@vielzeug/refine 1.5.1 → 1.5.3

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 (234) hide show
  1. package/dist/async.cjs +9 -9
  2. package/dist/async.cjs.map +1 -1
  3. package/dist/async.js +30 -31
  4. package/dist/async.js.map +1 -1
  5. package/dist/button.cjs +6 -6
  6. package/dist/button.cjs.map +1 -1
  7. package/dist/button.js +29 -30
  8. package/dist/button.js.map +1 -1
  9. package/dist/calendar.cjs +44 -44
  10. package/dist/calendar.cjs.map +1 -1
  11. package/dist/calendar.js +115 -117
  12. package/dist/calendar.js.map +1 -1
  13. package/dist/checkbox-group.cjs +7 -7
  14. package/dist/checkbox-group.cjs.map +1 -1
  15. package/dist/checkbox-group.js +71 -73
  16. package/dist/checkbox-group.js.map +1 -1
  17. package/dist/checkbox.cjs +3 -3
  18. package/dist/checkbox.cjs.map +1 -1
  19. package/dist/checkbox.js +28 -29
  20. package/dist/checkbox.js.map +1 -1
  21. package/dist/code-window.cjs +7 -7
  22. package/dist/code-window.cjs.map +1 -1
  23. package/dist/code-window.js +17 -18
  24. package/dist/code-window.js.map +1 -1
  25. package/dist/combobox.cjs +1 -1
  26. package/dist/combobox.cjs.map +1 -1
  27. package/dist/combobox.js +11 -12
  28. package/dist/combobox.js.map +1 -1
  29. package/dist/custom-elements.json +6570 -6570
  30. package/dist/datagrid.cjs +66 -66
  31. package/dist/datagrid.cjs.map +1 -1
  32. package/dist/datagrid.js +267 -268
  33. package/dist/datagrid.js.map +1 -1
  34. package/dist/date-picker.cjs +11 -11
  35. package/dist/date-picker.cjs.map +1 -1
  36. package/dist/date-picker.js +8 -9
  37. package/dist/date-picker.js.map +1 -1
  38. package/dist/file-input.cjs +6 -6
  39. package/dist/file-input.cjs.map +1 -1
  40. package/dist/file-input.js +50 -51
  41. package/dist/file-input.js.map +1 -1
  42. package/dist/grid.cjs +1 -1
  43. package/dist/grid.cjs.map +1 -1
  44. package/dist/grid.js +47 -48
  45. package/dist/grid.js.map +1 -1
  46. package/dist/icon.cjs +1 -1
  47. package/dist/icon.cjs.map +1 -1
  48. package/dist/icon.js +26 -27
  49. package/dist/icon.js.map +1 -1
  50. package/dist/input.cjs +20 -20
  51. package/dist/input.cjs.map +1 -1
  52. package/dist/input.js +98 -100
  53. package/dist/input.js.map +1 -1
  54. package/dist/message-composer.cjs +18 -18
  55. package/dist/message-composer.cjs.map +1 -1
  56. package/dist/message-composer.js +113 -115
  57. package/dist/message-composer.js.map +1 -1
  58. package/dist/navbar.cjs +11 -11
  59. package/dist/navbar.cjs.map +1 -1
  60. package/dist/navbar.js +78 -79
  61. package/dist/navbar.js.map +1 -1
  62. package/dist/otp-input.cjs +4 -4
  63. package/dist/otp-input.cjs.map +1 -1
  64. package/dist/otp-input.js +31 -32
  65. package/dist/otp-input.js.map +1 -1
  66. package/dist/progress.cjs +13 -13
  67. package/dist/progress.cjs.map +1 -1
  68. package/dist/progress.js +45 -46
  69. package/dist/progress.js.map +1 -1
  70. package/dist/radio-group.cjs +5 -5
  71. package/dist/radio-group.cjs.map +1 -1
  72. package/dist/radio-group.js +83 -85
  73. package/dist/radio-group.js.map +1 -1
  74. package/dist/radio.cjs +3 -3
  75. package/dist/radio.cjs.map +1 -1
  76. package/dist/radio.js +27 -28
  77. package/dist/radio.js.map +1 -1
  78. package/dist/rating.cjs +4 -4
  79. package/dist/rating.cjs.map +1 -1
  80. package/dist/rating.js +30 -31
  81. package/dist/rating.js.map +1 -1
  82. package/dist/select.cjs +4 -4
  83. package/dist/select.cjs.map +1 -1
  84. package/dist/select.js +88 -89
  85. package/dist/select.js.map +1 -1
  86. package/dist/sidebar.cjs +11 -11
  87. package/dist/sidebar.cjs.map +1 -1
  88. package/dist/sidebar.js +97 -98
  89. package/dist/sidebar.js.map +1 -1
  90. package/dist/skeleton.cjs +3 -3
  91. package/dist/skeleton.cjs.map +1 -1
  92. package/dist/skeleton.js +23 -24
  93. package/dist/skeleton.js.map +1 -1
  94. package/dist/slider.cjs +3 -3
  95. package/dist/slider.cjs.map +1 -1
  96. package/dist/slider.js +65 -66
  97. package/dist/slider.js.map +1 -1
  98. package/dist/switch.cjs +3 -3
  99. package/dist/switch.cjs.map +1 -1
  100. package/dist/switch.js +23 -24
  101. package/dist/switch.js.map +1 -1
  102. package/dist/tab-panel.cjs +7 -7
  103. package/dist/tab-panel.cjs.map +1 -1
  104. package/dist/tab-panel.js +21 -23
  105. package/dist/tab-panel.js.map +1 -1
  106. package/dist/testing.cjs +1 -1
  107. package/dist/testing.cjs.map +1 -1
  108. package/dist/testing.js +4 -5
  109. package/dist/testing.js.map +1 -1
  110. package/dist/textarea.cjs +13 -13
  111. package/dist/textarea.cjs.map +1 -1
  112. package/dist/textarea.js +92 -94
  113. package/dist/textarea.js.map +1 -1
  114. package/dist/time-picker.cjs +9 -9
  115. package/dist/time-picker.cjs.map +1 -1
  116. package/dist/time-picker.js +47 -48
  117. package/dist/time-picker.js.map +1 -1
  118. package/package.json +4 -4
  119. package/dist/ore/dist/_dev.cjs +0 -2
  120. package/dist/ore/dist/_dev.cjs.map +0 -1
  121. package/dist/ore/dist/_dev.js +0 -12
  122. package/dist/ore/dist/_dev.js.map +0 -1
  123. package/dist/ore/dist/base-element.cjs +0 -2
  124. package/dist/ore/dist/base-element.cjs.map +0 -1
  125. package/dist/ore/dist/base-element.js +0 -158
  126. package/dist/ore/dist/base-element.js.map +0 -1
  127. package/dist/ore/dist/context.cjs +0 -2
  128. package/dist/ore/dist/context.cjs.map +0 -1
  129. package/dist/ore/dist/context.js +0 -11
  130. package/dist/ore/dist/context.js.map +0 -1
  131. package/dist/ore/dist/define.cjs +0 -2
  132. package/dist/ore/dist/define.cjs.map +0 -1
  133. package/dist/ore/dist/define.js +0 -27
  134. package/dist/ore/dist/define.js.map +0 -1
  135. package/dist/ore/dist/directives/classMap.cjs +0 -1
  136. package/dist/ore/dist/directives/classMap.js +0 -1
  137. package/dist/ore/dist/directives/each.cjs +0 -1
  138. package/dist/ore/dist/directives/each.js +0 -5
  139. package/dist/ore/dist/directives/live.cjs +0 -2
  140. package/dist/ore/dist/directives/live.cjs.map +0 -1
  141. package/dist/ore/dist/directives/live.js +0 -6
  142. package/dist/ore/dist/directives/live.js.map +0 -1
  143. package/dist/ore/dist/directives/model.cjs +0 -1
  144. package/dist/ore/dist/directives/model.js +0 -3
  145. package/dist/ore/dist/directives/raw.cjs +0 -2
  146. package/dist/ore/dist/directives/raw.cjs.map +0 -1
  147. package/dist/ore/dist/directives/raw.js +0 -38
  148. package/dist/ore/dist/directives/raw.js.map +0 -1
  149. package/dist/ore/dist/directives/styleMap.cjs +0 -2
  150. package/dist/ore/dist/directives/styleMap.cjs.map +0 -1
  151. package/dist/ore/dist/directives/styleMap.js +0 -20
  152. package/dist/ore/dist/directives/styleMap.js.map +0 -1
  153. package/dist/ore/dist/directives/when.cjs +0 -2
  154. package/dist/ore/dist/directives/when.cjs.map +0 -1
  155. package/dist/ore/dist/directives/when.js +0 -38
  156. package/dist/ore/dist/directives/when.js.map +0 -1
  157. package/dist/ore/dist/directives.cjs +0 -1
  158. package/dist/ore/dist/directives.js +0 -8
  159. package/dist/ore/dist/errors.cjs +0 -3
  160. package/dist/ore/dist/errors.cjs.map +0 -1
  161. package/dist/ore/dist/errors.js +0 -50
  162. package/dist/ore/dist/errors.js.map +0 -1
  163. package/dist/ore/dist/forms/context.cjs +0 -2
  164. package/dist/ore/dist/forms/context.cjs.map +0 -1
  165. package/dist/ore/dist/forms/context.js +0 -6
  166. package/dist/ore/dist/forms/context.js.map +0 -1
  167. package/dist/ore/dist/forms/field.cjs +0 -2
  168. package/dist/ore/dist/forms/field.cjs.map +0 -1
  169. package/dist/ore/dist/forms/field.js +0 -42
  170. package/dist/ore/dist/forms/field.js.map +0 -1
  171. package/dist/ore/dist/forms.cjs +0 -1
  172. package/dist/ore/dist/forms.js +0 -3
  173. package/dist/ore/dist/observers/intersection-observe.cjs +0 -2
  174. package/dist/ore/dist/observers/intersection-observe.cjs.map +0 -1
  175. package/dist/ore/dist/observers/intersection-observe.js +0 -12
  176. package/dist/ore/dist/observers/intersection-observe.js.map +0 -1
  177. package/dist/ore/dist/observers/media-observe.cjs +0 -1
  178. package/dist/ore/dist/observers/media-observe.js +0 -1
  179. package/dist/ore/dist/observers/mutation-observe.cjs +0 -1
  180. package/dist/ore/dist/observers/mutation-observe.js +0 -1
  181. package/dist/ore/dist/observers/resize-observe.cjs +0 -2
  182. package/dist/ore/dist/observers/resize-observe.cjs.map +0 -1
  183. package/dist/ore/dist/observers/resize-observe.js +0 -20
  184. package/dist/ore/dist/observers/resize-observe.js.map +0 -1
  185. package/dist/ore/dist/observers.cjs +0 -1
  186. package/dist/ore/dist/observers.js +0 -5
  187. package/dist/ore/dist/props.cjs +0 -2
  188. package/dist/ore/dist/props.cjs.map +0 -1
  189. package/dist/ore/dist/props.js +0 -56
  190. package/dist/ore/dist/props.js.map +0 -1
  191. package/dist/ore/dist/runtime.cjs +0 -2
  192. package/dist/ore/dist/runtime.cjs.map +0 -1
  193. package/dist/ore/dist/runtime.js +0 -25
  194. package/dist/ore/dist/runtime.js.map +0 -1
  195. package/dist/ore/dist/testing/flush.cjs +0 -2
  196. package/dist/ore/dist/testing/flush.cjs.map +0 -1
  197. package/dist/ore/dist/testing/flush.js +0 -11
  198. package/dist/ore/dist/testing/flush.js.map +0 -1
  199. package/dist/ore/dist/testing/mount.cjs +0 -2
  200. package/dist/ore/dist/testing/mount.cjs.map +0 -1
  201. package/dist/ore/dist/testing/mount.js +0 -94
  202. package/dist/ore/dist/testing/mount.js.map +0 -1
  203. package/dist/ore/dist/testing/query.cjs +0 -2
  204. package/dist/ore/dist/testing/query.cjs.map +0 -1
  205. package/dist/ore/dist/testing/query.js +0 -12
  206. package/dist/ore/dist/testing/query.js.map +0 -1
  207. package/dist/ore/dist/testing/render-hook.cjs +0 -1
  208. package/dist/ore/dist/testing/render-hook.js +0 -3
  209. package/dist/ore/dist/testing/testing.cjs +0 -1
  210. package/dist/ore/dist/testing/testing.js +0 -4
  211. package/dist/ore/dist/testing/wait.cjs +0 -1
  212. package/dist/ore/dist/testing/wait.js +0 -1
  213. package/dist/ore/dist/testing.cjs +0 -1
  214. package/dist/ore/dist/testing.js +0 -6
  215. package/dist/ore/dist/types/bindings.cjs +0 -2
  216. package/dist/ore/dist/types/bindings.cjs.map +0 -1
  217. package/dist/ore/dist/types/bindings.js +0 -15
  218. package/dist/ore/dist/types/bindings.js.map +0 -1
  219. package/dist/ore/dist/types.cjs +0 -2
  220. package/dist/ore/dist/types.cjs.map +0 -1
  221. package/dist/ore/dist/types.js +0 -15
  222. package/dist/ore/dist/types.js.map +0 -1
  223. package/dist/ore/dist/utils/css.cjs +0 -2
  224. package/dist/ore/dist/utils/css.cjs.map +0 -1
  225. package/dist/ore/dist/utils/css.js +0 -18
  226. package/dist/ore/dist/utils/css.js.map +0 -1
  227. package/dist/ore/dist/utils/dom.cjs +0 -2
  228. package/dist/ore/dist/utils/dom.cjs.map +0 -1
  229. package/dist/ore/dist/utils/dom.js +0 -43
  230. package/dist/ore/dist/utils/dom.js.map +0 -1
  231. package/dist/ore/dist/utils/id.cjs +0 -2
  232. package/dist/ore/dist/utils/id.cjs.map +0 -1
  233. package/dist/ore/dist/utils/id.js +0 -4
  234. package/dist/ore/dist/utils/id.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"slider.js","names":[],"sources":["../src/inputs/slider/slider.ts"],"sourcesContent":["import {\n createStableId,\n define,\n html,\n inject,\n prop,\n ref,\n aria,\n bind,\n getHost,\n onCleanup,\n onEvent,\n onMounted,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport type { ComponentSize, ThemeColor } from '../../types';\n\nimport { createErrorHelperState, createSliderControl } from '../../headless';\nimport { disablableBundle, sizableBundle, SLIDER_SIZE_PRESET, themableBundle } from '../../shared';\nimport { coarsePointerMixin, colorThemeMixin, disabledStateMixin, sizeVariantMixin } from '../../styles';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { renderHelperRegion } from '../shared/templates';\nimport componentStyles from './slider.css?inline';\n\nconst guard =\n <E extends Event = Event>(condition: () => unknown, handler: (e: E) => void): ((e: E) => void) =>\n (e) => {\n if (condition()) handler(e);\n };\n\n/** Slider component properties */\n\nexport type OreSliderEvents = {\n change: { from?: number; originalEvent?: Event; to?: number; value: number | { from: number; to: number } };\n};\n\nexport type OreSliderProps = {\n /** Theme color */\n color?: ThemeColor;\n /** Disable interaction */\n disabled?: boolean;\n /** Error message — marks the field as invalid (fallback when the `error` slot is empty) */\n error?: string;\n /** Range mode: lower bound */\n from?: number | string;\n /** Range mode a11y label for the start thumb (e.g. \"$20\") */\n 'from-value-text'?: string;\n /** Helper text displayed below the slider (fallback when the `helper` slot is empty) */\n helper?: string;\n /** Maximum value */\n max?: number | string;\n /** Minimum value */\n min?: number | string;\n /** Single-value mode: form field name */\n name?: string;\n /** Activate two-thumb range selection */\n range?: boolean;\n /** Component size */\n size?: ComponentSize;\n /** Step increment */\n step?: number | string;\n /** Range mode: upper bound */\n to?: number | string;\n /** Range mode a11y label for the end thumb (e.g. \"$80\") */\n 'to-value-text'?: string;\n /** Single-value mode: current value */\n value?: number | string;\n /** Single-value mode a11y label override (e.g. \"75%\"). Overrides raw aria-valuenow. */\n 'value-text'?: string;\n};\n\n/**\n * A slider for selecting a single numeric value or a numeric range.\n *\n * Add the boolean `range` attribute to activate two-thumb range mode.\n *\n * @element ore-slider\n *\n * @attr {number} min - Minimum value (default: 0)\n * @attr {number} max - Maximum value (default: 100)\n * @attr {number} step - Step increment (default: 1)\n * @attr {number} value - Current value (single mode)\n * @attr {number} from - Lower bound (range mode)\n * @attr {number} to - Upper bound (range mode)\n * @attr {boolean} range - Activate range mode\n * @attr {boolean} disabled - Disable interaction\n * @attr {string} name - Form field name (single mode)\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n * @attr {string} size - 'sm' | 'md' | 'lg'\n * @attr {string} helper - Helper text below the slider\n * @attr {string} error - Error message below the slider\n *\n * @fires change - detail always includes `value`; single mode: { value: number }, range mode: { value: { from, to }, from, to }, plus optional originalEvent\n *\n * @slot - Slider label text\n *\n * @part slider - Slider container\n * @part track - Track element\n * @part fill - Fill element\n * @part thumb - Single-value thumb\n * @part thumb-start - Range start thumb\n * @part thumb-end - Range end thumb\n * @part label - Label element\n * @part helper-text - The helper/error text element\n *\n * @cssprop --slider-height - Track height\n * @cssprop --slider-size - Thumb dimensions\n * @cssprop --slider-track-bg - Track background color\n * @cssprop --slider-fill - Active fill color\n * @cssprop --slider-thumb-bg - Thumb background color\n *\n * @example\n * ```html\n * <ore-slider value=\"50\" name=\"volume\">Volume</ore-slider>\n * <ore-slider range from=\"20\" to=\"80\" color=\"primary\">Price range</ore-slider>\n * ```\n */\nexport const SLIDER_TAG = 'ore-slider' as const;\ndefine<OreSliderProps>(SLIDER_TAG, {\n formAssociated: true,\n props: {\n ...themableBundle,\n ...sizableBundle,\n ...disablableBundle,\n error: prop.string(),\n from: prop.number(0),\n 'from-value-text': prop.string(),\n helper: prop.string(),\n max: prop.number(100),\n min: prop.number(0),\n name: prop.string(),\n range: prop.bool(false),\n step: prop.number(1),\n to: prop.number(100),\n 'to-value-text': prop.string(),\n value: prop.number(0),\n 'value-text': prop.string(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreSliderEvents>();\n const slots = useSlots();\n\n // Treat `range` as static — determined at first render\n const isRange = props.range.value;\n // ── Shared helpers ────────────────────────────────────────────\n const sliderControl = createSliderControl({\n max: props.max,\n min: props.min,\n step: props.step,\n });\n // ── Single-value state ────────────────────────────────────────\n const formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n const isDragging = signal(false);\n const isDisabled = fCtxProps.disabled;\n const labelledById = signal<string | undefined>(undefined);\n const assistiveId = createStableId('helper');\n const assistive = createErrorHelperState({ error: props.error, helper: props.helper });\n const errorText = computed(() => assistive.value.errorText);\n const helperText = computed(() => assistive.value.helperText);\n const ariaDescribedBy = computed(() => (errorText.value || helperText.value ? assistiveId : null));\n\n bind({\n attr: {\n 'data-dragging': () => (isDragging.value ? true : undefined),\n size: fCtxProps.size,\n },\n });\n\n let sliderFd:\n | {\n reportValidity: () => boolean;\n }\n | undefined;\n const valueSignal = signal('0');\n\n if (!isRange) {\n sliderFd = useField({ disabled: isDisabled, value: valueSignal });\n watch(\n props.value,\n (v) => {\n valueSignal.value = String(v);\n },\n { immediate: true },\n );\n bind({\n attr: {\n ariaDescribedby: () => ariaDescribedBy.value ?? null,\n ariaDisabled: () => (isDisabled.value ? 'true' : null),\n ariaLabelledby: () => labelledById.value ?? null,\n ariaValuemax: () => sliderControl.max(),\n ariaValuemin: () => sliderControl.min(),\n ariaValuenow: () => Number(valueSignal.value || 0),\n ariaValuetext: () => props['value-text'].value ?? null,\n role: () => 'slider',\n tabindex: () => (isDisabled.value ? null : '0'),\n },\n });\n }\n\n // ── Range state ───────────────────────────────────────────────\n const startVal = signal(0);\n const endVal = signal(100);\n\n if (isRange) {\n sliderFd = useField<{\n from: number;\n to: number;\n }>({\n disabled: isDisabled,\n toFormValue: ({ from, to }) => {\n const name = props.name.value;\n\n if (!name) return null;\n\n const fd = new FormData();\n\n fd.append(`${name}[from]`, String(from));\n fd.append(`${name}[to]`, String(to));\n\n return fd;\n },\n value: computed(() => ({ from: startVal.value, to: endVal.value })),\n });\n watch(\n props.from,\n (v) => {\n startVal.value = sliderControl.snap(Number(v));\n },\n { immediate: true },\n );\n watch(\n props.to,\n (v) => {\n endVal.value = sliderControl.snap(Number(v));\n },\n { immediate: true },\n );\n }\n\n // ── Refs ──────────────────────────────────────────────────────\n const containerRef = ref<HTMLDivElement>();\n const labelRef = ref<HTMLSpanElement>();\n const thumbStartRef = ref<HTMLDivElement>();\n const thumbEndRef = ref<HTMLDivElement>();\n const startId = createStableId('slider-start');\n const endId = createStableId('slider-end');\n // ── CSS update helpers ────────────────────────────────────────\n const updateSingleCSS = (value: number) => {\n const pct = sliderControl.toPercent(value);\n\n el.style.setProperty('--_thumb-pos', `${pct}%`);\n el.style.setProperty('--_fill-start', '0%');\n el.style.setProperty('--_fill-width', `${pct}%`);\n };\n const updateRangeCSS = () => {\n const s = sliderControl.toPercent(startVal.value);\n const e = sliderControl.toPercent(endVal.value);\n\n el.style.setProperty('--_thumb-start', `${s}%`);\n el.style.setProperty('--_thumb-end', `${e}%`);\n el.style.setProperty('--_fill-start', `${s}%`);\n el.style.setProperty('--_fill-width', `${e - s}%`);\n };\n\n // ── Range mode setup ──────────────────────────────────────────\n const triggerValidation = (on: 'blur' | 'change') => {\n if (formCtx?.validateOn?.value === on) {\n sliderFd?.reportValidity();\n }\n };\n\n const setupRangeMode = (container: HTMLDivElement) => {\n updateRangeCSS();\n\n const clientToValue = (clientX: number) => {\n const rect = container.getBoundingClientRect();\n\n return sliderControl.fromClientX(clientX, rect);\n };\n let dragging: 'start' | 'end' | null = null;\n const applyDrag = (val: number) => {\n if (dragging === 'start') startVal.value = Math.min(sliderControl.snap(val), endVal.value);\n else if (dragging === 'end') endVal.value = Math.max(sliderControl.snap(val), startVal.value);\n\n startVal.value = sliderControl.clamp(startVal.value);\n endVal.value = sliderControl.clamp(endVal.value);\n updateRangeCSS();\n emit('change', {\n from: startVal.value,\n to: endVal.value,\n value: { from: startVal.value, to: endVal.value },\n });\n triggerValidation('change');\n };\n\n onEvent(\n container,\n 'pointerdown',\n guard(\n () => !isDisabled.value,\n (e: PointerEvent) => {\n e.preventDefault();\n\n const val = clientToValue(e.clientX);\n\n dragging = Math.abs(val - startVal.value) <= Math.abs(val - endVal.value) ? 'start' : 'end';\n (e.target as Element).setPointerCapture(e.pointerId);\n applyDrag(val);\n },\n ),\n );\n onEvent(\n container,\n 'pointermove',\n guard(\n () => !!dragging,\n (e: PointerEvent) => {\n e.preventDefault();\n\n if (!isDragging.value) isDragging.value = true;\n\n applyDrag(clientToValue(e.clientX));\n },\n ),\n );\n onEvent(\n container,\n 'pointerup',\n guard(\n () => !!dragging,\n (e: PointerEvent) => {\n e.preventDefault();\n dragging = null;\n isDragging.value = false;\n (e.target as Element).releasePointerCapture(e.pointerId);\n },\n ),\n );\n\n const makeThumbKeydown = (getVal: () => number, setVal: (v: number) => void) => (e: KeyboardEvent) => {\n if (isDisabled.value) return;\n\n const next = sliderControl.nextFromKey(e.key, getVal());\n\n if (next === null) return;\n\n e.preventDefault();\n setVal(sliderControl.snap(next));\n updateRangeCSS();\n emit('change', {\n from: startVal.value,\n originalEvent: e,\n to: endVal.value,\n value: { from: startVal.value, to: endVal.value },\n });\n triggerValidation('change');\n };\n const thumbStartEl = thumbStartRef.value;\n const thumbEndEl = thumbEndRef.value;\n\n if (thumbStartEl) {\n onEvent(\n thumbStartEl,\n 'keydown',\n makeThumbKeydown(\n () => startVal.value,\n (v) => {\n startVal.value = Math.min(v, endVal.value);\n },\n ),\n );\n onCleanup(\n aria(thumbStartEl, {\n label: 'Range start',\n valuemax: () => endVal.value,\n valuemin: () => sliderControl.min(),\n valuenow: () => startVal.value,\n valuetext: () => props['from-value-text'].value ?? null,\n }),\n );\n }\n\n if (thumbEndEl) {\n onEvent(\n thumbEndEl,\n 'keydown',\n makeThumbKeydown(\n () => endVal.value,\n (v) => {\n endVal.value = Math.max(v, startVal.value);\n },\n ),\n );\n onCleanup(\n aria(thumbEndEl, {\n label: 'Range end',\n valuemax: () => sliderControl.max(),\n valuemin: () => startVal.value,\n valuenow: () => endVal.value,\n valuetext: () => props['to-value-text'].value ?? null,\n }),\n );\n }\n };\n // ── Single-value mode setup ───────────────────────────────────\n const setupSingleMode = (container: HTMLDivElement) => {\n updateSingleCSS(Number(valueSignal.value));\n\n const updateValue = (clientX: number) => {\n if (isDisabled.value) return;\n\n const rect = container.getBoundingClientRect();\n const newValue = sliderControl.fromClientX(clientX, rect);\n\n if (Number(valueSignal.value) !== newValue) {\n valueSignal.value = newValue.toString();\n updateSingleCSS(newValue);\n emit('change', { value: newValue });\n triggerValidation('change');\n }\n };\n let isPointerDragging = false;\n\n onEvent(\n container,\n 'pointerdown',\n guard(\n () => !isDisabled.value,\n (e: PointerEvent) => {\n e.preventDefault();\n isPointerDragging = true;\n updateValue(e.clientX);\n (e.target as Element).setPointerCapture(e.pointerId);\n },\n ),\n );\n onEvent(\n container,\n 'pointermove',\n guard(\n () => isPointerDragging,\n (e: PointerEvent) => {\n e.preventDefault();\n\n if (!isDragging.value) isDragging.value = true;\n\n updateValue(e.clientX);\n },\n ),\n );\n onEvent(\n container,\n 'pointerup',\n guard(\n () => isPointerDragging,\n (e: PointerEvent) => {\n e.preventDefault();\n isPointerDragging = false;\n isDragging.value = false;\n (e.target as Element).releasePointerCapture(e.pointerId);\n },\n ),\n );\n onEvent(\n el,\n 'keydown',\n guard(\n () => !isDisabled.value,\n (e: KeyboardEvent) => {\n const val = Number(valueSignal.value || 0);\n const next = sliderControl.nextFromKey(e.key, val);\n\n if (next === null) return;\n\n e.preventDefault();\n\n const newValue = sliderControl.clamp(next);\n\n if (newValue !== val) {\n valueSignal.value = newValue.toString();\n updateSingleCSS(newValue);\n emit('change', { originalEvent: e, value: newValue });\n triggerValidation('change');\n }\n },\n ),\n );\n };\n\n onMounted(() => {\n const container = containerRef.value;\n\n if (!container) return;\n\n if (slots.has().value && labelRef.value) {\n const labelId = createStableId('slider-label');\n\n labelRef.value.id = labelId;\n\n if (!isRange) labelledById.value = labelId;\n }\n\n if (isRange) setupRangeMode(container);\n else setupSingleMode(container);\n });\n\n return html`\n <div class=\"slider-container\" part=\"slider\" ref=${containerRef}>\n <div class=\"slider-track\" part=\"track\">\n <div class=\"slider-fill\" part=\"fill\"></div>\n <div class=\"slider-thumb slider-thumb-sole\" part=\"thumb\"></div>\n <div\n class=\"slider-thumb slider-thumb-start\"\n part=\"thumb-start\"\n ref=${thumbStartRef}\n role=\"slider\"\n tabindex=\"${() => (isDisabled.value ? '-1' : '0')}\"\n :aria-describedby=\"${ariaDescribedBy}\"\n id=\"${startId}\"></div>\n <div\n class=\"slider-thumb slider-thumb-end\"\n part=\"thumb-end\"\n ref=${thumbEndRef}\n role=\"slider\"\n tabindex=\"${() => (isDisabled.value ? '-1' : '0')}\"\n :aria-describedby=\"${ariaDescribedBy}\"\n id=\"${endId}\"></div>\n </div>\n </div>\n <span class=\"label\" part=\"label\" ref=${labelRef}><slot></slot></span>\n ${renderHelperRegion(assistiveId, errorText, helperText)}\n `;\n },\n styles: [\n disabledStateMixin,\n colorThemeMixin,\n sizeVariantMixin(SLIDER_SIZE_PRESET),\n componentStyles,\n coarsePointerMixin,\n ],\n});\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAM,KACsB,GAA0B,OACnD,MAAM;CACL,AAAI,EAAU,KAAG,EAAQ,CAAC;AAC5B,GAyFW,IAAa;AAC1B,EAAuB,GAAY;CACjC,gBAAgB;CAChB,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;EACH,OAAO,EAAK,OAAO;EACnB,MAAM,EAAK,OAAO,CAAC;EACnB,mBAAmB,EAAK,OAAO;EAC/B,QAAQ,EAAK,OAAO;EACpB,KAAK,EAAK,OAAO,GAAG;EACpB,KAAK,EAAK,OAAO,CAAC;EAClB,MAAM,EAAK,OAAO;EAClB,OAAO,EAAK,KAAK,EAAK;EACtB,MAAM,EAAK,OAAO,CAAC;EACnB,IAAI,EAAK,OAAO,GAAG;EACnB,iBAAiB,EAAK,OAAO;EAC7B,OAAO,EAAK,OAAO,CAAC;EACpB,cAAc,EAAK,OAAO;CAC5B;CACA,MAAM,GAAO;EACX,IAAM,IAAK,EAAQ,GACb,IAAO,EAAyB,GAChC,IAAQ,EAAS,GAGjB,IAAU,EAAM,MAAM,OAEtB,IAAgB,EAAoB;GACxC,KAAK,EAAM;GACX,KAAK,EAAM;GACX,MAAM,EAAM;EACd,CAAC,GAEK,IAAU,EAAO,CAAQ,GACzB,IAAY,EAAe,GAAO,CAAO,GACzC,IAAa,E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AC"}
