@redvars/peacock 4.8.0 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/checkbox.js +2 -1
  2. package/dist/checkbox.js.map +1 -1
  3. package/dist/custom-elements.json +81 -0
  4. package/dist/date-picker.js +51 -1
  5. package/dist/date-picker.js.map +1 -1
  6. package/dist/{document-editor-CSS-wACs.js → document-editor-W4pXGCEL.js} +13 -1
  7. package/dist/document-editor-W4pXGCEL.js.map +1 -0
  8. package/dist/document-editor.js +1 -1
  9. package/dist/fab-menu.js +3 -0
  10. package/dist/fab-menu.js.map +1 -1
  11. package/dist/haptics-CAaQ2E-9.js +29 -0
  12. package/dist/haptics-CAaQ2E-9.js.map +1 -0
  13. package/dist/index.js +3 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/loader-full.js +2 -1
  16. package/dist/loader-full.js.map +1 -1
  17. package/dist/loader.js +2 -1
  18. package/dist/loader.js.map +1 -1
  19. package/dist/modal.js +12 -1
  20. package/dist/modal.js.map +1 -1
  21. package/dist/radio.js +3 -1
  22. package/dist/radio.js.map +1 -1
  23. package/dist/slider.js +6 -1
  24. package/dist/slider.js.map +1 -1
  25. package/dist/src/__internal/utils/haptics.d.ts +7 -0
  26. package/dist/src/date-picker/date-picker.d.ts +6 -1
  27. package/dist/src/document-editor/document-editor.d.ts +2 -0
  28. package/dist/src/modal/modal.d.ts +4 -0
  29. package/dist/switch.js +2 -1
  30. package/dist/switch.js.map +1 -1
  31. package/dist/test/haptics.test.d.ts +1 -0
  32. package/dist/{toggle-base-DP3PSXbf.js → toggle-base-CVO9YntI.js} +3 -1
  33. package/dist/toggle-base-CVO9YntI.js.map +1 -0
  34. package/dist/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +1 -1
  36. package/src/__internal/toggle-base.ts +2 -0
  37. package/src/__internal/utils/haptics.ts +32 -0
  38. package/src/date-picker/date-picker.scss +27 -0
  39. package/src/date-picker/date-picker.ts +27 -1
  40. package/src/document-editor/document-editor.ts +17 -0
  41. package/src/fab-menu/fab-menu.ts +2 -0
  42. package/src/modal/modal.ts +14 -1
  43. package/src/radio/radio.ts +2 -0
  44. package/src/slider/slider.ts +6 -1
  45. package/dist/document-editor-CSS-wACs.js.map +0 -1
  46. package/dist/toggle-base-DP3PSXbf.js.map +0 -1
