Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .agents/context/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Read them before making changes; if they disagree with this file, they win.
`#internals/*`, `#theming/*` and `#animations/*` aliases. The theme aggregator of a component
is imported through `#themes/*`.
- `src/extras/`: opt-in add-ons, published under `igniteui-webcomponents/extras`. A new add-on gets its own
subpath export, so an import pulls in only its own dependencies
directory with a `README.md` that the main README links, and its own subpath export, so an import pulls in only its
own dependencies
- `src/styles/`: global SCSS utilities, mixins and themes
- `src/index.ts`: the public entry point of the package
- `stories/`: Storybook stories, one per component tag
Expand Down
6 changes: 4 additions & 2 deletions .github/CODING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ entry in `package.json` holds the same list.
src/
├── animations/ # Animation players and presets → #animations/*
├── components/ # One directory per component, each with its own spec.md
├── extras/ # Opt-in add-ons, published under `igniteui-webcomponents/extras`
├── extras/ # Opt-in add-ons, one directory each with a README.md, published under `igniteui-webcomponents/extras`
├── internals/ # Shared building blocks, never public API → #internals/*
├── styles/ # Global SCSS: utilities, mixins, themes
├── theming/ # Theming controller and types → #theming/*
Expand Down Expand Up @@ -637,6 +637,7 @@ Each component has tests in `[component].spec.ts`. They cover:
| `value-state.spec.js` | `runValueStateMotionTests` |
| `fast-check-setup.spec.js` | `fc` with the seed, `SLOW_PROPERTY_RUNS`, `orderedPair` and `withFixture` |
| `date-arbitraries.spec.js` | Date arbitraries, wall clocks and `assumeWallClock` for date properties |
| `qr-decoder.spec.js` | `prepareQrDecoder`, `readQr` for an image and `readQrMatrix` for a QR matrix |

Use the simulated events, not `element.click()` or a hand-built `KeyboardEvent`. They send
the full event sequence of a real user interaction.
Expand Down Expand Up @@ -1062,7 +1063,8 @@ edits.

## Specifications

Each public component directory has a `spec.md`: the behavioral contract of the component.
Each public component directory has a `spec.md`: the behavioral contract of the component. An extra that no component
specification covers, such as `src/extras/qr-payloads`, has one too.
JSDoc documents one API member. The specification documents the whole component: its purpose,
its behavior, its keyboard and assistive technology support, its test coverage, and its
limits.
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `dot-style`, `square-style` and `corner-dot-style` take `squircle`, a square with soft corners.
- `corner-dot-style` sets the shape of the inner corner dots. When you do not set it, the inner corner dots use `dot-style`, as before.
- `dot-scale` sets the size of the data modules, from 0.7 to 1 of their cell, to leave a gap between them. The corners keep their full size.
- The `alignment` CSS part styles the alignment patterns. They take `--ig-qr-code-dark-color`.
- `dot-style` takes `diamond`, `plus`, `liquid`, `horizontal-bars` and `vertical-bars`. `liquid` fills the inside corners where `rounded` modules join. A bar style draws each run of dark modules in a row or a column as one bar with round ends. Without `corner-dot-style`, the corner dots draw `diamond` and `plus` as `square`, and the other new styles as `rounded`.
- `square-style` and `corner-dot-style` take `leaf`, a square with two opposite round corners on the diagonal toward the center of the code. In a `circle` corner square, a `leaf` corner dot draws as a circle.
- `gradient` paints the data modules, the alignment patterns and the corners with a `linear` or `radial` gradient, from `--ig-qr-code-gradient-start` to `--ig-qr-code-gradient-end`. `gradient-angle` turns a linear gradient. An explicit `--ig-qr-code-corner-square-color` or `--ig-qr-code-corner-dot-color` wins for its part. Keep both colors much darker than the background.
- `logo-shape` clips the logo to a `circle`, `rounded` or `squircle` shape that fills the logo box. The cutout removes only the modules under the shape.
- `createWifiPayload()`, `createVCardPayload()`, `createEpcPayload()` and `createEventPayload()` from `igniteui-webcomponents/extras/qr-payloads` build the value of a code that a phone turns into a Wi-Fi login, a contact card, a SEPA payment or a calendar event. They escape the text and throw a `RangeError` for input that the format does not allow.

