igniteui-webcomponents 7.1.1 → 7.1.2
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 +20 -0
- package/README.md +13 -11
- package/animations/easings.d.ts +1 -1
- package/animations/easings.js +1 -1
- package/animations/easings.js.map +1 -1
- package/components/button-group/button-group.js +2 -2
- package/components/button-group/button-group.js.map +1 -1
- package/components/button-group/themes/dark/button-group.bootstrap.css.js +1 -1
- package/components/button-group/themes/dark/button-group.bootstrap.css.js.map +1 -1
- package/components/button-group/themes/dark/button-group.fluent.css.js +1 -1
- package/components/button-group/themes/dark/button-group.fluent.css.js.map +1 -1
- package/components/button-group/themes/dark/button-group.indigo.css.js +1 -1
- package/components/button-group/themes/dark/button-group.indigo.css.js.map +1 -1
- package/components/button-group/themes/dark/button-group.material.css.js +1 -1
- package/components/button-group/themes/dark/button-group.material.css.js.map +1 -1
- package/components/button-group/themes/dark/button-group.shared.css.js +1 -1
- package/components/button-group/themes/dark/button-group.shared.css.js.map +1 -1
- package/components/button-group/themes/light/button-group.bootstrap.css.js +1 -1
- package/components/button-group/themes/light/button-group.bootstrap.css.js.map +1 -1
- package/components/button-group/themes/light/button-group.fluent.css.js +1 -1
- package/components/button-group/themes/light/button-group.fluent.css.js.map +1 -1
- package/components/button-group/themes/light/button-group.indigo.css.js +1 -1
- package/components/button-group/themes/light/button-group.indigo.css.js.map +1 -1
- package/components/button-group/themes/light/button-group.material.css.js +1 -1
- package/components/button-group/themes/light/button-group.material.css.js.map +1 -1
- package/components/button-group/themes/light/button-group.shared.css.js +1 -1
- package/components/button-group/themes/light/button-group.shared.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.bootstrap.css.js +1 -1
- package/components/button-group/themes/shared/button/button.bootstrap.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.fluent.css.js +1 -1
- package/components/button-group/themes/shared/button/button.fluent.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.material.css.js +1 -1
- package/components/button-group/themes/shared/button/button.material.css.js.map +1 -1
- package/components/calendar/calendar.js +3 -3
- package/components/calendar/calendar.js.map +1 -1
- package/components/calendar/helpers.js +2 -2
- package/components/calendar/helpers.js.map +1 -1
- package/components/carousel/carousel.js +2 -2
- package/components/carousel/carousel.js.map +1 -1
- package/components/chat/chat-message.js +1 -0
- package/components/chat/chat-message.js.map +1 -1
- package/components/chat/themes/dark/chat.bootstrap.css.js +1 -1
- package/components/chat/themes/dark/chat.bootstrap.css.js.map +1 -1
- package/components/chat/themes/dark/chat.fluent.css.js +1 -1
- package/components/chat/themes/dark/chat.fluent.css.js.map +1 -1
- package/components/chat/themes/dark/chat.indigo.css.js +1 -1
- package/components/chat/themes/dark/chat.indigo.css.js.map +1 -1
- package/components/chat/themes/dark/chat.material.css.js +1 -1
- package/components/chat/themes/dark/chat.material.css.js.map +1 -1
- package/components/chat/themes/light/chat.bootstrap.css.js +1 -1
- package/components/chat/themes/light/chat.bootstrap.css.js.map +1 -1
- package/components/chat/themes/light/chat.fluent.css.js +1 -1
- package/components/chat/themes/light/chat.fluent.css.js.map +1 -1
- package/components/chat/themes/light/chat.indigo.css.js +1 -1
- package/components/chat/themes/light/chat.indigo.css.js.map +1 -1
- package/components/chat/themes/light/chat.material.css.js +1 -1
- package/components/chat/themes/light/chat.material.css.js.map +1 -1
- package/components/chat/themes/light/chat.shared.css.js +1 -1
- package/components/chat/themes/light/chat.shared.css.js.map +1 -1
- package/components/chat/themes/message.base.css.js +1 -1
- package/components/chat/themes/message.base.css.js.map +1 -1
- package/components/chat/themes/message.js +0 -14
- package/components/chat/themes/message.js.map +1 -1
- package/components/chat/themes/shared/chat-message/chat-message.common.css.js +1 -1
- package/components/chat/themes/shared/chat-message/chat-message.common.css.js.map +1 -1
- package/components/chat/themes/shared/chat-message/chat-message.indigo.css.js +1 -1
- package/components/chat/themes/shared/chat-message/chat-message.indigo.css.js.map +1 -1
- package/components/chip/chip.d.ts +1 -0
- package/components/chip/chip.js +3 -1
- package/components/chip/chip.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/shared/chip.common.css.js +1 -1
- package/components/chip/themes/shared/chip.common.css.js.map +1 -1
- package/components/combo/combo-header.js.map +1 -1
- package/components/combo/combo-item.d.ts +6 -2
- package/components/combo/combo-item.js +5 -4
- package/components/combo/combo-item.js.map +1 -1
- package/components/combo/combo-list.js.map +1 -1
- package/components/combo/combo.d.ts +92 -81
- package/components/combo/combo.js +327 -281
- package/components/combo/combo.js.map +1 -1
- package/components/combo/controllers/data.d.ts +50 -13
- package/components/combo/controllers/data.js +49 -28
- package/components/combo/controllers/data.js.map +1 -1
- package/components/combo/controllers/navigation.d.ts +19 -18
- package/components/combo/controllers/navigation.js +73 -90
- package/components/combo/controllers/navigation.js.map +1 -1
- package/components/combo/operations/filter.d.ts +2 -2
- package/components/combo/operations/filter.js.map +1 -1
- package/components/combo/operations/group.d.ts +2 -2
- package/components/combo/operations/group.js.map +1 -1
- package/components/common/context.d.ts +1 -1
- package/components/common/context.js +1 -1
- package/components/common/context.js.map +1 -1
- package/components/common/controllers/drag.js +2 -2
- package/components/common/controllers/drag.js.map +1 -1
- package/components/common/controllers/key-bindings.d.ts +100 -18
- package/components/common/controllers/key-bindings.js +54 -47
- package/components/common/controllers/key-bindings.js.map +1 -1
- package/components/common/controllers/root-click.js +3 -3
- package/components/common/controllers/root-click.js.map +1 -1
- package/components/common/controllers/slot.d.ts +1 -1
- package/components/common/controllers/slot.js.map +1 -1
- package/components/common/mixins/combo-box.d.ts +24 -19
- package/components/common/mixins/combo-box.js +26 -23
- package/components/common/mixins/combo-box.js.map +1 -1
- package/components/common/util.d.ts +40 -2
- package/components/common/util.js +5 -2
- package/components/common/util.js.map +1 -1
- package/components/date-picker/date-picker.d.ts +3 -3
- package/components/date-picker/date-picker.js +10 -10
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-range-picker/date-range-picker.d.ts +3 -3
- package/components/date-range-picker/date-range-picker.js +9 -9
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-time-input/date-time-input.js +1 -1
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/datetime-mask-parser.d.ts +1 -2
- package/components/date-time-input/datetime-mask-parser.js +1 -2
- package/components/date-time-input/datetime-mask-parser.js.map +1 -1
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +6 -6
- package/components/dropdown/dropdown.js.map +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.common.css.js +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.common.css.js.map +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.indigo.css.js +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.indigo.css.js.map +1 -1
- package/components/progress/themes/circular/dark/circular.progress.indigo.css.js +1 -1
- package/components/progress/themes/circular/dark/circular.progress.indigo.css.js.map +1 -1
- package/components/progress/themes/circular/dark/circular.progress.shared.css.js +1 -1
- package/components/progress/themes/circular/dark/circular.progress.shared.css.js.map +1 -1
- package/components/progress/themes/circular/light/circular.progress.indigo.css.js +1 -1
- package/components/progress/themes/circular/light/circular.progress.indigo.css.js.map +1 -1
- package/components/progress/themes/circular/light/circular.progress.shared.css.js +1 -1
- package/components/progress/themes/circular/light/circular.progress.shared.css.js.map +1 -1
- package/components/progress/themes/circular/shared/circular.progress.common.css.js +1 -1
- package/components/progress/themes/circular/shared/circular.progress.common.css.js.map +1 -1
- package/components/progress/themes/linear/linear.progress.base.css.js +1 -1
- package/components/progress/themes/linear/linear.progress.base.css.js.map +1 -1
- package/components/radio/radio.js +1 -1
- package/components/radio/radio.js.map +1 -1
- package/components/rating/rating.d.ts +57 -28
- package/components/rating/rating.js +123 -120
- package/components/rating/rating.js.map +1 -1
- package/components/resize-container/resize-controller.js +2 -3
- package/components/resize-container/resize-controller.js.map +1 -1
- package/components/select/select.d.ts +3 -3
- package/components/select/select.js +10 -10
- package/components/select/select.js.map +1 -1
- package/components/splitter/types.d.ts +1 -1
- package/components/splitter/types.js.map +1 -1
- package/components/stepper/common/state.d.ts +1 -1
- package/components/stepper/common/state.js.map +1 -1
- package/components/stepper/stepper.js +3 -3
- package/components/stepper/stepper.js.map +1 -1
- package/components/tabs/tabs.js +3 -3
- package/components/tabs/tabs.js.map +1 -1
- package/components/tile-manager/tile.js +2 -2
- package/components/tile-manager/tile.js.map +1 -1
- package/components/tree/themes/shared/item.indigo.css.js +1 -1
- package/components/tree/themes/shared/item.indigo.css.js.map +1 -1
- package/components/tree/tree-item.js +2 -3
- package/components/tree/tree-item.js.map +1 -1
- package/custom-elements.json +1690 -966
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/package.json +1 -1
- package/skills/README.md +3 -0
- package/skills/igniteui-wc-choose-components/SKILL.md +53 -0
- package/skills/igniteui-wc-generate-from-image-design/SKILL.md +228 -0
- package/skills/igniteui-wc-generate-from-image-design/references/component-mapping.md +130 -0
- package/skills/igniteui-wc-generate-from-image-design/references/gotchas.md +147 -0
- package/skills/igniteui-wc-integrate-with-framework/SKILL.md +22 -1
- package/skills/igniteui-wc-integrate-with-framework/references/angular.md +2 -0
- package/skills/igniteui-wc-integrate-with-framework/references/react.md +2 -0
- package/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +2 -0
- package/skills/igniteui-wc-integrate-with-framework/references/vue.md +2 -0
- package/web-types.json +2 -2
- package/components/chat/themes/shared/chat-message/chat-message.bootstrap.css.d.ts +0 -1
- package/components/chat/themes/shared/chat-message/chat-message.bootstrap.css.js +0 -3
- package/components/chat/themes/shared/chat-message/chat-message.bootstrap.css.js.map +0 -1
- package/components/chat/themes/shared/chat-message/chat-message.fluent.css.d.ts +0 -1
- package/components/chat/themes/shared/chat-message/chat-message.fluent.css.js +0 -3
- package/components/chat/themes/shared/chat-message/chat-message.fluent.css.js.map +0 -1
- package/components/combo/controllers/selection.d.ts +0 -33
- package/components/combo/controllers/selection.js +0 -169
- package/components/combo/controllers/selection.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,GACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,E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,CAAC;kBACnB,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;sBACjB,IAAI,CAAC,QAAQ;sBACb,IAAI,CAAC,QAAQ;qBACd,IAAI,CAAC,OAAO,CAAC;qBACb,IAAI,CAAC,SAAS;4BACP,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ;6BACtC,WAAW;mBACrB,IAAI,CAAC,YAAY;;qBAEf,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mBAErC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sBAC/B,IAAI,CAAC,QAAQ;;;;eAIpB,IAAI,CAAC,QAAQ;iBACX,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oBAC9B,IAAI,CAAC,UAAU;;;;;QAK3B,IAAI,CAAC,yBAAyB,EAAE;KACnC,CAAC;IACJ,CAAC;;AA3RkB;IADlB,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;iDACwB;AAGnC;IADT,KAAK,EAAE;qDACoB;AAGpB;IADP,KAAK,EAAE;oDACc;AAuBtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAS1C;AAWD;IADC,QAAQ,EAAE;8CAMV;AAYD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAO3B;AAWM;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;wDACL","sourcesContent":["import { html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';\nimport {\n addKeybindings,\n arrowDown,\n arrowLeft,\n arrowRight,\n arrowUp,\n} from '../common/controllers/key-bindings.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { FormAssociatedCheckboxRequiredMixin } from '../common/mixins/forms/associated-required.js';\nimport { FormValueBooleanTransformers } from '../common/mixins/forms/form-transformers.js';\nimport { createFormValueState } from '../common/mixins/forms/form-value.js';\nimport { partMap } from '../common/part-map.js';\nimport { isDefined, isEmpty, isLTR, last, wrap } from '../common/util.js';\nimport type { ToggleLabelPosition } from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { styles } from './themes/radio.base.css.js';\nimport { styles as shared } from './themes/shared/radio.common.css.js';\nimport { all } from './themes/themes.js';\nimport { getGroup } from './utils.js';\nimport { radioValidators } from './validators.js';\n\nexport interface IgcRadioChangeEventArgs {\n checked: boolean;\n value?: string;\n}\n\nexport interface IgcRadioComponentEventMap {\n igcChange: CustomEvent<IgcRadioChangeEventArgs>;\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\nlet nextId = 1;\n\n/**\n * @element igc-radio\n *\n * @slot - The radio 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 radio control base wrapper.\n * @csspart control - The radio input control.\n * @csspart label - The radio control label.\n */\nexport default class IgcRadioComponent extends FormAssociatedCheckboxRequiredMixin(\n EventEmitterMixin<IgcRadioComponentEventMap, Constructor<LitElement>>(\n LitElement\n )\n) {\n public static readonly tagName = 'igc-radio';\n protected static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcRadioComponent, IgcValidationContainerComponent);\n }\n\n protected override get __validators() {\n return radioValidators;\n }\n\n private readonly _inputId = `radio-${nextId++}`;\n private readonly _labelId = `radio-label-${this._inputId}`;\n private readonly _focusRingManager = addKeyboardFocusRing(this);\n private readonly _slots = addSlotController(this, {\n slots: setSlots('helper-text', 'value-missing', 'custom-error', 'invalid'),\n onChange: this._handleSlotChange,\n });\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: false,\n transformers: FormValueBooleanTransformers,\n });\n\n protected _value!: string;\n\n @query('input', true)\n protected readonly _input!: HTMLInputElement;\n\n @state()\n protected _hideLabel = true;\n\n @state()\n private _tabIndex = 0;\n\n /** Returns all radio elements from the group, that is having the same name property. */\n private get _radios() {\n return getGroup(this).radios;\n }\n\n /** All sibling radio elements of the one invoking the getter. */\n private get _siblings() {\n return getGroup(this).siblings;\n }\n\n /** All non-disabled radio elements from the group. */\n private get _active() {\n return getGroup(this).active;\n }\n\n /** All checked radio elements from the group. */\n private get _checkedRadios() {\n return getGroup(this).checked;\n }\n\n @property({ type: Boolean, reflect: true })\n public override set required(value: boolean) {\n super.required = value;\n\n if (this.hasUpdated) {\n for (const radio of this._siblings) {\n radio._validate();\n }\n }\n }\n\n public override get required(): boolean {\n return this._required;\n }\n\n /**\n * The value attribute 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 this._tabIndex = this.checked ? 0 : -1;\n if (this.hasUpdated && this.checked) {\n this._updateCheckedState();\n }\n }\n\n public get checked(): boolean {\n return this._formValue.value;\n }\n\n /**\n * The label position of the radio control.\n * @attr label-position\n */\n @property({ reflect: true, attribute: 'label-position' })\n public labelPosition: ToggleLabelPosition = 'after';\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n addKeybindings(this, {\n skip: () => this.disabled,\n bindingDefaults: { preventDefault: true, triggers: ['keydownRepeat'] },\n })\n .set(arrowLeft, () => this._navigate(isLTR(this) ? -1 : 1))\n .set(arrowRight, () => this._navigate(isLTR(this) ? 1 : -1))\n .set(arrowUp, () => this._navigate(-1))\n .set(arrowDown, () => this._navigate(1));\n }\n\n protected override async firstUpdated(): Promise<void> {\n await this.updateComplete;\n\n if (this.checked && this === last(this._checkedRadios)) {\n for (const radio of this._siblings) {\n radio.checked = false;\n radio.defaultChecked = false;\n }\n } else {\n this._validate();\n }\n }\n\n protected _handleSlotChange(): void {\n this._hideLabel = !this._slots.hasAssignedNodes('[default]', true);\n }\n\n protected override _setDefaultValue(current: string | null): void {\n this._formValue.defaultValue = isDefined(current);\n for (const radio of this._siblings) {\n radio.defaultChecked = false;\n }\n }\n\n /** Simulates a click on the radio control. */\n public override click(): void {\n this._input.click();\n }\n\n /* alternateName: focusComponent */\n /** Sets focus on the radio control. */\n public override focus(options?: FocusOptions): void {\n this._input.focus(options);\n }\n\n /* alternateName: blurComponent */\n /** Removes focus from the radio control. */\n public override blur(): void {\n this._input.blur();\n }\n\n private _checkValidity(): boolean {\n return super.checkValidity();\n }\n\n private _reportValidity(): boolean {\n return super.reportValidity();\n }\n\n /** Checks for validity of the control and emits the invalid event if it invalid. */\n public override checkValidity(): boolean {\n for (const radio of this._siblings) {\n radio._checkValidity();\n }\n\n return this._checkValidity();\n }\n\n /** Checks for validity of the control and shows the browser message if it invalid. */\n public override reportValidity(): boolean {\n for (const radio of this._siblings) {\n radio._reportValidity();\n }\n\n return this._reportValidity();\n }\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public override setCustomValidity(message: string): void {\n for (const radio of this._radios) {\n radio._validate(message);\n }\n }\n\n private _updateCheckedState(): void {\n for (const radio of this._siblings) {\n radio.checked = false;\n }\n }\n\n protected override formResetCallback(): void {\n super.formResetCallback();\n this._resetTabIndexes();\n this.updateComplete.then(() => this._validate());\n }\n\n /** Called after a form reset callback to restore default keyboard navigation. */\n private _resetTabIndexes(): void {\n const radios = this._radios;\n\n if (isEmpty(this._checkedRadios)) {\n for (const radio of radios) {\n radio._tabIndex = 0;\n }\n } else {\n for (const radio of radios) {\n radio._tabIndex = radio.checked ? 0 : -1;\n }\n }\n }\n\n protected _handleClick(event: PointerEvent) {\n event.stopPropagation();\n this._setTouchedState();\n\n if (this.checked) {\n return;\n }\n\n this.checked = true;\n this._input.focus();\n this.emitEvent('igcChange', {\n detail: {\n checked: this.checked,\n value: this.value,\n },\n });\n }\n\n protected _navigate(idx: number): void {\n const active = this._active;\n const next = wrap(0, active.length - 1, active.indexOf(this) + idx);\n const radio = active[next];\n\n this._setTouchedState();\n radio.focus();\n radio.checked = true;\n radio.emitEvent('igcChange', {\n detail: { checked: radio.checked, value: radio.value },\n });\n }\n\n protected _renderValidatorContainer(): TemplateResult {\n return IgcValidationContainerComponent.create(this);\n }\n\n protected override render() {\n const labelledBy = this.getAttribute('aria-labelledby');\n const describedBy = this._slots.hasAssignedElements('helper-text')\n ? 'helper-text'\n : nothing;\n const checked = this.checked;\n\n return html`\n <label\n part=${partMap({\n base: true,\n checked,\n focused: this._focusRingManager.focused,\n })}\n for=${this._inputId}\n >\n <input\n id=${this._inputId}\n type=\"radio\"\n name=${ifDefined(this.name)}\n value=${ifDefined(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n .checked=${live(checked)}\n tabindex=${this._tabIndex}\n aria-labelledby=${labelledBy ? labelledBy : this._labelId}\n aria-describedby=${describedBy}\n @click=${this._handleClick}\n />\n <span part=${partMap({ control: true, checked })}>\n <span\n part=${partMap({ ripple: true, checked })}\n ?hidden=${this.disabled}\n ></span>\n </span>\n <span\n id=${this._labelId}\n part=${partMap({ label: true, checked })}\n ?hidden=${this._hideLabel}\n >\n <slot></slot>\n </span>\n </label>\n ${this._renderValidatorContainer()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-radio': IgcRadioComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../../src/components/radio/radio.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,GACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,mCAAmC,EAAE,MAAM,+CAA+C,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,+BAA+B,MAAM,iDAAiD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC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ACb,IAAI,CAAC,SAAS;4BACP,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ;6BACtC,WAAW;mBACrB,IAAI,CAAC,YAAY;;qBAEf,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mBAErC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sBAC/B,IAAI,CAAC,QAAQ;;;;eAIpB,IAAI,CAAC,QAAQ;iBACX,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oBAC9B,IAAI,CAAC,UAAU;;;;;QAK3B,IAAI,CAAC,yBAAyB,EAAE;KACnC,CAAC;IACJ,CAAC;;AA3RkB;IADlB,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;iDACwB;AAGnC;IADT,KAAK,EAAE;qDACoB;AAGpB;IADP,KAAK,EAAE;oDACc;AAuBtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;iDAS1C;AAWD;IADC,QAAQ,EAAE;8CAMV;AAYD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAO3B;AAWM;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;wDACL","sourcesContent":["import { html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport { addKeyboardFocusRing } from '../common/controllers/focus-ring.js';\nimport {\n addKeybindings,\n arrowDown,\n arrowLeft,\n arrowRight,\n arrowUp,\n} from '../common/controllers/key-bindings.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport { FormAssociatedCheckboxRequiredMixin } from '../common/mixins/forms/associated-required.js';\nimport { FormValueBooleanTransformers } from '../common/mixins/forms/form-transformers.js';\nimport { createFormValueState } from '../common/mixins/forms/form-value.js';\nimport { partMap } from '../common/part-map.js';\nimport { isDefined, isEmpty, isLTR, last, wrap } from '../common/util.js';\nimport type { ToggleLabelPosition } from '../types.js';\nimport IgcValidationContainerComponent from '../validation-container/validation-container.js';\nimport { styles } from './themes/radio.base.css.js';\nimport { styles as shared } from './themes/shared/radio.common.css.js';\nimport { all } from './themes/themes.js';\nimport { getGroup } from './utils.js';\nimport { radioValidators } from './validators.js';\n\nexport interface IgcRadioChangeEventArgs {\n checked: boolean;\n value?: string;\n}\n\nexport interface IgcRadioComponentEventMap {\n igcChange: CustomEvent<IgcRadioChangeEventArgs>;\n // For analyzer meta only:\n /* skipWCPrefix */\n focus: FocusEvent;\n /* skipWCPrefix */\n blur: FocusEvent;\n}\n\nlet nextId = 1;\n\n/**\n * @element igc-radio\n *\n * @slot - The radio 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 radio control base wrapper.\n * @csspart control - The radio input control.\n * @csspart label - The radio control label.\n */\nexport default class IgcRadioComponent extends FormAssociatedCheckboxRequiredMixin(\n EventEmitterMixin<IgcRadioComponentEventMap, Constructor<LitElement>>(\n LitElement\n )\n) {\n public static readonly tagName = 'igc-radio';\n protected static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcRadioComponent, IgcValidationContainerComponent);\n }\n\n protected override get __validators() {\n return radioValidators;\n }\n\n private readonly _inputId = `radio-${nextId++}`;\n private readonly _labelId = `radio-label-${this._inputId}`;\n private readonly _focusRingManager = addKeyboardFocusRing(this);\n private readonly _slots = addSlotController(this, {\n slots: setSlots('helper-text', 'value-missing', 'custom-error', 'invalid'),\n onChange: this._handleSlotChange,\n });\n\n protected override readonly _formValue = createFormValueState(this, {\n initialValue: false,\n transformers: FormValueBooleanTransformers,\n });\n\n protected _value!: string;\n\n @query('input', true)\n protected readonly _input!: HTMLInputElement;\n\n @state()\n protected _hideLabel = true;\n\n @state()\n private _tabIndex = 0;\n\n /** Returns all radio elements from the group, that is having the same name property. */\n private get _radios() {\n return getGroup(this).radios;\n }\n\n /** All sibling radio elements of the one invoking the getter. */\n private get _siblings() {\n return getGroup(this).siblings;\n }\n\n /** All non-disabled radio elements from the group. */\n private get _active() {\n return getGroup(this).active;\n }\n\n /** All checked radio elements from the group. */\n private get _checkedRadios() {\n return getGroup(this).checked;\n }\n\n @property({ type: Boolean, reflect: true })\n public override set required(value: boolean) {\n super.required = value;\n\n if (this.hasUpdated) {\n for (const radio of this._siblings) {\n radio._validate();\n }\n }\n }\n\n public override get required(): boolean {\n return this._required;\n }\n\n /**\n * The value attribute 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 this._tabIndex = this.checked ? 0 : -1;\n if (this.hasUpdated && this.checked) {\n this._updateCheckedState();\n }\n }\n\n public get checked(): boolean {\n return this._formValue.value;\n }\n\n /**\n * The label position of the radio control.\n * @attr label-position\n */\n @property({ reflect: true, attribute: 'label-position' })\n public labelPosition: ToggleLabelPosition = 'after';\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n addKeybindings(this, {\n skip: () => this.disabled,\n bindingDefaults: { preventDefault: true, repeat: true },\n })\n .set(arrowLeft, () => this._navigate(isLTR(this) ? -1 : 1))\n .set(arrowRight, () => this._navigate(isLTR(this) ? 1 : -1))\n .set(arrowUp, () => this._navigate(-1))\n .set(arrowDown, () => this._navigate(1));\n }\n\n protected override async firstUpdated(): Promise<void> {\n await this.updateComplete;\n\n if (this.checked && this === last(this._checkedRadios)) {\n for (const radio of this._siblings) {\n radio.checked = false;\n radio.defaultChecked = false;\n }\n } else {\n this._validate();\n }\n }\n\n protected _handleSlotChange(): void {\n this._hideLabel = !this._slots.hasAssignedNodes('[default]', true);\n }\n\n protected override _setDefaultValue(current: string | null): void {\n this._formValue.defaultValue = isDefined(current);\n for (const radio of this._siblings) {\n radio.defaultChecked = false;\n }\n }\n\n /** Simulates a click on the radio control. */\n public override click(): void {\n this._input.click();\n }\n\n /* alternateName: focusComponent */\n /** Sets focus on the radio control. */\n public override focus(options?: FocusOptions): void {\n this._input.focus(options);\n }\n\n /* alternateName: blurComponent */\n /** Removes focus from the radio control. */\n public override blur(): void {\n this._input.blur();\n }\n\n private _checkValidity(): boolean {\n return super.checkValidity();\n }\n\n private _reportValidity(): boolean {\n return super.reportValidity();\n }\n\n /** Checks for validity of the control and emits the invalid event if it invalid. */\n public override checkValidity(): boolean {\n for (const radio of this._siblings) {\n radio._checkValidity();\n }\n\n return this._checkValidity();\n }\n\n /** Checks for validity of the control and shows the browser message if it invalid. */\n public override reportValidity(): boolean {\n for (const radio of this._siblings) {\n radio._reportValidity();\n }\n\n return this._reportValidity();\n }\n\n /**\n * Sets a custom validation message for the control.\n * As long as `message` is not empty, the control is considered invalid.\n */\n public override setCustomValidity(message: string): void {\n for (const radio of this._radios) {\n radio._validate(message);\n }\n }\n\n private _updateCheckedState(): void {\n for (const radio of this._siblings) {\n radio.checked = false;\n }\n }\n\n protected override formResetCallback(): void {\n super.formResetCallback();\n this._resetTabIndexes();\n this.updateComplete.then(() => this._validate());\n }\n\n /** Called after a form reset callback to restore default keyboard navigation. */\n private _resetTabIndexes(): void {\n const radios = this._radios;\n\n if (isEmpty(this._checkedRadios)) {\n for (const radio of radios) {\n radio._tabIndex = 0;\n }\n } else {\n for (const radio of radios) {\n radio._tabIndex = radio.checked ? 0 : -1;\n }\n }\n }\n\n protected _handleClick(event: PointerEvent) {\n event.stopPropagation();\n this._setTouchedState();\n\n if (this.checked) {\n return;\n }\n\n this.checked = true;\n this._input.focus();\n this.emitEvent('igcChange', {\n detail: {\n checked: this.checked,\n value: this.value,\n },\n });\n }\n\n protected _navigate(idx: number): void {\n const active = this._active;\n const next = wrap(0, active.length - 1, active.indexOf(this) + idx);\n const radio = active[next];\n\n this._setTouchedState();\n radio.focus();\n radio.checked = true;\n radio.emitEvent('igcChange', {\n detail: { checked: radio.checked, value: radio.value },\n });\n }\n\n protected _renderValidatorContainer(): TemplateResult {\n return IgcValidationContainerComponent.create(this);\n }\n\n protected override render() {\n const labelledBy = this.getAttribute('aria-labelledby');\n const describedBy = this._slots.hasAssignedElements('helper-text')\n ? 'helper-text'\n : nothing;\n const checked = this.checked;\n\n return html`\n <label\n part=${partMap({\n base: true,\n checked,\n focused: this._focusRingManager.focused,\n })}\n for=${this._inputId}\n >\n <input\n id=${this._inputId}\n type=\"radio\"\n name=${ifDefined(this.name)}\n value=${ifDefined(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n .checked=${live(checked)}\n tabindex=${this._tabIndex}\n aria-labelledby=${labelledBy ? labelledBy : this._labelId}\n aria-describedby=${describedBy}\n @click=${this._handleClick}\n />\n <span part=${partMap({ control: true, checked })}>\n <span\n part=${partMap({ ripple: true, checked })}\n ?hidden=${this.disabled}\n ></span>\n </span>\n <span\n id=${this._labelId}\n part=${partMap({ label: true, checked })}\n ?hidden=${this._hideLabel}\n >\n <slot></slot>\n </span>\n </label>\n ${this._renderValidatorContainer()}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-radio': IgcRadioComponent;\n }\n}\n"]}
|
|
@@ -1,17 +1,47 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { Constructor } from '../common/mixins/constructor.js';
|
|
3
|
-
import IgcRatingSymbolComponent from './rating-symbol.js';
|
|
4
3
|
export interface IgcRatingComponentEventMap {
|
|
5
4
|
igcChange: CustomEvent<number>;
|
|
6
5
|
igcHover: CustomEvent<number>;
|
|
7
6
|
}
|
|
8
7
|
declare const IgcRatingComponent_base: Constructor<import("../common/mixins/forms/types.js").FormAssociatedElementInterface> & Constructor<import("../common/mixins/event-emitter.js").EventEmitterInterface<IgcRatingComponentEventMap>> & Constructor<LitElement>;
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* A rating component that allows users to view and provide ratings using customizable symbols.
|
|
10
|
+
* It supports fractional values, hover previews, keyboard navigation, single-selection mode,
|
|
11
|
+
* and integrates with forms as a number input.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <!-- Basic rating -->
|
|
16
|
+
* <igc-rating value="3" max="5" label="Rate this product"></igc-rating>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```html
|
|
21
|
+
* <!-- Half-star rating with hover preview -->
|
|
22
|
+
* <igc-rating step="0.5" hover-preview value-format="{0} out of {1} stars"></igc-rating>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html
|
|
27
|
+
* <!-- Custom symbols via projected rating symbols -->
|
|
28
|
+
* <igc-rating>
|
|
29
|
+
* <igc-rating-symbol>
|
|
30
|
+
* <igc-icon name="heart_filled" collection="default"></igc-icon>
|
|
31
|
+
* <igc-icon name="heart_outlined" collection="default" slot="empty"></igc-icon>
|
|
32
|
+
* </igc-rating-symbol>
|
|
33
|
+
* <igc-rating-symbol>
|
|
34
|
+
* <igc-icon name="heart_filled" collection="default"></igc-icon>
|
|
35
|
+
* <igc-icon name="heart_outlined" collection="default" slot="empty"></igc-icon>
|
|
36
|
+
* </igc-rating-symbol>
|
|
37
|
+
* </igc-rating>
|
|
38
|
+
* ```
|
|
12
39
|
*
|
|
13
40
|
* @element igc-rating
|
|
14
41
|
*
|
|
42
|
+
* @slot symbol - Slot for projecting custom `igc-rating-symbol` elements. When used, the number of symbols determines the `max` value.
|
|
43
|
+
* @slot value-label - Slot for custom content displayed alongside the rating value.
|
|
44
|
+
*
|
|
15
45
|
* @fires igcChange - Emitted when the value of the control changes.
|
|
16
46
|
* @fires igcHover - Emitted when hover is enabled and the user mouses over a symbol of the rating.
|
|
17
47
|
*
|
|
@@ -33,18 +63,18 @@ export default class IgcRatingComponent extends IgcRatingComponent_base {
|
|
|
33
63
|
static readonly tagName = "igc-rating";
|
|
34
64
|
static styles: import("lit").CSSResult[];
|
|
35
65
|
static register(): void;
|
|
66
|
+
protected readonly _slots: import("../common/controllers/slot.js").SlotController<"symbol" | "[default]" | "value-label">;
|
|
36
67
|
protected readonly _formValue: import("../common/mixins/forms/form-value.js").FormValue<number>;
|
|
37
68
|
private _max;
|
|
38
69
|
private _step;
|
|
39
70
|
private _single;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
protected get valueText(): string;
|
|
71
|
+
private _symbols;
|
|
72
|
+
private _container?;
|
|
73
|
+
private _hoverValue;
|
|
74
|
+
private _hoverState;
|
|
75
|
+
private get _isInteractive();
|
|
76
|
+
private get _hasProjectedSymbols();
|
|
77
|
+
private get _valueText();
|
|
48
78
|
/**
|
|
49
79
|
* The maximum value for the rating.
|
|
50
80
|
*
|
|
@@ -68,7 +98,7 @@ export default class IgcRatingComponent extends IgcRatingComponent_base {
|
|
|
68
98
|
* The label of the control.
|
|
69
99
|
* @attr label
|
|
70
100
|
*/
|
|
71
|
-
label
|
|
101
|
+
label?: string;
|
|
72
102
|
/**
|
|
73
103
|
* A format string which sets aria-valuetext. Instances of '{0}' will be replaced
|
|
74
104
|
* with the current value of the control and instances of '{1}' with the maximum value for the control.
|
|
@@ -76,7 +106,7 @@ export default class IgcRatingComponent extends IgcRatingComponent_base {
|
|
|
76
106
|
* Important for screen-readers and useful for localization.
|
|
77
107
|
* @attr value-format
|
|
78
108
|
*/
|
|
79
|
-
valueFormat
|
|
109
|
+
valueFormat?: string;
|
|
80
110
|
/**
|
|
81
111
|
* The current value of the component
|
|
82
112
|
* @attr value
|
|
@@ -104,22 +134,22 @@ export default class IgcRatingComponent extends IgcRatingComponent_base {
|
|
|
104
134
|
/**
|
|
105
135
|
* Whether to reset the rating when the user selects the same value.
|
|
106
136
|
* @attr allow-reset
|
|
137
|
+
* @default false
|
|
107
138
|
*/
|
|
108
139
|
allowReset: boolean;
|
|
109
140
|
constructor();
|
|
110
|
-
protected firstUpdated():
|
|
111
|
-
protected
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
141
|
+
protected firstUpdated(): void;
|
|
142
|
+
protected updated(): void;
|
|
143
|
+
private _handleClick;
|
|
144
|
+
private _handlePointerMove;
|
|
145
|
+
private _handleSlotChange;
|
|
146
|
+
private _handleHoverEnabled;
|
|
147
|
+
private _handleHoverDisabled;
|
|
148
|
+
private _emitValueUpdate;
|
|
149
|
+
private _calcNewValue;
|
|
150
|
+
private _round;
|
|
151
|
+
private _updateProjectedSymbols;
|
|
152
|
+
private _clipSymbol;
|
|
123
153
|
/**
|
|
124
154
|
* Increments the value of the control by `n` steps multiplied by the
|
|
125
155
|
* step factor.
|
|
@@ -130,8 +160,7 @@ export default class IgcRatingComponent extends IgcRatingComponent_base {
|
|
|
130
160
|
* the step factor.
|
|
131
161
|
*/
|
|
132
162
|
stepDown(n?: number): void;
|
|
133
|
-
|
|
134
|
-
protected clipProjected(): void;
|
|
163
|
+
private _renderSymbols;
|
|
135
164
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
136
165
|
}
|
|
137
166
|
declare global {
|
|
@@ -5,44 +5,46 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { html, LitElement, nothing } from 'lit';
|
|
8
|
-
import { property, query,
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { range } from 'lit/directives/range.js';
|
|
10
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
11
11
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
12
12
|
import { addThemingController } from '../../theming/theming-controller.js';
|
|
13
13
|
import { addKeybindings, arrowDown, arrowLeft, arrowRight, arrowUp, endKey, homeKey, } from '../common/controllers/key-bindings.js';
|
|
14
|
+
import { addSlotController, setSlots, } from '../common/controllers/slot.js';
|
|
14
15
|
import { registerComponent } from '../common/definitions/register.js';
|
|
15
16
|
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
16
17
|
import { FormAssociatedMixin } from '../common/mixins/forms/associated.js';
|
|
17
18
|
import { FormValueNumberTransformers } from '../common/mixins/forms/form-transformers.js';
|
|
18
19
|
import { createFormValueState } from '../common/mixins/forms/form-value.js';
|
|
19
|
-
import { asNumber, clamp, formatString,
|
|
20
|
+
import { asNumber, bindIf, clamp, formatString, isLTR, numberOfDecimals, roundPrecise, } from '../common/util.js';
|
|
20
21
|
import IgcIconComponent from '../icon/icon.js';
|
|
21
22
|
import IgcRatingSymbolComponent from './rating-symbol.js';
|
|
22
23
|
import { styles } from './themes/rating.base.css.js';
|
|
23
24
|
import { styles as shared } from './themes/shared/rating.common.css.js';
|
|
24
25
|
import { all } from './themes/themes.js';
|
|
26
|
+
const Slots = setSlots('symbol', 'value-label');
|
|
25
27
|
export default class IgcRatingComponent extends FormAssociatedMixin(EventEmitterMixin(LitElement)) {
|
|
26
28
|
static { this.tagName = 'igc-rating'; }
|
|
27
29
|
static { this.styles = [styles, shared]; }
|
|
28
30
|
static register() {
|
|
29
31
|
registerComponent(IgcRatingComponent, IgcIconComponent, IgcRatingSymbolComponent);
|
|
30
32
|
}
|
|
31
|
-
get
|
|
33
|
+
get _isInteractive() {
|
|
32
34
|
return !(this.readOnly || this.disabled);
|
|
33
35
|
}
|
|
34
|
-
get
|
|
35
|
-
return this.
|
|
36
|
+
get _hasProjectedSymbols() {
|
|
37
|
+
return this._symbols.length > 0;
|
|
36
38
|
}
|
|
37
|
-
get
|
|
38
|
-
const value = this.
|
|
39
|
+
get _valueText() {
|
|
40
|
+
const value = this._round(this.value);
|
|
39
41
|
return this.valueFormat
|
|
40
42
|
? formatString(this.valueFormat, value, this.max)
|
|
41
43
|
: `${value} of ${this.max}`;
|
|
42
44
|
}
|
|
43
45
|
set max(value) {
|
|
44
|
-
this._max = this.
|
|
45
|
-
? this.
|
|
46
|
+
this._max = this._hasProjectedSymbols
|
|
47
|
+
? this._symbols.length
|
|
46
48
|
: Math.max(0, value);
|
|
47
49
|
if (this._max < this.value) {
|
|
48
50
|
this.value = this._max;
|
|
@@ -78,6 +80,10 @@ export default class IgcRatingComponent extends FormAssociatedMixin(EventEmitter
|
|
|
78
80
|
}
|
|
79
81
|
constructor() {
|
|
80
82
|
super();
|
|
83
|
+
this._slots = addSlotController(this, {
|
|
84
|
+
slots: Slots,
|
|
85
|
+
onChange: this._handleSlotChange,
|
|
86
|
+
});
|
|
81
87
|
this._formValue = createFormValueState(this, {
|
|
82
88
|
initialValue: 0,
|
|
83
89
|
transformers: FormValueNumberTransformers,
|
|
@@ -85,76 +91,103 @@ export default class IgcRatingComponent extends FormAssociatedMixin(EventEmitter
|
|
|
85
91
|
this._max = 5;
|
|
86
92
|
this._step = 1;
|
|
87
93
|
this._single = false;
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
94
|
+
this._symbols = [];
|
|
95
|
+
this._hoverValue = -1;
|
|
96
|
+
this._hoverState = false;
|
|
90
97
|
this.hoverPreview = false;
|
|
91
98
|
this.readOnly = false;
|
|
92
99
|
this.allowReset = false;
|
|
93
100
|
addThemingController(this, all);
|
|
94
101
|
addKeybindings(this, {
|
|
95
|
-
skip: () => !this.
|
|
102
|
+
skip: () => !this._isInteractive,
|
|
103
|
+
bindingDefaults: { repeat: true },
|
|
96
104
|
})
|
|
97
|
-
.set(arrowUp, () => this.
|
|
98
|
-
.set(arrowRight, () => this.
|
|
99
|
-
.set(arrowDown, () => this.
|
|
100
|
-
.set(arrowLeft, () => this.
|
|
101
|
-
.set(homeKey, () => this.
|
|
102
|
-
.set(endKey, () => this.
|
|
105
|
+
.set(arrowUp, () => this._emitValueUpdate(this.value + this.step))
|
|
106
|
+
.set(arrowRight, () => this._emitValueUpdate(isLTR(this) ? this.value + this.step : this.value - this.step))
|
|
107
|
+
.set(arrowDown, () => this._emitValueUpdate(this.value - this.step))
|
|
108
|
+
.set(arrowLeft, () => this._emitValueUpdate(isLTR(this) ? this.value - this.step : this.value + this.step))
|
|
109
|
+
.set(homeKey, () => this._emitValueUpdate(this.step))
|
|
110
|
+
.set(endKey, () => this._emitValueUpdate(this.max));
|
|
103
111
|
}
|
|
104
|
-
|
|
105
|
-
await this.updateComplete;
|
|
112
|
+
firstUpdated() {
|
|
106
113
|
this._formValue.setValueAndFormState(clamp(this.value, 0, this.max));
|
|
107
114
|
this._pristine = true;
|
|
108
115
|
}
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
updated() {
|
|
117
|
+
if (this._hasProjectedSymbols) {
|
|
118
|
+
this._updateProjectedSymbols();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
_handleClick({ clientX }) {
|
|
122
|
+
const value = this._calcNewValue(clientX);
|
|
111
123
|
const sameValue = this.value === value;
|
|
112
124
|
if (this.allowReset && sameValue) {
|
|
113
|
-
this.
|
|
125
|
+
this._emitValueUpdate(0);
|
|
114
126
|
}
|
|
115
127
|
else if (!sameValue) {
|
|
116
|
-
this.
|
|
128
|
+
this._emitValueUpdate(value);
|
|
117
129
|
}
|
|
118
130
|
}
|
|
119
|
-
|
|
120
|
-
const value = this.
|
|
121
|
-
if (this.
|
|
122
|
-
this.
|
|
123
|
-
this.emitEvent('igcHover', { detail: this.
|
|
131
|
+
_handlePointerMove({ clientX }) {
|
|
132
|
+
const value = this._calcNewValue(clientX);
|
|
133
|
+
if (this._hoverValue !== value) {
|
|
134
|
+
this._hoverValue = value;
|
|
135
|
+
this.emitEvent('igcHover', { detail: this._hoverValue });
|
|
124
136
|
}
|
|
125
137
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
138
|
+
_handleSlotChange({ slot, }) {
|
|
139
|
+
if (slot === 'symbol') {
|
|
140
|
+
this._symbols = this._slots.getAssignedElements('symbol', {
|
|
141
|
+
selector: IgcRatingSymbolComponent.tagName,
|
|
142
|
+
});
|
|
143
|
+
if (this._hasProjectedSymbols) {
|
|
144
|
+
this.max = this._symbols.length;
|
|
145
|
+
}
|
|
131
146
|
}
|
|
132
147
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.max = this.ratingSymbols.length;
|
|
136
|
-
this.requestUpdate();
|
|
137
|
-
}
|
|
148
|
+
_handleHoverEnabled() {
|
|
149
|
+
this._hoverState = true;
|
|
138
150
|
}
|
|
139
|
-
|
|
140
|
-
this.
|
|
151
|
+
_handleHoverDisabled() {
|
|
152
|
+
this._hoverState = false;
|
|
141
153
|
}
|
|
142
|
-
|
|
143
|
-
this.
|
|
154
|
+
_emitValueUpdate(next) {
|
|
155
|
+
this._setTouchedState();
|
|
156
|
+
const clamped = clamp(next, 0, this.max);
|
|
157
|
+
if (clamped !== this.value) {
|
|
158
|
+
this.value = clamped;
|
|
159
|
+
this.emitEvent('igcChange', { detail: this.value });
|
|
160
|
+
}
|
|
144
161
|
}
|
|
145
|
-
|
|
146
|
-
const { width, left, right } = this.
|
|
162
|
+
_calcNewValue(x) {
|
|
163
|
+
const { width, left, right } = this._container?.getBoundingClientRect() ?? new DOMRect(1, 1, 1, 1);
|
|
147
164
|
const percent = isLTR(this) ? (x - left) / width : (right - x) / width;
|
|
148
|
-
const value = this.
|
|
165
|
+
const value = this._round(this.max * percent);
|
|
149
166
|
return clamp(value, this.step, this.max);
|
|
150
167
|
}
|
|
151
|
-
|
|
168
|
+
_round(value) {
|
|
152
169
|
return roundPrecise(Math.ceil(value / this.step) * this.step, numberOfDecimals(this.step));
|
|
153
170
|
}
|
|
154
|
-
|
|
155
|
-
const
|
|
171
|
+
_updateProjectedSymbols() {
|
|
172
|
+
const ltr = isLTR(this);
|
|
173
|
+
const partFull = '[part="symbol full"]';
|
|
174
|
+
const partEmpty = '[part="symbol empty"]';
|
|
175
|
+
for (const [i, symbol] of this._symbols.entries()) {
|
|
176
|
+
const full = symbol.renderRoot.querySelector(partFull);
|
|
177
|
+
const empty = symbol.renderRoot.querySelector(partEmpty);
|
|
178
|
+
const { forward, backward } = this._clipSymbol(i, ltr);
|
|
179
|
+
if (full) {
|
|
180
|
+
full.style.clipPath = forward;
|
|
181
|
+
}
|
|
182
|
+
if (empty) {
|
|
183
|
+
empty.style.clipPath = backward;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
_clipSymbol(index, isLTR = true) {
|
|
188
|
+
const value = this._hoverState ? this._hoverValue : this.value;
|
|
156
189
|
const progress = index + 1 - value;
|
|
157
|
-
const exclusive = progress === 0 ||
|
|
190
|
+
const exclusive = progress === 0 || value === index + 1 ? 0 : 1;
|
|
158
191
|
const selection = this.single ? exclusive : progress;
|
|
159
192
|
const activate = (p) => clamp(p * 100, 0, 100);
|
|
160
193
|
const forward = `inset(0 ${activate(isLTR ? selection : 1 - selection)}% 0 0)`;
|
|
@@ -165,57 +198,37 @@ export default class IgcRatingComponent extends FormAssociatedMixin(EventEmitter
|
|
|
165
198
|
};
|
|
166
199
|
}
|
|
167
200
|
stepUp(n = 1) {
|
|
168
|
-
this.value += this.
|
|
201
|
+
this.value += this._round(n * this.step);
|
|
169
202
|
}
|
|
170
203
|
stepDown(n = 1) {
|
|
171
|
-
this.value -= this.
|
|
172
|
-
}
|
|
173
|
-
*renderSymbols() {
|
|
174
|
-
const ltr = isLTR(this);
|
|
175
|
-
for (let i = 0; i < this.max; i++) {
|
|
176
|
-
const { forward, backward } = this.clipSymbol(i, ltr);
|
|
177
|
-
yield html `<igc-rating-symbol exportparts="symbol, full, empty">
|
|
178
|
-
<igc-icon
|
|
179
|
-
collection="default"
|
|
180
|
-
name="star_filled"
|
|
181
|
-
style=${styleMap({ clipPath: forward })}
|
|
182
|
-
></igc-icon>
|
|
183
|
-
<igc-icon
|
|
184
|
-
collection="default"
|
|
185
|
-
name="star_outlined"
|
|
186
|
-
style=${styleMap({ clipPath: backward })}
|
|
187
|
-
slot="empty"
|
|
188
|
-
></igc-icon>
|
|
189
|
-
</igc-rating-symbol>`;
|
|
190
|
-
}
|
|
204
|
+
this.value -= this._round(n * this.step);
|
|
191
205
|
}
|
|
192
|
-
|
|
206
|
+
_renderSymbols() {
|
|
193
207
|
const ltr = isLTR(this);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
208
|
+
return html `
|
|
209
|
+
${repeat(range(this.max), (i) => i, (i) => {
|
|
210
|
+
const { forward, backward } = this._clipSymbol(i, ltr);
|
|
211
|
+
return html `
|
|
212
|
+
<igc-rating-symbol exportparts="symbol, full, empty">
|
|
213
|
+
<igc-icon
|
|
214
|
+
collection="default"
|
|
215
|
+
name="star_filled"
|
|
216
|
+
style=${styleMap({ clipPath: forward })}
|
|
217
|
+
></igc-icon>
|
|
218
|
+
<igc-icon
|
|
219
|
+
collection="default"
|
|
220
|
+
name="star_outlined"
|
|
221
|
+
style=${styleMap({ clipPath: backward })}
|
|
222
|
+
slot="empty"
|
|
223
|
+
></igc-icon>
|
|
224
|
+
</igc-rating-symbol>
|
|
225
|
+
`;
|
|
226
|
+
})}
|
|
227
|
+
`;
|
|
207
228
|
}
|
|
208
229
|
render() {
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
this.hoverValue,
|
|
212
|
-
this.max,
|
|
213
|
-
this.step,
|
|
214
|
-
this.single,
|
|
215
|
-
this.hoverState,
|
|
216
|
-
this.ratingSymbols,
|
|
217
|
-
];
|
|
218
|
-
const hoverActive = this.hoverPreview && this.isInteractive;
|
|
230
|
+
const hoverActive = this.hoverPreview && this._isInteractive;
|
|
231
|
+
const valueLabelHidden = !this._slots.hasAssignedNodes('value-label', true);
|
|
219
232
|
return html `
|
|
220
233
|
<label part="label" id="rating-label" ?hidden=${!this.label}
|
|
221
234
|
>${this.label}</label
|
|
@@ -223,52 +236,42 @@ export default class IgcRatingComponent extends FormAssociatedMixin(EventEmitter
|
|
|
223
236
|
<div
|
|
224
237
|
part="base"
|
|
225
238
|
role="slider"
|
|
226
|
-
tabindex=${
|
|
239
|
+
tabindex=${this.disabled ? -1 : 0}
|
|
227
240
|
aria-labelledby="rating-label"
|
|
228
241
|
aria-valuemin="0"
|
|
229
242
|
aria-valuenow=${this.value}
|
|
230
243
|
aria-valuemax=${this.max}
|
|
231
|
-
aria-valuetext=${this.
|
|
244
|
+
aria-valuetext=${this._valueText}
|
|
232
245
|
>
|
|
233
246
|
<div
|
|
234
247
|
aria-hidden="true"
|
|
235
248
|
part="symbols"
|
|
236
|
-
@click=${this.
|
|
237
|
-
@pointerenter=${hoverActive
|
|
238
|
-
@pointerleave=${hoverActive
|
|
239
|
-
@
|
|
249
|
+
@click=${bindIf(this._isInteractive, this._handleClick)}
|
|
250
|
+
@pointerenter=${bindIf(hoverActive, this._handleHoverEnabled)}
|
|
251
|
+
@pointerleave=${bindIf(hoverActive, this._handleHoverDisabled)}
|
|
252
|
+
@pointercancel=${bindIf(hoverActive, this._handleHoverDisabled)}
|
|
253
|
+
@pointermove=${bindIf(hoverActive, this._handlePointerMove)}
|
|
240
254
|
>
|
|
241
|
-
<slot name="symbol"
|
|
242
|
-
${
|
|
243
|
-
? this.clipProjected()
|
|
244
|
-
: this.renderSymbols())}
|
|
255
|
+
<slot name="symbol">
|
|
256
|
+
${this._hasProjectedSymbols ? nothing : this._renderSymbols()}
|
|
245
257
|
</slot>
|
|
246
258
|
</div>
|
|
247
|
-
<label part="value-label" ?hidden=${
|
|
259
|
+
<label part="value-label" ?hidden=${valueLabelHidden}>
|
|
248
260
|
<slot name="value-label"></slot>
|
|
249
261
|
</label>
|
|
250
262
|
</div>
|
|
251
263
|
`;
|
|
252
264
|
}
|
|
253
265
|
}
|
|
254
|
-
__decorate([
|
|
255
|
-
queryAssignedElements({
|
|
256
|
-
selector: IgcRatingSymbolComponent.tagName,
|
|
257
|
-
slot: 'symbol',
|
|
258
|
-
})
|
|
259
|
-
], IgcRatingComponent.prototype, "ratingSymbols", void 0);
|
|
260
266
|
__decorate([
|
|
261
267
|
query('[part="symbols"]', true)
|
|
262
|
-
], IgcRatingComponent.prototype, "
|
|
263
|
-
__decorate([
|
|
264
|
-
queryAssignedNodes({ slot: 'value-label', flatten: true })
|
|
265
|
-
], IgcRatingComponent.prototype, "valueLabel", void 0);
|
|
268
|
+
], IgcRatingComponent.prototype, "_container", void 0);
|
|
266
269
|
__decorate([
|
|
267
270
|
state()
|
|
268
|
-
], IgcRatingComponent.prototype, "
|
|
271
|
+
], IgcRatingComponent.prototype, "_hoverValue", void 0);
|
|
269
272
|
__decorate([
|
|
270
273
|
state()
|
|
271
|
-
], IgcRatingComponent.prototype, "
|
|
274
|
+
], IgcRatingComponent.prototype, "_hoverState", void 0);
|
|
272
275
|
__decorate([
|
|
273
276
|
property({ type: Number })
|
|
274
277
|
], IgcRatingComponent.prototype, "max", null);
|