package/dist/radio.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"radio.js","sources":["../../src/radio/radio.ts"],"sourcesContent":["import { html, type PropertyValues } from 'lit';\nimport { state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport '@/__internal/agent/toggle-surface.js';\nimport type { AgentToggleChangeEvent } from '@/__internal/agent/toggle-surface.js';\nimport { spread } from '@/__internal/directive/spread.js';\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport ToggleBase from '@/__internal/toggle-base.js';\nimport type { ControlValidity } from '@/__internal/input-base.js';\n\nimport styles from './radio.scss';\n\ntype RadioDirection = 1 | -1;\n\n/**\n * @label Radio\n * @tag wc-radio\n * @rawTag radio\n * @summary A round button for choosing one option from a set; radios that share a name form a group.\n * @overview\n * <p>Radios that share a <code>name</code> form a group. Wrap them in <code>wc-radio-group</code> to get a\n * group label and a single <code>change</code> event for the whole set.</p>\n * <p>The radio is form-associated: the checked radio submits its <code>value</code> under its <code>name</code>.\n * When any radio of a group is <code>required</code>, the group blocks form submission until one is checked.</p>\n *\n * @cssprop --radio-size: Size of the outer radio circle.\n * @cssprop --radio-dot-size: Size of the inner dot when selected.\n * @cssprop --radio-selected-color: Color of the radio when selected.\n * @cssprop --radio-unselected-color: Color of the radio outline when unselected.\n * @cssprop --radio-state-layer-size: Size of the state layer for touch target.\n * @cssprop --radio-disabled-opacity: Opacity applied when the radio is disabled.\n *\n * @fires {CustomEvent<{checked: boolean, value: string, originalEvent?: Event}>} change - Dispatched when the radio is selected.\n *\n * @example\n * ```html\n * <wc-radio name=\"fruits\" value=\"apple\" label=\"Apple\"></wc-radio>\n * ```\n * @tags input, form\n */\nexport class Radio extends ToggleBase {\n // ── Static ───────────────────────────────────────────────────────────────\n\n private static readonly DIRECTION_NEXT: RadioDirection = 1;\n\n private static readonly DIRECTION_PREVIOUS: RadioDirection = -1;\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n // `name` (which groups radios), `disabled`, `required`, `readonly`, `label`, `checked`, `value`\n // and `configAria` are inherited.\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** True for the one radio in the group that should receive tab focus (roving tabindex). */\n @state()\n private isGroupFocusTarget = false;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n protected override firstUpdated() {\n this.updateGroupFocusTarget();\n }\n\n protected override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n\n if (changed.has('checked') && this.checked) {\n this.uncheckSiblings();\n }\n\n if (changed.has('checked') || changed.has('name')) {\n this.updateGroupFocusTarget();\n }\n\n if (changed.has('checked') || changed.has('required')) {\n // Group validity depends on every radio; let the others recompute theirs.\n for (const radio of this.getGroupRadios()) {\n if (radio !== this) radio.requestUpdate();\n }\n }\n }\n\n // ── Protected methods ────────────────────────────────────────────────────\n\n /** A radio submits nothing but its `value`; there is no `\"on\"` default to show. */\n protected override get defaultToggleValue(): string {\n return '';\n }\n\n /** Invalid while any radio of the group is required and none is checked. */\n protected override computeValidity(): ControlValidity {\n const group = this.getGroupRadios();\n const required = group.some(radio => radio.required);\n const checked = group.some(radio => radio.checked);\n if (required && !checked && !this.disabled) {\n return {\n flags: { valueMissing: true },\n message: peacockString('valueMissingRadio'),\n };\n }\n return { flags: {}, message: '' };\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private keyDownHandler = (event: KeyboardEvent) => {\n if (event.key === ' ') {\n event.preventDefault();\n this.isActive = true;\n this.selectRadio(event);\n } else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n event.preventDefault();\n this.navigateGroup(Radio.DIRECTION_NEXT);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n event.preventDefault();\n this.navigateGroup(Radio.DIRECTION_PREVIOUS);\n }\n };\n\n private clickHandler = (event: MouseEvent) => {\n this.selectRadio(event);\n };\n\n /** An agent's `select`, offered as a suggestion. Clearing a radio is refused: it has no such action. */\n private _handleAgentChange(event: AgentToggleChangeEvent) {\n event.stopPropagation();\n if (!event.detail.value || !this.applyAgentChange(true)) {\n event.preventDefault();\n }\n }\n\n private selectRadio(event?: Event) {\n if (this.disabled || this.readonly) return;\n\n if (!this.checked) {\n this.checked = true;\n this.uncheckSiblings();\n this.dispatchChange(event);\n }\n\n this.containerElement?.focus();\n }\n\n private uncheckSiblings() {\n if (!this.name || !this.checked) return;\n for (const radio of this.getGroupRadios()) {\n if (radio !== this) radio.checked = false;\n }\n }\n\n private getGroupRadios(): Radio[] {\n if (!this.name) return [this];\n // A radio group or form scopes the name; otherwise the radio's own tree (document or the\n // shadow root it was rendered into).\n const scopeRoot = (this.closest('wc-radio-group, form') ??\n this.getRootNode()) as ParentNode;\n return Array.from(\n scopeRoot.querySelectorAll<Radio>(\n `wc-radio[name=\"${CSS.escape(this.name)}\"]`,\n ),\n );\n }\n\n private static isRadioEnabled(radio: Radio) {\n return !radio.disabled && !radio.readonly;\n }\n\n private updateGroupFocusTarget() {\n const group = this.getGroupRadios();\n if (!group.length) return;\n\n const enabledGroup = group.filter(radio => Radio.isRadioEnabled(radio));\n if (!enabledGroup.length) {\n group.forEach(radio => {\n radio.isGroupFocusTarget = false;\n });\n return;\n }\n\n const target = enabledGroup.find(radio => radio.checked) || enabledGroup[0];\n\n group.forEach(radio => {\n radio.isGroupFocusTarget = radio === target;\n });\n }\n\n private navigateGroup(direction: RadioDirection) {\n const group = this.getGroupRadios().filter(radio =>\n Radio.isRadioEnabled(radio),\n );\n if (!group.length) return;\n\n const currentIndex = group.indexOf(this);\n const startIndex = currentIndex >= 0 ? currentIndex : 0;\n const nextIndex = (startIndex + direction + group.length) % group.length;\n const target = group[nextIndex];\n\n target.selectRadio();\n target.containerElement?.focus();\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const cssClasses = {\n radio: true,\n 'state-checked': this.checked,\n 'has-focus': this.hasFocus,\n active: this.isActive,\n disabled: this.disabled,\n readonly: this.readonly,\n required: this.required,\n 'has-content': this.slotHasContent,\n };\n\n const attributes = this.controlAttributes();\n if (!this.isGroupFocusTarget) attributes.tabindex = '-1';\n\n return html`\n <label class=${classMap(cssClasses)}>\n <agent-radio\n .checked=${!!this.checked}\n .disabled=${this.disabled || !this.agentAvailable}\n .readOnly=${this.readonly}\n .required=${this.required}\n @checkedchange=${this._handleAgentChange}\n >\n <div\n class=\"container\"\n role=\"radio\"\n aria-checked=${String(this.checked)}\n @mousedown=${this.handleMouseDown}\n @keydown=${this.keyDownHandler}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n ${spread({\n ...attributes,\n // Named for the agent bridge (ADR-030004): its name comes from the label or slotted text.\n 'aria-label': this.label || this.textContent?.trim() || undefined,\n })}\n >\n <div class=\"state-layer\"></div>\n <div class=\"outer-circle\"></div>\n <div class=\"inner-circle\"></div>\n </div>\n </agent-radio>\n\n <input\n type=\"radio\"\n class=\"input-native\"\n .value=${this.value}\n .checked=${this.checked}\n aria-hidden=\"true\"\n ?disabled=${this.disabled}\n tabindex=\"-1\"\n @click=${this.clickHandler}\n />\n\n ${this.renderLabel()}\n </label>\n `;\n }\n}\n"],"names":["html","classMap","styles","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG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B,UAAA,CAAA;AADP,IAAAC,CAAK;AAC6B,CAAA,EAAA,KAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,MAAA,CAAA;;;;"}
1
+ {"version":3,"file":"radio.js","sources":["../../src/radio/radio.ts"],"sourcesContent":["import { html, type PropertyValues } from 'lit';\nimport { state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport '@/__internal/agent/toggle-surface.js';\nimport type { AgentToggleChangeEvent } from '@/__internal/agent/toggle-surface.js';\nimport { spread } from '@/__internal/directive/spread.js';\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport ToggleBase from '@/__internal/toggle-base.js';\nimport type { ControlValidity } from '@/__internal/input-base.js';\n\nimport styles from './radio.scss';\nimport { haptic } from '../__internal/utils/haptics.js';\n\ntype RadioDirection = 1 | -1;\n\n/**\n * @label Radio\n * @tag wc-radio\n * @rawTag radio\n * @summary A round button for choosing one option from a set; radios that share a name form a group.\n * @overview\n * <p>Radios that share a <code>name</code> form a group. Wrap them in <code>wc-radio-group</code> to get a\n * group label and a single <code>change</code> event for the whole set.</p>\n * <p>The radio is form-associated: the checked radio submits its <code>value</code> under its <code>name</code>.\n * When any radio of a group is <code>required</code>, the group blocks form submission until one is checked.</p>\n *\n * @cssprop --radio-size: Size of the outer radio circle.\n * @cssprop --radio-dot-size: Size of the inner dot when selected.\n * @cssprop --radio-selected-color: Color of the radio when selected.\n * @cssprop --radio-unselected-color: Color of the radio outline when unselected.\n * @cssprop --radio-state-layer-size: Size of the state layer for touch target.\n * @cssprop --radio-disabled-opacity: Opacity applied when the radio is disabled.\n *\n * @fires {CustomEvent<{checked: boolean, value: string, originalEvent?: Event}>} change - Dispatched when the radio is selected.\n *\n * @example\n * ```html\n * <wc-radio name=\"fruits\" value=\"apple\" label=\"Apple\"></wc-radio>\n * ```\n * @tags input, form\n */\nexport class Radio extends ToggleBase {\n // ── Static ───────────────────────────────────────────────────────────────\n\n private static readonly DIRECTION_NEXT: RadioDirection = 1;\n\n private static readonly DIRECTION_PREVIOUS: RadioDirection = -1;\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n // `name` (which groups radios), `disabled`, `required`, `readonly`, `label`, `checked`, `value`\n // and `configAria` are inherited.\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** True for the one radio in the group that should receive tab focus (roving tabindex). */\n @state()\n private isGroupFocusTarget = false;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n protected override firstUpdated() {\n this.updateGroupFocusTarget();\n }\n\n protected override updated(changed: PropertyValues<this>) {\n super.updated(changed);\n\n if (changed.has('checked') && this.checked) {\n this.uncheckSiblings();\n }\n\n if (changed.has('checked') || changed.has('name')) {\n this.updateGroupFocusTarget();\n }\n\n if (changed.has('checked') || changed.has('required')) {\n // Group validity depends on every radio; let the others recompute theirs.\n for (const radio of this.getGroupRadios()) {\n if (radio !== this) radio.requestUpdate();\n }\n }\n }\n\n // ── Protected methods ────────────────────────────────────────────────────\n\n /** A radio submits nothing but its `value`; there is no `\"on\"` default to show. */\n protected override get defaultToggleValue(): string {\n return '';\n }\n\n /** Invalid while any radio of the group is required and none is checked. */\n protected override computeValidity(): ControlValidity {\n const group = this.getGroupRadios();\n const required = group.some(radio => radio.required);\n const checked = group.some(radio => radio.checked);\n if (required && !checked && !this.disabled) {\n return {\n flags: { valueMissing: true },\n message: peacockString('valueMissingRadio'),\n };\n }\n return { flags: {}, message: '' };\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private keyDownHandler = (event: KeyboardEvent) => {\n if (event.key === ' ') {\n event.preventDefault();\n this.isActive = true;\n this.selectRadio(event);\n } else if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n event.preventDefault();\n this.navigateGroup(Radio.DIRECTION_NEXT);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n event.preventDefault();\n this.navigateGroup(Radio.DIRECTION_PREVIOUS);\n }\n };\n\n private clickHandler = (event: MouseEvent) => {\n this.selectRadio(event);\n };\n\n /** An agent's `select`, offered as a suggestion. Clearing a radio is refused: it has no such action. */\n private _handleAgentChange(event: AgentToggleChangeEvent) {\n event.stopPropagation();\n if (!event.detail.value || !this.applyAgentChange(true)) {\n event.preventDefault();\n }\n }\n\n private selectRadio(event?: Event) {\n if (this.disabled || this.readonly) return;\n\n if (!this.checked) {\n this.checked = true;\n this.uncheckSiblings();\n haptic('toggle');\n this.dispatchChange(event);\n }\n\n this.containerElement?.focus();\n }\n\n private uncheckSiblings() {\n if (!this.name || !this.checked) return;\n for (const radio of this.getGroupRadios()) {\n if (radio !== this) radio.checked = false;\n }\n }\n\n private getGroupRadios(): Radio[] {\n if (!this.name) return [this];\n // A radio group or form scopes the name; otherwise the radio's own tree (document or the\n // shadow root it was rendered into).\n const scopeRoot = (this.closest('wc-radio-group, form') ??\n this.getRootNode()) as ParentNode;\n return Array.from(\n scopeRoot.querySelectorAll<Radio>(\n `wc-radio[name=\"${CSS.escape(this.name)}\"]`,\n ),\n );\n }\n\n private static isRadioEnabled(radio: Radio) {\n return !radio.disabled && !radio.readonly;\n }\n\n private updateGroupFocusTarget() {\n const group = this.getGroupRadios();\n if (!group.length) return;\n\n const enabledGroup = group.filter(radio => Radio.isRadioEnabled(radio));\n if (!enabledGroup.length) {\n group.forEach(radio => {\n radio.isGroupFocusTarget = false;\n });\n return;\n }\n\n const target = enabledGroup.find(radio => radio.checked) || enabledGroup[0];\n\n group.forEach(radio => {\n radio.isGroupFocusTarget = radio === target;\n });\n }\n\n private navigateGroup(direction: RadioDirection) {\n const group = this.getGroupRadios().filter(radio =>\n Radio.isRadioEnabled(radio),\n );\n if (!group.length) return;\n\n const currentIndex = group.indexOf(this);\n const startIndex = currentIndex >= 0 ? currentIndex : 0;\n const nextIndex = (startIndex + direction + group.length) % group.length;\n const target = group[nextIndex];\n\n target.selectRadio();\n target.containerElement?.focus();\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const cssClasses = {\n radio: true,\n 'state-checked': this.checked,\n 'has-focus': this.hasFocus,\n active: this.isActive,\n disabled: this.disabled,\n readonly: this.readonly,\n required: this.required,\n 'has-content': this.slotHasContent,\n };\n\n const attributes = this.controlAttributes();\n if (!this.isGroupFocusTarget) attributes.tabindex = '-1';\n\n return html`\n <label class=${classMap(cssClasses)}>\n <agent-radio\n .checked=${!!this.checked}\n .disabled=${this.disabled || !this.agentAvailable}\n .readOnly=${this.readonly}\n .required=${this.required}\n @checkedchange=${this._handleAgentChange}\n >\n <div\n class=\"container\"\n role=\"radio\"\n aria-checked=${String(this.checked)}\n @mousedown=${this.handleMouseDown}\n @keydown=${this.keyDownHandler}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n ${spread({\n ...attributes,\n // Named for the agent bridge (ADR-030004): its name comes from the label or slotted text.\n 'aria-label': this.label || this.textContent?.trim() || undefined,\n })}\n >\n <div class=\"state-layer\"></div>\n <div class=\"outer-circle\"></div>\n <div class=\"inner-circle\"></div>\n </div>\n </agent-radio>\n\n <input\n type=\"radio\"\n class=\"input-native\"\n .value=${this.value}\n .checked=${this.checked}\n aria-hidden=\"true\"\n ?disabled=${this.disabled}\n tabindex=\"-1\"\n @click=${this.clickHandler}\n />\n\n ${this.renderLabel()}\n </label>\n `;\n }\n}\n"],"names":["html","classMap","styles","state"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,MAAO,KAAM,SAAQ,UAAU,CAAA;AAArC,IAAA,WAAA,GAAA;;;;;;;;QAiBU,IAAA,CAAA,kBAAkB,GAAG,KAAK;;AAkD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AAA,MAAA,CAAA;;;;"}
package/dist/slider.js CHANGED
@@ -6,6 +6,7 @@ import { e as e$1 } from './class-map-DN-g_e4M.js';
6
6
  import { o } from './style-map-D1ZICebN.js';
7
7
  import { I as InputBase } from './input-base-u60DF-pm.js';
8
8
  import { I as I18nController } from './i18n-controller-BTeChxE0.js';
9
+ import { h as haptic } from './haptics-CAaQ2E-9.js';
9
10
  import './base-Cl6v8-BZ.js';
10
11
  import './directive-ZPhl09Yt.js';
11
12
  import './element-internals-QME0yEz4.js';
@@ -437,8 +438,12 @@ class Slider extends InputBase {
437
438
  const steppedValue = this.snapToStep(rawValue);
438
439
  const oldValue = this.value;
439
440
  this.value = Math.max(this.min, Math.min(this.max, steppedValue));
440
- if (oldValue !== this.value)
441
+ if (oldValue !== this.value) {
442
+ // A tick per step on a stepped slider; a near-continuous one stays quiet.
443
+ if ((this.max - this.min) / this.step <= 20)
444
+ haptic('tick');
441
445
  this.emit('input');
446
+ }
442
447
  }
443
448
  onMouseDown(e) {
444
449
  if (!this.isInteractive)
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","sources":["../../src/slider/slider.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport type { FormRestoreState } from '@/__internal/mixins/form-associated.js';\nimport type { ScaleSize } from '@/__internal/utils/size.js';\nimport InputBase, { type ControlValidity } from '@/__internal/input-base.js';\nimport sliderStyles from './slider.scss';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\n\nlet sliderCount = 0;\n\n/** Handle half-width plus the gap on each side of it, in px (matches `--_handle-space`). */\nconst HANDLE_SPACE_PX = 8;\n\n/** Room the inset icon needs on the active track: icon plus inset on both sides, in px. */\nconst ICON_ROOM = { md: 40, lg: 48, xl: 64 } as const;\n\n/** Where the slider shows its value: on the thumb while it is used, after the track, or not. */\nexport type SliderValueLabel = 'thumb' | 'end' | 'none';\n\n/**\n * @label Slider\n * @tag wc-slider\n * @rawTag slider\n *\n * @summary A track with a thumb the person drags to pick a number from a range.\n * @overview\n * <p>The slider is form-associated: its <code>value</code> is submitted under its <code>name</code>,\n * and <code>form.reset()</code> restores the starting value. Without a <code>value</code> it starts\n * at the middle of <code>min</code>–<code>max</code>, like a native range input.</p>\n * <p><code>label</code> is shown above the track, as on fields, and names the thumb; without it the\n * thumb is named \"Slider\". <code>value-text</code> (the <code>valueText</code> property) formats\n * the value for <code>aria-valuetext</code> and the visible value, for example\n * <code>v =&gt; `${v}%`</code>.</p>\n * <p><code>required</code> does not apply: a slider always has a value. <code>readonly</code> keeps\n * it focusable but its value cannot change.</p>\n * <p>The look follows Material 3 Expressive: a thick track split around a slim handle, a stop\n * dot at the end, five <code>size</code>s, and an optional <code>icon</code> inside the track.</p>\n * <p>Keyboard: the arrows move one step (ten with Shift), Page Up and Page Down move ten steps,\n * Home and End go to <code>min</code> and <code>max</code>.</p>\n *\n * @fires {CustomEvent<{value: number}>} input - Dispatched when the slider value changes during interaction.\n * @fires {CustomEvent<{value: number}>} change - Dispatched when the slider interaction ends.\n *\n * @example\n * ```html\n * <wc-slider label=\"Volume\" min=\"0\" max=\"100\" value=\"50\"></wc-slider>\n * ```\n * @tags input, form\n */\nexport class Slider extends InputBase {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [sliderStyles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n // `name` and `disabled` come from mixinFormAssociated; `readonly` and `required` from InputBase.\n\n /**\n * The minimum value of the slider.\n */\n @property({ type: Number }) min = 0;\n\n /**\n * The maximum value of the slider.\n */\n @property({ type: Number }) max = 100;\n\n /**\n * The current value of the slider. Defaults to the middle of `min`–`max`.\n */\n @property({ type: Number })\n get value(): number {\n return this.explicitValue ?? this.snapToStep((this.min + this.max) / 2);\n }\n\n set value(value: number | undefined | null) {\n const old = this.value;\n this.explicitValue =\n value === undefined || value === null || Number.isNaN(Number(value))\n ? undefined\n : Number(value);\n this.requestUpdate('value', old);\n }\n\n /**\n * The step increment for the slider.\n */\n @property({ type: Number }) step = 1;\n\n /** Label shown above the slider; also the thumb's accessible name. */\n @property({ type: String }) label = '';\n\n /** Help text shown below the slider. */\n @property({ type: String, attribute: 'helper-text' }) helperText = '';\n\n /** Shows the slider in its error state with `error-text`. */\n @property({ type: Boolean, reflect: true }) error = false;\n\n /** Error message shown below the slider while `error` is set; replaces the help text. */\n @property({ type: String, attribute: 'error-text' }) errorText = '';\n\n /**\n * Size of the track and handle, from the M3 Expressive scale: `xs` (16px track, the default),\n * `sm` (24px), `md` (40px), `lg` (56px) or `xl` (96px).\n */\n @property({ type: String, reflect: true }) size: ScaleSize = 'xs';\n\n /**\n * Name of an icon shown inside the track, at its start (`md` and larger). It sits on the active\n * part while it fits there, else just after the handle.\n */\n @property({ type: String }) icon?: string;\n\n /**\n * Where the value shows: `thumb` (on the thumb while it is used; the default), `end` (after the\n * track) or `none`.\n */\n @property({ type: String, attribute: 'value-label' })\n valueLabel: SliderValueLabel = 'thumb';\n\n /** Formats the value for `aria-valuetext` and the visible value. */\n @property({ attribute: false })\n valueText?: (value: number) => string;\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** True while the user is actively dragging the thumb. */\n @state() private isDragging = false;\n\n /** Width of the track in px, for placing the inset icon. */\n @state() private trackWidth = 0;\n\n private resizeObserver?: ResizeObserver;\n\n // ── Queries ──────────────────────────────────────────────────────────────\n\n @query('.slider-container') private container!: HTMLElement;\n\n @query('.thumb') private thumbElement!: HTMLElement;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** The value set by the consumer or the person; `undefined` means the midpoint. */\n private explicitValue?: number;\n\n /** Whether a value was given when first connected; reset returns to the midpoint otherwise. */\n private startedWithValue?: boolean;\n\n private readonly idPrefix = `wc-slider-${(sliderCount += 1)}`;\n\n /** Peacock's strings for the thumb label. */\n private readonly i18n = new I18nController(this);\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n override connectedCallback() {\n this.startedWithValue ??= this.explicitValue !== undefined;\n super.connectedCallback();\n }\n\n override firstUpdated() {\n this.resizeObserver = new ResizeObserver(([entry]) => {\n this.trackWidth = entry.contentRect.width;\n });\n this.resizeObserver.observe(this.container);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n }\n\n // ── Public methods ───────────────────────────────────────────────────────\n\n override focus() {\n this.thumbElement?.focus();\n }\n\n override blur() {\n this.thumbElement?.blur();\n }\n\n // ── Form association ─────────────────────────────────────────────────────\n\n override formResetCallback() {\n super.formResetCallback();\n if (!this.startedWithValue) this.value = undefined;\n }\n\n protected override parseRestoreState(restored: FormRestoreState): unknown {\n const value = Number(restored);\n return typeof restored === 'string' && !Number.isNaN(value)\n ? value\n : this.value;\n }\n\n // ── Protected methods ────────────────────────────────────────────────────\n\n /** A slider always has a value in range, so only `setCustomValidity()` makes it invalid. */\n protected override computeValidity(): ControlValidity {\n return { flags: {}, message: '' };\n }\n\n protected override validityAnchor() {\n return this.thumbElement;\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private get isInteractive(): boolean {\n return !this.disabled && !this.readonly;\n }\n\n /** Where the value shows, from `value-label`. */\n private get valuePlacement(): { thumb: boolean; end: boolean } {\n return {\n thumb: this.valueLabel === 'thumb',\n end: this.valueLabel === 'end',\n };\n }\n\n private formatValue(value: number): string {\n return this.valueText ? this.valueText(value) : String(value);\n }\n\n private emit(type: 'input' | 'change') {\n this.dispatchEvent(\n new CustomEvent(type, {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleInput(event: MouseEvent | TouchEvent) {\n if (!this.isInteractive) return;\n\n const rect = this.container.getBoundingClientRect();\n const clientX =\n 'touches' in event\n ? event.touches[0].clientX\n : (event as MouseEvent).clientX;\n\n // Calculate percentage relative to track width\n let percentage = (clientX - rect.left) / rect.width;\n percentage = Math.max(0, Math.min(1, percentage));\n\n const rawValue = this.min + percentage * (this.max - this.min);\n const steppedValue = this.snapToStep(rawValue);\n\n const oldValue = this.value;\n this.value = Math.max(this.min, Math.min(this.max, steppedValue));\n\n if (oldValue !== this.value) this.emit('input');\n }\n\n private onMouseDown(e: MouseEvent | TouchEvent) {\n if (!this.isInteractive) return;\n\n e.preventDefault();\n this.isDragging = true;\n\n // Add dragging class for CSS state\n this.container.classList.add('dragging');\n this.thumbElement.classList.add('dragging');\n\n this.handleInput(e);\n\n window.addEventListener('mousemove', this.onMouseMove);\n window.addEventListener('mouseup', this.onMouseUp);\n window.addEventListener('touchmove', this.onMouseMove, { passive: false });\n window.addEventListener('touchend', this.onMouseUp);\n window.addEventListener('touchcancel', this.onMouseUp);\n }\n\n private onMouseMove = (e: MouseEvent | TouchEvent) => {\n if (this.isDragging) {\n e.preventDefault();\n this.handleInput(e);\n }\n };\n\n private onMouseUp = () => {\n if (!this.isDragging) return;\n\n this.isDragging = false;\n this.container.classList.remove('dragging');\n this.thumbElement.classList.remove('dragging');\n\n this.emit('change');\n\n window.removeEventListener('mousemove', this.onMouseMove);\n window.removeEventListener('mouseup', this.onMouseUp);\n window.removeEventListener('touchmove', this.onMouseMove);\n window.removeEventListener('touchend', this.onMouseUp);\n window.removeEventListener('touchcancel', this.onMouseUp);\n };\n\n /**\n * Rounds a value to the nearest step counted from `min`, like a native range input, so a slider\n * with `min=\"1\" step=\"5\"` lands on 1, 6, 11. Rounds away float noise from fractional steps.\n */\n private snapToStep(raw: number): number {\n if (!(this.step > 0)) return raw;\n const stepped =\n this.min + Math.round((raw - this.min) / this.step) * this.step;\n const decimals = Math.max(\n (String(this.step).split('.')[1] ?? '').length,\n (String(this.min).split('.')[1] ?? '').length,\n );\n return Number(stepped.toFixed(decimals));\n }\n\n private handleKeyDown(e: KeyboardEvent) {\n if (!this.isInteractive) return;\n\n const increment = e.shiftKey ? this.step * 10 : this.step;\n const page = this.step * 10;\n const current = this.value;\n let newValue = current;\n\n if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {\n newValue = Math.min(this.max, current + increment);\n } else if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {\n newValue = Math.max(this.min, current - increment);\n } else if (e.key === 'PageUp') {\n newValue = Math.min(this.max, current + page);\n } else if (e.key === 'PageDown') {\n newValue = Math.max(this.min, current - page);\n } else if (e.key === 'Home') {\n newValue = this.min;\n } else if (e.key === 'End') {\n newValue = this.max;\n } else {\n return;\n }\n e.preventDefault();\n\n if (newValue !== current) {\n this.value = newValue;\n this.emit('input');\n this.emit('change');\n }\n }\n\n /** A suggestion for a slider is a number. */\n protected override writeSuggestionValue(value: unknown): void {\n this.value = Number(value);\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n /**\n * The inset icon: on the active part of the track while it fits there, else on the inactive part\n * just after the handle. Shown from `md` up, where the track is tall enough.\n */\n private renderIcon(percentage: number) {\n if (!this.icon || !['md', 'lg', 'xl'].includes(this.size)) return nothing;\n const iconSpace = ICON_ROOM[this.size as 'md' | 'lg' | 'xl'];\n const activeWidth = (percentage / 100) * this.trackWidth - HANDLE_SPACE_PX;\n const onActive = activeWidth >= iconSpace;\n return html`<wc-icon\n class=${classMap({ 'track-icon': true, 'on-active': onActive })}\n name=${this.icon}\n aria-hidden=\"true\"\n style=${styleMap({\n left: onActive\n ? 'var(--_icon-inset)'\n : `calc(${percentage}% + var(--_handle-space) + var(--_icon-inset))`,\n })}\n ></wc-icon>`;\n }\n\n render() {\n const { value } = this;\n const range = this.max - this.min;\n const percentage = range > 0 ? ((value - this.min) / range) * 100 : 0;\n const placement = this.valuePlacement;\n const formatted = this.formatValue(value);\n const labelId = `${this.idPrefix}-label`;\n const descriptionId = `${this.idPrefix}-description`;\n const errorText = this.error ? this.errorText : this.validationText;\n const invalid = this.error || !!errorText;\n const description = errorText || this.suggestionReason || this.helperText;\n\n return html`\n <div\n class=${classMap({\n wrapper: true,\n [`size-${this.size}`]: true,\n disabled: this.disabled,\n readonly: this.readonly,\n error: invalid,\n })}\n >\n ${this.label\n ? this.labelWithSuggestion(\n html`<div class=\"label\" id=${labelId}>${this.label}</div>`,\n )\n : this.suggestionBadge()}\n <div class=\"slider ${placement.end ? 'with-value' : ''}\">\n <div\n class=\"slider-container ${this.disabled ? 'disabled' : ''}\"\n @mousedown=${this.onMouseDown}\n @touchstart=${this.onMouseDown}\n >\n <div\n class=\"track track-active\"\n style=${styleMap({\n width: `max(0px, calc(${percentage}% - var(--_handle-space)))`,\n })}\n ></div>\n <div\n class=\"track track-inactive\"\n style=${styleMap({\n left: `calc(${percentage}% + var(--_handle-space))`,\n })}\n >\n ${percentage < 100 ? html`<span class=\"stop\"></span>` : nothing}\n </div>\n ${this.renderIcon(percentage)}\n\n <div\n class=\"thumb\"\n role=\"slider\"\n aria-label=${this.label ? nothing : this.i18n.t('slider')}\n aria-labelledby=${this.label ? labelId : nothing}\n aria-describedby=${description ? descriptionId : nothing}\n tabindex=\"${this.disabled ? -1 : 0}\"\n aria-valuemin=${this.min}\n aria-valuemax=${this.max}\n aria-valuenow=${value}\n aria-valuetext=${this.valueText ? formatted : nothing}\n aria-disabled=${this.disabled ? 'true' : nothing}\n aria-readonly=${this.readonly ? 'true' : nothing}\n aria-invalid=${invalid ? 'true' : nothing}\n style=${styleMap({\n left: `calc(${percentage}% - var(--_handle-width) / 2)`,\n })}\n @keydown=${this.handleKeyDown}\n >\n ${placement.thumb\n ? html`<div class=\"value-label\">${formatted}</div>`\n : ''}\n </div>\n </div>\n\n ${placement.end\n ? html`<output class=\"value-display\" aria-hidden=\"true\"\n >${formatted}</output\n >`\n : ''}\n </div>\n ${description\n ? html`<div class=\"helper\" id=${descriptionId}>${description}</div>`\n : nothing}\n </div>\n `;\n }\n}\n"],"names":["nothing","html","classMap","styleMap","sliderStyles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,SAAS,EAAE,KAAK,EAAE;AACQ,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAKrB,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAA8B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAGnB,UAAA,CAAA;AAAhB,IAAAA,CAAK;AAA0B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAMI,UAAA,CAAA;IAAnCC,CAAK,CAAC,mBAAmB;AAAkC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAEnC,UAAA,CAAA;IAAxBA,CAAK,CAAC,QAAQ;AAAqC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;;;;"}
1
+ {"version":3,"file":"slider.js","sources":["../../src/slider/slider.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styleMap } from 'lit/directives/style-map.js';\nimport type { FormRestoreState } from '@/__internal/mixins/form-associated.js';\nimport type { ScaleSize } from '@/__internal/utils/size.js';\nimport InputBase, { type ControlValidity } from '@/__internal/input-base.js';\nimport sliderStyles from './slider.scss';\nimport { I18nController } from '@/__internal/i18n/i18n-controller.js';\nimport { haptic } from '../__internal/utils/haptics.js';\n\nlet sliderCount = 0;\n\n/** Handle half-width plus the gap on each side of it, in px (matches `--_handle-space`). */\nconst HANDLE_SPACE_PX = 8;\n\n/** Room the inset icon needs on the active track: icon plus inset on both sides, in px. */\nconst ICON_ROOM = { md: 40, lg: 48, xl: 64 } as const;\n\n/** Where the slider shows its value: on the thumb while it is used, after the track, or not. */\nexport type SliderValueLabel = 'thumb' | 'end' | 'none';\n\n/**\n * @label Slider\n * @tag wc-slider\n * @rawTag slider\n *\n * @summary A track with a thumb the person drags to pick a number from a range.\n * @overview\n * <p>The slider is form-associated: its <code>value</code> is submitted under its <code>name</code>,\n * and <code>form.reset()</code> restores the starting value. Without a <code>value</code> it starts\n * at the middle of <code>min</code>–<code>max</code>, like a native range input.</p>\n * <p><code>label</code> is shown above the track, as on fields, and names the thumb; without it the\n * thumb is named \"Slider\". <code>value-text</code> (the <code>valueText</code> property) formats\n * the value for <code>aria-valuetext</code> and the visible value, for example\n * <code>v =&gt; `${v}%`</code>.</p>\n * <p><code>required</code> does not apply: a slider always has a value. <code>readonly</code> keeps\n * it focusable but its value cannot change.</p>\n * <p>The look follows Material 3 Expressive: a thick track split around a slim handle, a stop\n * dot at the end, five <code>size</code>s, and an optional <code>icon</code> inside the track.</p>\n * <p>Keyboard: the arrows move one step (ten with Shift), Page Up and Page Down move ten steps,\n * Home and End go to <code>min</code> and <code>max</code>.</p>\n *\n * @fires {CustomEvent<{value: number}>} input - Dispatched when the slider value changes during interaction.\n * @fires {CustomEvent<{value: number}>} change - Dispatched when the slider interaction ends.\n *\n * @example\n * ```html\n * <wc-slider label=\"Volume\" min=\"0\" max=\"100\" value=\"50\"></wc-slider>\n * ```\n * @tags input, form\n */\nexport class Slider extends InputBase {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [sliderStyles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n // `name` and `disabled` come from mixinFormAssociated; `readonly` and `required` from InputBase.\n\n /**\n * The minimum value of the slider.\n */\n @property({ type: Number }) min = 0;\n\n /**\n * The maximum value of the slider.\n */\n @property({ type: Number }) max = 100;\n\n /**\n * The current value of the slider. Defaults to the middle of `min`–`max`.\n */\n @property({ type: Number })\n get value(): number {\n return this.explicitValue ?? this.snapToStep((this.min + this.max) / 2);\n }\n\n set value(value: number | undefined | null) {\n const old = this.value;\n this.explicitValue =\n value === undefined || value === null || Number.isNaN(Number(value))\n ? undefined\n : Number(value);\n this.requestUpdate('value', old);\n }\n\n /**\n * The step increment for the slider.\n */\n @property({ type: Number }) step = 1;\n\n /** Label shown above the slider; also the thumb's accessible name. */\n @property({ type: String }) label = '';\n\n /** Help text shown below the slider. */\n @property({ type: String, attribute: 'helper-text' }) helperText = '';\n\n /** Shows the slider in its error state with `error-text`. */\n @property({ type: Boolean, reflect: true }) error = false;\n\n /** Error message shown below the slider while `error` is set; replaces the help text. */\n @property({ type: String, attribute: 'error-text' }) errorText = '';\n\n /**\n * Size of the track and handle, from the M3 Expressive scale: `xs` (16px track, the default),\n * `sm` (24px), `md` (40px), `lg` (56px) or `xl` (96px).\n */\n @property({ type: String, reflect: true }) size: ScaleSize = 'xs';\n\n /**\n * Name of an icon shown inside the track, at its start (`md` and larger). It sits on the active\n * part while it fits there, else just after the handle.\n */\n @property({ type: String }) icon?: string;\n\n /**\n * Where the value shows: `thumb` (on the thumb while it is used; the default), `end` (after the\n * track) or `none`.\n */\n @property({ type: String, attribute: 'value-label' })\n valueLabel: SliderValueLabel = 'thumb';\n\n /** Formats the value for `aria-valuetext` and the visible value. */\n @property({ attribute: false })\n valueText?: (value: number) => string;\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** True while the user is actively dragging the thumb. */\n @state() private isDragging = false;\n\n /** Width of the track in px, for placing the inset icon. */\n @state() private trackWidth = 0;\n\n private resizeObserver?: ResizeObserver;\n\n // ── Queries ──────────────────────────────────────────────────────────────\n\n @query('.slider-container') private container!: HTMLElement;\n\n @query('.thumb') private thumbElement!: HTMLElement;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** The value set by the consumer or the person; `undefined` means the midpoint. */\n private explicitValue?: number;\n\n /** Whether a value was given when first connected; reset returns to the midpoint otherwise. */\n private startedWithValue?: boolean;\n\n private readonly idPrefix = `wc-slider-${(sliderCount += 1)}`;\n\n /** Peacock's strings for the thumb label. */\n private readonly i18n = new I18nController(this);\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n override connectedCallback() {\n this.startedWithValue ??= this.explicitValue !== undefined;\n super.connectedCallback();\n }\n\n override firstUpdated() {\n this.resizeObserver = new ResizeObserver(([entry]) => {\n this.trackWidth = entry.contentRect.width;\n });\n this.resizeObserver.observe(this.container);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n }\n\n // ── Public methods ───────────────────────────────────────────────────────\n\n override focus() {\n this.thumbElement?.focus();\n }\n\n override blur() {\n this.thumbElement?.blur();\n }\n\n // ── Form association ─────────────────────────────────────────────────────\n\n override formResetCallback() {\n super.formResetCallback();\n if (!this.startedWithValue) this.value = undefined;\n }\n\n protected override parseRestoreState(restored: FormRestoreState): unknown {\n const value = Number(restored);\n return typeof restored === 'string' && !Number.isNaN(value)\n ? value\n : this.value;\n }\n\n // ── Protected methods ────────────────────────────────────────────────────\n\n /** A slider always has a value in range, so only `setCustomValidity()` makes it invalid. */\n protected override computeValidity(): ControlValidity {\n return { flags: {}, message: '' };\n }\n\n protected override validityAnchor() {\n return this.thumbElement;\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private get isInteractive(): boolean {\n return !this.disabled && !this.readonly;\n }\n\n /** Where the value shows, from `value-label`. */\n private get valuePlacement(): { thumb: boolean; end: boolean } {\n return {\n thumb: this.valueLabel === 'thumb',\n end: this.valueLabel === 'end',\n };\n }\n\n private formatValue(value: number): string {\n return this.valueText ? this.valueText(value) : String(value);\n }\n\n private emit(type: 'input' | 'change') {\n this.dispatchEvent(\n new CustomEvent(type, {\n detail: { value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private handleInput(event: MouseEvent | TouchEvent) {\n if (!this.isInteractive) return;\n\n const rect = this.container.getBoundingClientRect();\n const clientX =\n 'touches' in event\n ? event.touches[0].clientX\n : (event as MouseEvent).clientX;\n\n // Calculate percentage relative to track width\n let percentage = (clientX - rect.left) / rect.width;\n percentage = Math.max(0, Math.min(1, percentage));\n\n const rawValue = this.min + percentage * (this.max - this.min);\n const steppedValue = this.snapToStep(rawValue);\n\n const oldValue = this.value;\n this.value = Math.max(this.min, Math.min(this.max, steppedValue));\n\n if (oldValue !== this.value) {\n // A tick per step on a stepped slider; a near-continuous one stays quiet.\n if ((this.max - this.min) / this.step <= 20) haptic('tick');\n this.emit('input');\n }\n }\n\n private onMouseDown(e: MouseEvent | TouchEvent) {\n if (!this.isInteractive) return;\n\n e.preventDefault();\n this.isDragging = true;\n\n // Add dragging class for CSS state\n this.container.classList.add('dragging');\n this.thumbElement.classList.add('dragging');\n\n this.handleInput(e);\n\n window.addEventListener('mousemove', this.onMouseMove);\n window.addEventListener('mouseup', this.onMouseUp);\n window.addEventListener('touchmove', this.onMouseMove, { passive: false });\n window.addEventListener('touchend', this.onMouseUp);\n window.addEventListener('touchcancel', this.onMouseUp);\n }\n\n private onMouseMove = (e: MouseEvent | TouchEvent) => {\n if (this.isDragging) {\n e.preventDefault();\n this.handleInput(e);\n }\n };\n\n private onMouseUp = () => {\n if (!this.isDragging) return;\n\n this.isDragging = false;\n this.container.classList.remove('dragging');\n this.thumbElement.classList.remove('dragging');\n\n this.emit('change');\n\n window.removeEventListener('mousemove', this.onMouseMove);\n window.removeEventListener('mouseup', this.onMouseUp);\n window.removeEventListener('touchmove', this.onMouseMove);\n window.removeEventListener('touchend', this.onMouseUp);\n window.removeEventListener('touchcancel', this.onMouseUp);\n };\n\n /**\n * Rounds a value to the nearest step counted from `min`, like a native range input, so a slider\n * with `min=\"1\" step=\"5\"` lands on 1, 6, 11. Rounds away float noise from fractional steps.\n */\n private snapToStep(raw: number): number {\n if (!(this.step > 0)) return raw;\n const stepped =\n this.min + Math.round((raw - this.min) / this.step) * this.step;\n const decimals = Math.max(\n (String(this.step).split('.')[1] ?? '').length,\n (String(this.min).split('.')[1] ?? '').length,\n );\n return Number(stepped.toFixed(decimals));\n }\n\n private handleKeyDown(e: KeyboardEvent) {\n if (!this.isInteractive) return;\n\n const increment = e.shiftKey ? this.step * 10 : this.step;\n const page = this.step * 10;\n const current = this.value;\n let newValue = current;\n\n if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {\n newValue = Math.min(this.max, current + increment);\n } else if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {\n newValue = Math.max(this.min, current - increment);\n } else if (e.key === 'PageUp') {\n newValue = Math.min(this.max, current + page);\n } else if (e.key === 'PageDown') {\n newValue = Math.max(this.min, current - page);\n } else if (e.key === 'Home') {\n newValue = this.min;\n } else if (e.key === 'End') {\n newValue = this.max;\n } else {\n return;\n }\n e.preventDefault();\n\n if (newValue !== current) {\n this.value = newValue;\n this.emit('input');\n this.emit('change');\n }\n }\n\n /** A suggestion for a slider is a number. */\n protected override writeSuggestionValue(value: unknown): void {\n this.value = Number(value);\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n /**\n * The inset icon: on the active part of the track while it fits there, else on the inactive part\n * just after the handle. Shown from `md` up, where the track is tall enough.\n */\n private renderIcon(percentage: number) {\n if (!this.icon || !['md', 'lg', 'xl'].includes(this.size)) return nothing;\n const iconSpace = ICON_ROOM[this.size as 'md' | 'lg' | 'xl'];\n const activeWidth = (percentage / 100) * this.trackWidth - HANDLE_SPACE_PX;\n const onActive = activeWidth >= iconSpace;\n return html`<wc-icon\n class=${classMap({ 'track-icon': true, 'on-active': onActive })}\n name=${this.icon}\n aria-hidden=\"true\"\n style=${styleMap({\n left: onActive\n ? 'var(--_icon-inset)'\n : `calc(${percentage}% + var(--_handle-space) + var(--_icon-inset))`,\n })}\n ></wc-icon>`;\n }\n\n render() {\n const { value } = this;\n const range = this.max - this.min;\n const percentage = range > 0 ? ((value - this.min) / range) * 100 : 0;\n const placement = this.valuePlacement;\n const formatted = this.formatValue(value);\n const labelId = `${this.idPrefix}-label`;\n const descriptionId = `${this.idPrefix}-description`;\n const errorText = this.error ? this.errorText : this.validationText;\n const invalid = this.error || !!errorText;\n const description = errorText || this.suggestionReason || this.helperText;\n\n return html`\n <div\n class=${classMap({\n wrapper: true,\n [`size-${this.size}`]: true,\n disabled: this.disabled,\n readonly: this.readonly,\n error: invalid,\n })}\n >\n ${this.label\n ? this.labelWithSuggestion(\n html`<div class=\"label\" id=${labelId}>${this.label}</div>`,\n )\n : this.suggestionBadge()}\n <div class=\"slider ${placement.end ? 'with-value' : ''}\">\n <div\n class=\"slider-container ${this.disabled ? 'disabled' : ''}\"\n @mousedown=${this.onMouseDown}\n @touchstart=${this.onMouseDown}\n >\n <div\n class=\"track track-active\"\n style=${styleMap({\n width: `max(0px, calc(${percentage}% - var(--_handle-space)))`,\n })}\n ></div>\n <div\n class=\"track track-inactive\"\n style=${styleMap({\n left: `calc(${percentage}% + var(--_handle-space))`,\n })}\n >\n ${percentage < 100 ? html`<span class=\"stop\"></span>` : nothing}\n </div>\n ${this.renderIcon(percentage)}\n\n <div\n class=\"thumb\"\n role=\"slider\"\n aria-label=${this.label ? nothing : this.i18n.t('slider')}\n aria-labelledby=${this.label ? labelId : nothing}\n aria-describedby=${description ? descriptionId : nothing}\n tabindex=\"${this.disabled ? -1 : 0}\"\n aria-valuemin=${this.min}\n aria-valuemax=${this.max}\n aria-valuenow=${value}\n aria-valuetext=${this.valueText ? formatted : nothing}\n aria-disabled=${this.disabled ? 'true' : nothing}\n aria-readonly=${this.readonly ? 'true' : nothing}\n aria-invalid=${invalid ? 'true' : nothing}\n style=${styleMap({\n left: `calc(${percentage}% - var(--_handle-width) / 2)`,\n })}\n @keydown=${this.handleKeyDown}\n >\n ${placement.thumb\n ? html`<div class=\"value-label\">${formatted}</div>`\n : ''}\n </div>\n </div>\n\n ${placement.end\n ? html`<output class=\"value-display\" aria-hidden=\"true\"\n >${formatted}</output\n >`\n : ''}\n </div>\n ${description\n ? html`<div class=\"helper\" id=${descriptionId}>${description}</div>`\n : nothing}\n </div>\n `;\n }\n}\n"],"names":["nothing","html","classMap","styleMap","sliderStyles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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M,EAAE,SAAS,EAAE,aAAa,EAAE;AACb,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAIvC,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE;AACQ,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAKrB,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAA8B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAGnB,UAAA,CAAA;AAAhB,IAAAA,CAAK;AAA0B,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAMI,UAAA,CAAA;IAAnCC,CAAK,CAAC,mBAAmB;AAAkC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAEnC,UAAA,CAAA;IAAxBA,CAAK,CAAC,QAAQ;AAAqC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;;;;"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Short vibrations for M3 Expressive haptics. They play only where the browser supports
3
+ * `navigator.vibrate` (Chrome on Android; desktops and iOS ignore it) and only during a user
4
+ * gesture, so programmatic changes stay silent. `data-haptics="off"` on `<html>` turns them off.
5
+ */
6
+ export type HapticKind = 'tick' | 'toggle' | 'confirm';
7
+ export declare function haptic(kind: HapticKind): void;
@@ -73,7 +73,7 @@ export declare class DatePicker extends LitElement {
73
73
  /** Peacock's strings for the navigation and action buttons. */
74
74
  private readonly i18n;
75
75
  protected willUpdate(changed: Map<PropertyKey, unknown>): void;
76
- protected updated(): void;
76
+ protected updated(changed: Map<PropertyKey, unknown>): void;
77
77
  /** Moves focus to the active day (or month or year). */
78
78
  focus(): void;
79
79
  private get resolvedLocale();
@@ -90,6 +90,11 @@ export declare class DatePicker extends LitElement {
90
90
  private emit;
91
91
  private select;
92
92
  private shiftView;
93
+ /**
94
+ * M3 Expressive: when the shown month changes in the day view, the new month slides in from the
95
+ * side it comes from (`data-enter` on `.months`), like a tab panel.
96
+ */
97
+ private slideMonths;
93
98
  private cycleView;
94
99
  private focusActive;
95
100
  private moveActive;
@@ -192,6 +192,8 @@ export declare class DocumentEditor extends LitElement implements RichTextMentio
192
192
  private _produced?;
193
193
  private _inputTimer?;
194
194
  private _paginateFrame?;
195
+ /** A click below a page break is smooth-scrolling the caret into view. */
196
+ private _revealingCaret;
195
197
  private _changed;
196
198
  private _resizeObserver?;
197
199
  /** Watches the canvas's width for the fit-width zoom. */
@@ -62,6 +62,8 @@ export declare class Modal extends LitElement {
62
62
  private _panel?;
63
63
  /** Peacock's strings for the close button label. */
64
64
  private readonly i18n;
65
+ /** Whether the current press began on the scrim, so a drag that ends there is not a scrim click. */
66
+ private _pressStartedOnScrim;
65
67
  private readonly overlay;
66
68
  protected updated(changed: PropertyValues<this>): void;
67
69
  /** Opens the modal. */
@@ -78,6 +80,8 @@ export declare class Modal extends LitElement {
78
80
  * the dialog (a popover, menu or select closing; they bubble and are composed) is not ours.
79
81
  */
80
82
  private _handleNativeClose;
83
+ /** Records where a press starts: a drag that begins in the content and ends on the scrim must not close. */
84
+ private _handleDialogPointerDown;
81
85
  /** A click that lands outside the dialog container, not on its content, is a scrim click. */
82
86
  private _handleDialogClick;
83
87
  private _handleCloseClick;
package/dist/switch.js CHANGED
@@ -4,7 +4,7 @@ import { e } from './class-map-DN-g_e4M.js';
4
4
  import './toggle-surface-CkMdGtyR.js';
5
5
  import { s as spread } from './spread-B5cgadZl.js';
6
6
  import { p as peacockString } from './strings-DeiQWMd9.js';
7
- import { T as ToggleBase } from './toggle-base-DP3PSXbf.js';
7
+ import { T as ToggleBase } from './toggle-base-CVO9YntI.js';
8
8
  import './directive-ZPhl09Yt.js';
9
9
  import './define-element-DwIWgY_Y.js';
10
10
  import './platform-DHfE4Fvo.js';
@@ -17,6 +17,7 @@ import './input-base-u60DF-pm.js';
17
17
  import './suggestion-controller-DhXsD9gH.js';
18
18
  import './ai-controller-DR_Tg0sN.js';
19
19
  import './locale-DEsJZCQG.js';
20
+ import './haptics-CAaQ2E-9.js';
20
21
 
21
22
  var css_248z = i`* {
22
23
  box-sizing: border-box;
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sources":["../../src/switch/switch.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport '@/__internal/agent/toggle-surface.js';\nimport type { AgentToggleChangeEvent } from '@/__internal/agent/toggle-surface.js';\nimport { spread } from '@/__internal/directive/spread.js';\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport ToggleBase from '@/__internal/toggle-base.js';\n\nimport styles from './switch.scss';\n\n/**\n * @label Switch\n * @tag wc-switch\n * @rawTag switch\n *\n * @summary An on and off switch for a single setting, such as turning notifications on.\n * @overview\n * <p>The switch is form-associated: when <code>checked</code>, it submits its <code>value</code>\n * (<code>on</code> by default) under its <code>name</code>. With <code>required</code> it blocks form\n * submission until it is on.</p>\n *\n * @cssprop --switch-track-color: Color of the switch track when checked.\n * @cssprop --switch-track-off-color: Color of the switch track when unchecked.\n * @cssprop --switch-width: Width of the switch track.\n * @cssprop --switch-height: Height of the switch track.\n * @cssprop --switch-handle-radius: Size of the switch handle.\n * @cssprop --switch-handle-color: Color of the switch handle.\n *\n * @fires {CustomEvent<{checked: boolean, value: string, originalEvent?: Event}>} change - Dispatched when the switch is toggled.\n *\n * @example\n * ```html\n * <wc-switch checked label=\"Wi-Fi\"></wc-switch>\n * ```\n * @tags input, form\n */\nexport class Switch extends ToggleBase {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n // `name`, `disabled`, `required`, `readonly`, `label`, `checked`, `value` and `configAria` are\n // inherited.\n\n /**\n * If true, the toggle has rounded corners. Defaults to `true`.\n */\n @property({ type: Boolean })\n rounded: boolean = true;\n\n /** Shows a check icon in the handle when on and a close icon when off. */\n @property({ type: Boolean, reflect: true, attribute: 'with-icon' })\n withIcon: boolean = false;\n\n // ── Protected methods ────────────────────────────────────────────────────\n\n protected override valueMissingText(): string {\n return peacockString('valueMissingCheckbox');\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private keyDownHandler = (event: KeyboardEvent) => {\n if (event.key === ' ') {\n event.preventDefault();\n this.isActive = true;\n this.toggleChecked(event);\n }\n };\n\n private clickHandler = (event: MouseEvent) => {\n this.toggleChecked(event);\n };\n\n // ── Render helpers ───────────────────────────────────────────────────────\n\n private renderIcon() {\n if (!this.withIcon) return nothing;\n return this.checked\n ? html`<wc-icon name=\"check\" class=\"icon\"></wc-icon>`\n : html`<wc-icon name=\"close\" class=\"icon\"></wc-icon>`;\n }\n\n /** An agent's change, applied as a click would be; disabled and read-only switches refuse it. */\n private _handleAgentChange(event: AgentToggleChangeEvent) {\n event.stopPropagation();\n if (!this.applyAgentChange(event.detail.value)) event.preventDefault();\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const cssClasses = {\n switch: true,\n 'state-checked': this.checked,\n 'has-focus': this.hasFocus,\n active: this.isActive,\n disabled: this.disabled,\n readonly: this.readonly,\n required: this.required,\n rounded: this.rounded,\n 'has-content': this.slotHasContent,\n };\n\n return html`\n <label class=${classMap(cssClasses)}>\n <agent-switch\n .checked=${!!this.checked}\n .disabled=${this.disabled || !this.agentAvailable}\n .readOnly=${this.readonly}\n .required=${this.required}\n @checkedchange=${this._handleAgentChange}\n >\n <div\n class=\"track container\"\n role=\"switch\"\n aria-checked=${String(this.checked)}\n @mousedown=${this.handleMouseDown}\n @keydown=${this.keyDownHandler}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n ${spread({\n ...this.controlAttributes(),\n // Named for the agent bridge (ADR-030004): its name comes from the label or slotted text.\n 'aria-label': this.label || this.textContent?.trim() || undefined,\n })}\n >\n <div class=\"handle\">${this.renderIcon()}</div>\n </div>\n </agent-switch>\n\n <input\n type=\"checkbox\"\n class=\"input-native\"\n .checked=${this.checked}\n aria-hidden=\"true\"\n tabindex=\"-1\"\n @click=${this.clickHandler}\n />\n\n ${this.renderLabel()}\n </label>\n `;\n }\n}\n"],"names":["nothing","html","classMap","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,MAAO,MAAO,SAAQ,UAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;;;;;AASE;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAY,IAAI;;QAIvB,IAAA,CAAA,QAAQ,GAAY,KAAK;;AAUjB,QAAA,IAAA,CAAA,cAAc,GAAG,CAAC,KAAoB,KAAI;AAChD,YAAA,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE;gBACrB,KAAK,CAAC,cAAc,EAAE;AACtB,gBAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;AACpB,gBAAA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC3B;AACF,QAAA,CAAC;AAEO,QAAA,IAAA,CAAA,YAAY,GAAG,CAAC,KAAiB,KAAI;AAC3C,YAAA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AAC3B,QAAA,CAAC;IAwEH;;IAxFqB,gBAAgB,GAAA;AACjC,QAAA,OAAO,aAAa,CAAC,sBAAsB,CAAC;IAC9C;;IAkBQ,UAAU,GAAA;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ;AAAE,YAAA,OAAOA,CAAO;QAClC,OAAO,IAAI,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AAE;;AAE3B,YAAA,YAAY,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,SAAS;SAClE,CAAC;;kCAEoB,IAAI,CAAC,UAAU,EAAE,CAAA;;;;;;;AAO9B,mBAAA,EAAA,IAAI,CAAC,OAAO;;;AAGd,iBAAA,EAAA,IAAI,CAAC,YAAY;;;UAG1B,IAAI,CAAC,WAAW,EAAE;;KAEvB;IACH;;AAzGO,MAAA,CAAA,MAAM,GAAG,CAACC,QAAM,CAAC;AAUxB,UAAA,CAAA;AADC,IAAAC,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE;AACH,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAIxB,UAAA,CAAA;AADC,IAAAA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;AACxC,CAAA,EAAA,MAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;;;;"}
1
+ {"version":3,"file":"switch.js","sources":["../../src/switch/switch.ts"],"sourcesContent":["import { html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nimport '@/__internal/agent/toggle-surface.js';\nimport type { AgentToggleChangeEvent } from '@/__internal/agent/toggle-surface.js';\nimport { spread } from '@/__internal/directive/spread.js';\nimport { peacockString } from '@/__internal/i18n/strings.js';\nimport ToggleBase from '@/__internal/toggle-base.js';\n\nimport styles from './switch.scss';\n\n/**\n * @label Switch\n * @tag wc-switch\n * @rawTag switch\n *\n * @summary An on and off switch for a single setting, such as turning notifications on.\n * @overview\n * <p>The switch is form-associated: when <code>checked</code>, it submits its <code>value</code>\n * (<code>on</code> by default) under its <code>name</code>. With <code>required</code> it blocks form\n * submission until it is on.</p>\n *\n * @cssprop --switch-track-color: Color of the switch track when checked.\n * @cssprop --switch-track-off-color: Color of the switch track when unchecked.\n * @cssprop --switch-width: Width of the switch track.\n * @cssprop --switch-height: Height of the switch track.\n * @cssprop --switch-handle-radius: Size of the switch handle.\n * @cssprop --switch-handle-color: Color of the switch handle.\n *\n * @fires {CustomEvent<{checked: boolean, value: string, originalEvent?: Event}>} change - Dispatched when the switch is toggled.\n *\n * @example\n * ```html\n * <wc-switch checked label=\"Wi-Fi\"></wc-switch>\n * ```\n * @tags input, form\n */\nexport class Switch extends ToggleBase {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n // `name`, `disabled`, `required`, `readonly`, `label`, `checked`, `value` and `configAria` are\n // inherited.\n\n /**\n * If true, the toggle has rounded corners. Defaults to `true`.\n */\n @property({ type: Boolean })\n rounded: boolean = true;\n\n /** Shows a check icon in the handle when on and a close icon when off. */\n @property({ type: Boolean, reflect: true, attribute: 'with-icon' })\n withIcon: boolean = false;\n\n // ── Protected methods ────────────────────────────────────────────────────\n\n protected override valueMissingText(): string {\n return peacockString('valueMissingCheckbox');\n }\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private keyDownHandler = (event: KeyboardEvent) => {\n if (event.key === ' ') {\n event.preventDefault();\n this.isActive = true;\n this.toggleChecked(event);\n }\n };\n\n private clickHandler = (event: MouseEvent) => {\n this.toggleChecked(event);\n };\n\n // ── Render helpers ───────────────────────────────────────────────────────\n\n private renderIcon() {\n if (!this.withIcon) return nothing;\n return this.checked\n ? html`<wc-icon name=\"check\" class=\"icon\"></wc-icon>`\n : html`<wc-icon name=\"close\" class=\"icon\"></wc-icon>`;\n }\n\n /** An agent's change, applied as a click would be; disabled and read-only switches refuse it. */\n private _handleAgentChange(event: AgentToggleChangeEvent) {\n event.stopPropagation();\n if (!this.applyAgentChange(event.detail.value)) event.preventDefault();\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const cssClasses = {\n switch: true,\n 'state-checked': this.checked,\n 'has-focus': this.hasFocus,\n active: this.isActive,\n disabled: this.disabled,\n readonly: this.readonly,\n required: this.required,\n rounded: this.rounded,\n 'has-content': this.slotHasContent,\n };\n\n return html`\n <label class=${classMap(cssClasses)}>\n <agent-switch\n .checked=${!!this.checked}\n .disabled=${this.disabled || !this.agentAvailable}\n .readOnly=${this.readonly}\n .required=${this.required}\n @checkedchange=${this._handleAgentChange}\n >\n <div\n class=\"track container\"\n role=\"switch\"\n aria-checked=${String(this.checked)}\n @mousedown=${this.handleMouseDown}\n @keydown=${this.keyDownHandler}\n @focus=${this.handleFocusChange}\n @blur=${this.handleFocusChange}\n ${spread({\n ...this.controlAttributes(),\n // Named for the agent bridge (ADR-030004): its name comes from the label or slotted text.\n 'aria-label': this.label || this.textContent?.trim() || undefined,\n })}\n >\n <div class=\"handle\">${this.renderIcon()}</div>\n </div>\n </agent-switch>\n\n <input\n type=\"checkbox\"\n class=\"input-native\"\n .checked=${this.checked}\n aria-hidden=\"true\"\n tabindex=\"-1\"\n @click=${this.clickHandler}\n />\n\n ${this.renderLabel()}\n </label>\n `;\n }\n}\n"],"names":["nothing","html","classMap","styles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACG,MAAO,MAAO,SAAQ,UAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;;;;;AASE;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAY,IAAI;;QAIvB,IAAA,CAAA,QAAQ,GAAY,KAAK;;AAUjB,QAAA,IAAA,CAAA,cAAc,GAAG,CAAC,KAAoB,KAAI;AAChD,YAAA,IAAI,KAAK,CAAC,G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import { e } from './query-CHb9Ft_d.js';
5
5
  import { g as getFormValue, a as getFormState } from './form-associated-CZ4StgI6.js';
6
6
  import { I as InputBase } from './input-base-u60DF-pm.js';
7
+ import { h as haptic } from './haptics-CAaQ2E-9.js';
7
8
 
8
9
  let toggleCount = 0;
9
10
  /**
@@ -169,6 +170,7 @@ class ToggleBase extends InputBase {
169
170
  if (this.disabled || this.readonly)
170
171
  return;
171
172
  this.checked = !this.checked;
173
+ haptic('toggle');
172
174
  this.afterToggle();
173
175
  this.dispatchChange(originalEvent);
174
176
  this.containerElement?.focus();
@@ -249,4 +251,4 @@ __decorate([
249
251
  ], ToggleBase.prototype, "containerElement", void 0);
250
252
 
251
253
  export { ToggleBase as T };
252
- //# sourceMappingURL=toggle-base-DP3PSXbf.js.map
254
+ //# sourceMappingURL=toggle-base-CVO9YntI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-base-CVO9YntI.js","sources":["../../src/__internal/toggle-base.ts"],"sourcesContent":["import { html, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\n\nimport {\n type FormRestoreState,\n type FormValue,\n getFormState,\n getFormValue,\n} from '@/__internal/mixins/form-associated.js';\nimport InputBase, { type ControlValidity } from '@/__internal/input-base.js';\nimport { haptic } from './utils/haptics.js';\n\nlet toggleCount = 0;\n\n/**\n * Base for Peacock's on/off controls: `wc-checkbox`, `wc-switch` and `wc-radio`.\n *\n * Like a native checkbox, `checked` is the state and `value` the string submitted under `name`\n * while checked (`\"on\"` by default). `required` blocks form submission until the control is\n * checked. The inner control (an element with class `container` and a `role`) gets the host's\n * `tabindex` and `aria-*`, and is named by the visible label through `aria-labelledby`.\n *\n * Subclasses render the control with `controlAttributes()`, the label with `renderLabel()`, and\n * call `toggleChecked(event)` (or their own selection logic) on activation.\n */\nexport default abstract class ToggleBase extends InputBase {\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** Visible label; slotted content is used when it is empty. */\n @property({ type: String })\n label: string = '';\n\n /** Whether the control is on. */\n @property({ type: Boolean, reflect: true })\n checked: boolean = false;\n\n /**\n * The value submitted with a form while checked. Defaults to `\"on\"` for checkboxes and switches.\n */\n @property({ type: String })\n get value(): string {\n return this.toggleValue;\n }\n\n set value(value: string) {\n const old = this.toggleValue;\n this.toggleValue = value ?? '';\n this.requestUpdate('value', old);\n }\n\n /** ARIA attributes moved from the host onto the inner control. */\n @property({ type: Object })\n configAria: Record<string, string> = {};\n\n // ── State ────────────────────────────────────────────────────────────────\n\n /** True while the inner control has focus. */\n @state() protected hasFocus = false;\n\n /** True while the control is being pressed with the mouse or Space. */\n @state() protected isActive = false;\n\n /** True when there is a label to show, from `label` or slotted content. */\n @state() protected slotHasContent = false;\n\n // ── Queries ──────────────────────────────────────────────────────────────\n\n @query('.container') protected containerElement?: HTMLElement;\n\n // ── Private fields ───────────────────────────────────────────────────────\n\n /** A `tabindex` set on the host, moved to the inner control. */\n protected controlTabIndex?: string;\n\n /** Id of the visible label, which names the inner control. */\n protected readonly labelId = `wc-toggle-label-${(toggleCount += 1)}`;\n\n private toggleValue: string = this.defaultToggleValue;\n\n /** `checked` when first connected; `form.reset()` returns to it. */\n private defaultChecked?: boolean;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────\n\n override connectedCallback() {\n super.connectedCallback();\n this.defaultChecked ??= this.checked;\n for (const attr of Array.from(this.attributes)) {\n if (attr.name.startsWith('aria-')) {\n this.configAria = { ...this.configAria, [attr.name]: attr.value };\n this.removeAttribute(attr.name);\n }\n }\n if (this.hasAttribute('tabindex')) {\n this.controlTabIndex = this.getAttribute('tabindex') ?? undefined;\n this.removeAttribute('tabindex');\n }\n this.addEventListener('click', this.hostClick);\n window.addEventListener('mouseup', this.windowMouseUp);\n window.addEventListener('keyup', this.windowKeyUp);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('click', this.hostClick);\n window.removeEventListener('mouseup', this.windowMouseUp);\n window.removeEventListener('keyup', this.windowKeyUp);\n }\n\n protected override willUpdate(changed: PropertyValues) {\n super.willUpdate(changed);\n if (changed.has('label') || !this.hasUpdated) {\n this.slotHasContent = this.hasChildNodes() || !!this.label;\n }\n }\n\n // ── Public methods ───────────────────────────────────────────────────────\n\n override focus() {\n this.containerElement?.focus();\n }\n\n override blur() {\n this.containerElement?.blur();\n }\n\n // ── Form association ─────────────────────────────────────────────────────\n\n override [getFormValue](): FormValue | null {\n return this.checked ? this.value || 'on' : null;\n }\n\n override [getFormState](): FormValue | null {\n return String(this.checked);\n }\n\n override formResetCallback() {\n super.formResetCallback();\n this.checked = this.defaultChecked ?? false;\n }\n\n override formStateRestoreCallback(restored: FormRestoreState | null) {\n this.checked = restored === 'true';\n }\n\n // ── Protected ────────────────────────────────────────────────────────────\n\n /** The default `value`: `\"on\"`, like a native checkbox. Radios override it. */\n protected get defaultToggleValue(): string {\n return 'on';\n }\n\n protected override computeValidity(): ControlValidity {\n if (this.required && !this.checked && !this.disabled) {\n return {\n flags: { valueMissing: true },\n message: this.valueMissingText(),\n };\n }\n return { flags: {}, message: '' };\n }\n\n protected override validityAnchor() {\n return this.containerElement;\n }\n\n /** Whether to mark the control invalid: a failed check or a commit left it invalid. */\n protected get showsInvalid(): boolean {\n return !!this.validationText;\n }\n\n /**\n * Attributes for the inner control: the host's `tabindex` (or `fallbackTabIndex`), the label as\n * its name, required and invalid state, plus `configAria`.\n */\n protected controlAttributes(\n fallbackTabIndex = '0',\n ): Record<string, string | undefined> {\n return {\n tabindex: this.disabled\n ? '-1'\n : (this.controlTabIndex ?? fallbackTabIndex),\n 'aria-labelledby': this.slotHasContent ? this.labelId : undefined,\n 'aria-disabled': this.disabled ? 'true' : undefined,\n 'aria-required': this.required ? 'true' : undefined,\n 'aria-invalid': this.showsInvalid ? 'true' : undefined,\n ...this.configAria,\n };\n }\n\n /** Flips `checked` and fires `change`, unless the control is disabled or read-only. */\n protected toggleChecked(originalEvent?: Event) {\n if (this.disabled || this.readonly) return;\n this.checked = !this.checked;\n haptic('toggle');\n this.afterToggle();\n this.dispatchChange(originalEvent);\n this.containerElement?.focus();\n }\n\n /**\n * Offers an agent's change as a suggestion (ADR-030002, ADR-030004): the control fills and marks\n * it, and the person commits it by editing or submitting the form. Refused while the control is\n * disabled or read-only, when AI is off or the control is sensitive, or when it already holds\n * that state.\n */\n protected applyAgentChange(checked: boolean) {\n if (this.disabled || this.readonly || !this.agentAvailable) return false;\n if (checked === this.checked) return false;\n this.suggestion = { value: checked };\n return true;\n }\n\n /** Hook for state that clears when the control is toggled, such as `indeterminate`. */\n protected afterToggle() {}\n\n /**\n * Fires `change`. `detail.checked` is the new state and `detail.value` the submitted value\n * while checked.\n */\n protected dispatchChange(originalEvent?: Event) {\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: { checked: this.checked, value: this.value, originalEvent },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n protected handleMouseDown = () => {\n this.isActive = true;\n };\n\n protected handleFocusChange = (event: FocusEvent) => {\n this.hasFocus = event.type === 'focus';\n };\n\n /**\n * The visible label, from `label` or the default slot, with the id that names the control, and\n * the Suggested badge after it while a suggestion shows.\n */\n protected renderLabel() {\n const label = this.label\n ? html`<div id=${this.labelId} class=\"label\">${this.label}</div>`\n : html`<div id=${this.labelId} class=\"label slot-container\">\n <slot></slot>\n </div>`;\n return html`${label}${this.suggestionBadge({ withReason: true })}`;\n }\n\n /** A suggestion for a toggle is its `checked` state. */\n protected override readSuggestionValue(): unknown {\n return this.checked;\n }\n\n protected override writeSuggestionValue(value: unknown): void {\n this.checked = !!value;\n }\n\n protected override emitSuggestionValue(): void {\n this.dispatchChange();\n }\n\n // ── Private ──────────────────────────────────────────────────────────────\n\n /**\n * A click aimed at the host itself, not at something inside it, comes from an external\n * `<label for>`, a wrapping `<label>` or `host.click()`. Forward it to the inner native input, the\n * control the shadow `<label>` activates, so it toggles like a click on the control. Clicks from\n * inside (the control, the shadow label or slotted label content) start elsewhere and are left\n * alone, so a click toggles once.\n */\n private hostClick = (event: MouseEvent) => {\n if (event.composedPath()[0] !== this) return;\n this.renderRoot.querySelector<HTMLInputElement>('.input-native')?.click();\n };\n\n private windowMouseUp = () => {\n if (this.isActive) this.isActive = false;\n };\n\n private windowKeyUp = (event: KeyboardEvent) => {\n if (this.isActive && event.key === ' ') this.isActive = false;\n };\n}\n"],"names":["html","property","state","query"],"mappings":";;;;;;;;AAYA,IAAI,WAAW,GAAG,CAAC;AAEnB;;;;;;;;;;AAUG;AACW,MAAgB,UAAW,SAAQ,SAAS,CAAA;AAA1D,IAAA,WAAA,GAAA;;;;QAKE,IAAA,CAAA,KAAK,GAAW,EAAE;;QAIlB,IAAA,CAAA,OAAO,GAAY,KAAK;;QAkBxB,IAAA,CAAA,UAAU,GAA2B,EAAE;;;QAKpB,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAGhB,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAGhB,IAAA,CAAA,cAAc,GAAG,KAAK;;QAYtB,IAAA,CAAA,OAAO,GAAG,oBAAoB,WAAW,IAAI,CAAC,GAAG;AAE5D,QAAA,IAAA,CAAA,WAAW,GAAW,IAAI,CAAC,kBAAkB;QAyJ3C,IAAA,CAAA,eAAe,GAAG,MAAK;AAC/B,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI;AACtB,QAAA,CAAC;AAES,QAAA,IAAA,CAAA,iBAAiB,GAAG,CAAC,KAAiB,KAAI;YAClD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,KAAK,OAAO;AACxC,QAAA,CAAC;;AA8BD;;;;;;AAMG;AACK,QAAA,IAAA,CAAA,SAAS,GAAG,CAAC,KAAiB,KAAI;YACxC,IAAI,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI;gBAAE;YACtC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAmB,eAAe,CAAC,EAAE,KAAK,EAAE;AAC3E,QAAA,CAAC;QAEO,IAAA,CAAA,aAAa,GAAG,MAAK;YAC3B,IAAI,IAAI,CAA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