### Changed
- #### Button group, Checkbox, Chip, Color picker, Combo, Date picker, Date range picker, Date time input, File input, Input, List, Mask input, Navigation drawer, Radio, Select, Switch, Textarea, Tree
Expand Down Expand Up @@ -39,8 +45,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- #### Library
- The library supports the last 2 major versions of Chrome, Edge, Firefox, Opera and Safari. The fallbacks for older browsers are removed, and the styles no longer have vendor prefixes for them.
- #### QR code
- The code splits its value into numeric, alphanumeric and byte segments with the fewest bits. A value that mixes long runs of digits or uppercase letters with other text, such as an order number in a URL, can get a smaller version. A scanner reads the same text.
- The cutout under the logo holds whole modules, so it cuts no module in part.
- `logoSize` is a share of the code without its quiet zone, so `margin` no longer changes the logo. At the default `margin`, logos are smaller than before: 28% smaller in side on a version 1 code, and 4% on a version 40 code.
- `logoSize` is a share of the code without its quiet zone, so `margin` no longer changes the logo. At the default `margin`, logos are smaller than before: 28% smaller in side on a version 1 code, and 4% on a version 40 code. The old size covered more than the safe area of level `M`: 5.9% of a version 3 code at the default `margin`, against 4%.
- Each module covers a whole number of pixels, so the edges are sharp. The pixels that are left over widen the quiet zone, so the code can be smaller than `size`, and `margin` is a minimum. An export gets whole pixels at its own size.
- The alignment patterns take the shapes of the corners: a ring of `square-style` around a dot of the corner dot style. A `rounded` module no longer joins them.
- With a logo, a `rounded` module ends round at the edge of the cutout, and so do the `liquid` modules and the bars. Before, a `rounded` module next to the cutout was cut straight.
- #### Radio
- Each radio keeps its own default, as a native radio does. The `checked` attribute of one radio no longer clears `defaultChecked` of the other radios of its group. As before, the last radio with the `checked` attribute is checked at the start and after a form reset.
- `checkValidity()` and `reportValidity()` emit `invalid` on the radios of the group in DOM order. Before, the other radios emitted it first, and the called radio last.
Expand Down Expand Up @@ -95,6 +105,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- A formatted value that you empty submits nothing. Before, the form submitted the empty mask, such as `__-__`.
- #### QR code
- A logo no longer makes a short value unreadable. The component selects a larger version, so that the logo hides no more codewords than the error correction recovers. When you set `version`, the logo gets smaller.
- A code with `square-style="circle"` no longer fails to scan at some sizes, about 1 time in 10. For this fix, a `square` corner dot in a `circle` corner square draws as a circle.
- #### Radio
- The validity of a group changes at once when a radio joins or leaves the group, and on a form reset. A radio joins or leaves by `name`, by form owner or by a DOM change. A removed radio has the validity of a group of its own, as a native radio does. Before, the other radios kept the old validity. A group stayed invalid after its required radio left. After a form reset, the validity was correct only after the next render.
- A checked radio that joins a group, by connect, `name` or form owner, unchecks the other radios of the group, as a native radio does. Before, two radios of the group could stay checked.
Expand Down
22 changes: 5 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,11 @@ The condition names are `igc-theme-material`, `igc-theme-bootstrap`, `igc-theme-

The extras are opt-in add-ons that build on the public API of the components. A bundle that does not import them does not contain them. Each one has its own entry point, so it needs only its own dependencies.

- `createMarkdownRenderer()` from `igniteui-webcomponents/extras` renders the chat messages from Markdown, with syntax highlighting. It imports the optional peer dependencies `marked` and `dompurify`, and loads `shiki` for the highlighting.
- `bindComboDataSource()` from `igniteui-webcomponents/extras/combo-data-source` binds a combo to a server that searches and pages. It sets `totalItemCount` from the total of the server, so the list shows a placeholder row for each item to load, and `loading` while a search waits or a page loads.

```ts
import { bindComboDataSource } from 'igniteui-webcomponents/extras/combo-data-source';