1
+ {"version":3,"file":"slider.js","names":[],"sources":["../src/inputs/slider/slider.ts"],"sourcesContent":["import {\n createStableId,\n define,\n html,\n inject,\n prop,\n ref,\n aria,\n bind,\n getHost,\n onCleanup,\n onEvent,\n onMounted,\n useEmit,\n useSlots,\n} from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\nimport { computed, signal, watch } from '@vielzeug/ripple';\n\nimport type { ComponentSize, ThemeColor } from '../../types';\n\nimport { createErrorHelperState, createSliderControl } from '../../headless';\nimport { disablableBundle, sizableBundle, SLIDER_SIZE_PRESET, themableBundle } from '../../shared';\nimport { coarsePointerMixin, colorThemeMixin, disabledStateMixin, sizeVariantMixin } from '../../styles';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { renderHelperRegion } from '../shared/templates';\nimport componentStyles from './slider.css?inline';\n\nconst guard =\n <E extends Event = Event>(condition: () => unknown, handler: (e: E) => void): ((e: E) => void) =>\n (e) => {\n if (condition()) handler(e);\n };\n\n/** Slider component properties */\n\nexport type OreSliderEvents = {\n change: { from?: number; originalEvent?: Event; to?: number; value: number | { from: number; to: number } };\n};\n\nexport type OreSliderProps = {\n /** Theme color */\n color?: ThemeColor;\n /** Disable interaction */\n disabled?: boolean;\n /** Error message — marks the field as invalid (fallback when the `error` slot is empty) */\n error?: string;\n /** Range mode: lower bound */\n from?: number | string;\n /** Range mode a11y label for the start thumb (e.g. \"$20\") */\n 'from-value-text'?: string;\n /** Helper text displayed below the slider (fallback when the `helper` slot is empty) */\n helper?: string;\n /** Maximum value */\n max?: number | string;\n /** Minimum value */\n min?: number | string;\n /** Single-value mode: form field name */\n name?: string;\n /** Activate two-thumb range selection */\n range?: boolean;\n /** Component size */\n size?: ComponentSize;\n /** Step increment */\n step?: number | string;\n /** Range mode: upper bound */\n to?: number | string;\n /** Range mode a11y label for the end thumb (e.g. \"$80\") */\n 'to-value-text'?: string;\n /** Single-value mode: current value */\n value?: number | string;\n /** Single-value mode a11y label override (e.g. \"75%\"). Overrides raw aria-valuenow. */\n 'value-text'?: string;\n};\n\n/**\n * A slider for selecting a single numeric value or a numeric range.\n *\n * Add the boolean `range` attribute to activate two-thumb range mode.\n *\n * @element ore-slider\n *\n * @attr {number} min - Minimum value (default: 0)\n * @attr {number} max - Maximum value (default: 100)\n * @attr {number} step - Step increment (default: 1)\n * @attr {number} value - Current value (single mode)\n * @attr {number} from - Lower bound (range mode)\n * @attr {number} to - Upper bound (range mode)\n * @attr {boolean} range - Activate range mode\n * @attr {boolean} disabled - Disable interaction\n * @attr {string} name - Form field name (single mode)\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n * @attr {string} size - 'sm' | 'md' | 'lg'\n * @attr {string} helper - Helper text below the slider\n * @attr {string} error - Error message below the slider\n *\n * @fires change - detail always includes `value`; single mode: { value: number }, range mode: { value: { from, to }, from, to }, plus optional originalEvent\n *\n * @slot - Slider label text\n *\n * @part slider - Slider container\n * @part track - Track element\n * @part fill - Fill element\n * @part thumb - Single-value thumb\n * @part thumb-start - Range start thumb\n * @part thumb-end - Range end thumb\n * @part label - Label element\n * @part helper-text - The helper/error text element\n *\n * @cssprop --slider-height - Track height\n * @cssprop --slider-size - Thumb dimensions\n * @cssprop --slider-track-bg - Track background color\n * @cssprop --slider-fill - Active fill color\n * @cssprop --slider-thumb-bg - Thumb background color\n *\n * @example\n * ```html\n * <ore-slider value=\"50\" name=\"volume\">Volume</ore-slider>\n * <ore-slider range from=\"20\" to=\"80\" color=\"primary\">Price range</ore-slider>\n * ```\n */\nexport const SLIDER_TAG = 'ore-slider' as const;\ndefine<OreSliderProps>(SLIDER_TAG, {\n formAssociated: true,\n props: {\n ...themableBundle,\n ...sizableBundle,\n ...disablableBundle,\n error: prop.string(),\n from: prop.number(0),\n 'from-value-text': prop.string(),\n helper: prop.string(),\n max: prop.number(100),\n min: prop.number(0),\n name: prop.string(),\n range: prop.bool(false),\n step: prop.number(1),\n to: prop.number(100),\n 'to-value-text': prop.string(),\n value: prop.number(0),\n 'value-text': prop.string(),\n },\n setup(props) {\n const el = getHost();\n const emit = useEmit<OreSliderEvents>();\n const slots = useSlots();\n\n // Treat `range` as static — determined at first render\n const isRange = props.range.value;\n // ── Shared helpers ────────────────────────────────────────────\n const sliderControl = createSliderControl({\n max: props.max,\n min: props.min,\n step: props.step,\n });\n // ── Single-value state ────────────────────────────────────────\n const formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n const isDragging = signal(false);\n const isDisabled = fCtxProps.disabled;\n const labelledById = signal<string | undefined>(undefined);\n const assistiveId = createStableId('helper');\n const assistive = createErrorHelperState({ error: props.error, helper: props.helper });\n const errorText = computed(() => assistive.value.errorText);\n const helperText = computed(() => assistive.value.helperText);\n const ariaDescribedBy = computed(() => (errorText.value || helperText.value ? assistiveId : null));\n\n bind({\n attr: {\n 'data-dragging': () => (isDragging.value ? true : undefined),\n size: fCtxProps.size,\n },\n });\n\n let sliderFd:\n | {\n reportValidity: () => boolean;\n }\n | undefined;\n const valueSignal = signal('0');\n\n if (!isRange) {\n sliderFd = useField({ disabled: isDisabled, value: valueSignal });\n watch(\n props.value,\n (v) => {\n valueSignal.value = String(v);\n },\n { immediate: true },\n );\n bind({\n attr: {\n ariaDescribedby: () => ariaDescribedBy.value ?? null,\n ariaDisabled: () => (isDisabled.value ? 'true' : null),\n ariaLabelledby: () => labelledById.value ?? null,\n ariaValuemax: () => sliderControl.max(),\n ariaValuemin: () => sliderControl.min(),\n ariaValuenow: () => Number(valueSignal.value || 0),\n ariaValuetext: () => props['value-text'].value ?? null,\n role: () => 'slider',\n tabindex: () => (isDisabled.value ? null : '0'),\n },\n });\n }\n\n // ── Range state ───────────────────────────────────────────────\n const startVal = signal(0);\n const endVal = signal(100);\n\n if (isRange) {\n sliderFd = useField<{\n from: number;\n to: number;\n }>({\n disabled: isDisabled,\n toFormValue: ({ from, to }) => {\n const name = props.name.value;\n\n if (!name) return null;\n\n const fd = new FormData();\n\n fd.append(`${name}[from]`, String(from));\n fd.append(`${name}[to]`, String(to));\n\n return fd;\n },\n value: computed(() => ({ from: startVal.value, to: endVal.value })),\n });\n watch(\n props.from,\n (v) => {\n startVal.value = sliderControl.snap(Number(v));\n },\n { immediate: true },\n );\n watch(\n props.to,\n (v) => {\n endVal.value = sliderControl.snap(Number(v));\n },\n { immediate: true },\n );\n }\n\n // ── Refs ──────────────────────────────────────────────────────\n const containerRef = ref<HTMLDivElement>();\n const labelRef = ref<HTMLSpanElement>();\n const thumbStartRef = ref<HTMLDivElement>();\n const thumbEndRef = ref<HTMLDivElement>();\n const startId = createStableId('slider-start');\n const endId = createStableId('slider-end');\n // ── CSS update helpers ────────────────────────────────────────\n const updateSingleCSS = (value: number) => {\n const pct = sliderControl.toPercent(value);\n\n el.style.setProperty('--_thumb-pos', `${pct}%`);\n el.style.setProperty('--_fill-start', '0%');\n el.style.setProperty('--_fill-width', `${pct}%`);\n };\n const updateRangeCSS = () => {\n const s = sliderControl.toPercent(startVal.value);\n const e = sliderControl.toPercent(endVal.value);\n\n el.style.setProperty('--_thumb-start', `${s}%`);\n el.style.setProperty('--_thumb-end', `${e}%`);\n el.style.setProperty('--_fill-start', `${s}%`);\n el.style.setProperty('--_fill-width', `${e - s}%`);\n };\n\n // ── Range mode setup ──────────────────────────────────────────\n const triggerValidation = (on: 'blur' | 'change') => {\n if (formCtx?.validateOn?.value === on) {\n sliderFd?.reportValidity();\n }\n };\n\n const setupRangeMode = (container: HTMLDivElement) => {\n updateRangeCSS();\n\n const clientToValue = (clientX: number) => {\n const rect = container.getBoundingClientRect();\n\n return sliderControl.fromClientX(clientX, rect);\n };\n let dragging: 'start' | 'end' | null = null;\n const applyDrag = (val: number) => {\n if (dragging === 'start') startVal.value = Math.min(sliderControl.snap(val), endVal.value);\n else if (dragging === 'end') endVal.value = Math.max(sliderControl.snap(val), startVal.value);\n\n startVal.value = sliderControl.clamp(startVal.value);\n endVal.value = sliderControl.clamp(endVal.value);\n updateRangeCSS();\n emit('change', {\n from: startVal.value,\n to: endVal.value,\n value: { from: startVal.value, to: endVal.value },\n });\n triggerValidation('change');\n };\n\n onEvent(\n container,\n 'pointerdown',\n guard(\n () => !isDisabled.value,\n (e: PointerEvent) => {\n e.preventDefault();\n\n const val = clientToValue(e.clientX);\n\n dragging = Math.abs(val - startVal.value) <= Math.abs(val - endVal.value) ? 'start' : 'end';\n (e.target as Element).setPointerCapture(e.pointerId);\n applyDrag(val);\n },\n ),\n );\n onEvent(\n container,\n 'pointermove',\n guard(\n () => !!dragging,\n (e: PointerEvent) => {\n e.preventDefault();\n\n if (!isDragging.value) isDragging.value = true;\n\n applyDrag(clientToValue(e.clientX));\n },\n ),\n );\n onEvent(\n container,\n 'pointerup',\n guard(\n () => !!dragging,\n (e: PointerEvent) => {\n e.preventDefault();\n dragging = null;\n isDragging.value = false;\n (e.target as Element).releasePointerCapture(e.pointerId);\n },\n ),\n );\n\n const makeThumbKeydown = (getVal: () => number, setVal: (v: number) => void) => (e: KeyboardEvent) => {\n if (isDisabled.value) return;\n\n const next = sliderControl.nextFromKey(e.key, getVal());\n\n if (next === null) return;\n\n e.preventDefault();\n setVal(sliderControl.snap(next));\n updateRangeCSS();\n emit('change', {\n from: startVal.value,\n originalEvent: e,\n to: endVal.value,\n value: { from: startVal.value, to: endVal.value },\n });\n triggerValidation('change');\n };\n const thumbStartEl = thumbStartRef.value;\n const thumbEndEl = thumbEndRef.value;\n\n if (thumbStartEl) {\n onEvent(\n thumbStartEl,\n 'keydown',\n makeThumbKeydown(\n () => startVal.value,\n (v) => {\n startVal.value = Math.min(v, endVal.value);\n },\n ),\n );\n onCleanup(\n aria(thumbStartEl, {\n label: 'Range start',\n valuemax: () => endVal.value,\n valuemin: () => sliderControl.min(),\n valuenow: () => startVal.value,\n valuetext: () => props['from-value-text'].value ?? null,\n }),\n );\n }\n\n if (thumbEndEl) {\n onEvent(\n thumbEndEl,\n 'keydown',\n makeThumbKeydown(\n () => endVal.value,\n (v) => {\n endVal.value = Math.max(v, startVal.value);\n },\n ),\n );\n onCleanup(\n aria(thumbEndEl, {\n label: 'Range end',\n valuemax: () => sliderControl.max(),\n valuemin: () => startVal.value,\n valuenow: () => endVal.value,\n valuetext: () => props['to-value-text'].value ?? null,\n }),\n );\n }\n };\n // ── Single-value mode setup ───────────────────────────────────\n const setupSingleMode = (container: HTMLDivElement) => {\n updateSingleCSS(Number(valueSignal.value));\n\n const updateValue = (clientX: number) => {\n if (isDisabled.value) return;\n\n const rect = container.getBoundingClientRect();\n const newValue = sliderControl.fromClientX(clientX, rect);\n\n if (Number(valueSignal.value) !== newValue) {\n valueSignal.value = newValue.toString();\n updateSingleCSS(newValue);\n emit('change', { value: newValue });\n triggerValidation('change');\n }\n };\n let isPointerDragging = false;\n\n onEvent(\n container,\n 'pointerdown',\n guard(\n () => !isDisabled.value,\n (e: PointerEvent) => {\n e.preventDefault();\n isPointerDragging = true;\n updateValue(e.clientX);\n (e.target as Element).setPointerCapture(e.pointerId);\n },\n ),\n );\n onEvent(\n container,\n 'pointermove',\n guard(\n () => isPointerDragging,\n (e: PointerEvent) => {\n e.preventDefault();\n\n if (!isDragging.value) isDragging.value = true;\n\n updateValue(e.clientX);\n },\n ),\n );\n onEvent(\n container,\n 'pointerup',\n guard(\n () => isPointerDragging,\n (e: PointerEvent) => {\n e.preventDefault();\n isPointerDragging = false;\n isDragging.value = false;\n (e.target as Element).releasePointerCapture(e.pointerId);\n },\n ),\n );\n onEvent(\n el,\n 'keydown',\n guard(\n () => !isDisabled.value,\n (e: KeyboardEvent) => {\n const val = Number(valueSignal.value || 0);\n const next = sliderControl.nextFromKey(e.key, val);\n\n if (next === null) return;\n\n e.preventDefault();\n\n const newValue = sliderControl.clamp(next);\n\n if (newValue !== val) {\n valueSignal.value = newValue.toString();\n updateSingleCSS(newValue);\n emit('change', { originalEvent: e, value: newValue });\n triggerValidation('change');\n }\n },\n ),\n );\n };\n\n onMounted(() => {\n const container = containerRef.value;\n\n if (!container) return;\n\n if (slots.has().value && labelRef.value) {\n const labelId = createStableId('slider-label');\n\n labelRef.value.id = labelId;\n\n if (!isRange) labelledById.value = labelId;\n }\n\n if (isRange) setupRangeMode(container);\n else setupSingleMode(container);\n });\n\n return html`\n <div class=\"slider-container\" part=\"slider\" ref=${containerRef}>\n <div class=\"slider-track\" part=\"track\">\n <div class=\"slider-fill\" part=\"fill\"></div>\n <div class=\"slider-thumb slider-thumb-sole\" part=\"thumb\"></div>\n <div\n class=\"slider-thumb slider-thumb-start\"\n part=\"thumb-start\"\n ref=${thumbStartRef}\n role=\"slider\"\n tabindex=\"${() => (isDisabled.value ? '-1' : '0')}\"\n :aria-describedby=\"${ariaDescribedBy}\"\n id=\"${startId}\"></div>\n <div\n class=\"slider-thumb slider-thumb-end\"\n part=\"thumb-end\"\n ref=${thumbEndRef}\n role=\"slider\"\n tabindex=\"${() => (isDisabled.value ? '-1' : '0')}\"\n :aria-describedby=\"${ariaDescribedBy}\"\n id=\"${endId}\"></div>\n </div>\n </div>\n <span class=\"label\" part=\"label\" ref=${labelRef}><slot></slot></span>\n ${renderHelperRegion(assistiveId, errorText, helperText)}\n `;\n },\n styles: [\n disabledStateMixin,\n colorThemeMixin,\n sizeVariantMixin(SLIDER_SIZE_PRESET),\n componentStyles,\n coarsePointerMixin,\n ],\n});\n"],"mappings":";;;;;;;;;;;;;;;AA4BA,IAAM,KACsB,GAA0B,OACnD,MAAM;CACL,AAAI,EAAU,KAAG,EAAQ,CAAC;AAC5B,GAyFW,IAAa;AAC1B,EAAuB,GAAY;CACjC,gBAAgB;CAChB,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;EACH,OAAO,EAAK,OAAO;EACnB,MAAM,EAAK,OAAO,CAAC;EACnB,mBAAmB,EAAK,OAAO;EAC/B,QAAQ,EAAK,OAAO;EACpB,KAAK,EAAK,OAAO,GAAG;EACpB,KAAK,EAAK,OAAO,CAAC;EAClB,MAAM,EAAK,OAAO;EAClB,OAAO,EAAK,KAAK,EAAK;EACtB,MA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Q;IACrC;IAEA,AAAI,IAAS,EAAe,CAAS,IAChC,EAAgB,CAAS;GAH9B;EAIF,CAAC,GAEM,CAAI;wDACyC,EAAa;;;;;;;kBAOnD,EAAc;;8BAED,EAAW,QAAQ,OAAO,IAAK;iCAC7B,EAAgB;kBAC/B,EAAQ;;;;kBAIR,EAAY;;8BAEC,EAAW,QAAQ,OAAO,IAAK;iCAC7B,EAAgB;kBAC/B,EAAM;;;6CAGqB,EAAS;QAC9C,EAAmB,GAAa,GAAW,CAAU,EAAE;;CAE7D;CACA,QAAQ;EACN;EACA;EACA,EAAiB,CAAkB;EACnC;EACA;CACF;AACF,CAAC"}
package/dist/switch.cjs CHANGED
@@ -1,10 +1,10 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/shape.css.cjs"),t=require("./styles/mixins/states.css.cjs"),n=require("./styles/mixins/theme.css.cjs"),r=require("./shared/prop-bundles.cjs"),i=require("./shared/size-presets.cjs"),a=require("./headless/ore.cjs"),o=require("./headless/checkable.cjs"),s=require("./ore/dist/forms/field.cjs");require("./ore/dist/forms.cjs");const c=require("./inputs/shared/field-binding.cjs"),l=require("./inputs/shared/form-context.cjs"),u=require("./inputs/shared/templates.cjs"),d=require("./inputs/switch/switch.css.cjs");let f=require("@vielzeug/ore");var p=`ore-switch`;(0,f.define)(p,{formAssociated:!0,props:{...r.themableBundle,...r.sizableBundle,...r.disablableBundle,checked:f.prop.bool(!1),error:f.prop.string(),helper:f.prop.string(),name:f.prop.string(),value:f.prop.string(`on`)},setup(e){let t=(0,f.useEmit)(),n=(0,f.inject)(l.FORM_CTX),r=l.useFormContext(e,n),i=o.createCheckable({checked:e.checked,clearIndeterminateFirst:!1,disabled:r.disabled,error:e.error,helper:e.helper,onToggle:e=>{i.triggerValidation(`change`),t(`change`,e)},prefix:`switch`,signal:a.lifecycleSignal(f.onCleanup),validateOn:n?.validateOn,value:e.value});i.attachFormField(s.useField({disabled:i.disabled,toFormValue:e=>e,value:i.checkableFormValue}));let{assistiveId:d,checked:p,disabled:m,errorText:h,handleClick:g,handleKeydown:_,helperText:v,labelId:y}=i;return c.applyCheckableBinding(r.size,{assistiveId:d,checked:p,disabled:m,errorText:h,handleClick:g,handleKeydown:_,helperText:v,labelId:y},`switch`),f.html`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/shape.css.cjs"),t=require("./styles/mixins/states.css.cjs"),n=require("./styles/mixins/theme.css.cjs"),r=require("./shared/prop-bundles.cjs"),i=require("./shared/size-presets.cjs"),a=require("./headless/ore.cjs"),o=require("./headless/checkable.cjs"),s=require("./inputs/shared/field-binding.cjs"),c=require("./inputs/shared/form-context.cjs"),l=require("./inputs/shared/templates.cjs"),u=require("./inputs/switch/switch.css.cjs");let d=require("@vielzeug/ore"),f=require("@vielzeug/ore/forms");var p=`ore-switch`;(0,d.define)(p,{formAssociated:!0,props:{...r.themableBundle,...r.sizableBundle,...r.disablableBundle,checked:d.prop.bool(!1),error:d.prop.string(),helper:d.prop.string(),name:d.prop.string(),value:d.prop.string(`on`)},setup(e){let t=(0,d.useEmit)(),n=(0,d.inject)(c.FORM_CTX),r=c.useFormContext(e,n),i=o.createCheckable({checked:e.checked,clearIndeterminateFirst:!1,disabled:r.disabled,error:e.error,helper:e.helper,onToggle:e=>{i.triggerValidation(`change`),t(`change`,e)},prefix:`switch`,signal:a.lifecycleSignal(d.onCleanup),validateOn:n?.validateOn,value:e.value});i.attachFormField((0,f.useField)({disabled:i.disabled,toFormValue:e=>e,value:i.checkableFormValue}));let{assistiveId:u,checked:p,disabled:m,errorText:h,handleClick:g,handleKeydown:_,helperText:v,labelId:y}=i;return s.applyCheckableBinding(r.size,{assistiveId:u,checked:p,disabled:m,errorText:h,handleClick:g,handleKeydown:_,helperText:v,labelId:y},`switch`),d.html`
2
2
  <div class="switch-wrapper" part="switch">
3
3
  <div class="switch-track" part="track">
4
4
  <div class="switch-thumb" part="thumb"></div>
5
5
  </div>
6
6
  </div>
7
7
  <span class="label" part="label" id="${y}"><slot></slot></span>
8
- ${u.renderHelperRegion(d,h,v)}
9
- `},styles:[n.colorThemeMixin,n.forcedColorsFormControlMixin,t.disabledStateMixin,e.sizeVariantMixin(i.SWITCH_SIZE_PRESET),d.default]}),exports.SWITCH_TAG=p;
8
+ ${l.renderHelperRegion(u,h,v)}
9
+ `},styles:[n.colorThemeMixin,n.forcedColorsFormControlMixin,t.disabledStateMixin,e.sizeVariantMixin(i.SWITCH_SIZE_PRESET),u.default]}),exports.SWITCH_TAG=p;
10
10
  //# sourceMappingURL=switch.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"switch.cjs","names":[],"sources":["../src/inputs/switch/switch.ts"],"sourcesContent":["import { define, html, inject, prop, onCleanup, useEmit } from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\n\nimport type { CheckableProps, ComponentSize, ThemeColor } from '../../types';\n\nimport { type CheckableChangePayload, lifecycleSignal, createCheckable } from '../../headless';\nimport { disablableBundle, sizableBundle, SWITCH_SIZE_PRESET, themableBundle } from '../../shared';\nimport { colorThemeMixin, disabledStateMixin, forcedColorsFormControlMixin, sizeVariantMixin } from '../../styles';\nimport { applyCheckableBinding } from '../shared/field-binding';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { renderHelperRegion } from '../shared/templates';\nimport componentStyles from './switch.css?inline';\n\nexport type OreSwitchEvents = {\n change: CheckableChangePayload;\n};\n\nexport type OreSwitchProps = CheckableProps & {\n /** Theme color */\n color?: ThemeColor;\n /** Disable interaction */\n disabled?: boolean;\n /** Error message (marks field as invalid) */\n error?: string;\n /** Helper text displayed below the switch */\n helper?: string;\n /** Component size */\n size?: ComponentSize;\n};\n\n/**\n * A toggle switch component for binary on/off states.\n *\n * @element ore-switch\n *\n * @attr {boolean} checked - Checked/on state\n * @attr {boolean} disabled - Disable switch interaction\n * @attr {string} value - Field value\n * @attr {string} name - Form field name\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n * @attr {string} size - Switch size: 'sm' | 'md' | 'lg'\n * @attr {string} error - Error message (marks field as invalid)\n * @attr {string} helper - Helper text displayed below the switch\n *\n * @fires change - Emitted when switch is toggled. detail: { checked: boolean, value: string, originalEvent?: Event }\n *\n * @slot - Switch label text\n *\n * @cssprop --switch-width - Track width\n * @cssprop --switch-height - Track height\n * @cssprop --switch-track-bg - Inactive track background color\n * @cssprop --switch-checked-bg - Active/checked track background color\n * @cssprop --switch-thumb-bg - Thumb background color\n * @cssprop --switch-font-size - Label font size\n * @part switch - The switch wrapper element\n * @part track - The switch track element\n * @part thumb - The switch thumb element\n * @part label - The label element\n * @part helper-text - The helper/error text element\n *\n * @example\n * ```html\n * <ore-switch name=\"notifications\" checked color=\"primary\">Enable notifications</ore-switch>\n * <ore-switch name=\"darkMode\" size=\"sm\">Dark mode</ore-switch>\n * <ore-switch disabled helper=\"Contact admin to change\">Admin only</ore-switch>\n * ```\n */\nexport const SWITCH_TAG = 'ore-switch' as const;\ndefine<OreSwitchProps>(SWITCH_TAG, {\n formAssociated: true,\n props: {\n ...themableBundle,\n ...sizableBundle,\n ...disablableBundle,\n checked: prop.bool(false),\n error: prop.string(),\n helper: prop.string(),\n name: prop.string(),\n value: prop.string('on'),\n },\n setup(props) {\n const emit = useEmit<OreSwitchEvents>();\n\n const formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n\n const checkable = createCheckable({\n checked: props.checked,\n clearIndeterminateFirst: false,\n disabled: fCtxProps.disabled,\n error: props.error,\n helper: props.helper,\n onToggle: (payload) => {\n checkable.triggerValidation('change');\n emit('change', payload);\n },\n prefix: 'switch',\n signal: lifecycleSignal(onCleanup),\n validateOn: formCtx?.validateOn,\n value: props.value,\n });\n\n checkable.attachFormField(\n useField<string | null>({\n disabled: checkable.disabled,\n toFormValue: (v) => v,\n value: checkable.checkableFormValue,\n }),\n );\n\n const { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId } = checkable;\n\n applyCheckableBinding(\n fCtxProps.size,\n { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId },\n 'switch',\n );\n\n return html`\n <div class=\"switch-wrapper\" part=\"switch\">\n <div class=\"switch-track\" part=\"track\">\n <div class=\"switch-thumb\" part=\"thumb\"></div>\n </div>\n </div>\n <span class=\"label\" part=\"label\" id=\"${labelId}\"><slot></slot></span>\n ${renderHelperRegion(assistiveId, errorText, helperText)}\n `;\n },\n styles: [\n colorThemeMixin,\n forcedColorsFormControlMixin,\n disabledStateMixin,\n sizeVariantMixin(SWITCH_SIZE_PRESET),\n componentStyles,\n ],\n});\n"],"mappings":"goBAmEA,IAAa,EAAa,0BACH,EAAY,CACjC,eAAgB,GAChB,MAAO,CACL,GAAG,EAAA,eACH,GAAG,EAAA,cACH,GAAG,EAAA,iBACH,QAAS,EAAA,KAAK,KAAK,EAAK,EACxB,MAAO,EAAA,KAAK,OAAO,EACnB,OAAQ,EAAA,KAAK,OAAO,EACpB,KAAM,EAAA,KAAK,OAAO,EAClB,MAAO,EAAA,KAAK,OAAO,IAAI,CACzB,EACA,MAAM,EAAO,CACX,IAAM,GAAA,EAAA,EAAA,QAAA,CAAgC,EAEhC,GAAA,EAAA,EAAA,OAAA,CAAiB,EAAA,QAAQ,EACzB,EAAY,EAAA,eAAe,EAAO,CAAO,EAEzC,EAAY,EAAA,gBAAgB,CAChC,QAAS,EAAM,QACf,wBAAyB,GACzB,SAAU,EAAU,SACpB,MAAO,EAAM,MACb,OAAQ,EAAM,OACd,SAAW,GAAY,CACrB,EAAU,kBAAkB,QAAQ,EACpC,EAAK,SAAU,CAAO,CACxB,EACA,OAAQ,SACR,OAAQ,EAAA,gBAAgB,EAAA,SAAS,EACjC,WAAY,GAAS,WACrB,MAAO,EAAM,KACf,CAAC,EAED,EAAU,gBACR,EAAA,SAAwB,CACtB,SAAU,EAAU,SACpB,YAAc,GAAM,EACpB,MAAO,EAAU,kBACnB,CAAC,CACH,EAEA,GAAM,CAAE,cAAa,UAAS,WAAU,YAAW,cAAa,gBAAe,aAAY,WAAY,EAQvG,OANA,EAAA,sBACE,EAAU,KACV,CAAE,cAAa,UAAS,WAAU,YAAW,cAAa,gBAAe,aAAY,SAAQ,EAC7F,QACF,EAEO,EAAA,IAAI;;;;;;6CAM8B,EAAQ;QAC7C,EAAA,mBAAmB,EAAa,EAAW,CAAU,EAAE;KAE7D,EACA,OAAQ,CACN,EAAA,gBACA,EAAA,6BACA,EAAA,mBACA,EAAA,iBAAiB,EAAA,kBAAkB,EACnC,EAAA,OACF,CACF,CAAC"}
