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.
Files changed (97) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/components/checkbox/checkbox-base.d.ts +2 -0
  3. package/components/checkbox/checkbox-base.js +4 -0
  4. package/components/checkbox/checkbox-base.js.map +1 -1
  5. package/components/checkbox/checkbox.js +3 -11
  6. package/components/checkbox/checkbox.js.map +1 -1
  7. package/components/checkbox/switch.js +1 -8
  8. package/components/checkbox/switch.js.map +1 -1
  9. package/components/color-picker/color-picker.js +3 -3
  10. package/components/color-picker/color-picker.js.map +1 -1
  11. package/components/combo/combo.d.ts +6 -4
  12. package/components/combo/combo.js +13 -24
  13. package/components/combo/combo.js.map +1 -1
  14. package/components/date-picker/date-picker.base.d.ts +3 -3
  15. package/components/date-picker/date-picker.base.js +2 -2
  16. package/components/date-picker/date-picker.base.js.map +1 -1
  17. package/components/date-picker/date-picker.d.ts +1 -1
  18. package/components/date-range-picker/date-range-picker.d.ts +1 -1
  19. package/components/date-time-input/date-time-input.base.d.ts +4 -4
  20. package/components/date-time-input/date-time-input.base.js +3 -5
  21. package/components/date-time-input/date-time-input.base.js.map +1 -1
  22. package/components/file-input/file-input.d.ts +5 -0
  23. package/components/file-input/file-input.js +4 -0
  24. package/components/file-input/file-input.js.map +1 -1
  25. package/components/input/input-base.d.ts +2 -2
  26. package/components/input/input-base.js +3 -5
  27. package/components/input/input-base.js.map +1 -1
  28. package/components/input/input.d.ts +1 -1
  29. package/components/radio/radio.d.ts +2 -0
  30. package/components/radio/radio.js +7 -11
  31. package/components/radio/radio.js.map +1 -1
  32. package/components/rating/rating.d.ts +3 -0
  33. package/components/rating/rating.js +17 -18
  34. package/components/rating/rating.js.map +1 -1
  35. package/components/select/select.js +1 -1
  36. package/components/select/select.js.map +1 -1
  37. package/components/slider/range-slider.d.ts +0 -1
  38. package/components/slider/range-slider.js +6 -11
  39. package/components/slider/range-slider.js.map +1 -1
  40. package/components/slider/slider-base.d.ts +4 -1
  41. package/components/slider/slider-base.js +20 -18
  42. package/components/slider/slider-base.js.map +1 -1
  43. package/components/slider/slider.d.ts +2 -0
  44. package/components/slider/slider.js +5 -1
  45. package/components/slider/slider.js.map +1 -1
  46. package/components/textarea/textarea.d.ts +1 -4
  47. package/components/textarea/textarea.js +3 -5
  48. package/components/textarea/textarea.js.map +1 -1
  49. package/components/validation-container/validation-container.js +2 -1
  50. package/components/validation-container/validation-container.js.map +1 -1
  51. package/components/virtualization/engine.d.ts +35 -4
  52. package/components/virtualization/engine.js +126 -61
  53. package/components/virtualization/engine.js.map +1 -1
  54. package/components/virtualization/recycle.d.ts +13 -0
  55. package/components/virtualization/recycle.js +152 -0
  56. package/components/virtualization/recycle.js.map +1 -0
  57. package/components/virtualization/virtualization.d.ts +32 -11
  58. package/components/virtualization/virtualization.js +14 -11
  59. package/components/virtualization/virtualization.js.map +1 -1
  60. package/custom-elements.json +2382 -79
  61. package/igniteui-webcomponents.html-data.json +1 -1
  62. package/index.d.ts +1 -1
  63. package/index.js.map +1 -1
  64. package/internals/controllers/aria-projection.d.ts +61 -23
  65. package/internals/controllers/aria-projection.js +77 -26
  66. package/internals/controllers/aria-projection.js.map +1 -1
  67. package/internals/mixins/forms/associated.js +34 -0
  68. package/internals/mixins/forms/associated.js.map +1 -1
  69. package/internals/mixins/forms/types.d.ts +5 -0
  70. package/internals/mixins/forms/types.js.map +1 -1
  71. package/internals/templates/toggle-shell.d.ts +15 -14
  72. package/internals/templates/toggle-shell.js +12 -8
  73. package/internals/templates/toggle-shell.js.map +1 -1
  74. package/internals/utils/dom.d.ts +2 -2
  75. package/internals/utils/dom.js +2 -2
  76. package/internals/utils/dom.js.map +1 -1
  77. package/package.json +1 -1
  78. package/skills/README.md +2 -4
  79. package/skills/igniteui-wc-choose-components/SKILL.md +2 -1
  80. package/skills/igniteui-wc-customize-component-theme/SKILL.md +2 -1
  81. package/skills/igniteui-wc-figma-to-app/SKILL.md +133 -712
  82. package/skills/igniteui-wc-figma-to-app/references/asset-extraction.md +42 -62
  83. package/skills/igniteui-wc-figma-to-app/references/design-provenance.md +199 -0
  84. package/skills/igniteui-wc-figma-to-app/references/design-token-bridge.md +189 -107
  85. package/skills/igniteui-wc-figma-to-app/references/figma-component-map.md +129 -84
  86. package/skills/igniteui-wc-figma-to-app/references/figma-exploration.md +222 -0
  87. package/skills/igniteui-wc-figma-to-app/references/mcp-setup.md +81 -127
  88. package/skills/igniteui-wc-figma-to-app/references/project-setup.md +105 -0
  89. package/skills/igniteui-wc-figma-to-app/references/theme-generation.md +180 -0
  90. package/skills/igniteui-wc-figma-to-app/references/validation-patterns.md +74 -80
  91. package/skills/igniteui-wc-generate-from-image-design/SKILL.md +2 -1
  92. package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +3 -3
  93. package/skills/igniteui-wc-grids/SKILL.md +133 -0
  94. package/skills/igniteui-wc-integrate-with-framework/SKILL.md +2 -1
  95. package/skills/igniteui-wc-migrate-grid-lite-to-premium/SKILL.md +2 -1
  96. package/skills/igniteui-wc-optimize-bundle-size/SKILL.md +2 -1
  97. package/web-types.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"associated.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/associated.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAmB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,EAIL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAA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AS,IAAI,IAAI,EAAE,CAAC;gBACtB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC;YACrC,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,oBAAoB,EAAE,CAAC;YAC/B,CAAC;QACH,CAAC;QAEe,wBAAwB,CACtC,IAAY,EACZ,IAAmB,EACnB,OAAsB;YAEtB,KAAK,CAAC,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KACF;IApCC;QADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uEAS9B;IA8BH,OAAO,6BACJ,CAAC;AACN,CAAC","sourcesContent":["import { isServer, type LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { addInternalsController } from '../../controllers/internals.js';\nimport { enterKey, isKey } from '../../controllers/keys.js';\nimport { addSafeEventListener } from '../../utils/events.js';\nimport { isFunction, isString } from '../../utils/types.js';\nimport type { Validator } from '../../validators.js';\nimport type { Constructor } from '../constructor.js';\nimport type { FormValue } from './form-value.js';\nimport {\n type FormAssociatedCheckboxElementInterface,\n type FormAssociatedElementInterface,\n type FormValueType,\n InternalInvalidEvent,\n InternalResetEvent,\n} from './types.js';\n\nconst INVALID_STATE = 'ig-invalid';\n\n/**\n * The event emitter of the host. This mixin cannot see the event-emitter\n * mixin in its type chain, so the emits go through this contract.\n */\ntype EventEmitterLike = {\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\nconst eventOptions = {\n bubbles: false,\n composed: false,\n};\n\n/** Emits one of the internal form events on the host. */\nfunction emitInternalFormEvent(host: LitElement, name: string): void {\n host.dispatchEvent(new CustomEvent(name, eventOptions));\n}\n\nfunction BaseFormAssociated<T extends Constructor<LitElement>>(base: T) {\n class BaseFormAssociatedElement extends base {\n public static readonly formAssociated = true;\n\n //#region Internal state and properties\n\n protected readonly _internals = addInternalsController(this);\n protected readonly _formValue!: FormValue<unknown>;\n\n /**\n * Hides the invalid styling for a validation cycle started from code. Set\n * immediately before the check and cleared immediately after, so that it\n * does not reach a later cycle.\n */\n private _isInternalValidation = false;\n private _touched = false;\n private _isExternalInvalid = false;\n\n private get _shouldApplyStyles(): boolean {\n if (this._isExternalInvalid) {\n return true;\n }\n\n // A disabled control cannot validate, so it never styles as invalid.\n return (\n !this._disabled &&\n this._invalid &&\n this._touched &&\n !this._isInternalValidation\n );\n }\n\n protected _disabled = false;\n protected _invalid = false;\n protected _pristine = true;\n\n protected get __validators(): Validator[] {\n return [];\n }\n\n //#endregion\n\n //#region Public properties and attributes\n\n /**\n * The name of the control, submitted with the form data.\n * @attr\n */\n @property({ reflect: true })\n public name!: string;\n\n /**\n * The disabled state of the component.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set disabled(value: boolean) {\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n if (this.hasUpdated) {\n this._setInvalidStyles();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Sets the control into invalid state (visual state only).\n *\n * @remarks\n * Not reflected to the attribute. Reading returns the effective state, so\n * a touched control that fails validation reads `true` after `false`.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set invalid(value: boolean) {\n this._isExternalInvalid = value;\n this._setInvalidStyles();\n }\n\n public get invalid(): boolean {\n return this._shouldApplyStyles;\n }\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n /** Returns a `ValidityState` object for the element. */\n public get validity(): ValidityState {\n return this._internals.validity;\n }\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n /**\n * Returns `true` when the element is a candidate for constraint\n * validation.\n */\n public get willValidate(): boolean {\n return this._internals.willValidate;\n }\n //#endregion\n\n //#region Life-cycle hooks\n\n constructor(...args: any[]) {\n super(...args);\n addSafeEventListener(this, 'invalid', this._handleInvalid);\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n\n if (!this.hasUpdated) {\n this._pristine = true;\n this._touched = false;\n }\n\n this._validate();\n }\n\n //#endregion\n\n //#region Enter key submission handling\n\n protected _handleEnterKeydown(event: KeyboardEvent): void {\n if (!isKey(event, enterKey) || event.repeat) {\n return;\n }\n\n this.form?.requestSubmit();\n }\n\n //#endregion\n\n //#region Form value and validation states\n\n private _handleInvalid(event: Event): void {\n event.preventDefault();\n this._invalid = true;\n\n if (this._isInternalValidation) {\n this._isInternalValidation = false;\n } else {\n // A failed submission is a lasting interaction: touched keeps\n // `invalid` and the projected messages visible across re-renders.\n this._setTouchedState();\n emitInternalFormEvent(this, InternalInvalidEvent);\n }\n\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n private _setInvalidStyles(): void {\n this._internals.setState(INVALID_STATE, this._shouldApplyStyles);\n }\n\n private __runValidators(): {\n validity: ValidityStateFlags;\n message: string;\n } {\n let validity: ValidityStateFlags = {};\n let message = '';\n\n for (const validator of this.__validators) {\n const isValid = validator.isValid(this);\n\n validity[validator.key] = !isValid;\n\n if (!isValid) {\n message = isFunction(validator.message)\n ? validator.message(this)\n : validator.message;\n\n if (validator.key === 'valueMissing') {\n validity = { valueMissing: true };\n break;\n }\n }\n }\n\n return { validity, message };\n }\n\n /** Runs the validators and updates the internal validity state. */\n protected _validate(userMessage?: string): void {\n if (isServer) return;\n const { validity, message: validatorMessage } = this.__runValidators();\n const hasCustomError = this.validity.customError;\n let message = validatorMessage;\n\n if (hasCustomError && userMessage === undefined) {\n // Internal cycle after `setCustomValidity(message)`. Keep the\n // `customError` flag and the message.\n validity.customError = true;\n message = this.validationMessage;\n } else if (hasCustomError && userMessage === '') {\n // The caller passed an empty message to `setCustomValidity()`.\n validity.customError = false;\n } else if (userMessage && userMessage !== '') {\n // The caller passed a message to `setCustomValidity()`.\n validity.customError = true;\n message = userMessage;\n }\n\n this._internals.setValidity(validity, message);\n this._isInternalValidation = true;\n this._invalid = !this._internals.checkValidity();\n this._isInternalValidation = false;\n this._setInvalidStyles();\n }\n\n protected _handleBlur(): void {\n this._setTouchedState();\n this._validate();\n }\n\n protected _setTouchedState(): void {\n this._touched = true;\n }\n\n protected _emitTouchedEvent(\n eventName: string,\n init?: CustomEventInit\n ): boolean {\n this._setTouchedState();\n return (this as unknown as EventEmitterLike).emitEvent(eventName, init);\n }\n\n protected _setDefaultValue(current: string | null): void {\n this._formValue.defaultValue = current;\n }\n\n protected _restoreDefaultValue(): void {\n const value = this._formValue.value;\n this._formValue.setValueAndFormState(this._formValue.defaultValue);\n this.requestUpdate('value', value);\n }\n\n protected _setFormValue(value: FormValueType, state?: FormValueType): void {\n this._pristine = false;\n this._internals.setFormValue(value, state);\n this._validate();\n }\n\n //#endregion\n\n //#region Form associated callback hooks\n\n protected formAssociatedCallback(_form: HTMLFormElement): void {}\n\n protected formDisabledCallback(state: boolean): void {\n this._disabled = state;\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n protected formResetCallback(): void {\n this._restoreDefaultValue();\n this._pristine = true;\n this._touched = false;\n this._invalid = false;\n this._isExternalInvalid = false;\n this._setInvalidStyles();\n emitInternalFormEvent(this, InternalResetEvent);\n }\n\n //#endregion\n\n //#region Public API\n\n /** Checks validity and shows the browser message when invalid. */\n public reportValidity(): boolean {\n const state = this._internals.reportValidity();\n this._invalid = !state;\n return state;\n }\n\n /** Checks validity and emits `invalid` when the control is invalid. */\n public checkValidity(): boolean {\n this._isInternalValidation = true;\n const state = this._internals.checkValidity();\n this._invalid = !state;\n this._isInternalValidation = false;\n return state;\n }\n\n /** Sets a custom message. Invalid while `message` is not empty. */\n public setCustomValidity(message: string): void {\n this._validate(message);\n this.requestUpdate();\n }\n\n //#endregion\n }\n return BaseFormAssociatedElement as Constructor<BaseFormAssociatedElement> &\n T;\n}\n\n/**\n * Turns the given class into a form-associated custom element with a\n * `defaultValue` property.\n */\nexport function FormAssociatedMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultValue(value: unknown) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'value' in this) {\n this.value = this.defaultValue;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultValue(): unknown {\n return this._formValue.defaultValue;\n }\n\n /**\n * Restores the default value through the public `value` setter, so that a\n * form reset gets the same clamping, normalization and reactive state.\n */\n protected override _restoreDefaultValue(): void {\n if ('value' in this) {\n this.value = this.defaultValue;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n /** Sets touched first, so the `value` setter validation cycle sees it. */\n protected _commitValue(value: unknown, eventName: string): boolean {\n this._setTouchedState();\n\n if ('value' in this) {\n this.value = value;\n return (this as unknown as EventEmitterLike).emitEvent(eventName, {\n detail: this.value,\n });\n }\n\n return false;\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'value') {\n this._setDefaultValue(current);\n }\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedElementInterface> &\n T;\n}\n\n/**\n * Turns the given class into a form-associated checkbox custom element with\n * a `defaultChecked` property.\n */\nexport function FormAssociatedCheckboxMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedCheckboxElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultChecked(value: boolean) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'checked' in this) {\n this.checked = this.defaultChecked;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultChecked(): boolean {\n return this._formValue.defaultValue as boolean;\n }\n\n /**\n * Restores the default checked state through the public `checked` setter,\n * which records the correct reactive property for the update cycle.\n */\n protected override _restoreDefaultValue(): void {\n if ('checked' in this) {\n this.checked = this.defaultChecked;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'checked') {\n this._setDefaultValue(isString(current) ? 'true' : null);\n }\n }\n }\n\n return FormAssociatedCheckboxElement as unknown as Constructor<FormAssociatedCheckboxElementInterface> &\n T;\n}\n"]}
