igniteui-webcomponents 7.3.0 → 7.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +30 -0
- package/components/avatar/avatar.d.ts +1 -2
- package/components/avatar/avatar.js +4 -8
- package/components/avatar/avatar.js.map +1 -1
- package/components/badge/badge.d.ts +6 -1
- package/components/badge/badge.js +8 -5
- package/components/badge/badge.js.map +1 -1
- package/components/badge/themes/badge.base.css.js +1 -1
- package/components/badge/themes/badge.base.css.js.map +1 -1
- package/components/chip/chip.d.ts +30 -14
- package/components/chip/chip.js +54 -48
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/dark/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js +1 -1
- package/components/chip/themes/dark/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js +1 -1
- package/components/chip/themes/dark/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/dark/chip.material.css.js +1 -1
- package/components/chip/themes/dark/chip.material.css.js.map +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/light/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/light/chip.fluent.css.js +1 -1
- package/components/chip/themes/light/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/light/chip.indigo.css.js +1 -1
- package/components/chip/themes/light/chip.indigo.css.js.map +1 -1
- package/components/chip/themes/light/chip.material.css.js +1 -1
- package/components/chip/themes/light/chip.material.css.js.map +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js +1 -1
- package/components/chip/themes/shared/chip.bootstrap.css.js.map +1 -1
- package/components/chip/themes/shared/chip.common.css.js +1 -1
- package/components/chip/themes/shared/chip.common.css.js.map +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js +1 -1
- package/components/chip/themes/shared/chip.fluent.css.js.map +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js.map +1 -1
- package/components/color-picker/color-picker.d.ts +2 -2
- package/components/color-picker/color-picker.js.map +1 -1
- package/components/color-picker/picker-canvas.js +2 -1
- package/components/color-picker/picker-canvas.js.map +1 -1
- package/components/textarea/textarea.d.ts +2 -15
- package/components/textarea/textarea.js +48 -93
- package/components/textarea/textarea.js.map +1 -1
- package/components/tile-manager/position.d.ts +2 -9
- package/components/tile-manager/position.js +27 -42
- package/components/tile-manager/position.js.map +1 -1
- package/components/tile-manager/resize-state.d.ts +11 -22
- package/components/tile-manager/resize-state.js +60 -119
- package/components/tile-manager/resize-state.js.map +1 -1
- package/components/tile-manager/resize-util.d.ts +3 -7
- package/components/tile-manager/resize-util.js +65 -72
- package/components/tile-manager/resize-util.js.map +1 -1
- package/components/tile-manager/serializer.d.ts +1 -1
- package/components/tile-manager/serializer.js +9 -10
- package/components/tile-manager/serializer.js.map +1 -1
- package/components/tile-manager/themes/shared/tile/tile.common.css.js +1 -1
- package/components/tile-manager/themes/shared/tile/tile.common.css.js.map +1 -1
- package/components/tile-manager/themes/tile.base.css.js +1 -1
- package/components/tile-manager/themes/tile.base.css.js.map +1 -1
- package/components/tile-manager/tile-ghost-util.js +16 -20
- package/components/tile-manager/tile-ghost-util.js.map +1 -1
- package/components/tile-manager/tile-manager.d.ts +5 -2
- package/components/tile-manager/tile-manager.js +27 -23
- package/components/tile-manager/tile-manager.js.map +1 -1
- package/components/tile-manager/tile.d.ts +32 -18
- package/components/tile-manager/tile.js +181 -161
- package/components/tile-manager/tile.js.map +1 -1
- package/components/tile-manager/types.d.ts +1 -5
- package/components/tile-manager/types.js.map +1 -1
- package/custom-elements.json +498 -853
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +1 -0
- package/index.js.map +1 -1
- package/internals/directives/drag.d.ts +144 -0
- package/internals/directives/drag.js +278 -0
- package/internals/directives/drag.js.map +1 -0
- package/internals/directives/resize.d.ts +109 -0
- package/internals/directives/resize.js +214 -0
- package/internals/directives/resize.js.map +1 -0
- package/internals/templates/input-shell.d.ts +12 -1
- package/internals/templates/input-shell.js +17 -10
- package/internals/templates/input-shell.js.map +1 -1
- package/internals/utils/dom.d.ts +2 -0
- package/internals/utils/dom.js +3 -0
- package/internals/utils/dom.js.map +1 -1
- package/internals/utils/events.d.ts +2 -0
- package/internals/utils/events.js +3 -0
- package/internals/utils/events.js.map +1 -1
- package/package.json +1 -1
- package/skills/README.md +1 -0
- package/web-types.json +2 -2
- package/components/resize-container/default-ghost.d.ts +0 -5
- package/components/resize-container/default-ghost.js +0 -20
- package/components/resize-container/default-ghost.js.map +0 -1
- package/components/resize-container/resize-container.d.ts +0 -60
- package/components/resize-container/resize-container.js +0 -156
- package/components/resize-container/resize-container.js.map +0 -1
- package/components/resize-container/resize-controller.d.ts +0 -46
- package/components/resize-container/resize-controller.js +0 -195
- package/components/resize-container/resize-controller.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.bootstrap.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.fluent.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.indigo.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.material.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.material.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.material.css.js.map +0 -1
- package/components/resize-container/themes/dark/resize-indicator.shared.css.d.ts +0 -1
- package/components/resize-container/themes/dark/resize-indicator.shared.css.js +0 -3
- package/components/resize-container/themes/dark/resize-indicator.shared.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.bootstrap.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.fluent.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.fluent.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.fluent.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.indigo.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.indigo.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.indigo.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.material.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.material.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.material.css.js.map +0 -1
- package/components/resize-container/themes/light/resize-indicator.shared.css.d.ts +0 -1
- package/components/resize-container/themes/light/resize-indicator.shared.css.js +0 -3
- package/components/resize-container/themes/light/resize-indicator.shared.css.js.map +0 -1
- package/components/resize-container/themes/resize-container.base.css.d.ts +0 -1
- package/components/resize-container/themes/resize-container.base.css.js +0 -3
- package/components/resize-container/themes/resize-container.base.css.js.map +0 -1
- package/components/resize-container/themes/shared/resize-container.common.css.d.ts +0 -1
- package/components/resize-container/themes/shared/resize-container.common.css.js +0 -3
- package/components/resize-container/themes/shared/resize-container.common.css.js.map +0 -1
- package/components/resize-container/themes/themes.d.ts +0 -2
- package/components/resize-container/themes/themes.js +0 -47
- package/components/resize-container/themes/themes.js.map +0 -1
- package/components/resize-container/types.d.ts +0 -40
- package/components/resize-container/types.js +0 -2
- package/components/resize-container/types.js.map +0 -1
- package/internals/controllers/drag.d.ts +0 -166
- package/internals/controllers/drag.js +0 -283
- package/internals/controllers/drag.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,46 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [7.3.1] - 2026-09-01
|
|
10
|
+
### Added
|
|
11
|
+
- #### Color picker
|
|
12
|
+
- `IgcColorPickerComponentEventMap` is now exported from the package entry point. [#2360](https://github.com/IgniteUI/igniteui-webcomponents/pull/2360)
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- #### Avatar
|
|
16
|
+
- The component now exposes `role="img"`. Before, it declared `image`, which is an ARIA 1.3 token that current tools do not know. [#2363](https://github.com/IgniteUI/igniteui-webcomponents/pull/2363)
|
|
17
|
+
- The accessible name now comes from `alt`, and then from `initials`. The role description is the static string `avatar`. Before, the two were inverted: the name was always the literal "avatar", and `alt` or `initials` became the role description.
|
|
18
|
+
- #### Badge
|
|
19
|
+
- The role description is the static string `badge`. The visual `variant` no longer reaches assistive technology. `role="status"` is unchanged. [#2363](https://github.com/IgniteUI/igniteui-webcomponents/pull/2363)
|
|
20
|
+
- The `icon` CSS part now applies only when an `igc-icon` is the only content of the badge, as the documentation already stated.
|
|
21
|
+
- #### Chip
|
|
22
|
+
- **Breaking for custom styles:** `part="base"` is now a plain wrapper. The selection control moved to the new `action` part, and the remove control to the new `remove` part. Move rules that target `::part(base)` for the interactive surface to `::part(action)`. [#2362](https://github.com/IgniteUI/igniteui-webcomponents/pull/2362)
|
|
23
|
+
- `igcRemove` is typed `CustomEvent<void>`. The type declared a boolean detail that the event never carried.
|
|
24
|
+
- The `start` and `end` slots, and the `action` and `remove` parts, are documented. Thus they reach the custom elements manifest.
|
|
25
|
+
- #### Tile manager
|
|
26
|
+
- `igc-tile` renders its resize handles directly. Before, an internal element rendered them and exported the parts. The `trigger-side`, `trigger` and `trigger-bottom` parts keep their names, and the new `tile-container` part wraps the tile content together with the handles. [#2359](https://github.com/IgniteUI/igniteui-webcomponents/pull/2359)
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- #### Avatar
|
|
30
|
+
- The `<img>` element carried no `alt` attribute when you set no alt text. This is an `image-alt` violation in the page of the consumer. The component now renders `alt=""`, thus the image counts as decorative. [#2363](https://github.com/IgniteUI/igniteui-webcomponents/pull/2363)
|
|
31
|
+
- Removed the documented `icon` CSS part. The component never rendered it.
|
|
32
|
+
- #### Badge
|
|
33
|
+
- A badge that holds an `igc-icon` together with text lost its inline padding and clipped the text under `overflow: hidden`. The `icon` part became active for any slotted icon, but the padding rule matched `[part='base']` exactly and thus did not apply. [#2363](https://github.com/IgniteUI/igniteui-webcomponents/pull/2363)
|
|
34
|
+
- #### Chip
|
|
35
|
+
- A removable chip failed the `nested-interactive` accessibility audit. The chip rendered its full surface as a button, and the remove icon inside it declared `role="button"` and `tabindex="0"`. The two controls are now siblings. [#2362](https://github.com/IgniteUI/igniteui-webcomponents/pull/2362)
|
|
36
|
+
- The accessible name of the chip read "Chip remove chip" or "select chip Chip", because the labels of the remove icon and of the selection icon became part of it. The name is now the content of the chip.
|
|
37
|
+
- `Space` did not toggle the selection, and `igcRemove` fired on chips that are not removable. The remove keybindings applied to the host and cancelled the activation keys of the chip. They now apply to the remove control only.
|
|
38
|
+
- Focus on the remove control now also shows the focus state of the chip.
|
|
39
|
+
- The prefix wrapper hides only when the chip is selectable and selected, and the suffix wrapper no longer hides because of `removable`.
|
|
40
|
+
- #### Color picker
|
|
41
|
+
- The picker canvas did not respond to touch input. [#2357](https://github.com/IgniteUI/igniteui-webcomponents/pull/2357)
|
|
42
|
+
- #### Textarea
|
|
43
|
+
- A change of `resize` away from `auto` did not release the inline height. Thus the control stayed at its last automatic height. [#2361](https://github.com/IgniteUI/igniteui-webcomponents/pull/2361)
|
|
44
|
+
- Text that you project into the default slot now becomes the default value, as with a native `<textarea>`. Before, it became the value. Thus the control was not pristine, and a form reset cleared the visible text while the light DOM still held it.
|
|
45
|
+
- #### Tile manager
|
|
46
|
+
- A swap of two positioned tiles wrote a column value into `rowStart`. Thus the tiles moved to the wrong row. [#2359](https://github.com/IgniteUI/igniteui-webcomponents/pull/2359)
|
|
47
|
+
- A tile that you add next to a single positioned tile collided with it at position 0.
|
|
48
|
+
|
|
9
49
|
## [7.3.0] - 2026-08-26
|
|
10
50
|
### Added
|
|
11
51
|
- #### Calendar
|
|
@@ -1555,6 +1595,7 @@ Initial release of Ignite UI Web Components
|
|
|
1555
1595
|
- Ripple component
|
|
1556
1596
|
- Switch component
|
|
1557
1597
|
|
|
1598
|
+
[7.3.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.3.0...7.3.1
|
|
1558
1599
|
[7.3.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.2.4...7.3.0
|
|
1559
1600
|
[7.2.4]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.2.3...7.2.4
|
|
1560
1601
|
[7.2.3]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.2.2...7.2.3
|
package/README.md
CHANGED
|
@@ -26,6 +26,9 @@ See the [Storybook Here](https://igniteui.github.io/igniteui-webcomponents)
|
|
|
26
26
|
|
|
27
27
|
| Components | Status | Documentation | Released Version | License |
|
|
28
28
|
| :---------------------- | :----: | :----------------------------: | :--------------: | :------------: |
|
|
29
|
+
| Virtual Scroll | ✅ | [Storybook][Storybook] | [7.3.0] | [MIT](LICENSE) |
|
|
30
|
+
| QR Code | ✅ | [Storybook][Storybook] | [7.3.0] | [MIT](LICENSE) |
|
|
31
|
+
| Color Picker | ✅ | [Storybook][Storybook] | [7.3.0] | [MIT](LICENSE) |
|
|
29
32
|
| Splitter | ✅ | [Docs][Splitter Docs] | [7.1.0] | [MIT](LICENSE) |
|
|
30
33
|
| Chat | ✅ | [Docs][Chat Docs] | [6.3.0] | [MIT](LICENSE) |
|
|
31
34
|
| Date Range Picker | ✅ | [Docs][Date Range Picker Docs] | [6.1.0] | [MIT](LICENSE) |
|
|
@@ -148,6 +151,31 @@ Refer to the documentation of your editor of choice to see if you can take advan
|
|
|
148
151
|
| igniteui-webcomponents/igniteui-webcomponents.css-data.json | VSCode CSS custom data |
|
|
149
152
|
| igniteui-webcomponents/igniteui-webcomponents.html-data.json | VSCode HTML custom data |
|
|
150
153
|
|
|
154
|
+
### AI agent skills
|
|
155
|
+
|
|
156
|
+
The package also includes reusable skills for GitHub Copilot and other compatible AI agents. They provide task-specific guidance and current best practices for:
|
|
157
|
+
|
|
158
|
+
- [Choosing the right components](skills/igniteui-wc-choose-components/SKILL.md)
|
|
159
|
+
- [Integrating with React, Angular, Vue, or vanilla JavaScript](skills/igniteui-wc-integrate-with-framework/SKILL.md)
|
|
160
|
+
- [Customizing component themes](skills/igniteui-wc-customize-component-theme/SKILL.md)
|
|
161
|
+
- [Generating a view from an image or design](skills/igniteui-wc-generate-from-image-design/SKILL.md)
|
|
162
|
+
- [Optimizing bundle size](skills/igniteui-wc-optimize-bundle-size/SKILL.md)
|
|
163
|
+
- [Migrating from Grid Lite to the premium Data Grid](skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md)
|
|
164
|
+
|
|
165
|
+
After installing the package, copy the skills into your repository so your agent can discover them automatically:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
# Unix/macOS
|
|
169
|
+
cp -r node_modules/igniteui-webcomponents/skills/* .github/skills/
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```powershell
|
|
173
|
+
# Windows PowerShell
|
|
174
|
+
Copy-Item -Recurse node_modules\igniteui-webcomponents\skills\* .github\skills\
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
See the [AI agent skills guide](skills/README.md) for example prompts, supported workflows, and additional installation locations.
|
|
178
|
+
|
|
151
179
|
## Contributing
|
|
152
180
|
|
|
153
181
|
Follow the [Contribution Guidelines] to setup a development
|
|
@@ -199,6 +227,7 @@ npm run storybook:build
|
|
|
199
227
|
|
|
200
228
|
[Ignite UI for Web Components]: https://www.infragistics.com/products/ignite-ui-web-components
|
|
201
229
|
[Indigo.Design Design System]: https://www.infragistics.com/products/appbuilder/ui-toolkit
|
|
230
|
+
[Storybook]: https://igniteui.github.io/igniteui-webcomponents
|
|
202
231
|
[Ignite UI for WebComponents Grids]: https://www.npmjs.com/package/igniteui-webcomponents-grids
|
|
203
232
|
[Dock Manager Picture]: https://github.com/IgniteUI/igniteui-webcomponents/assets/52001020/a9643f17-f1c2-4554-87aa-96c9daea13b0
|
|
204
233
|
[Custom Elements Manifest]: https://github.com/webcomponents/custom-elements-manifest
|
|
@@ -282,3 +311,4 @@ npm run storybook:build
|
|
|
282
311
|
[6.1.0]: https://github.com/IgniteUI/igniteui-webcomponents/releases/tag/6.1.0
|
|
283
312
|
[6.3.0]: https://github.com/IgniteUI/igniteui-webcomponents/releases/tag/6.3.0
|
|
284
313
|
[7.1.0]: https://github.com/IgniteUI/igniteui-webcomponents/releases/tag/7.1.0
|
|
314
|
+
[7.3.0]: https://github.com/IgniteUI/igniteui-webcomponents/releases/tag/7.3.0
|
|
@@ -6,12 +6,11 @@ import type { AvatarShape } from '../types.js';
|
|
|
6
6
|
*
|
|
7
7
|
* @element igc-avatar
|
|
8
8
|
*
|
|
9
|
-
* @slot - Renders an icon inside the default slot.
|
|
9
|
+
* @slot - Renders an icon inside the default slot. Ignored when `initials` is set.
|
|
10
10
|
*
|
|
11
11
|
* @csspart base - The base wrapper of the avatar.
|
|
12
12
|
* @csspart initials - The initials wrapper of the avatar.
|
|
13
13
|
* @csspart image - The image wrapper of the avatar.
|
|
14
|
-
* @csspart icon - The icon wrapper of the avatar.
|
|
15
14
|
*/
|
|
16
15
|
export default class IgcAvatarComponent extends LitElement {
|
|
17
16
|
static readonly tagName = "igc-avatar";
|
|
@@ -6,7 +6,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement, nothing } from 'lit';
|
|
8
8
|
import { property, state } from 'lit/decorators.js';
|
|
9
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
9
|
import { addInternalsController } from '#internals/controllers/internals.js';
|
|
11
10
|
import { registerComponent } from '#internals/definitions/register.js';
|
|
12
11
|
import { addThemingController } from '#theming/theming-controller.js';
|
|
@@ -25,11 +24,8 @@ export default class IgcAvatarComponent extends LitElement {
|
|
|
25
24
|
this.shape = 'square';
|
|
26
25
|
addThemingController(this, all);
|
|
27
26
|
addInternalsController(this, {
|
|
28
|
-
initialARIA: {
|
|
29
|
-
|
|
30
|
-
ariaLabel: 'avatar',
|
|
31
|
-
},
|
|
32
|
-
aria: () => ({ ariaRoleDescription: this.alt ?? this.initials ?? null }),
|
|
27
|
+
initialARIA: { role: 'img', ariaRoleDescription: 'avatar' },
|
|
28
|
+
aria: () => ({ ariaLabel: this.alt ?? this.initials ?? null }),
|
|
33
29
|
});
|
|
34
30
|
}
|
|
35
31
|
willUpdate(changedProperties) {
|
|
@@ -50,8 +46,8 @@ export default class IgcAvatarComponent extends LitElement {
|
|
|
50
46
|
? html `
|
|
51
47
|
<img
|
|
52
48
|
part="image"
|
|
53
|
-
alt=${
|
|
54
|
-
src=${
|
|
49
|
+
alt=${this.alt ?? ''}
|
|
50
|
+
src=${this.src}
|
|
55
51
|
@error=${this._handleError}
|
|
56
52
|
/>
|
|
57
53
|
`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/components/avatar/avatar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/components/avatar/avatar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO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B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;;UAGL,IAAI,CAAC,QAAQ;YACX,CAAC,CAAC,IAAI,CAAA,yBAAyB,IAAI,CAAC,QAAQ,SAAS;YACrD,CAAC,CAAC,IAAI,CAAA,eACV;UAEE,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS;YACzB,CAAC,CAAC,IAAI,CAAA;;;wBAGM,IAAI,CAAC,GAAG,IAAI,EAAE;wBACd,IAAI,CAAC,GAAG;2BACL,IAAI,CAAC,YAAY;;eAE7B;YACH,CAAC,CAAC,OACN;;KAEH,CAAC;IACJ,CAAC;;AAxEO;IADP,KAAK,EAAE;qDACkB;AAOnB;IADN,QAAQ,EAAE;+CACS;AAOb;IADN,QAAQ,EAAE;+CACS;AAOb;IADN,QAAQ,EAAE;oDACc;AAOlB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACS","sourcesContent":["import { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { addInternalsController } from '#internals/controllers/internals.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport type { AvatarShape } from '../types.js';\nimport { styles } from './themes/avatar.base.css.js';\nimport { styles as shared } from './themes/shared/avatar.common.css.js';\nimport { all } from './themes/themes.js';\n\n/**\n * An avatar component is used as a representation of a user identity\n * typically in a user profile.\n *\n * @element igc-avatar\n *\n * @slot - Renders an icon inside the default slot. Ignored when `initials` is set.\n *\n * @csspart base - The base wrapper of the avatar.\n * @csspart initials - The initials wrapper of the avatar.\n * @csspart image - The image wrapper of the avatar.\n */\nexport default class IgcAvatarComponent extends LitElement {\n public static readonly tagName = 'igc-avatar';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcAvatarComponent);\n }\n\n @state()\n private _hasError = false;\n\n /**\n * The image source to use.\n * @attr\n */\n @property()\n public src?: string;\n\n /**\n * Alternative text for the image.\n * @attr\n */\n @property()\n public alt?: string;\n\n /**\n * Initials to use as a fallback when no image is available.\n * @attr\n */\n @property()\n public initials?: string;\n\n /**\n * The shape of the avatar.\n * @attr\n */\n @property({ reflect: true })\n public shape: AvatarShape = 'square';\n\n constructor() {\n super();\n addThemingController(this, all);\n\n addInternalsController(this, {\n initialARIA: { role: 'img', ariaRoleDescription: 'avatar' },\n aria: () => ({ ariaLabel: this.alt ?? this.initials ?? null }),\n });\n }\n\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('src')) {\n this._hasError = false;\n }\n }\n\n protected _handleError(): void {\n this._hasError = true;\n }\n\n protected override render() {\n return html`\n <div part=\"base\">\n ${\n this.initials\n ? html`<span part=\"initials\">${this.initials}</span>`\n : html`<slot></slot>`\n }\n ${\n this.src && !this._hasError\n ? html`\n <img\n part=\"image\"\n alt=${this.alt ?? ''}\n src=${this.src}\n @error=${this._handleError}\n />\n `\n : nothing\n }\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-avatar': IgcAvatarComponent;\n }\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import type { BadgeShape, StyleVariant } from '../types.js';
|
|
|
9
9
|
* @slot - Default slot for the badge content.
|
|
10
10
|
*
|
|
11
11
|
* @csspart base - The base wrapper of the badge.
|
|
12
|
-
* @csspart icon - The icon container, present when an icon
|
|
12
|
+
* @csspart icon - The icon container, present when an `igc-icon` is the only slotted element.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```html
|
|
@@ -54,6 +54,11 @@ export default class IgcBadgeComponent extends LitElement {
|
|
|
54
54
|
*/
|
|
55
55
|
dot: boolean;
|
|
56
56
|
constructor();
|
|
57
|
+
/**
|
|
58
|
+
* The `icon` part is reserved for a badge whose only content is a single
|
|
59
|
+
* `igc-icon`, which renders as a circle rather than a padded pill. The filter
|
|
60
|
+
* discards the whitespace text nodes that formatted markup leaves around it.
|
|
61
|
+
*/
|
|
57
62
|
protected _handleSlotChange(): void;
|
|
58
63
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
59
64
|
}
|
|
@@ -10,6 +10,8 @@ import { addInternalsController } from '#internals/controllers/internals.js';
|
|
|
10
10
|
import { addSlotController, setSlots } from '#internals/controllers/slot.js';
|
|
11
11
|
import { registerComponent } from '#internals/definitions/register.js';
|
|
12
12
|
import { partMap } from '#internals/part-map.js';
|
|
13
|
+
import { isEmpty } from '#internals/utils/arrays.js';
|
|
14
|
+
import { isElement } from '#internals/utils/dom.js';
|
|
13
15
|
import { addThemingController } from '#theming/theming-controller.js';
|
|
14
16
|
import { styles } from './themes/badge.base.css.js';
|
|
15
17
|
import { styles as shared } from './themes/shared/badge.common.css.js';
|
|
@@ -33,14 +35,15 @@ export default class IgcBadgeComponent extends LitElement {
|
|
|
33
35
|
this.dot = false;
|
|
34
36
|
addThemingController(this, all);
|
|
35
37
|
addInternalsController(this, {
|
|
36
|
-
initialARIA: { role: 'status' },
|
|
37
|
-
aria: () => ({ ariaRoleDescription: `badge ${this.variant}` }),
|
|
38
|
+
initialARIA: { role: 'status', ariaRoleDescription: 'badge' },
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
_handleSlotChange() {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const [content, ...rest] = this._slots
|
|
43
|
+
.getAssignedNodes('[default]')
|
|
44
|
+
.filter((node) => isElement(node) || node.textContent?.trim());
|
|
45
|
+
this._hasIcon =
|
|
46
|
+
isEmpty(rest) && isElement(content) && content.matches('igc-icon');
|
|
44
47
|
}
|
|
45
48
|
render() {
|
|
46
49
|
return html `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/components/badge/badge.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM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9B,QAAG,GAAG,KAAK,CAAC;QAKjB,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAEhC,sBAAsB,CAAC,IAAI,EAAE;YAC3B,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE;SAC9D,CAAC,CAAC;IACL,CAAC;IAOS,iBAAiB;QACzB,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM;aACnC,gBAAgB,CAAC,WAAW,CAAC;aAC7B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAEjE,IAAI,CAAC,QAAQ;YACX,OAAO,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACvE,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA;mBACI,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;;;KAG1D,CAAC;IACJ,CAAC;;AA5DM;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACa;AASlC;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACnB;AASjB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDACS;AAU9B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACxB","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { addInternalsController } from '#internals/controllers/internals.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport { isElement } from '#internals/utils/dom.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport type { BadgeShape, StyleVariant } from '../types.js';\nimport { styles } from './themes/badge.base.css.js';\nimport { styles as shared } from './themes/shared/badge.common.css.js';\nimport { all } from './themes/themes.js';\n\n/**\n * The badge is a component indicating a status on a related item or an area\n * where some active indication is required.\n *\n * @element igc-badge\n *\n * @slot - Default slot for the badge content.\n *\n * @csspart base - The base wrapper of the badge.\n * @csspart icon - The icon container, present when an `igc-icon` is the only slotted element.\n *\n * @example\n * ```html\n * <igc-badge variant=\"success\">New</igc-badge>\n * <igc-badge variant=\"danger\" shape=\"square\">5</igc-badge>\n * <igc-badge dot></igc-badge>\n * ```\n */\nexport default class IgcBadgeComponent extends LitElement {\n public static readonly tagName = 'igc-badge';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcBadgeComponent);\n }\n\n private readonly _slots = addSlotController(this, {\n slots: setSlots(),\n onChange: this._handleSlotChange,\n });\n\n private _hasIcon = false;\n\n /**\n * The type (style variant) of the badge.\n *\n * @attr variant\n * @default 'primary'\n */\n @property({ reflect: true })\n public variant: StyleVariant = 'primary';\n\n /**\n * Sets whether to draw an outlined version of the badge.\n *\n * @attr outlined\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public outlined = false;\n\n /**\n * The shape of the badge.\n *\n * @attr shape\n * @default 'rounded'\n */\n @property({ reflect: true })\n public shape: BadgeShape = 'rounded';\n\n /**\n * Sets whether to render a dot type badge.\n * When enabled, the badge appears as a small dot without any content.\n *\n * @attr dot\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public dot = false;\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n addInternalsController(this, {\n initialARIA: { role: 'status', ariaRoleDescription: 'badge' },\n });\n }\n\n /**\n * The `icon` part is reserved for a badge whose only content is a single\n * `igc-icon`, which renders as a circle rather than a padded pill. The filter\n * discards the whitespace text nodes that formatted markup leaves around it.\n */\n protected _handleSlotChange(): void {\n const [content, ...rest] = this._slots\n .getAssignedNodes('[default]')\n .filter((node) => isElement(node) || node.textContent?.trim());\n\n this._hasIcon =\n isEmpty(rest) && isElement(content) && content.matches('igc-icon');\n }\n\n protected override render() {\n return html`\n <span part=${partMap({ base: true, icon: this._hasIcon })}>\n <slot></slot>\n </span>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-badge': IgcBadgeComponent;\n }\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const styles = css `:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);position:relative;box-sizing:border-box;scrollbar-width:var(--ig-scrollbar-size, var(--sb-size));scrollbar-color:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color)) var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar{width:var(--ig-scrollbar-size, var(--sb-size));height:var(--ig-scrollbar-size, var(--sb-size));background:var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar-thumb{background:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color))}:host *,:host *::before,:host *::after{box-sizing:border-box}:host([hidden]),[hidden]{display:none !important}:host{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;display:inline-flex;vertical-align:top}[part~=base]{display:inline-flex;min-width:var(--_badge-size);min-height:var(--_badge-size);justify-content:center;align-items:center;overflow:hidden;white-space:nowrap;font-size:max(var(--is-large, 1)*max(var(--ig-body-2-font-size), -1 * var(--ig-body-2-font-size)),var(--is-medium, 1)*max(var(--ig-body-2-font-size), -1 * var(--ig-body-2-font-size)),var(--is-small, 1)*max(var(--ig-caption-font-size), -1 * var(--ig-caption-font-size)));font-weight:max(var(--is-large, 1)*max(var(--ig-body-2-font-weight), -1 * var(--ig-body-2-font-weight)),var(--is-medium, 1)*max(var(--ig-body-2-font-weight), -1 * var(--ig-body-2-font-weight)),var(--is-small, 1)*max(var(--ig-caption-font-weight), -1 * var(--ig-caption-font-weight)));line-height:max(var(--is-large, 1)*max(var(--ig-body-2-line-height), -1 * var(--ig-body-2-line-height)),var(--is-medium, 1)*max(var(--ig-body-2-line-height), -1 * var(--ig-body-2-line-height)),var(--is-small, 1)*max(var(--ig-caption-line-height), -1 * var(--ig-caption-line-height)));letter-spacing:max(var(--is-large, 1)*max(var(--ig-body-2-letter-spacing), -1 * var(--ig-body-2-letter-spacing)),var(--is-medium, 1)*max(var(--ig-body-2-letter-spacing), -1 * var(--ig-body-2-letter-spacing)),var(--is-small, 1)*max(var(--ig-caption-letter-spacing), -1 * var(--ig-caption-letter-spacing)));text-transform:max(var(--is-large, 1)*max(var(--ig-body-2-text-transform), -1 * var(--ig-body-2-text-transform)),var(--is-medium, 1)*max(var(--ig-body-2-text-transform), -1 * var(--ig-body-2-text-transform)),var(--is-small, 1)*max(var(--ig-caption-text-transform), -1 * var(--ig-caption-text-transform)))}:host(:not(:empty,[dot])) [part
|
|
2
|
+
export const styles = css `:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);position:relative;box-sizing:border-box;scrollbar-width:var(--ig-scrollbar-size, var(--sb-size));scrollbar-color:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color)) var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar{width:var(--ig-scrollbar-size, var(--sb-size));height:var(--ig-scrollbar-size, var(--sb-size));background:var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar-thumb{background:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color))}:host *,:host *::before,:host *::after{box-sizing:border-box}:host([hidden]),[hidden]{display:none !important}:host{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;display:inline-flex;vertical-align:top}[part~=base]{display:inline-flex;min-width:var(--_badge-size);min-height:var(--_badge-size);justify-content:center;align-items:center;overflow:hidden;white-space:nowrap;font-size:max(var(--is-large, 1)*max(var(--ig-body-2-font-size), -1 * var(--ig-body-2-font-size)),var(--is-medium, 1)*max(var(--ig-body-2-font-size), -1 * var(--ig-body-2-font-size)),var(--is-small, 1)*max(var(--ig-caption-font-size), -1 * var(--ig-caption-font-size)));font-weight:max(var(--is-large, 1)*max(var(--ig-body-2-font-weight), -1 * var(--ig-body-2-font-weight)),var(--is-medium, 1)*max(var(--ig-body-2-font-weight), -1 * var(--ig-body-2-font-weight)),var(--is-small, 1)*max(var(--ig-caption-font-weight), -1 * var(--ig-caption-font-weight)));line-height:max(var(--is-large, 1)*max(var(--ig-body-2-line-height), -1 * var(--ig-body-2-line-height)),var(--is-medium, 1)*max(var(--ig-body-2-line-height), -1 * var(--ig-body-2-line-height)),var(--is-small, 1)*max(var(--ig-caption-line-height), -1 * var(--ig-caption-line-height)));letter-spacing:max(var(--is-large, 1)*max(var(--ig-body-2-letter-spacing), -1 * var(--ig-body-2-letter-spacing)),var(--is-medium, 1)*max(var(--ig-body-2-letter-spacing), -1 * var(--ig-body-2-letter-spacing)),var(--is-small, 1)*max(var(--ig-caption-letter-spacing), -1 * var(--ig-caption-letter-spacing)));text-transform:max(var(--is-large, 1)*max(var(--ig-body-2-text-transform), -1 * var(--ig-body-2-text-transform)),var(--is-medium, 1)*max(var(--ig-body-2-text-transform), -1 * var(--ig-body-2-text-transform)),var(--is-small, 1)*max(var(--ig-caption-text-transform), -1 * var(--ig-caption-text-transform)))}:host(:not(:empty,[dot])) [part~=base]:not([part~=icon]){padding-inline:max(var(--is-large, 1)*max(0.5rem, -1 * 0.5rem)*var(--ig-spacing-inline-large, var(--ig-spacing-inline, var(--ig-spacing))),var(--is-medium, 1)*max(0.375rem, -1 * 0.375rem)*var(--ig-spacing-inline-medium, var(--ig-spacing-inline, var(--ig-spacing))),var(--is-small, 1)*max(0.25rem, -1 * 0.25rem)*var(--ig-spacing-inline-small, var(--ig-spacing-inline, var(--ig-spacing))))}:host([variant=info]) [part~=base]{background:var(--ig-info-500)}:host([variant=success]) [part~=base]{background:var(--ig-success-500)}:host([variant=warning]) [part~=base]{background:var(--ig-warn-500);color:var(--ig-warn-500-contrast)}:host([variant=warning]) [part~=base] igc-icon,:host([variant=warning]) [part~=base] ::slotted(igc-icon){color:var(--ig-warn-500-contrast)}:host([variant=danger]) [part~=base]{background:var(--ig-error-500);color:var(--ig-error-900-contrast)}:host([shape=rounded]),:host([shape=rounded]) [part~=base],:host([dot]) [part~=base]{border-radius:calc(var(--_badge-size)*2)}`;
|
|
3
3
|
//# sourceMappingURL=badge.base.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.base.css.js","sourceRoot":"","sources":["../../../../src/components/badge/themes/badge.base.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"badge.base.css.js","sourceRoot":"","sources":["../../../../src/components/badge/themes/badge.base.css.ts"],"names":[],"mappings":"AACE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,urHAAurH,CAAC","sourcesContent":["\n import { css } from 'lit';\n export const styles = css`:host{--is-large: clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-large, 3), 1);--is-medium: min( clamp(0, (var(--component-size, 1) + 1) - var(--ig-size-medium, 2), 1), clamp(0, var(--ig-size-large, 3) - var(--component-size, 1), 1) );--is-small: clamp(0, var(--ig-size-medium) - var(--component-size, 1), 1);position:relative;box-sizing:border-box;scrollbar-width:var(--ig-scrollbar-size, var(--sb-size));scrollbar-color:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color)) var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar{width:var(--ig-scrollbar-size, var(--sb-size));height:var(--ig-scrollbar-size, var(--sb-size));background:var(--ig-scrollbar-track-background, var(--sb-track-bg-color))}:host ::-webkit-scrollbar-thumb{background:var(--ig-scrollbar-thumb-background, var(--sb-thumb-bg-color))}:host *,:host *::before,:host *::after{box-sizing:border-box}:host([hidden]),[hidden]{display:none !important}:host{width:-moz-fit-content;width:fit-content;height:-moz-fit-content;height:fit-content;display:inline-flex;vertical-align:top}[part~=base]{display:inline-flex;min-width:var(--_badge-size);min-height:var(--_badge-size);justify-content:center;align-items:center;overflow:hidden;white-space:nowrap;font-size:max(var(--is-large, 1)*max(var(--ig-body-2-font-size), -1 * var(--ig-body-2-font-size)),var(--is-medium, 1)*max(var(--ig-body-2-font-size), -1 * var(--ig-body-2-font-size)),var(--is-small, 1)*max(var(--ig-caption-font-size), -1 * var(--ig-caption-font-size)));font-weight:max(var(--is-large, 1)*max(var(--ig-body-2-font-weight), -1 * var(--ig-body-2-font-weight)),var(--is-medium, 1)*max(var(--ig-body-2-font-weight), -1 * var(--ig-body-2-font-weight)),var(--is-small, 1)*max(var(--ig-caption-font-weight), -1 * var(--ig-caption-font-weight)));line-height:max(var(--is-large, 1)*max(var(--ig-body-2-line-height), -1 * var(--ig-body-2-line-height)),var(--is-medium, 1)*max(var(--ig-body-2-line-height), -1 * var(--ig-body-2-line-height)),var(--is-small, 1)*max(var(--ig-caption-line-height), -1 * var(--ig-caption-line-height)));letter-spacing:max(var(--is-large, 1)*max(var(--ig-body-2-letter-spacing), -1 * var(--ig-body-2-letter-spacing)),var(--is-medium, 1)*max(var(--ig-body-2-letter-spacing), -1 * var(--ig-body-2-letter-spacing)),var(--is-small, 1)*max(var(--ig-caption-letter-spacing), -1 * var(--ig-caption-letter-spacing)));text-transform:max(var(--is-large, 1)*max(var(--ig-body-2-text-transform), -1 * var(--ig-body-2-text-transform)),var(--is-medium, 1)*max(var(--ig-body-2-text-transform), -1 * var(--ig-body-2-text-transform)),var(--is-small, 1)*max(var(--ig-caption-text-transform), -1 * var(--ig-caption-text-transform)))}:host(:not(:empty,[dot])) [part~=base]:not([part~=icon]){padding-inline:max(var(--is-large, 1)*max(0.5rem, -1 * 0.5rem)*var(--ig-spacing-inline-large, var(--ig-spacing-inline, var(--ig-spacing))),var(--is-medium, 1)*max(0.375rem, -1 * 0.375rem)*var(--ig-spacing-inline-medium, var(--ig-spacing-inline, var(--ig-spacing))),var(--is-small, 1)*max(0.25rem, -1 * 0.25rem)*var(--ig-spacing-inline-small, var(--ig-spacing-inline, var(--ig-spacing))))}:host([variant=info]) [part~=base]{background:var(--ig-info-500)}:host([variant=success]) [part~=base]{background:var(--ig-success-500)}:host([variant=warning]) [part~=base]{background:var(--ig-warn-500);color:var(--ig-warn-500-contrast)}:host([variant=warning]) [part~=base] igc-icon,:host([variant=warning]) [part~=base] ::slotted(igc-icon){color:var(--ig-warn-500-contrast)}:host([variant=danger]) [part~=base]{background:var(--ig-error-500);color:var(--ig-error-900-contrast)}:host([shape=rounded]),:host([shape=rounded]) [part~=base],:host([dot]) [part~=base]{border-radius:calc(var(--_badge-size)*2)}`;\n "]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type IChipResourceStrings } from 'igniteui-i18n-core';
|
|
2
|
-
import { LitElement } from 'lit';
|
|
2
|
+
import { LitElement, nothing } from 'lit';
|
|
3
3
|
import type { Constructor } from '#internals/mixins/constructor.js';
|
|
4
4
|
import type { StyleVariant } from '../types.js';
|
|
5
5
|
export interface IgcChipComponentEventMap {
|
|
6
|
-
igcRemove: CustomEvent<
|
|
6
|
+
igcRemove: CustomEvent<void>;
|
|
7
7
|
igcSelect: CustomEvent<boolean>;
|
|
8
8
|
}
|
|
9
9
|
declare const IgcChipComponent_base: import("#internals/mixins/constructor.js").AbstractConstructor<import("#internals/mixins/i18n.js").I18nInterface<IChipResourceStrings, Required<IChipResourceStrings>>> & Constructor<import("#internals/mixins/event-emitter.js").EventEmitterInterface<IgcChipComponentEventMap>> & Constructor<LitElement>;
|
|
@@ -14,7 +14,9 @@ declare const IgcChipComponent_base: import("#internals/mixins/constructor.js").
|
|
|
14
14
|
*
|
|
15
15
|
* @slot - Renders content in the default slot of the chip.
|
|
16
16
|
* @slot prefix - Renders content at the start of the chip, before the default content.
|
|
17
|
+
* @slot start - Renders content at the start of the chip, before the prefix content.
|
|
17
18
|
* @slot suffix - Renders content at the end of the chip after the default content.
|
|
19
|
+
* @slot end - Renders content at the end of the chip, before the suffix content.
|
|
18
20
|
* @slot select - Content to render when the chip in selected state.
|
|
19
21
|
* @slot remove - Content to override the default remove chip icon.
|
|
20
22
|
*
|
|
@@ -22,9 +24,11 @@ declare const IgcChipComponent_base: import("#internals/mixins/constructor.js").
|
|
|
22
24
|
* @fires igcSelect - Emits event when the chip component is selected/deselected and any related animations and transitions also end.
|
|
23
25
|
*
|
|
24
26
|
* @csspart base - The base wrapper of the chip.
|
|
27
|
+
* @csspart action - The selection control of the chip, wrapping the chip content.
|
|
25
28
|
* @csspart content - The wrapper element around the default slot of the chip.
|
|
26
29
|
* @csspart prefix - The prefix container of the chip.
|
|
27
30
|
* @csspart suffix - The suffix container of the chip.
|
|
31
|
+
* @csspart remove - The container of the remove control of the chip.
|
|
28
32
|
*/
|
|
29
33
|
export default class IgcChipComponent extends IgcChipComponent_base {
|
|
30
34
|
static readonly tagName = "igc-chip";
|
|
@@ -33,41 +37,53 @@ export default class IgcChipComponent extends IgcChipComponent_base {
|
|
|
33
37
|
private readonly _removePartRef;
|
|
34
38
|
private readonly _slots;
|
|
35
39
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
40
|
+
* Whether the chip is disabled or not.
|
|
41
|
+
*
|
|
42
|
+
* @attr disabled
|
|
43
|
+
* @default false
|
|
38
44
|
*/
|
|
39
45
|
disabled: boolean;
|
|
40
46
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
47
|
+
* Whether the chip is removable or not.
|
|
48
|
+
*
|
|
49
|
+
* @attr removable
|
|
50
|
+
* @default false
|
|
43
51
|
*/
|
|
44
52
|
removable: boolean;
|
|
45
53
|
/**
|
|
46
|
-
*
|
|
54
|
+
* Whether the chip is outlined or not.
|
|
47
55
|
*
|
|
48
|
-
* @attr
|
|
56
|
+
* @attr outlined
|
|
57
|
+
* @default false
|
|
49
58
|
*/
|
|
50
59
|
outlined: boolean;
|
|
51
60
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
61
|
+
* Whether the chip is selectable or not.
|
|
62
|
+
*
|
|
63
|
+
* @attr selectable
|
|
64
|
+
* @default false
|
|
54
65
|
*/
|
|
55
66
|
selectable: boolean;
|
|
56
67
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
68
|
+
* Whether the chip is selected or not.
|
|
69
|
+
*
|
|
70
|
+
* @attr selected
|
|
71
|
+
* @default false
|
|
59
72
|
*/
|
|
60
73
|
selected: boolean;
|
|
61
74
|
/**
|
|
62
75
|
* A property that sets the color variant of the chip component.
|
|
63
|
-
*
|
|
76
|
+
*
|
|
77
|
+
* @attr variant
|
|
64
78
|
*/
|
|
65
|
-
variant
|
|
79
|
+
variant?: StyleVariant;
|
|
66
80
|
constructor();
|
|
81
|
+
private _hasSlotted;
|
|
67
82
|
protected _handleSelect(): void;
|
|
68
83
|
protected _handleRemove(event: Event): void;
|
|
69
84
|
protected _renderPrefix(): import("lit-html").TemplateResult<1>;
|
|
70
85
|
protected _renderSuffix(): import("lit-html").TemplateResult<1>;
|
|
86
|
+
protected _renderRemove(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
71
87
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
72
88
|
}
|
|
73
89
|
declare global {
|
package/components/chip/chip.js
CHANGED
|
@@ -9,7 +9,7 @@ import { html, LitElement, nothing } from 'lit';
|
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
11
11
|
import { addKeybindings } from '#internals/controllers/key-bindings.js';
|
|
12
|
-
import { addSlotController, setSlots } from '#internals/controllers/slot.js';
|
|
12
|
+
import { addSlotController, setSlots, } from '#internals/controllers/slot.js';
|
|
13
13
|
import { registerComponent } from '#internals/definitions/register.js';
|
|
14
14
|
import { EventEmitterMixin } from '#internals/mixins/event-emitter.js';
|
|
15
15
|
import { I18nMixin } from '#internals/mixins/i18n.js';
|
|
@@ -19,6 +19,7 @@ import IgcIconComponent from '../icon/icon.js';
|
|
|
19
19
|
import { styles } from './themes/chip.base.css.js';
|
|
20
20
|
import { styles as shared } from './themes/shared/chip.common.css.js';
|
|
21
21
|
import { all } from './themes/themes.js';
|
|
22
|
+
const Slots = setSlots('start', 'prefix', 'suffix', 'end');
|
|
22
23
|
const i18n = {
|
|
23
24
|
defaultEN: ChipResourceStringsEN,
|
|
24
25
|
};
|
|
@@ -31,9 +32,7 @@ export default class IgcChipComponent extends I18nMixin(EventEmitterMixin(LitEle
|
|
|
31
32
|
constructor() {
|
|
32
33
|
super();
|
|
33
34
|
this._removePartRef = createRef();
|
|
34
|
-
this._slots = addSlotController(this, {
|
|
35
|
-
slots: setSlots('prefix', 'suffix', 'start', 'end', 'select', 'remove'),
|
|
36
|
-
});
|
|
35
|
+
this._slots = addSlotController(this, { slots: Slots });
|
|
37
36
|
this.disabled = false;
|
|
38
37
|
this.removable = false;
|
|
39
38
|
this.outlined = false;
|
|
@@ -42,9 +41,13 @@ export default class IgcChipComponent extends I18nMixin(EventEmitterMixin(LitEle
|
|
|
42
41
|
addThemingController(this, all);
|
|
43
42
|
addKeybindings(this, {
|
|
44
43
|
ref: this._removePartRef,
|
|
44
|
+
skip: () => !this._removePartRef.value,
|
|
45
45
|
bindingDefaults: { triggers: ['keyup'] },
|
|
46
46
|
}).setActivateHandler(this._handleRemove);
|
|
47
47
|
}
|
|
48
|
+
_hasSlotted(...slots) {
|
|
49
|
+
return slots.some((slot) => this._slots.hasAssignedElements(slot));
|
|
50
|
+
}
|
|
48
51
|
_handleSelect() {
|
|
49
52
|
if (this.selectable) {
|
|
50
53
|
this.selected = !this.selected;
|
|
@@ -56,66 +59,69 @@ export default class IgcChipComponent extends I18nMixin(EventEmitterMixin(LitEle
|
|
|
56
59
|
this.emitEvent('igcRemove');
|
|
57
60
|
}
|
|
58
61
|
_renderPrefix() {
|
|
59
|
-
const
|
|
60
|
-
this._slots.hasAssignedElements('start');
|
|
61
|
-
const selectSlot = this.selectable && this.selected
|
|
62
|
-
? renderSlottedIcon({
|
|
63
|
-
slot: 'select',
|
|
64
|
-
icon: 'selected',
|
|
65
|
-
label: this.resourceStrings.chip_select,
|
|
66
|
-
})
|
|
67
|
-
: nothing;
|
|
62
|
+
const showSelected = this.selectable && this.selected;
|
|
68
63
|
return html `
|
|
69
|
-
<span
|
|
70
|
-
|
|
64
|
+
<span
|
|
65
|
+
part="prefix"
|
|
66
|
+
?hidden=${!showSelected && !this._hasSlotted('start', 'prefix')}
|
|
67
|
+
>
|
|
68
|
+
${showSelected
|
|
69
|
+
? renderSlottedIcon({ slot: 'select', icon: 'selected' })
|
|
70
|
+
: nothing}
|
|
71
71
|
<slot name="start"></slot>
|
|
72
72
|
<slot name="prefix"></slot>
|
|
73
73
|
</span>
|
|
74
74
|
`;
|
|
75
75
|
}
|
|
76
76
|
_renderSuffix() {
|
|
77
|
-
const isVisible = this._slots.hasAssignedElements('suffix') ||
|
|
78
|
-
this._slots.hasAssignedElements('end');
|
|
79
|
-
const removeSlot = this.removable && !this.disabled
|
|
80
|
-
? html `
|
|
81
|
-
<slot
|
|
82
|
-
${ref(this._removePartRef)}
|
|
83
|
-
name="remove"
|
|
84
|
-
@click=${this._handleRemove}
|
|
85
|
-
>
|
|
86
|
-
<igc-icon
|
|
87
|
-
name="remove"
|
|
88
|
-
collection="default"
|
|
89
|
-
tabindex="0"
|
|
90
|
-
role="button"
|
|
91
|
-
aria-label=${this.resourceStrings.chip_remove}
|
|
92
|
-
></igc-icon>
|
|
93
|
-
</slot>
|
|
94
|
-
`
|
|
95
|
-
: nothing;
|
|
96
77
|
return html `
|
|
97
|
-
<span part="suffix" ?hidden=${!
|
|
78
|
+
<span part="suffix" ?hidden=${!this._hasSlotted('end', 'suffix')}>
|
|
98
79
|
<slot name="end"></slot>
|
|
99
80
|
<slot name="suffix"></slot>
|
|
100
|
-
|
|
81
|
+
</span>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
_renderRemove() {
|
|
85
|
+
if (!this.removable || this.disabled) {
|
|
86
|
+
return nothing;
|
|
87
|
+
}
|
|
88
|
+
return html `
|
|
89
|
+
<span part="remove">
|
|
90
|
+
<slot
|
|
91
|
+
${ref(this._removePartRef)}
|
|
92
|
+
name="remove"
|
|
93
|
+
@click=${this._handleRemove}
|
|
94
|
+
>
|
|
95
|
+
<igc-icon
|
|
96
|
+
name="remove"
|
|
97
|
+
collection="default"
|
|
98
|
+
tabindex="0"
|
|
99
|
+
role="button"
|
|
100
|
+
aria-label=${this.resourceStrings.chip_remove}
|
|
101
|
+
></igc-icon>
|
|
102
|
+
</slot>
|
|
101
103
|
</span>
|
|
102
104
|
`;
|
|
103
105
|
}
|
|
104
106
|
render() {
|
|
105
107
|
const ariaPressed = this.selectable ? this.selected.toString() : null;
|
|
106
108
|
return html `
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
<div part="base">
|
|
110
|
+
<button
|
|
111
|
+
part="action"
|
|
112
|
+
type="button"
|
|
113
|
+
.ariaPressed=${ariaPressed}
|
|
114
|
+
?disabled=${this.disabled}
|
|
115
|
+
@click=${this._handleSelect}
|
|
116
|
+
>
|
|
117
|
+
${this._renderPrefix()}
|
|
118
|
+
<span part="content">
|
|
119
|
+
<slot></slot>
|
|
120
|
+
</span>
|
|
121
|
+
${this._renderSuffix()}
|
|
122
|
+
</button>
|
|
123
|
+
${this._renderRemove()}
|
|
124
|
+
</div>
|
|
119
125
|
`;
|
|
120
126
|
}
|
|
121
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chip.js","sourceRoot":"","sources":["../../../src/components/chip/chip.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,GAA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G,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtE,OAAO,IAAI,CAAA;;;uBAGQ,WAAW;oBACd,IAAI,CAAC,QAAQ;iBAChB,IAAI,CAAC,aAAa;;UAEzB,IAAI,CAAC,aAAa,EAAE;;;;UAIpB,IAAI,CAAC,aAAa,EAAE;;KAEzB,CAAC;IACJ,CAAC;;AAvIM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AAOjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAClB;AAQlB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AAOjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACjB;AAQnB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AAOjB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACE","sourcesContent":["import {\n ChipResourceStringsEN,\n type IChipResourceStrings,\n} from 'igniteui-i18n-core';\nimport { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { addKeybindings } from '#internals/controllers/key-bindings.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { I18nControllerConfig } from '#internals/i18n/i18n-controller.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { I18nMixin } from '#internals/mixins/i18n.js';\nimport { renderSlottedIcon } from '#internals/templates/slotted-icon.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport type { StyleVariant } from '../types.js';\nimport { styles } from './themes/chip.base.css.js';\nimport { styles as shared } from './themes/shared/chip.common.css.js';\nimport { all } from './themes/themes.js';\n\nexport interface IgcChipComponentEventMap {\n igcRemove: CustomEvent<boolean>;\n igcSelect: CustomEvent<boolean>;\n}\n\nconst i18n: I18nControllerConfig<IChipResourceStrings> = {\n defaultEN: ChipResourceStringsEN,\n};\n\n/**\n * Chips help people enter information, make selections, filter content, or trigger actions.\n *\n * @element igc-chip\n *\n * @slot - Renders content in the default slot of the chip.\n * @slot prefix - Renders content at the start of the chip, before the default content.\n * @slot suffix - Renders content at the end of the chip after the default content.\n * @slot select - Content to render when the chip in selected state.\n * @slot remove - Content to override the default remove chip icon.\n *\n * @fires igcRemove - Emits an event when the chip component is removed.\n * @fires igcSelect - Emits event when the chip component is selected/deselected and any related animations and transitions also end.\n *\n * @csspart base - The base wrapper of the chip.\n * @csspart content - The wrapper element around the default slot of the chip.\n * @csspart prefix - The prefix container of the chip.\n * @csspart suffix - The suffix container of the chip.\n */\nexport default class IgcChipComponent extends I18nMixin(\n EventEmitterMixin<IgcChipComponentEventMap, Constructor<LitElement>>(\n LitElement\n ),\n i18n\n) {\n public static readonly tagName = 'igc-chip';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcChipComponent, IgcIconComponent);\n }\n\n private readonly _removePartRef = createRef<HTMLSlotElement>();\n\n private readonly _slots = addSlotController(this, {\n slots: setSlots('prefix', 'suffix', 'start', 'end', 'select', 'remove'),\n });\n\n /**\n * Sets the disabled state for the chip.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Defines if the chip is removable or not.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public removable = false;\n\n /**\n * Defines if the chip is outlined or not.\n *\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public outlined = false;\n\n /**\n * Defines if the chip is selectable or not.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public selectable = false;\n\n /* @tsTwoWayProperty(true, \"igcSelect\", \"detail\", false) */\n /**\n * Defines if the chip is selected or not.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n /**\n * A property that sets the color variant of the chip component.\n * @attr\n */\n @property({ reflect: true })\n public variant!: StyleVariant;\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n addKeybindings(this, {\n ref: this._removePartRef,\n bindingDefaults: { triggers: ['keyup'] },\n }).setActivateHandler(this._handleRemove);\n }\n\n protected _handleSelect(): void {\n if (this.selectable) {\n this.selected = !this.selected;\n this.emitEvent('igcSelect', { detail: this.selected });\n }\n }\n\n protected _handleRemove(event: Event): void {\n event.stopPropagation();\n this.emitEvent('igcRemove');\n }\n\n protected _renderPrefix() {\n const isVisible =\n this._slots.hasAssignedElements('prefix') ||\n this._slots.hasAssignedElements('start');\n\n const selectSlot =\n this.selectable && this.selected\n ? renderSlottedIcon({\n slot: 'select',\n icon: 'selected',\n label: this.resourceStrings.chip_select,\n })\n : nothing;\n\n return html`\n <span part=\"prefix\" ?hidden=${!isVisible && !this.selected}>\n ${selectSlot}\n <slot name=\"start\"></slot>\n <slot name=\"prefix\"></slot>\n </span>\n `;\n }\n\n protected _renderSuffix() {\n const isVisible =\n this._slots.hasAssignedElements('suffix') ||\n this._slots.hasAssignedElements('end');\n\n const removeSlot =\n this.removable && !this.disabled\n ? html`\n <slot\n ${ref(this._removePartRef)}\n name=\"remove\"\n @click=${this._handleRemove}\n >\n <igc-icon\n name=\"remove\"\n collection=\"default\"\n tabindex=\"0\"\n role=\"button\"\n aria-label=${this.resourceStrings.chip_remove}\n ></igc-icon>\n </slot>\n `\n : nothing;\n\n return html`\n <span part=\"suffix\" ?hidden=${!isVisible && !this.removable}>\n <slot name=\"end\"></slot>\n <slot name=\"suffix\"></slot>\n ${removeSlot}\n </span>\n `;\n }\n\n protected override render() {\n const ariaPressed = this.selectable ? this.selected.toString() : null;\n\n return html`\n <button\n part=\"base\"\n .ariaPressed=${ariaPressed}\n ?disabled=${this.disabled}\n @click=${this._handleSelect}\n >\n ${this._renderPrefix()}\n <span part=\"content\">\n <slot></slot>\n </span>\n ${this._renderSuffix()}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-chip': IgcChipComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chip.js","sourceRoot":"","sources":["../../../src/components/chip/chip.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EACL,iBAAiB,EAEjB,QAAQ,GACT,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAOzC,MAAM,KAAK,GAAG,QAAQ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,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAEtE,OAAO,IAAI,CAAA;;;;;yBAKU,WAAW;sBACd,IAAI,CAAC,QAAQ;mBAChB,IAAI,CAAC,aAAa;;YAEzB,IAAI,CAAC,aAAa,EAAE;;;;YAIpB,IAAI,CAAC,aAAa,EAAE;;UAEtB,IAAI,CAAC,aAAa,EAAE;;KAEzB,CAAC;IACJ,CAAC;;AApJM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AASjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAClB;AASlB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AASjB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oDACjB;AAUnB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDACnB;AAQjB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDACE","sourcesContent":["import {\n ChipResourceStringsEN,\n type IChipResourceStrings,\n} from 'igniteui-i18n-core';\nimport { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { addKeybindings } from '#internals/controllers/key-bindings.js';\nimport {\n addSlotController,\n type InferSlotNames,\n setSlots,\n} from '#internals/controllers/slot.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { I18nControllerConfig } from '#internals/i18n/i18n-controller.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { I18nMixin } from '#internals/mixins/i18n.js';\nimport { renderSlottedIcon } from '#internals/templates/slotted-icon.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport type { StyleVariant } from '../types.js';\nimport { styles } from './themes/chip.base.css.js';\nimport { styles as shared } from './themes/shared/chip.common.css.js';\nimport { all } from './themes/themes.js';\n\nexport interface IgcChipComponentEventMap {\n igcRemove: CustomEvent<void>;\n igcSelect: CustomEvent<boolean>;\n}\n\nconst Slots = setSlots('start', 'prefix', 'suffix', 'end');\n\nconst i18n: I18nControllerConfig<IChipResourceStrings> = {\n defaultEN: ChipResourceStringsEN,\n};\n\n/**\n * Chips help people enter information, make selections, filter content, or trigger actions.\n *\n * @element igc-chip\n *\n * @slot - Renders content in the default slot of the chip.\n * @slot prefix - Renders content at the start of the chip, before the default content.\n * @slot start - Renders content at the start of the chip, before the prefix content.\n * @slot suffix - Renders content at the end of the chip after the default content.\n * @slot end - Renders content at the end of the chip, before the suffix content.\n * @slot select - Content to render when the chip in selected state.\n * @slot remove - Content to override the default remove chip icon.\n *\n * @fires igcRemove - Emits an event when the chip component is removed.\n * @fires igcSelect - Emits event when the chip component is selected/deselected and any related animations and transitions also end.\n *\n * @csspart base - The base wrapper of the chip.\n * @csspart action - The selection control of the chip, wrapping the chip content.\n * @csspart content - The wrapper element around the default slot of the chip.\n * @csspart prefix - The prefix container of the chip.\n * @csspart suffix - The suffix container of the chip.\n * @csspart remove - The container of the remove control of the chip.\n */\nexport default class IgcChipComponent extends I18nMixin(\n EventEmitterMixin<IgcChipComponentEventMap, Constructor<LitElement>>(\n LitElement\n ),\n i18n\n) {\n public static readonly tagName = 'igc-chip';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcChipComponent, IgcIconComponent);\n }\n\n private readonly _removePartRef = createRef<HTMLSlotElement>();\n private readonly _slots = addSlotController(this, { slots: Slots });\n\n /**\n * Whether the chip is disabled or not.\n *\n * @attr disabled\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Whether the chip is removable or not.\n *\n * @attr removable\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public removable = false;\n\n /**\n * Whether the chip is outlined or not.\n *\n * @attr outlined\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public outlined = false;\n\n /**\n * Whether the chip is selectable or not.\n *\n * @attr selectable\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public selectable = false;\n\n /* @tsTwoWayProperty(true, \"igcSelect\", \"detail\", false) */\n /**\n * Whether the chip is selected or not.\n *\n * @attr selected\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n /**\n * A property that sets the color variant of the chip component.\n *\n * @attr variant\n */\n @property({ reflect: true })\n public variant?: StyleVariant;\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n addKeybindings(this, {\n ref: this._removePartRef,\n skip: () => !this._removePartRef.value,\n bindingDefaults: { triggers: ['keyup'] },\n }).setActivateHandler(this._handleRemove);\n }\n\n private _hasSlotted(...slots: InferSlotNames<typeof Slots>[]): boolean {\n return slots.some((slot) => this._slots.hasAssignedElements(slot));\n }\n\n protected _handleSelect(): void {\n if (this.selectable) {\n this.selected = !this.selected;\n this.emitEvent('igcSelect', { detail: this.selected });\n }\n }\n\n protected _handleRemove(event: Event): void {\n event.stopPropagation();\n this.emitEvent('igcRemove');\n }\n\n protected _renderPrefix() {\n const showSelected = this.selectable && this.selected;\n\n return html`\n <span\n part=\"prefix\"\n ?hidden=${!showSelected && !this._hasSlotted('start', 'prefix')}\n >\n ${\n showSelected\n ? renderSlottedIcon({ slot: 'select', icon: 'selected' })\n : nothing\n }\n <slot name=\"start\"></slot>\n <slot name=\"prefix\"></slot>\n </span>\n `;\n }\n\n protected _renderSuffix() {\n return html`\n <span part=\"suffix\" ?hidden=${!this._hasSlotted('end', 'suffix')}>\n <slot name=\"end\"></slot>\n <slot name=\"suffix\"></slot>\n </span>\n `;\n }\n\n protected _renderRemove() {\n if (!this.removable || this.disabled) {\n return nothing;\n }\n\n return html`\n <span part=\"remove\">\n <slot\n ${ref(this._removePartRef)}\n name=\"remove\"\n @click=${this._handleRemove}\n >\n <igc-icon\n name=\"remove\"\n collection=\"default\"\n tabindex=\"0\"\n role=\"button\"\n aria-label=${this.resourceStrings.chip_remove}\n ></igc-icon>\n </slot>\n </span>\n `;\n }\n\n protected override render() {\n const ariaPressed = this.selectable ? this.selected.toString() : null;\n\n return html`\n <div part=\"base\">\n <button\n part=\"action\"\n type=\"button\"\n .ariaPressed=${ariaPressed}\n ?disabled=${this.disabled}\n @click=${this._handleSelect}\n >\n ${this._renderPrefix()}\n <span part=\"content\">\n <slot></slot>\n </span>\n ${this._renderSuffix()}\n </button>\n ${this._renderRemove()}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-chip': IgcChipComponent;\n }\n}\n"]}
|