1
+ {"version":3,"file":"switch.cjs","names":[],"sources":["../src/inputs/switch/switch.ts"],"sourcesContent":["import { define, html, inject, prop, onCleanup, useEmit } from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\n\nimport type { CheckableProps, ComponentSize, ThemeColor } from '../../types';\n\nimport { type CheckableChangePayload, lifecycleSignal, createCheckable } from '../../headless';\nimport { disablableBundle, sizableBundle, SWITCH_SIZE_PRESET, themableBundle } from '../../shared';\nimport { colorThemeMixin, disabledStateMixin, forcedColorsFormControlMixin, sizeVariantMixin } from '../../styles';\nimport { applyCheckableBinding } from '../shared/field-binding';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { renderHelperRegion } from '../shared/templates';\nimport componentStyles from './switch.css?inline';\n\nexport type OreSwitchEvents = {\n change: CheckableChangePayload;\n};\n\nexport type OreSwitchProps = CheckableProps & {\n /** Theme color */\n color?: ThemeColor;\n /** Disable interaction */\n disabled?: boolean;\n /** Error message (marks field as invalid) */\n error?: string;\n /** Helper text displayed below the switch */\n helper?: string;\n /** Component size */\n size?: ComponentSize;\n};\n\n/**\n * A toggle switch component for binary on/off states.\n *\n * @element ore-switch\n *\n * @attr {boolean} checked - Checked/on state\n * @attr {boolean} disabled - Disable switch interaction\n * @attr {string} value - Field value\n * @attr {string} name - Form field name\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n * @attr {string} size - Switch size: 'sm' | 'md' | 'lg'\n * @attr {string} error - Error message (marks field as invalid)\n * @attr {string} helper - Helper text displayed below the switch\n *\n * @fires change - Emitted when switch is toggled. detail: { checked: boolean, value: string, originalEvent?: Event }\n *\n * @slot - Switch label text\n *\n * @cssprop --switch-width - Track width\n * @cssprop --switch-height - Track height\n * @cssprop --switch-track-bg - Inactive track background color\n * @cssprop --switch-checked-bg - Active/checked track background color\n * @cssprop --switch-thumb-bg - Thumb background color\n * @cssprop --switch-font-size - Label font size\n * @part switch - The switch wrapper element\n * @part track - The switch track element\n * @part thumb - The switch thumb element\n * @part label - The label element\n * @part helper-text - The helper/error text element\n *\n * @example\n * ```html\n * <ore-switch name=\"notifications\" checked color=\"primary\">Enable notifications</ore-switch>\n * <ore-switch name=\"darkMode\" size=\"sm\">Dark mode</ore-switch>\n * <ore-switch disabled helper=\"Contact admin to change\">Admin only</ore-switch>\n * ```\n */\nexport const SWITCH_TAG = 'ore-switch' as const;\ndefine<OreSwitchProps>(SWITCH_TAG, {\n formAssociated: true,\n props: {\n ...themableBundle,\n ...sizableBundle,\n ...disablableBundle,\n checked: prop.bool(false),\n error: prop.string(),\n helper: prop.string(),\n name: prop.string(),\n value: prop.string('on'),\n },\n setup(props) {\n const emit = useEmit<OreSwitchEvents>();\n\n const formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n\n const checkable = createCheckable({\n checked: props.checked,\n clearIndeterminateFirst: false,\n disabled: fCtxProps.disabled,\n error: props.error,\n helper: props.helper,\n onToggle: (payload) => {\n checkable.triggerValidation('change');\n emit('change', payload);\n },\n prefix: 'switch',\n signal: lifecycleSignal(onCleanup),\n validateOn: formCtx?.validateOn,\n value: props.value,\n });\n\n checkable.attachFormField(\n useField<string | null>({\n disabled: checkable.disabled,\n toFormValue: (v) => v,\n value: checkable.checkableFormValue,\n }),\n );\n\n const { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId } = checkable;\n\n applyCheckableBinding(\n fCtxProps.size,\n { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId },\n 'switch',\n );\n\n return html`\n <div class=\"switch-wrapper\" part=\"switch\">\n <div class=\"switch-track\" part=\"track\">\n <div class=\"switch-thumb\" part=\"thumb\"></div>\n </div>\n </div>\n <span class=\"label\" part=\"label\" id=\"${labelId}\"><slot></slot></span>\n ${renderHelperRegion(assistiveId, errorText, helperText)}\n `;\n },\n styles: [\n colorThemeMixin,\n forcedColorsFormControlMixin,\n disabledStateMixin,\n sizeVariantMixin(SWITCH_SIZE_PRESET),\n componentStyles,\n ],\n});\n"],"mappings":"mlBAmEA,IAAa,EAAa,0BACH,EAAY,CACjC,eAAgB,GAChB,MAAO,CACL,GAAG,EAAA,eACH,GAAG,EAAA,cACH,GAAG,EAAA,iBACH,QAAS,EAAA,KAAK,KAAK,EAAK,EACxB,MAAO,EAAA,KAAK,OAAO,EACnB,OAAQ,EAAA,KAAK,OAAO,EACpB,KAAM,EAAA,KAAK,OAAO,EAClB,MAAO,EAAA,KAAK,OAAO,IAAI,CACzB,EACA,MAAM,EAAO,CACX,IAAM,GAAA,EAAA,EAAA,QAAA,CAAgC,EAEhC,GAAA,EAAA,EAAA,OAAA,CAAiB,EAAA,QAAQ,EACzB,EAAY,EAAA,eAAe,EAAO,CAAO,EAEzC,EAAY,EAAA,gBAAgB,CAChC,QAAS,EAAM,QACf,wBAAyB,GACzB,SAAU,EAAU,SACpB,MAAO,EAAM,MACb,OAAQ,EAAM,OACd,SAAW,GAAY,CACrB,EAAU,kBAAkB,QAAQ,EACpC,EAAK,SAAU,CAAO,CACxB,EACA,OAAQ,SACR,OAAQ,EAAA,gBAAgB,EAAA,SAAS,EACjC,WAAY,GAAS,WACrB,MAAO,EAAM,KACf,CAAC,EAED,EAAU,iBAAA,EAAA,EAAA,SAAA,CACgB,CACtB,SAAU,EAAU,SACpB,YAAc,GAAM,EACpB,MAAO,EAAU,kBACnB,CAAC,CACH,EAEA,GAAM,CAAE,cAAa,UAAS,WAAU,YAAW,cAAa,gBAAe,aAAY,WAAY,EAQvG,OANA,EAAA,sBACE,EAAU,KACV,CAAE,cAAa,UAAS,WAAU,YAAW,cAAa,gBAAe,aAAY,SAAQ,EAC7F,QACF,EAEO,EAAA,IAAI;;;;;;6CAM8B,EAAQ;QAC7C,EAAA,mBAAmB,EAAa,EAAW,CAAU,EAAE;KAE7D,EACA,OAAQ,CACN,EAAA,gBACA,EAAA,6BACA,EAAA,mBACA,EAAA,iBAAiB,EAAA,kBAAkB,EACnC,EAAA,OACF,CACF,CAAC"}
package/dist/switch.js CHANGED
@@ -5,29 +5,28 @@ import { disablableBundle as i, sizableBundle as a, themableBundle as o } from "
5
5
  import { SWITCH_SIZE_PRESET as s } from "./shared/size-presets.js";