1
+ {"version":3,"file":"associated.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/associated.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,EAIL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,aAAa,GAAG,YAAY,CAAC;AAUnC,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;CAChB,CAAC;AAGF,SAAS,qBAAqB,CAAC,IAAgB,EAAE,IAAY;IAC3D,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,kBAAkB,CAAoC,IAAO;IACpE,MAAM,yBAA0B,SAAQ,IAAI;iBACn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,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;KACF;IApCC;QADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uEAS9B;IA8BH,OAAO,6BACJ,CAAC;AACN,CAAC","sourcesContent":["import { isServer, type LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { NAMING_ATTRIBUTES } from '../../controllers/aria-projection.js';\nimport { addInternalsController } from '../../controllers/internals.js';\nimport { enterKey, isKey } from '../../controllers/keys.js';\nimport { sameItems } from '../../utils/arrays.js';\nimport { addSafeEventListener } from '../../utils/events.js';\nimport { isFunction, isString } from '../../utils/types.js';\nimport type { Validator } from '../../validators.js';\nimport type { Constructor } from '../constructor.js';\nimport type { FormValue } from './form-value.js';\nimport {\n type FormAssociatedCheckboxElementInterface,\n type FormAssociatedElementInterface,\n type FormValueType,\n InternalInvalidEvent,\n InternalResetEvent,\n} from './types.js';\n\nconst INVALID_STATE = 'ig-invalid';\n\n/**\n * The event emitter of the host. This mixin cannot see the event-emitter\n * mixin in its type chain, so the emits go through this contract.\n */\ntype EventEmitterLike = {\n emitEvent(name: string, init?: CustomEventInit): boolean;\n};\n\nconst eventOptions = {\n bubbles: false,\n composed: false,\n};\n\n/** Emits one of the internal form events on the host. */\nfunction emitInternalFormEvent(host: LitElement, name: string): void {\n host.dispatchEvent(new CustomEvent(name, eventOptions));\n}\n\nfunction BaseFormAssociated<T extends Constructor<LitElement>>(base: T) {\n class BaseFormAssociatedElement extends base {\n public static readonly formAssociated = true;\n\n /**\n * Adds the naming attributes. The mixin base type has no static\n * `observedAttributes`, so `Reflect.get` calls the base getter with this\n * class as `this`.\n * @internal\n */\n public static get observedAttributes(): string[] {\n const inherited = Reflect.get(base, 'observedAttributes', this);\n return [...(inherited as string[]), ...NAMING_ATTRIBUTES];\n }\n\n //#region Internal state and properties\n\n protected readonly _internals = addInternalsController(this);\n protected readonly _formValue!: FormValue<unknown>;\n\n /**\n * Hides the invalid styling for a validation cycle started from code. Set\n * immediately before the check and cleared immediately after, so that it\n * does not reach a later cycle.\n */\n private _isInternalValidation = false;\n private _touched = false;\n private _isExternalInvalid = false;\n /** The `<label>` elements at the last update. */\n private _renderedLabels: ReadonlyArray<Element> | null = null;\n\n private get _shouldApplyStyles(): boolean {\n if (this._isExternalInvalid) {\n return true;\n }\n\n // A disabled control cannot validate, so it never styles as invalid.\n return (\n !this._disabled &&\n this._invalid &&\n this._touched &&\n !this._isInternalValidation\n );\n }\n\n protected _disabled = false;\n protected _invalid = false;\n protected _pristine = true;\n\n protected get __validators(): Validator[] {\n return [];\n }\n\n //#endregion\n\n //#region Public properties and attributes\n\n /**\n * The name of the control, submitted with the form data.\n * @attr\n */\n @property({ reflect: true })\n public name!: string;\n\n /**\n * The disabled state of the component.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set disabled(value: boolean) {\n this._disabled = value;\n this.toggleAttribute('disabled', Boolean(this._disabled));\n if (this.hasUpdated) {\n this._setInvalidStyles();\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n\n /**\n * Sets the control into invalid state (visual state only).\n *\n * @remarks\n * Not reflected to the attribute. Reading returns the effective state, so\n * a touched control that fails validation reads `true` after `false`.\n * @attr\n * @default false\n */\n @property({ type: Boolean })\n public set invalid(value: boolean) {\n this._isExternalInvalid = value;\n this._setInvalidStyles();\n }\n\n public get invalid(): boolean {\n return this._shouldApplyStyles;\n }\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null {\n return this._internals.form;\n }\n\n /** Returns a `ValidityState` object for the element. */\n public get validity(): ValidityState {\n return this._internals.validity;\n }\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string {\n return this._internals.validationMessage;\n }\n\n /**\n * Returns `true` when the element is a candidate for constraint\n * validation.\n */\n public get willValidate(): boolean {\n return this._internals.willValidate;\n }\n //#endregion\n\n //#region Life-cycle hooks\n\n constructor(...args: any[]) {\n super(...args);\n addSafeEventListener(this, 'invalid', this._handleInvalid);\n addSafeEventListener(this, 'click', this._handleHostClick);\n addSafeEventListener(this, 'focusin', this._handleFocusEnter);\n }\n\n /** @internal */\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n\n if (NAMING_ATTRIBUTES.includes(name)) {\n this.requestUpdate();\n }\n }\n\n /** @internal */\n protected override update(properties: PropertyValues): void {\n this._renderedLabels = this._internals.labels;\n super.update(properties);\n }\n\n /** @internal */\n public override connectedCallback(): void {\n super.connectedCallback();\n\n if (!this.hasUpdated) {\n this._pristine = true;\n this._touched = false;\n }\n\n this._validate();\n }\n\n //#endregion\n\n //#region Labels\n\n /**\n * A bubbling click that starts on the host activates the component. A\n * `<label>` sends this click. A click from code that does not bubble does\n * not activate the component.\n */\n private _handleHostClick(event: MouseEvent): void {\n if (\n !this.disabled &&\n event.bubbles &&\n !event.defaultPrevented &&\n event.composedPath()[0] === this\n ) {\n this._handleLabelActivation();\n }\n }\n\n /**\n * `ElementInternals.labels` sends no change event. When focus enters the\n * host from outside, render again if the labels changed after the last\n * update.\n */\n private _handleFocusEnter(event: FocusEvent): void {\n if (\n !this.contains(event.relatedTarget as Node | null) &&\n !sameItems(this._internals.labels, this._renderedLabels)\n ) {\n this.requestUpdate();\n }\n }\n\n /**\n * Runs when a `<label>` or a click on the host activates the component. A\n * component that delegates focus needs no override: the browser focuses it.\n */\n protected _handleLabelActivation(): void {}\n\n //#endregion\n\n //#region Enter key submission handling\n\n protected _handleEnterKeydown(event: KeyboardEvent): void {\n if (!isKey(event, enterKey) || event.repeat) {\n return;\n }\n\n this.form?.requestSubmit();\n }\n\n //#endregion\n\n //#region Form value and validation states\n\n private _handleInvalid(event: Event): void {\n event.preventDefault();\n this._invalid = true;\n\n if (this._isInternalValidation) {\n this._isInternalValidation = false;\n } else {\n // A failed submission is a lasting interaction: touched keeps\n // `invalid` and the projected messages visible across re-renders.\n this._setTouchedState();\n emitInternalFormEvent(this, InternalInvalidEvent);\n }\n\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n private _setInvalidStyles(): void {\n this._internals.setState(INVALID_STATE, this._shouldApplyStyles);\n }\n\n private __runValidators(): {\n validity: ValidityStateFlags;\n message: string;\n } {\n let validity: ValidityStateFlags = {};\n let message = '';\n\n for (const validator of this.__validators) {\n const isValid = validator.isValid(this);\n\n validity[validator.key] = !isValid;\n\n if (!isValid) {\n message = isFunction(validator.message)\n ? validator.message(this)\n : validator.message;\n\n if (validator.key === 'valueMissing') {\n validity = { valueMissing: true };\n break;\n }\n }\n }\n\n return { validity, message };\n }\n\n /** Runs the validators and updates the internal validity state. */\n protected _validate(userMessage?: string): void {\n if (isServer) return;\n const { validity, message: validatorMessage } = this.__runValidators();\n const hasCustomError = this.validity.customError;\n let message = validatorMessage;\n\n if (hasCustomError && userMessage === undefined) {\n // Internal cycle after `setCustomValidity(message)`. Keep the\n // `customError` flag and the message.\n validity.customError = true;\n message = this.validationMessage;\n } else if (hasCustomError && userMessage === '') {\n // The caller passed an empty message to `setCustomValidity()`.\n validity.customError = false;\n } else if (userMessage && userMessage !== '') {\n // The caller passed a message to `setCustomValidity()`.\n validity.customError = true;\n message = userMessage;\n }\n\n this._internals.setValidity(validity, message);\n this._isInternalValidation = true;\n this._invalid = !this._internals.checkValidity();\n this._isInternalValidation = false;\n this._setInvalidStyles();\n }\n\n protected _handleBlur(): void {\n this._setTouchedState();\n this._validate();\n }\n\n protected _setTouchedState(): void {\n this._touched = true;\n }\n\n protected _emitTouchedEvent(\n eventName: string,\n init?: CustomEventInit\n ): boolean {\n this._setTouchedState();\n return (this as unknown as EventEmitterLike).emitEvent(eventName, init);\n }\n\n protected _setDefaultValue(current: string | null): void {\n this._formValue.defaultValue = current;\n }\n\n protected _restoreDefaultValue(): void {\n const value = this._formValue.value;\n this._formValue.setValueAndFormState(this._formValue.defaultValue);\n this.requestUpdate('value', value);\n }\n\n protected _setFormValue(value: FormValueType, state?: FormValueType): void {\n this._pristine = false;\n this._internals.setFormValue(value, state);\n this._validate();\n }\n\n //#endregion\n\n //#region Form associated callback hooks\n\n protected formAssociatedCallback(_form: HTMLFormElement): void {}\n\n protected formDisabledCallback(state: boolean): void {\n this._disabled = state;\n this._setInvalidStyles();\n this.requestUpdate();\n }\n\n protected formResetCallback(): void {\n this._restoreDefaultValue();\n this._pristine = true;\n this._touched = false;\n this._invalid = false;\n this._isExternalInvalid = false;\n this._setInvalidStyles();\n emitInternalFormEvent(this, InternalResetEvent);\n }\n\n //#endregion\n\n //#region Public API\n\n /** Checks validity and shows the browser message when invalid. */\n public reportValidity(): boolean {\n const state = this._internals.reportValidity();\n this._invalid = !state;\n return state;\n }\n\n /** Checks validity and emits `invalid` when the control is invalid. */\n public checkValidity(): boolean {\n this._isInternalValidation = true;\n const state = this._internals.checkValidity();\n this._invalid = !state;\n this._isInternalValidation = false;\n return state;\n }\n\n /** Sets a custom message. Invalid while `message` is not empty. */\n public setCustomValidity(message: string): void {\n this._validate(message);\n this.requestUpdate();\n }\n\n //#endregion\n }\n return BaseFormAssociatedElement as Constructor<BaseFormAssociatedElement> &\n T;\n}\n\n/**\n * Turns the given class into a form-associated custom element with a\n * `defaultValue` property.\n */\nexport function FormAssociatedMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultValue(value: unknown) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'value' in this) {\n this.value = this.defaultValue;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultValue(): unknown {\n return this._formValue.defaultValue;\n }\n\n /**\n * Restores the default value through the public `value` setter, so that a\n * form reset gets the same clamping, normalization and reactive state.\n */\n protected override _restoreDefaultValue(): void {\n if ('value' in this) {\n this.value = this.defaultValue;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n /** Sets touched first, so the `value` setter validation cycle sees it. */\n protected _commitValue(value: unknown, eventName: string): boolean {\n this._setTouchedState();\n\n if ('value' in this) {\n this.value = value;\n return (this as unknown as EventEmitterLike).emitEvent(eventName, {\n detail: this.value,\n });\n }\n\n return false;\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'value') {\n this._setDefaultValue(current);\n }\n }\n }\n\n return FormAssociatedElement as unknown as Constructor<FormAssociatedElementInterface> &\n T;\n}\n\n/**\n * Turns the given class into a form-associated checkbox custom element with\n * a `defaultChecked` property.\n */\nexport function FormAssociatedCheckboxMixin<T extends Constructor<LitElement>>(\n base: T\n) {\n class FormAssociatedCheckboxElement extends BaseFormAssociated(base) {\n /* blazorCSSuppress */\n @property({ attribute: false })\n public set defaultChecked(value: boolean) {\n this._formValue.defaultValue = value;\n\n if (this._pristine && 'checked' in this) {\n this.checked = this.defaultChecked;\n this._pristine = true;\n this._validate();\n }\n }\n\n public get defaultChecked(): boolean {\n return this._formValue.defaultValue as boolean;\n }\n\n /**\n * Restores the default checked state through the public `checked` setter,\n * which records the correct reactive property for the update cycle.\n */\n protected override _restoreDefaultValue(): void {\n if ('checked' in this) {\n this.checked = this.defaultChecked;\n } else {\n super._restoreDefaultValue();\n }\n }\n\n public override attributeChangedCallback(\n name: string,\n prev: string | null,\n current: string | null\n ): void {\n super.attributeChangedCallback(name, prev, current);\n if (name === 'checked') {\n this._setDefaultValue(isString(current) ? 'true' : null);\n }\n }\n }\n\n return FormAssociatedCheckboxElement as unknown as Constructor<FormAssociatedCheckboxElementInterface> &\n T;\n}\n"]}
@@ -39,6 +39,11 @@ export declare class BaseFormAssociatedElement {
39
39
  * Returns `true` when the element is a candidate for constraint validation.
40
40
  */
41
41
  get willValidate(): boolean;
42
+ /**
43
+ * Runs when a `<label>` or a click on the host activates the component.
44
+ * Does nothing by default.
45
+ */
46
+ protected _handleLabelActivation(): void;
42
47
  /** Submits the parent form, if any, on `Enter`. */
43
48
  protected _handleEnterKeydown(event: KeyboardEvent): void;
44
49
  /** Sets **touched**, then validates. Call this on blur or focusout. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/types.ts"],"names":[],"mappings":"AA0JA,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport type {\n ElementInternalsController,\n FormValueType,\n} from '../../controllers/internals.js';\nimport type { Validator } from '../../validators.js';\n\nexport type FormRestoreMode = 'autocomplete' | 'restore';\nexport type { FormValueType };\nexport type IgcFormControl = LitElement &\n (FormAssociatedElementInterface | FormAssociatedCheckboxElementInterface);\n\nexport declare class BaseFormAssociatedElement {\n public static readonly formAssociated: boolean;\n\n //#region Properties\n\n protected readonly _internals: ElementInternalsController;\n protected readonly _formValue: unknown;\n\n protected _pristine: boolean;\n protected _disabled: boolean;\n protected _invalid: boolean;\n\n protected get __validators(): Validator[];\n\n /**\n * The disabled state of the component.\n * @attr\n * @default false\n */\n public disabled: boolean;\n\n /**\n * Sets the control into invalid state (visual state only).\n * @attr\n * @default false\n */\n public invalid: boolean;\n\n /**\n * The name of the control, submitted with the form data.\n * @attr\n */\n public name: string;\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null;\n\n /** Returns a `ValidityState` object for the element. */\n public get validity(): ValidityState;\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string;\n\n /**\n * Returns `true` when the element is a candidate for constraint validation.\n */\n public get willValidate(): boolean;\n\n //#endregion\n\n //#region Methods\n\n /** Submits the parent form, if any, on `Enter`. */\n protected _handleEnterKeydown(event: KeyboardEvent): void;\n\n /** Sets **touched**, then validates. Call this on blur or focusout. */\n protected _handleBlur(): void;\n\n /** Sets **touched** without validating. Call this on a user interaction. */\n protected _setTouchedState(): void;\n\n /** Sets **touched**, then emits `eventName`. Needs the emitter mixin. */\n protected _emitTouchedEvent(\n eventName: string,\n init?: CustomEventInit\n ): boolean;\n\n /** Sets the default value from a change of the `value` attribute. */\n protected _setDefaultValue(current: string | null): void;\n\n /** Restores the default value on a form reset. */\n protected _restoreDefaultValue(): void;\n\n /** Runs the validators and updates the internal validity state. */\n protected _validate(message?: string): void;\n\n /** Sets the submission value and the submission state. */\n protected _setFormValue(value: FormValueType, state?: FormValueType): void;\n\n /** Runs on form association or de-association. Not implemented. */\n protected formAssociatedCallback(form: HTMLFormElement): void;\n\n /**\n * Runs when the component, or a parent `fieldset`, becomes disabled or\n * enabled.\n */\n protected formDisabledCallback(state: boolean): void;\n\n /**\n * Resets the value, state and validation to the defaults. Override\n * `_restoreDefaultValue`, not this callback.\n */\n protected formResetCallback(): void;\n\n /** Runs on browser auto-fill. Not implemented. */\n protected formStateRestoreCallback(\n state: FormValueType,\n mode: FormRestoreMode\n ): void;\n\n /** Checks validity and emits `invalid` when the control is invalid. */\n public checkValidity(): boolean;\n\n /** Checks validity and shows the browser message when invalid. */\n public reportValidity(): boolean;\n\n /** Sets a custom message. Invalid while `message` is not empty. */\n public setCustomValidity(message: string): void;\n\n //#endregion\n}\n\nexport declare class FormAssociatedElementInterface extends BaseFormAssociatedElement {\n /** The initial value of the component. */\n public set defaultValue(value: unknown);\n public get defaultValue(): unknown;\n\n /**\n * Commits a user value change, then emits `eventName`. Sets **touched**\n * *before* the `value` assignment, so the setter styles invalid at once.\n */\n protected _commitValue(value: unknown, eventName: string): boolean;\n}\n\nexport declare class FormAssociatedCheckboxElementInterface extends BaseFormAssociatedElement {\n /** The initial checked state of the component. */\n public set defaultChecked(value: boolean);\n public get defaultChecked(): boolean;\n}\n\nexport declare class FormRequiredInterface {\n protected _required: boolean;\n\n /**\n * When set, makes the component a required field for validation.\n * @attr\n * @default false\n */\n public set required(value: boolean);\n public get required(): boolean;\n}\n\nexport const InternalInvalidEvent = 'igc-form-internal-invalid';\nexport const InternalResetEvent = 'igc-form-internal-reset';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/internals/mixins/forms/types.ts"],"names":[],"mappings":"AAgKA,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAChE,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC","sourcesContent":["import type { LitElement } from 'lit';\nimport type {\n ElementInternalsController,\n FormValueType,\n} from '../../controllers/internals.js';\nimport type { Validator } from '../../validators.js';\n\nexport type FormRestoreMode = 'autocomplete' | 'restore';\nexport type { FormValueType };\nexport type IgcFormControl = LitElement &\n (FormAssociatedElementInterface | FormAssociatedCheckboxElementInterface);\n\nexport declare class BaseFormAssociatedElement {\n public static readonly formAssociated: boolean;\n\n //#region Properties\n\n protected readonly _internals: ElementInternalsController;\n protected readonly _formValue: unknown;\n\n protected _pristine: boolean;\n protected _disabled: boolean;\n protected _invalid: boolean;\n\n protected get __validators(): Validator[];\n\n /**\n * The disabled state of the component.\n * @attr\n * @default false\n */\n public disabled: boolean;\n\n /**\n * Sets the control into invalid state (visual state only).\n * @attr\n * @default false\n */\n public invalid: boolean;\n\n /**\n * The name of the control, submitted with the form data.\n * @attr\n */\n public name: string;\n\n /** Returns the HTMLFormElement associated with this element. */\n public get form(): HTMLFormElement | null;\n\n /** Returns a `ValidityState` object for the element. */\n public get validity(): ValidityState;\n\n /** A string containing the validation message of this element. */\n public get validationMessage(): string;\n\n /**\n * Returns `true` when the element is a candidate for constraint validation.\n */\n public get willValidate(): boolean;\n\n //#endregion\n\n //#region Methods\n\n /**\n * Runs when a `<label>` or a click on the host activates the component.\n * Does nothing by default.\n */\n protected _handleLabelActivation(): void;\n\n /** Submits the parent form, if any, on `Enter`. */\n protected _handleEnterKeydown(event: KeyboardEvent): void;\n\n /** Sets **touched**, then validates. Call this on blur or focusout. */\n protected _handleBlur(): void;\n\n /** Sets **touched** without validating. Call this on a user interaction. */\n protected _setTouchedState(): void;\n\n /** Sets **touched**, then emits `eventName`. Needs the emitter mixin. */\n protected _emitTouchedEvent(\n eventName: string,\n init?: CustomEventInit\n ): boolean;\n\n /** Sets the default value from a change of the `value` attribute. */\n protected _setDefaultValue(current: string | null): void;\n\n /** Restores the default value on a form reset. */\n protected _restoreDefaultValue(): void;\n\n /** Runs the validators and updates the internal validity state. */\n protected _validate(message?: string): void;\n\n /** Sets the submission value and the submission state. */\n protected _setFormValue(value: FormValueType, state?: FormValueType): void;\n\n /** Runs on form association or de-association. Not implemented. */\n protected formAssociatedCallback(form: HTMLFormElement): void;\n\n /**\n * Runs when the component, or a parent `fieldset`, becomes disabled or\n * enabled.\n */\n protected formDisabledCallback(state: boolean): void;\n\n /**\n * Resets the value, state and validation to the defaults. Override\n * `_restoreDefaultValue`, not this callback.\n */\n protected formResetCallback(): void;\n\n /** Runs on browser auto-fill. Not implemented. */\n protected formStateRestoreCallback(\n state: FormValueType,\n mode: FormRestoreMode\n ): void;\n\n /** Checks validity and emits `invalid` when the control is invalid. */\n public checkValidity(): boolean;\n\n /** Checks validity and shows the browser message when invalid. */\n public reportValidity(): boolean;\n\n /** Sets a custom message. Invalid while `message` is not empty. */\n public setCustomValidity(message: string): void;\n\n //#endregion\n}\n\nexport declare class FormAssociatedElementInterface extends BaseFormAssociatedElement {\n /** The initial value of the component. */\n public set defaultValue(value: unknown);\n public get defaultValue(): unknown;\n\n /**\n * Commits a user value change, then emits `eventName`. Sets **touched**\n * *before* the `value` assignment, so the setter styles invalid at once.\n */\n protected _commitValue(value: unknown, eventName: string): boolean;\n}\n\nexport declare class FormAssociatedCheckboxElementInterface extends BaseFormAssociatedElement {\n /** The initial checked state of the component. */\n public set defaultChecked(value: boolean);\n public get defaultChecked(): boolean;\n}\n\nexport declare class FormRequiredInterface {\n protected _required: boolean;\n\n /**\n * When set, makes the component a required field for validation.\n * @attr\n * @default false\n */\n public set required(value: boolean);\n public get required(): boolean;\n}\n\nexport const InternalInvalidEvent = 'igc-form-internal-invalid';\nexport const InternalResetEvent = 'igc-form-internal-reset';\n"]}
@@ -4,7 +4,7 @@ export interface ToggleShellOptions {
4
4
  type: 'checkbox' | 'radio';
5
5
  /** The id of the native input; the `for` target of the wrapping label. */
6
6
  inputId: string;
7
- /** The id of the label span, the fallback `aria-labelledby` target. */
7
+ /** The id of the label span. */
8
8
  labelId: string;
9
9
  /** Resolved part-name map for the wrapping label element. */
10
10
  baseParts: Record<string, boolean>;
@@ -14,14 +14,8 @@ export interface ToggleShellOptions {
14
14
  labelParts: Record<string, boolean>;
15
15
  /** Renders the control indicator inside the control span. */
16
16
  renderControl: () => TemplateResult;
17
- /** Current checked state rendered through `live()`. */
18
- checked: boolean;
19
17
  /** Hides the label span when the default slot has no assigned content. */
20
18
  hideLabel: boolean;
21
- name?: string;
22
- value?: string;
23
- required: boolean;
24
- disabled: boolean;
25
19
  /**
26
20
  * The current indeterminate state, rendered through `live()`. Defaults to
27
21
  * `false`, and `live()` then writes nothing.
@@ -29,17 +23,24 @@ export interface ToggleShellOptions {
29
23
  indeterminate?: boolean;
30
24
  /** When provided, sets the `tabindex` attribute. */
31
25
  tabindex?: number;
32
- /** Resolved `aria-labelledby` target - an external id or `labelId`. */
33
- ariaLabelledBy: string;
34
- /** When provided, sets the `aria-describedby` attribute. */
35
- ariaDescribedBy?: string;
26
+ /** The id of the helper-text container that describes the native input. */
27
+ describedBy?: string;
36
28
  onClick: (event: PointerEvent) => void;
37
29
  onKeyDown: (event: KeyboardEvent) => void;
38
30
  onBlur?: () => void;
39
31
  }
32
+ /** The host state that {@link renderToggleShell} binds onto the native input. */
33
+ type ToggleShellHost = HTMLElement & {
34
+ checked: boolean;
35
+ disabled: boolean;
36
+ required: boolean;
37
+ name?: string;
38
+ value?: string;
39
+ };
40
40
  /**
41
41
  * Renders the native input and its wrapping label for a toggle control, with
42
- * the input bindings, so a leaf component describes only its part maps and
43
- * its control indicator.
42
+ * the input bindings and the name, so a leaf component describes only its part
43
+ * maps and its control indicator.
44
44
  */
45
- export declare function renderToggleShell(options: ToggleShellOptions): TemplateResult;
45
+ export declare function renderToggleShell(host: ToggleShellHost, options: ToggleShellOptions): TemplateResult;
46
+ export {};
@@ -1,23 +1,27 @@
1
1
  import { html, nothing } from 'lit';
2
2
  import { ifDefined } from 'lit/directives/if-defined.js';
3
3
  import { live } from 'lit/directives/live.js';
4
+ import { ariaBindings, resolveNaming } from '../controllers/aria-projection.js';
4
5
  import { partMap } from '../part-map.js';
5
6
  import { bindIf } from '../utils/lit.js';
6
- export function renderToggleShell(options) {
7
+ export function renderToggleShell(host, options) {
8
+ const aria = {
9
+ ...resolveNaming(host, !options.hideLabel && options.labelId),
10
+ describedByRef: options.describedBy,
11
+ };
7
12
  return html `
8
13
  <label part=${partMap(options.baseParts)} for=${options.inputId}>
9
14
  <input
15
+ ${ariaBindings(aria)}
10
16
  id=${options.inputId}
11
17
  type=${options.type}
12
- name=${ifDefined(options.name)}
13
- value=${ifDefined(options.value)}
14
- ?required=${options.required}
15
- ?disabled=${options.disabled}
16
- .checked=${live(options.checked)}
18
+ name=${ifDefined(host.name)}
19
+ value=${ifDefined(host.value)}
20
+ ?required=${host.required}
21
+ ?disabled=${host.disabled}
22
+ .checked=${live(host.checked)}
17
23
  .indeterminate=${live(options.indeterminate ?? false)}
18
24
  tabindex=${bindIf(options.tabindex != null, options.tabindex)}
19
- aria-labelledby=${options.ariaLabelledBy}
20
- aria-describedby=${ifDefined(options.ariaDescribedBy)}
21
25
  @keydown=${options.onKeyDown}
22
26
  @click=${options.onClick}
23
27
  @blur=${options.onBlur ?? nothing}
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-shell.js","sourceRoot":"","sources":["../../../src/internals/templates/toggle-shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AA+CzC,MAAM,UAAU,iBAAiB,CAAC,OAA2B;IAC3D,OAAO,IAAI,CAAA;kBACK,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,OAAO,CAAC,OAAO;;aAEtD,OAAO,CAAC,OAAO;eACb,OAAO,CAAC,IAAI;eACZ,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;gBACtB,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC;oBACpB,OAAO,CAAC,QAAQ;oBAChB,OAAO,CAAC,QAAQ;mBACjB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;yBACf,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC;mBAC1C,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;0BAC3C,OAAO,CAAC,cAAc;2BACrB,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC;mBAC1C,OAAO,CAAC,SAAS;iBACnB,OAAO,CAAC,OAAO;gBAChB,OAAO,CAAC,MAAM,IAAI,OAAO;;mBAEtB,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;WACrC,OAAO,CAAC,aAAa,EAAE;;;aAGrB,OAAO,CAAC,OAAO;eACb,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;kBACxB,OAAO,CAAC,SAAS;;;;;GAKhC,CAAC;AACJ,CAAC","sourcesContent":["import { html, nothing, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { partMap } from '../part-map.js';\nimport { bindIf } from '../utils/lit.js';\n\nexport interface ToggleShellOptions {\n /** The type of the native input element. */\n type: 'checkbox' | 'radio';\n /** The id of the native input; the `for` target of the wrapping label. */\n inputId: string;\n /** The id of the label span, the fallback `aria-labelledby` target. */\n labelId: string;\n /** Resolved part-name map for the wrapping label element. */\n baseParts: Record<string, boolean>;\n /** Resolved part-name map for the control span. */\n controlParts: Record<string, boolean>;\n /** Resolved part-name map for the label span. */\n labelParts: Record<string, boolean>;\n /** Renders the control indicator inside the control span. */\n renderControl: () => TemplateResult;\n /** Current checked state rendered through `live()`. */\n checked: boolean;\n /** Hides the label span when the default slot has no assigned content. */\n hideLabel: boolean;\n name?: string;\n value?: string;\n required: boolean;\n disabled: boolean;\n /**\n * The current indeterminate state, rendered through `live()`. Defaults to\n * `false`, and `live()` then writes nothing.\n */\n indeterminate?: boolean;\n /** When provided, sets the `tabindex` attribute. */\n tabindex?: number;\n /** Resolved `aria-labelledby` target - an external id or `labelId`. */\n ariaLabelledBy: string;\n /** When provided, sets the `aria-describedby` attribute. */\n ariaDescribedBy?: string;\n\n onClick: (event: PointerEvent) => void;\n onKeyDown: (event: KeyboardEvent) => void;\n onBlur?: () => void;\n}\n\n/**\n * Renders the native input and its wrapping label for a toggle control, with\n * the input bindings, so a leaf component describes only its part maps and\n * its control indicator.\n */\nexport function renderToggleShell(options: ToggleShellOptions): TemplateResult {\n return html`\n <label part=${partMap(options.baseParts)} for=${options.inputId}>\n <input\n id=${options.inputId}\n type=${options.type}\n name=${ifDefined(options.name)}\n value=${ifDefined(options.value)}\n ?required=${options.required}\n ?disabled=${options.disabled}\n .checked=${live(options.checked)}\n .indeterminate=${live(options.indeterminate ?? false)}\n tabindex=${bindIf(options.tabindex != null, options.tabindex)}\n aria-labelledby=${options.ariaLabelledBy}\n aria-describedby=${ifDefined(options.ariaDescribedBy)}\n @keydown=${options.onKeyDown}\n @click=${options.onClick}\n @blur=${options.onBlur ?? nothing}\n />\n <span part=${partMap(options.controlParts)}\n >${options.renderControl()}</span\n >\n <span\n id=${options.labelId}\n part=${partMap(options.labelParts)}\n ?hidden=${options.hideLabel}\n >\n <slot></slot>\n </span>\n </label>\n `;\n}\n"]}
1
+ {"version":3,"file":"toggle-shell.js","sourceRoot":"","sources":["../../../src/internals/templates/toggle-shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAgDzC,MAAM,UAAU,iBAAiB,CAC/B,IAAqB,EACrB,OAA2B;IAE3B,MAAM,IAAI,GAAG;QACX,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;QAC7D,cAAc,EAAE,OAAO,CAAC,WAAW;KACpC,CAAC;IAEF,OAAO,IAAI,CAAA;kBACK,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,OAAO,CAAC,OAAO;;UAEzD,YAAY,CAAC,IAAI,CAAC;aACf,OAAO,CAAC,OAAO;eACb,OAAO,CAAC,IAAI;eACZ,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;oBACjB,IAAI,CAAC,QAAQ;oBACb,IAAI,CAAC,QAAQ;mBACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;yBACZ,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,KAAK,CAAC;mBAC1C,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC;mBAClD,OAAO,CAAC,SAAS;iBACnB,OAAO,CAAC,OAAO;gBAChB,OAAO,CAAC,MAAM,IAAI,OAAO;;mBAEtB,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;WACrC,OAAO,CAAC,aAAa,EAAE;;;aAGrB,OAAO,CAAC,OAAO;eACb,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;kBACxB,OAAO,CAAC,SAAS;;;;;GAKhC,CAAC;AACJ,CAAC","sourcesContent":["import { html, nothing, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { ariaBindings, resolveNaming } from '../controllers/aria-projection.js';\nimport { partMap } from '../part-map.js';\nimport { bindIf } from '../utils/lit.js';\n\nexport interface ToggleShellOptions {\n /** The type of the native input element. */\n type: 'checkbox' | 'radio';\n /** The id of the native input; the `for` target of the wrapping label. */\n inputId: string;\n /** The id of the label span. */\n labelId: string;\n /** Resolved part-name map for the wrapping label element. */\n baseParts: Record<string, boolean>;\n /** Resolved part-name map for the control span. */\n controlParts: Record<string, boolean>;\n /** Resolved part-name map for the label span. */\n labelParts: Record<string, boolean>;\n /** Renders the control indicator inside the control span. */\n renderControl: () => TemplateResult;\n /** Hides the label span when the default slot has no assigned content. */\n hideLabel: boolean;\n /**\n * The current indeterminate state, rendered through `live()`. Defaults to\n * `false`, and `live()` then writes nothing.\n */\n indeterminate?: boolean;\n /** When provided, sets the `tabindex` attribute. */\n tabindex?: number;\n /** The id of the helper-text container that describes the native input. */\n describedBy?: string;\n\n onClick: (event: PointerEvent) => void;\n onKeyDown: (event: KeyboardEvent) => void;\n onBlur?: () => void;\n}\n\n/** The host state that {@link renderToggleShell} binds onto the native input. */\ntype ToggleShellHost = HTMLElement & {\n checked: boolean;\n disabled: boolean;\n required: boolean;\n name?: string;\n value?: string;\n};\n\n/**\n * Renders the native input and its wrapping label for a toggle control, with\n * the input bindings and the name, so a leaf component describes only its part\n * maps and its control indicator.\n */\nexport function renderToggleShell(\n host: ToggleShellHost,\n options: ToggleShellOptions\n): TemplateResult {\n const aria = {\n ...resolveNaming(host, !options.hideLabel && options.labelId),\n describedByRef: options.describedBy,\n };\n\n return html`\n <label part=${partMap(options.baseParts)} for=${options.inputId}>\n <input\n ${ariaBindings(aria)}\n id=${options.inputId}\n type=${options.type}\n name=${ifDefined(host.name)}\n value=${ifDefined(host.value)}\n ?required=${host.required}\n ?disabled=${host.disabled}\n .checked=${live(host.checked)}\n .indeterminate=${live(options.indeterminate ?? false)}\n tabindex=${bindIf(options.tabindex != null, options.tabindex)}\n @keydown=${options.onKeyDown}\n @click=${options.onClick}\n @blur=${options.onBlur ?? nothing}\n />\n <span part=${partMap(options.controlParts)}\n >${options.renderControl()}</span\n >\n <span\n id=${options.labelId}\n part=${partMap(options.labelParts)}\n ?hidden=${options.hideLabel}\n >\n <slot></slot>\n </span>\n </label>\n `;\n}\n"]}
@@ -44,8 +44,8 @@ export declare function iterNodes<T extends Node>(root: Node, options?: IterNode
44
44
  * ```
45
45
  */
46
46
  export declare function iterAncestors(node?: Node | null): Generator<Element>;
47
- /** Returns the root node (document or shadow root) of the given element. */
48
- export declare function getRoot(element: Element, options?: GetRootNodeOptions): Document | ShadowRoot;
47
+ /** Returns the root node (document or shadow root) of the given node. */
48
+ export declare function getRoot(node: Node, options?: GetRootNodeOptions): Document | ShadowRoot;
49
49
  /** Returns the element with the given id in the root node of `root`. */
50
50
  export declare function getElementByIdFromRoot(root: HTMLElement, id: string): HTMLElement | null;
51
51
  export declare function isElement(node: unknown): node is Element;
@@ -71,8 +71,8 @@ export function* iterAncestors(node) {
71
71
  current = current instanceof ShadowRoot ? current.host : current.parentNode;
72
72
  }
73
73
  }
74
- export function getRoot(element, options) {
75
- return element.getRootNode(options);
74
+ export function getRoot(node, options) {
75
+ return node.getRootNode(options);
76
76
  }
77
77
  export function getElementByIdFromRoot(root, id) {
78
78
  return getRoot(root).getElementById(id);
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../src/internals/utils/dom.ts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AM,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3D,IAAI,QAAQ,YAAY,WAAW,IAAI,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC;YAClE,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { isServer } from 'lit';\nimport { asNumber, clamp, numberInRangeInclusive } from './math.js';\nimport { isDefined } from './types.js';\n\n/** Returns whether an element has a Left-to-Right directionality. */\nexport function isLTR(element: HTMLElement) {\n return element.matches(':dir(ltr)');\n}\n\nconst LENGTH_PROPERTY = '--igc-resolved-length';\n\nconst SUPPORTS_REGISTERED_PROPERTIES =\n !isServer && typeof CSS !== 'undefined' && 'registerProperty' in CSS;\n\nlet lengthPropertyUsable: boolean | undefined;\n\nfunction canResolveLengths(): boolean {\n if (lengthPropertyUsable === undefined) {\n lengthPropertyUsable = SUPPORTS_REGISTERED_PROPERTIES;\n\n if (lengthPropertyUsable) {\n try {\n CSS.registerProperty({\n name: LENGTH_PROPERTY,\n syntax: '<length>',\n inherits: false,\n initialValue: '0px',\n });\n } catch {\n // The descriptor is constant, so a rejection means another bundle\n // instance already registered it. The property stays usable.\n }\n }\n }\n\n return lengthPropertyUsable;\n}\n\n/**\n * Resolves a CSS length to pixels in the context of `element`.\n *\n * @remarks\n * Registration makes the property compute to an absolute length, so the\n * browser converts font, viewport and container relative units. Returns 0\n * for percentages, for invalid lengths, during SSR and in a browser without\n * registered custom properties. Resolve percentages against the basis of\n * the applicable property instead.\n *\n * @example\n * ```typescript\n * resolveCssLength(element, '5rem'); // 80\n * resolveCssLength(element, '2em'); // 2 x the element font size\n * ```\n */\nexport function resolveCssLength(element: HTMLElement, value: string): number {\n if (!canResolveLengths()) {\n return 0;\n }\n\n const { style } = element;\n const previous = style.getPropertyValue(LENGTH_PROPERTY);\n const priority = style.getPropertyPriority(LENGTH_PROPERTY);\n\n style.setProperty(LENGTH_PROPERTY, value);\n const resolved = getComputedStyle(element).getPropertyValue(LENGTH_PROPERTY);\n\n // Restore rather than remove: the caller may use the property itself.\n if (previous) {\n style.setProperty(LENGTH_PROPERTY, previous, priority);\n } else {\n style.removeProperty(LENGTH_PROPERTY);\n }\n\n return asNumber(resolved);\n}\n\nexport type IterNodesOptions<T = Node> = {\n show?: keyof typeof NodeFilter;\n filter?: (node: T) => boolean;\n};\n\nfunction createNodeFilter<T extends Node>(predicate: (node: T) => boolean) {\n return {\n acceptNode: (node: T): number =>\n predicate(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP,\n };\n}\n\n/**\n * Iterates over the DOM subtree of `root` in document order, and yields the\n * nodes that match the {@link IterNodesOptions | options}.\n *\n * @example\n * ```typescript\n * for (const button of iterNodes<HTMLButtonElement>(root, {\n * show: 'SHOW_ELEMENT',\n * filter: isButton,\n * })) { ... }\n * ```\n */\nexport function* iterNodes<T extends Node>(\n root: Node,\n options?: IterNodesOptions<T>\n): Generator<T> {\n if (!isDefined(globalThis.document)) {\n return;\n }\n\n const whatToShow = options?.show\n ? NodeFilter[options.show]\n : NodeFilter.SHOW_ALL;\n\n const nodeFilter = options?.filter\n ? createNodeFilter(options.filter)\n : undefined;\n\n const treeWalker = document.createTreeWalker(root, whatToShow, nodeFilter);\n\n while (treeWalker.nextNode()) {\n yield treeWalker.currentNode as T;\n }\n}\n\n/**\n * Iterates over `node` and its element ancestors, and crosses each shadow\n * root through its host.\n *\n * @example\n * ```typescript\n * for (const ancestor of iterAncestors(element)) { ... }\n * ```\n */\nexport function* iterAncestors(node?: Node | null): Generator<Element> {\n let current: Node | null | undefined = node;\n\n while (current) {\n if (isElement(current)) {\n yield current;\n }\n\n current = current instanceof ShadowRoot ? current.host : current.parentNode;\n }\n}\n\n/** Returns the root node (document or shadow root) of the given element. */\nexport function getRoot(\n element: Element,\n options?: GetRootNodeOptions\n): Document | ShadowRoot {\n return element.getRootNode(options) as Document | ShadowRoot;\n}\n\n/** Returns the element with the given id in the root node of `root`. */\nexport function getElementByIdFromRoot(root: HTMLElement, id: string) {\n return getRoot(root).getElementById(id);\n}\n\nexport function isElement(node: unknown): node is Element {\n return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport function isDocument(node: unknown): node is Document {\n return node instanceof Node && node.nodeType === Node.DOCUMENT_NODE;\n}\n\n/** Returns the center x/y coordinate of a given element. */\nexport function getCenterPoint(element: Element): { x: number; y: number } {\n const { left, top, width, height } = element.getBoundingClientRect();\n\n return {\n x: left + width * 0.5,\n y: top + height * 0.5,\n };\n}\n\n/**\n * Maps the `clientX` coordinate of a pointer to a fraction of the element\n * width, in the range 0 to 1.\n *\n * @remarks\n * Measured from the logical start edge: the left one when `ltr` is true, the\n * right one otherwise. Returns 0 for an element that has no layout.\n *\n * @example\n * ```typescript\n * // Pointer 30px into a 120px wide element\n * pointToFraction(element, event.clientX); // 0.25\n * pointToFraction(element, event.clientX, false); // 0.75\n * ```\n */\nexport function pointToFraction(\n element: Element,\n clientX: number,\n ltr = true\n): number {\n const { left, right, width } = element.getBoundingClientRect();\n\n if (width === 0) {\n return 0;\n }\n\n return clamp((ltr ? clientX - left : right - clientX) / width, 0, 1);\n}\n\n/**\n * Concatenates the text content of the given nodes, trimmed and with each\n * run of whitespace collapsed into one space.\n */\nexport function normalizedTextContent(nodes: Iterable<Node>): string {\n let text = '';\n\n for (const node of nodes) {\n text += node.textContent ?? '';\n }\n\n return text.trim().replace(/\\s+/gu, ' ');\n}\n\n/** Returns whether the given coordinates lie in the element bounding box. */\nexport function isPointInsideElement(\n element: Element,\n x: number,\n y: number\n): boolean {\n const { left, right, top, bottom } = element.getBoundingClientRect();\n return (\n numberInRangeInclusive(x, left, right) &&\n numberInRangeInclusive(y, top, bottom)\n );\n}\n\n/** Returns the scale factor of a given element. */\nexport function getScaleFactor(element: HTMLElement): { x: number; y: number } {\n const { offsetWidth, offsetHeight } = element;\n const { width, height } = element.getBoundingClientRect();\n return { x: offsetWidth / width || 1, y: offsetHeight / height || 1 };\n}\n\n/**\n * Rounds a CSS pixel value to the closest device-pixel boundary, to prevent\n * blurry rendering.\n */\nexport function roundByDPR(value: number): number {\n const dpr = globalThis.devicePixelRatio || 1;\n return Math.round(value * dpr) / dpr;\n}\n\n/**\n * Calls `Element.scrollIntoView` on the element, by default to the nearest\n * block and inline position. Does nothing for an empty element.\n */\nexport function scrollIntoView(\n element?: HTMLElement | null,\n config?: ScrollIntoViewOptions\n): void {\n if (!element) {\n return;\n }\n\n element.scrollIntoView(\n Object.assign(\n {\n behavior: 'auto',\n block: 'nearest',\n inline: 'nearest',\n },\n config\n )\n );\n}\n\n/** Returns the default containing layer for a floating element. */\nexport function getDefaultLayer(): HTMLElement {\n return document.body;\n}\n\n/**\n * Applies the given CSS declarations to the inline style of the element.\n *\n * @remarks\n * An unset declaration reads as an empty string, never `undefined`, so every\n * given property overwrites the current one.\n */\nexport function setStyles(\n element: HTMLElement,\n styles: Partial<CSSStyleDeclaration>\n): void {\n Object.assign(element.style, styles);\n}\n\n/** Returns whether the given input has at least one selected file. */\nexport function hasFiles(input: { files: FileList | null }): boolean {\n return input.files != null && input.files.length > 0;\n}\n\n/**\n * Returns whether the given element is an open popover.\n *\n * @remarks\n * Prefer this over the `open` property of a component, which disagrees with\n * the popover state while an open or close animation runs. Reads\n * `:popover-open`, so the element must use the popover API.\n */\nexport function isPopoverOpen(element?: Element): boolean {\n return element?.matches(':popover-open') ?? false;\n}\n\n/**\n * Returns whether the element, or an ancestor across shadow DOM boundaries,\n * has the `sticky` position.\n */\nexport function hasStickyAncestor(element: Element): boolean {\n for (const ancestor of iterAncestors(element)) {\n if (getComputedStyle(ancestor).position === 'sticky') {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns the nearest visible ancestor of the given node across shadow DOM\n * boundaries, or `null`.\n */\nexport function getVisibleAncestor(startNode: Node): HTMLElement | null {\n for (const ancestor of iterAncestors(startNode.parentNode)) {\n if (ancestor instanceof HTMLElement && ancestor.checkVisibility()) {\n return ancestor;\n }\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../src/internals/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGvC,MAAM,UAAU,KAAK,CAAC,OAAoB;IACxC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEhD,MAAM,8BAA8B,GAClC,CAAC,QAAQ,IAAI,OAAO,GAAG,KAAK,WAAW,IAAI,kBAAkB,IAAI,GAAG,CAAC;AAEvE,IAAI,oBAAyC,CAAC;AAE9C,SAAS,iBAAiB;IACxB,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;QACvC,oBAAoB,GAAG,8BAA8B,CAAC;QAEtD,IAAI,oBAAoB,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,GAAG,CAAC,gBAAgB,CAAC;oBACnB,IAAI,EAAE,eAAe;oBACrB,MAAM,EAAE,UAAU;oBAClB,QAAQ,EAAE,KAAK;oBACf,YAAY,EAAE,KAAK;iBACpB,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;YAGT,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAkBD,MAAM,UAAU,gBAAgB,CAAC,OAAoB,EAAE,KAAa;IAClE,IAAI,CAAC,iBAAiB,EAAE,EAAE,CAAC;QACzB,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;I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QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAMD,MAAM,UAAU,kBAAkB,CAAC,SAAe;IAChD,KAAK,MAAM,QAAQ,IAAI,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3D,IAAI,QAAQ,YAAY,WAAW,IAAI,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC;YAClE,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { isServer } from 'lit';\nimport { asNumber, clamp, numberInRangeInclusive } from './math.js';\nimport { isDefined } from './types.js';\n\n/** Returns whether an element has a Left-to-Right directionality. */\nexport function isLTR(element: HTMLElement) {\n return element.matches(':dir(ltr)');\n}\n\nconst LENGTH_PROPERTY = '--igc-resolved-length';\n\nconst SUPPORTS_REGISTERED_PROPERTIES =\n !isServer && typeof CSS !== 'undefined' && 'registerProperty' in CSS;\n\nlet lengthPropertyUsable: boolean | undefined;\n\nfunction canResolveLengths(): boolean {\n if (lengthPropertyUsable === undefined) {\n lengthPropertyUsable = SUPPORTS_REGISTERED_PROPERTIES;\n\n if (lengthPropertyUsable) {\n try {\n CSS.registerProperty({\n name: LENGTH_PROPERTY,\n syntax: '<length>',\n inherits: false,\n initialValue: '0px',\n });\n } catch {\n // The descriptor is constant, so a rejection means another bundle\n // instance already registered it. The property stays usable.\n }\n }\n }\n\n return lengthPropertyUsable;\n}\n\n/**\n * Resolves a CSS length to pixels in the context of `element`.\n *\n * @remarks\n * Registration makes the property compute to an absolute length, so the\n * browser converts font, viewport and container relative units. Returns 0\n * for percentages, for invalid lengths, during SSR and in a browser without\n * registered custom properties. Resolve percentages against the basis of\n * the applicable property instead.\n *\n * @example\n * ```typescript\n * resolveCssLength(element, '5rem'); // 80\n * resolveCssLength(element, '2em'); // 2 x the element font size\n * ```\n */\nexport function resolveCssLength(element: HTMLElement, value: string): number {\n if (!canResolveLengths()) {\n return 0;\n }\n\n const { style } = element;\n const previous = style.getPropertyValue(LENGTH_PROPERTY);\n const priority = style.getPropertyPriority(LENGTH_PROPERTY);\n\n style.setProperty(LENGTH_PROPERTY, value);\n const resolved = getComputedStyle(element).getPropertyValue(LENGTH_PROPERTY);\n\n // Restore rather than remove: the caller may use the property itself.\n if (previous) {\n style.setProperty(LENGTH_PROPERTY, previous, priority);\n } else {\n style.removeProperty(LENGTH_PROPERTY);\n }\n\n return asNumber(resolved);\n}\n\nexport type IterNodesOptions<T = Node> = {\n show?: keyof typeof NodeFilter;\n filter?: (node: T) => boolean;\n};\n\nfunction createNodeFilter<T extends Node>(predicate: (node: T) => boolean) {\n return {\n acceptNode: (node: T): number =>\n predicate(node) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP,\n };\n}\n\n/**\n * Iterates over the DOM subtree of `root` in document order, and yields the\n * nodes that match the {@link IterNodesOptions | options}.\n *\n * @example\n * ```typescript\n * for (const button of iterNodes<HTMLButtonElement>(root, {\n * show: 'SHOW_ELEMENT',\n * filter: isButton,\n * })) { ... }\n * ```\n */\nexport function* iterNodes<T extends Node>(\n root: Node,\n options?: IterNodesOptions<T>\n): Generator<T> {\n if (!isDefined(globalThis.document)) {\n return;\n }\n\n const whatToShow = options?.show\n ? NodeFilter[options.show]\n : NodeFilter.SHOW_ALL;\n\n const nodeFilter = options?.filter\n ? createNodeFilter(options.filter)\n : undefined;\n\n const treeWalker = document.createTreeWalker(root, whatToShow, nodeFilter);\n\n while (treeWalker.nextNode()) {\n yield treeWalker.currentNode as T;\n }\n}\n\n/**\n * Iterates over `node` and its element ancestors, and crosses each shadow\n * root through its host.\n *\n * @example\n * ```typescript\n * for (const ancestor of iterAncestors(element)) { ... }\n * ```\n */\nexport function* iterAncestors(node?: Node | null): Generator<Element> {\n let current: Node | null | undefined = node;\n\n while (current) {\n if (isElement(current)) {\n yield current;\n }\n\n current = current instanceof ShadowRoot ? current.host : current.parentNode;\n }\n}\n\n/** Returns the root node (document or shadow root) of the given node. */\nexport function getRoot(\n node: Node,\n options?: GetRootNodeOptions\n): Document | ShadowRoot {\n return node.getRootNode(options) as Document | ShadowRoot;\n}\n\n/** Returns the element with the given id in the root node of `root`. */\nexport function getElementByIdFromRoot(root: HTMLElement, id: string) {\n return getRoot(root).getElementById(id);\n}\n\nexport function isElement(node: unknown): node is Element {\n return node instanceof Node && node.nodeType === Node.ELEMENT_NODE;\n}\n\nexport function isDocument(node: unknown): node is Document {\n return node instanceof Node && node.nodeType === Node.DOCUMENT_NODE;\n}\n\n/** Returns the center x/y coordinate of a given element. */\nexport function getCenterPoint(element: Element): { x: number; y: number } {\n const { left, top, width, height } = element.getBoundingClientRect();\n\n return {\n x: left + width * 0.5,\n y: top + height * 0.5,\n };\n}\n\n/**\n * Maps the `clientX` coordinate of a pointer to a fraction of the element\n * width, in the range 0 to 1.\n *\n * @remarks\n * Measured from the logical start edge: the left one when `ltr` is true, the\n * right one otherwise. Returns 0 for an element that has no layout.\n *\n * @example\n * ```typescript\n * // Pointer 30px into a 120px wide element\n * pointToFraction(element, event.clientX); // 0.25\n * pointToFraction(element, event.clientX, false); // 0.75\n * ```\n */\nexport function pointToFraction(\n element: Element,\n clientX: number,\n ltr = true\n): number {\n const { left, right, width } = element.getBoundingClientRect();\n\n if (width === 0) {\n return 0;\n }\n\n return clamp((ltr ? clientX - left : right - clientX) / width, 0, 1);\n}\n\n/**\n * Concatenates the text content of the given nodes, trimmed and with each\n * run of whitespace collapsed into one space.\n */\nexport function normalizedTextContent(nodes: Iterable<Node>): string {\n let text = '';\n\n for (const node of nodes) {\n text += node.textContent ?? '';\n }\n\n return text.trim().replace(/\\s+/gu, ' ');\n}\n\n/** Returns whether the given coordinates lie in the element bounding box. */\nexport function isPointInsideElement(\n element: Element,\n x: number,\n y: number\n): boolean {\n const { left, right, top, bottom } = element.getBoundingClientRect();\n return (\n numberInRangeInclusive(x, left, right) &&\n numberInRangeInclusive(y, top, bottom)\n );\n}\n\n/** Returns the scale factor of a given element. */\nexport function getScaleFactor(element: HTMLElement): { x: number; y: number } {\n const { offsetWidth, offsetHeight } = element;\n const { width, height } = element.getBoundingClientRect();\n return { x: offsetWidth / width || 1, y: offsetHeight / height || 1 };\n}\n\n/**\n * Rounds a CSS pixel value to the closest device-pixel boundary, to prevent\n * blurry rendering.\n */\nexport function roundByDPR(value: number): number {\n const dpr = globalThis.devicePixelRatio || 1;\n return Math.round(value * dpr) / dpr;\n}\n\n/**\n * Calls `Element.scrollIntoView` on the element, by default to the nearest\n * block and inline position. Does nothing for an empty element.\n */\nexport function scrollIntoView(\n element?: HTMLElement | null,\n config?: ScrollIntoViewOptions\n): void {\n if (!element) {\n return;\n }\n\n element.scrollIntoView(\n Object.assign(\n {\n behavior: 'auto',\n block: 'nearest',\n inline: 'nearest',\n },\n config\n )\n );\n}\n\n/** Returns the default containing layer for a floating element. */\nexport function getDefaultLayer(): HTMLElement {\n return document.body;\n}\n\n/**\n * Applies the given CSS declarations to the inline style of the element.\n *\n * @remarks\n * An unset declaration reads as an empty string, never `undefined`, so every\n * given property overwrites the current one.\n */\nexport function setStyles(\n element: HTMLElement,\n styles: Partial<CSSStyleDeclaration>\n): void {\n Object.assign(element.style, styles);\n}\n\n/** Returns whether the given input has at least one selected file. */\nexport function hasFiles(input: { files: FileList | null }): boolean {\n return input.files != null && input.files.length > 0;\n}\n\n/**\n * Returns whether the given element is an open popover.\n *\n * @remarks\n * Prefer this over the `open` property of a component, which disagrees with\n * the popover state while an open or close animation runs. Reads\n * `:popover-open`, so the element must use the popover API.\n */\nexport function isPopoverOpen(element?: Element): boolean {\n return element?.matches(':popover-open') ?? false;\n}\n\n/**\n * Returns whether the element, or an ancestor across shadow DOM boundaries,\n * has the `sticky` position.\n */\nexport function hasStickyAncestor(element: Element): boolean {\n for (const ancestor of iterAncestors(element)) {\n if (getComputedStyle(ancestor).position === 'sticky') {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Returns the nearest visible ancestor of the given node across shadow DOM\n * boundaries, or `null`.\n */\nexport function getVisibleAncestor(startNode: Node): HTMLElement | null {\n for (const ancestor of iterAncestors(startNode.parentNode)) {\n if (ancestor instanceof HTMLElement && ancestor.checkVisibility()) {\n return ancestor;\n }\n }\n\n return null;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "igniteui-webcomponents",
3
- "version": "7.4.0",
3
+ "version": "7.4.1",
4
4
  "description": "Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.",
5
5
  "author": "Infragistics",
6
6
  "license": "MIT",
package/skills/README.md CHANGED
@@ -14,9 +14,10 @@ Skills are structured instructions that help AI agents understand and execute co
14
14
  | [igniteui-wc-integrate-with-framework](./igniteui-wc-integrate-with-framework/SKILL.md) | Integrate components into React, Angular, Vue, or vanilla JS applications | Setting up components in your project |
15
15
  | [igniteui-wc-customize-component-theme](./igniteui-wc-customize-component-theme/SKILL.md) | Customize styling using CSS custom properties, parts, and theming system | Applying custom brand colors/styles |
16
16
  | [igniteui-wc-generate-from-image-design](./igniteui-wc-generate-from-image-design/SKILL.md) | Implement a view from a screenshot or mockup using Ignite UI Web Components | Converting a design image into UI |
17
- | [igniteui-wc-figma-to-app](./igniteui-wc-figma-to-app/SKILL.md) | Translate Figma screens built with the Indigo.Design UI Kits into a working app | Implementing a design from a Figma file |
17
+ | [igniteui-wc-figma-to-app](./igniteui-wc-figma-to-app/SKILL.md) | Translate Figma screens from any UI kit (Indigo.Design, third-party, or plain frames) into a working app | Implementing a design from a Figma file |
18
18
  | [igniteui-wc-optimize-bundle-size](./igniteui-wc-optimize-bundle-size/SKILL.md) | Reduce bundle size by importing only needed components and lazy loading | Optimizing production performance |
19
19
  | [igniteui-wc-migrate-grid-lite-to-premium](./igniteui-wc-migrate-grid-lite-to-premium/SKILL.md) | Migrate from Grid Lite to the premium Data Grid | Adopting enterprise grid features |
20
+ | [igniteui-wc-grids](./igniteui-wc-grids/SKILL.md) | Set up a grid: package choice, theming, Shadow DOM, layout, sorting/filtering | Adding or debugging a grid in an app |
20
21
 
21
22
  ## How to Use
22
23
 
@@ -56,9 +57,6 @@ If you identify gaps in the skills or have suggestions for improvements:
56
57
 
57
58
  1. [Open an issue](https://github.com/IgniteUI/igniteui-webcomponents/issues) describing the improvement
58
59
  2. Submit a pull request with the proposed changes
59
- 3. Follow the skill format and structure of existing skills
60
-
61
- For skills related to **contributing to the library itself** (creating components, reviewing PRs, etc.), see [`.github/skills/`](../.github/skills/).
62
60
 
63
61
  ## Additional Resources
64
62
 
@@ -1,6 +1,7 @@
1
1
  ---
2
+ license: MIT
2
3
  name: igniteui-wc-choose-components
3
- description: Identify and select the right Ignite UI Web Components for your app UI, then navigate to official docs, usage examples, and API references
4
+ description: "Identify the right Ignite UI Web Components (igniteui-webcomponents, grids, charts, dock manager, React wrappers) for a UI requirement and point to official docs, examples, and API references. WHEN TO USE: the user asks which component fits a UI pattern (form, table, dashboard, navigation, chat, etc.), needs to compare options (e.g. Grid Lite vs. premium Grid), wants a component list for a screen, or asks which package a component lives in. WHEN NOT TO USE: implementing a view from a design image or Figma file (use generate-from-image-design or figma-to-app), installing/wiring packages into a framework (use integrate-with-framework), styling/theming (use customize-component-theme), reducing bundle size (use optimize-bundle-size), or migrating Grid Lite to the premium grid (use migrate-grid-lite-to-premium)."
4
5
  user-invocable: true
5
6
  ---
6
7
 
@@ -1,6 +1,7 @@
1
1
  ---
2
+ license: MIT
2
3
  name: igniteui-wc-customize-component-theme
3
- description: Customize Ignite UI Web Components styling using CSS custom properties, optional Sass, and the igniteui-theming MCP server for AI-assisted theming
4
+ description: "Theme and style Ignite UI Web Components (and igniteui-react) apps using CSS custom properties, optional Sass, and the igniteui-theming MCP server. WHEN TO USE: the user wants to apply or switch a pre-built theme (Material, Fluent, Bootstrap, Indigo, light/dark), create a custom palette or global theme, restyle a specific component via design tokens or ::part, scope a theme to a container, adjust sizing/spacing/roundness, or toggle light/dark mode. WHEN NOT TO USE: choosing which component to use (use choose-components), building a full view from a design image or Figma file (use generate-from-image-design or figma-to-app, which include theming), installing packages or framework setup (use integrate-with-framework), or styling non-Ignite UI elements or libraries."
4
5
  user-invocable: true
5
6
  ---
6
7