const binding = bindComboDataSource(combo, {
load: async ({ searchText, caseSensitive, startIndex, count }, signal) => {
const query = `q=${encodeURIComponent(searchText)}&case=${caseSensitive}&skip=${startIndex}&top=${count}`;
const response = await fetch(`/api/cities?${query}`, { signal });
const { items, total } = await response.json();
return { items, totalCount: total };
},
});

binding.dispose(); // removes the listeners, aborts the request in flight and clears `totalItemCount` and `loading`
```
| Extra | Entry point | Use |
| ----- | ----------- | --- |
| [Chat Markdown renderer](./src/extras/chat-markdown-renderer/README.md) | `igniteui-webcomponents/extras` | Renders the chat messages from Markdown, with syntax highlighting. |
| [Combo data source](./src/extras/combo-data-source/README.md) | `igniteui-webcomponents/extras/combo-data-source` | Binds a combo to a server that searches and pages. |
| [QR payloads](./src/extras/qr-payloads/README.md) | `igniteui-webcomponents/extras/qr-payloads` | Builds QR code values for a Wi-Fi login, a contact card, a SEPA payment and a calendar event. |

## Browser support

Expand Down
56 changes: 45 additions & 11 deletions api-reference/igc-qr-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ defineComponents(IgcQrCodeComponent);
`undefined` or remove the attribute.
- `size`: `number`. Default: `128`. Attribute: `size`.
The size of the QR code in pixels. This determines the width and height of the generated QR code. The default value is 128 pixels.

Each module covers a whole number of pixels, so the edges stay sharp. The pixels that are
left over widen the quiet zone, and the code can be smaller than `size`. An exported image
gets whole pixels at its own size.
- `margin`: `number`. Default: `4`. Attribute: `margin`.
The margin (quiet zone) around the QR code, expressed as a number of QR code modules rather
than pixels. This is the blank border area surrounding the code, which helps ensure that it
can be properly scanned.
can be properly scanned. It is a minimum: spare pixels make the quiet zone wider.
- `logoSrc`: `string | undefined`. Attribute: `logo-src`.
The source URL of an optional logo image at the center of the QR code.
The component does not render a logo that fails to load, a `javascript:` or `vbscript:` URL,
Expand All @@ -56,21 +60,48 @@ defineComponents(IgcQrCodeComponent);
- `logoMargin`: `number | undefined`. Attribute: `logo-margin`.
The margin around the logo in pixels. This is the whitespace area surrounding the logo within the QR code,
which helps ensure that the logo does not interfere with the QR code's scannability.
- `dotStyle`: `'square' | 'circle' | 'rounded' | 'squircle'`. Default: `'square'`. Attribute: `dot-style`.
- `logoShape`: `'square' | 'circle' | 'rounded' | 'squircle'`. Default: `'square'`. Attribute: `logo-shape`.
The shape of the logo: 'square', 'circle', 'rounded' or 'squircle'. The shape fills the logo
box, so a 'circle' logo with a wide image is an ellipse. The image is clipped to the shape,
and the cutout holds only the modules that the shape covers, in part or in full.
- `dotStyle`: `'square' | 'circle' | 'rounded' | 'squircle' | 'diamond' | 'plus' | 'liquid' | 'horizontal-bars' | 'vertical-bars'`. Default: `'square'`. Attribute: `dot-style`.
The style of the data modules (dots) in the QR code. This can be 'square', 'circle',
'rounded', or 'squircle'. The inner dot of each finder-pattern corner uses the same style
unless `cornerDotStyle` is set.
'rounded', 'squircle', 'diamond', 'plus', 'liquid', 'horizontal-bars' or 'vertical-bars'.
'liquid' is 'rounded' with a smooth fill in the inside corners where modules join. The bar
styles draw each run of dark modules in a row or a column as one bar with round ends.

The inner dot of each finder-pattern corner uses the same style unless `cornerDotStyle` is
set. It draws 'diamond' and 'plus' as 'square', and 'liquid' and the bar styles as
'rounded'.
- `dotScale`: `number`. Default: `1`. Attribute: `dot-scale`.
The size of each data module, as a ratio of its cell in the module grid. The value is a
number from 0.7 to 1. Other values are clamped. A value below 1 leaves a gap between the
modules, so 'rounded' modules do not join their neighbors. The finder-pattern corners keep
their full size. A smaller value can make the code harder to scan with a camera.
- `squareStyle`: `'square' | 'circle' | 'rounded' | 'squircle'`. Default: `'square'`. Attribute: `square-style`.
modules, so 'rounded' modules do not join their neighbors, and 'liquid' draws as 'rounded'.
For the bar styles, it sets the thickness of the bars and shortens their ends. The
finder-pattern corners keep their full size. A smaller value can make the code harder to
scan with a camera.
- `squareStyle`: `'square' | 'circle' | 'rounded' | 'squircle' | 'leaf'`. Default: `'square'`. Attribute: `square-style`.
The style of the corner squares in the QR code. This can be 'square', 'circle', 'rounded',
or 'squircle'.
- `cornerDotStyle`: `'square' | 'circle' | 'rounded' | 'squircle' | undefined`. Attribute: `corner-dot-style`.
'squircle' or 'leaf'. A 'leaf' has two opposite round corners on the diagonal toward the
center of the code. The rings of the alignment patterns use the same style, and a 'leaf'
ring there has the shape of the top-left corner square.
- `cornerDotStyle`: `'square' | 'circle' | 'rounded' | 'squircle' | 'leaf' | undefined`. Attribute: `corner-dot-style`.
The style of the inner dot of each finder-pattern corner. This can be 'square', 'circle',
'rounded', or 'squircle'. When it is not set, the inner dot uses `dotStyle`.
'rounded', 'squircle' or 'leaf'. When it is not set, the inner dot uses `dotStyle`. The
centers of the alignment patterns use the same style.

In a 'circle' corner square, a 'square' or 'leaf' dot draws as 'circle', because scanners
do not find the pattern reliably with corners in a round ring.
- `gradient`: `'linear' | 'radial' | undefined`. Attribute: `gradient`.
The gradient of the dark modules: 'linear' or 'radial'. When it is not set, or has another
value, the modules have one color. The gradient goes from `--ig-qr-code-gradient-start` to
`--ig-qr-code-gradient-end` over the code without its quiet zone. It also paints the corners,
unless `--ig-qr-code-corner-square-color` or `--ig-qr-code-corner-dot-color` is set.

Keep both colors much darker than the background.
- `gradientAngle`: `number`. Default: `0`. Attribute: `gradient-angle`.
The angle of a 'linear' gradient in degrees, clockwise. At 0 the gradient goes from left to
right, and at 90 from top to bottom.

## Methods

Expand Down Expand Up @@ -109,10 +140,13 @@ defineComponents(IgcQrCodeComponent);
- `dots`: The data modules (dots) of the QR code.
- `corner-square`: The outer corner (finder-pattern) squares of the QR code.
- `corner-dot`: The inner corner (finder-pattern) dots of the QR code.
- `alignment`: The alignment patterns of the QR code, from version 2.

## CSS custom properties

- `--ig-qr-code-background`: The background color of the QR code. Default is `white`.
- `--ig-qr-code-dark-color`: The color of the data modules (dots), and the corner square/dot colors unless overridden below. Default is `black`.
- `--ig-qr-code-dark-color`: The color of the data modules (dots) and the alignment patterns, and the corner square/dot colors unless overridden below. Default is `black`.
- `--ig-qr-code-corner-square-color`: The color of the outer finder-pattern corner squares. Defaults to `--ig-qr-code-dark-color`.
- `--ig-qr-code-corner-dot-color`: The color of the inner finder-pattern corner dots. Defaults to `--ig-qr-code-dark-color`.
- `--ig-qr-code-gradient-start`: The start color of the `gradient`. Defaults to `--ig-qr-code-dark-color`.
- `--ig-qr-code-gradient-end`: The end color of the `gradient`. Defaults to `--ig-qr-code-dark-color`.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
".": "./src/index.js",
"./types": "./src/types.js",
"./extras": "./src/extras/index.js",
"./extras/combo-data-source": "./src/extras/combo-data-source.js"
"./extras/combo-data-source": "./src/extras/combo-data-source/combo-data-source.js",
"./extras/qr-payloads": "./src/extras/qr-payloads/qr-payloads.js"
},
"imports": {
"#internals/*.js": "./src/internals/*.ts",
Expand Down
Loading