6
6
  import { lifecycleSignal as c } from "./headless/ore.js";
7
7
  import { createCheckable as l } from "./headless/checkable.js";
8
- import { useField as u } from "./ore/dist/forms/field.js";
9
- import "./ore/dist/forms.js";
10
- import { applyCheckableBinding as d } from "./inputs/shared/field-binding.js";
11
- import { FORM_CTX as f, useFormContext as p } from "./inputs/shared/form-context.js";
12
- import { renderHelperRegion as m } from "./inputs/shared/templates.js";
13
- import h from "./inputs/switch/switch.css.js";
14
- import { define as g, html as _, inject as v, onCleanup as y, prop as b, useEmit as x } from "@vielzeug/ore";
8
+ import { applyCheckableBinding as u } from "./inputs/shared/field-binding.js";
9
+ import { FORM_CTX as d, useFormContext as f } from "./inputs/shared/form-context.js";
10
+ import { renderHelperRegion as p } from "./inputs/shared/templates.js";
11
+ import m from "./inputs/switch/switch.css.js";
12
+ import { define as h, html as g, inject as _, onCleanup as v, prop as y, useEmit as b } from "@vielzeug/ore";
13
+ import { useField as x } from "@vielzeug/ore/forms";
15
14
  //#region src/inputs/switch/switch.ts
