igniteui-webcomponents 7.4.0 → 7.4.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 +38 -0
- package/components/checkbox/checkbox-base.d.ts +2 -0
- package/components/checkbox/checkbox-base.js +4 -0
- package/components/checkbox/checkbox-base.js.map +1 -1
- package/components/checkbox/checkbox.js +3 -11
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.js +1 -8
- package/components/checkbox/switch.js.map +1 -1
- package/components/color-picker/color-picker.js +3 -3
- package/components/color-picker/color-picker.js.map +1 -1
- package/components/combo/combo.d.ts +6 -4
- package/components/combo/combo.js +13 -24
- package/components/combo/combo.js.map +1 -1
- package/components/date-picker/date-picker.base.d.ts +3 -3
- package/components/date-picker/date-picker.base.js +2 -2
- package/components/date-picker/date-picker.base.js.map +1 -1
- package/components/date-picker/date-picker.d.ts +1 -1
- package/components/date-range-picker/date-range-picker.d.ts +1 -1
- package/components/date-time-input/date-time-input.base.d.ts +4 -4
- package/components/date-time-input/date-time-input.base.js +3 -5
- package/components/date-time-input/date-time-input.base.js.map +1 -1
- package/components/file-input/file-input.d.ts +5 -0
- package/components/file-input/file-input.js +4 -0
- package/components/file-input/file-input.js.map +1 -1
- package/components/input/input-base.d.ts +2 -2
- package/components/input/input-base.js +3 -5
- package/components/input/input-base.js.map +1 -1
- package/components/input/input.d.ts +1 -1
- package/components/radio/radio.d.ts +2 -0
- package/components/radio/radio.js +7 -11
- package/components/radio/radio.js.map +1 -1
- package/components/rating/rating.d.ts +3 -0
- package/components/rating/rating.js +17 -18
- package/components/rating/rating.js.map +1 -1
- package/components/select/select.js +1 -1
- package/components/select/select.js.map +1 -1
- package/components/slider/range-slider.d.ts +0 -1
- package/components/slider/range-slider.js +6 -11
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.d.ts +4 -1
- package/components/slider/slider-base.js +20 -18
- package/components/slider/slider-base.js.map +1 -1
- package/components/slider/slider.d.ts +2 -0
- package/components/slider/slider.js +5 -1
- package/components/slider/slider.js.map +1 -1
- package/components/textarea/textarea.d.ts +1 -4
- package/components/textarea/textarea.js +3 -5
- package/components/textarea/textarea.js.map +1 -1
- package/components/validation-container/validation-container.js +2 -1
- package/components/validation-container/validation-container.js.map +1 -1
- package/components/virtualization/engine.d.ts +35 -4
- package/components/virtualization/engine.js +126 -61
- package/components/virtualization/engine.js.map +1 -1
- package/components/virtualization/recycle.d.ts +13 -0
- package/components/virtualization/recycle.js +152 -0
- package/components/virtualization/recycle.js.map +1 -0
- package/components/virtualization/virtualization.d.ts +32 -11
- package/components/virtualization/virtualization.js +14 -11
- package/components/virtualization/virtualization.js.map +1 -1
- package/custom-elements.json +2382 -79
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/internals/controllers/aria-projection.d.ts +61 -23
- package/internals/controllers/aria-projection.js +77 -26
- package/internals/controllers/aria-projection.js.map +1 -1
- package/internals/mixins/forms/associated.js +34 -0
- package/internals/mixins/forms/associated.js.map +1 -1
- package/internals/mixins/forms/types.d.ts +5 -0
- package/internals/mixins/forms/types.js.map +1 -1
- package/internals/templates/toggle-shell.d.ts +15 -14
- package/internals/templates/toggle-shell.js +12 -8
- package/internals/templates/toggle-shell.js.map +1 -1
- package/internals/utils/dom.d.ts +2 -2
- package/internals/utils/dom.js +2 -2
- package/internals/utils/dom.js.map +1 -1
- package/package.json +1 -1
- package/skills/README.md +2 -4
- package/skills/igniteui-wc-choose-components/SKILL.md +2 -1
- package/skills/igniteui-wc-customize-component-theme/SKILL.md +2 -1
- package/skills/igniteui-wc-figma-to-app/SKILL.md +133 -712
- package/skills/igniteui-wc-figma-to-app/references/asset-extraction.md +42 -62
- package/skills/igniteui-wc-figma-to-app/references/design-provenance.md +199 -0
- package/skills/igniteui-wc-figma-to-app/references/design-token-bridge.md +189 -107
- package/skills/igniteui-wc-figma-to-app/references/figma-component-map.md +129 -84
- package/skills/igniteui-wc-figma-to-app/references/figma-exploration.md +222 -0
- package/skills/igniteui-wc-figma-to-app/references/mcp-setup.md +81 -127
- package/skills/igniteui-wc-figma-to-app/references/project-setup.md +105 -0
- package/skills/igniteui-wc-figma-to-app/references/theme-generation.md +180 -0
- package/skills/igniteui-wc-figma-to-app/references/validation-patterns.md +74 -80
- package/skills/igniteui-wc-generate-from-image-design/SKILL.md +2 -1
- package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +3 -3
- package/skills/igniteui-wc-grids/SKILL.md +133 -0
- package/skills/igniteui-wc-integrate-with-framework/SKILL.md +2 -1
- package/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +2 -1
- package/skills/igniteui-wc-optimize-bundle-size/SKILL.md +2 -1
- package/web-types.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,43 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [7.4.1] - 2026-09-25
|
|
8
|
+
### Added
|
|
9
|
+
- #### AI-Assisted Development
|
|
10
|
+
- New `igniteui-wc-grids` skill. It helps an agent pick the grid package, register the grid, apply one theme, inject the theme into a Shadow DOM, set the layout and set up sorting and filtering. [#2376](https://github.com/IgniteUI/igniteui-webcomponents/pull/2376)
|
|
11
|
+
- #### Virtual scroll
|
|
12
|
+
- `keyFunction` property. It returns the key of an item, so an item keeps its element while it is in the rendered window, also when it moves in `data`. Without it, the index is the key. [#2401](https://github.com/IgniteUI/igniteui-webcomponents/pull/2401)
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- #### AI-Assisted Development
|
|
16
|
+
- All skills now declare the MIT license, and their descriptions state when to use them and when to use a different skill. [#2400](https://github.com/IgniteUI/igniteui-webcomponents/pull/2400)
|
|
17
|
+
- The `igniteui-wc-figma-to-app` skill now supports Figma files from any UI kit, not only the Indigo.Design UI Kits. Its guidance now agrees with the current Figma, theming and component APIs, and its steps are in separate reference files, so an agent loads less text. [#2400](https://github.com/IgniteUI/igniteui-webcomponents/pull/2400) [#2404](https://github.com/IgniteUI/igniteui-webcomponents/pull/2404)
|
|
18
|
+
- #### Virtual scroll
|
|
19
|
+
- **Behavior change:** Item elements are now recycled. An item that stays in the rendered window keeps its element, and the elements of the items that leave show the items that enter. Before, each element showed the item at its window position, so each scroll updated every rendered item. DOM state that the item template does not bind, for example the state of a checkbox without a `checked` binding, stays with the element and shows on the item that enters. The `itemTemplate` documentation shows how to bind this state or get new DOM for each item. [#2401](https://github.com/IgniteUI/igniteui-webcomponents/pull/2401)
|
|
20
|
+
- The average measured item size now replaces `estimatedItemSize` for the items that are not measured yet, so the scrollbar follows the real content when the estimate is wrong. [#2401](https://github.com/IgniteUI/igniteui-webcomponents/pull/2401)
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- #### Virtual scroll
|
|
24
|
+
- `scrollToIndex` with `block: 'nearest'` now aligns an item after the viewport to the end of the viewport, as native `scrollIntoView` does. Before, it aligned each item out of view to the start, so a scroll to the next item moved a full page. [#2401](https://github.com/IgniteUI/igniteui-webcomponents/pull/2401)
|
|
25
|
+
- #### Checkbox, Switch, Radio
|
|
26
|
+
- A `<label>` element bound through `for`, or wrapping the component, now names the control and a click on it focuses and toggles the control, as for a native checkbox or radio. Before, the control had no accessible name and the click did nothing. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
27
|
+
- The host `aria-labelledby` now names the control. Before, the component copied the ID into its shadow root, where it did not resolve. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
28
|
+
- #### Rating, Slider
|
|
29
|
+
- A `<label>` element bound through `for`, or wrapping the component, now names the control, and a click on it focuses the control. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
30
|
+
- The host `aria-labelledby` now names the control. The slider now also follows a change of the host `aria-label` after the first render. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
31
|
+
- The slider value tooltip is hidden from assistive technology, because `aria-valuetext` already carries the value. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
32
|
+
- #### Color picker
|
|
33
|
+
- In `default` mode, an external `<label>` and the host `aria-labelledby` and `aria-label` now name the trigger button. Before, it was always "Open color picker". [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
34
|
+
- In `input` mode, the text input no longer carries `aria-expanded`, which ARIA does not allow on a text input. The swatch button in the prefix still reflects the open state. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
35
|
+
- #### File input
|
|
36
|
+
- A click on an external `<label>` now focuses the native input and opens the file picker, as for a native file input. Before, the focus went to the browse button. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
37
|
+
- #### Combo
|
|
38
|
+
- The `label` property and an external `<label>` now name the input. Before, the selection status text ("No options selected") replaced them. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
39
|
+
- #### Combo, Color picker, Date picker, Date range picker, Date time input, File input, Input, Mask input, Select, Textarea
|
|
40
|
+
- The host `aria-labelledby` and `aria-label` now name the native editor. All form associated components use one naming order: the host `aria-labelledby`, then the external `<label>` elements, then the own label, then the host `aria-label`. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
41
|
+
- A `<label>` element added after the first render now names the control from its first focus. Before, it did not name the control until the next render. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
42
|
+
- The helper text `aria-describedby` of the input editors now stays after a re-render. Before, a re-render removed it. [#2402](https://github.com/IgniteUI/igniteui-webcomponents/pull/2402)
|
|
43
|
+
|
|
7
44
|
## [7.4.0] - 2026-09-23
|
|
8
45
|
### Added
|
|
9
46
|
- #### Breadcrumbs
|
|
@@ -1664,6 +1701,7 @@ Initial release of Ignite UI Web Components
|
|
|
1664
1701
|
- Ripple component
|
|
1665
1702
|
- Switch component
|
|
1666
1703
|
|
|
1704
|
+
[7.4.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.4.0...7.4.1
|
|
1667
1705
|
[7.4.0]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.3.2...7.4.0
|
|
1668
1706
|
[7.3.2]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.3.1...7.3.2
|
|
1669
1707
|
[7.3.1]: https://github.com/IgniteUI/igniteui-webcomponents/compare/7.3.0...7.3.1
|
|
@@ -42,6 +42,8 @@ export declare class IgcCheckboxBaseComponent extends IgcCheckboxBaseComponent_b
|
|
|
42
42
|
focus(options?: FocusOptions): void;
|
|
43
43
|
/** Removes focus from the control. */
|
|
44
44
|
blur(): void;
|
|
45
|
+
/** Focuses and toggles the control, as a native checkbox label does. */
|
|
46
|
+
protected _handleLabelActivation(): void;
|
|
45
47
|
protected _handleSlotChange(): void;
|
|
46
48
|
protected _handleClick(event: PointerEvent): void;
|
|
47
49
|
}
|
|
@@ -56,6 +56,10 @@ let IgcCheckboxBaseComponent = class IgcCheckboxBaseComponent extends FormAssoci
|
|
|
56
56
|
blur() {
|
|
57
57
|
this._input.blur();
|
|
58
58
|
}
|
|
59
|
+
_handleLabelActivation() {
|
|
60
|
+
this._input.focus();
|
|
61
|
+
this._input.click();
|
|
62
|
+
}
|
|
59
63
|
_handleSlotChange() {
|
|
60
64
|
this._hideLabel = !this._slots.hasAssignedNodes('[default]');
|
|
61
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-base.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO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EAAE,gBAAgB,EAAE,CAAC;+DACL;AA9DzC,wBAAwB;IADpC,gBAAgB;GACJ,wBAAwB,CAoGpC","sourcesContent":["import { LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { addKeyboardFocusRing } from '#internals/controllers/focus-ring.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport { blazorDeepImport } from '#internals/decorators/blazorDeepImport.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { FormAssociatedCheckboxRequiredMixin } from '#internals/mixins/forms/associated-required.js';\nimport { FormValueBooleanTransformers } from '#internals/mixins/forms/form-transformers.js';\nimport { createFormValueState } from '#internals/mixins/forms/form-value.js';\nimport type { ToggleLabelPosition } from '../types.js';\nimport { checkBoxValidators } from './validators.js';\n\nexport interface IgcCheckboxChangeEventArgs {\n checked: boolean;\n value?: string;\n}\n\nexport interface IgcCheckboxComponentEventMap {\n igcChange: CustomEvent<IgcCheckboxChangeEventArgs>;\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\n@blazorDeepImport\nexport class IgcCheckboxBaseComponent extends FormAssociatedCheckboxRequiredMixin(\n EventEmitterMixin<IgcCheckboxComponentEventMap, Constructor<LitElement>>(\n LitElement\n )\n) {\n protected override get __validators() {\n return checkBoxValidators;\n }\n\n protected readonly _slots = addSlotController(this, {\n slots: setSlots('helper-text', 'value-missing', 'custom-error', 'invalid'),\n onChange: this._handleSlotChange,\n });\n\n protected readonly _focusRingManager = addKeyboardFocusRing(this);\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: false,\n transformers: FormValueBooleanTransformers,\n });\n protected _value!: string;\n\n @query('input', true)\n protected readonly _input!: HTMLInputElement;\n\n @state()\n protected _hideLabel = true;\n\n /**\n * The value of the control.\n * @attr\n */\n @property()\n public set value(value: string) {\n this._value = value;\n if (this.checked) {\n this._formValue.setValueAndFormState(this.checked);\n }\n }\n\n public get value(): string {\n return this._value;\n }\n\n /* @tsTwoWayProperty(true, \"igcChange\", \"detail.checked\", false) */\n /**\n * The checked state of the control.\n * @attr\n */\n @property({ type: Boolean })\n public set checked(value: boolean) {\n this._formValue.setValueAndFormState(value);\n }\n\n public get checked(): boolean {\n return this._formValue.value;\n }\n\n /**\n * The label position of the control.\n * @attr label-position\n */\n @property({ reflect: true, attribute: 'label-position' })\n public labelPosition: ToggleLabelPosition = 'after';\n\n /** Simulates a click on the control. */\n public override click(): void {\n this._input.click();\n }\n\n /* alternateName: focusComponent */\n /** Sets focus on the control. */\n public override focus(options?: FocusOptions): void {\n this._input.focus(options);\n }\n\n /* alternateName: blurComponent */\n /** Removes focus from the control. */\n public override blur(): void {\n this._input.blur();\n }\n\n /** Focuses and toggles the control, as a native checkbox label does. */\n protected override _handleLabelActivation(): void {\n this._input.focus();\n this._input.click();\n }\n\n protected _handleSlotChange(): void {\n this._hideLabel = !this._slots.hasAssignedNodes('[default]');\n }\n\n protected _handleClick(event: PointerEvent): void {\n event.stopPropagation();\n\n this._setTouchedState();\n this.checked = !this.checked;\n this.emitEvent('igcChange', {\n detail: { checked: this.checked, value: this.value },\n });\n }\n}\n"]}
|
|
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html } from 'lit';
|
|
8
8
|
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { helperText } from '#internals/controllers/aria-projection.js';
|
|
9
10
|
import { registerComponent } from '#internals/definitions/register.js';
|
|
10
11
|
import { partMap } from '#internals/part-map.js';
|
|
11
12
|
import { renderToggleShell } from '#internals/templates/toggle-shell.js';
|
|
@@ -52,10 +53,9 @@ export default class IgcCheckboxComponent extends IgcCheckboxBaseComponent {
|
|
|
52
53
|
`;
|
|
53
54
|
}
|
|
54
55
|
render() {
|
|
55
|
-
const labelledBy = this.getAttribute('aria-labelledby');
|
|
56
56
|
const checked = this.checked;
|
|
57
57
|
return html `
|
|
58
|
-
${renderToggleShell({
|
|
58
|
+
${renderToggleShell(this, {
|
|
59
59
|
type: 'checkbox',
|
|
60
60
|
inputId: this._inputId,
|
|
61
61
|
labelId: this._labelId,
|
|
@@ -73,17 +73,9 @@ export default class IgcCheckboxComponent extends IgcCheckboxBaseComponent {
|
|
|
73
73
|
: this._renderStandard()}
|
|
74
74
|
</span>
|
|
75
75
|
`,
|
|
76
|
-
checked,
|
|
77
76
|
hideLabel: this._hideLabel,
|
|
78
|
-
name: this.name,
|
|
79
|
-
value: this.value,
|
|
80
|
-
required: this.required,
|
|
81
|
-
disabled: this.disabled,
|
|
82
77
|
indeterminate: this.indeterminate,
|
|
83
|
-
|
|
84
|
-
ariaDescribedBy: this._slots.hasAssignedElements('helper-text')
|
|
85
|
-
? 'helper-text'
|
|
86
|
-
: undefined,
|
|
78
|
+
describedBy: helperText(this, this._slots)?.id,
|
|
87
79
|
onClick: this._handleClick,
|
|
88
80
|
onKeyDown: this._handleEnterKeydown,
|
|
89
81
|
onBlur: this._handleBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,+BAA+B,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oB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,EAAE,IAAI,EAAE,OAAO,EAAE;YACpC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;uBACV,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;cAE9C,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ;gBAC7B,CAAC,CAAC,IAAI,CAAC,aAAa,EAAE;gBACtB,CAAC,CAAC,IAAI,CAAC,eAAe,EAC1B;;SAEH;YACD,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,WAAW,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YAC9C,OAAO,EAAE,IAAI,CAAC,YAAY;YAC1B,SAAS,EAAE,IAAI,CAAC,mBAAmB;YACnC,MAAM,EAAE,IAAI,CAAC,WAAW;SACzB,CAAC;QACA,+BAA+B,CAAC,MAAM,CAAC,IAAI,CAAC;KAC/C,CAAC;IACJ,CAAC;;AA3DM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2DACd","sourcesContent":["import { html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { helperText } from '#internals/controllers/aria-projection.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { partMap } from '#internals/part-map.js';\nimport { renderToggleShell } from '#internals/templates/toggle-shell.js';\nimport { createIdGenerator } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { IgcCheckboxBaseComponent } from './checkbox-base.js';\nimport { all } from './themes/checkbox-themes.js';\nimport { styles } from './themes/checkbox.base.css.js';\nimport { styles as shared } from './themes/shared/checkbox/checkbox.common.css.js';\n\nconst nextId = createIdGenerator('checkbox');\n\n/**\n * A check box allowing single values to be selected/deselected.\n *\n * @element igc-checkbox\n *\n * @slot - The checkbox label.\n * @slot helper-text - Renders content below the input.\n * @slot value-missing - Renders content when the required validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n *\n * @fires igcChange - Emitted when the control's checked state changes.\n *\n * @csspart base - The base wrapper of the checkbox.\n * @csspart control - The checkbox input element.\n * @csspart label - The checkbox label.\n * @csspart indicator - The checkbox indicator icon.\n */\nexport default class IgcCheckboxComponent extends IgcCheckboxBaseComponent {\n public static readonly tagName = 'igc-checkbox';\n protected static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcCheckboxComponent, IgcValidationContainerComponent);\n }\n\n private readonly _themes = addThemingController(this, all);\n\n private readonly _inputId = nextId();\n private readonly _labelId = `checkbox-label-${this._inputId}`;\n\n /**\n * Draws the checkbox in indeterminate state.\n * @attr\n */\n @property({ type: Boolean, reflect: true })\n public indeterminate = false;\n\n protected override _handleClick(event: PointerEvent): void {\n this.indeterminate = false;\n super._handleClick(event);\n }\n\n protected _renderStandard() {\n return html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <path d=\"M4.1,12.7 9,17.6 20.3,6.3\" />\n </svg>\n `;\n }\n\n protected _renderIndigo() {\n return html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n <rect width=\"18\" height=\"4\" x=\"3\" y=\"10\" rx=\"1.85\" />\n <path\n d=\"M19.033 5a1.966 1.966 0 0 0-1.418.586l-8.479 8.577-2.753-2.77a1.971 1.971 0 0 0-2.8 0 1.998 1.998 0 0 0 0 2.822l4.155 4.196a1.955 1.955 0 0 0 2.8 0l9.879-9.99a1.998 1.998 0 0 0 0-2.821 1.966 1.966 0 0 0-1.384-.6Z\"\n />\n </svg>\n `;\n }\n\n protected override render() {\n const checked = this.checked;\n\n return html`\n ${renderToggleShell(this, {\n type: 'checkbox',\n inputId: this._inputId,\n labelId: this._labelId,\n baseParts: {\n base: true,\n checked,\n focused: this._focusRingManager.focused,\n },\n controlParts: { control: true, checked },\n labelParts: { label: true, checked },\n renderControl: () => html`\n <span part=${partMap({ indicator: true, checked })}>\n ${\n this._themes.theme === 'indigo'\n ? this._renderIndigo()\n : this._renderStandard()\n }\n </span>\n `,\n hideLabel: this._hideLabel,\n indeterminate: this.indeterminate,\n describedBy: helperText(this, this._slots)?.id,\n onClick: this._handleClick,\n onKeyDown: this._handleEnterKeydown,\n onBlur: this._handleBlur,\n })}\n ${IgcValidationContainerComponent.create(this)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-checkbox': IgcCheckboxComponent;\n }\n}\n"]}
|
|
@@ -22,9 +22,8 @@ export default class IgcSwitchComponent extends IgcCheckboxBaseComponent {
|
|
|
22
22
|
addThemingController(this, all);
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
|
-
const labelledBy = this.getAttribute('aria-labelledby');
|
|
26
25
|
const checked = this.checked;
|
|
27
|
-
return renderToggleShell({
|
|
26
|
+
return renderToggleShell(this, {
|
|
28
27
|
type: 'checkbox',
|
|
29
28
|
inputId: this._inputId,
|
|
30
29
|
labelId: this._labelId,
|
|
@@ -36,13 +35,7 @@ export default class IgcSwitchComponent extends IgcCheckboxBaseComponent {
|
|
|
36
35
|
},
|
|
37
36
|
labelParts: { label: true, checked },
|
|
38
37
|
renderControl: () => html `<span part=${partMap({ thumb: true, checked })}></span>`,
|
|
39
|
-
checked,
|
|
40
38
|
hideLabel: this._hideLabel,
|
|
41
|
-
name: this.name,
|
|
42
|
-
value: this.value,
|
|
43
|
-
required: this.required,
|
|
44
|
-
disabled: this.disabled,
|
|
45
|
-
ariaLabelledBy: labelledBy ? labelledBy : this._labelId,
|
|
46
39
|
onClick: this._handleClick,
|
|
47
40
|
onKeyDown: this._handleEnterKeydown,
|
|
48
41
|
onBlur: this._handleBlur,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/checkbox/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAgB3C,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,wBAAwB;aAC/C,YAAO,GAAG,YAAY,AAAf,CAAgB;aAChC,WAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnB,CAAoB;IAGjC,MAAM,CAAC,QAAQ;QACpB,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAKD;QACE,KAAK,EAAE,CAAC;QAJO,aAAQ,GAAG,MAAM,EAAE,CAAC;QACpB,aAAQ,GAAG,gBAAgB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAI1D,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;IAEkB,MAAM;QACvB,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/components/checkbox/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,iBAAiB,E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AE,IAAI;gBACb,OAAO;gBACP,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO;aACxC;YACD,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE;YACpC,aAAa,EAAE,GAAG,EAAE,CAClB,IAAI,CAAA,cAAc,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,UAAU;YAC/D,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,OAAO,EAAE,IAAI,CAAC,YAAY;YAC1B,SAAS,EAAE,IAAI,CAAC,mBAAmB;YACnC,MAAM,EAAE,IAAI,CAAC,WAAW;SACzB,CAAC,CAAC;IACL,CAAC","sourcesContent":["import { html } from 'lit';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { partMap } from '#internals/part-map.js';\nimport { renderToggleShell } from '#internals/templates/toggle-shell.js';\nimport { createIdGenerator } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport { IgcCheckboxBaseComponent } from './checkbox-base.js';\nimport { styles as shared } from './themes/shared/switch/switch.common.css.js';\nimport { all } from './themes/switch-themes.js';\nimport { styles } from './themes/switch.base.css.js';\n\nconst nextId = createIdGenerator('switch');\n\n/**\n * Similar to a checkbox, a switch controls the state of a single setting on or off.\n *\n * @element igc-switch\n *\n * @slot - The switch label.\n *\n * @fires igcChange - Emitted when the control's checked state changes.\n *\n * @csspart base - The base wrapper of the switch.\n * @csspart control - The switch input element.\n * @csspart thumb - The position indicator of the switch.\n * @csspart label - The switch label.\n */\nexport default class IgcSwitchComponent extends IgcCheckboxBaseComponent {\n public static readonly tagName = 'igc-switch';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcSwitchComponent);\n }\n\n private readonly _inputId = nextId();\n private readonly _labelId = `switch-label-${this._inputId}`;\n\n constructor() {\n super();\n addThemingController(this, all);\n }\n\n protected override render() {\n const checked = this.checked;\n\n return renderToggleShell(this, {\n type: 'checkbox',\n inputId: this._inputId,\n labelId: this._labelId,\n baseParts: { base: true, checked },\n controlParts: {\n control: true,\n checked,\n focused: this._focusRingManager.focused,\n },\n labelParts: { label: true, checked },\n renderControl: () =>\n html`<span part=${partMap({ thumb: true, checked })}></span>`,\n hideLabel: this._hideLabel,\n onClick: this._handleClick,\n onKeyDown: this._handleEnterKeydown,\n onBlur: this._handleBlur,\n });\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-switch': IgcSwitchComponent;\n }\n}\n"]}
|
|
@@ -12,7 +12,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|
|
12
12
|
import { live } from 'lit/directives/live.js';
|
|
13
13
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
14
14
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
15
|
-
import { addAriaProjector } from '#internals/controllers/aria-projection.js';
|
|
15
|
+
import { addAriaProjector, ariaBindings, resolveNaming, } from '#internals/controllers/aria-projection.js';
|
|
16
16
|
import { addKeybindings, altKey, arrowDown, arrowRight, arrowUp, endKey, escapeKey, isKey, } from '#internals/controllers/key-bindings.js';
|
|
17
17
|
import { addRootClickController } from '#internals/controllers/root-click.js';
|
|
18
18
|
import { addSlotController, setSlots } from '#internals/controllers/slot.js';
|
|
@@ -124,10 +124,9 @@ let IgcColorPickerComponent = class IgcColorPickerComponent extends FormAssociat
|
|
|
124
124
|
target: () => (this._isInputMode ? this._anchorRef.value : null),
|
|
125
125
|
state: () => ({
|
|
126
126
|
hasPopup: 'dialog',
|
|
127
|
-
expanded: `${this.open}`,
|
|
128
|
-
labelledBy: this._internals.labels,
|
|
129
127
|
describedBy: this._helperText ? [this._helperText] : null,
|
|
130
128
|
}),
|
|
129
|
+
hasOwnLabel: () => Boolean(this.label),
|
|
131
130
|
});
|
|
132
131
|
}
|
|
133
132
|
update(props) {
|
|
@@ -495,6 +494,7 @@ let IgcColorPickerComponent = class IgcColorPickerComponent extends FormAssociat
|
|
|
495
494
|
return html `
|
|
496
495
|
<button
|
|
497
496
|
${ref(this._anchorRef)}
|
|
497
|
+
${ariaBindings(resolveNaming(this, Boolean(this.label)))}
|
|
498
498
|
id="trigger"
|
|
499
499
|
type="button"
|
|
500
500
|
aria-haspopup="dialog"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../../src/components/color-picker/color-picker.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EACL,cAAc,EACd,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,GACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC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CAAC,CAAC,OACN;UACE,IAAI,CAAC,iBAAiB,EAAE;;KAE7B,CAAC;IACJ,CAAC;;AAxzBgB;IADhB,KAAK,CAAC,cAAc,CAAC;4DACgD;AAkB/D;IADN,QAAQ,EAAE;sDACW;AAWtB;IADC,QAAQ,EAAE;oDAIV;AAgBM;IADN,QAAQ,EAAE;uDACwB;AAS5B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;4DAC3C;AASpB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0DAC3C;AAalB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDACa;AAQlC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDACA;AApJZ,uBAAuB;IAD3C,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GACnB,uBAAuB,CAs3B3C;eAt3BoB,uBAAuB","sourcesContent":["import { html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport { addAriaProjector } from '#internals/controllers/aria-projection.js';\nimport {\n addKeybindings,\n altKey,\n arrowDown,\n arrowRight,\n arrowUp,\n endKey,\n escapeKey,\n isKey,\n} from '#internals/controllers/key-bindings.js';\nimport { addRootClickController } from '#internals/controllers/root-click.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport { shadowOptions } from '#internals/decorators/shadow-options.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { IgcBaseComboBoxComponent } from '#internals/mixins/combo-box.js';\nimport type { AbstractConstructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { FormAssociatedRequiredMixin } from '#internals/mixins/forms/associated-required.js';\nimport { createFormValueState } from '#internals/mixins/forms/form-value.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport {\n addSafeEventListener,\n focusLeftHost,\n getElementFromPath,\n stopPropagation,\n} from '#internals/utils/events.js';\nimport { bindIf } from '#internals/utils/lit.js';\nimport { asNumber, clamp } from '#internals/utils/math.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcButtonComponent from '../button/button.js';\nimport IgcIconButtonComponent from '../button/icon-button.js';\nimport IgcDividerComponent from '../divider/divider.js';\nimport IgcFocusTrapComponent from '../focus-trap/focus-trap.js';\nimport IgcInputComponent from '../input/input.js';\nimport IgcPopoverComponent from '../popover/popover.js';\nimport type IgcSelectItemComponent from '../select/select-item.js';\nimport IgcSelectComponent from '../select/select.js';\nimport type { ColorFormat, ColorPickerMode } from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport IgcVisuallyHiddenComponent from '../visually-hidden/visually-hidden.js';\nimport { isValidColor, normalizeColor } from './common.js';\nimport { ColorModel, getContext } from './model.js';\nimport IgcPickerCanvasComponent, {\n type PickerCanvasEventDetail,\n} from './picker-canvas.js';\nimport { styles } from './themes/color-picker.base.css.js';\nimport { styles as shared } from './themes/shared/color-picker.common.css.js';\nimport { all } from './themes/themes.js';\nimport { colorPickerValidators } from './validators.js';\n\nexport interface IgcColorPickerComponentEventMap {\n igcOpening: CustomEvent<void>;\n igcOpened: CustomEvent<void>;\n igcClosing: CustomEvent<void>;\n igcClosed: CustomEvent<void>;\n igcInput: CustomEvent<string>;\n igcChange: CustomEvent<string>;\n}\n\nconst Slots = setSlots(\n 'value-missing',\n 'custom-error',\n 'invalid',\n 'helper-text'\n);\n\n/** The color string shape of each format. Shown while the input is empty. */\nconst formatPlaceholders: Record<ColorFormat, string> = {\n hex: '#rrggbb',\n rgb: 'rgb(r g b)',\n hsl: 'hsl(h s% l%)',\n};\n\n/** The alpha text is `<digits>%`. An edit removes every other character. */\nconst nonDigits = /\\D/g;\n\n/** The last caret offset in `<digits>%`, the position in front of the `%`. */\nfunction caretLimit(text: string): number {\n return Math.max(text.length - 1, 0);\n}\n\n/**\n * The part of the EyeDropper API that this component uses.\n *\n * The type is declared locally, because the API is not in the baseline DOM\n * typings. Firefox and Safari do not implement it.\n */\ninterface EyeDropperLike {\n open(): Promise<{ sRGBHex: string }>;\n}\n\ntype EyeDropperConstructor = new () => EyeDropperLike;\n\n/** Returns the EyeDropper constructor, if the browser provides one. */\nfunction getEyeDropper(): EyeDropperConstructor | undefined {\n return (globalThis as { EyeDropper?: EyeDropperConstructor }).EyeDropper;\n}\n\n/**\n * Color input component.\n *\n * The user picks a color with the HSV saturation/value canvas, the hue slider\n * and the optional alpha slider. The user can also type a color string: hex,\n * rgb(a), hsl(a) or a named CSS color.\n *\n * The component supports pre-defined swatches and the native EyeDropper API,\n * where the browser provides one. The anchor is a trigger button\n * (`mode=\"default\"`) or an editable text field (`mode=\"input\"`).\n *\n * @element igc-color-picker\n *\n * @slot value-missing - Renders content when the required validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n * @slot helper-text - Renders content below the picker.\n *\n * @fires igcOpening - Emitted just before the picker dropdown is open.\n * @fires igcOpened - Emitted after the picker dropdown is open.\n * @fires igcClosing - Emitted just before the picker dropdown is closed.\n * @fires igcClosed - Emitted after closing the picker dropdown.\n * @fires igcInput - Emitted when the value of the component is changed.\n * @fires igcChange - Emitted when the value of the component is committed.\n *\n * @csspart anchor - The trigger element that opens the picker (the button in default mode, or the swatch prefix in input mode).\n * @csspart empty - Applied alongside `anchor` when no color value is set, rendering a checkered background.\n * @csspart label - The label rendered above the anchor in default mode.\n * @csspart picker - The popover container holding the canvas, sliders, inputs and swatches.\n * @csspart main-row - The row containing the hue slider and the copy/eyedropper buttons.\n * @csspart alpha-row - The row containing the alpha slider and input, rendered when `show-alpha` is set.\n * @csspart inputs-row - The row containing the format select and the color value input.\n * @csspart buttons - The wrapper around the copy and eyedropper buttons.\n * @csspart hue - The hue slider.\n * @csspart alpha - The alpha slider.\n * @csspart copy - The button that copies the current color value to the clipboard.\n * @csspart eye-dropper - The button that activates the EyeDropper API.\n * @csspart format-select - The select control used to switch the color string format.\n * @csspart swatches - The container of the pre-defined color swatches.\n * @csspart swatch - An individual color swatch button.\n */\n@shadowOptions({ delegatesFocus: true })\nexport default class IgcColorPickerComponent extends FormAssociatedRequiredMixin(\n EventEmitterMixin<\n IgcColorPickerComponentEventMap,\n AbstractConstructor<IgcBaseComboBoxComponent>\n >(IgcBaseComboBoxComponent)\n) {\n public static readonly tagName = 'igc-color-picker';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(\n IgcColorPickerComponent,\n IgcInputComponent,\n IgcPopoverComponent,\n IgcFocusTrapComponent,\n IgcSelectComponent,\n IgcPickerCanvasComponent,\n IgcDividerComponent,\n IgcButtonComponent,\n IgcIconButtonComponent,\n IgcValidationContainerComponent,\n IgcVisuallyHiddenComponent\n );\n }\n\n //#region Internal state and properties\n\n protected override get __validators() {\n return colorPickerValidators;\n }\n\n protected readonly _slots = addSlotController(this, { slots: Slots });\n\n protected override readonly _rootClickController = addRootClickController(\n this,\n {\n onHide: this._handleClosing,\n }\n );\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: '',\n });\n\n private readonly _alphaRef = createRef<HTMLInputElement>();\n private readonly _alphaInputRef = createRef<IgcInputComponent>();\n private readonly _canvasRef = createRef<IgcPickerCanvasComponent>();\n private readonly _hueRef = createRef<HTMLInputElement>();\n private readonly _anchorRef = createRef<\n HTMLButtonElement | IgcInputComponent\n >();\n\n private readonly _supportsEyeDropper = Boolean(getEyeDropper());\n private _color = ColorModel.empty();\n private _oldValue = '';\n\n /** The last value written for each host custom property. */\n private readonly _appliedProperties = new Map<string, string>();\n\n @query('#helper-text')\n private readonly _helperText!: IgcValidationContainerComponent | null;\n\n private get _isInputMode(): boolean {\n return this.mode === 'input';\n }\n\n //#endregion\n\n //#region Public attributes and properties\n\n /**\n * The label of the component.\n *\n * In `mode=\"input\"` the component forwards the label to the anchor input.\n * In `mode=\"default\"` it renders the label as a separate element.\n * @attr label\n */\n @property()\n public label?: string;\n\n /**\n * The value of the component as a CSS color string. Accepts hex, rgb(a),\n * hsl(a) and named colors.\n *\n * An empty, whitespace-only or invalid string clears the value.\n *\n * @attr value\n */\n @property()\n public set value(value: string) {\n this._color = ColorModel.parse(value);\n this._updateColor();\n }\n\n public get value(): string {\n return this._formValue.value;\n }\n\n /**\n * Sets the color format of the string value.\n *\n * A format change renders `value` in the new notation. The color does not\n * change, so the component emits no `igcInput` or `igcChange`.\n *\n * @attr format\n * @default 'hex'\n */\n @property()\n public format: ColorFormat = 'hex';\n\n /**\n * Whether to hide the format picker buttons.\n *\n * @attr hide-formats\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-formats' })\n public hideFormats = false;\n\n /**\n * Whether to show the alpha slider and input.\n *\n * @attr show-alpha\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'show-alpha' })\n public showAlpha = false;\n\n /**\n * The mode of the color picker.\n *\n * In `\"default\"` mode the anchor is a trigger button. In `\"input\"` mode the\n * anchor is an editable text field with a color swatch prefix. The prefix\n * also opens the picker.\n *\n * @attr mode\n * @default 'default'\n */\n @property({ reflect: true })\n public mode: ColorPickerMode = 'default';\n\n /**\n * Pre-defined color strings. The component renders them as clickable\n * swatches below the picker controls. A click on a swatch commits its color\n * as the value.\n */\n @property({ attribute: false })\n public swatches: string[] = [];\n\n //#endregion\n\n //#region Lifecycle\n\n constructor() {\n super();\n\n addThemingController(this, all);\n addSafeEventListener(this, 'focusin', this._handleFocusIn);\n addSafeEventListener(this, 'focusout', this._handleFocusOut);\n\n addKeybindings(this, { skip: () => this.disabled })\n .set(escapeKey, this._handleKeyboardClosing)\n .set([altKey, arrowDown], this._handleAnchorClick)\n .set([altKey, arrowUp], this._handleKeyboardClosing);\n\n addKeybindings(this, {\n skip: () => this.disabled || !this._alphaInputRef.value,\n ref: this._alphaInputRef,\n bindingDefaults: { repeat: true },\n })\n .set(arrowUp, () => this._handleAlphaInputSpin(1))\n .set(arrowDown, () => this._handleAlphaInputSpin(-1))\n .set(arrowRight, this._handleAlphaInputCaretForward, {\n preventDefault: false,\n })\n .set(endKey, this._handleAlphaInputCaretForward, {\n preventDefault: false,\n });\n\n addAriaProjector(this, {\n target: () => (this._isInputMode ? this._anchorRef.value : null),\n state: () => ({\n hasPopup: 'dialog',\n expanded: `${this.open}`,\n labelledBy: this._internals.labels,\n describedBy: this._helperText ? [this._helperText] : null,\n }),\n });\n }\n\n protected override update(props: PropertyValues<this>): void {\n if (props.has('open')) {\n this._rootClickController.update();\n }\n\n if (this.hasUpdated && props.has('format')) {\n this._formValue.setValueAndFormState(this._color.asString(this.format));\n }\n\n this._applyColorProperties();\n\n super.update(props);\n }\n\n protected override updated(props: PropertyValues<this>): void {\n super.updated(props);\n\n if (props.has('open') || props.has('value')) {\n // Wait for the paint, then sync the marker position with the color.\n requestAnimationFrame(() => this._syncCanvasPosition());\n }\n }\n\n //#endregion\n\n //#region Form associated overrides\n\n protected override formResetCallback(): void {\n super.formResetCallback();\n\n if (this._isInputMode) {\n const input = this._anchorRef.value as IgcInputComponent;\n input?.['formResetCallback']();\n }\n }\n\n //#endregion\n\n //#region Event handlers\n\n private _handleClosing(): void {\n this._hide(true);\n }\n\n private async _handleKeyboardClosing(): Promise<void> {\n if (await this._hide(true)) {\n this._anchorRef.value?.focus();\n }\n }\n\n private _handleFocusIn(event: FocusEvent): void {\n if (focusLeftHost(this, event)) {\n this._oldValue = this._alphaColor;\n }\n }\n\n private _handleFocusOut(event: FocusEvent): void {\n if (!focusLeftHost(this, event)) {\n return;\n }\n\n this._handleBlur();\n\n if (this._alphaColor !== this._oldValue) {\n this._oldValue = this._alphaColor;\n this.emitEvent('igcChange', { detail: this.value });\n }\n }\n\n private _handleCanvasColorPicked(\n event: CustomEvent<PickerCanvasEventDetail>\n ): void {\n this._color.setSaturationAndValue(event.detail.x, 100 - event.detail.y);\n this._updateColor();\n this._emitInputEvent();\n }\n\n private _handleHueValueChange(event: Event): void {\n stopPropagation(event);\n\n this._color.h = asNumber(this._hueRef.value?.value);\n this._updateColor();\n this._emitInputEvent();\n }\n\n private _handleAlphaSliderValueChange(event: Event): void {\n stopPropagation(event);\n\n this._setAlpha(asNumber(this._alphaRef.value?.value));\n }\n\n /**\n * Writes the alpha field again as `<digits>%` after each edit.\n *\n * @remarks\n * The `%` is part of the value, not a suffix element, so the browser lets the\n * user edit it. This handler corrects the result of an edit, and does not\n * filter the keystrokes in `beforeinput`. The `%` is then a literal for each\n * way that text reaches the field: typing, paste, drop, composition, undo and\n * autofill. `beforeinput` carries `data` only for typing.\n */\n private _handleAlphaInputEdit(event: Event): void {\n const input = this._alphaInputRef.value;\n const native = getElementFromPath<HTMLInputElement>('input', event);\n\n if (!input || !native) return;\n\n const caret = native.selectionStart ?? native.value.length;\n const typed = native.value.slice(0, caret).replace(nonDigits, '').length;\n const digits = native.value.replace(nonDigits, '');\n const percent = clamp(asNumber(digits), 0, 100);\n\n const text = digits ? `${percent}%` : '';\n\n this._writeAlphaText(input, text, Math.min(typed, caretLimit(text)));\n\n if (digits) {\n this._setAlpha(percent);\n }\n }\n\n /**\n * Keeps the caret and the selection in the digits.\n *\n * @remarks\n * The last `%` is a literal. Without this handler, the caret goes after the\n * `%` on focus, on a click past the text, and when a shifted selection\n * extends over it. The handler thus runs on `keyup`, `focusin` and `click`.\n * The parse discards text after the `%`.\n */\n private _handleAlphaInputCaret(event: Event): void {\n const native = getElementFromPath<HTMLInputElement>('input', event);\n if (!native) return;\n\n const limit = caretLimit(native.value);\n\n native.setSelectionRange(\n Math.min(native.selectionStart ?? 0, limit),\n Math.min(native.selectionEnd ?? 0, limit)\n );\n }\n\n /**\n * Steps the alpha by one percent.\n *\n * @remarks\n * The step applies to the color, not to the text of the field, which keeps a\n * held arrow key correct. The key downs repeat faster than a render, so the\n * text can be stale.\n *\n * The handler writes the new text itself, so that the caret does not move. A\n * value assignment puts the caret after the `%`, and a write from the render\n * applies one frame late, which the user sees as a jump.\n */\n private _handleAlphaInputSpin(increment: -1 | 1): void {\n const input = this._alphaInputRef.value;\n const percent = clamp(this._alphaPercent + increment, 0, 100);\n\n if (!input || percent === this._alphaPercent) return;\n\n this._writeAlphaText(input, `${percent}%`);\n this._setAlpha(percent);\n }\n\n /**\n * Holds the caret at the `%`. Without this handler the caret steps past the\n * `%`, and `keyup` pulls it back. This is the frame-late jump that\n * {@link _handleAlphaInputSpin} describes.\n */\n private _handleAlphaInputCaretForward(event: KeyboardEvent): void {\n const native = getElementFromPath<HTMLInputElement>('input', event);\n if (!native) return;\n\n const limit = caretLimit(native.value);\n\n if (isKey(event, endKey) || (native.selectionEnd ?? 0) >= limit) {\n event.preventDefault();\n native.setSelectionRange(limit, limit);\n }\n }\n\n private _handleAlphaInputChange(event: CustomEvent<string>): void {\n stopPropagation(event);\n\n const input = event.target as IgcInputComponent;\n\n if (!input.value) {\n input.value = `${this._alphaPercent}%`;\n }\n }\n\n private _handleFormatChange(\n event: CustomEvent<IgcSelectItemComponent>\n ): void {\n stopPropagation(event);\n this.format = event.detail.value as ColorFormat;\n }\n\n private _handleColorInputChange(event: CustomEvent<string>): void {\n stopPropagation(event);\n\n const input = event.target as IgcInputComponent;\n const value = normalizeColor(event.detail);\n const cleared = !value;\n\n // An invalid and non-empty value reverts the input to the current color.\n // An empty value clears the color.\n if (!cleared && !isValidColor(value, getContext())) {\n input.value = this._color.asString(this.format);\n return;\n }\n\n this._color = cleared ? ColorModel.empty() : ColorModel.parse(value);\n this._updateColor();\n this._syncCanvasPosition();\n }\n\n private _handleEyeDropperClick(): void {\n const EyeDropper = getEyeDropper();\n\n if (!EyeDropper) return;\n\n new EyeDropper()\n .open()\n .then((result) => {\n this.value = result.sRGBHex;\n this._emitInputEvent();\n })\n .catch(() => {});\n }\n\n private _handleCopy(): void {\n navigator.clipboard?.writeText(this.value).catch(() => {});\n }\n\n private _handleSwatchClick(event: Event): void {\n const swatch = getElementFromPath<HTMLButtonElement>(\n 'button[part=\"swatch\"]',\n event\n );\n const color = swatch?.dataset.color;\n\n if (color) {\n this.value = color;\n this._emitInputEvent();\n }\n }\n\n //#endregion\n\n //#region Internal methods\n\n /**\n * The current color with its alpha, in a notation that is independent of\n * `format`.\n */\n private get _alphaColor(): string {\n return this._color.asString('rgb', true);\n }\n\n /**\n * The current color with an opaque alpha channel.\n *\n * @remarks\n * The swatch preview paints this color on one half of its surface, and\n * {@link _alphaColor} on the other half, which shows a translucent color next\n * to its opaque form. At full alpha the two halves agree and the split is\n * invisible, so an opaque color needs no separate branch.\n *\n * This value is defined also with no color. An empty color is white, which is\n * where the alpha ramp and the canvas marker belong before the first pick.\n * The anchor keeps its \"no color\" mark, because {@link _previewStyle} uses\n * {@link _alphaColor}, which stays empty.\n */\n private get _opaqueColor(): string {\n return new ColorModel(this._color.toRGB()).asString('rgb');\n }\n\n /** The alpha channel as the whole percentage that both alpha controls use. */\n private get _alphaPercent(): number {\n return Math.round(this._color.alpha * 100);\n }\n\n /** The pure hue that the saturation/value plane and the hue thumb use. */\n private get _currentColor(): string {\n return `hsl(${this._color.h} 100% 50%)`;\n }\n\n /**\n * Copies the colors that the stylesheet needs onto the host.\n *\n * @remarks\n * `update()` calls this, not the handlers that change the color, so it runs\n * also for the first render. A picker with no value calls none of those\n * handlers, and the plane would keep the stylesheet fallback.\n */\n private _applyColorProperties(): void {\n const properties = {\n '--_current-color': this._currentColor,\n '--_selected-color': this._opaqueColor,\n };\n\n for (const [name, value] of Object.entries(properties)) {\n if (this._appliedProperties.get(name) !== value) {\n this._appliedProperties.set(name, value);\n this.style.setProperty(name, value);\n }\n }\n }\n\n /**\n * Replaces the whole text of the alpha field and puts the caret in front of\n * the `%` by default.\n */\n private _writeAlphaText(\n input: IgcInputComponent,\n text: string,\n caret = caretLimit(text)\n ): void {\n input.setRangeText(text, 0, input.value.length);\n input.setSelectionRange(caret, caret);\n }\n\n private _setAlpha(percent: number): void {\n const alpha = clamp(percent, 0, 100) / 100;\n\n if (this._color.alpha === alpha) {\n return;\n }\n\n this._color.alpha = alpha;\n this._updateColor();\n this._emitInputEvent();\n }\n\n private _updateColor(): void {\n this._formValue.setValueAndFormState(this._color.asString(this.format));\n this.requestUpdate();\n }\n\n private _syncCanvasPosition(): void {\n if (!this._canvasRef.value || !this.open) return;\n\n const rect = this._canvasRef.value.getBoundingClientRect();\n const { width: markerWidth, height: markerHeight } =\n this._canvasRef.value.getMarkerDimensions();\n\n const [, s, v] = this._color.toHSV();\n const x = (s / 100) * rect.width - markerWidth;\n const y = ((100 - v) / 100) * rect.height - markerHeight;\n\n this._canvasRef.value.x = x;\n this._canvasRef.value.y = y;\n }\n\n private _emitInputEvent(): void {\n this.emitEvent('igcInput', { detail: this.value });\n }\n\n //#endregion\n\n //#region Canvas area rendering\n\n private _renderCanvasGradient(): TemplateResult {\n const [, saturation, brightness] = this._color.toHSV();\n\n return html`\n <igc-picker-canvas\n exportparts=\"marker, dragging\"\n part=\"picker-canvas\"\n ${ref(this._canvasRef)}\n @igcColorPicked=${this._handleCanvasColorPicked}\n currentColor=${this._currentColor}\n markerColor=${this._opaqueColor}\n .saturation=${saturation}\n .brightness=${brightness}\n >\n </igc-picker-canvas>\n `;\n }\n\n //#endregion\n\n //#region Hue row and buttons rendering\n\n private _renderHueSlider(): TemplateResult {\n return html`\n <input\n ${ref(this._hueRef)}\n aria-label=\"Hue\"\n type=\"range\"\n part=\"hue\"\n min=\"0\"\n max=\"360\"\n .value=${String(Math.round(this._color.h))}\n @input=${this._handleHueValueChange}\n @change=${stopPropagation}\n />\n `;\n }\n\n private _renderIconButton(\n part: string,\n icon: string,\n label: string,\n handler: () => void,\n disabled = false\n ): TemplateResult {\n return html`\n <igc-icon-button\n part=${part}\n variant=\"flat\"\n name=${icon}\n ?disabled=${disabled}\n @click=${handler}\n >\n <igc-visually-hidden>${label}</igc-visually-hidden>\n </igc-icon-button>\n `;\n }\n\n private _renderPickerButtons(): TemplateResult {\n return html`\n <div part=\"buttons\">\n ${this._renderIconButton(\n 'copy',\n 'copy_content',\n 'Copy color value to clipboard',\n this._handleCopy\n )}\n ${this._renderIconButton(\n 'eye-dropper',\n 'eye_dropper',\n 'Pick a color from the screen',\n this._handleEyeDropperClick,\n !this._supportsEyeDropper\n )}\n </div>\n `;\n }\n\n //#endregion\n\n //#region Alpha row rendering\n\n private _renderAlphaRow(): TemplateResult {\n return html`\n <input\n ${ref(this._alphaRef)}\n aria-label=\"Alpha slider\"\n type=\"range\"\n part=\"alpha\"\n min=\"0\"\n max=\"100\"\n .value=${String(this._alphaPercent)}\n @input=${this._handleAlphaSliderValueChange}\n @change=${stopPropagation}\n />\n\n <igc-visually-hidden>\n <label for=\"alpha\">Alpha value</label>\n </igc-visually-hidden>\n\n <igc-input\n ${ref(this._alphaInputRef)}\n id=\"alpha\"\n name=\"alpha\"\n placeholder=\"Alpha value\"\n inputmode=\"numeric\"\n part=\"alpha-input\"\n outlined\n type=\"text\"\n .value=${live(`${this._alphaPercent}%`)}\n @input=${this._handleAlphaInputEdit}\n @focusin=${this._handleAlphaInputCaret}\n @click=${this._handleAlphaInputCaret}\n @keyup=${this._handleAlphaInputCaret}\n @igcChange=${this._handleAlphaInputChange}\n ></igc-input>\n `;\n }\n\n //#endregion\n\n //#region Color formats and input row rendering\n\n private _renderSelect(): TemplateResult {\n return html`\n <igc-visually-hidden>\n <label for=\"format-select\">Color format</label>\n </igc-visually-hidden>\n\n <igc-select\n id=\"format-select\"\n part=\"format-select\"\n placeholder=\"Color format\"\n name=\"format\"\n outlined\n .value=${this.format}\n @igcChange=${this._handleFormatChange}\n >\n <igc-select-item value=\"hex\">Hex</igc-select-item>\n <igc-select-item value=\"rgb\">RGB</igc-select-item>\n <igc-select-item value=\"hsl\">HSL</igc-select-item>\n </igc-select>\n `;\n }\n\n private _renderInputsRow(): TemplateResult {\n return html`\n ${cache(this.hideFormats ? nothing : this._renderSelect())}\n <igc-visually-hidden>\n <label for=\"color-input\"> Color value input </label>\n </igc-visually-hidden>\n\n <igc-input\n id=\"color-input\"\n name=\"color-input\"\n placeholder=${formatPlaceholders[this.format]}\n outlined\n .value=${live(this._color.asString(this.format))}\n @igcChange=${this._handleColorInputChange}\n ></igc-input>\n `;\n }\n\n //#endregion\n\n //#region Swatches rendering\n\n private _renderSwatches(): TemplateResult | typeof nothing {\n return !isEmpty(this.swatches)\n ? html`\n <igc-divider></igc-divider>\n <div part=\"swatches\" @click=${this._handleSwatchClick}>\n ${this.swatches.map(\n (color) => html`\n <button\n type=\"button\"\n part=\"swatch\"\n data-color=${color}\n aria-label=${color}\n style=\"background-color: ${color}\"\n ></button>\n `\n )}\n </div>\n `\n : nothing;\n }\n\n //#endregion\n\n //#region Anchor rendering\n\n private get _anchorParts(): ReturnType<typeof partMap> {\n return partMap({\n anchor: true,\n empty: this._color.isEmpty,\n 'input-mode': this._isInputMode,\n });\n }\n\n /**\n * The swatch preview style that both anchors use.\n *\n * `--_color-preview` paints the opaque color over the left half.\n * `--_alpha-preview` paints the color with its real alpha over the whole\n * surface. Do not transpose the two. See the `swatch-preview` mixin.\n */\n private _previewStyle(): ReturnType<typeof styleMap> {\n const color = this._alphaColor;\n\n return bindIf(\n color,\n styleMap({\n '--_alpha-preview': color,\n '--_color-preview': this._opaqueColor,\n })\n );\n }\n\n private _renderButtonAnchor(): TemplateResult {\n return html`\n <button\n ${ref(this._anchorRef)}\n id=\"trigger\"\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-controls=\"picker\"\n aria-expanded=${this.open}\n aria-describedby=\"helper-text\"\n part=${this._anchorParts}\n slot=\"anchor\"\n style=${this._previewStyle()}\n ?disabled=${this.disabled}\n @click=${this._handleAnchorClick}\n >\n <igc-visually-hidden>Open color picker</igc-visually-hidden>\n </button>\n `;\n }\n\n private _renderInputAnchor(): TemplateResult {\n return html`\n <igc-input\n ${ref(this._anchorRef)}\n slot=\"anchor\"\n outlined\n placeholder=${formatPlaceholders[this.format]}\n label=${ifDefined(this.label)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n .value=${live(this.value)}\n .invalid=${this.invalid}\n @igcChange=${this._handleColorInputChange}\n >\n <div slot=\"prefix\">\n <button\n type=\"button\"\n part=${this._anchorParts}\n aria-label=\"Open color picker\"\n aria-haspopup=\"dialog\"\n aria-controls=\"picker\"\n aria-expanded=${this.open}\n style=${this._previewStyle()}\n ?disabled=${this.disabled}\n @click=${this._handleAnchorClick}\n ></button>\n </div>\n </igc-input>\n `;\n }\n\n private _renderAnchor(): TemplateResult {\n return this._isInputMode\n ? this._renderInputAnchor()\n : this._renderButtonAnchor();\n }\n\n private _renderHelperText(): TemplateResult {\n return IgcValidationContainerComponent.create(this, {\n id: 'helper-text',\n hasHelperText: true,\n });\n }\n\n //#endregion\n\n private _renderPicker(): TemplateResult {\n return html`\n <igc-focus-trap ?disabled=${!this.open} .inert=${!this.open}>\n <div\n id=\"picker\"\n part=\"picker\"\n role=\"dialog\"\n aria-label=\"Color picker\"\n aria-modal=\"false\"\n >\n ${this._renderCanvasGradient()}\n <div part=\"main-row\">\n ${this._renderHueSlider()}${this._renderPickerButtons()}\n </div>\n ${\n this.showAlpha\n ? html`<div part=\"alpha-row\">${this._renderAlphaRow()}</div>`\n : nothing\n }\n <div part=\"inputs-row\">${this._renderInputsRow()}</div>\n ${this._renderSwatches()}\n </div>\n </igc-focus-trap>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div part=\"color-picker\">\n <igc-popover\n ?open=${this.open}\n flip\n .scrollStrategy=${this.scrollStrategy}\n @igcPopoverScrollClose=${this._handleClosing}\n >\n ${this._renderAnchor()}${this._renderPicker()}\n </igc-popover>\n ${\n !this._isInputMode && this.label\n ? html`<label part=\"label\" for=\"trigger\">${this.label}</label>`\n : nothing\n }\n ${this._renderHelperText()}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-color-picker': IgcColorPickerComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../../../src/components/color-picker/color-picker.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAA4C,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,aAAa,GACd,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,cAAc,EACd,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,GACN,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,gD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AAK;YAC9B,CAAC,CAAC,IAAI,CAAA,qCAAqC,IAAI,CAAC,KAAK,UAAU;YAC/D,CAAC,CAAC,OACN;UACE,IAAI,CAAC,iBAAiB,EAAE;;KAE7B,CAAC;IACJ,CAAC;;AAzzBgB;IADhB,KAAK,CAAC,cAAc,CAAC;4DACgD;AAkB/D;IADN,QAAQ,EAAE;sDACW;AAWtB;IADC,QAAQ,EAAE;oDAIV;AAgBM;IADN,QAAQ,EAAE;uDACwB;AAS5B;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;4DAC3C;AASpB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0DAC3C;AAalB;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDACa;AAQlC;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDACA;AApJZ,uBAAuB;IAD3C,aAAa,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;GACnB,uBAAuB,CAu3B3C;eAv3BoB,uBAAuB","sourcesContent":["import { html, nothing, type PropertyValues, type TemplateResult } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { cache } from 'lit/directives/cache.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport {\n addAriaProjector,\n ariaBindings,\n resolveNaming,\n} from '#internals/controllers/aria-projection.js';\nimport {\n addKeybindings,\n altKey,\n arrowDown,\n arrowRight,\n arrowUp,\n endKey,\n escapeKey,\n isKey,\n} from '#internals/controllers/key-bindings.js';\nimport { addRootClickController } from '#internals/controllers/root-click.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport { shadowOptions } from '#internals/decorators/shadow-options.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { IgcBaseComboBoxComponent } from '#internals/mixins/combo-box.js';\nimport type { AbstractConstructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { FormAssociatedRequiredMixin } from '#internals/mixins/forms/associated-required.js';\nimport { createFormValueState } from '#internals/mixins/forms/form-value.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport {\n addSafeEventListener,\n focusLeftHost,\n getElementFromPath,\n stopPropagation,\n} from '#internals/utils/events.js';\nimport { bindIf } from '#internals/utils/lit.js';\nimport { asNumber, clamp } from '#internals/utils/math.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcButtonComponent from '../button/button.js';\nimport IgcIconButtonComponent from '../button/icon-button.js';\nimport IgcDividerComponent from '../divider/divider.js';\nimport IgcFocusTrapComponent from '../focus-trap/focus-trap.js';\nimport IgcInputComponent from '../input/input.js';\nimport IgcPopoverComponent from '../popover/popover.js';\nimport type IgcSelectItemComponent from '../select/select-item.js';\nimport IgcSelectComponent from '../select/select.js';\nimport type { ColorFormat, ColorPickerMode } from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport IgcVisuallyHiddenComponent from '../visually-hidden/visually-hidden.js';\nimport { isValidColor, normalizeColor } from './common.js';\nimport { ColorModel, getContext } from './model.js';\nimport IgcPickerCanvasComponent, {\n type PickerCanvasEventDetail,\n} from './picker-canvas.js';\nimport { styles } from './themes/color-picker.base.css.js';\nimport { styles as shared } from './themes/shared/color-picker.common.css.js';\nimport { all } from './themes/themes.js';\nimport { colorPickerValidators } from './validators.js';\n\nexport interface IgcColorPickerComponentEventMap {\n igcOpening: CustomEvent<void>;\n igcOpened: CustomEvent<void>;\n igcClosing: CustomEvent<void>;\n igcClosed: CustomEvent<void>;\n igcInput: CustomEvent<string>;\n igcChange: CustomEvent<string>;\n}\n\nconst Slots = setSlots(\n 'value-missing',\n 'custom-error',\n 'invalid',\n 'helper-text'\n);\n\n/** The color string shape of each format. Shown while the input is empty. */\nconst formatPlaceholders: Record<ColorFormat, string> = {\n hex: '#rrggbb',\n rgb: 'rgb(r g b)',\n hsl: 'hsl(h s% l%)',\n};\n\n/** The alpha text is `<digits>%`. An edit removes every other character. */\nconst nonDigits = /\\D/g;\n\n/** The last caret offset in `<digits>%`, the position in front of the `%`. */\nfunction caretLimit(text: string): number {\n return Math.max(text.length - 1, 0);\n}\n\n/**\n * The part of the EyeDropper API that this component uses.\n *\n * The type is declared locally, because the API is not in the baseline DOM\n * typings. Firefox and Safari do not implement it.\n */\ninterface EyeDropperLike {\n open(): Promise<{ sRGBHex: string }>;\n}\n\ntype EyeDropperConstructor = new () => EyeDropperLike;\n\n/** Returns the EyeDropper constructor, if the browser provides one. */\nfunction getEyeDropper(): EyeDropperConstructor | undefined {\n return (globalThis as { EyeDropper?: EyeDropperConstructor }).EyeDropper;\n}\n\n/**\n * Color input component.\n *\n * The user picks a color with the HSV saturation/value canvas, the hue slider\n * and the optional alpha slider. The user can also type a color string: hex,\n * rgb(a), hsl(a) or a named CSS color.\n *\n * The component supports pre-defined swatches and the native EyeDropper API,\n * where the browser provides one. The anchor is a trigger button\n * (`mode=\"default\"`) or an editable text field (`mode=\"input\"`).\n *\n * @element igc-color-picker\n *\n * @slot value-missing - Renders content when the required validation fails.\n * @slot custom-error - Renders content when setCustomValidity(message) is set.\n * @slot invalid - Renders content when the component is in invalid state (validity.valid = false).\n * @slot helper-text - Renders content below the picker.\n *\n * @fires igcOpening - Emitted just before the picker dropdown is open.\n * @fires igcOpened - Emitted after the picker dropdown is open.\n * @fires igcClosing - Emitted just before the picker dropdown is closed.\n * @fires igcClosed - Emitted after closing the picker dropdown.\n * @fires igcInput - Emitted when the value of the component is changed.\n * @fires igcChange - Emitted when the value of the component is committed.\n *\n * @csspart anchor - The trigger element that opens the picker (the button in default mode, or the swatch prefix in input mode).\n * @csspart empty - Applied alongside `anchor` when no color value is set, rendering a checkered background.\n * @csspart label - The label rendered above the anchor in default mode.\n * @csspart picker - The popover container holding the canvas, sliders, inputs and swatches.\n * @csspart main-row - The row containing the hue slider and the copy/eyedropper buttons.\n * @csspart alpha-row - The row containing the alpha slider and input, rendered when `show-alpha` is set.\n * @csspart inputs-row - The row containing the format select and the color value input.\n * @csspart buttons - The wrapper around the copy and eyedropper buttons.\n * @csspart hue - The hue slider.\n * @csspart alpha - The alpha slider.\n * @csspart copy - The button that copies the current color value to the clipboard.\n * @csspart eye-dropper - The button that activates the EyeDropper API.\n * @csspart format-select - The select control used to switch the color string format.\n * @csspart swatches - The container of the pre-defined color swatches.\n * @csspart swatch - An individual color swatch button.\n */\n@shadowOptions({ delegatesFocus: true })\nexport default class IgcColorPickerComponent extends FormAssociatedRequiredMixin(\n EventEmitterMixin<\n IgcColorPickerComponentEventMap,\n AbstractConstructor<IgcBaseComboBoxComponent>\n >(IgcBaseComboBoxComponent)\n) {\n public static readonly tagName = 'igc-color-picker';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(\n IgcColorPickerComponent,\n IgcInputComponent,\n IgcPopoverComponent,\n IgcFocusTrapComponent,\n IgcSelectComponent,\n IgcPickerCanvasComponent,\n IgcDividerComponent,\n IgcButtonComponent,\n IgcIconButtonComponent,\n IgcValidationContainerComponent,\n IgcVisuallyHiddenComponent\n );\n }\n\n //#region Internal state and properties\n\n protected override get __validators() {\n return colorPickerValidators;\n }\n\n protected readonly _slots = addSlotController(this, { slots: Slots });\n\n protected override readonly _rootClickController = addRootClickController(\n this,\n {\n onHide: this._handleClosing,\n }\n );\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: '',\n });\n\n private readonly _alphaRef = createRef<HTMLInputElement>();\n private readonly _alphaInputRef = createRef<IgcInputComponent>();\n private readonly _canvasRef = createRef<IgcPickerCanvasComponent>();\n private readonly _hueRef = createRef<HTMLInputElement>();\n private readonly _anchorRef = createRef<\n HTMLButtonElement | IgcInputComponent\n >();\n\n private readonly _supportsEyeDropper = Boolean(getEyeDropper());\n private _color = ColorModel.empty();\n private _oldValue = '';\n\n /** The last value written for each host custom property. */\n private readonly _appliedProperties = new Map<string, string>();\n\n @query('#helper-text')\n private readonly _helperText!: IgcValidationContainerComponent | null;\n\n private get _isInputMode(): boolean {\n return this.mode === 'input';\n }\n\n //#endregion\n\n //#region Public attributes and properties\n\n /**\n * The label of the component.\n *\n * In `mode=\"input\"` the component forwards the label to the anchor input.\n * In `mode=\"default\"` it renders the label as a separate element.\n * @attr label\n */\n @property()\n public label?: string;\n\n /**\n * The value of the component as a CSS color string. Accepts hex, rgb(a),\n * hsl(a) and named colors.\n *\n * An empty, whitespace-only or invalid string clears the value.\n *\n * @attr value\n */\n @property()\n public set value(value: string) {\n this._color = ColorModel.parse(value);\n this._updateColor();\n }\n\n public get value(): string {\n return this._formValue.value;\n }\n\n /**\n * Sets the color format of the string value.\n *\n * A format change renders `value` in the new notation. The color does not\n * change, so the component emits no `igcInput` or `igcChange`.\n *\n * @attr format\n * @default 'hex'\n */\n @property()\n public format: ColorFormat = 'hex';\n\n /**\n * Whether to hide the format picker buttons.\n *\n * @attr hide-formats\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-formats' })\n public hideFormats = false;\n\n /**\n * Whether to show the alpha slider and input.\n *\n * @attr show-alpha\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'show-alpha' })\n public showAlpha = false;\n\n /**\n * The mode of the color picker.\n *\n * In `\"default\"` mode the anchor is a trigger button. In `\"input\"` mode the\n * anchor is an editable text field with a color swatch prefix. The prefix\n * also opens the picker.\n *\n * @attr mode\n * @default 'default'\n */\n @property({ reflect: true })\n public mode: ColorPickerMode = 'default';\n\n /**\n * Pre-defined color strings. The component renders them as clickable\n * swatches below the picker controls. A click on a swatch commits its color\n * as the value.\n */\n @property({ attribute: false })\n public swatches: string[] = [];\n\n //#endregion\n\n //#region Lifecycle\n\n constructor() {\n super();\n\n addThemingController(this, all);\n addSafeEventListener(this, 'focusin', this._handleFocusIn);\n addSafeEventListener(this, 'focusout', this._handleFocusOut);\n\n addKeybindings(this, { skip: () => this.disabled })\n .set(escapeKey, this._handleKeyboardClosing)\n .set([altKey, arrowDown], this._handleAnchorClick)\n .set([altKey, arrowUp], this._handleKeyboardClosing);\n\n addKeybindings(this, {\n skip: () => this.disabled || !this._alphaInputRef.value,\n ref: this._alphaInputRef,\n bindingDefaults: { repeat: true },\n })\n .set(arrowUp, () => this._handleAlphaInputSpin(1))\n .set(arrowDown, () => this._handleAlphaInputSpin(-1))\n .set(arrowRight, this._handleAlphaInputCaretForward, {\n preventDefault: false,\n })\n .set(endKey, this._handleAlphaInputCaretForward, {\n preventDefault: false,\n });\n\n addAriaProjector(this, {\n target: () => (this._isInputMode ? this._anchorRef.value : null),\n // A text input cannot have `aria-expanded`. The prefix button has it.\n state: () => ({\n hasPopup: 'dialog',\n describedBy: this._helperText ? [this._helperText] : null,\n }),\n hasOwnLabel: () => Boolean(this.label),\n });\n }\n\n protected override update(props: PropertyValues<this>): void {\n if (props.has('open')) {\n this._rootClickController.update();\n }\n\n if (this.hasUpdated && props.has('format')) {\n this._formValue.setValueAndFormState(this._color.asString(this.format));\n }\n\n this._applyColorProperties();\n\n super.update(props);\n }\n\n protected override updated(props: PropertyValues<this>): void {\n super.updated(props);\n\n if (props.has('open') || props.has('value')) {\n // Wait for the paint, then sync the marker position with the color.\n requestAnimationFrame(() => this._syncCanvasPosition());\n }\n }\n\n //#endregion\n\n //#region Form associated overrides\n\n protected override formResetCallback(): void {\n super.formResetCallback();\n\n if (this._isInputMode) {\n const input = this._anchorRef.value as IgcInputComponent;\n input?.['formResetCallback']();\n }\n }\n\n //#endregion\n\n //#region Event handlers\n\n private _handleClosing(): void {\n this._hide(true);\n }\n\n private async _handleKeyboardClosing(): Promise<void> {\n if (await this._hide(true)) {\n this._anchorRef.value?.focus();\n }\n }\n\n private _handleFocusIn(event: FocusEvent): void {\n if (focusLeftHost(this, event)) {\n this._oldValue = this._alphaColor;\n }\n }\n\n private _handleFocusOut(event: FocusEvent): void {\n if (!focusLeftHost(this, event)) {\n return;\n }\n\n this._handleBlur();\n\n if (this._alphaColor !== this._oldValue) {\n this._oldValue = this._alphaColor;\n this.emitEvent('igcChange', { detail: this.value });\n }\n }\n\n private _handleCanvasColorPicked(\n event: CustomEvent<PickerCanvasEventDetail>\n ): void {\n this._color.setSaturationAndValue(event.detail.x, 100 - event.detail.y);\n this._updateColor();\n this._emitInputEvent();\n }\n\n private _handleHueValueChange(event: Event): void {\n stopPropagation(event);\n\n this._color.h = asNumber(this._hueRef.value?.value);\n this._updateColor();\n this._emitInputEvent();\n }\n\n private _handleAlphaSliderValueChange(event: Event): void {\n stopPropagation(event);\n\n this._setAlpha(asNumber(this._alphaRef.value?.value));\n }\n\n /**\n * Writes the alpha field again as `<digits>%` after each edit.\n *\n * @remarks\n * The `%` is part of the value, not a suffix element, so the browser lets the\n * user edit it. This handler corrects the result of an edit, and does not\n * filter the keystrokes in `beforeinput`. The `%` is then a literal for each\n * way that text reaches the field: typing, paste, drop, composition, undo and\n * autofill. `beforeinput` carries `data` only for typing.\n */\n private _handleAlphaInputEdit(event: Event): void {\n const input = this._alphaInputRef.value;\n const native = getElementFromPath<HTMLInputElement>('input', event);\n\n if (!input || !native) return;\n\n const caret = native.selectionStart ?? native.value.length;\n const typed = native.value.slice(0, caret).replace(nonDigits, '').length;\n const digits = native.value.replace(nonDigits, '');\n const percent = clamp(asNumber(digits), 0, 100);\n\n const text = digits ? `${percent}%` : '';\n\n this._writeAlphaText(input, text, Math.min(typed, caretLimit(text)));\n\n if (digits) {\n this._setAlpha(percent);\n }\n }\n\n /**\n * Keeps the caret and the selection in the digits.\n *\n * @remarks\n * The last `%` is a literal. Without this handler, the caret goes after the\n * `%` on focus, on a click past the text, and when a shifted selection\n * extends over it. The handler thus runs on `keyup`, `focusin` and `click`.\n * The parse discards text after the `%`.\n */\n private _handleAlphaInputCaret(event: Event): void {\n const native = getElementFromPath<HTMLInputElement>('input', event);\n if (!native) return;\n\n const limit = caretLimit(native.value);\n\n native.setSelectionRange(\n Math.min(native.selectionStart ?? 0, limit),\n Math.min(native.selectionEnd ?? 0, limit)\n );\n }\n\n /**\n * Steps the alpha by one percent.\n *\n * @remarks\n * The step applies to the color, not to the text of the field, which keeps a\n * held arrow key correct. The key downs repeat faster than a render, so the\n * text can be stale.\n *\n * The handler writes the new text itself, so that the caret does not move. A\n * value assignment puts the caret after the `%`, and a write from the render\n * applies one frame late, which the user sees as a jump.\n */\n private _handleAlphaInputSpin(increment: -1 | 1): void {\n const input = this._alphaInputRef.value;\n const percent = clamp(this._alphaPercent + increment, 0, 100);\n\n if (!input || percent === this._alphaPercent) return;\n\n this._writeAlphaText(input, `${percent}%`);\n this._setAlpha(percent);\n }\n\n /**\n * Holds the caret at the `%`. Without this handler the caret steps past the\n * `%`, and `keyup` pulls it back. This is the frame-late jump that\n * {@link _handleAlphaInputSpin} describes.\n */\n private _handleAlphaInputCaretForward(event: KeyboardEvent): void {\n const native = getElementFromPath<HTMLInputElement>('input', event);\n if (!native) return;\n\n const limit = caretLimit(native.value);\n\n if (isKey(event, endKey) || (native.selectionEnd ?? 0) >= limit) {\n event.preventDefault();\n native.setSelectionRange(limit, limit);\n }\n }\n\n private _handleAlphaInputChange(event: CustomEvent<string>): void {\n stopPropagation(event);\n\n const input = event.target as IgcInputComponent;\n\n if (!input.value) {\n input.value = `${this._alphaPercent}%`;\n }\n }\n\n private _handleFormatChange(\n event: CustomEvent<IgcSelectItemComponent>\n ): void {\n stopPropagation(event);\n this.format = event.detail.value as ColorFormat;\n }\n\n private _handleColorInputChange(event: CustomEvent<string>): void {\n stopPropagation(event);\n\n const input = event.target as IgcInputComponent;\n const value = normalizeColor(event.detail);\n const cleared = !value;\n\n // An invalid and non-empty value reverts the input to the current color.\n // An empty value clears the color.\n if (!cleared && !isValidColor(value, getContext())) {\n input.value = this._color.asString(this.format);\n return;\n }\n\n this._color = cleared ? ColorModel.empty() : ColorModel.parse(value);\n this._updateColor();\n this._syncCanvasPosition();\n }\n\n private _handleEyeDropperClick(): void {\n const EyeDropper = getEyeDropper();\n\n if (!EyeDropper) return;\n\n new EyeDropper()\n .open()\n .then((result) => {\n this.value = result.sRGBHex;\n this._emitInputEvent();\n })\n .catch(() => {});\n }\n\n private _handleCopy(): void {\n navigator.clipboard?.writeText(this.value).catch(() => {});\n }\n\n private _handleSwatchClick(event: Event): void {\n const swatch = getElementFromPath<HTMLButtonElement>(\n 'button[part=\"swatch\"]',\n event\n );\n const color = swatch?.dataset.color;\n\n if (color) {\n this.value = color;\n this._emitInputEvent();\n }\n }\n\n //#endregion\n\n //#region Internal methods\n\n /**\n * The current color with its alpha, in a notation that is independent of\n * `format`.\n */\n private get _alphaColor(): string {\n return this._color.asString('rgb', true);\n }\n\n /**\n * The current color with an opaque alpha channel.\n *\n * @remarks\n * The swatch preview paints this color on one half of its surface, and\n * {@link _alphaColor} on the other half, which shows a translucent color next\n * to its opaque form. At full alpha the two halves agree and the split is\n * invisible, so an opaque color needs no separate branch.\n *\n * This value is defined also with no color. An empty color is white, which is\n * where the alpha ramp and the canvas marker belong before the first pick.\n * The anchor keeps its \"no color\" mark, because {@link _previewStyle} uses\n * {@link _alphaColor}, which stays empty.\n */\n private get _opaqueColor(): string {\n return new ColorModel(this._color.toRGB()).asString('rgb');\n }\n\n /** The alpha channel as the whole percentage that both alpha controls use. */\n private get _alphaPercent(): number {\n return Math.round(this._color.alpha * 100);\n }\n\n /** The pure hue that the saturation/value plane and the hue thumb use. */\n private get _currentColor(): string {\n return `hsl(${this._color.h} 100% 50%)`;\n }\n\n /**\n * Copies the colors that the stylesheet needs onto the host.\n *\n * @remarks\n * `update()` calls this, not the handlers that change the color, so it runs\n * also for the first render. A picker with no value calls none of those\n * handlers, and the plane would keep the stylesheet fallback.\n */\n private _applyColorProperties(): void {\n const properties = {\n '--_current-color': this._currentColor,\n '--_selected-color': this._opaqueColor,\n };\n\n for (const [name, value] of Object.entries(properties)) {\n if (this._appliedProperties.get(name) !== value) {\n this._appliedProperties.set(name, value);\n this.style.setProperty(name, value);\n }\n }\n }\n\n /**\n * Replaces the whole text of the alpha field and puts the caret in front of\n * the `%` by default.\n */\n private _writeAlphaText(\n input: IgcInputComponent,\n text: string,\n caret = caretLimit(text)\n ): void {\n input.setRangeText(text, 0, input.value.length);\n input.setSelectionRange(caret, caret);\n }\n\n private _setAlpha(percent: number): void {\n const alpha = clamp(percent, 0, 100) / 100;\n\n if (this._color.alpha === alpha) {\n return;\n }\n\n this._color.alpha = alpha;\n this._updateColor();\n this._emitInputEvent();\n }\n\n private _updateColor(): void {\n this._formValue.setValueAndFormState(this._color.asString(this.format));\n this.requestUpdate();\n }\n\n private _syncCanvasPosition(): void {\n if (!this._canvasRef.value || !this.open) return;\n\n const rect = this._canvasRef.value.getBoundingClientRect();\n const { width: markerWidth, height: markerHeight } =\n this._canvasRef.value.getMarkerDimensions();\n\n const [, s, v] = this._color.toHSV();\n const x = (s / 100) * rect.width - markerWidth;\n const y = ((100 - v) / 100) * rect.height - markerHeight;\n\n this._canvasRef.value.x = x;\n this._canvasRef.value.y = y;\n }\n\n private _emitInputEvent(): void {\n this.emitEvent('igcInput', { detail: this.value });\n }\n\n //#endregion\n\n //#region Canvas area rendering\n\n private _renderCanvasGradient(): TemplateResult {\n const [, saturation, brightness] = this._color.toHSV();\n\n return html`\n <igc-picker-canvas\n exportparts=\"marker, dragging\"\n part=\"picker-canvas\"\n ${ref(this._canvasRef)}\n @igcColorPicked=${this._handleCanvasColorPicked}\n currentColor=${this._currentColor}\n markerColor=${this._opaqueColor}\n .saturation=${saturation}\n .brightness=${brightness}\n >\n </igc-picker-canvas>\n `;\n }\n\n //#endregion\n\n //#region Hue row and buttons rendering\n\n private _renderHueSlider(): TemplateResult {\n return html`\n <input\n ${ref(this._hueRef)}\n aria-label=\"Hue\"\n type=\"range\"\n part=\"hue\"\n min=\"0\"\n max=\"360\"\n .value=${String(Math.round(this._color.h))}\n @input=${this._handleHueValueChange}\n @change=${stopPropagation}\n />\n `;\n }\n\n private _renderIconButton(\n part: string,\n icon: string,\n label: string,\n handler: () => void,\n disabled = false\n ): TemplateResult {\n return html`\n <igc-icon-button\n part=${part}\n variant=\"flat\"\n name=${icon}\n ?disabled=${disabled}\n @click=${handler}\n >\n <igc-visually-hidden>${label}</igc-visually-hidden>\n </igc-icon-button>\n `;\n }\n\n private _renderPickerButtons(): TemplateResult {\n return html`\n <div part=\"buttons\">\n ${this._renderIconButton(\n 'copy',\n 'copy_content',\n 'Copy color value to clipboard',\n this._handleCopy\n )}\n ${this._renderIconButton(\n 'eye-dropper',\n 'eye_dropper',\n 'Pick a color from the screen',\n this._handleEyeDropperClick,\n !this._supportsEyeDropper\n )}\n </div>\n `;\n }\n\n //#endregion\n\n //#region Alpha row rendering\n\n private _renderAlphaRow(): TemplateResult {\n return html`\n <input\n ${ref(this._alphaRef)}\n aria-label=\"Alpha slider\"\n type=\"range\"\n part=\"alpha\"\n min=\"0\"\n max=\"100\"\n .value=${String(this._alphaPercent)}\n @input=${this._handleAlphaSliderValueChange}\n @change=${stopPropagation}\n />\n\n <igc-visually-hidden>\n <label for=\"alpha\">Alpha value</label>\n </igc-visually-hidden>\n\n <igc-input\n ${ref(this._alphaInputRef)}\n id=\"alpha\"\n name=\"alpha\"\n placeholder=\"Alpha value\"\n inputmode=\"numeric\"\n part=\"alpha-input\"\n outlined\n type=\"text\"\n .value=${live(`${this._alphaPercent}%`)}\n @input=${this._handleAlphaInputEdit}\n @focusin=${this._handleAlphaInputCaret}\n @click=${this._handleAlphaInputCaret}\n @keyup=${this._handleAlphaInputCaret}\n @igcChange=${this._handleAlphaInputChange}\n ></igc-input>\n `;\n }\n\n //#endregion\n\n //#region Color formats and input row rendering\n\n private _renderSelect(): TemplateResult {\n return html`\n <igc-visually-hidden>\n <label for=\"format-select\">Color format</label>\n </igc-visually-hidden>\n\n <igc-select\n id=\"format-select\"\n part=\"format-select\"\n placeholder=\"Color format\"\n name=\"format\"\n outlined\n .value=${this.format}\n @igcChange=${this._handleFormatChange}\n >\n <igc-select-item value=\"hex\">Hex</igc-select-item>\n <igc-select-item value=\"rgb\">RGB</igc-select-item>\n <igc-select-item value=\"hsl\">HSL</igc-select-item>\n </igc-select>\n `;\n }\n\n private _renderInputsRow(): TemplateResult {\n return html`\n ${cache(this.hideFormats ? nothing : this._renderSelect())}\n <igc-visually-hidden>\n <label for=\"color-input\"> Color value input </label>\n </igc-visually-hidden>\n\n <igc-input\n id=\"color-input\"\n name=\"color-input\"\n placeholder=${formatPlaceholders[this.format]}\n outlined\n .value=${live(this._color.asString(this.format))}\n @igcChange=${this._handleColorInputChange}\n ></igc-input>\n `;\n }\n\n //#endregion\n\n //#region Swatches rendering\n\n private _renderSwatches(): TemplateResult | typeof nothing {\n return !isEmpty(this.swatches)\n ? html`\n <igc-divider></igc-divider>\n <div part=\"swatches\" @click=${this._handleSwatchClick}>\n ${this.swatches.map(\n (color) => html`\n <button\n type=\"button\"\n part=\"swatch\"\n data-color=${color}\n aria-label=${color}\n style=\"background-color: ${color}\"\n ></button>\n `\n )}\n </div>\n `\n : nothing;\n }\n\n //#endregion\n\n //#region Anchor rendering\n\n private get _anchorParts(): ReturnType<typeof partMap> {\n return partMap({\n anchor: true,\n empty: this._color.isEmpty,\n 'input-mode': this._isInputMode,\n });\n }\n\n /**\n * The swatch preview style that both anchors use.\n *\n * `--_color-preview` paints the opaque color over the left half.\n * `--_alpha-preview` paints the color with its real alpha over the whole\n * surface. Do not transpose the two. See the `swatch-preview` mixin.\n */\n private _previewStyle(): ReturnType<typeof styleMap> {\n const color = this._alphaColor;\n\n return bindIf(\n color,\n styleMap({\n '--_alpha-preview': color,\n '--_color-preview': this._opaqueColor,\n })\n );\n }\n\n private _renderButtonAnchor(): TemplateResult {\n return html`\n <button\n ${ref(this._anchorRef)}\n ${ariaBindings(resolveNaming(this, Boolean(this.label)))}\n id=\"trigger\"\n type=\"button\"\n aria-haspopup=\"dialog\"\n aria-controls=\"picker\"\n aria-expanded=${this.open}\n aria-describedby=\"helper-text\"\n part=${this._anchorParts}\n slot=\"anchor\"\n style=${this._previewStyle()}\n ?disabled=${this.disabled}\n @click=${this._handleAnchorClick}\n >\n <igc-visually-hidden>Open color picker</igc-visually-hidden>\n </button>\n `;\n }\n\n private _renderInputAnchor(): TemplateResult {\n return html`\n <igc-input\n ${ref(this._anchorRef)}\n slot=\"anchor\"\n outlined\n placeholder=${formatPlaceholders[this.format]}\n label=${ifDefined(this.label)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n .value=${live(this.value)}\n .invalid=${this.invalid}\n @igcChange=${this._handleColorInputChange}\n >\n <div slot=\"prefix\">\n <button\n type=\"button\"\n part=${this._anchorParts}\n aria-label=\"Open color picker\"\n aria-haspopup=\"dialog\"\n aria-controls=\"picker\"\n aria-expanded=${this.open}\n style=${this._previewStyle()}\n ?disabled=${this.disabled}\n @click=${this._handleAnchorClick}\n ></button>\n </div>\n </igc-input>\n `;\n }\n\n private _renderAnchor(): TemplateResult {\n return this._isInputMode\n ? this._renderInputAnchor()\n : this._renderButtonAnchor();\n }\n\n private _renderHelperText(): TemplateResult {\n return IgcValidationContainerComponent.create(this, {\n id: 'helper-text',\n hasHelperText: true,\n });\n }\n\n //#endregion\n\n private _renderPicker(): TemplateResult {\n return html`\n <igc-focus-trap ?disabled=${!this.open} .inert=${!this.open}>\n <div\n id=\"picker\"\n part=\"picker\"\n role=\"dialog\"\n aria-label=\"Color picker\"\n aria-modal=\"false\"\n >\n ${this._renderCanvasGradient()}\n <div part=\"main-row\">\n ${this._renderHueSlider()}${this._renderPickerButtons()}\n </div>\n ${\n this.showAlpha\n ? html`<div part=\"alpha-row\">${this._renderAlphaRow()}</div>`\n : nothing\n }\n <div part=\"inputs-row\">${this._renderInputsRow()}</div>\n ${this._renderSwatches()}\n </div>\n </igc-focus-trap>\n `;\n }\n\n protected override render(): TemplateResult {\n return html`\n <div part=\"color-picker\">\n <igc-popover\n ?open=${this.open}\n flip\n .scrollStrategy=${this.scrollStrategy}\n @igcPopoverScrollClose=${this._handleClosing}\n >\n ${this._renderAnchor()}${this._renderPicker()}\n </igc-popover>\n ${\n !this._isInputMode && this.label\n ? html`<label part=\"label\" for=\"trigger\">${this.label}</label>`\n : nothing\n }\n ${this._renderHelperText()}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-color-picker': IgcColorPickerComponent;\n }\n}\n"]}
|
|
@@ -272,9 +272,11 @@ export default class IgcComboComponent<T extends object = any> extends IgcComboC
|
|
|
272
272
|
*/
|
|
273
273
|
private _resolveItemValue;
|
|
274
274
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
275
|
+
* The value representation of a data record: its `valueKey` property, or the
|
|
276
|
+
* record when that property is not set.
|
|
277
277
|
*/
|
|
278
|
+
private _valueOf;
|
|
279
|
+
/** Maps data records to their value representations. See {@link _valueOf}. */
|
|
278
280
|
private _toValues;
|
|
279
281
|
/**
|
|
280
282
|
* Recomputes {@link _displayValue} from the current selection and returns its
|
|
@@ -315,8 +317,8 @@ export default class IgcComboComponent<T extends object = any> extends IgcComboC
|
|
|
315
317
|
* "select everything".
|
|
316
318
|
*/
|
|
317
319
|
private _recordAt;
|
|
318
|
-
|
|
319
|
-
private
|
|
320
|
+
/** Selects the record at `index`. With `toggle`, deselects a selected one. */
|
|
321
|
+
private _selectAt;
|
|
320
322
|
private _clearSelection;
|
|
321
323
|
private _clearSingleSelection;
|
|
322
324
|
protected _handleMainInput({ detail, }: CustomEvent<string>): Promise<void>;
|