@tylertech/forge 3.0.0-next.22 → 3.0.0-next.23
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/dist/esm/autocomplete/index.js +1 -1
- package/dist/esm/bottom-sheet/index.js +1 -1
- package/dist/esm/checkbox/index.js +1 -1
- package/dist/esm/chip-field/index.js +1 -1
- package/dist/esm/chunks/{chunk.5ADUSMC7.js → chunk.2W23MOPP.js} +2 -2
- package/dist/esm/chunks/{chunk.XATVDHDW.js → chunk.32APLNN2.js} +2 -2
- package/dist/esm/chunks/{chunk.ISLJNJEE.js → chunk.3II7OT2I.js} +2 -2
- package/dist/esm/chunks/{chunk.ISLJNJEE.js.map → chunk.3II7OT2I.js.map} +1 -1
- package/dist/esm/chunks/{chunk.24SQJBSQ.js → chunk.5QIWLZG3.js} +2 -2
- package/dist/esm/chunks/{chunk.6E5WHIPF.js → chunk.7RLY2O3H.js} +2 -2
- package/dist/esm/chunks/{chunk.6E5WHIPF.js.map → chunk.7RLY2O3H.js.map} +2 -2
- package/dist/esm/chunks/{chunk.Q7TBWGKN.js → chunk.AIJK3CTV.js} +2 -2
- package/dist/esm/chunks/{chunk.3IUQ4C47.js → chunk.CLYGTLXN.js} +2 -2
- package/dist/esm/chunks/chunk.GRYO5XP2.js +7 -0
- package/dist/esm/chunks/{chunk.PFIIBXTS.js.map → chunk.GRYO5XP2.js.map} +2 -2
- package/dist/esm/chunks/{chunk.LSMHIVX2.js → chunk.HD2SLIL2.js} +2 -2
- package/dist/esm/chunks/{chunk.EUJBIOGT.js → chunk.KCCW4AMU.js} +2 -2
- package/dist/esm/chunks/{chunk.JE5LSPXG.js → chunk.LY2Z2Z7S.js} +2 -2
- package/dist/esm/chunks/{chunk.RFT3BAJ2.js → chunk.MFS7AVW6.js} +2 -2
- package/dist/esm/chunks/{chunk.5A665C5E.js → chunk.OJ7JO4O6.js} +2 -2
- package/dist/esm/chunks/{chunk.DZJ6HBAG.js → chunk.OQHDHS2C.js} +2 -2
- package/dist/esm/chunks/{chunk.E2BE52ME.js → chunk.OREDK5MJ.js} +2 -2
- package/dist/esm/chunks/{chunk.RONMNRSH.js → chunk.SZOZIJZI.js} +2 -2
- package/dist/esm/chunks/{chunk.KTPEFU7V.js → chunk.TSSZQPLE.js} +2 -2
- package/dist/esm/chunks/chunk.V6KUOCAR.js +7 -0
- package/dist/esm/chunks/chunk.V6KUOCAR.js.map +7 -0
- package/dist/esm/chunks/{chunk.XTJGWT5F.js → chunk.VJZ7VDG5.js} +2 -2
- package/dist/esm/chunks/{chunk.EHVCEEV2.js → chunk.VL5RWSAV.js} +2 -2
- package/dist/esm/chunks/{chunk.W6FT6MKN.js → chunk.X77NKT6Z.js} +2 -2
- package/dist/esm/chunks/{chunk.A2NB7CIK.js → chunk.XZ23XHFE.js} +2 -2
- package/dist/esm/date-picker/index.js +1 -1
- package/dist/esm/date-range-picker/index.js +1 -1
- package/dist/esm/field/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/label/index.js +1 -1
- package/dist/esm/paginator/index.js +1 -1
- package/dist/esm/quantity-field/index.js +1 -1
- package/dist/esm/radio/index.js +1 -1
- package/dist/esm/radio/radio/index.js +1 -1
- package/dist/esm/radio/radio-group/index.js +1 -1
- package/dist/esm/select/index.js +1 -1
- package/dist/esm/select/select/index.js +1 -1
- package/dist/esm/split-view/index.js +1 -1
- package/dist/esm/split-view/split-view/index.js +1 -1
- package/dist/esm/split-view/split-view-panel/index.js +1 -1
- package/dist/esm/switch/index.js +1 -1
- package/dist/esm/table/index.js +1 -1
- package/dist/esm/text-field/index.js +1 -1
- package/dist/esm/time-picker/index.js +1 -1
- package/esm/checkbox/checkbox.js +1 -1
- package/esm/radio/radio/radio.js +1 -1
- package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
- package/esm/switch/switch.js +1 -1
- package/package.json +1 -1
- package/styles/core/styles/tokens/checkbox/_tokens.scss +1 -1
- package/styles/core/styles/tokens/radio/_tokens.scss +1 -1
- package/styles/core/styles/tokens/switch/_tokens.scss +1 -1
- package/dist/esm/chunks/chunk.LGSCBWNR.js +0 -7
- package/dist/esm/chunks/chunk.LGSCBWNR.js.map +0 -7
- package/dist/esm/chunks/chunk.PFIIBXTS.js +0 -7
- /package/dist/esm/chunks/{chunk.5ADUSMC7.js.map → chunk.2W23MOPP.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.XATVDHDW.js.map → chunk.32APLNN2.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.24SQJBSQ.js.map → chunk.5QIWLZG3.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.Q7TBWGKN.js.map → chunk.AIJK3CTV.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.3IUQ4C47.js.map → chunk.CLYGTLXN.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.LSMHIVX2.js.map → chunk.HD2SLIL2.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.EUJBIOGT.js.map → chunk.KCCW4AMU.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.JE5LSPXG.js.map → chunk.LY2Z2Z7S.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.RFT3BAJ2.js.map → chunk.MFS7AVW6.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.5A665C5E.js.map → chunk.OJ7JO4O6.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.DZJ6HBAG.js.map → chunk.OQHDHS2C.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.E2BE52ME.js.map → chunk.OREDK5MJ.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.RONMNRSH.js.map → chunk.SZOZIJZI.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.KTPEFU7V.js.map → chunk.TSSZQPLE.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.XTJGWT5F.js.map → chunk.VJZ7VDG5.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.EHVCEEV2.js.map → chunk.VL5RWSAV.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.W6FT6MKN.js.map → chunk.X77NKT6Z.js.map} +0 -0
- /package/dist/esm/chunks/{chunk.A2NB7CIK.js.map → chunk.XZ23XHFE.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/radio/core/radio-group-manager.ts", "../../src/radio/radio/radio-constants.ts", "../../src/radio/radio/radio-adapter.ts", "../../src/radio/radio/radio-foundation.ts", "../../src/radio/radio/radio.ts", "../../src/radio/radio/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { getValidationMessage, internals, isFocusable } from '../../constants';\nimport { task } from '../../core/utils/event-utils';\nimport { IRadioComponent, RADIO_CONSTANTS, tryCheck } from '../radio';\n\n/**\n * A class for coordinating the states of radio components within a radio group.\n */\nexport class RadioGroupManager {\n private static _radiosRequestingReset = new WeakSet<IRadioComponent>();\n\n /**\n * Returns an array of IRadioComponents that belong to the same radio group as the given\n * IRadioComponent.\n * If the given IRadioComponent does not have an associated form element, it searches the root\n * node for all IRadioComponents with the same name.\n * If the given IRadioComponent has an associated form element, it gets all RadioComponents with\n * the same name from the form element.\n * \n * @param el - The IRadioComponent to get the radio group for.\n * @param rootNode - The node to search for radios.\n * @param form - The form element to get radios from.\n * @returns An array of IRadioComponents that belong to the same radio group as the given\n * IRadioComponent.\n */\n public static getRadioGroup(el: IRadioComponent, {\n rootNode,\n form\n }: {\n rootNode?: ShadowRoot | Document;\n form?: HTMLFormElement;\n } = {}): IRadioComponent[] {\n // If there's no name, it's not part of a radio group\n if (!el.name) {\n return [el];\n }\n\n // If there's no associated form element search the root node\n if (!el.form && !form) {\n const root = rootNode ?? el.getRootNode() as ShadowRoot | Document;\n const namedRadios = root.querySelectorAll<IRadioComponent>(`${RADIO_CONSTANTS.elementName}[name=${el.name}]`);\n return Array.from(namedRadios).filter(radio => !radio.form);\n }\n\n // When there is a form element, get all RadioComponents with the same name\n const formRadios = ((el.form ?? form) as HTMLFormElement).elements.namedItem(el.name);\n if (formRadios && Object.prototype.isPrototypeOf.call(RadioNodeList.prototype, formRadios)) {\n return Array.from(formRadios as RadioNodeList)\n .filter((radio: HTMLElement) => radio.matches(RADIO_CONSTANTS.elementName)) as IRadioComponent[];\n }\n return [el];\n }\n\n /**\n * Sets the validity of a radio group.\n * If no radio is selected in the group and selection is required, it sets the validity to\n * `valueMissing`.\n * \n * @param el A radio component within the group to set the validity for.\n */\n public static setRadioGroupValidity(el: IRadioComponent): void {\n const group = RadioGroupManager.getRadioGroup(el);\n const invalid = RadioGroupManager._selectionIsRequired(group);\n \n group.forEach(radio => {\n if (!radio.shadowRoot) {\n return;\n }\n\n const validationMessage = radio[getValidationMessage]({\n required: invalid,\n checked: radio.checked\n });\n radio[internals].setValidity({ valueMissing: invalid }, validationMessage);\n });\n }\n\n /**\n * Sets the selected radio in a radio group.\n * \n * @param el - The radio component to set as selected.\n */\n public static setSelectedRadioInGroup(el: IRadioComponent): void {\n const group = RadioGroupManager.getRadioGroup(el);\n group.forEach(radio => radio.checked = radio === el);\n }\n\n /**\n * Sets the tabindices of radios in a radio group based on the currently checked radio.\n * @param el - A radio component within the group to update the tab indices for.\n * @param ignoreSelf - Whether to ignore the passed radio component when updating the tab indices.\n * @param rootNode - The node to search for radios.\n * @param form - The form element to get radios from.\n */\n public static syncRadioFocusableState(el: IRadioComponent, {\n ignoreSelf,\n rootNode,\n form\n }: {\n ignoreSelf: boolean;\n rootNode?: ShadowRoot | Document;\n form?: HTMLFormElement;\n } = { ignoreSelf: false }): void {\n let group = RadioGroupManager.getRadioGroup(el, { rootNode, form });\n group = group.filter(radio => (ignoreSelf && radio !== el) || radio.shadowRoot);\n\n if (!group.some(radio => radio.checked)) {\n group.forEach(radio => radio[isFocusable] = !radio.disabled);\n return;\n }\n group.forEach(radio => radio[isFocusable] = radio.checked && !radio.disabled);\n }\n\n /**\n * Focuses the next radio in the radio group.\n * \n * @param el - The currently focused radio component.\n */\n public static focusNextRadioInGroup(el: IRadioComponent): void {\n RadioGroupManager._updateRadioGroupFocus(el, 1);\n }\n\n /**\n * Focuses the previous radio in the radio group.\n * \n * @param el - The currently focused radio component.\n */\n public static focusPreviousRadioInGroup(el: IRadioComponent): void {\n RadioGroupManager._updateRadioGroupFocus(el, -1);\n }\n\n /**\n * Adds or removes each radio in a radio group from the tab order. When no radio is selected and\n * focus is not in the group, all radios are added to the tab order. Otherwise only the selected\n * radio is added to the tab order.\n * \n * @param el - The focused or blurred radio component.\n * @param event - The event type (`'focus'` or `'blur'`).\n */\n public static setUncheckedRadioGroupFocus(el: IRadioComponent, event: 'focus' | 'blur'): void {\n const group = RadioGroupManager.getRadioGroup(el);\n \n if (event === 'focus') {\n group.forEach(radio => radio[isFocusable] = radio === el);\n return;\n }\n\n if (!el.checked || group[0] === el || group[group.length - 1] === el) {\n group.forEach(radio => radio[isFocusable] = true);\n }\n }\n\n /**\n * Resets a radio group to . This will run once each radio has a chance to\n * update.\n * \n * @param el - The radio component requesting the reset.\n * @returns A promise that resolves when the reset logic is complete.\n */\n public static async requestRadioGroupReset(el: IRadioComponent): Promise<void> {\n this._radiosRequestingReset.add(el);\n\n // Wait for any other radios in the group to request a reset. The reset logic should only run\n // once per group\n await task();\n\n // If the radio has been removed from the set, its group has already been reset and we can\n // skip it\n if (!this._radiosRequestingReset.has(el)) {\n return;\n }\n \n const group = RadioGroupManager.getRadioGroup(el);\n let checkedRadio: IRadioComponent | null = null;\n\n // The first loop removes each radio in the group from the set and stores the radio that should\n // be checked, if any\n group.forEach(radio => {\n this._radiosRequestingReset.delete(radio);\n \n if (radio.defaultChecked) {\n checkedRadio = radio;\n }\n });\n\n // The second loop sets the checked radio and sets each radio to be focusable if there is a no\n // selection, or only the selected radio if there is\n group.forEach(radio => {\n radio.checked = radio === checkedRadio;\n radio[isFocusable] = !checkedRadio || radio.checked;\n });\n }\n\n /**\n * Updates the focus and selection of a radio group based on the currently focused radio and the\n * direction of the focus change.\n * \n * @param el - The currently focused radio element.\n * @param increment - The direction of the focus change. 1 for forward, -1 for backward.\n */\n private static _updateRadioGroupFocus(el: IRadioComponent, increment: 1 | -1): void {\n const group = RadioGroupManager.getRadioGroup(el);\n\n // Get the next enabled and writable radio in the group\n let index = group.indexOf(el);\n let nextRadio = group[index];\n do {\n index += increment;\n if (index < 0) {\n index = group.length - 1;\n } else if (index >= group.length) {\n index = 0;\n }\n\n nextRadio = group[index];\n if (nextRadio === el) {\n return;\n }\n } while (nextRadio.disabled || nextRadio.readonly);\n\n // Attempt to check the next radio, return if the event is cancelled\n if (!nextRadio[tryCheck]()) {\n return;\n }\n\n // Add the next radio to the tab order, and focus it\n nextRadio[isFocusable] = true;\n nextRadio.focus();\n\n // Remove every other radio from the tab order and deselect it\n group.forEach(radio => {\n if (radio === nextRadio) {\n return;\n }\n radio[isFocusable] = false;\n radio.checked = false;\n });\n }\n\n /**\n * Determines if a radio selection is required within a group.\n * \n * @param group - The radio components within a group.\n * @returns True if the radio selection is required, false otherwise.\n */\n private static _selectionIsRequired(group: IRadioComponent[]): boolean {\n let required = false;\n let selection = false;\n\n group.forEach(radio => {\n if (radio.required) {\n required = true;\n }\n if (radio.checked) {\n selection = true;\n }\n });\n\n return required && !selection;\n }\n}\n", "import { COMPONENT_NAME_PREFIX } from '../../constants';\n\nconst elementName: keyof HTMLElementTagNameMap = `${COMPONENT_NAME_PREFIX}radio`;\n\nconst observedAttributes = {\n CHECKED: 'checked',\n DEFAULT_CHECKED: 'default-checked',\n VALUE: 'value',\n DENSE: 'dense',\n DISABLED: 'disabled',\n REQUIRED: 'required',\n READONLY: 'readonly',\n LABEL_POSITION: 'label-position',\n TABINDEX: 'tabindex'\n};\n\nconst attributes = {\n ...observedAttributes\n};\n\nconst selectors = {\n ROOT: '.forge-radio',\n LABEL: '#label',\n STATE_LAYER: 'forge-state-layer'\n};\n\nconst events = {\n CHANGE: 'change',\n INPUT: 'input'\n};\n\nexport const RADIO_CONSTANTS = {\n elementName,\n observedAttributes,\n attributes,\n selectors,\n events\n};\n\n/**\n * This symbol is used to attempt to check a radio while navigating between its siblings in a\n * group. It differs from simply setting `checked` in that it causes the input/change events to\n * emit and returns `false` if either was prevented. The radio group manager can then prevent a\n * change in focus and selection state.\n */\nexport const tryCheck = Symbol('tryCheck');\n\nexport type RadioState = 'checked' | 'unchecked';\nexport type RadioLabelPosition = 'start' | 'end';\n", "import { getShadowElement } from '@tylertech/forge-core';\nimport { internals, setDefaultAria } from '../../constants';\nimport { BaseAdapter, IBaseAdapter } from '../../core/base/';\nimport { StateLayerComponent } from '../../state-layer';\nimport { RadioGroupManager } from '../core/radio-group-manager';\nimport { IRadioComponent } from './radio';\nimport { RadioLabelPosition, RadioState, RADIO_CONSTANTS } from './radio-constants';\n\nexport interface IRadioAdapter extends IBaseAdapter {\n setChecked(checked: boolean, value: string): void;\n trySetDisabled(value: boolean): boolean;\n setRequired(value: boolean): void;\n setReadonly(value: boolean): void;\n setLabelPosition(value: RadioLabelPosition): void;\n disableStateLayer(value: boolean): void;\n setUncheckedRadioGroupFocus(event: 'focus' | 'blur'): void;\n focusNext(): void;\n focusPrevious(): void;\n}\n\nexport class RadioAdapter extends BaseAdapter<IRadioComponent> implements IRadioAdapter {\n private readonly _rootElement: HTMLElement;\n private readonly _labelElement: HTMLElement;\n private readonly _stateLayerElement: StateLayerComponent;\n\n constructor(component: IRadioComponent) {\n super(component);\n\n this._rootElement = getShadowElement(component, RADIO_CONSTANTS.selectors.ROOT);\n this._labelElement = getShadowElement(component, RADIO_CONSTANTS.selectors.LABEL);\n this._stateLayerElement = getShadowElement(component, RADIO_CONSTANTS.selectors.STATE_LAYER) as StateLayerComponent;\n }\n\n public setChecked(checked: boolean, value: string): void {\n this._component[setDefaultAria]({ ariaChecked: checked ? 'true' : 'false' });\n if (checked) {\n RadioGroupManager.setSelectedRadioInGroup(this._component);\n }\n\n // Update tab indices\n RadioGroupManager.syncRadioFocusableState(this._component);\n\n // Update the form value, state, and validity\n const formValue = checked ? value : null;\n const formState: RadioState = checked ? 'checked' : 'unchecked';\n this._component[internals].setFormValue(formValue, formState);\n RadioGroupManager.setRadioGroupValidity(this._component);\n }\n\n /**\n * Attempts to set the disabled state of the radio. If the radio is in a disabled radio group, it\n * can't be enabled.\n * \n * @param value Whether the radio should be disabled.\n * @returns Whether the disabled state was set.\n */\n public trySetDisabled(value: boolean): boolean {\n const group = this._component.closest('forge-radio-group');\n\n if (!value && group && group.disabled) {\n return false;\n }\n\n this._component[setDefaultAria]({ ariaDisabled: `${!!value}` });\n RadioGroupManager.syncRadioFocusableState(this._component);\n return true;\n }\n\n public setRequired(value: boolean): void {\n this._component[setDefaultAria]({\n ariaRequired: value ? 'true' : 'false'\n }, { setAttribute: true });\n RadioGroupManager.setRadioGroupValidity(this._component);\n }\n\n public setReadonly(value: boolean): void {\n this._component[setDefaultAria]({ ariaDisabled: `${!!value}` });\n }\n\n public disableStateLayer(value: boolean): void {\n this._stateLayerElement.disabled = value;\n }\n\n public setLabelPosition(value: RadioLabelPosition): void {\n this._labelElement.remove();\n\n if (value === 'start') {\n this._rootElement.prepend(this._labelElement);\n } else {\n this._rootElement.append(this._labelElement);\n }\n }\n\n public setUncheckedRadioGroupFocus(event: 'focus' | 'blur'): void {\n RadioGroupManager.setUncheckedRadioGroupFocus(this._component, event);\n }\n\n public focusNext(): void {\n RadioGroupManager.focusNextRadioInGroup(this._component);\n }\n\n public focusPrevious(): void {\n RadioGroupManager.focusPreviousRadioInGroup(this._component);\n }\n}\n", "import { ICustomElementFoundation } from '@tylertech/forge-core';\nimport { task } from '../../core/utils/event-utils';\nimport { IRadioAdapter } from './radio-adapter';\nimport { RadioLabelPosition, RADIO_CONSTANTS } from './radio-constants';\n\nexport interface IRadioFoundation extends ICustomElementFoundation {\n checked: boolean;\n defaultChecked: boolean;\n value: string;\n disabled: boolean;\n required: boolean;\n readonly: boolean;\n dense: boolean;\n labelPosition: RadioLabelPosition;\n tryCheck(): boolean;\n}\n\nexport class RadioFoundation implements IRadioFoundation {\n // State\n private _checked = false;\n private _defaultChecked = false;\n private _value = 'on';\n private _disabled = false;\n private _required = false;\n private _readonly = false;\n private _dense = false;\n private _labelPosition: RadioLabelPosition = 'end';\n\n // Listeners\n private readonly _focusListener: EventListener;\n private readonly _blurListener: EventListener;\n private readonly _clickListener: EventListener;\n private readonly _keydownListener: EventListener;\n private readonly _keyupListener: EventListener;\n\n constructor(private _adapter: IRadioAdapter) {\n this._focusListener = () => this._handleFocus();\n this._blurListener = () => this._handleBlur();\n this._clickListener = (evt: MouseEvent) => this._handleClick(evt);\n this._keydownListener = (evt: KeyboardEvent) => this._handleKeydown(evt);\n this._keyupListener = (evt: KeyboardEvent) => this._handleKeyup(evt);\n }\n\n public initialize(): void {\n this._adapter.addHostListener('focus', this._focusListener);\n this._adapter.addHostListener('blur', this._blurListener);\n this._adapter.addHostListener('click', this._clickListener);\n this._adapter.addHostListener('keydown', this._keydownListener);\n this._adapter.addHostListener('keyup', this._keyupListener);\n this._adapter.setChecked(this._checked, this._value);\n }\n\n // Public methods\n\n public tryCheck(): boolean {\n this._checked = true;\n\n if (!this._dispatchEvents()) {\n this._checked = false;\n return false;\n }\n \n this._adapter.setChecked(this._checked, this._value);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.CHECKED, this._checked);\n return true;\n }\n\n // Event handlers\n\n private _handleFocus(): void {\n if (!this._checked) {\n this._adapter.setUncheckedRadioGroupFocus('focus');\n }\n }\n\n private _handleBlur(): void {\n if (!this._checked) {\n this._adapter.setUncheckedRadioGroupFocus('blur');\n }\n }\n\n private _handleClick(evt: MouseEvent): void {\n this._activate(evt);\n }\n\n private _handleKeydown(evt: KeyboardEvent): void {\n switch (evt.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n evt.preventDefault();\n this._adapter.focusNext();\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n evt.preventDefault();\n this._adapter.focusPrevious();\n break;\n case ' ':\n // Prevent the spacebar from scrolling the page\n evt.preventDefault();\n break;\n }\n }\n\n private _handleKeyup(evt: KeyboardEvent): void {\n if (evt.key === ' ') {\n this._activate(evt);\n }\n }\n\n /**\n * Checks the radio button if it is not disabled or readonly. Exits early if the activating\n * event is cancelled.\n */\n private async _activate(evt: Event): Promise<void> {\n if (this._checked || this._disabled || this._readonly) {\n return;\n }\n\n // Wait a task to allow the event to propagate to user code.\n await task();\n if (evt.defaultPrevented) {\n return;\n }\n\n this._checked = true;\n\n if (!this._dispatchEvents()) {\n this._checked = false;\n return;\n }\n\n this._adapter.setChecked(this._checked, this._value);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.CHECKED, this._checked);\n }\n\n /**\n * Dispatches change and input events.\n * \n * @returns {boolean} - Returns true if neither event was cancelled.\n */\n private _dispatchEvents(): boolean {\n // Emit both change and input events per the spec.\n const changeEvent = new Event(RADIO_CONSTANTS.events.CHANGE, { bubbles: true, cancelable: true });\n const inputEvent = new Event(RADIO_CONSTANTS.events.INPUT, { bubbles: true, cancelable: true, composed: true });\n this._adapter.dispatchHostEvent(changeEvent);\n this._adapter.dispatchHostEvent(inputEvent);\n return !(changeEvent.defaultPrevented || inputEvent.defaultPrevented);\n }\n\n public get checked(): boolean {\n return this._checked;\n }\n public set checked(value: boolean) {\n if (this._checked !== value) {\n this._checked = value;\n this._adapter.setChecked(this._checked, this._value);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.CHECKED, this._checked);\n }\n }\n\n public get defaultChecked(): boolean {\n return this._defaultChecked;\n }\n public set defaultChecked(value: boolean) {\n if (this._defaultChecked !== value) {\n this._defaultChecked = value;\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.DEFAULT_CHECKED, this._defaultChecked);\n }\n }\n\n public get value(): string {\n return this._value;\n }\n public set value(value: string) {\n if (this._value !== value) {\n this._value = value;\n this._adapter.setHostAttribute(RADIO_CONSTANTS.attributes.VALUE, this._value);\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n public set disabled(value: boolean) {\n if (this._disabled !== value) {\n this._disabled = value;\n // Attempt to set disabled, restore if unsuccessful\n if (this._adapter.trySetDisabled(this._disabled)) {\n this._adapter.disableStateLayer(this._disabled || this._readonly);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.DISABLED, this._disabled);\n } else {\n this._disabled = !this._disabled;\n }\n }\n }\n\n public get required(): boolean {\n return this._required;\n }\n public set required(value: boolean) {\n if (this._required !== value) {\n this._required = value;\n this._adapter.setRequired(this._required);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.REQUIRED, this._required);\n }\n }\n\n public get readonly(): boolean {\n return this._readonly;\n }\n public set readonly(value: boolean) {\n if (this._readonly !== value) {\n this._readonly = value;\n this._adapter.setReadonly(this._readonly);\n this._adapter.disableStateLayer(this._disabled || this._readonly);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.READONLY, this._readonly);\n }\n }\n\n public get dense(): boolean {\n return this._dense;\n }\n public set dense(value: boolean) {\n if (this._dense !== value) {\n this._dense = value;\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.DENSE, this._dense);\n }\n }\n\n public get labelPosition(): RadioLabelPosition {\n return this._labelPosition;\n }\n public set labelPosition(value: RadioLabelPosition) {\n if (this._labelPosition !== value) {\n this._labelPosition = value;\n this._adapter.setLabelPosition(this._labelPosition);\n this._adapter.setHostAttribute(RADIO_CONSTANTS.attributes.LABEL_POSITION, this._labelPosition);\n }\n }\n}\n", "import { attachShadowTemplate, coerceBoolean, CustomElement, FoundationProperty } from '@tylertech/forge-core';\nimport { getFormState, getFormValue, inputType, setDefaultAria } from '../../constants';\nimport { BaseComponent } from '../../core/base/base-component';\nimport { IWithFocusable, WithFocusable } from '../../core/mixins/focus/with-focusable';\nimport { IWithFormAssociation, WithFormAssociation } from '../../core/mixins/form/with-form-associated';\nimport { IWithDefaultAria, WithDefaultAria } from '../../core/mixins/internals/with-default-aria';\nimport { IWithElementInternals, WithElementInternals } from '../../core/mixins/internals/with-element-internals';\nimport { IWithLabelAwareness, WithLabelAwareness } from '../../core/mixins/label/with-label-aware';\nimport { FormValue } from '../../core/utils/form-utils';\nimport { FocusIndicatorComponent } from '../../focus-indicator';\nimport { StateLayerComponent } from '../../state-layer';\nimport { RadioGroupManager } from '../core/radio-group-manager';\nimport { RadioAdapter } from './radio-adapter';\nimport { RadioLabelPosition, RadioState, RADIO_CONSTANTS, tryCheck } from './radio-constants';\nimport { RadioFoundation } from './radio-foundation';\n\nconst template = '<template><div id=\\\"radio\\\" class=\\\"forge-radio\\\" part=\\\"root\\\"><div id=\\\"container\\\" class=\\\"container\\\" aria-hidden=\\\"true\\\"><div id=\\\"background\\\" class=\\\"background\\\" part=\\\"background\\\"></div><forge-focus-indicator target=\\\":host\\\" part=\\\"focus-indicator\\\"></forge-focus-indicator><forge-state-layer exportparts=\\\"surface:state-layer\\\"></forge-state-layer></div><span id=\\\"label\\\" class=\\\"label\\\" for=\\\"input\\\" part=\\\"label\\\"><slot></slot></span></div></template>';\nconst styles = ':host{display:inline-block;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}:host(:focus){outline:0}.forge-radio{--_radio-primary-color:var(--forge-radio-primary-color, var(--forge-theme-tertiary, #3d5afe));--_radio-inactive-color:var(--forge-radio-inactive-color, var(--forge-theme-surface-container-high, #9e9e9e));--_radio-size:var(--forge-radio-size, 20px);--_radio-mark-size:var(--forge-radio-mark-size, 12px);--_radio-state-layer-size:var(--forge-radio-state-layer-size, 40px);--_radio-state-layer-dense-size:var(--forge-radio-state-layer-dense-size, 24px);--_radio-width:var(--forge-radio-width, var(--_radio-size));--_radio-height:var(--forge-radio-height, var(--_radio-size));--_radio-border-width:var(--forge-radio-border-width, var(--forge-border-medium, 2px));--_radio-unchecked-border-color:var(--forge-radio-unchecked-border-color, var(--_radio-inactive-color));--_radio-checked-border-color:var(--forge-radio-checked-border-color, var(--_radio-primary-color));--_radio-background:var(--forge-radio-background, transparent);--_radio-shape:var(--forge-radio-shape, var(--forge-shape-round, 50%));--_radio-mark-width:var(--forge-radio-mark-width, var(--_radio-mark-size));--_radio-mark-height:var(--forge-radio-mark-height, var(--_radio-mark-size));--_radio-mark-unchecked-color:var(--forge-radio-mark-unchecked-color, var(--_radio-inactive-color));--_radio-mark-checked-color:var(--forge-radio-mark-checked-color, var(--_radio-primary-color));--_radio-mark-unchecked-background:var(--forge-radio-mark-unchecked-background, transparent);--_radio-mark-checked-background:var(--forge-radio-mark-checked-background, transparent);--_radio-gap:var(--forge-radio-gap, 0);--_radio-justify:var(--forge-radio-justify, space-between);--_radio-direction:var(--forge-radio-direction, initial);--_radio-state-layer-width:var(--forge-radio-state-layer-width, var(--_radio-state-layer-size));--_radio-state-layer-height:var(--forge-radio-state-layer-height, var(--_radio-state-layer-size));--_radio-state-layer-unchecked-color:var(--forge-radio-state-layer-unchecked-color, var(--_radio-color));--_radio-state-layer-checked-color:var(--forge-radio-state-layer-checked-color, var(--_radio-primary-color));--_radio-state-layer-shape:var(--forge-radio-state-layer-shape, var(--_radio-shape));--_radio-state-layer-dense-width:var(--forge-radio-state-layer-dense-width, var(--_radio-state-layer-dense-size));--_radio-state-layer-dense-height:var(--forge-radio-state-layer-dense-height, var(--_radio-state-layer-dense-size));--_radio-disabled-opacity:var(--forge-radio-disabled-opacity, 0.38);--_radio-animation-duration:var(--forge-radio-animation-duration, var(--forge-animation-duration-short4, 200ms));--_radio-animation-timing-function:var(--forge-radio-animation-timing-function, var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1)));--_radio-animation-delay:var(--forge-radio-animation-delay, 0ms)}.forge-radio{position:relative;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:var(--_radio-direction);flex-shrink:0;-webkit-box-align:center;align-items:center;-webkit-box-pack:var(--_radio-justify);justify-content:var(--_radio-justify);gap:var(--_radio-gap);display:-webkit-box;display:flex}.forge-radio .container{position:relative;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;display:-webkit-box;display:flex;border-radius:var(--_radio-shape);inline-size:var(--_radio-state-layer-width);block-size:var(--_radio-state-layer-height);cursor:pointer}.forge-radio .background{position:relative;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;display:-webkit-box;display:flex;overflow:hidden;-webkit-transition-duration:var(--_radio-animation-duration);transition-duration:var(--_radio-animation-duration);-webkit-transition-delay:var(--_radio-animation-delay);transition-delay:var(--_radio-animation-delay);-webkit-transition-timing-function:var(--_radio-animation-timing-function);transition-timing-function:var(--_radio-animation-timing-function);-webkit-transition-property:border-color;transition-property:border-color;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:var(--_radio-shape);border-width:var(--_radio-border-width);border-style:solid;border-color:var(--_radio-unchecked-border-color);inline-size:var(--_radio-width);block-size:var(--_radio-height);background:var(--_radio-background)}.forge-radio .background::after{content:\\\"\\\";position:absolute;contain:strict;-webkit-transition-duration:var(--_radio-animation-duration);transition-duration:var(--_radio-animation-duration);-webkit-transition-delay:var(--_radio-animation-delay);transition-delay:var(--_radio-animation-delay);-webkit-transition-timing-function:var(--_radio-animation-timing-function);transition-timing-function:var(--_radio-animation-timing-function);-webkit-transition-property:inline-size,block-size,border-color;transition-property:inline-size,block-size,border-color;border-radius:var(--_radio-shape);border-width:calc(var(--_radio-mark-height)/ 2) calc(var(--_radio-mark-width)/ 2);border-color:var(--_radio-mark-unchecked-color);border-style:solid;inline-size:calc(var(--_radio-width) - 2 * var(--_radio-border-width));block-size:calc(var(--_radio-height) - 2 * var(--_radio-border-width));background:var(--_radio-mark-unchecked-background)}.forge-radio .label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label1-font-family, var(--forge-typography-font-family, \\\"Roboto\\\", sans-serif));font-size:var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .75)));font-weight:var(--forge-typography-label1-font-weight,400);line-height:var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label1-letter-spacing, .0357142857em);text-transform:var(--forge-typography-label1-text-transform,inherit);-webkit-text-decoration:var(--forge-typography-label1-text-decoration,inherit);text-decoration:var(--forge-typography-label1-text-decoration,inherit);cursor:default}.forge-radio .label:empty{display:none}:host([checked]) .forge-radio .background{border-color:var(--_radio-checked-border-color)}:host([checked]) .forge-radio .background::after{border-color:var(--_radio-mark-checked-color);inline-size:0px;block-size:0px;background:var(--_radio-mark-checked-background)}:host([checked]) forge-state-layer{--forge-state-layer-color:var(--_radio-state-layer-checked-color)}:host([dense]) .forge-radio .container{inline-size:var(--_radio-state-layer-dense-width);block-size:var(--_radio-state-layer-dense-height)}:host([disabled]) .forge-radio{opacity:var(--_radio-disabled-opacity)}:host([disabled]) .forge-radio .container{cursor:not-allowed}:host([readonly]) .forge-radio .container{cursor:not-allowed}forge-focus-indicator{--forge-focus-indicator-color:var(--_radio-primary-color);--forge-focus-indicator-outward-offset:0px;--forge-focus-indicator-shape:var(--_radio-state-layer-shape)}forge-state-layer{--forge-state-layer-color:var(--_radio-state-layer-unchecked-color)}';\n\nexport interface IRadioComponent extends IWithFormAssociation, IWithFocusable, IWithLabelAwareness, IWithElementInternals, IWithDefaultAria {\n checked: boolean;\n defaultChecked: boolean;\n value: string;\n required: boolean;\n dense: boolean;\n labelPosition: RadioLabelPosition;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'forge-radio': IRadioComponent;\n }\n}\n\nconst BaseRadioClass = WithFormAssociation(WithLabelAwareness(WithFocusable(WithDefaultAria(WithElementInternals(BaseComponent)))));\n\n/**\n * @tag forge-radio\n * \n * @summary The Forge Radio component is used to create a form input where only one out of a set of\n * values should be selected.\n * \n * @property {boolean} checked - Indicates whether the radio button is checked.\n * @property {boolean} defaultChecked - Indicates whether the radio button is checked by default.\n * @property {string} value - The value of the radio button when submitted.\n * @property {boolean} dense - Indicates whether the radio button should be displayed in a dense layout.\n * @property {boolean} disabled - Indicates whether the radio button is disabled.\n * @property {boolean} required - Indicates whether the radio button is required.\n * @property {boolean} readonly - Indicates whether the radio button is read-only.\n * @property {RadioLabelPosition} labelPosition - The position of the radio button's label.\n * \n * @attribute {boolean} checked - Indicates whether the radio button is checked.\n * @attribute {boolean} default-checked - Indicates whether the radio button is checked by default.\n * @attribute {string} value - The value of the radio button when submitted.\n * @attribute {boolean} dense - Indicates whether the radio button should be displayed in a dense layout.\n * @attribute {boolean} disabled - Indicates whether the radio button is disabled.\n * @attribute {boolean} required - Indicates whether the radio button is required.\n * @attribute {boolean} readonly - Indicates whether the radio button is read-only.\n * @attribute {RadioLabelPosition} label-position - The position of the radio button's label.\n * \n * @cssproperty --forge-radio-primary-color - The primary color of the radio button when checked.\n * @cssproperty --forge-radio-inactive-color - The color of the radio button when unchecked.\n * @cssproperty --forge-radio-size - The size of the radio button in the inline and block directions.\n * @cssproperty --forge-radio-width - The width of the radio button.\n * @cssproperty --forge-radio-height - The height of the radio button.\n * @cssproperty --forge-radio-border-width - The width of the radio button's border.\n * @cssproperty --forge-radio-unchecked-border-color - The color of the radio button's border when unchecked.\n * @cssproperty --forge-radio-checked-border-color - The color of the radio button's border when checked.\n * @cssproperty --forge-radio-background - The background of the radio button.\n * @cssproperty --forge-radio-shape - The shape of the radio button.\n * @cssproperty --forge-radio-mark-size - The size of the radio button's mark in the inline and block directions.\n * @cssproperty --forge-radio-mark-width - The width of the radio button's mark.\n * @cssproperty --forge-radio-mark-height - The height of the radio button's mark.\n * @cssproperty --forge-radio-mark-unchecked-color - The color of the radio button's mark when unchecked.\n * @cssproperty --forge-radio-mark-checked-color - The color of the radio button's mark when checked.\n * @cssproperty --forge-radio-mark-unchecked-background - The background of the radio button's mark when unchecked.\n * @cssproperty --forge-radio-mark-checked-background - The background of the radio button's mark when checked.\n * @cssproperty --forge-radio-gap - The gap between the radio button and its label.\n * @cssproperty --forge-radio-justify - The alignment of the radio button and its label in the inline direction.\n * @cssproperty --forge-radio-direction - The direction of the radio button and its label.\n * @cssproperty --forge-radio-state-layer-size - The size of the radio button's state layer in the inline and block directions.\n * @cssproperty --forge-radio-state-layer-width - The width of the radio button's state layer.\n * @cssproperty --forge-radio-state-layer-height - The height of the radio button's state layer.\n * @cssproperty --forge-radio-state-layer-unchecked-color - The color of the radio button's state layer when unchecked.\n * @cssproperty --forge-radio-state-layer-checked-color - The color of the radio button's state layer when checked.\n * @cssproperty --forge-radio-state-layer-shape - The shape of the radio button's state layer.\n * @cssproperty --forge-radio-state-layer-dense-size - The size of the radio button's state layer when dense.\n * @cssproperty --forge-radio-state-layer-dense-width - The width of the radio button's state layer when dense.\n * @cssproperty --forge-radio-state-layer-dense-height - The height of the radio button's state layer when dense.\n * @cssproperty --forge-radio-disabled-opacity - The opacity of the radio button when disabled.\n * @cssproperty --forge-radio-animation-duration - The duration of the radio button's animations.\n * @cssproperty --forge-radio-animation-timing-function - The timing function of the radio button's animations.\n * @cssproperty --forge-radio-animation-delay - The delay of the radio button's animations.\n * \n * @csspart root - Styles the radio's root element.\n * @csspart background - Styles the border and background of the radio.\n * @csspart focus-indicator - Styles the focus indicator of the radio.\n * @csspart state-layer - Styles the state layer of the radio.\n * \n * @slot - This is a default/unnamed slot for the label text.\n */\n@CustomElement({\n name: RADIO_CONSTANTS.elementName,\n dependencies: [\n FocusIndicatorComponent,\n StateLayerComponent\n ]\n})\nexport class RadioComponent extends BaseRadioClass implements IRadioComponent {\n public static get observedAttributes(): string[] {\n return Object.values(RADIO_CONSTANTS.observedAttributes);\n }\n\n private _foundation: RadioFoundation;\n\n // Used to communicate with the form group after this radio instance has been disconnected\n private _rootNode?: ShadowRoot | Document;\n private _latestAssociatedForm?: HTMLFormElement;\n\n constructor() {\n super();\n attachShadowTemplate(this, template, styles);\n this[inputType] = 'radio';\n this._foundation = new RadioFoundation(new RadioAdapter(this));\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this[setDefaultAria]({\n role: 'radio',\n ariaChecked: this.checked ? 'true' : 'false',\n ariaDisabled: this.disabled ? 'true' : 'false',\n ariaRequired: this.required ? 'true' : 'false'\n });\n RadioGroupManager.syncRadioFocusableState(this);\n this._foundation.initialize();\n this._rootNode = this.getRootNode() as ShadowRoot | Document;\n }\n\n public disconnectedCallback(): void {\n RadioGroupManager.syncRadioFocusableState(this, { ignoreSelf: true, rootNode: this._rootNode, form: this._latestAssociatedForm });\n }\n\n public override attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n switch (name) {\n case RADIO_CONSTANTS.attributes.CHECKED:\n this._foundation.checked = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.DEFAULT_CHECKED:\n this._foundation.defaultChecked = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.VALUE:\n this.value = newValue;\n break;\n case RADIO_CONSTANTS.attributes.DENSE:\n this.dense = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.DISABLED:\n this.disabled = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.REQUIRED:\n this.required = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.READONLY:\n this.readonly = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.LABEL_POSITION:\n this.labelPosition = newValue as RadioLabelPosition;\n break;\n }\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n public override [getFormValue](): FormValue | null {\n return this.checked ? this.value : null;\n }\n\n public override [getFormState](): RadioState {\n return this.checked ? 'checked' : 'unchecked';\n }\n\n public formAssociatedCallback(form: HTMLFormElement | null): void {\n if (form) {\n this._latestAssociatedForm = form;\n }\n }\n\n public formResetCallback(): void {\n RadioGroupManager.requestRadioGroupReset(this);\n }\n\n public formStateRestoreCallback(state: RadioState): void {\n this.checked = state === 'checked';\n }\n\n public labelClickedCallback(): void {\n this.click();\n }\n\n public labelChangedCallback(value: string | null): void {\n this[setDefaultAria]({ ariaLabel: value });\n }\n\n @FoundationProperty()\n public declare checked: boolean;\n\n @FoundationProperty()\n public declare defaultChecked: boolean;\n\n @FoundationProperty()\n public declare value: string;\n\n @FoundationProperty()\n public declare dense: boolean;\n\n @FoundationProperty()\n public declare disabled: boolean;\n\n @FoundationProperty()\n public declare required: boolean;\n\n @FoundationProperty()\n public declare readonly: boolean;\n\n @FoundationProperty()\n public declare labelPosition: RadioLabelPosition;\n\n public [tryCheck](): boolean {\n return this._foundation.tryCheck();\n }\n}\n", "import { defineCustomElement } from '@tylertech/forge-core';\n\nimport { RadioComponent } from './radio';\n\nexport * from './radio-adapter';\nexport * from './radio-constants';\nexport * from './radio-foundation';\nexport * from './radio';\n\nexport function defineRadioComponent(): void {\n defineCustomElement(RadioComponent);\n}\n"],
|
|
5
|
-
"mappings": "8lBAOO,IAAMA,EAAN,MAAMA,CAAkB,CAiB7B,OAAc,cAAcC,EAAqB,CAC/C,SAAAC,EACA,KAAAC,CACF,EAGI,CAAC,EAAsB,CA9B7B,IAAAC,EAgCI,GAAI,CAACH,EAAG,KACN,MAAO,CAACA,CAAE,EAIZ,GAAI,CAACA,EAAG,MAAQ,CAACE,EAAM,CAErB,IAAME,GADOH,GAAA,KAAAA,EAAYD,EAAG,YAAY,GACf,iBAAkC,GAAGK,EAAgB,oBAAoBL,EAAG,OAAO,EAC5G,OAAO,MAAM,KAAKI,CAAW,EAAE,OAAOE,GAAS,CAACA,EAAM,IAAI,EAI5D,IAAMC,IAAeJ,EAAAH,EAAG,OAAH,KAAAG,EAAWD,GAA0B,SAAS,UAAUF,EAAG,IAAI,EACpF,OAAIO,GAAc,OAAO,UAAU,cAAc,KAAK,cAAc,UAAWA,CAAU,EAChF,MAAM,KAAKA,CAA2B,EAC1C,OAAQD,GAAuBA,EAAM,QAAQD,EAAgB,WAAW,CAAC,EAEvE,CAACL,CAAE,CACZ,CASA,OAAc,sBAAsBA,EAA2B,CAC7D,IAAMQ,EAAQT,EAAkB,cAAcC,CAAE,EAC1CS,EAAUV,EAAkB,qBAAqBS,CAAK,EAE5DA,EAAM,QAAQF,GAAS,CACrB,GAAI,CAACA,EAAM,WACT,O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B,OAAO,KAAK,SACd,CACA,IAAW,SAASI,EAAgB,CAC9B,KAAK,YAAcA,IACrB,KAAK,UAAYA,EACjB,KAAK,SAAS,YAAY,KAAK,SAAS,EACxC,KAAK,SAAS,kBAAkB,KAAK,WAAa,KAAK,SAAS,EAChE,KAAK,SAAS,oBAAoBJ,EAAgB,WAAW,SAAU,KAAK,SAAS,EAEzF,CAEA,IAAW,OAAiB,CAC1B,OAAO,KAAK,MACd,CACA,IAAW,MAAMI,EAAgB,CAC3B,KAAK,SAAWA,IAClB,KAAK,OAASA,EACd,KAAK,SAAS,oBAAoBJ,EAAgB,WAAW,MAAO,KAAK,MAAM,EAEnF,CAEA,IAAW,eAAoC,CAC7C,OAAO,KAAK,cACd,CACA,IAAW,cAAcI,EAA2B,CAC9C,KAAK,iBAAmBA,IAC1B,KAAK,eAAiBA,EACtB,KAAK,SAAS,iBAAiB,KAAK,cAAc,EAClD,KAAK,SAAS,iBAAiBJ,EAAgB,WAAW,eAAgB,KAAK,cAAc,EAEjG,CACF,EChOA,IAAMK,EAAW,ubACXC,EAAS,
|
|
4
|
+
"sourcesContent": ["import { getValidationMessage, internals, isFocusable } from '../../constants';\nimport { task } from '../../core/utils/event-utils';\nimport { IRadioComponent, RADIO_CONSTANTS, tryCheck } from '../radio';\n\n/**\n * A class for coordinating the states of radio components within a radio group.\n */\nexport class RadioGroupManager {\n private static _radiosRequestingReset = new WeakSet<IRadioComponent>();\n\n /**\n * Returns an array of IRadioComponents that belong to the same radio group as the given\n * IRadioComponent.\n * If the given IRadioComponent does not have an associated form element, it searches the root\n * node for all IRadioComponents with the same name.\n * If the given IRadioComponent has an associated form element, it gets all RadioComponents with\n * the same name from the form element.\n * \n * @param el - The IRadioComponent to get the radio group for.\n * @param rootNode - The node to search for radios.\n * @param form - The form element to get radios from.\n * @returns An array of IRadioComponents that belong to the same radio group as the given\n * IRadioComponent.\n */\n public static getRadioGroup(el: IRadioComponent, {\n rootNode,\n form\n }: {\n rootNode?: ShadowRoot | Document;\n form?: HTMLFormElement;\n } = {}): IRadioComponent[] {\n // If there's no name, it's not part of a radio group\n if (!el.name) {\n return [el];\n }\n\n // If there's no associated form element search the root node\n if (!el.form && !form) {\n const root = rootNode ?? el.getRootNode() as ShadowRoot | Document;\n const namedRadios = root.querySelectorAll<IRadioComponent>(`${RADIO_CONSTANTS.elementName}[name=${el.name}]`);\n return Array.from(namedRadios).filter(radio => !radio.form);\n }\n\n // When there is a form element, get all RadioComponents with the same name\n const formRadios = ((el.form ?? form) as HTMLFormElement).elements.namedItem(el.name);\n if (formRadios && Object.prototype.isPrototypeOf.call(RadioNodeList.prototype, formRadios)) {\n return Array.from(formRadios as RadioNodeList)\n .filter((radio: HTMLElement) => radio.matches(RADIO_CONSTANTS.elementName)) as IRadioComponent[];\n }\n return [el];\n }\n\n /**\n * Sets the validity of a radio group.\n * If no radio is selected in the group and selection is required, it sets the validity to\n * `valueMissing`.\n * \n * @param el A radio component within the group to set the validity for.\n */\n public static setRadioGroupValidity(el: IRadioComponent): void {\n const group = RadioGroupManager.getRadioGroup(el);\n const invalid = RadioGroupManager._selectionIsRequired(group);\n \n group.forEach(radio => {\n if (!radio.shadowRoot) {\n return;\n }\n\n const validationMessage = radio[getValidationMessage]({\n required: invalid,\n checked: radio.checked\n });\n radio[internals].setValidity({ valueMissing: invalid }, validationMessage);\n });\n }\n\n /**\n * Sets the selected radio in a radio group.\n * \n * @param el - The radio component to set as selected.\n */\n public static setSelectedRadioInGroup(el: IRadioComponent): void {\n const group = RadioGroupManager.getRadioGroup(el);\n group.forEach(radio => radio.checked = radio === el);\n }\n\n /**\n * Sets the tabindices of radios in a radio group based on the currently checked radio.\n * @param el - A radio component within the group to update the tab indices for.\n * @param ignoreSelf - Whether to ignore the passed radio component when updating the tab indices.\n * @param rootNode - The node to search for radios.\n * @param form - The form element to get radios from.\n */\n public static syncRadioFocusableState(el: IRadioComponent, {\n ignoreSelf,\n rootNode,\n form\n }: {\n ignoreSelf: boolean;\n rootNode?: ShadowRoot | Document;\n form?: HTMLFormElement;\n } = { ignoreSelf: false }): void {\n let group = RadioGroupManager.getRadioGroup(el, { rootNode, form });\n group = group.filter(radio => (ignoreSelf && radio !== el) || radio.shadowRoot);\n\n if (!group.some(radio => radio.checked)) {\n group.forEach(radio => radio[isFocusable] = !radio.disabled);\n return;\n }\n group.forEach(radio => radio[isFocusable] = radio.checked && !radio.disabled);\n }\n\n /**\n * Focuses the next radio in the radio group.\n * \n * @param el - The currently focused radio component.\n */\n public static focusNextRadioInGroup(el: IRadioComponent): void {\n RadioGroupManager._updateRadioGroupFocus(el, 1);\n }\n\n /**\n * Focuses the previous radio in the radio group.\n * \n * @param el - The currently focused radio component.\n */\n public static focusPreviousRadioInGroup(el: IRadioComponent): void {\n RadioGroupManager._updateRadioGroupFocus(el, -1);\n }\n\n /**\n * Adds or removes each radio in a radio group from the tab order. When no radio is selected and\n * focus is not in the group, all radios are added to the tab order. Otherwise only the selected\n * radio is added to the tab order.\n * \n * @param el - The focused or blurred radio component.\n * @param event - The event type (`'focus'` or `'blur'`).\n */\n public static setUncheckedRadioGroupFocus(el: IRadioComponent, event: 'focus' | 'blur'): void {\n const group = RadioGroupManager.getRadioGroup(el);\n \n if (event === 'focus') {\n group.forEach(radio => radio[isFocusable] = radio === el);\n return;\n }\n\n if (!el.checked || group[0] === el || group[group.length - 1] === el) {\n group.forEach(radio => radio[isFocusable] = true);\n }\n }\n\n /**\n * Resets a radio group to . This will run once each radio has a chance to\n * update.\n * \n * @param el - The radio component requesting the reset.\n * @returns A promise that resolves when the reset logic is complete.\n */\n public static async requestRadioGroupReset(el: IRadioComponent): Promise<void> {\n this._radiosRequestingReset.add(el);\n\n // Wait for any other radios in the group to request a reset. The reset logic should only run\n // once per group\n await task();\n\n // If the radio has been removed from the set, its group has already been reset and we can\n // skip it\n if (!this._radiosRequestingReset.has(el)) {\n return;\n }\n \n const group = RadioGroupManager.getRadioGroup(el);\n let checkedRadio: IRadioComponent | null = null;\n\n // The first loop removes each radio in the group from the set and stores the radio that should\n // be checked, if any\n group.forEach(radio => {\n this._radiosRequestingReset.delete(radio);\n \n if (radio.defaultChecked) {\n checkedRadio = radio;\n }\n });\n\n // The second loop sets the checked radio and sets each radio to be focusable if there is a no\n // selection, or only the selected radio if there is\n group.forEach(radio => {\n radio.checked = radio === checkedRadio;\n radio[isFocusable] = !checkedRadio || radio.checked;\n });\n }\n\n /**\n * Updates the focus and selection of a radio group based on the currently focused radio and the\n * direction of the focus change.\n * \n * @param el - The currently focused radio element.\n * @param increment - The direction of the focus change. 1 for forward, -1 for backward.\n */\n private static _updateRadioGroupFocus(el: IRadioComponent, increment: 1 | -1): void {\n const group = RadioGroupManager.getRadioGroup(el);\n\n // Get the next enabled and writable radio in the group\n let index = group.indexOf(el);\n let nextRadio = group[index];\n do {\n index += increment;\n if (index < 0) {\n index = group.length - 1;\n } else if (index >= group.length) {\n index = 0;\n }\n\n nextRadio = group[index];\n if (nextRadio === el) {\n return;\n }\n } while (nextRadio.disabled || nextRadio.readonly);\n\n // Attempt to check the next radio, return if the event is cancelled\n if (!nextRadio[tryCheck]()) {\n return;\n }\n\n // Add the next radio to the tab order, and focus it\n nextRadio[isFocusable] = true;\n nextRadio.focus();\n\n // Remove every other radio from the tab order and deselect it\n group.forEach(radio => {\n if (radio === nextRadio) {\n return;\n }\n radio[isFocusable] = false;\n radio.checked = false;\n });\n }\n\n /**\n * Determines if a radio selection is required within a group.\n * \n * @param group - The radio components within a group.\n * @returns True if the radio selection is required, false otherwise.\n */\n private static _selectionIsRequired(group: IRadioComponent[]): boolean {\n let required = false;\n let selection = false;\n\n group.forEach(radio => {\n if (radio.required) {\n required = true;\n }\n if (radio.checked) {\n selection = true;\n }\n });\n\n return required && !selection;\n }\n}\n", "import { COMPONENT_NAME_PREFIX } from '../../constants';\n\nconst elementName: keyof HTMLElementTagNameMap = `${COMPONENT_NAME_PREFIX}radio`;\n\nconst observedAttributes = {\n CHECKED: 'checked',\n DEFAULT_CHECKED: 'default-checked',\n VALUE: 'value',\n DENSE: 'dense',\n DISABLED: 'disabled',\n REQUIRED: 'required',\n READONLY: 'readonly',\n LABEL_POSITION: 'label-position',\n TABINDEX: 'tabindex'\n};\n\nconst attributes = {\n ...observedAttributes\n};\n\nconst selectors = {\n ROOT: '.forge-radio',\n LABEL: '#label',\n STATE_LAYER: 'forge-state-layer'\n};\n\nconst events = {\n CHANGE: 'change',\n INPUT: 'input'\n};\n\nexport const RADIO_CONSTANTS = {\n elementName,\n observedAttributes,\n attributes,\n selectors,\n events\n};\n\n/**\n * This symbol is used to attempt to check a radio while navigating between its siblings in a\n * group. It differs from simply setting `checked` in that it causes the input/change events to\n * emit and returns `false` if either was prevented. The radio group manager can then prevent a\n * change in focus and selection state.\n */\nexport const tryCheck = Symbol('tryCheck');\n\nexport type RadioState = 'checked' | 'unchecked';\nexport type RadioLabelPosition = 'start' | 'end';\n", "import { getShadowElement } from '@tylertech/forge-core';\nimport { internals, setDefaultAria } from '../../constants';\nimport { BaseAdapter, IBaseAdapter } from '../../core/base/';\nimport { StateLayerComponent } from '../../state-layer';\nimport { RadioGroupManager } from '../core/radio-group-manager';\nimport { IRadioComponent } from './radio';\nimport { RadioLabelPosition, RadioState, RADIO_CONSTANTS } from './radio-constants';\n\nexport interface IRadioAdapter extends IBaseAdapter {\n setChecked(checked: boolean, value: string): void;\n trySetDisabled(value: boolean): boolean;\n setRequired(value: boolean): void;\n setReadonly(value: boolean): void;\n setLabelPosition(value: RadioLabelPosition): void;\n disableStateLayer(value: boolean): void;\n setUncheckedRadioGroupFocus(event: 'focus' | 'blur'): void;\n focusNext(): void;\n focusPrevious(): void;\n}\n\nexport class RadioAdapter extends BaseAdapter<IRadioComponent> implements IRadioAdapter {\n private readonly _rootElement: HTMLElement;\n private readonly _labelElement: HTMLElement;\n private readonly _stateLayerElement: StateLayerComponent;\n\n constructor(component: IRadioComponent) {\n super(component);\n\n this._rootElement = getShadowElement(component, RADIO_CONSTANTS.selectors.ROOT);\n this._labelElement = getShadowElement(component, RADIO_CONSTANTS.selectors.LABEL);\n this._stateLayerElement = getShadowElement(component, RADIO_CONSTANTS.selectors.STATE_LAYER) as StateLayerComponent;\n }\n\n public setChecked(checked: boolean, value: string): void {\n this._component[setDefaultAria]({ ariaChecked: checked ? 'true' : 'false' });\n if (checked) {\n RadioGroupManager.setSelectedRadioInGroup(this._component);\n }\n\n // Update tab indices\n RadioGroupManager.syncRadioFocusableState(this._component);\n\n // Update the form value, state, and validity\n const formValue = checked ? value : null;\n const formState: RadioState = checked ? 'checked' : 'unchecked';\n this._component[internals].setFormValue(formValue, formState);\n RadioGroupManager.setRadioGroupValidity(this._component);\n }\n\n /**\n * Attempts to set the disabled state of the radio. If the radio is in a disabled radio group, it\n * can't be enabled.\n * \n * @param value Whether the radio should be disabled.\n * @returns Whether the disabled state was set.\n */\n public trySetDisabled(value: boolean): boolean {\n const group = this._component.closest('forge-radio-group');\n\n if (!value && group && group.disabled) {\n return false;\n }\n\n this._component[setDefaultAria]({ ariaDisabled: `${!!value}` });\n RadioGroupManager.syncRadioFocusableState(this._component);\n return true;\n }\n\n public setRequired(value: boolean): void {\n this._component[setDefaultAria]({\n ariaRequired: value ? 'true' : 'false'\n }, { setAttribute: true });\n RadioGroupManager.setRadioGroupValidity(this._component);\n }\n\n public setReadonly(value: boolean): void {\n this._component[setDefaultAria]({ ariaDisabled: `${!!value}` });\n }\n\n public disableStateLayer(value: boolean): void {\n this._stateLayerElement.disabled = value;\n }\n\n public setLabelPosition(value: RadioLabelPosition): void {\n this._labelElement.remove();\n\n if (value === 'start') {\n this._rootElement.prepend(this._labelElement);\n } else {\n this._rootElement.append(this._labelElement);\n }\n }\n\n public setUncheckedRadioGroupFocus(event: 'focus' | 'blur'): void {\n RadioGroupManager.setUncheckedRadioGroupFocus(this._component, event);\n }\n\n public focusNext(): void {\n RadioGroupManager.focusNextRadioInGroup(this._component);\n }\n\n public focusPrevious(): void {\n RadioGroupManager.focusPreviousRadioInGroup(this._component);\n }\n}\n", "import { ICustomElementFoundation } from '@tylertech/forge-core';\nimport { task } from '../../core/utils/event-utils';\nimport { IRadioAdapter } from './radio-adapter';\nimport { RadioLabelPosition, RADIO_CONSTANTS } from './radio-constants';\n\nexport interface IRadioFoundation extends ICustomElementFoundation {\n checked: boolean;\n defaultChecked: boolean;\n value: string;\n disabled: boolean;\n required: boolean;\n readonly: boolean;\n dense: boolean;\n labelPosition: RadioLabelPosition;\n tryCheck(): boolean;\n}\n\nexport class RadioFoundation implements IRadioFoundation {\n // State\n private _checked = false;\n private _defaultChecked = false;\n private _value = 'on';\n private _disabled = false;\n private _required = false;\n private _readonly = false;\n private _dense = false;\n private _labelPosition: RadioLabelPosition = 'end';\n\n // Listeners\n private readonly _focusListener: EventListener;\n private readonly _blurListener: EventListener;\n private readonly _clickListener: EventListener;\n private readonly _keydownListener: EventListener;\n private readonly _keyupListener: EventListener;\n\n constructor(private _adapter: IRadioAdapter) {\n this._focusListener = () => this._handleFocus();\n this._blurListener = () => this._handleBlur();\n this._clickListener = (evt: MouseEvent) => this._handleClick(evt);\n this._keydownListener = (evt: KeyboardEvent) => this._handleKeydown(evt);\n this._keyupListener = (evt: KeyboardEvent) => this._handleKeyup(evt);\n }\n\n public initialize(): void {\n this._adapter.addHostListener('focus', this._focusListener);\n this._adapter.addHostListener('blur', this._blurListener);\n this._adapter.addHostListener('click', this._clickListener);\n this._adapter.addHostListener('keydown', this._keydownListener);\n this._adapter.addHostListener('keyup', this._keyupListener);\n this._adapter.setChecked(this._checked, this._value);\n }\n\n // Public methods\n\n public tryCheck(): boolean {\n this._checked = true;\n\n if (!this._dispatchEvents()) {\n this._checked = false;\n return false;\n }\n \n this._adapter.setChecked(this._checked, this._value);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.CHECKED, this._checked);\n return true;\n }\n\n // Event handlers\n\n private _handleFocus(): void {\n if (!this._checked) {\n this._adapter.setUncheckedRadioGroupFocus('focus');\n }\n }\n\n private _handleBlur(): void {\n if (!this._checked) {\n this._adapter.setUncheckedRadioGroupFocus('blur');\n }\n }\n\n private _handleClick(evt: MouseEvent): void {\n this._activate(evt);\n }\n\n private _handleKeydown(evt: KeyboardEvent): void {\n switch (evt.key) {\n case 'ArrowRight':\n case 'ArrowDown':\n evt.preventDefault();\n this._adapter.focusNext();\n break;\n case 'ArrowLeft':\n case 'ArrowUp':\n evt.preventDefault();\n this._adapter.focusPrevious();\n break;\n case ' ':\n // Prevent the spacebar from scrolling the page\n evt.preventDefault();\n break;\n }\n }\n\n private _handleKeyup(evt: KeyboardEvent): void {\n if (evt.key === ' ') {\n this._activate(evt);\n }\n }\n\n /**\n * Checks the radio button if it is not disabled or readonly. Exits early if the activating\n * event is cancelled.\n */\n private async _activate(evt: Event): Promise<void> {\n if (this._checked || this._disabled || this._readonly) {\n return;\n }\n\n // Wait a task to allow the event to propagate to user code.\n await task();\n if (evt.defaultPrevented) {\n return;\n }\n\n this._checked = true;\n\n if (!this._dispatchEvents()) {\n this._checked = false;\n return;\n }\n\n this._adapter.setChecked(this._checked, this._value);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.CHECKED, this._checked);\n }\n\n /**\n * Dispatches change and input events.\n * \n * @returns {boolean} - Returns true if neither event was cancelled.\n */\n private _dispatchEvents(): boolean {\n // Emit both change and input events per the spec.\n const changeEvent = new Event(RADIO_CONSTANTS.events.CHANGE, { bubbles: true, cancelable: true });\n const inputEvent = new Event(RADIO_CONSTANTS.events.INPUT, { bubbles: true, cancelable: true, composed: true });\n this._adapter.dispatchHostEvent(changeEvent);\n this._adapter.dispatchHostEvent(inputEvent);\n return !(changeEvent.defaultPrevented || inputEvent.defaultPrevented);\n }\n\n public get checked(): boolean {\n return this._checked;\n }\n public set checked(value: boolean) {\n if (this._checked !== value) {\n this._checked = value;\n this._adapter.setChecked(this._checked, this._value);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.CHECKED, this._checked);\n }\n }\n\n public get defaultChecked(): boolean {\n return this._defaultChecked;\n }\n public set defaultChecked(value: boolean) {\n if (this._defaultChecked !== value) {\n this._defaultChecked = value;\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.DEFAULT_CHECKED, this._defaultChecked);\n }\n }\n\n public get value(): string {\n return this._value;\n }\n public set value(value: string) {\n if (this._value !== value) {\n this._value = value;\n this._adapter.setHostAttribute(RADIO_CONSTANTS.attributes.VALUE, this._value);\n }\n }\n\n public get disabled(): boolean {\n return this._disabled;\n }\n public set disabled(value: boolean) {\n if (this._disabled !== value) {\n this._disabled = value;\n // Attempt to set disabled, restore if unsuccessful\n if (this._adapter.trySetDisabled(this._disabled)) {\n this._adapter.disableStateLayer(this._disabled || this._readonly);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.DISABLED, this._disabled);\n } else {\n this._disabled = !this._disabled;\n }\n }\n }\n\n public get required(): boolean {\n return this._required;\n }\n public set required(value: boolean) {\n if (this._required !== value) {\n this._required = value;\n this._adapter.setRequired(this._required);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.REQUIRED, this._required);\n }\n }\n\n public get readonly(): boolean {\n return this._readonly;\n }\n public set readonly(value: boolean) {\n if (this._readonly !== value) {\n this._readonly = value;\n this._adapter.setReadonly(this._readonly);\n this._adapter.disableStateLayer(this._disabled || this._readonly);\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.READONLY, this._readonly);\n }\n }\n\n public get dense(): boolean {\n return this._dense;\n }\n public set dense(value: boolean) {\n if (this._dense !== value) {\n this._dense = value;\n this._adapter.toggleHostAttribute(RADIO_CONSTANTS.attributes.DENSE, this._dense);\n }\n }\n\n public get labelPosition(): RadioLabelPosition {\n return this._labelPosition;\n }\n public set labelPosition(value: RadioLabelPosition) {\n if (this._labelPosition !== value) {\n this._labelPosition = value;\n this._adapter.setLabelPosition(this._labelPosition);\n this._adapter.setHostAttribute(RADIO_CONSTANTS.attributes.LABEL_POSITION, this._labelPosition);\n }\n }\n}\n", "import { attachShadowTemplate, coerceBoolean, CustomElement, FoundationProperty } from '@tylertech/forge-core';\nimport { getFormState, getFormValue, inputType, setDefaultAria } from '../../constants';\nimport { BaseComponent } from '../../core/base/base-component';\nimport { IWithFocusable, WithFocusable } from '../../core/mixins/focus/with-focusable';\nimport { IWithFormAssociation, WithFormAssociation } from '../../core/mixins/form/with-form-associated';\nimport { IWithDefaultAria, WithDefaultAria } from '../../core/mixins/internals/with-default-aria';\nimport { IWithElementInternals, WithElementInternals } from '../../core/mixins/internals/with-element-internals';\nimport { IWithLabelAwareness, WithLabelAwareness } from '../../core/mixins/label/with-label-aware';\nimport { FormValue } from '../../core/utils/form-utils';\nimport { FocusIndicatorComponent } from '../../focus-indicator';\nimport { StateLayerComponent } from '../../state-layer';\nimport { RadioGroupManager } from '../core/radio-group-manager';\nimport { RadioAdapter } from './radio-adapter';\nimport { RadioLabelPosition, RadioState, RADIO_CONSTANTS, tryCheck } from './radio-constants';\nimport { RadioFoundation } from './radio-foundation';\n\nconst template = '<template><div id=\\\"radio\\\" class=\\\"forge-radio\\\" part=\\\"root\\\"><div id=\\\"container\\\" class=\\\"container\\\" aria-hidden=\\\"true\\\"><div id=\\\"background\\\" class=\\\"background\\\" part=\\\"background\\\"></div><forge-focus-indicator target=\\\":host\\\" part=\\\"focus-indicator\\\"></forge-focus-indicator><forge-state-layer exportparts=\\\"surface:state-layer\\\"></forge-state-layer></div><span id=\\\"label\\\" class=\\\"label\\\" for=\\\"input\\\" part=\\\"label\\\"><slot></slot></span></div></template>';\nconst styles = ':host{display:inline-block;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}:host(:focus){outline:0}.forge-radio{--_radio-primary-color:var(--forge-radio-primary-color, var(--forge-theme-tertiary, #3d5afe));--_radio-inactive-color:var(--forge-radio-inactive-color, var(--forge-theme-surface-container-high, #9e9e9e));--_radio-size:var(--forge-radio-size, 20px);--_radio-mark-size:var(--forge-radio-mark-size, 12px);--_radio-state-layer-size:var(--forge-radio-state-layer-size, 40px);--_radio-state-layer-dense-size:var(--forge-radio-state-layer-dense-size, 24px);--_radio-width:var(--forge-radio-width, var(--_radio-size));--_radio-height:var(--forge-radio-height, var(--_radio-size));--_radio-border-width:var(--forge-radio-border-width, var(--forge-border-medium, 2px));--_radio-unchecked-border-color:var(--forge-radio-unchecked-border-color, var(--_radio-inactive-color));--_radio-checked-border-color:var(--forge-radio-checked-border-color, var(--_radio-primary-color));--_radio-background:var(--forge-radio-background, transparent);--_radio-shape:var(--forge-radio-shape, var(--forge-shape-round, 50%));--_radio-mark-width:var(--forge-radio-mark-width, var(--_radio-mark-size));--_radio-mark-height:var(--forge-radio-mark-height, var(--_radio-mark-size));--_radio-mark-unchecked-color:var(--forge-radio-mark-unchecked-color, var(--_radio-inactive-color));--_radio-mark-checked-color:var(--forge-radio-mark-checked-color, var(--_radio-primary-color));--_radio-mark-unchecked-background:var(--forge-radio-mark-unchecked-background, transparent);--_radio-mark-checked-background:var(--forge-radio-mark-checked-background, transparent);--_radio-gap:var(--forge-radio-gap, 0);--_radio-justify:var(--forge-radio-justify, start);--_radio-direction:var(--forge-radio-direction, initial);--_radio-state-layer-width:var(--forge-radio-state-layer-width, var(--_radio-state-layer-size));--_radio-state-layer-height:var(--forge-radio-state-layer-height, var(--_radio-state-layer-size));--_radio-state-layer-unchecked-color:var(--forge-radio-state-layer-unchecked-color, var(--_radio-color));--_radio-state-layer-checked-color:var(--forge-radio-state-layer-checked-color, var(--_radio-primary-color));--_radio-state-layer-shape:var(--forge-radio-state-layer-shape, var(--_radio-shape));--_radio-state-layer-dense-width:var(--forge-radio-state-layer-dense-width, var(--_radio-state-layer-dense-size));--_radio-state-layer-dense-height:var(--forge-radio-state-layer-dense-height, var(--_radio-state-layer-dense-size));--_radio-disabled-opacity:var(--forge-radio-disabled-opacity, 0.38);--_radio-animation-duration:var(--forge-radio-animation-duration, var(--forge-animation-duration-short4, 200ms));--_radio-animation-timing-function:var(--forge-radio-animation-timing-function, var(--forge-animation-easing-decelerate, cubic-bezier(0, 0, 0, 1)));--_radio-animation-delay:var(--forge-radio-animation-delay, 0ms)}.forge-radio{position:relative;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:var(--_radio-direction);flex-shrink:0;-webkit-box-align:center;align-items:center;-webkit-box-pack:var(--_radio-justify);justify-content:var(--_radio-justify);gap:var(--_radio-gap);display:-webkit-box;display:flex}.forge-radio .container{position:relative;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;display:-webkit-box;display:flex;border-radius:var(--_radio-shape);inline-size:var(--_radio-state-layer-width);block-size:var(--_radio-state-layer-height);cursor:pointer}.forge-radio .background{position:relative;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;display:-webkit-box;display:flex;overflow:hidden;-webkit-transition-duration:var(--_radio-animation-duration);transition-duration:var(--_radio-animation-duration);-webkit-transition-delay:var(--_radio-animation-delay);transition-delay:var(--_radio-animation-delay);-webkit-transition-timing-function:var(--_radio-animation-timing-function);transition-timing-function:var(--_radio-animation-timing-function);-webkit-transition-property:border-color;transition-property:border-color;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:var(--_radio-shape);border-width:var(--_radio-border-width);border-style:solid;border-color:var(--_radio-unchecked-border-color);inline-size:var(--_radio-width);block-size:var(--_radio-height);background:var(--_radio-background)}.forge-radio .background::after{content:\\\"\\\";position:absolute;contain:strict;-webkit-transition-duration:var(--_radio-animation-duration);transition-duration:var(--_radio-animation-duration);-webkit-transition-delay:var(--_radio-animation-delay);transition-delay:var(--_radio-animation-delay);-webkit-transition-timing-function:var(--_radio-animation-timing-function);transition-timing-function:var(--_radio-animation-timing-function);-webkit-transition-property:inline-size,block-size,border-color;transition-property:inline-size,block-size,border-color;border-radius:var(--_radio-shape);border-width:calc(var(--_radio-mark-height)/ 2) calc(var(--_radio-mark-width)/ 2);border-color:var(--_radio-mark-unchecked-color);border-style:solid;inline-size:calc(var(--_radio-width) - 2 * var(--_radio-border-width));block-size:calc(var(--_radio-height) - 2 * var(--_radio-border-width));background:var(--_radio-mark-unchecked-background)}.forge-radio .label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label1-font-family, var(--forge-typography-font-family, \\\"Roboto\\\", sans-serif));font-size:var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .75)));font-weight:var(--forge-typography-label1-font-weight,400);line-height:var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label1-letter-spacing, .0357142857em);text-transform:var(--forge-typography-label1-text-transform,inherit);-webkit-text-decoration:var(--forge-typography-label1-text-decoration,inherit);text-decoration:var(--forge-typography-label1-text-decoration,inherit);cursor:default}.forge-radio .label:empty{display:none}:host([checked]) .forge-radio .background{border-color:var(--_radio-checked-border-color)}:host([checked]) .forge-radio .background::after{border-color:var(--_radio-mark-checked-color);inline-size:0px;block-size:0px;background:var(--_radio-mark-checked-background)}:host([checked]) forge-state-layer{--forge-state-layer-color:var(--_radio-state-layer-checked-color)}:host([dense]) .forge-radio .container{inline-size:var(--_radio-state-layer-dense-width);block-size:var(--_radio-state-layer-dense-height)}:host([disabled]) .forge-radio{opacity:var(--_radio-disabled-opacity)}:host([disabled]) .forge-radio .container{cursor:not-allowed}:host([readonly]) .forge-radio .container{cursor:not-allowed}forge-focus-indicator{--forge-focus-indicator-color:var(--_radio-primary-color);--forge-focus-indicator-outward-offset:0px;--forge-focus-indicator-shape:var(--_radio-state-layer-shape)}forge-state-layer{--forge-state-layer-color:var(--_radio-state-layer-unchecked-color)}';\n\nexport interface IRadioComponent extends IWithFormAssociation, IWithFocusable, IWithLabelAwareness, IWithElementInternals, IWithDefaultAria {\n checked: boolean;\n defaultChecked: boolean;\n value: string;\n required: boolean;\n dense: boolean;\n labelPosition: RadioLabelPosition;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'forge-radio': IRadioComponent;\n }\n}\n\nconst BaseRadioClass = WithFormAssociation(WithLabelAwareness(WithFocusable(WithDefaultAria(WithElementInternals(BaseComponent)))));\n\n/**\n * @tag forge-radio\n * \n * @summary The Forge Radio component is used to create a form input where only one out of a set of\n * values should be selected.\n * \n * @property {boolean} checked - Indicates whether the radio button is checked.\n * @property {boolean} defaultChecked - Indicates whether the radio button is checked by default.\n * @property {string} value - The value of the radio button when submitted.\n * @property {boolean} dense - Indicates whether the radio button should be displayed in a dense layout.\n * @property {boolean} disabled - Indicates whether the radio button is disabled.\n * @property {boolean} required - Indicates whether the radio button is required.\n * @property {boolean} readonly - Indicates whether the radio button is read-only.\n * @property {RadioLabelPosition} labelPosition - The position of the radio button's label.\n * \n * @attribute {boolean} checked - Indicates whether the radio button is checked.\n * @attribute {boolean} default-checked - Indicates whether the radio button is checked by default.\n * @attribute {string} value - The value of the radio button when submitted.\n * @attribute {boolean} dense - Indicates whether the radio button should be displayed in a dense layout.\n * @attribute {boolean} disabled - Indicates whether the radio button is disabled.\n * @attribute {boolean} required - Indicates whether the radio button is required.\n * @attribute {boolean} readonly - Indicates whether the radio button is read-only.\n * @attribute {RadioLabelPosition} label-position - The position of the radio button's label.\n * \n * @cssproperty --forge-radio-primary-color - The primary color of the radio button when checked.\n * @cssproperty --forge-radio-inactive-color - The color of the radio button when unchecked.\n * @cssproperty --forge-radio-size - The size of the radio button in the inline and block directions.\n * @cssproperty --forge-radio-width - The width of the radio button.\n * @cssproperty --forge-radio-height - The height of the radio button.\n * @cssproperty --forge-radio-border-width - The width of the radio button's border.\n * @cssproperty --forge-radio-unchecked-border-color - The color of the radio button's border when unchecked.\n * @cssproperty --forge-radio-checked-border-color - The color of the radio button's border when checked.\n * @cssproperty --forge-radio-background - The background of the radio button.\n * @cssproperty --forge-radio-shape - The shape of the radio button.\n * @cssproperty --forge-radio-mark-size - The size of the radio button's mark in the inline and block directions.\n * @cssproperty --forge-radio-mark-width - The width of the radio button's mark.\n * @cssproperty --forge-radio-mark-height - The height of the radio button's mark.\n * @cssproperty --forge-radio-mark-unchecked-color - The color of the radio button's mark when unchecked.\n * @cssproperty --forge-radio-mark-checked-color - The color of the radio button's mark when checked.\n * @cssproperty --forge-radio-mark-unchecked-background - The background of the radio button's mark when unchecked.\n * @cssproperty --forge-radio-mark-checked-background - The background of the radio button's mark when checked.\n * @cssproperty --forge-radio-gap - The gap between the radio button and its label.\n * @cssproperty --forge-radio-justify - The alignment of the radio button and its label in the inline direction.\n * @cssproperty --forge-radio-direction - The direction of the radio button and its label.\n * @cssproperty --forge-radio-state-layer-size - The size of the radio button's state layer in the inline and block directions.\n * @cssproperty --forge-radio-state-layer-width - The width of the radio button's state layer.\n * @cssproperty --forge-radio-state-layer-height - The height of the radio button's state layer.\n * @cssproperty --forge-radio-state-layer-unchecked-color - The color of the radio button's state layer when unchecked.\n * @cssproperty --forge-radio-state-layer-checked-color - The color of the radio button's state layer when checked.\n * @cssproperty --forge-radio-state-layer-shape - The shape of the radio button's state layer.\n * @cssproperty --forge-radio-state-layer-dense-size - The size of the radio button's state layer when dense.\n * @cssproperty --forge-radio-state-layer-dense-width - The width of the radio button's state layer when dense.\n * @cssproperty --forge-radio-state-layer-dense-height - The height of the radio button's state layer when dense.\n * @cssproperty --forge-radio-disabled-opacity - The opacity of the radio button when disabled.\n * @cssproperty --forge-radio-animation-duration - The duration of the radio button's animations.\n * @cssproperty --forge-radio-animation-timing-function - The timing function of the radio button's animations.\n * @cssproperty --forge-radio-animation-delay - The delay of the radio button's animations.\n * \n * @csspart root - Styles the radio's root element.\n * @csspart background - Styles the border and background of the radio.\n * @csspart focus-indicator - Styles the focus indicator of the radio.\n * @csspart state-layer - Styles the state layer of the radio.\n * \n * @slot - This is a default/unnamed slot for the label text.\n */\n@CustomElement({\n name: RADIO_CONSTANTS.elementName,\n dependencies: [\n FocusIndicatorComponent,\n StateLayerComponent\n ]\n})\nexport class RadioComponent extends BaseRadioClass implements IRadioComponent {\n public static get observedAttributes(): string[] {\n return Object.values(RADIO_CONSTANTS.observedAttributes);\n }\n\n private _foundation: RadioFoundation;\n\n // Used to communicate with the form group after this radio instance has been disconnected\n private _rootNode?: ShadowRoot | Document;\n private _latestAssociatedForm?: HTMLFormElement;\n\n constructor() {\n super();\n attachShadowTemplate(this, template, styles);\n this[inputType] = 'radio';\n this._foundation = new RadioFoundation(new RadioAdapter(this));\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this[setDefaultAria]({\n role: 'radio',\n ariaChecked: this.checked ? 'true' : 'false',\n ariaDisabled: this.disabled ? 'true' : 'false',\n ariaRequired: this.required ? 'true' : 'false'\n });\n RadioGroupManager.syncRadioFocusableState(this);\n this._foundation.initialize();\n this._rootNode = this.getRootNode() as ShadowRoot | Document;\n }\n\n public disconnectedCallback(): void {\n RadioGroupManager.syncRadioFocusableState(this, { ignoreSelf: true, rootNode: this._rootNode, form: this._latestAssociatedForm });\n }\n\n public override attributeChangedCallback(name: string, oldValue: string, newValue: string): void {\n switch (name) {\n case RADIO_CONSTANTS.attributes.CHECKED:\n this._foundation.checked = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.DEFAULT_CHECKED:\n this._foundation.defaultChecked = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.VALUE:\n this.value = newValue;\n break;\n case RADIO_CONSTANTS.attributes.DENSE:\n this.dense = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.DISABLED:\n this.disabled = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.REQUIRED:\n this.required = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.READONLY:\n this.readonly = coerceBoolean(newValue);\n break;\n case RADIO_CONSTANTS.attributes.LABEL_POSITION:\n this.labelPosition = newValue as RadioLabelPosition;\n break;\n }\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n public override [getFormValue](): FormValue | null {\n return this.checked ? this.value : null;\n }\n\n public override [getFormState](): RadioState {\n return this.checked ? 'checked' : 'unchecked';\n }\n\n public formAssociatedCallback(form: HTMLFormElement | null): void {\n if (form) {\n this._latestAssociatedForm = form;\n }\n }\n\n public formResetCallback(): void {\n RadioGroupManager.requestRadioGroupReset(this);\n }\n\n public formStateRestoreCallback(state: RadioState): void {\n this.checked = state === 'checked';\n }\n\n public labelClickedCallback(): void {\n this.click();\n }\n\n public labelChangedCallback(value: string | null): void {\n this[setDefaultAria]({ ariaLabel: value });\n }\n\n @FoundationProperty()\n public declare checked: boolean;\n\n @FoundationProperty()\n public declare defaultChecked: boolean;\n\n @FoundationProperty()\n public declare value: string;\n\n @FoundationProperty()\n public declare dense: boolean;\n\n @FoundationProperty()\n public declare disabled: boolean;\n\n @FoundationProperty()\n public declare required: boolean;\n\n @FoundationProperty()\n public declare readonly: boolean;\n\n @FoundationProperty()\n public declare labelPosition: RadioLabelPosition;\n\n public [tryCheck](): boolean {\n return this._foundation.tryCheck();\n }\n}\n", "import { defineCustomElement } from '@tylertech/forge-core';\n\nimport { RadioComponent } from './radio';\n\nexport * from './radio-adapter';\nexport * from './radio-constants';\nexport * from './radio-foundation';\nexport * from './radio';\n\nexport function defineRadioComponent(): void {\n defineCustomElement(RadioComponent);\n}\n"],
|
|
5
|
+
"mappings": "8lBAOO,IAAMA,EAAN,MAAMA,CAAkB,CAiB7B,OAAc,cAAcC,EAAqB,CAC/C,SAAAC,EACA,KAAAC,CACF,EAGI,CAAC,EAAsB,CA9B7B,IAAAC,EAgCI,GAAI,CAACH,EAAG,KACN,MAAO,CAACA,CAAE,EAIZ,GAAI,CAACA,EAAG,MAAQ,CAACE,EAAM,CAErB,IAAME,GADOH,GAAA,KAAAA,EAAYD,EAAG,YAAY,GACf,iBAAkC,GAAGK,EAAgB,oBAAoBL,EAAG,OAAO,EAC5G,OAAO,MAAM,KAAKI,CAAW,EAAE,OAAOE,GAAS,CAACA,EAAM,IAAI,EAI5D,IAAMC,IAAeJ,EAAAH,EAAG,OAAH,KAAAG,EAAWD,GAA0B,SAAS,UAAUF,EAAG,IAAI,EACpF,OAAIO,G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AAY,WACpC,CAEO,uBAAuBC,EAAoC,CAC5DA,IACF,KAAK,sBAAwBA,EAEjC,CAEO,mBAA0B,CAC/BP,EAAkB,uBAAuB,IAAI,CAC/C,CAEO,yBAAyBQ,EAAyB,CACvD,KAAK,QAAUA,IAAU,SAC3B,CAEO,sBAA6B,CAClC,KAAK,MAAM,CACb,CAEO,qBAAqBC,EAA4B,CACtD,KAAKV,CAAc,EAAE,CAAE,UAAWU,CAAM,CAAC,CAC3C,CA0BA,CAAQC,CAAQ,GAAa,CAC3B,OAAO,KAAK,YAAY,SAAS,CACnC,CACF,EA1BiBC,EAAA,CADdC,EAAmB,GA/FTnB,EAgGI,uBAGAkB,EAAA,CADdC,EAAmB,GAlGTnB,EAmGI,8BAGAkB,EAAA,CADdC,EAAmB,GArGTnB,EAsGI,qBAGAkB,EAAA,CADdC,EAAmB,GAxGTnB,EAyGI,qBAGAkB,EAAA,CADdC,EAAmB,GA3GTnB,EA4GI,wBAGAkB,EAAA,CADdC,EAAmB,GA9GTnB,EA+GI,wBAGAkB,EAAA,CADdC,EAAmB,GAjHTnB,EAkHI,wBAGAkB,EAAA,CADdC,EAAmB,GApHTnB,EAqHI,6BArHJA,EAANkB,EAAA,CAPNE,EAAc,CACb,KAAMf,EAAgB,YACtB,aAAc,CACZgB,EACAC,CACF,CACF,CAAC,GACYtB,GCnGN,SAASuB,IAA6B,CAC3CC,EAAoBC,CAAc,CACpC",
|
|
6
6
|
"names": ["_RadioGroupManager", "el", "rootNode", "form", "_a", "namedRadios", "RADIO_CONSTANTS", "radio", "formRadios", "group", "invalid", "validationMessage", "getValidationMessage", "internals", "ignoreSelf", "isFocusable", "event", "task", "checkedRadio", "increment", "index", "nextRadio", "tryCheck", "required", "selection", "RadioGroupManager", "elementName", "COMPONENT_NAME_PREFIX", "observedAttributes", "attributes", "__spreadValues", "selectors", "events", "RADIO_CONSTANTS", "tryCheck", "RadioAdapter", "BaseAdapter", "component", "getShadowElement", "RADIO_CONSTANTS", "checked", "value", "setDefaultAria", "RadioGroupManager", "formValue", "formState", "internals", "group", "event", "RadioFoundation", "_adapter", "evt", "RADIO_CONSTANTS", "task", "changeEvent", "inputEvent", "value", "template", "styles", "BaseRadioClass", "WithFormAssociation", "WithLabelAwareness", "WithFocusable", "WithDefaultAria", "WithElementInternals", "BaseComponent", "RadioComponent", "attachShadowTemplate", "inputType", "RadioFoundation", "RadioAdapter", "RADIO_CONSTANTS", "setDefaultAria", "RadioGroupManager", "name", "oldValue", "newValue", "coerceBoolean", "getFormValue", "getFormState", "form", "state", "value", "tryCheck", "__decorateClass", "FoundationProperty", "CustomElement", "FocusIndicatorComponent", "StateLayerComponent", "defineRadioComponent", "defineCustomElement", "RadioComponent"]
|
|
7
7
|
}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* Copyright 2023 Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import{d as H}from"./chunk.MTIPIEXA.js";import{i as _}from"./chunk.
|
|
6
|
+
import{d as H}from"./chunk.MTIPIEXA.js";import{i as _}from"./chunk.OJ7JO4O6.js";import{d as i}from"./chunk.K6GJNDTY.js";import{d as k}from"./chunk.I7YON2TC.js";import{d}from"./chunk.MX4JX4GT.js";import{b as c}from"./chunk.DKERDHXH.js";import{d as g}from"./chunk.ZG6YF2HI.js";import{e as f}from"./chunk.QKTK5XUE.js";import{b as l}from"./chunk.CEGBMUSR.js";import{d as p}from"./chunk.RXBLU4OJ.js";import{b as J}from"./chunk.NEQX2QVX.js";import{d as q}from"./chunk.UKBE2FMZ.js";import{d as j}from"./chunk.YRAEFQJW.js";import{d as K}from"./chunk.X77NKT6Z.js";import{b as Mo}from"./chunk.7IPAW4D2.js";import{e as Y}from"./chunk.32APLNN2.js";import{d as X}from"./chunk.LY2Z2Z7S.js";import{E as z}from"./chunk.UPSXYWPD.js";import{f as W}from"./chunk.A7BCLPP4.js";import{d as N}from"./chunk.XZ23XHFE.js";import{a as G}from"./chunk.WMJSYYXQ.js";import{e as V}from"./chunk.NWVQ5HK2.js";import{d as mo}from"./chunk.5UOX22ML.js";import{d as to}from"./chunk.YPNSK2CK.js";import{d as oo}from"./chunk.KLU54MDQ.js";import{b as ro}from"./chunk.6VS3LYAF.js";import{b as $}from"./chunk.CGFSMACZ.js";import{b as w}from"./chunk.QUXMLWBJ.js";import{b as no}from"./chunk.QLGJS37N.js";import{j as eo}from"./chunk.IL4S57WO.js";import{b as po}from"./chunk.KEOLH7G3.js";import{d as h}from"./chunk.7Y3BUR7Q.js";import{d as D}from"./chunk.QVATEY5S.js";import{d as lo}from"./chunk.KCCW4AMU.js";import{b as fo}from"./chunk.CE35CVDV.js";import{d as P}from"./chunk.YNCTSMT6.js";import{c as So}from"./chunk.TSSZQPLE.js";import{b as Bo}from"./chunk.OVXEOEJF.js";import{d as co}from"./chunk.2W23MOPP.js";import{d as ao}from"./chunk.OOAJHLW4.js";import{b as Co}from"./chunk.ENUKGA2U.js";import{d as io}from"./chunk.AOVXNX7P.js";import{d as Q}from"./chunk.U6J4VHU6.js";import{b as xo}from"./chunk.EO3GP6DP.js";import{d as uo}from"./chunk.OREDK5MJ.js";import{c as Do}from"./chunk.3KAKJGUS.js";import{f as Ao}from"./chunk.TQWZDM6T.js";import{h as go}from"./chunk.HD2SLIL2.js";import{d as Po}from"./chunk.3PMONORO.js";import{d as To}from"./chunk.BQZKOIAW.js";import{d as m}from"./chunk.IQYOLMPG.js";import{d as t}from"./chunk.RSYEG2RW.js";import{e as so}from"./chunk.AG6IRMLZ.js";import{f as wo}from"./chunk.QTY25OTN.js";import{b as ko}from"./chunk.OEI35LFU.js";import{b as E}from"./chunk.SROEDYPL.js";import{d as ho}from"./chunk.VGIRVTBJ.js";import{q as Eo}from"./chunk.VL5RWSAV.js";import{c as B}from"./chunk.2GUWHBUU.js";import{f as u}from"./chunk.O5WAQQNR.js";import{b as s}from"./chunk.GG7IQL46.js";import{c as S}from"./chunk.USTVZ6MZ.js";import{b as T}from"./chunk.5MB6CTBA.js";import{c as R}from"./chunk.OQHDHS2C.js";import{d as y}from"./chunk.MFS7AVW6.js";import{e as I,j as O}from"./chunk.CLYGTLXN.js";import{e as F}from"./chunk.7RLY2O3H.js";import{d as b}from"./chunk.CFAI4K3E.js";import{d as M}from"./chunk.BHE6Z5Y2.js";import{d as L}from"./chunk.GRYO5XP2.js";import{d as v}from"./chunk.V6KUOCAR.js";import{c as a}from"./chunk.GBAVJILM.js";import{g as Z}from"./chunk.FLBYVCQ6.js";import{b as U}from"./chunk.PC6TW5XE.js";import{d as A}from"./chunk.QIZBZGYT.js";import{d as C}from"./chunk.GIENHEMN.js";import{l as r}from"./chunk.T7NWP7DB.js";import{d as n}from"./chunk.FLF5RTYO.js";import{p as e}from"./chunk.ASLHRT3N.js";import{h as x}from"./chunk.H4VQXV2H.js";import{b as o}from"./chunk.LNTTU2GL.js";var bo=[p,f,g,c,d,k,i,_,D,U,l,H,K,j,q,A,M,b,z,J,L,V,N,G,Q,W,X,Y,Z,w,$,m,y,to,mo,n,C,r,po,eo,O,no,s,B,u,P,ro,oo,t,io,Co,x,fo,lo,S,h,uo,F,I,xo,co,ao,T,Bo,So,so,e,To,Po,v,Do,Ao,go,R,Eo,ho,E,a,ko,wo];function Kr(){o(bo)}var Lo=[Mo];function Qr(){o(Lo)}export{Kr as a,Qr as b};
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright (c) Tyler Technologies, Inc.
|
|
10
10
|
* License: Apache-2.0
|
|
11
11
|
*/
|
|
12
|
-
//# sourceMappingURL=chunk.
|
|
12
|
+
//# sourceMappingURL=chunk.AIJK3CTV.js.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Copyright 2023 Tyler Technologies, Inc.
|
|
4
4
|
* License: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import{a as E,e as B}from"./chunk.
|
|
7
|
-
//# sourceMappingURL=chunk.
|
|
6
|
+
import{a as E,e as B}from"./chunk.7RLY2O3H.js";import{a as R}from"./chunk.CFAI4K3E.js";import{a as w}from"./chunk.GRYO5XP2.js";import{a as G}from"./chunk.V6KUOCAR.js";import{b as D}from"./chunk.QIZBZGYT.js";import{a as H}from"./chunk.GIENHEMN.js";import{a as S}from"./chunk.INQZNXG6.js";import{a as M,b as x}from"./chunk.BQ52JYLA.js";import{c as k}from"./chunk.BX4AQRHB.js";import{a as l}from"./chunk.NVUMRW44.js";import{a as g}from"./chunk.OLFOVKQG.js";import{a as f,b as v,k as N,n as p}from"./chunk.VRSPT7WX.js";import{a as b,e as h,f as O,k as _}from"./chunk.LNTTU2GL.js";import{r as y}from"./chunk.L4QSPQDE.js";import{k as c}from"./chunk.J2M2MXP2.js";import{a as u,d as o}from"./chunk.M3QDAYD2.js";var L=class extends g{constructor(t){super(t)}attachLabel(t){t.nonInteractive=!0,t.forElement=this._component}setDisabled(t){this._component[p]({ariaDisabled:t?"true":null}),this._disableRadios(t)}_disableRadios(t){this._component.querySelectorAll(E.elementName).forEach(e=>{e.disabled=t})}};var U=`${v}radio-group`,F={DISABLED:"disabled"},j=u({},F),m={elementName:U,observedAttributes:F,attributes:j};var P=d=>typeof d.labelChangedCallback=="function";var z=`${v}label`,W={FOR:"for",DYNAMIC:"dynamic",NON_INTERACTIVE:"non-interactive",LEGEND:"legend"},$=u({},W),q={SLOT:"slot"},X={CONNECTED:`${z}-connected`},Y=[D.elementName,w.elementName,H.elementName,E.elementName,G.elementName,R.elementName],a={elementName:z,observedAttributes:W,attributes:$,selectors:q,events:X,labelableChildSelectors:Y};var T=class extends g{constructor(e){super(e);this._targetElement=null;this._slotElement=O(e,a.selectors.SLOT)}destroy(){var e;(e=this._targetElement)==null||e.labelChangedCallback(null),this._targetElement=null}hasTargetElement(){return!!this._targetElement}getTargetElement(){return this._targetElement}setTargetElement(e){if(e&&this._checkLabelAwareness(e)){this._targetElement=e;return}this._targetElement=null}trySetTarget(e){this._targetElement=this._locateTargetElement(e)}clickTarget(){var e,i;(i=(e=this._targetElement)==null?void 0:e.labelClickedCallback)==null||i.call(e)}updateTargetLabel(){var i,n,I;let e=(n=(i=this._component.textContent)==null?void 0:i.trim())!=null?n:"";(I=this._targetElement)==null||I.labelChangedCallback(e)}addSlotChangeListener(e){this._slotElement.addEventListener("slotchange",e)}removerSlotChangeListener(e){this._slotElement.removeEventListener("slotchange",e)}addMutationObserver(e){this._mutationObserver=new MutationObserver(e),this._mutationObserver.observe(this._component,{subtree:!0,characterData:!0,childList:!0}),e([],this._mutationObserver)}removeMutationObserver(){var e;(e=this._mutationObserver)==null||e.disconnect(),this._mutationObserver=void 0}_checkLabelAwareness(e){return P(e)?!0:(console.warn("Label target element is not label aware.",e),!1)}_locateTargetElement(e){let i;if(e)i=this._component.getRootNode().querySelector(`#${e}`);else{let n=a.labelableChildSelectors.join(",");i=this._component.querySelector(n)}return i&&!this._checkLabelAwareness(i)?null:i}};var C=class{constructor(t){this._adapter=t;this._dynamic=!1;this._nonInteractive=!1;this._legend=!1;this._isConnected=!1;this._clickListener=e=>this._handleClick(e),this._slotChangeListener=()=>this._handleSlotChange(),this._mutationCallback=()=>this._handleMutation()}initialize(){this._legend?this._initializeAsLegend():this._initializeAsLabel()}disconnect(){this._disconnect(),this._adapter.destroy()}update(){this._adapter.updateTargetLabel()}async _initializeAsLegend(){await k(),this._adapter.emitHostEvent(a.events.CONNECTED)}async _initializeAsLabel(){var t;this._adapter.addSlotChangeListener(this._slotChangeListener),this._adapter.trySetTarget((t=this._for)!=null?t:null),this._adapter.hasTargetElement()&&this._connect()}_handleClick(t){var i;let e=(i=this._clickTarget)!=null?i:this._adapter.getTargetElement();t.target===e||e!=null&&e.contains(t.target)||this._adapter.clickTarget()}_handleSlotChange(){!this._for&&!this._forElement&&(this._adapter.trySetTarget(null),this._tryConnect())}_handleMutation(){this._adapter.updateTargetLabel()}_connect(){this._nonInteractive||this._adapter.addHostListener("click",this._clickListener),this._adapter.updateTargetLabel(),this._dynamic&&this._adapter.addMutationObserver(this._mutationCallback),this._isConnected=!0}_disconnect(){this._adapter.removeHostListener("click",this._clickListener),this._adapter.removeMutationObserver(),this._isConnected=!1}_tryConnect(){this._adapter.hasTargetElement()?this._isConnected||this._connect():this._disconnect()}get for(){return this._for}set for(t){var e,i;this._for!==t&&(this._for=t,this._adapter.toggleHostAttribute(a.attributes.FOR,!!this.for,(e=this.for)!=null?e:void 0),this._adapter.trySetTarget((i=this._for)!=null?i:null),this._tryConnect())}get forElement(){return this._forElement}set forElement(t){var e;this._forElement!==t&&(this._forElement=t,this._adapter.setTargetElement((e=this._forElement)!=null?e:null),this._tryConnect())}get clickTarget(){return this._clickTarget}set clickTarget(t){this._clickTarget!==t&&(this._clickTarget=t)}get dynamic(){return this._dynamic}set dynamic(t){this._dynamic!==t&&(this._dynamic=t,this._adapter.toggleHostAttribute(a.attributes.DYNAMIC,this._dynamic),this._dynamic?this._adapter.hasTargetElement()&&this._adapter.addMutationObserver(this._mutationCallback):this._adapter.removeMutationObserver())}get nonInteractive(){return this._nonInteractive}set nonInteractive(t){if(this._nonInteractive!==t){if(this._nonInteractive=t,this._adapter.toggleHostAttribute(a.attributes.NON_INTERACTIVE,this._nonInteractive),!this._isConnected)return;this._nonInteractive?this._adapter.removeHostListener("click",this._clickListener):this._adapter.addHostListener("click",this._clickListener)}}get legend(){return this._legend}set legend(t){var e;if(this._legend!==t){if(this._legend=t,this._adapter.toggleHostAttribute(a.attributes.LEGEND,this._legend),this._legend){this._adapter.removerSlotChangeListener(this._slotChangeListener),this._adapter.emitHostEvent(a.events.CONNECTED);return}this._adapter.addSlotChangeListener(this._slotChangeListener),this._adapter.trySetTarget((e=this._for)!=null?e:null),this._adapter.hasTargetElement()&&this._connect()}}};var V="<template><slot></slot></template>",K=':host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));font-size:var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .75)));font-weight:var(--forge-typography-label1-font-weight,400);line-height:var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label1-letter-spacing, .0357142857em);text-transform:var(--forge-typography-label1-text-transform,inherit);-webkit-text-decoration:var(--forge-typography-label1-text-decoration,inherit);text-decoration:var(--forge-typography-label1-text-decoration,inherit);display:inline-block;cursor:default}:host([hidden]){display:none}',r=class extends _{constructor(){super();h(this,V,K),this._foundation=new C(new T(this))}static get observedAttributes(){return Object.values(a.observedAttributes)}connectedCallback(){this._foundation.initialize()}disconnectedCallback(){this._foundation.disconnect()}attributeChangedCallback(e,i,n){switch(e){case a.attributes.FOR:this.for=n;break;case a.attributes.DYNAMIC:this.dynamic=c(n);break;case a.attributes.NON_INTERACTIVE:this.nonInteractive=c(n);break;case a.attributes.LEGEND:this.legend=c(n);break}}update(){this._foundation.update()}};o([l()],r.prototype,"for",2),o([l()],r.prototype,"forElement",2),o([l()],r.prototype,"clickTarget",2),o([l()],r.prototype,"dynamic",2),o([l()],r.prototype,"nonInteractive",2),o([l()],r.prototype,"legend",2),r=o([f({name:a.elementName})],r);function Pe(){b(r)}var A=class{constructor(t){this._adapter=t;this._disabled=!1;this._labelConnectedListener=e=>this._handleLabelConnected(e)}initialize(){this._adapter.addHostListener(a.events.CONNECTED,this._labelConnectedListener)}_handleLabelConnected(t){t.stopPropagation(),this._adapter.attachLabel(t.target)}get disabled(){return this._disabled}set disabled(t){this._disabled!==t&&(this._disabled=t,this._adapter.setDisabled(t),this._adapter.toggleHostAttribute(m.attributes.DISABLED,t))}};var J="<template><slot></slot></template>",Q=S(x(M(_))),s=class extends Q{constructor(){super();h(this,J),this._foundation=new A(new L(this))}get form(){return this[N].form}get labels(){return this[N].labels}get name(){var e;return(e=this.getAttribute("name"))!=null?e:""}set name(e){y(this,!!e,"name",e)}static get observedAttributes(){return Object.values(m.observedAttributes)}connectedCallback(){this[p]({role:"radiogroup",ariaDisabled:this.disabled?"true":null}),this._foundation.initialize()}attributeChangedCallback(e,i,n){switch(e){case m.attributes.DISABLED:this.disabled=c(n);break}}formDisabledCallback(e){this.disabled=e}labelChangedCallback(e){this[p]({ariaLabel:e!=null?e:null})}};s.formAssociated=!0,o([l()],s.prototype,"disabled",2),s=o([f({name:m.elementName,dependencies:[B]})],s);function bt(){b(s)}export{P as a,L as b,m as c,A as d,s as e,bt as f,a as g,T as h,C as i,r as j,Pe as k};
|
|
7
|
+
//# sourceMappingURL=chunk.CLYGTLXN.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Tyler Technologies, Inc.
|
|
4
|
+
* License: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import{a as R}from"./chunk.BEFAXPXJ.js";import{a as F}from"./chunk.MFQRXVKO.js";import{a as N}from"./chunk.INQZNXG6.js";import{d as T}from"./chunk.FLF5RTYO.js";import{p as S}from"./chunk.ASLHRT3N.js";import{a as O,b as z}from"./chunk.BQ52JYLA.js";import{a as P}from"./chunk.SQ3AZAHF.js";import{a as c}from"./chunk.NVUMRW44.js";import{a as C}from"./chunk.OLFOVKQG.js";import{a as v,b as E,g as L,h as w,i as d,j as A,k as m,l as I,m as D,n as l}from"./chunk.VRSPT7WX.js";import{a as _,e as x,f as h,k as y}from"./chunk.LNTTU2GL.js";import{b as g,c as p,k as s}from"./chunk.J2M2MXP2.js";import{a as f,d as n}from"./chunk.M3QDAYD2.js";var B=`${E}checkbox`,H={CHECKED:"checked",DEFAULT_CHECKED:"default-checked",INDETERMINATE:"indeterminate",VALUE:"value",DENSE:"dense",DISABLED:"disabled",REQUIRED:"required",READONLY:"readonly",LABEL_POSITION:"label-position",TABINDEX:"tabindex"},V=f({},H),K={ROOT:".forge-checkbox",LABEL:"#label",STATE_LAYER:"forge-state-layer"},o={elementName:B,selectors:K,observedAttributes:H,attributes:V};var b=class extends C{constructor(t){super(t);this._rootElement=h(t,o.selectors.ROOT),this._labelElement=h(t,o.selectors.LABEL),this._stateLayerElement=h(t,o.selectors.STATE_LAYER)}setChecked(t){this._component[d](),this._component[l]({ariaChecked:t?"true":"false"})}setDisabled(t){this._component[D]=!t,this._component[l]({ariaDisabled:t?"true":"false"}),this._stateLayerElement.disabled=t}setRequired(t){this._component[d](),this._component[l]({ariaRequired:t?"true":"false"})}setReadonly(t){this._component[l]({ariaReadOnly:t?"true":"false"}),this._stateLayerElement.disabled=t}setLabelPosition(t){this._labelElement.remove(),t==="start"?this._rootElement.prepend(this._labelElement):this._rootElement.append(this._labelElement)}syncValue(t,a){let i=t?new FormData:null;i&&t&&i.append(this._component.name,t),this._component.setFormValue(i,a)}};var k=class{constructor(e){this._adapter=e;this._checked=!1;this._defaultChecked=!1;this._indeterminate=!1;this._value="on";this._dense=!1;this._disabled=!1;this._required=!1;this._readonly=!1;this._labelPosition="end";this._clickListener=e=>this._handleChange();this._keydownListener=e=>this._handleKeydown(e);this._keyupListener=e=>this._handleKeyup(e)}get _submittedValue(){return this._checked?this._value:null}get _formState(){return this._checked?this._indeterminate?"checked-indeterminate":"checked":this._indeterminate?"unchecked-indeterminate":"unchecked"}initialize(){this._adapter.addHostListener("click",this._clickListener),this._adapter.addHostListener("keydown",this._keydownListener),this._adapter.addHostListener("keyup",this._keyupListener),this._adapter.syncValue(this._submittedValue,this._formState)}_handleKeydown(e){e.key===" "&&e.preventDefault()}_handleKeyup(e){e.key===" "&&this._handleChange()}_handleChange(){if(this._readonly)return;let e=this._checked,t=!this._checked;this.checked=t;let a=new Event("change",{cancelable:!0});if(this._adapter.redispatchEvent(a),a.defaultPrevented){this.checked=e;return}this._indeterminate=!1,this._adapter.toggleHostAttribute(o.attributes.INDETERMINATE,this._indeterminate)}get checked(){return this._checked}set checked(e){this._checked!==e&&(this._checked=e,this._adapter.setChecked(this._checked),this._adapter.syncValue(this._submittedValue,this._formState),this._adapter.toggleHostAttribute(o.attributes.CHECKED,this._checked))}get defaultChecked(){return this._defaultChecked}set defaultChecked(e){this._defaultChecked!==e&&(this._defaultChecked=e,this._adapter.toggleHostAttribute(o.attributes.DEFAULT_CHECKED,this._defaultChecked))}get indeterminate(){return this._indeterminate}set indeterminate(e){this._indeterminate!==e&&(this._indeterminate=e,this._adapter.syncValue(this._submittedValue,this._formState),this._adapter.toggleHostAttribute(o.attributes.INDETERMINATE,this._indeterminate))}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this._adapter.syncValue(this._submittedValue,this._formState),this._adapter.setHostAttribute(o.attributes.VALUE,this._value))}get dense(){return this._dense}set dense(e){this._dense!==e&&(this._dense=e,this._adapter.toggleHostAttribute(o.attributes.DENSE,this._dense))}get disabled(){return this._disabled}set disabled(e){this._disabled!==e&&(this._disabled=e,this._adapter.setDisabled(this.disabled),this._adapter.toggleHostAttribute(o.attributes.DISABLED,this._disabled))}get required(){return this._required}set required(e){this._required!==e&&(this._required=e,this._adapter.setRequired(this._required),this._adapter.toggleHostAttribute(o.attributes.REQUIRED,this._required))}get readonly(){return this._readonly}set readonly(e){this._readonly!==e&&(this._readonly=e,this._adapter.setReadonly(this._readonly),this._adapter.toggleHostAttribute(o.attributes.READONLY,this._readonly))}get labelPosition(){return this._labelPosition}set labelPosition(e){this.labelPosition!==e&&(this._labelPosition=e,this._adapter.setLabelPosition(this._labelPosition),this._adapter.setHostAttribute(o.attributes.LABEL_POSITION,this._labelPosition))}};var M='<template><div class="forge-checkbox" part="root"><div id="container" class="container"><div class="background" part="background"><svg class="icon icon--checked" aria-hidden="true" viewBox="0 0 24 24" part="checkmark"><path d="M1.73,12.91 8.1,19.28 22.79,4.59"></path></svg> <svg class="icon icon--indeterminate" aria-hidden="true" viewBox="0 0 24 24" part="mixedmark"><line x1="2" y1="12" x2="22" y2="12"></line></svg><forge-focus-indicator target=":host" part="focus-indicator"></forge-focus-indicator></div><forge-state-layer target=":host" exportparts="surface:state-layer"></forge-state-layer></div><div id="label" class="label" part="label"><slot></slot></div></div></template>',W=':host{display:inline-block;outline:0;-webkit-tap-highlight-color:transparent}:host([hidden]){display:none}.forge-checkbox{--_checkbox-primary-color:var(--forge-checkbox-primary-color, var(--forge-theme-tertiary, #3d5afe));--_checkbox-size:var(--forge-checkbox-size, 16px);--_checkbox-border-width:var(--forge-checkbox-border-width, var(--forge-border-medium, 2px));--_checkbox-icon-color:var(--forge-checkbox-icon-color, var(--forge-theme-on-tertiary, #ffffff));--_checkbox-state-layer-size:var(--forge-checkbox-state-layer-size, 40px);--_checkbox-state-layer-dense-size:var(--forge-checkbox-state-layer-dense-size, 24px);--_checkbox-background:var(--forge-checkbox-background, var(--forge-theme-surface, #ffffff));--_checkbox-width:var(--forge-checkbox-width, var(--_checkbox-size));--_checkbox-height:var(--forge-checkbox-height, var(--_checkbox-size));--_checkbox-unchecked-border-width:var(--forge-checkbox-unchecked-border-width, var(--_checkbox-border-width));--_checkbox-unchecked-border-color:var(--forge-checkbox-unchecked-border-color, var(--forge-theme-surface-container-high, #9e9e9e));--_checkbox-shape:var(--forge-checkbox-shape, var(--forge-shape-small, 2px));--_checkbox-elevation:var(--forge-checkbox-elevation, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12));--_checkbox-checked-background:var(--forge-checkbox-checked-background, var(--_checkbox-primary-color));--_checkbox-checked-border-width:var(--forge-checkbox-checked-border-width, var(--_checkbox-border-width));--_checkbox-checked-border-color:var(--forge-checkbox-checked-border-color, var(--_checkbox-checked-background));--_checkbox-icon-checked-color:var(--forge-checkbox-icon-checked-color, var(--_checkbox-icon-color));--_checkbox-icon-indeterminate-color:var(--forge-checkbox-icon-indeterminate-color, var(--_checkbox-icon-color));--_checkbox-icon-stroke-width:var(--forge-checkbox-icon-stroke-width, 4px);--_checkbox-gap:var(--forge-checkbox-gap, 0);--_checkbox-justify:var(--forge-checkbox-justify, start);--_checkbox-direction:var(--forge-checkbox-direction, initial);--_checkbox-state-layer-width:var(--forge-checkbox-state-layer-width, var(--_checkbox-state-layer-size));--_checkbox-state-layer-height:var(--forge-checkbox-state-layer-height, var(--_checkbox-state-layer-size));--_checkbox-state-layer-checked-color:var(--forge-checkbox-state-layer-checked-color, var(--_checkbox-primary-color));--_checkbox-state-layer-unchecked-color:var(--forge-checkbox-state-layer-unchecked-color, var(--_checkbox-color));--_checkbox-state-layer-shape:var(--forge-checkbox-state-layer-shape, var(--forge-shape-full, 9999px));--_checkbox-dense-gap:var(--forge-checkbox-dense-gap, 8px);--_checkbox-state-layer-dense-width:var(--forge-checkbox-state-layer-dense-width, var(--_checkbox-state-layer-dense-size));--_checkbox-state-layer-dense-height:var(--forge-checkbox-state-layer-dense-height, var(--_checkbox-state-layer-dense-size));--_checkbox-disabled-opacity:var(--forge-checkbox-disabled-opacity, 0.38);--_checkbox-animation-duration:var(--forge-checkbox-animation-duration, var(--forge-animation-duration-short2, 100ms));--_checkbox-background-animation-timing:var(--forge-checkbox-background-animation-timing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_checkbox-icon-animation-timing:var(--forge-checkbox-icon-animation-timing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)))}.forge-checkbox{position:relative;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:var(--_checkbox-direction);flex-shrink:0;-webkit-box-align:center;align-items:center;-webkit-box-pack:var(--_checkbox-justify);justify-content:var(--_checkbox-justify);gap:var(--_checkbox-gap);display:-webkit-box;display:flex}.forge-checkbox .container{position:relative;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;display:-webkit-box;display:flex;border-radius:var(--_checkbox-state-layer-shape);inline-size:var(--_checkbox-state-layer-width);block-size:var(--_checkbox-state-layer-height);cursor:pointer}.forge-checkbox .background{position:relative;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;display:-webkit-box;display:flex;-webkit-transition-property:background,border-width,border-color;transition-property:background,border-width,border-color;-webkit-transition-duration:var(--_checkbox-animation-duration);transition-duration:var(--_checkbox-animation-duration);-webkit-transition-timing-function:var(--_checkbox-background-animation-timing);transition-timing-function:var(--_checkbox-background-animation-timing);-webkit-box-shadow:var(--_checkbox-elevation);box-shadow:var(--_checkbox-elevation);border-style:solid;border-width:var(--_checkbox-unchecked-border-width);border-color:var(--_checkbox-unchecked-border-color);border-radius:var(--_checkbox-shape);-webkit-box-sizing:border-box;box-sizing:border-box;block-size:var(--_checkbox-height);inline-size:var(--_checkbox-width);background:var(--_checkbox-background)}.forge-checkbox .icon{position:absolute;-webkit-transition-property:stroke-dashoffset;transition-property:stroke-dashoffset;-webkit-transition-duration:var(--_checkbox-animation-duration);transition-duration:var(--_checkbox-animation-duration);-webkit-transition-timing-function:var(--_checkbox-icon-animation-timing);transition-timing-function:var(--_checkbox-icon-animation-timing);fill:none;stroke-width:var(--_checkbox-icon-stroke-width)}.forge-checkbox .icon--checked{stroke:var(--_checkbox-icon-checked-color);stroke-dasharray:30;-webkit-transition-delay:0s;transition-delay:0s;stroke-dashoffset:30}.forge-checkbox .icon--indeterminate{stroke:var(--_checkbox-icon-indeterminate-color);stroke-dasharray:20;-webkit-transition-delay:0s;transition-delay:0s;stroke-dashoffset:20}.forge-checkbox .label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-label1-font-family, var(--forge-typography-font-family, "Roboto", sans-serif));font-size:var(--forge-typography-label1-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-font-size-scale, .75)));font-weight:var(--forge-typography-label1-font-weight,400);line-height:var(--forge-typography-label1-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-label-line-height-scale, 1.25)));letter-spacing:var(--forge-typography-label1-letter-spacing, .0357142857em);text-transform:var(--forge-typography-label1-text-transform,inherit);-webkit-text-decoration:var(--forge-typography-label1-text-decoration,inherit);text-decoration:var(--forge-typography-label1-text-decoration,inherit);cursor:default}:host([checked]) .background{border-style:solid;border-width:var(--_checkbox-checked-border-width);border-color:var(--_checkbox-checked-border-color);background:var(--_checkbox-checked-background)}:host([checked]) .icon--checked{-webkit-transition-delay:var(--_checkbox-animation-duration);transition-delay:var(--_checkbox-animation-duration);stroke-dashoffset:0}:host([checked]) .icon--checked:dir(rtl){stroke-dashoffset:60}:host([checked]) .icon--indeterminate{-webkit-transition-delay:0s;transition-delay:0s;stroke-dashoffset:20}:host([checked]) forge-state-layer{--forge-state-layer-color:var(--_checkbox-state-layer-checked-color)}:host([indeterminate]) .background{border-style:solid;border-width:var(--_checkbox-checked-border-width);border-color:var(--_checkbox-checked-border-color);background:var(--_checkbox-checked-background)}:host([indeterminate]) .icon--checked{-webkit-transition-delay:0s;transition-delay:0s;stroke-dashoffset:30}:host([indeterminate]) .icon--indeterminate{-webkit-transition-delay:var(--_checkbox-animation-duration);transition-delay:var(--_checkbox-animation-duration);stroke-dashoffset:0}:host([indeterminate]) .icon--indeterminate:dir(rtl){stroke-dashoffset:40}:host([indeterminate]) forge-state-layer{--forge-state-layer-color:var(--_checkbox-state-layer-checked-color)}:host([dense]) .forge-checkbox{--_checkbox-gap:var(--_checkbox-dense-gap)}:host([dense]) .forge-checkbox .container{inline-size:var(--_checkbox-state-layer-dense-width);block-size:var(--_checkbox-state-layer-dense-height)}:host([disabled]) .forge-checkbox{opacity:var(--_checkbox-disabled-opacity)}:host([disabled]) .forge-checkbox .container{cursor:not-allowed}:host([readonly]) .forge-checkbox .container{cursor:not-allowed}@media (prefers-reduced-motion){.forge-checkbox{--_checkbox-animation-duration:var(--forge-checkbox-animation-duration, 0s)}}forge-state-layer{--forge-state-layer-color:var(--_checkbox-state-layer-unchecked-color)}forge-focus-indicator{--forge-focus-indicator-shape:0px;--forge-focus-indicator-outward-offset:8px}',U=R(N(F(z(O(y))))),r=class extends U{constructor(){super();x(this,M,W),this[I]="checkbox",this._foundation=new k(new b(this))}static get observedAttributes(){return Object.values(o.observedAttributes)}connectedCallback(){super.connectedCallback(),this[l]({role:"checkbox",ariaChecked:this.checked?"true":"false",ariaDisabled:this.disabled?"true":"false",ariaRequired:this.required?"true":"false"}),this._foundation.initialize()}attributeChangedCallback(t,a,i){switch(t){case o.observedAttributes.CHECKED:this.checked=s(i);break;case o.observedAttributes.DEFAULT_CHECKED:this.defaultChecked=s(i);break;case o.observedAttributes.INDETERMINATE:this.indeterminate=s(i);break;case o.observedAttributes.VALUE:this.value=i;break;case o.observedAttributes.DENSE:this.dense=s(i);break;case o.observedAttributes.DISABLED:this.disabled=s(i);break;case o.observedAttributes.REQUIRED:this.required=s(i);break;case o.observedAttributes.READONLY:this.readonly=s(i);break;case o.observedAttributes.LABEL_POSITION:this.labelPosition=i;break}super.attributeChangedCallback(t,a,i)}[L](){return this.checked?this.value:null}[w](){return this.checked?this.indeterminate?"checked-indeterminate":"checked":this.indeterminate?"unchecked-indeterminate":"unchecked"}[d](){this[m].setValidity({valueMissing:this.required&&!this.checked},this[A]({checked:this.checked,required:this.required}))}formResetCallback(){this.checked=this.defaultChecked}formStateRestoreCallback(t){this.checked=t==="checked"||t==="checked-indeterminate",this.indeterminate=t==="unchecked-indeterminate"||t==="checked-indeterminate"}labelClickedCallback(){this.click(),this.focus()}labelChangedCallback(t){this[l]({ariaLabel:t})}setFormValue(t,a){if(this[m].setFormValue(t,a),a){let i=p(a)?a:a[this.name];this.checked=i==="checked"||i==="checked-indeterminate",this.indeterminate=i==="unchecked-indeterminate"||i==="checked-indeterminate";return}p(t)?this.checked=!!t:t!=null&&t[this.name]?this.checked=!!t[this.name]:this.checked=!1}toggle(t){g(t)?this._foundation.checked=t:this._foundation.checked=!this._foundation.checked}};n([c()],r.prototype,"checked",2),n([c()],r.prototype,"defaultChecked",2),n([c()],r.prototype,"indeterminate",2),n([c()],r.prototype,"value",2),n([c()],r.prototype,"dense",2),n([c()],r.prototype,"disabled",2),n([c()],r.prototype,"required",2),n([c()],r.prototype,"readonly",2),n([c()],r.prototype,"labelPosition",2),r=n([v({name:o.elementName,dependencies:[T,S]})],r);var q=class extends P{constructor(e){super(e)}get value(){return this._element.value}set value(e){this._element.value=e}get checked(){return this._element.checked}set checked(e){this._element.checked=e}get defaultChecked(){return this._element.defaultChecked}set defaultChecked(e){this._element.defaultChecked=e}get disabled(){return this._element.disabled}set disabled(e){this._element.disabled=e}get indeterminate(){return this._element.indeterminate}set indeterminate(e){this._element.indeterminate=e}get dense(){return this._element.dense}set dense(e){this._element.dense=e}get required(){return this._element.required}set required(e){this._element.required=e}get readonly(){return this._element.readonly}set readonly(e){this._element.readonly=e}get name(){return this._element.name}set name(e){this._element.name=e}get labelPosition(){return this._element.labelPosition}set labelPosition(e){this._element.labelPosition=e}onChange(e){this._element.addEventListener("change",t=>e(t.target.checked))}onFocus(e){this._element.addEventListener("focus",t=>e(t))}onBlur(e){this._element.addEventListener("blur",t=>e(t))}setLabel(e){this._element.innerText=e!=null?e:""}toggle(e){this._element.toggle(e)}_build(){return document.createElement(o.elementName)}_configure(){var e,t;(e=this._config.options)!=null&&e.id&&(this._element.id=this._config.options.id),(t=this._config.options)!=null&&t.label&&(this._element.innerText=this._config.options.label)}};function Re(){_(r)}export{o as a,b,k as c,r as d,q as e,Re as f};
|
|
7
|
+
//# sourceMappingURL=chunk.GRYO5XP2.js.map
|