16
15
  var S = "ore-switch";
17
- g(S, {
16
+ h(S, {
18
17
  formAssociated: !0,
19
18
  props: {
20
19
  ...o,
21
20
  ...a,
22
21
  ...i,
23
- checked: b.bool(!1),
24
- error: b.string(),
25
- helper: b.string(),
26
- name: b.string(),
27
- value: b.string("on")
22
+ checked: y.bool(!1),
23
+ error: y.string(),
24
+ helper: y.string(),
25
+ name: y.string(),
26
+ value: y.string("on")
28
27
  },
29
28
  setup(e) {
30
- let t = x(), n = v(f), r = p(e, n), i = l({
29
+ let t = b(), n = _(d), r = f(e, n), i = l({
31
30
  checked: e.checked,
32
31
  clearIndeterminateFirst: !1,
33
32
  disabled: r.disabled,
@@ -37,33 +36,33 @@ g(S, {
37
36
  i.triggerValidation("change"), t("change", e);
38
37
  },
39
38
  prefix: "switch",
40
- signal: c(y),
39
+ signal: c(v),
41
40
  validateOn: n?.validateOn,
42
41
  value: e.value
43
42
  });
44
- i.attachFormField(u({
43
+ i.attachFormField(x({
45
44
  disabled: i.disabled,
46
45
  toFormValue: (e) => e,
47
46
  value: i.checkableFormValue
48
47
  }));
49
- let { assistiveId: a, checked: o, disabled: s, errorText: h, handleClick: g, handleKeydown: b, helperText: S, labelId: C } = i;
50
- return d(r.size, {
48
+ let { assistiveId: a, checked: o, disabled: s, errorText: m, handleClick: h, handleKeydown: y, helperText: S, labelId: C } = i;
49
+ return u(r.size, {
51
50
  assistiveId: a,
52
51
  checked: o,
53
52
  disabled: s,
54
- errorText: h,
55
- handleClick: g,
56
- handleKeydown: b,
53
+ errorText: m,
54
+ handleClick: h,
55
+ handleKeydown: y,
57
56
  helperText: S,
58
57
  labelId: C
59
- }, "switch"), _`
58
+ }, "switch"), g`
60
59
  <div class="switch-wrapper" part="switch">
61
60
  <div class="switch-track" part="track">
62
61
  <div class="switch-thumb" part="thumb"></div>
63
62
  </div>
64
63
  </div>
65
64
  <span class="label" part="label" id="${C}"><slot></slot></span>
66
- ${m(a, h, S)}
65
+ ${p(a, m, S)}
67
66
  `;
68
67
  },
69
68
  styles: [
@@ -71,7 +70,7 @@ g(S, {
71
70
  r,
72
71
  t,
73
72
  e(s),
74
- h
73
+ m
75
74
  ]
76
75
  });
77
76
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","names":[],"sources":["../src/inputs/switch/switch.ts"],"sourcesContent":["import { define, html, inject, prop, onCleanup, useEmit } from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\n\nimport type { CheckableProps, ComponentSize, ThemeColor } from '../../types';\n\nimport { type CheckableChangePayload, lifecycleSignal, createCheckable } from '../../headless';\nimport { disablableBundle, sizableBundle, SWITCH_SIZE_PRESET, themableBundle } from '../../shared';\nimport { colorThemeMixin, disabledStateMixin, forcedColorsFormControlMixin, sizeVariantMixin } from '../../styles';\nimport { applyCheckableBinding } from '../shared/field-binding';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { renderHelperRegion } from '../shared/templates';\nimport componentStyles from './switch.css?inline';\n\nexport type OreSwitchEvents = {\n change: CheckableChangePayload;\n};\n\nexport type OreSwitchProps = CheckableProps & {\n /** Theme color */\n color?: ThemeColor;\n /** Disable interaction */\n disabled?: boolean;\n /** Error message (marks field as invalid) */\n error?: string;\n /** Helper text displayed below the switch */\n helper?: string;\n /** Component size */\n size?: ComponentSize;\n};\n\n/**\n * A toggle switch component for binary on/off states.\n *\n * @element ore-switch\n *\n * @attr {boolean} checked - Checked/on state\n * @attr {boolean} disabled - Disable switch interaction\n * @attr {string} value - Field value\n * @attr {string} name - Form field name\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n * @attr {string} size - Switch size: 'sm' | 'md' | 'lg'\n * @attr {string} error - Error message (marks field as invalid)\n * @attr {string} helper - Helper text displayed below the switch\n *\n * @fires change - Emitted when switch is toggled. detail: { checked: boolean, value: string, originalEvent?: Event }\n *\n * @slot - Switch label text\n *\n * @cssprop --switch-width - Track width\n * @cssprop --switch-height - Track height\n * @cssprop --switch-track-bg - Inactive track background color\n * @cssprop --switch-checked-bg - Active/checked track background color\n * @cssprop --switch-thumb-bg - Thumb background color\n * @cssprop --switch-font-size - Label font size\n * @part switch - The switch wrapper element\n * @part track - The switch track element\n * @part thumb - The switch thumb element\n * @part label - The label element\n * @part helper-text - The helper/error text element\n *\n * @example\n * ```html\n * <ore-switch name=\"notifications\" checked color=\"primary\">Enable notifications</ore-switch>\n * <ore-switch name=\"darkMode\" size=\"sm\">Dark mode</ore-switch>\n * <ore-switch disabled helper=\"Contact admin to change\">Admin only</ore-switch>\n * ```\n */\nexport const SWITCH_TAG = 'ore-switch' as const;\ndefine<OreSwitchProps>(SWITCH_TAG, {\n formAssociated: true,\n props: {\n ...themableBundle,\n ...sizableBundle,\n ...disablableBundle,\n checked: prop.bool(false),\n error: prop.string(),\n helper: prop.string(),\n name: prop.string(),\n value: prop.string('on'),\n },\n setup(props) {\n const emit = useEmit<OreSwitchEvents>();\n\n const formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n\n const checkable = createCheckable({\n checked: props.checked,\n clearIndeterminateFirst: false,\n disabled: fCtxProps.disabled,\n error: props.error,\n helper: props.helper,\n onToggle: (payload) => {\n checkable.triggerValidation('change');\n emit('change', payload);\n },\n prefix: 'switch',\n signal: lifecycleSignal(onCleanup),\n validateOn: formCtx?.validateOn,\n value: props.value,\n });\n\n checkable.attachFormField(\n useField<string | null>({\n disabled: checkable.disabled,\n toFormValue: (v) => v,\n value: checkable.checkableFormValue,\n }),\n );\n\n const { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId } = checkable;\n\n applyCheckableBinding(\n fCtxProps.size,\n { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId },\n 'switch',\n );\n\n return html`\n <div class=\"switch-wrapper\" part=\"switch\">\n <div class=\"switch-track\" part=\"track\">\n <div class=\"switch-thumb\" part=\"thumb\"></div>\n </div>\n </div>\n <span class=\"label\" part=\"label\" id=\"${labelId}\"><slot></slot></span>\n ${renderHelperRegion(assistiveId, errorText, helperText)}\n `;\n },\n styles: [\n colorThemeMixin,\n forcedColorsFormControlMixin,\n disabledStateMixin,\n sizeVariantMixin(SWITCH_SIZE_PRESET),\n componentStyles,\n ],\n});\n"],"mappings":";;;;;;;;;;;;;;;AAmEA,IAAa,IAAa;AAC1B,EAAuB,GAAY;CACjC,gBAAgB;CAChB,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;EACH,SAAS,EAAK,KAAK,EAAK;EACxB,OAAO,EAAK,OAAO;EACnB,QAAQ,EAAK,OAAO;EACpB,MAAM,EAAK,OAAO;EAClB,OAAO,EAAK,OAAO,IAAI;CACzB;CACA,MAAM,GAAO;EACX,IAAM,IAAO,EAAyB,GAEhC,IAAU,EAAO,CAAQ,GACzB,IAAY,EAAe,GAAO,CAAO,GAEzC,IAAY,EAAgB;GAChC,SAAS,EAAM;GACf,yBAAyB;GACzB,UAAU,EAAU;GACpB,OAAO,EAAM;GACb,QAAQ,EAAM;GACd,WAAW,MAAY;IAErB,AADA,EAAU,kBAAkB,QAAQ,GACpC,EAAK,UAAU,CAAO;GACxB;GACA,QAAQ;GACR,QAAQ,EAAgB,CAAS;GACjC,YAAY,GAAS;GACrB,OAAO,EAAM;EACf,CAAC;EAED,EAAU,gBACR,EAAwB;GACtB,UAAU,EAAU;GACpB,cAAc,MAAM;GACpB,OAAO,EAAU;EACnB,CAAC,CACH;EAEA,IAAM,EAAE,gBAAa,YAAS,aAAU,cAAW,gBAAa,kBAAe,eAAY,eAAY;EAQvG,OANA,EACE,EAAU,MACV;GAAE;GAAa;GAAS;GAAU;GAAW;GAAa;GAAe;GAAY;EAAQ,GAC7F,QACF,GAEO,CAAI;;;;;;6CAM8B,EAAQ;QAC7C,EAAmB,GAAa,GAAW,CAAU,EAAE;;CAE7D;CACA,QAAQ;EACN;EACA;EACA;EACA,EAAiB,CAAkB;EACnC;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"switch.js","names":[],"sources":["../src/inputs/switch/switch.ts"],"sourcesContent":["import { define, html, inject, prop, onCleanup, useEmit } from '@vielzeug/ore';\nimport { useField } from '@vielzeug/ore/forms';\n\nimport type { CheckableProps, ComponentSize, ThemeColor } from '../../types';\n\nimport { type CheckableChangePayload, lifecycleSignal, createCheckable } from '../../headless';\nimport { disablableBundle, sizableBundle, SWITCH_SIZE_PRESET, themableBundle } from '../../shared';\nimport { colorThemeMixin, disabledStateMixin, forcedColorsFormControlMixin, sizeVariantMixin } from '../../styles';\nimport { applyCheckableBinding } from '../shared/field-binding';\nimport { FORM_CTX, useFormContext } from '../shared/form-context';\nimport { renderHelperRegion } from '../shared/templates';\nimport componentStyles from './switch.css?inline';\n\nexport type OreSwitchEvents = {\n change: CheckableChangePayload;\n};\n\nexport type OreSwitchProps = CheckableProps & {\n /** Theme color */\n color?: ThemeColor;\n /** Disable interaction */\n disabled?: boolean;\n /** Error message (marks field as invalid) */\n error?: string;\n /** Helper text displayed below the switch */\n helper?: string;\n /** Component size */\n size?: ComponentSize;\n};\n\n/**\n * A toggle switch component for binary on/off states.\n *\n * @element ore-switch\n *\n * @attr {boolean} checked - Checked/on state\n * @attr {boolean} disabled - Disable switch interaction\n * @attr {string} value - Field value\n * @attr {string} name - Form field name\n * @attr {string} color - Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'\n * @attr {string} size - Switch size: 'sm' | 'md' | 'lg'\n * @attr {string} error - Error message (marks field as invalid)\n * @attr {string} helper - Helper text displayed below the switch\n *\n * @fires change - Emitted when switch is toggled. detail: { checked: boolean, value: string, originalEvent?: Event }\n *\n * @slot - Switch label text\n *\n * @cssprop --switch-width - Track width\n * @cssprop --switch-height - Track height\n * @cssprop --switch-track-bg - Inactive track background color\n * @cssprop --switch-checked-bg - Active/checked track background color\n * @cssprop --switch-thumb-bg - Thumb background color\n * @cssprop --switch-font-size - Label font size\n * @part switch - The switch wrapper element\n * @part track - The switch track element\n * @part thumb - The switch thumb element\n * @part label - The label element\n * @part helper-text - The helper/error text element\n *\n * @example\n * ```html\n * <ore-switch name=\"notifications\" checked color=\"primary\">Enable notifications</ore-switch>\n * <ore-switch name=\"darkMode\" size=\"sm\">Dark mode</ore-switch>\n * <ore-switch disabled helper=\"Contact admin to change\">Admin only</ore-switch>\n * ```\n */\nexport const SWITCH_TAG = 'ore-switch' as const;\ndefine<OreSwitchProps>(SWITCH_TAG, {\n formAssociated: true,\n props: {\n ...themableBundle,\n ...sizableBundle,\n ...disablableBundle,\n checked: prop.bool(false),\n error: prop.string(),\n helper: prop.string(),\n name: prop.string(),\n value: prop.string('on'),\n },\n setup(props) {\n const emit = useEmit<OreSwitchEvents>();\n\n const formCtx = inject(FORM_CTX);\n const fCtxProps = useFormContext(props, formCtx);\n\n const checkable = createCheckable({\n checked: props.checked,\n clearIndeterminateFirst: false,\n disabled: fCtxProps.disabled,\n error: props.error,\n helper: props.helper,\n onToggle: (payload) => {\n checkable.triggerValidation('change');\n emit('change', payload);\n },\n prefix: 'switch',\n signal: lifecycleSignal(onCleanup),\n validateOn: formCtx?.validateOn,\n value: props.value,\n });\n\n checkable.attachFormField(\n useField<string | null>({\n disabled: checkable.disabled,\n toFormValue: (v) => v,\n value: checkable.checkableFormValue,\n }),\n );\n\n const { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId } = checkable;\n\n applyCheckableBinding(\n fCtxProps.size,\n { assistiveId, checked, disabled, errorText, handleClick, handleKeydown, helperText, labelId },\n 'switch',\n );\n\n return html`\n <div class=\"switch-wrapper\" part=\"switch\">\n <div class=\"switch-track\" part=\"track\">\n <div class=\"switch-thumb\" part=\"thumb\"></div>\n </div>\n </div>\n <span class=\"label\" part=\"label\" id=\"${labelId}\"><slot></slot></span>\n ${renderHelperRegion(assistiveId, errorText, helperText)}\n `;\n },\n styles: [\n colorThemeMixin,\n forcedColorsFormControlMixin,\n disabledStateMixin,\n sizeVariantMixin(SWITCH_SIZE_PRESET),\n componentStyles,\n ],\n});\n"],"mappings":";;;;;;;;;;;;;;AAmEA,IAAa,IAAa;AAC1B,EAAuB,GAAY;CACjC,gBAAgB;CAChB,OAAO;EACL,GAAG;EACH,GAAG;EACH,GAAG;EACH,SAAS,EAAK,KAAK,EAAK;EACxB,OAAO,EAAK,OAAO;EACnB,QAAQ,EAAK,OAAO;EACpB,MAAM,EAAK,OAAO;EAClB,OAAO,EAAK,OAAO,IAAI;CACzB;CACA,MAAM,GAAO;EACX,IAAM,IAAO,EAAyB,GAEhC,IAAU,EAAO,CAAQ,GACzB,IAAY,EAAe,GAAO,CAAO,GAEzC,IAAY,EAAgB;GAChC,SAAS,EAAM;GACf,yBAAyB;GACzB,UAAU,EAAU;GACpB,OAAO,EAAM;GACb,QAAQ,EAAM;GACd,WAAW,MAAY;IAErB,AADA,EAAU,kBAAkB,QAAQ,GACpC,EAAK,UAAU,CAAO;GACxB;GACA,QAAQ;GACR,QAAQ,EAAgB,CAAS;GACjC,YAAY,GAAS;GACrB,OAAO,EAAM;EACf,CAAC;EAED,EAAU,gBACR,EAAwB;GACtB,UAAU,EAAU;GACpB,cAAc,MAAM;GACpB,OAAO,EAAU;EACnB,CAAC,CACH;EAEA,IAAM,EAAE,gBAAa,YAAS,aAAU,cAAW,gBAAa,kBAAe,eAAY,eAAY;EAQvG,OANA,EACE,EAAU,MACV;GAAE;GAAa;GAAS;GAAU;GAAW;GAAa;GAAe;GAAY;EAAQ,GAC7F,QACF,GAEO,CAAI;;;;;;6CAM8B,EAAQ;QAC7C,EAAmB,GAAa,GAAW,CAAU,EAAE;;CAE7D;CACA,QAAQ;EACN;EACA;EACA;EACA,EAAiB,CAAkB;EACnC;CACF;AACF,CAAC"}
@@ -1,14 +1,14 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./ore/dist/directives/styleMap.cjs"),t=require("./ore/dist/directives/when.cjs");require("./ore/dist/directives.cjs");const n=require("./styles/mixins/accessibility.css.cjs"),r=require("./tabs.cjs"),i=require("./disclosure/tab-panel/tab-panel.css.cjs");let a=require("@vielzeug/ore"),o=require("@vielzeug/ripple");var s={"2xl":`var(--size-12)`,lg:`var(--size-6)`,md:`var(--size-4)`,none:`0`,sm:`var(--size-2)`,xl:`var(--size-8)`,xs:`var(--size-1)`},c=`ore-tab-panel`;(0,a.define)(c,{props:{active:a.prop.bool(!1),lazy:a.prop.bool(!1),padding:a.prop.oneOf([`none`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`],`md`),value:a.prop.string(``)},setup(n){let i=a.watchEffect,c=(0,a.inject)(r.TABS_CTX),l=(0,o.computed)(()=>c?!!c.value.value&&c.value.value===n.value.value:n.active.value);(0,a.bind)({attr:{active:()=>l.value?!0:void 0}});let u=(0,o.computed)(()=>s[n.padding.value??`md`]??s.md),d=(0,o.signal)(!1);i(()=>{l.value&&(d.value=!0)});let f=(0,o.computed)(()=>!n.lazy.value||d.value),p=e.styleMap({"--tab-panel-padding":u}),m=()=>`tabpanel-${n.value.value}`,h=()=>`tab-${n.value.value}`;return a.html`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./styles/mixins/accessibility.css.cjs"),t=require("./tabs.cjs"),n=require("./disclosure/tab-panel/tab-panel.css.cjs");let r=require("@vielzeug/ore"),i=require("@vielzeug/ore/directives"),a=require("@vielzeug/ripple");var o={"2xl":`var(--size-12)`,lg:`var(--size-6)`,md:`var(--size-4)`,none:`0`,sm:`var(--size-2)`,xl:`var(--size-8)`,xs:`var(--size-1)`},s=`ore-tab-panel`;(0,r.define)(s,{props:{active:r.prop.bool(!1),lazy:r.prop.bool(!1),padding:r.prop.oneOf([`none`,`xs`,`sm`,`md`,`lg`,`xl`,`2xl`],`md`),value:r.prop.string(``)},setup(e){let n=r.watchEffect,s=(0,r.inject)(t.TABS_CTX),c=(0,a.computed)(()=>s?!!s.value.value&&s.value.value===e.value.value:e.active.value);(0,r.bind)({attr:{active:()=>c.value?!0:void 0}});let l=(0,a.computed)(()=>o[e.padding.value??`md`]??o.md),u=(0,a.signal)(!1);n(()=>{c.value&&(u.value=!0)});let d=(0,a.computed)(()=>!e.lazy.value||u.value),f=(0,i.styleMap)({"--tab-panel-padding":l}),p=()=>`tabpanel-${e.value.value}`,m=()=>`tab-${e.value.value}`;return r.html`
2
2
  <div
3
3
  class="panel"
4
4
  part="panel"
5
5
  role="tabpanel"
6
- id="${()=>m()}"
7
- aria-labelledby="${()=>h()}"
8
- aria-hidden="${()=>String(!l.value)}"
9
- :style="${p}"
6
+ id="${()=>p()}"
7
+ aria-labelledby="${()=>m()}"
8
+ aria-hidden="${()=>String(!c.value)}"
9
+ :style="${f}"
10
10
  tabindex="0">
11
- ${t.when(f,()=>a.html`<slot></slot>`)}
11
+ ${(0,i.when)(d,()=>r.html`<slot></slot>`)}
12
12
  </div>
13
- `},styles:[n.reducedMotionMixin,i.default]}),exports.TAB_PANEL_TAG=c;
13
+ `},styles:[e.reducedMotionMixin,n.default]}),exports.TAB_PANEL_TAG=s;
14
14
  //# sourceMappingURL=tab-panel.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab-panel.cjs","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, bind, watchEffect } from '@vielzeug/ore';\nimport { styleMap, when } from '@vielzeug/ore/directives';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const labelledById = () => `tab-${props.value.value}`;\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n id=\"${() => panelId()}\"\n aria-labelledby=\"${() => labelledById()}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n :style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(shouldRender, () => html`<slot></slot>`)}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":"8YAQA,IAAM,EAAmD,CACvD,MAAO,iBACP,GAAI,gBACJ,GAAI,gBACJ,KAAM,IACN,GAAI,gBACJ,GAAI,gBACJ,GAAI,eACN,EAkCa,EAAgB,6BACJ,EAAe,CACtC,MAAO,CACL,OAAQ,EAAA,KAAK,KAAK,EAAK,EACvB,KAAM,EAAA,KAAK,KAAK,EAAK,EACrB,QAAS,EAAA,KAAK,MAAM,CAAC,OAAQ,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,EAAY,IAAI,EAChF,MAAO,EAAA,KAAK,OAAO,EAAE,CACvB,EACA,MAAM,EAAO,CACX,IAAM,EAAQ,EAAA,YAER,GAAA,EAAA,EAAA,OAAA,CAAiB,EAAA,QAAQ,EACzB,GAAA,EAAA,EAAA,SAAA,KACJ,EAAU,CAAC,CAAC,EAAQ,MAAM,OAAS,EAAQ,MAAM,QAAU,EAAM,MAAM,MAAQ,EAAM,OAAO,KAC9F,GAEA,EAAA,EAAA,KAAA,CAAK,CACH,KAAM,CACJ,WAAe,EAAS,MAAQ,GAAO,IAAA,EACzC,CACF,CAAC,EAGD,IAAM,GAAA,EAAA,EAAA,SAAA,KAGG,EAFK,EAAM,QAAQ,OAAS,OAEK,EAAyB,EAClE,EAEK,GAAA,EAAA,EAAA,OAAA,CAAuB,EAAK,EAElC,MAAY,CACN,EAAS,QAAO,EAAc,MAAQ,GAC5C,CAAC,EAGD,IAAM,GAAA,EAAA,EAAA,SAAA,KAA8B,CAAC,EAAM,KAAK,OAAS,EAAc,KAAK,EACtE,EAAa,EAAA,SAAS,CAAE,sBAAuB,CAAa,CAAC,EAC7D,MAAgB,YAAY,EAAM,MAAM,QACxC,MAAqB,OAAO,EAAM,MAAM,QAE9C,MAAO,GAAA,IAAI;;;;;kBAKK,EAAQ,EAAE;+BACG,EAAa,EAAE;2BACnB,OAAO,CAAC,EAAS,KAAK,EAAE;kBACnC,EAAW;;UAEnB,EAAA,KAAK,MAAoB,EAAA,IAAI,eAAe,EAAE;;KAGtD,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAM,CACrC,CAAC"}
1
+ {"version":3,"file":"tab-panel.cjs","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, bind, watchEffect } from '@vielzeug/ore';\nimport { styleMap, when } from '@vielzeug/ore/directives';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const labelledById = () => `tab-${props.value.value}`;\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n id=\"${() => panelId()}\"\n aria-labelledby=\"${() => labelledById()}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n :style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(shouldRender, () => html`<slot></slot>`)}\n </div>\n `;\n },\n sty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AoB,EAAA,IAAI,eAAe,EAAE;;KAGtD,EACA,OAAQ,CAAC,EAAA,mBAAoB,EAAA,OAAM,CACrC,CAAC"}
package/dist/tab-panel.js CHANGED
@@ -1,10 +1,8 @@
1
- import { styleMap as e } from "./ore/dist/directives/styleMap.js";
2
- import { when as t } from "./ore/dist/directives/when.js";
3
- import "./ore/dist/directives.js";
4
- import { reducedMotionMixin as n } from "./styles/mixins/accessibility.css.js";
5
- import { TABS_CTX as r } from "./tabs.js";
6
- import i from "./disclosure/tab-panel/tab-panel.css.js";
7
- import { bind as a, define as o, html as s, inject as c, prop as l, watchEffect as u } from "@vielzeug/ore";
1
+ import { reducedMotionMixin as e } from "./styles/mixins/accessibility.css.js";
2
+ import { TABS_CTX as t } from "./tabs.js";
3
+ import n from "./disclosure/tab-panel/tab-panel.css.js";
4
+ import { bind as r, define as i, html as a, inject as o, prop as s, watchEffect as c } from "@vielzeug/ore";
5
+ import { styleMap as l, when as u } from "@vielzeug/ore/directives";
8
6
  import { computed as d, signal as f } from "@vielzeug/ripple";
9
7
  //#region src/disclosure/tab-panel/tab-panel.ts
10
8
  var p = {
@@ -16,11 +14,11 @@ var p = {
16
14
  xl: "var(--size-8)",
17
15
  xs: "var(--size-1)"
18
16
  }, m = "ore-tab-panel";
19
- o(m, {
17
+ i(m, {
20
18
  props: {
21
- active: l.bool(!1),
22
- lazy: l.bool(!1),
23
- padding: l.oneOf([
19
+ active: s.bool(!1),
20
+ lazy: s.bool(!1),
21
+ padding: s.oneOf([
24
22
  "none",
25
23
  "xs",
26
24
  "sm",
@@ -29,31 +27,31 @@ o(m, {
29
27
  "xl",
30
28
  "2xl"
31
29
  ], "md"),
32
- value: l.string("")
30
+ value: s.string("")
33
31
  },
34
- setup(n) {
35
- let i = u, o = c(r), l = d(() => o ? !!o.value.value && o.value.value === n.value.value : n.active.value);
36
- a({ attr: { active: () => l.value ? !0 : void 0 } });
37
- let m = d(() => p[n.padding.value ?? "md"] ?? p.md), h = f(!1);
38
- i(() => {
39
- l.value && (h.value = !0);
32
+ setup(e) {
33
+ let n = c, i = o(t), s = d(() => i ? !!i.value.value && i.value.value === e.value.value : e.active.value);
34
+ r({ attr: { active: () => s.value ? !0 : void 0 } });
35
+ let m = d(() => p[e.padding.value ?? "md"] ?? p.md), h = f(!1);
36
+ n(() => {
37
+ s.value && (h.value = !0);
40
38
  });
41
- let g = d(() => !n.lazy.value || h.value), _ = e({ "--tab-panel-padding": m }), v = () => `tabpanel-${n.value.value}`, y = () => `tab-${n.value.value}`;
42
- return s`
39
+ let g = d(() => !e.lazy.value || h.value), _ = l({ "--tab-panel-padding": m }), v = () => `tabpanel-${e.value.value}`, y = () => `tab-${e.value.value}`;
40
+ return a`
43
41
  <div
44
42
  class="panel"
45
43
  part="panel"
46
44
  role="tabpanel"
47
45
  id="${() => v()}"
48
46
  aria-labelledby="${() => y()}"
49
- aria-hidden="${() => String(!l.value)}"
47
+ aria-hidden="${() => String(!s.value)}"
50
48
  :style="${_}"
51
49
  tabindex="0">
52
- ${t(g, () => s`<slot></slot>`)}
50
+ ${u(g, () => a`<slot></slot>`)}
53
51
  </div>
54
52
  `;
55
53
  },
56
- styles: [n, i]
54
+ styles: [e, n]
57
55
  });
58
56
  //#endregion
59
57
  export { m as TAB_PANEL_TAG };
@@ -1 +1 @@
1
- {"version":3,"file":"tab-panel.js","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, bind, watchEffect } from '@vielzeug/ore';\nimport { styleMap, when } from '@vielzeug/ore/directives';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const labelledById = () => `tab-${props.value.value}`;\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n id=\"${() => panelId()}\"\n aria-labelledby=\"${() => labelledById()}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n :style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(shouldRender, () => html`<slot></slot>`)}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":";;;;;;;;;AAQA,IAAM,IAAmD;CACvD,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAkCa,IAAgB;AAC7B,EAAyB,GAAe;CACtC,OAAO;EACL,QAAQ,EAAK,KAAK,EAAK;EACvB,MAAM,EAAK,KAAK,EAAK;EACrB,SAAS,EAAK,MAAM;GAAC;GAAQ;GAAM;GAAM;GAAM;GAAM;GAAM;EAAK,GAAY,IAAI;EAChF,OAAO,EAAK,OAAO,EAAE;CACvB;CACA,MAAM,GAAO;EACX,IAAM,IAAQ,GAER,IAAU,EAAO,CAAQ,GACzB,IAAW,QACf,IAAU,CAAC,CAAC,EAAQ,MAAM,SAAS,EAAQ,MAAM,UAAU,EAAM,MAAM,QAAQ,EAAM,OAAO,KAC9F;EAEA,EAAK,EACH,MAAM,EACJ,cAAe,EAAS,QAAQ,KAAO,KAAA,EACzC,EACF,CAAC;EAGD,IAAM,IAAe,QAGZ,EAFK,EAAM,QAAQ,SAAS,SAEK,EAAyB,EAClE,GAEK,IAAgB,EAAO,EAAK;EAElC,QAAY;GACV,AAAI,EAAS,UAAO,EAAc,QAAQ;EAC5C,CAAC;EAGD,IAAM,IAAe,QAAe,CAAC,EAAM,KAAK,SAAS,EAAc,KAAK,GACtE,IAAa,EAAS,EAAE,uBAAuB,EAAa,CAAC,GAC7D,UAAgB,YAAY,EAAM,MAAM,SACxC,UAAqB,OAAO,EAAM,MAAM;EAE9C,OAAO,CAAI;;;;;oBAKK,EAAQ,EAAE;iCACG,EAAa,EAAE;6BACnB,OAAO,CAAC,EAAS,KAAK,EAAE;kBACnC,EAAW;;UAEnB,EAAK,SAAoB,CAAI,eAAe,EAAE;;;CAGtD;CACA,QAAQ,CAAC,GAAoB,CAAM;AACrC,CAAC"}
1
+ {"version":3,"file":"tab-panel.js","names":[],"sources":["../src/disclosure/tab-panel/tab-panel.ts"],"sourcesContent":["import { define, html, inject, prop, bind, watchEffect } from '@vielzeug/ore';\nimport { styleMap, when } from '@vielzeug/ore/directives';\nimport { computed, signal } from '@vielzeug/ripple';\n\nimport { reducedMotionMixin } from '../../styles';\nimport { TABS_CTX } from '../tabs/tabs';\nimport styles from './tab-panel.css?inline';\n\nconst TAB_PANEL_PADDING_PRESET: Record<string, string> = {\n '2xl': 'var(--size-12)',\n lg: 'var(--size-6)',\n md: 'var(--size-4)',\n none: '0',\n sm: 'var(--size-2)',\n xl: 'var(--size-8)',\n xs: 'var(--size-1)',\n};\n\nexport type OreTabPanelProps = {\n /** Active state (managed by ore-tabs) */\n active?: boolean;\n /** When true, the panel content is not rendered until first activation (preserves resources) */\n lazy?: boolean;\n /** Panel padding size: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' (default: 'md' = var(--size-4)) */\n padding?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Must match the `value` of its corresponding ore-tab-item */\n value: string;\n};\n\n/**\n * Content panel for a tab. Shown when its `value` matches the selected tab.\n *\n * @element ore-tab-panel\n *\n * @attr {string} value - Must match the corresponding ore-tab-item value\n * @attr {boolean} active - Toggled by the parent ore-tabs\n * @attr {string} padding - Panel padding: 'none' | 'xs' | 'sm' | 'md' (default) | 'lg' | 'xl' | '2xl'\n *\n * @slot - Panel content\n *\n * @cssprop --tab-panel-padding - Inner padding of the panel content area\n * @cssprop --tab-panel-font-size - Font size of the panel content\n * @part panel - Panel container.\n * @example\n * ```html\n * <ore-tab-panel value=\"overview\"><p>Overview content here</p></ore-tab-panel>\n * <ore-tab-panel value=\"settings\" padding=\"lg\"><p>Large padding</p></ore-tab-panel>\n * <ore-tab-panel value=\"code\" padding=\"none\"><pre>No padding for code</pre></ore-tab-panel>\n * ```\n */\nexport const TAB_PANEL_TAG = 'ore-tab-panel' as const;\ndefine<OreTabPanelProps>(TAB_PANEL_TAG, {\n props: {\n active: prop.bool(false),\n lazy: prop.bool(false),\n padding: prop.oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const, 'md'),\n value: prop.string(''),\n },\n setup(props) {\n const watch = watchEffect;\n\n const tabsCtx = inject(TABS_CTX);\n const isActive = computed(() =>\n tabsCtx ? !!tabsCtx.value.value && tabsCtx.value.value === props.value.value : props.active.value,\n );\n\n bind({\n attr: {\n active: () => (isActive.value ? true : undefined),\n },\n });\n\n // Map padding prop to CSS variable\n const paddingValue = computed(() => {\n const key = props.padding.value ?? 'md';\n\n return TAB_PANEL_PADDING_PRESET[key] ?? TAB_PANEL_PADDING_PRESET.md;\n });\n // Track whether the panel has ever been active (for lazy rendering)\n const hasBeenActive = signal(false);\n\n watch(() => {\n if (isActive.value) hasBeenActive.value = true;\n });\n\n // shouldRender: true if not lazy OR has been active at least once\n const shouldRender = computed(() => !props.lazy.value || hasBeenActive.value);\n const panelStyle = styleMap({ '--tab-panel-padding': paddingValue });\n const panelId = () => `tabpanel-${props.value.value}`;\n const labelledById = () => `tab-${props.value.value}`;\n\n return html`\n <div\n class=\"panel\"\n part=\"panel\"\n role=\"tabpanel\"\n id=\"${() => panelId()}\"\n aria-labelledby=\"${() => labelledById()}\"\n aria-hidden=\"${() => String(!isActive.value)}\"\n :style=\"${panelStyle}\"\n tabindex=\"0\">\n ${when(shouldRender, () => html`<slot></slot>`)}\n </div>\n `;\n },\n styles: [reducedMotionMixin, styles],\n});\n"],"mappings":";;;;;;;AAQA,IAAM,IAAmD;CACvD,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAkCa,IAAgB;AAC7B,EAAyB,GAAe;CACtC,OAAO;EACL,QAAQ,EAAK,KAAK,EAAK;EACvB,MAAM,EAAK,KAAK,EAAK;EACrB,SAAS,EAAK,MAAM;GAAC;GAAQ;GAAM;GAAM;GAAM;GAAM;GAAM;EAAK,GAAY,IAAI;EAChF,OAAO,EAAK,OAAO,EAAE;CACvB;CACA,MAAM,GAAO;EACX,IAAM,IAAQ,GAER,IAAU,EAAO,CAAQ,GACzB,IAAW,QACf,IAAU,CAAC,CAAC,EAAQ,MAAM,SAAS,EAAQ,MAAM,UAAU,EAAM,MAAM,QAAQ,EAAM,OAAO,KAC9F;EAEA,EAAK,EACH,MAAM,EACJ,cAAe,EAAS,QAAQ,KAAO,KAAA,EACzC,EACF,CAAC;EAGD,IAAM,IAAe,QAGZ,EAFK,EAAM,QAAQ,SAAS,SAEK,EAAyB,EAClE,GAEK,IAAgB,EAAO,EAAK;EAElC,QAAY;GACV,AAAI,EAAS,UAAO,EAAc,QAAQ;EAC5C,CAAC;EAGD,IAAM,IAAe,QAAe,CAAC,EAAM,KAAK,SAAS,EAAc,KAAK,GACtE,IAAa,EAAS,EAAE,uBAAuB,EAAa,CAAC,GAC7D,UAAgB,YAAY,EAAM,MAAM,SACxC,UAAqB,OAAO,EAAM,MAAM;EAE9C,OAAO,CAAI;;;;;oBAKK,EAAQ,EAAE;iCACG,EAAa,EAAE;6BACnB,OAAO,CAAC,EAAS,KAAK,EAAE;kBACnC,EAAW;;UAEnB,EAAK,SAAoB,CAAI,eAAe,EAAE;;;CAGtD;CACA,QAAQ,CAAC,GAAoB,CAAM;AACrC,CAAC"}
package/dist/testing.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./ore/dist/testing/mount.cjs");require("./ore/dist/testing.cjs");let t=require("@vielzeug/ore");var n=e=>e.getAttribute(`aria-invalid`)===`true`,r=e=>e.getAttribute(`aria-disabled`)===`true`,i=e=>e.getAttribute(`aria-checked`)===`true`,a=e=>e.getAttribute(`aria-checked`)===`mixed`,o=e=>e.getAttribute(`aria-expanded`)===`true`,s=e=>e.getAttribute(`aria-pressed`)===`true`,c=e=>e.getAttribute(`aria-required`)===`true`,l=e=>e.getAttribute(`aria-hidden`)===`true`,u=e=>e.getAttribute(`aria-label`),d=e=>e.getAttribute(`aria-labelledby`),f=e=>e.getAttribute(`aria-describedby`),p=e=>e.getAttribute(`aria-controls`),m=e=>e.getAttribute(`role`),h=(e,t)=>e.shadowRoot?.querySelector(t)??null,g=(e,t)=>Array.from(e.shadowRoot?.querySelectorAll(t)??[]),_=(e,t)=>h(e,`[part="${t}"]`),v=(e,t)=>{let n=t?`[slot="${t}"]`:`:not([slot])`;return Array.from(e.querySelectorAll(`:scope > ${n}`))},y=(e,t,n)=>{e.dispatchEvent(new PointerEvent(`pointer${t}`,{bubbles:!0,composed:!0,...n}))},b=e=>e.value??null,x=e=>e.validity?.valid??!0,S=(e,t)=>new KeyboardEvent(`keydown`,{bubbles:!0,cancelable:!0,key:e,...t}),C=()=>new Promise(e=>{queueMicrotask(e)}),w=(e=0)=>new Promise(t=>{setTimeout(t,e)}),T=e=>({ariaLabel:e.getAttribute(`aria-label`),checked:e.getAttribute(`aria-checked`),disabled:e.getAttribute(`aria-disabled`),expanded:e.getAttribute(`aria-expanded`),invalid:e.getAttribute(`aria-invalid`),labelledby:e.getAttribute(`aria-labelledby`),required:e.getAttribute(`aria-required`),role:e.getAttribute(`role`)}),E=e=>Object.entries(e).map(([e,t])=>t===``?e:`${e}="${t.replace(/"/g,`&quot;`)}"`).join(` `),D=(e={})=>{let t={};for(let[n,r]of Object.entries(e))if(!(r===!1||r==null))if(r===!0)t[n]=``;else if(Array.isArray(r)){if(r.length>0&&typeof r[0]==`object`)continue;t[n]=r.join(`,`)}else t[n]=String(r);return t},O=(t,n)=>e.mount(`<ore-input ${E(D(t))}>${n?.innerHTML??``}</ore-input>`),k=(t,n)=>e.mount(`<ore-textarea ${E(D(t))}>${n?.innerHTML??``}</ore-textarea>`),A=(t,n)=>e.mount(`<ore-select ${E(D(t))}>${n?.innerHTML??``}</ore-select>`),j=(t,n)=>e.mount(`<ore-combobox ${E(D(t))}>${n?.innerHTML??``}</ore-combobox>`),M=(t,n)=>e.mount(`<ore-checkbox ${E(D(t))}>${n?.innerHTML??``}</ore-checkbox>`),N=(t,n)=>e.mount(`<ore-checkbox-group ${E(D(t))}>${n?.innerHTML??``}</ore-checkbox-group>`),P=(t,n)=>e.mount(`<ore-radio ${E(D(t))}>${n?.innerHTML??``}</ore-radio>`),F=(t,n)=>e.mount(`<ore-radio-group ${E(D(t))}>${n?.innerHTML??``}</ore-radio-group>`),I=(t,n)=>e.mount(`<ore-switch ${E(D(t))}>${n?.innerHTML??``}</ore-switch>`),L=(t,n)=>e.mount(`<ore-button ${E(D(t))}>${n?.innerHTML??``}</ore-button>`),R=(t,n)=>e.mount(`<ore-button-group ${E(D(t))}>${n?.innerHTML??``}</ore-button-group>`),z=(t,n)=>e.mount(`<ore-file-input ${E(D(t))}>${n?.innerHTML??``}</ore-file-input>`),B=(t,n)=>e.mount(`<ore-form ${E(D(t))}>${n?.innerHTML??``}</ore-form>`),V=(t,n)=>e.mount(`<ore-number-input ${E(D(t))}>${n?.innerHTML??``}</ore-number-input>`),H=(t,n)=>e.mount(`<ore-otp-input ${E(D(t))}>${n?.innerHTML??``}</ore-otp-input>`),U=(t,n)=>e.mount(`<ore-rating ${E(D(t))}>${n?.innerHTML??``}</ore-rating>`),W=(t,n)=>e.mount(`<ore-slider ${E(D(t))}>${n?.innerHTML??``}</ore-slider>`);exports.attrsToHtml=E,exports.dispatchPointer=y,exports.getAriaControls=p,exports.getAriaDescribedBy=f,exports.getAriaLabel=u,exports.getAriaLabelledBy=d,exports.getAriaState=T,exports.getFormValue=b,exports.getRole=m,exports.getSlotted=v,exports.isAriaChecked=i,exports.isAriaDisabled=r,exports.isAriaExpanded=o,exports.isAriaHidden=l,exports.isAriaIndeterminate=a,exports.isAriaInvalid=n,exports.isAriaPressed=s,exports.isAriaRequired=c,exports.isFormValid=x,exports.keyEvent=S,exports.mountOreButton=L,exports.mountOreButtonGroup=R,exports.mountOreCheckbox=M,exports.mountOreCheckboxGroup=N,exports.mountOreCombobox=j,exports.mountOreFileInput=z,exports.mountOreForm=B,exports.mountOreInput=O,exports.mountOreNumberInput=V,exports.mountOreOtpInput=H,exports.mountOreRadio=P,exports.mountOreRadioGroup=F,exports.mountOreRating=U,exports.mountOreSelect=A,exports.mountOreSlider=W,exports.mountOreSwitch=I,exports.mountOreTextarea=k,exports.nextTick=C,exports.propsToAttrs=D,exports.queryAllInShadow=g,exports.queryInShadow=h,exports.queryPart=_,Object.defineProperty(exports,"resetIdCounter",{enumerable:!0,get:function(){return t.resetIdCounter}}),exports.wait=w;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@vielzeug/ore"),t=require("@vielzeug/ore/testing");var n=e=>e.getAttribute(`aria-invalid`)===`true`,r=e=>e.getAttribute(`aria-disabled`)===`true`,i=e=>e.getAttribute(`aria-checked`)===`true`,a=e=>e.getAttribute(`aria-checked`)===`mixed`,o=e=>e.getAttribute(`aria-expanded`)===`true`,s=e=>e.getAttribute(`aria-pressed`)===`true`,c=e=>e.getAttribute(`aria-required`)===`true`,l=e=>e.getAttribute(`aria-hidden`)===`true`,u=e=>e.getAttribute(`aria-label`),d=e=>e.getAttribute(`aria-labelledby`),f=e=>e.getAttribute(`aria-describedby`),p=e=>e.getAttribute(`aria-controls`),m=e=>e.getAttribute(`role`),h=(e,t)=>e.shadowRoot?.querySelector(t)??null,g=(e,t)=>Array.from(e.shadowRoot?.querySelectorAll(t)??[]),_=(e,t)=>h(e,`[part="${t}"]`),v=(e,t)=>{let n=t?`[slot="${t}"]`:`:not([slot])`;return Array.from(e.querySelectorAll(`:scope > ${n}`))},y=(e,t,n)=>{e.dispatchEvent(new PointerEvent(`pointer${t}`,{bubbles:!0,composed:!0,...n}))},b=e=>e.value??null,x=e=>e.validity?.valid??!0,S=(e,t)=>new KeyboardEvent(`keydown`,{bubbles:!0,cancelable:!0,key:e,...t}),C=()=>new Promise(e=>{queueMicrotask(e)}),w=(e=0)=>new Promise(t=>{setTimeout(t,e)}),T=e=>({ariaLabel:e.getAttribute(`aria-label`),checked:e.getAttribute(`aria-checked`),disabled:e.getAttribute(`aria-disabled`),expanded:e.getAttribute(`aria-expanded`),invalid:e.getAttribute(`aria-invalid`),labelledby:e.getAttribute(`aria-labelledby`),required:e.getAttribute(`aria-required`),role:e.getAttribute(`role`)}),E=e=>Object.entries(e).map(([e,t])=>t===``?e:`${e}="${t.replace(/"/g,`&quot;`)}"`).join(` `),D=(e={})=>{let t={};for(let[n,r]of Object.entries(e))if(!(r===!1||r==null))if(r===!0)t[n]=``;else if(Array.isArray(r)){if(r.length>0&&typeof r[0]==`object`)continue;t[n]=r.join(`,`)}else t[n]=String(r);return t},O=(e,n)=>(0,t.mount)(`<ore-input ${E(D(e))}>${n?.innerHTML??``}</ore-input>`),k=(e,n)=>(0,t.mount)(`<ore-textarea ${E(D(e))}>${n?.innerHTML??``}</ore-textarea>`),A=(e,n)=>(0,t.mount)(`<ore-select ${E(D(e))}>${n?.innerHTML??``}</ore-select>`),j=(e,n)=>(0,t.mount)(`<ore-combobox ${E(D(e))}>${n?.innerHTML??``}</ore-combobox>`),M=(e,n)=>(0,t.mount)(`<ore-checkbox ${E(D(e))}>${n?.innerHTML??``}</ore-checkbox>`),N=(e,n)=>(0,t.mount)(`<ore-checkbox-group ${E(D(e))}>${n?.innerHTML??``}</ore-checkbox-group>`),P=(e,n)=>(0,t.mount)(`<ore-radio ${E(D(e))}>${n?.innerHTML??``}</ore-radio>`),F=(e,n)=>(0,t.mount)(`<ore-radio-group ${E(D(e))}>${n?.innerHTML??``}</ore-radio-group>`),I=(e,n)=>(0,t.mount)(`<ore-switch ${E(D(e))}>${n?.innerHTML??``}</ore-switch>`),L=(e,n)=>(0,t.mount)(`<ore-button ${E(D(e))}>${n?.innerHTML??``}</ore-button>`),R=(e,n)=>(0,t.mount)(`<ore-button-group ${E(D(e))}>${n?.innerHTML??``}</ore-button-group>`),z=(e,n)=>(0,t.mount)(`<ore-file-input ${E(D(e))}>${n?.innerHTML??``}</ore-file-input>`),B=(e,n)=>(0,t.mount)(`<ore-form ${E(D(e))}>${n?.innerHTML??``}</ore-form>`),V=(e,n)=>(0,t.mount)(`<ore-number-input ${E(D(e))}>${n?.innerHTML??``}</ore-number-input>`),H=(e,n)=>(0,t.mount)(`<ore-otp-input ${E(D(e))}>${n?.innerHTML??``}</ore-otp-input>`),U=(e,n)=>(0,t.mount)(`<ore-rating ${E(D(e))}>${n?.innerHTML??``}</ore-rating>`),W=(e,n)=>(0,t.mount)(`<ore-slider ${E(D(e))}>${n?.innerHTML??``}</ore-slider>`);exports.attrsToHtml=E,exports.dispatchPointer=y,exports.getAriaControls=p,exports.getAriaDescribedBy=f,exports.getAriaLabel=u,exports.getAriaLabelledBy=d,exports.getAriaState=T,exports.getFormValue=b,exports.getRole=m,exports.getSlotted=v,exports.isAriaChecked=i,exports.isAriaDisabled=r,exports.isAriaExpanded=o,exports.isAriaHidden=l,exports.isAriaIndeterminate=a,exports.isAriaInvalid=n,exports.isAriaPressed=s,exports.isAriaRequired=c,exports.isFormValid=x,exports.keyEvent=S,exports.mountOreButton=L,exports.mountOreButtonGroup=R,exports.mountOreCheckbox=M,exports.mountOreCheckboxGroup=N,exports.mountOreCombobox=j,exports.mountOreFileInput=z,exports.mountOreForm=B,exports.mountOreInput=O,exports.mountOreNumberInput=V,exports.mountOreOtpInput=H,exports.mountOreRadio=P,exports.mountOreRadioGroup=F,exports.mountOreRating=U,exports.mountOreSelect=A,exports.mountOreSlider=W,exports.mountOreSwitch=I,exports.mountOreTextarea=k,exports.nextTick=C,exports.propsToAttrs=D,exports.queryAllInShadow=g,exports.queryInShadow=h,exports.queryPart=_,Object.defineProperty(exports,"resetIdCounter",{enumerable:!0,get:function(){return e.resetIdCounter}}),exports.wait=w;
2
2
  //# sourceMappingURL=testing.cjs.map