reka-ui 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/Combobox/ComboboxContentImpl.cjs +1 -1
  2. package/dist/Combobox/ComboboxContentImpl.js +1 -1
  3. package/dist/Dialog/DialogContentImpl.cjs +1 -1
  4. package/dist/Dialog/DialogContentImpl.js +1 -1
  5. package/dist/DismissableLayer/utils.cjs +12 -4
  6. package/dist/DismissableLayer/utils.cjs.map +1 -1
  7. package/dist/DismissableLayer/utils.js +12 -4
  8. package/dist/DismissableLayer/utils.js.map +1 -1
  9. package/dist/Editable/EditableRoot.cjs +2 -2
  10. package/dist/Editable/EditableRoot.cjs.map +1 -1
  11. package/dist/Editable/EditableRoot.js +2 -2
  12. package/dist/Editable/EditableRoot.js.map +1 -1
  13. package/dist/HoverCard/HoverCardContentImpl.cjs +1 -1
  14. package/dist/HoverCard/HoverCardContentImpl.js +1 -1
  15. package/dist/Menu/MenuContentImpl.cjs +1 -1
  16. package/dist/Menu/MenuContentImpl.js +1 -1
  17. package/dist/NavigationMenu/NavigationMenuContentImpl.cjs +1 -1
  18. package/dist/NavigationMenu/NavigationMenuContentImpl.js +1 -1
  19. package/dist/PinInput/PinInputInput.cjs +14 -6
  20. package/dist/PinInput/PinInputInput.cjs.map +1 -1
  21. package/dist/PinInput/PinInputInput.js +14 -6
  22. package/dist/PinInput/PinInputInput.js.map +1 -1
  23. package/dist/PinInput/PinInputRoot.cjs +4 -2
  24. package/dist/PinInput/PinInputRoot.cjs.map +1 -1
  25. package/dist/PinInput/PinInputRoot.js +4 -2
  26. package/dist/PinInput/PinInputRoot.js.map +1 -1
  27. package/dist/Popover/PopoverContentImpl.cjs +1 -1
  28. package/dist/Popover/PopoverContentImpl.js +1 -1
  29. package/dist/RadioGroup/Radio.cjs +2 -0
  30. package/dist/RadioGroup/Radio.cjs.map +1 -1
  31. package/dist/RadioGroup/Radio.js +2 -0
  32. package/dist/RadioGroup/Radio.js.map +1 -1
  33. package/dist/Select/SelectContentImpl.cjs +1 -1
  34. package/dist/Select/SelectContentImpl.js +1 -1
  35. package/dist/Stepper/StepperRoot.cjs +1 -1
  36. package/dist/Stepper/StepperRoot.cjs.map +1 -1
  37. package/dist/Stepper/StepperRoot.js +1 -1
  38. package/dist/Stepper/StepperRoot.js.map +1 -1
  39. package/dist/Toast/ToastViewport.cjs +1 -1
  40. package/dist/Toast/ToastViewport.js +1 -1
  41. package/dist/Tooltip/TooltipContentImpl.cjs +1 -1
  42. package/dist/Tooltip/TooltipContentImpl.js +1 -1
  43. package/dist/index.d.ts +3 -2
  44. package/dist/shared/useForwardProps.cjs +2 -4
  45. package/dist/shared/useForwardProps.cjs.map +1 -1
  46. package/dist/shared/useForwardProps.js +3 -5
  47. package/dist/shared/useForwardProps.js.map +1 -1
  48. package/package.json +1 -1
@@ -20,7 +20,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  const currentValue = computed(() => context.currentModelValue.value[props.index]);
21
21
  const disabled = computed(() => props.disabled || context.disabled.value);
22
22
  const isOtpMode = computed(() => context.otp.value);
23
- const isNumericMode = computed(() => context.type.value === "number");
24
23
  const isPasswordMode = computed(() => context.mask.value);
25
24
  const { primitiveElement, currentElement } = usePrimitiveElement();
26
25
  function handleInput(event) {
@@ -29,7 +28,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
28
  handleMultipleCharacter(target.value);
30
29
  return;
31
30
  }
32
- if (isNumericMode.value && !/^\d*$/.test(target.value)) {
31
+ if (context.isNumericMode.value && !/^\d*$/.test(target.value)) {
33
32
  target.value = target.value.replace(/\D/g, "");
34
33
  return;
35
34
  }
@@ -99,7 +98,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
99
98
  for (let i = initialIndex; i < lastIndex; i++) {
100
99
  const input = inputElements.value[i];
101
100
  const value = values[i - initialIndex];
102
- if (isNumericMode.value && !/^\d*$/.test(value))
101
+ if (context.isNumericMode.value && !/^\d*$/.test(value))
103
102
  continue;
104
103
  tempModelValue[i] = value;
105
104
  input.focus();
@@ -117,7 +116,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
117
116
  }
118
117
  function updateModelValueAt(index, value) {
119
118
  const tempModelValue = [...context.currentModelValue.value];
120
- tempModelValue[index] = isNumericMode.value ? +value : value;
119
+ if (context.isNumericMode.value) {
120
+ const num = +value;
121
+ if (value === "" || isNaN(num)) {
122
+ delete tempModelValue[index];
123
+ } else {
124
+ tempModelValue[index] = num;
125
+ }
126
+ } else {
127
+ tempModelValue[index] = value;
128
+ }
121
129
  context.modelValue.value = removeTrailingEmptyStrings(tempModelValue);
122
130
  }
123
131
  watch(currentValue, () => {
@@ -140,8 +148,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
140
148
  "as-child": _ctx.asChild,
141
149
  autocomplete: isOtpMode.value ? "one-time-code" : "false",
142
150
  type: isPasswordMode.value ? "password" : "text",
143
- inputmode: isNumericMode.value ? "numeric" : "text",
144
- pattern: isNumericMode.value ? "[0-9]*" : void 0,
151
+ inputmode: unref(context).isNumericMode.value ? "numeric" : "text",
152
+ pattern: unref(context).isNumericMode.value ? "[0-9]*" : void 0,
145
153
  placeholder: unref(context).placeholder.value,
146
154
  value: currentValue.value,
147
155
  disabled: disabled.value,
@@ -1 +1 @@
1
- {"version":3,"file":"PinInputInput.js","sources":["../../src/PinInput/PinInputInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PinInputValue } from './PinInputRoot.vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { getActiveElement, useArrowNavigation } from '@/shared'\nimport { injectPinInputRootContext } from './PinInputRoot.vue'\n\nexport interface PinInputInputProps extends PrimitiveProps {\n /** Position of the value this input binds to. */\n index: number\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'\n\nconst props = withDefaults(defineProps<PinInputInputProps>(), {\n as: 'input',\n})\n\nconst context = injectPinInputRootContext()\nconst inputElements = computed(() => Array.from(context.inputElements!.value))\nconst currentValue = computed(() => context.currentModelValue.value[props.index])\n\nconst disabled = computed(() => props.disabled || context.disabled.value)\nconst isOtpMode = computed(() => context.otp.value)\nconst isNumericMode = computed(() => context.type.value === 'number')\nconst isPasswordMode = computed(() => context.mask.value)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n\n if ((event.data?.length ?? 0) > 1) {\n handleMultipleCharacter(target.value)\n return\n }\n\n if (isNumericMode.value && !/^\\d*$/.test(target.value)) {\n target.value = target.value.replace(/\\D/g, '')\n return\n }\n\n target.value = target.value.slice(-1)\n updateModelValueAt(props.index, target.value)\n\n const nextEl = inputElements.value[props.index + 1]\n if (nextEl)\n nextEl.focus()\n}\n\nfunction resetPlaceholder() {\n const target = currentElement.value as HTMLInputElement\n nextTick(() => {\n if (target && !target.value)\n target.placeholder = context.placeholder.value\n })\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n useArrowNavigation(event, getActiveElement() as HTMLElement, undefined, {\n itemsArray: inputElements.value,\n focus: true,\n loop: false,\n arrowKeyOptions: 'horizontal',\n dir: context.dir.value,\n })\n}\n\nfunction handleBackspace(event: KeyboardEvent) {\n event.preventDefault()\n const target = event.target as HTMLInputElement\n const value = target.value\n\n if (value) {\n updateModelValueAt(props.index, '')\n }\n else {\n const prevEl = inputElements.value[props.index - 1]\n if (prevEl) {\n prevEl.focus()\n updateModelValueAt(props.index - 1, '')\n }\n }\n}\n\nfunction handleDelete(event: KeyboardEvent) {\n if (event.key === 'Delete') {\n event.preventDefault()\n updateModelValueAt(props.index, '')\n }\n}\n\nfunction handleFocus(event: FocusEvent) {\n const target = event.target as HTMLInputElement\n target.setSelectionRange(1, 1)\n\n if (!target.value)\n target.placeholder = ''\n}\n\nfunction handleBlur(event: FocusEvent) {\n resetPlaceholder()\n}\n\nfunction handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n const clipboardData = event.clipboardData\n if (!clipboardData)\n return\n\n const values = clipboardData.getData('text')\n handleMultipleCharacter(values)\n}\n\nfunction handleMultipleCharacter(values: string) {\n const tempModelValue = [...context.currentModelValue.value] as PinInputValue<typeof context.type.value>\n const initialIndex = values.length >= inputElements.value.length ? 0 : props.index\n const lastIndex = Math.min(initialIndex + values.length, inputElements.value.length)\n for (let i = initialIndex; i < lastIndex; i++) {\n const input = inputElements.value[i]\n const value = values[i - initialIndex]\n if (isNumericMode.value && !/^\\d*$/.test(value))\n continue\n\n tempModelValue[i] = value\n input.focus()\n }\n context.modelValue.value = tempModelValue\n inputElements.value[lastIndex]?.focus()\n}\n\nfunction removeTrailingEmptyStrings(input: PinInputValue<typeof context.type.value>) {\n let i = input.length - 1\n\n while (i >= 0 && input[i] === '') {\n input.pop()\n i--\n }\n\n return input\n}\n\nfunction updateModelValueAt(index: number, value: string) {\n const tempModelValue = [...context.currentModelValue.value] as PinInputValue<typeof context.type.value>\n tempModelValue[index] = isNumericMode.value ? +value : value\n context.modelValue.value = removeTrailingEmptyStrings(tempModelValue)\n}\n\nwatch(currentValue, () => {\n if (!currentValue.value) {\n resetPlaceholder()\n }\n})\n\nonMounted(() => {\n context.onInputElementChange(currentElement.value as HTMLInputElement)\n})\nonUnmounted(() => {\n context.inputElements?.value.delete(currentElement.value as HTMLInputElement)\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n autocapitalize=\"none\"\n :as=\"as\"\n :as-child=\"asChild\"\n :autocomplete=\"isOtpMode ? 'one-time-code' : 'false'\"\n :type=\"isPasswordMode ? 'password' : 'text'\"\n :inputmode=\"isNumericMode ? 'numeric' : 'text'\"\n :pattern=\"isNumericMode ? '[0-9]*' : undefined\"\n :placeholder=\"context.placeholder.value\"\n :value=\"currentValue\"\n :disabled=\"disabled\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-complete=\"context.isCompleted.value ? '' : undefined\"\n :aria-label=\"`pin input ${index + 1} of ${inputElements.length}`\"\n @input=\"handleInput($event as InputEvent)\"\n @keydown.left.right.up.down.home.end=\"handleKeydown\"\n @keydown.backspace=\"handleBackspace\"\n @keydown.delete=\"handleDelete\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @paste=\"handlePaste\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,UAAU,yBAA0B,EAAA;AAC1C,IAAM,MAAA,aAAA,GAAgB,SAAS,MAAM,KAAA,CAAM,KAAK,OAAQ,CAAA,aAAA,CAAe,KAAK,CAAC,CAAA;AAC7E,IAAM,MAAA,YAAA,GAAe,SAAS,MAAM,OAAA,CAAQ,kBAAkB,KAAM,CAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AAEhF,IAAA,MAAM,WAAW,QAAS,CAAA,MAAM,MAAM,QAAY,IAAA,OAAA,CAAQ,SAAS,KAAK,CAAA;AACxE,IAAA,MAAM,SAAY,GAAA,QAAA,CAAS,MAAM,OAAA,CAAQ,IAAI,KAAK,CAAA;AAClD,IAAA,MAAM,gBAAgB,QAAS,CAAA,MAAM,OAAQ,CAAA,IAAA,CAAK,UAAU,QAAQ,CAAA;AACpE,IAAA,MAAM,cAAiB,GAAA,QAAA,CAAS,MAAM,OAAA,CAAQ,KAAK,KAAK,CAAA;AAExD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA;AACjE,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAA,MAAM,SAAS,KAAM,CAAA,MAAA;AAErB,MAAA,IAAA,CAAK,KAAM,CAAA,IAAA,EAAM,MAAU,IAAA,CAAA,IAAK,CAAG,EAAA;AACjC,QAAA,uBAAA,CAAwB,OAAO,KAAK,CAAA;AACpC,QAAA;AAAA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AAA;AACvD,MAAQ,OAAA,CAAA,UAAA,CAAW,KAAQ,GAAA,0BAAA,CAA2B,cAAc,CAAA;AAAA;AAGtE,IAAA,KAAA,CAAM,cAAc,MAAM;AACxB,MAAI,IAAA,CAAC,aAAa,KAAO,EAAA;AACvB,QAAiB,gBAAA,EAAA;AAAA;AACnB,KACD,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AACd,MAAQ,OAAA,CAAA,oBAAA,CAAqB,eAAe,KAAyB,CAAA;AAAA,KACtE,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAA,OAAA,CAAQ,aAAe,EAAA,KAAA,CAAM,MAAO,CAAA,cAAA,CAAe,KAAyB,CAAA;AAAA,KAC7E,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PinInputInput.js","sources":["../../src/PinInput/PinInputInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PinInputValue } from './PinInputRoot.vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { getActiveElement, useArrowNavigation } from '@/shared'\nimport { injectPinInputRootContext } from './PinInputRoot.vue'\n\nexport interface PinInputInputProps extends PrimitiveProps {\n /** Position of the value this input binds to. */\n index: number\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onMounted, onUnmounted, watch } from 'vue'\n\nconst props = withDefaults(defineProps<PinInputInputProps>(), {\n as: 'input',\n})\n\nconst context = injectPinInputRootContext()\nconst inputElements = computed(() => Array.from(context.inputElements!.value))\nconst currentValue = computed(() => context.currentModelValue.value[props.index])\n\nconst disabled = computed(() => props.disabled || context.disabled.value)\nconst isOtpMode = computed(() => context.otp.value)\nconst isPasswordMode = computed(() => context.mask.value)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n\n if ((event.data?.length ?? 0) > 1) {\n handleMultipleCharacter(target.value)\n return\n }\n\n if (context.isNumericMode.value && !/^\\d*$/.test(target.value)) {\n target.value = target.value.replace(/\\D/g, '')\n return\n }\n\n target.value = target.value.slice(-1)\n updateModelValueAt(props.index, target.value)\n\n const nextEl = inputElements.value[props.index + 1]\n if (nextEl)\n nextEl.focus()\n}\n\nfunction resetPlaceholder() {\n const target = currentElement.value as HTMLInputElement\n nextTick(() => {\n if (target && !target.value)\n target.placeholder = context.placeholder.value\n })\n}\n\nfunction handleKeydown(event: KeyboardEvent) {\n useArrowNavigation(event, getActiveElement() as HTMLElement, undefined, {\n itemsArray: inputElements.value,\n focus: true,\n loop: false,\n arrowKeyOptions: 'horizontal',\n dir: context.dir.value,\n })\n}\n\nfunction handleBackspace(event: KeyboardEvent) {\n event.preventDefault()\n const target = event.target as HTMLInputElement\n const value = target.value\n\n if (value) {\n updateModelValueAt(props.index, '')\n }\n else {\n const prevEl = inputElements.value[props.index - 1]\n if (prevEl) {\n prevEl.focus()\n updateModelValueAt(props.index - 1, '')\n }\n }\n}\n\nfunction handleDelete(event: KeyboardEvent) {\n if (event.key === 'Delete') {\n event.preventDefault()\n updateModelValueAt(props.index, '')\n }\n}\n\nfunction handleFocus(event: FocusEvent) {\n const target = event.target as HTMLInputElement\n target.setSelectionRange(1, 1)\n\n if (!target.value)\n target.placeholder = ''\n}\n\nfunction handleBlur(event: FocusEvent) {\n resetPlaceholder()\n}\n\nfunction handlePaste(event: ClipboardEvent) {\n event.preventDefault()\n const clipboardData = event.clipboardData\n if (!clipboardData)\n return\n\n const values = clipboardData.getData('text')\n handleMultipleCharacter(values)\n}\n\nfunction handleMultipleCharacter(values: string) {\n const tempModelValue = [...context.currentModelValue.value] as PinInputValue<typeof context.type.value>\n const initialIndex = values.length >= inputElements.value.length ? 0 : props.index\n const lastIndex = Math.min(initialIndex + values.length, inputElements.value.length)\n for (let i = initialIndex; i < lastIndex; i++) {\n const input = inputElements.value[i]\n const value = values[i - initialIndex]\n if (context.isNumericMode.value && !/^\\d*$/.test(value))\n continue\n\n tempModelValue[i] = value\n input.focus()\n }\n context.modelValue.value = tempModelValue\n inputElements.value[lastIndex]?.focus()\n}\n\nfunction removeTrailingEmptyStrings(input: PinInputValue<typeof context.type.value>) {\n let i = input.length - 1\n\n while (i >= 0 && input[i] === '') {\n input.pop()\n i--\n }\n\n return input\n}\n\nfunction updateModelValueAt(index: number, value: string) {\n const tempModelValue = [...context.currentModelValue.value] as PinInputValue<typeof context.type.value>\n\n if (context.isNumericMode.value) {\n const num = +value\n\n if (value === '' || isNaN(num)) {\n delete tempModelValue[index]\n }\n else {\n tempModelValue[index] = num\n }\n }\n else {\n tempModelValue[index] = value\n }\n\n context.modelValue.value = removeTrailingEmptyStrings(tempModelValue)\n}\n\nwatch(currentValue, () => {\n if (!currentValue.value) {\n resetPlaceholder()\n }\n})\n\nonMounted(() => {\n context.onInputElementChange(currentElement.value as HTMLInputElement)\n})\nonUnmounted(() => {\n context.inputElements?.value.delete(currentElement.value as HTMLInputElement)\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n autocapitalize=\"none\"\n :as=\"as\"\n :as-child=\"asChild\"\n :autocomplete=\"isOtpMode ? 'one-time-code' : 'false'\"\n :type=\"isPasswordMode ? 'password' : 'text'\"\n :inputmode=\"context.isNumericMode.value ? 'numeric' : 'text'\"\n :pattern=\"context.isNumericMode.value ? '[0-9]*' : undefined\"\n :placeholder=\"context.placeholder.value\"\n :value=\"currentValue\"\n :disabled=\"disabled\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-complete=\"context.isCompleted.value ? '' : undefined\"\n :aria-label=\"`pin input ${index + 1} of ${inputElements.length}`\"\n @input=\"handleInput($event as InputEvent)\"\n @keydown.left.right.up.down.home.end=\"handleKeydown\"\n @keydown.backspace=\"handleBackspace\"\n @keydown.delete=\"handleDelete\"\n @focus=\"handleFocus\"\n @blur=\"handleBlur\"\n @paste=\"handlePaste\"\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A2B,cAAc,CAAA;AAAA;AAGtE,IAAA,KAAA,CAAM,cAAc,MAAM;AACxB,MAAI,IAAA,CAAC,aAAa,KAAO,EAAA;AACvB,QAAiB,gBAAA,EAAA;AAAA;AACnB,KACD,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AACd,MAAQ,OAAA,CAAA,oBAAA,CAAqB,eAAe,KAAyB,CAAA;AAAA,KACtE,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAA,OAAA,CAAQ,aAAe,EAAA,KAAA,CAAM,MAAO,CAAA,cAAA,CAAe,KAAyB,CAAA;AAAA,KAC7E,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -45,8 +45,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
45
45
  function onInputElementChange(el) {
46
46
  inputElements.value.add(el);
47
47
  }
48
+ const isNumericMode = vue.computed(() => props.type === "number");
48
49
  const isCompleted = vue.computed(() => {
49
- const modelValues = currentModelValue.value.filter((i) => !!i);
50
+ const modelValues = currentModelValue.value.filter((i) => !!i || isNumericMode.value && i === 0);
50
51
  return modelValues.length === inputElements.value.size;
51
52
  });
52
53
  vue.watch(modelValue, () => {
@@ -64,7 +65,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
64
65
  disabled,
65
66
  isCompleted,
66
67
  inputElements,
67
- onInputElementChange
68
+ onInputElementChange,
69
+ isNumericMode
68
70
  });
69
71
  return (_ctx, _cache) => {
70
72
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps(_ctx.$attrs, {
@@ -1 +1 @@
1
- {"version":3,"file":"PinInputRoot.cjs","sources":["../../src/PinInput/PinInputRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { Direction, FormFieldProps } from '@/shared/types'\nimport { computed, ref, toRefs, watch } from 'vue'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\n\nexport type PinInputType = 'text' | 'number'\n\n// Using this type to avoid mixed arrays (string | number)[].\nexport type PinInputValue<Type extends PinInputType = 'text'> = Type extends 'number' ? number[] : string[]\n\nexport type PinInputRootEmits<Type extends PinInputType = 'text'> = {\n 'update:modelValue': [value: PinInputValue<Type>]\n 'complete': [value: PinInputValue<Type>]\n}\n\nexport interface PinInputRootProps<Type extends PinInputType = 'text'> extends PrimitiveProps, FormFieldProps {\n /** The controlled checked state of the pin input. Can be binded as `v-model`. */\n modelValue?: PinInputValue<Type> | null\n /** The default value of the pin inputs when it is initially rendered. Use when you do not need to control its checked state. */\n defaultValue?: PinInputValue<Type>[]\n /** The placeholder character to use for empty pin-inputs. */\n placeholder?: string\n /** When `true`, pin inputs will be treated as password. */\n mask?: boolean\n /** When `true`, mobile devices will autodetect the OTP from messages or clipboard, and enable the autocomplete field. */\n otp?: boolean\n /** Input type for the inputs. */\n type?: Type\n /** The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport interface PinInputRootContext<Type extends PinInputType = 'text'> {\n modelValue: Ref<PinInputValue<Type>>\n currentModelValue: ComputedRef<PinInputValue<Type>>\n mask: Ref<boolean>\n otp: Ref<boolean>\n placeholder: Ref<string>\n type: Ref<PinInputType>\n dir: Ref<Direction>\n disabled: Ref<boolean>\n isCompleted: ComputedRef<boolean>\n inputElements?: Ref<Set<HTMLInputElement>>\n onInputElementChange: (el: HTMLInputElement) => void\n}\n\nexport const [injectPinInputRootContext, providePinInputRootContext]\n = createContext<PinInputRootContext<PinInputType>>('PinInputRoot')\n</script>\n\n<script setup lang=\"ts\" generic=\"Type extends PinInputType = 'text'\">\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<PinInputRootProps<Type>>(), {\n placeholder: '',\n type: 'text' as any,\n})\nconst emits = defineEmits<PinInputRootEmits<Type>>()\n\ndefineSlots<{\n default?: (props: {\n /** Current input values */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { mask, otp, placeholder, type, disabled, dir: propDir } = toRefs(props)\nconst { forwardRef } = useForwardExpose()\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? [] as any,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<PinInputValue<Type>>\n\nconst currentModelValue = computed(() => Array.isArray(modelValue.value) ? [...modelValue.value] : [])\n\nconst inputElements = ref<Set<HTMLInputElement>>(new Set())\nfunction onInputElementChange(el: HTMLInputElement) {\n inputElements.value.add(el)\n}\n\nconst isCompleted = computed(() => {\n const modelValues = currentModelValue.value.filter(i => !!i)\n return modelValues.length === inputElements.value.size\n})\n\nwatch(modelValue, () => {\n if (isCompleted.value)\n emits('complete', modelValue.value)\n}, { deep: true })\n\nprovidePinInputRootContext({\n modelValue,\n currentModelValue: currentModelValue as ComputedRef<PinInputValue<Type>>,\n mask,\n otp,\n placeholder,\n type,\n dir,\n disabled,\n isCompleted,\n inputElements,\n onInputElementChange,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n :dir=\"dir\"\n :data-complete=\"isCompleted ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot :model-value=\"modelValue\" />\n\n <VisuallyHiddenInput\n :id=\"id\"\n as=\"input\"\n feature=\"focusable\"\n tabindex=\"-1\"\n :value=\"currentModelValue.join('')\"\n :name=\"name ?? ''\"\n :disabled=\"disabled\"\n :required=\"required\"\n @focus=\"Array.from(inputElements)?.[0]?.focus()\"\n />\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","useForwardExpose","useDirection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YAAY,MAAM;AACtB,MAAA,IAAI,WAAY,CAAA,KAAA;AACd,QAAM,KAAA,CAAA,UAAA,EAAY,WAAW,KAAK,CAAA;AAAA,KACnC,EAAA,EAAE,IAAM,EAAA,IAAA,EAAM,CAAA;AAEjB,IAA2B,0BAAA,CAAA;AAAA,MACzB,UAAA;AAAA,MACA,iBAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PinInputRoot.cjs","sources":["../../src/PinInput/PinInputRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { Direction, FormFieldProps } from '@/shared/types'\nimport { computed, ref, toRefs, watch } from 'vue'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\n\nexport type PinInputType = 'text' | 'number'\n\n// Using this type to avoid mixed arrays (string | number)[].\nexport type PinInputValue<Type extends PinInputType = 'text'> = Type extends 'number' ? number[] : string[]\n\nexport type PinInputRootEmits<Type extends PinInputType = 'text'> = {\n 'update:modelValue': [value: PinInputValue<Type>]\n 'complete': [value: PinInputValue<Type>]\n}\n\nexport interface PinInputRootProps<Type extends PinInputType = 'text'> extends PrimitiveProps, FormFieldProps {\n /** The controlled checked state of the pin input. Can be binded as `v-model`. */\n modelValue?: PinInputValue<Type> | null\n /** The default value of the pin inputs when it is initially rendered. Use when you do not need to control its checked state. */\n defaultValue?: PinInputValue<Type>[]\n /** The placeholder character to use for empty pin-inputs. */\n placeholder?: string\n /** When `true`, pin inputs will be treated as password. */\n mask?: boolean\n /** When `true`, mobile devices will autodetect the OTP from messages or clipboard, and enable the autocomplete field. */\n otp?: boolean\n /** Input type for the inputs. */\n type?: Type\n /** The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport interface PinInputRootContext<Type extends PinInputType = 'text'> {\n modelValue: Ref<PinInputValue<Type>>\n currentModelValue: ComputedRef<PinInputValue<Type>>\n mask: Ref<boolean>\n otp: Ref<boolean>\n placeholder: Ref<string>\n type: Ref<PinInputType>\n dir: Ref<Direction>\n disabled: Ref<boolean>\n isCompleted: ComputedRef<boolean>\n inputElements?: Ref<Set<HTMLInputElement>>\n onInputElementChange: (el: HTMLInputElement) => void\n isNumericMode: ComputedRef<boolean>\n}\n\nexport const [injectPinInputRootContext, providePinInputRootContext]\n = createContext<PinInputRootContext<PinInputType>>('PinInputRoot')\n</script>\n\n<script setup lang=\"ts\" generic=\"Type extends PinInputType = 'text'\">\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<PinInputRootProps<Type>>(), {\n placeholder: '',\n type: 'text' as any,\n})\nconst emits = defineEmits<PinInputRootEmits<Type>>()\n\ndefineSlots<{\n default?: (props: {\n /** Current input values */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { mask, otp, placeholder, type, disabled, dir: propDir } = toRefs(props)\nconst { forwardRef } = useForwardExpose()\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? [] as any,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<PinInputValue<Type>>\n\nconst currentModelValue = computed(() => Array.isArray(modelValue.value) ? [...modelValue.value] : [])\n\nconst inputElements = ref<Set<HTMLInputElement>>(new Set())\nfunction onInputElementChange(el: HTMLInputElement) {\n inputElements.value.add(el)\n}\n\nconst isNumericMode = computed(() => props.type === 'number')\nconst isCompleted = computed(() => {\n const modelValues = currentModelValue.value.filter(i => !!i || (isNumericMode.value && i === 0))\n return modelValues.length === inputElements.value.size\n})\n\nwatch(modelValue, () => {\n if (isCompleted.value)\n emits('complete', modelValue.value)\n}, { deep: true })\n\nprovidePinInputRootContext({\n modelValue,\n currentModelValue: currentModelValue as ComputedRef<PinInputValue<Type>>,\n mask,\n otp,\n placeholder,\n type,\n dir,\n disabled,\n isCompleted,\n inputElements,\n onInputElementChange,\n isNumericMode,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n :dir=\"dir\"\n :data-complete=\"isCompleted ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot :model-value=\"modelValue\" />\n\n <VisuallyHiddenInput\n :id=\"id\"\n as=\"input\"\n feature=\"focusable\"\n tabindex=\"-1\"\n :value=\"currentModelValue.join('')\"\n :name=\"name ?? ''\"\n :disabled=\"disabled\"\n :required=\"required\"\n @focus=\"Array.from(inputElements)?.[0]?.focus()\"\n />\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","useForwardExpose","useDirection","useVModel","computed","ref","watch"],"mappings":";;;;;;;;;;AAsDO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/DA,mCAAiD,cAAc;;;;;;;;;;;;;;;;;;;;;;;AAWnE,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAM,MAAA,EAAE,IAAM,EAAA,GAAA,EAAK,WAAa,EAAA,IAAA,EAAM,UAAU,GAAK,EAAA,OAAA,EAAY,GAAAC,UAAA,CAAO,KAAK,CAAA;AAC7E,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIC,wCAAiB,EAAA;AACxC,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA;AAEhC,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,Y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BAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -43,8 +43,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
43
43
  function onInputElementChange(el) {
44
44
  inputElements.value.add(el);
45
45
  }
46
+ const isNumericMode = computed(() => props.type === "number");
46
47
  const isCompleted = computed(() => {
47
- const modelValues = currentModelValue.value.filter((i) => !!i);
48
+ const modelValues = currentModelValue.value.filter((i) => !!i || isNumericMode.value && i === 0);
48
49
  return modelValues.length === inputElements.value.size;
49
50
  });
50
51
  watch(modelValue, () => {
@@ -62,7 +63,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
62
63
  disabled,
63
64
  isCompleted,
64
65
  inputElements,
65
- onInputElementChange
66
+ onInputElementChange,
67
+ isNumericMode
66
68
  });
67
69
  return (_ctx, _cache) => {
68
70
  return openBlock(), createBlock(unref(Primitive), mergeProps(_ctx.$attrs, {
@@ -1 +1 @@
1
- {"version":3,"file":"PinInputRoot.js","sources":["../../src/PinInput/PinInputRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { Direction, FormFieldProps } from '@/shared/types'\nimport { computed, ref, toRefs, watch } from 'vue'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\n\nexport type PinInputType = 'text' | 'number'\n\n// Using this type to avoid mixed arrays (string | number)[].\nexport type PinInputValue<Type extends PinInputType = 'text'> = Type extends 'number' ? number[] : string[]\n\nexport type PinInputRootEmits<Type extends PinInputType = 'text'> = {\n 'update:modelValue': [value: PinInputValue<Type>]\n 'complete': [value: PinInputValue<Type>]\n}\n\nexport interface PinInputRootProps<Type extends PinInputType = 'text'> extends PrimitiveProps, FormFieldProps {\n /** The controlled checked state of the pin input. Can be binded as `v-model`. */\n modelValue?: PinInputValue<Type> | null\n /** The default value of the pin inputs when it is initially rendered. Use when you do not need to control its checked state. */\n defaultValue?: PinInputValue<Type>[]\n /** The placeholder character to use for empty pin-inputs. */\n placeholder?: string\n /** When `true`, pin inputs will be treated as password. */\n mask?: boolean\n /** When `true`, mobile devices will autodetect the OTP from messages or clipboard, and enable the autocomplete field. */\n otp?: boolean\n /** Input type for the inputs. */\n type?: Type\n /** The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport interface PinInputRootContext<Type extends PinInputType = 'text'> {\n modelValue: Ref<PinInputValue<Type>>\n currentModelValue: ComputedRef<PinInputValue<Type>>\n mask: Ref<boolean>\n otp: Ref<boolean>\n placeholder: Ref<string>\n type: Ref<PinInputType>\n dir: Ref<Direction>\n disabled: Ref<boolean>\n isCompleted: ComputedRef<boolean>\n inputElements?: Ref<Set<HTMLInputElement>>\n onInputElementChange: (el: HTMLInputElement) => void\n}\n\nexport const [injectPinInputRootContext, providePinInputRootContext]\n = createContext<PinInputRootContext<PinInputType>>('PinInputRoot')\n</script>\n\n<script setup lang=\"ts\" generic=\"Type extends PinInputType = 'text'\">\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<PinInputRootProps<Type>>(), {\n placeholder: '',\n type: 'text' as any,\n})\nconst emits = defineEmits<PinInputRootEmits<Type>>()\n\ndefineSlots<{\n default?: (props: {\n /** Current input values */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { mask, otp, placeholder, type, disabled, dir: propDir } = toRefs(props)\nconst { forwardRef } = useForwardExpose()\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? [] as any,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<PinInputValue<Type>>\n\nconst currentModelValue = computed(() => Array.isArray(modelValue.value) ? [...modelValue.value] : [])\n\nconst inputElements = ref<Set<HTMLInputElement>>(new Set())\nfunction onInputElementChange(el: HTMLInputElement) {\n inputElements.value.add(el)\n}\n\nconst isCompleted = computed(() => {\n const modelValues = currentModelValue.value.filter(i => !!i)\n return modelValues.length === inputElements.value.size\n})\n\nwatch(modelValue, () => {\n if (isCompleted.value)\n emits('complete', modelValue.value)\n}, { deep: true })\n\nprovidePinInputRootContext({\n modelValue,\n currentModelValue: currentModelValue as ComputedRef<PinInputValue<Type>>,\n mask,\n otp,\n placeholder,\n type,\n dir,\n disabled,\n isCompleted,\n inputElements,\n onInputElementChange,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n :dir=\"dir\"\n :data-complete=\"isCompleted ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot :model-value=\"modelValue\" />\n\n <VisuallyHiddenInput\n :id=\"id\"\n as=\"input\"\n feature=\"focusable\"\n tabindex=\"-1\"\n :value=\"currentModelValue.join('')\"\n :name=\"name ?? ''\"\n :disabled=\"disabled\"\n :required=\"required\"\n @focus=\"Array.from(inputElements)?.[0]?.focus()\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;AAqDO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAiD,cAAc;;;;;;;;;;;;;;;;;;;;;;;AAWnE,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAM,MAAA,EAAE,IAAM,EAAA,GAAA,EAAK,WAAa,EAAA,IAAA,EAAM,UAAU,GAAK,EAAA,OAAA,EAAY,GAAA,MAAA,CAAO,KAAK,CAAA;AAC7E,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;AACxC,IAAM,MAAA,GAAA,GAAM,aAAa,OAAO,CAAA;AAEhC,IAAA,MA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.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { Direction, FormFieldProps } from '@/shared/types'\nimport { computed, ref, toRefs, watch } from 'vue'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\n\nexport type PinInputType = 'text' | 'number'\n\n// Using this type to avoid mixed arrays (string | number)[].\nexport type PinInputValue<Type extends PinInputType = 'text'> = Type extends 'number' ? number[] : string[]\n\nexport type PinInputRootEmits<Type extends PinInputType = 'text'> = {\n 'update:modelValue': [value: PinInputValue<Type>]\n 'complete': [value: PinInputValue<Type>]\n}\n\nexport interface PinInputRootProps<Type extends PinInputType = 'text'> extends PrimitiveProps, FormFieldProps {\n /** The controlled checked state of the pin input. Can be binded as `v-model`. */\n modelValue?: PinInputValue<Type> | null\n /** The default value of the pin inputs when it is initially rendered. Use when you do not need to control its checked state. */\n defaultValue?: PinInputValue<Type>[]\n /** The placeholder character to use for empty pin-inputs. */\n placeholder?: string\n /** When `true`, pin inputs will be treated as password. */\n mask?: boolean\n /** When `true`, mobile devices will autodetect the OTP from messages or clipboard, and enable the autocomplete field. */\n otp?: boolean\n /** Input type for the inputs. */\n type?: Type\n /** The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** When `true`, prevents the user from interacting with the pin input */\n disabled?: boolean\n /** Id of the element */\n id?: string\n}\n\nexport interface PinInputRootContext<Type extends PinInputType = 'text'> {\n modelValue: Ref<PinInputValue<Type>>\n currentModelValue: ComputedRef<PinInputValue<Type>>\n mask: Ref<boolean>\n otp: Ref<boolean>\n placeholder: Ref<string>\n type: Ref<PinInputType>\n dir: Ref<Direction>\n disabled: Ref<boolean>\n isCompleted: ComputedRef<boolean>\n inputElements?: Ref<Set<HTMLInputElement>>\n onInputElementChange: (el: HTMLInputElement) => void\n isNumericMode: ComputedRef<boolean>\n}\n\nexport const [injectPinInputRootContext, providePinInputRootContext]\n = createContext<PinInputRootContext<PinInputType>>('PinInputRoot')\n</script>\n\n<script setup lang=\"ts\" generic=\"Type extends PinInputType = 'text'\">\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<PinInputRootProps<Type>>(), {\n placeholder: '',\n type: 'text' as any,\n})\nconst emits = defineEmits<PinInputRootEmits<Type>>()\n\ndefineSlots<{\n default?: (props: {\n /** Current input values */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { mask, otp, placeholder, type, disabled, dir: propDir } = toRefs(props)\nconst { forwardRef } = useForwardExpose()\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? [] as any,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<PinInputValue<Type>>\n\nconst currentModelValue = computed(() => Array.isArray(modelValue.value) ? [...modelValue.value] : [])\n\nconst inputElements = ref<Set<HTMLInputElement>>(new Set())\nfunction onInputElementChange(el: HTMLInputElement) {\n inputElements.value.add(el)\n}\n\nconst isNumericMode = computed(() => props.type === 'number')\nconst isCompleted = computed(() => {\n const modelValues = currentModelValue.value.filter(i => !!i || (isNumericMode.value && i === 0))\n return modelValues.length === inputElements.value.size\n})\n\nwatch(modelValue, () => {\n if (isCompleted.value)\n emits('complete', modelValue.value)\n}, { deep: true })\n\nprovidePinInputRootContext({\n modelValue,\n currentModelValue: currentModelValue as ComputedRef<PinInputValue<Type>>,\n mask,\n otp,\n placeholder,\n type,\n dir,\n disabled,\n isCompleted,\n inputElements,\n onInputElementChange,\n isNumericMode,\n})\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n :dir=\"dir\"\n :data-complete=\"isCompleted ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n >\n <slot :model-value=\"modelValue\" />\n\n <VisuallyHiddenInput\n :id=\"id\"\n as=\"input\"\n feature=\"focusable\"\n tabindex=\"-1\"\n :value=\"currentModelValue.join('')\"\n :name=\"name ?? ''\"\n :disabled=\"disabled\"\n :required=\"required\"\n @focus=\"Array.from(inputElements)?.[0]?.focus()\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;AAsDO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAiD,cAAc;;;;;;;;;;;;;;;;;;;;;;;AAWnE,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAM,MAAA,EAAE,IAAM,EAAA,GAAA,EAAK,WAAa,EAAA,IAAA,EAAM,UAAU,GAAK,EAAA,OAAA,EAAY,GAAA,MAAA,CAAO,KAAK,CAAA;AAC7E,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;AACxC,IAAM,MAAA,GAAA,GAAM,aAAa,OAAO,CAAA;AAEhC,IAAA,MAAM,UAAa,GAAA,SAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,YAAA,EAAc,KAAM,CAAA,YAAA,IAAgB,EAAC;AAAA,MACrC,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,MAAM,iBAAoB,GAAA,QAAA,CAAS,MAAM,KAAA,CAAM,QAAQ,UAAW,CAAA,KAAK,CAAI,GAAA,CAAC,GAAG,UAAA,CAAW,KAAK,CAAA,GAAI,EAAE,CAAA;AAErG,IAAA,MAAM,aAAgB,GAAA,GAAA,iBAA+B,IAAA,GAAA,EAAK,CAAA;AAC1D,IAAA,SAAS,qBAAqB,EAAsB,EAAA;AAClD,MAAc,aAAA,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA;AAAA;AAG5B,IAAA,MAAM,aAAgB,GAAA,QAAA,CAAS,MAAM,KAAA,CAAM,SAAS,QAAQ,CAAA;AAC5D,IAAM,MAAA,WAAA,GAAc,SAAS,MAAM;AACjC,MAAM,MAAA,WAAA,GAAc,iBAAkB,CAAA,KAAA,CAAM,MAAO,CAAA,CAAA,CAAA,KAAK,CAAC,CAAC,CAAM,IAAA,aAAA,CAAc,KAAS,IAAA,CAAA,KAAM,CAAE,CAAA;AAC/F,MAAO,OAAA,WAAA,CAAY,MAAW,KAAA,aAAA,CAAc,KAAM,CAAA,IAAA;AAAA,KACnD,CAAA;AAED,IAAA,KAAA,CAAM,YAAY,MAAM;AACtB,MAAA,IAAI,WAAY,CAAA,KAAA;AACd,QAAM,KAAA,CAAA,UAAA,EAAY,WAAW,KAAK,CAAA;AAAA,KACnC,EAAA,EAAE,IAAM,EAAA,IAAA,EAAM,CAAA;AAEjB,IAA2B,0BAAA,CAAA;AAAA,MACzB,UAAA;AAAA,MACA,iBAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,WAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA,oBAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  const vue = require('vue');
4
- const DismissableLayer_DismissableLayer = require('../DismissableLayer/DismissableLayer.cjs');
5
4
  const Popper_PopperContent = require('../Popper/PopperContent.cjs');
6
5
  const shared = require('@vueuse/shared');
7
6
  const shared_useForwardProps = require('../shared/useForwardProps.cjs');
8
7
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
9
8
  const shared_useFocusGuards = require('../shared/useFocusGuards.cjs');
10
9
  const FocusScope_FocusScope = require('../FocusScope/FocusScope.cjs');
10
+ const DismissableLayer_DismissableLayer = require('../DismissableLayer/DismissableLayer.cjs');
11
11
  const Popover_PopoverRoot = require('./PopoverRoot.cjs');
12
12
 
13
13
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
@@ -1,11 +1,11 @@
1
1
  import { defineComponent, createBlock, openBlock, unref, withCtx, createVNode, mergeProps, renderSlot } from 'vue';
2
- import { _ as _sfc_main$2 } from '../DismissableLayer/DismissableLayer.js';
3
2
  import { _ as _sfc_main$3 } from '../Popper/PopperContent.js';
4
3
  import { reactiveOmit } from '@vueuse/shared';
5
4
  import { u as useForwardProps } from '../shared/useForwardProps.js';
6
5
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
7
6
  import { u as useFocusGuards } from '../shared/useFocusGuards.js';
8
7
  import { _ as _sfc_main$1 } from '../FocusScope/FocusScope.js';
8
+ import { _ as _sfc_main$2 } from '../DismissableLayer/DismissableLayer.js';
9
9
  import { i as injectPopoverRootContext } from './PopoverRoot.js';
10
10
 
11
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -32,6 +32,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
32
32
  const isFormControl = shared_useFormControl.useFormControl(triggerElement);
33
33
  const ariaLabel = vue.computed(() => props.id && triggerElement.value ? document.querySelector(`[for="${props.id}"]`)?.innerText ?? props.value : void 0);
34
34
  function handleClick(event) {
35
+ if (props.disabled)
36
+ return;
35
37
  RadioGroup_utils.handleSelect(event, props.value, (ev) => {
36
38
  emits("select", ev);
37
39
  if (ev?.defaultPrevented)
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.cjs","sources":["../../src/RadioGroup/Radio.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { SelectEvent } from './utils'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { AcceptableValue, FormFieldProps } from '@/shared/types'\n\nexport type RadioEmits = {\n 'update:checked': [value: boolean]\n 'select': [SelectEvent]\n}\n\nexport interface RadioProps extends PrimitiveProps, FormFieldProps {\n id?: string\n /** The value given as data when submitted with a `name`. */\n value?: AcceptableValue\n /** When `true`, prevents the user from interacting with the radio item. */\n disabled?: boolean\n checked?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { computed, toRefs } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\nimport { handleSelect } from './utils'\n\nconst props = withDefaults(defineProps<RadioProps>(), {\n disabled: false,\n checked: undefined,\n as: 'button',\n})\nconst emits = defineEmits<RadioEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current checked state */\n checked: typeof checked.value\n }) => any\n}>()\n\nconst checked = useVModel(props, 'checked', emits, {\n passive: (props.checked === undefined) as false,\n})\n\nconst { value } = toRefs(props)\nconst { forwardRef, currentElement: triggerElement } = useForwardExpose()\nconst isFormControl = useFormControl(triggerElement)\n\nconst ariaLabel = computed(() => props.id && triggerElement.value ? (document.querySelector(`[for=\"${props.id}\"]`) as HTMLLabelElement)?.innerText ?? props.value : undefined)\n\nfunction handleClick(event: MouseEvent) {\n handleSelect(event, props.value, (ev) => {\n emits('select', ev)\n if (ev?.defaultPrevented)\n return\n\n checked.value = true\n if (isFormControl.value) {\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n ev.stopPropagation()\n }\n })\n}\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :id=\"id\"\n :ref=\"forwardRef\"\n role=\"radio\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as=\"as\"\n :aria-checked=\"checked\"\n :aria-label=\"ariaLabel\"\n :as-child=\"asChild\"\n :disabled=\"disabled ? '' : undefined\"\n :data-state=\"checked ? 'checked' : 'unchecked'\"\n :data-disabled=\"disabled ? '' : undefined\"\n :value=\"value\"\n :required=\"required\"\n :name=\"name\"\n @click.stop=\"handleClick\"\n >\n <slot :checked=\"checked\" />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"radio\"\n tabindex=\"-1\"\n :value=\"value\"\n :checked=\"!!checked\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":["useVModel","toRefs","useForwardExpose","useFormControl","computed","handleSelect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAA,MAAM,OAAU,GAAAA,cAAA,CAAU,KAAO,EAAA,SAAA,EAAW,KAAO,EAAA;AAAA,MACjD,OAAA,EAAU,MAAM,OAAY,KAAA;AAAA,KAC7B,CAAA;AAED,IAAA,MAAM,EAAE,KAAA,EAAU,GAAAC,UAAA,CAAO,KAAK,CAAA;AAC9B,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,cAAA,KAAmBC,wCAAiB,EAAA;AACxE,IAAM,MAAA,aAAA,GAAgBC,qCAAe,cAAc,CAAA;AAEnD,IAAA,MAAM,YAAYC,YAAS,CAAA,MAAM,KAAM,CAAA,EAAA,IAAM,eAAe,KAAS,GAAA,QAAA,CAAS,aAAc,CAAA,CAAA,MAAA,EAAS,MAAM,EAAE,CAAA,EAAA,CAAI,GAAwB,SAAa,IAAA,KAAA,CAAM,QAAQ,MAAS,CAAA;AAE7K,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAAC,6BAAA,CAAa,KAAO,EAAA,KAAA,CAAM,KAAO,EAAA,CAAC,EAAO,KAAA;AACvC,QAAA,KAAA,CAAM,UAAU,EAAE,CAAA;AAClB,QAAA,IAAI,EAAI,EAAA,gBAAA;AACN,UAAA;AAEF,QAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,QAAA,IAAI,cAAc,KAAO,EAAA;AAIvB,UAAA,EAAA,CAAG,eAAgB,EAAA;AAAA;AACrB,OACD,CAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Radio.cjs","sources":["../../src/RadioGroup/Radio.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { SelectEvent } from './utils'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { AcceptableValue, FormFieldProps } from '@/shared/types'\n\nexport type RadioEmits = {\n 'update:checked': [value: boolean]\n 'select': [SelectEvent]\n}\n\nexport interface RadioProps extends PrimitiveProps, FormFieldProps {\n id?: string\n /** The value given as data when submitted with a `name`. */\n value?: AcceptableValue\n /** When `true`, prevents the user from interacting with the radio item. */\n disabled?: boolean\n checked?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { computed, toRefs } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\nimport { handleSelect } from './utils'\n\nconst props = withDefaults(defineProps<RadioProps>(), {\n disabled: false,\n checked: undefined,\n as: 'button',\n})\nconst emits = defineEmits<RadioEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current checked state */\n checked: typeof checked.value\n }) => any\n}>()\n\nconst checked = useVModel(props, 'checked', emits, {\n passive: (props.checked === undefined) as false,\n})\n\nconst { value } = toRefs(props)\nconst { forwardRef, currentElement: triggerElement } = useForwardExpose()\nconst isFormControl = useFormControl(triggerElement)\n\nconst ariaLabel = computed(() => props.id && triggerElement.value ? (document.querySelector(`[for=\"${props.id}\"]`) as HTMLLabelElement)?.innerText ?? props.value : undefined)\n\nfunction handleClick(event: MouseEvent) {\n if (props.disabled)\n return\n\n handleSelect(event, props.value, (ev) => {\n emits('select', ev)\n if (ev?.defaultPrevented)\n return\n\n checked.value = true\n if (isFormControl.value) {\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n ev.stopPropagation()\n }\n })\n}\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :id=\"id\"\n :ref=\"forwardRef\"\n role=\"radio\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as=\"as\"\n :aria-checked=\"checked\"\n :aria-label=\"ariaLabel\"\n :as-child=\"asChild\"\n :disabled=\"disabled ? '' : undefined\"\n :data-state=\"checked ? 'checked' : 'unchecked'\"\n :data-disabled=\"disabled ? '' : undefined\"\n :value=\"value\"\n :required=\"required\"\n :name=\"name\"\n @click.stop=\"handleClick\"\n >\n <slot :checked=\"checked\" />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"radio\"\n tabindex=\"-1\"\n :value=\"value\"\n :checked=\"!!checked\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":["useVModel","toRefs","useForwardExpose","useFormControl","computed","handleSelect"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAA,MAAM,OAAU,GAAAA,cAAA,CAAU,KAAO,EAAA,SAAA,EAAW,KAAO,EAAA;AAAA,MACjD,OAAA,EAAU,MAAM,OAAY,KAAA;AAAA,KAC7B,CAAA;AAED,IAAA,MAAM,EAAE,KAAA,EAAU,GAAAC,UAAA,CAAO,KAAK,CAAA;AAC9B,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,cAAA,KAAmBC,wCAAiB,EAAA;AACxE,IAAM,MAAA,aAAA,GAAgBC,qCAAe,cAAc,CAAA;AAEnD,IAAA,MAAM,YAAYC,YAAS,CAAA,MAAM,KAAM,CAAA,EAAA,IAAM,eAAe,KAAS,GAAA,QAAA,CAAS,aAAc,CAAA,CAAA,MAAA,EAAS,MAAM,EAAE,CAAA,EAAA,CAAI,GAAwB,SAAa,IAAA,KAAA,CAAM,QAAQ,MAAS,CAAA;AAE7K,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAA,IAAI,KAAM,CAAA,QAAA;AACR,QAAA;AAEF,MAAAC,6BAAA,CAAa,KAAO,EAAA,KAAA,CAAM,KAAO,EAAA,CAAC,EAAO,KAAA;AACvC,QAAA,KAAA,CAAM,UAAU,EAAE,CAAA;AAClB,QAAA,IAAI,EAAI,EAAA,gBAAA;AACN,UAAA;AAEF,QAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,QAAA,IAAI,cAAc,KAAO,EAAA;AAIvB,UAAA,EAAA,CAAG,eAAgB,EAAA;AAAA;AACrB,OACD,CAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -30,6 +30,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
30
  const isFormControl = useFormControl(triggerElement);
31
31
  const ariaLabel = computed(() => props.id && triggerElement.value ? document.querySelector(`[for="${props.id}"]`)?.innerText ?? props.value : void 0);
32
32
  function handleClick(event) {
33
+ if (props.disabled)
34
+ return;
33
35
  handleSelect(event, props.value, (ev) => {
34
36
  emits("select", ev);
35
37
  if (ev?.defaultPrevented)
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../src/RadioGroup/Radio.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { SelectEvent } from './utils'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { AcceptableValue, FormFieldProps } from '@/shared/types'\n\nexport type RadioEmits = {\n 'update:checked': [value: boolean]\n 'select': [SelectEvent]\n}\n\nexport interface RadioProps extends PrimitiveProps, FormFieldProps {\n id?: string\n /** The value given as data when submitted with a `name`. */\n value?: AcceptableValue\n /** When `true`, prevents the user from interacting with the radio item. */\n disabled?: boolean\n checked?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { computed, toRefs } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\nimport { handleSelect } from './utils'\n\nconst props = withDefaults(defineProps<RadioProps>(), {\n disabled: false,\n checked: undefined,\n as: 'button',\n})\nconst emits = defineEmits<RadioEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current checked state */\n checked: typeof checked.value\n }) => any\n}>()\n\nconst checked = useVModel(props, 'checked', emits, {\n passive: (props.checked === undefined) as false,\n})\n\nconst { value } = toRefs(props)\nconst { forwardRef, currentElement: triggerElement } = useForwardExpose()\nconst isFormControl = useFormControl(triggerElement)\n\nconst ariaLabel = computed(() => props.id && triggerElement.value ? (document.querySelector(`[for=\"${props.id}\"]`) as HTMLLabelElement)?.innerText ?? props.value : undefined)\n\nfunction handleClick(event: MouseEvent) {\n handleSelect(event, props.value, (ev) => {\n emits('select', ev)\n if (ev?.defaultPrevented)\n return\n\n checked.value = true\n if (isFormControl.value) {\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n ev.stopPropagation()\n }\n })\n}\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :id=\"id\"\n :ref=\"forwardRef\"\n role=\"radio\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as=\"as\"\n :aria-checked=\"checked\"\n :aria-label=\"ariaLabel\"\n :as-child=\"asChild\"\n :disabled=\"disabled ? '' : undefined\"\n :data-state=\"checked ? 'checked' : 'unchecked'\"\n :data-disabled=\"disabled ? '' : undefined\"\n :value=\"value\"\n :required=\"required\"\n :name=\"name\"\n @click.stop=\"handleClick\"\n >\n <slot :checked=\"checked\" />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"radio\"\n tabindex=\"-1\"\n :value=\"value\"\n :checked=\"!!checked\"\n :name=\"name\"\n :disabled=\"disabled\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAA,MAAM,OAAU,GAAA,SAAA,CAAU,KAAO,EAAA,SAAA,EAAW,KAAO,EAAA;AAAA,MACjD,OAAA,EAAU,MAAM,OAAY,KAAA;AAAA,KAC7B,CAAA;AAED,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAA,CAAO,KAAK,CAAA;AAC9B,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,cAAA,KAAmB,gBAAiB,EAAA;AACxE,IAAM,MAAA,aAAA,GAAgB,eAAe,cAAc,CAAA;AAEnD,IAAA,MAAM,YAAY,QAAS,CAAA,MAAM,KAAM,CAAA,EAAA,IAAM,eAAe,KAAS,GAAA,QAAA,CAAS,aAAc,CAAA,CAAA,MAAA,EAAS,MAAM,EAAE,CAAA,EAAA,CAAI,GAAwB,SAAa,IAAA,KAAA,CAAM,QAAQ,MAAS,CAAA;AAE7K,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAA,YAAA,CAAa,KAAO,EAAA,KAAA,CAAM,KAAO,EAAA,CAAC,EAAO,KAAA;AACvC,QAAA,KAAA,CAAM,UAAU,EAAE,CAAA;AAClB,QAAA,IAAI,EAAI,EAAA,gBAAA;AACN,UAAA;AAEF,QAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,QAAA,IAAI,cAAc,KAAO,EAAA;AAIvB,UAAA,EAAA,CAAG,eAAgB,EAAA;AAAA;AACrB,OACD,CAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../src/RadioGroup/Radio.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { SelectEvent } from './utils'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { AcceptableValue, FormFieldProps } from '@/shared/types'\n\nexport type RadioEmits = {\n 'update:checked': [value: boolean]\n 'select': [SelectEvent]\n}\n\nexport interface RadioProps extends PrimitiveProps, FormFieldProps {\n id?: string\n /** The value given as data when submitted with a `name`. */\n value?: AcceptableValue\n /** When `true`, prevents the user from interacting with the radio item. */\n disabled?: boolean\n checked?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { useVModel } from '@vueuse/core'\nimport { computed, toRefs } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport { VisuallyHiddenInput } from '@/VisuallyHidden'\nimport { handleSelect } from './utils'\n\nconst props = withDefaults(defineProps<RadioProps>(), {\n disabled: false,\n checked: undefined,\n as: 'button',\n})\nconst emits = defineEmits<RadioEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current checked state */\n checked: typeof checked.value\n }) => any\n}>()\n\nconst checked = useVModel(props, 'checked', emits, {\n passive: (props.checked === undefined) as false,\n})\n\nconst { value } = toRefs(props)\nconst { forwardRef, currentElement: triggerElement } = useForwardExpose()\nconst isFormControl = useFormControl(triggerElement)\n\nconst ariaLabel = computed(() => props.id && triggerElement.value ? (document.querySelector(`[for=\"${props.id}\"]`) as HTMLLabelElement)?.innerText ?? props.value : undefined)\n\nfunction handleClick(event: MouseEvent) {\n if (props.disabled)\n return\n\n handleSelect(event, props.value, (ev) => {\n emits('select', ev)\n if (ev?.defaultPrevented)\n return\n\n checked.value = true\n if (isFormControl.value) {\n // if radio is in a form, stop propagation from the button so that we only propagate\n // one click event (from the input). We propagate changes from an input so that native\n // form validation works and form events reflect radio updates.\n ev.stopPropagation()\n }\n })\n}\n</script>\n\n<template>\n <Primitive\n v-bind=\"$attrs\"\n :id=\"id\"\n :ref=\"forwardRef\"\n role=\"radio\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as=\"as\"\n :aria-checked=\"checked\"\n :aria-label=\"ariaLabel\"\n :as-child=\"asChild\"\n :disabled=\"disabled ? '' : undefined\"\n :data-state=\"checked ? 'checked' : 'unchecked'\"\n :data-disabled=\"disabled ? '' : undefined\"\n :value=\"value\"\n :required=\"required\"\n :name=\"name\"\n @click.stop=\"handleClick\"\n >\n <slot :checked=\"checked\" />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name\"\n type=\"radio\"\n tabindex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 
3
3
  const vue = require('vue');
4
4
  const core = require('@vueuse/core');
5
- const DismissableLayer_DismissableLayer = require('../DismissableLayer/DismissableLayer.cjs');
6
5
  const Menu_utils = require('../Menu/utils.cjs');
7
6
  const Select_SelectItemAlignedPosition = require('./SelectItemAlignedPosition.cjs');
8
7
  const Select_SelectPopperPosition = require('./SelectPopperPosition.cjs');
@@ -15,6 +14,7 @@ const shared_useHideOthers = require('../shared/useHideOthers.cjs');
15
14
  const shared_useTypeahead = require('../shared/useTypeahead.cjs');
16
15
  const shared_useForwardProps = require('../shared/useForwardProps.cjs');
17
16
  const FocusScope_FocusScope = require('../FocusScope/FocusScope.cjs');
17
+ const DismissableLayer_DismissableLayer = require('../DismissableLayer/DismissableLayer.cjs');
18
18
  const Select_SelectRoot = require('./SelectRoot.cjs');
19
19
 
20
20
  const SelectContentDefaultContextValue = {
@@ -1,6 +1,5 @@
1
1
  import { defineComponent, ref, watch, watchEffect, computed, createBlock, openBlock, unref, withCtx, createVNode, withModifiers, resolveDynamicComponent, mergeProps, renderSlot } from 'vue';
2
2
  import { unrefElement } from '@vueuse/core';
3
- import { _ as _sfc_main$2 } from '../DismissableLayer/DismissableLayer.js';
4
3
  import { f as focusFirst } from '../Menu/utils.js';
5
4
  import { _ as _sfc_main$4 } from './SelectItemAlignedPosition.js';
6
5
  import { _ as _sfc_main$3 } from './SelectPopperPosition.js';
@@ -13,6 +12,7 @@ import { u as useHideOthers } from '../shared/useHideOthers.js';
13
12
  import { u as useTypeahead } from '../shared/useTypeahead.js';
14
13
  import { u as useForwardProps } from '../shared/useForwardProps.js';
15
14
  import { _ as _sfc_main$1 } from '../FocusScope/FocusScope.js';
15
+ import { _ as _sfc_main$2 } from '../DismissableLayer/DismissableLayer.js';
16
16
  import { i as injectSelectRootContext } from './SelectRoot.js';
17
17
 
18
18
  const SelectContentDefaultContextValue = {
@@ -37,7 +37,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
37
37
  const emits = __emit;
38
38
  const { dir: propDir, orientation: propOrientation, linear } = vue.toRefs(props);
39
39
  const dir = shared_useDirection.useDirection(propDir);
40
- shared_useForwardExpose.useForwardExpose();
41
40
  const totalStepperItems = vue.ref(/* @__PURE__ */ new Set());
42
41
  const modelValue = core.useVModel(props, "modelValue", emits, {
43
42
  defaultValue: props.defaultValue,
@@ -111,6 +110,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
111
110
  hasNext,
112
111
  hasPrev
113
112
  });
113
+ shared_useForwardExpose.useForwardExpose();
114
114
  return (_ctx, _cache) => {
115
115
  return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), {
116
116
  role: "group",
@@ -1 +1 @@
1
- {"version":3,"file":"StepperRoot.cjs","sources":["../../src/Stepper/StepperRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { DataOrientation, Direction } from '../shared/types'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { computed, nextTick, ref, toRefs, watch } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\n\nexport interface StepperRootContext {\n modelValue: Ref<number | undefined>\n changeModelValue: (value: number) => void\n orientation: Ref<DataOrientation>\n dir: Ref<Direction>\n linear: Ref<boolean>\n totalStepperItems: Ref<Set<HTMLElement>>\n}\n\nexport interface StepperRootProps extends PrimitiveProps {\n /**\n * The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.\n */\n defaultValue?: number\n /**\n * The orientation the steps are laid out.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down).\n * @defaultValue horizontal\n */\n orientation?: DataOrientation\n /**\n * The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode.\n */\n dir?: Direction\n /** The controlled value of the step to activate. Can be bound as `v-model`. */\n modelValue?: number\n /** Whether or not the steps must be completed in order. */\n linear?: boolean\n}\nexport type StepperRootEmits = {\n /** Event handler called when the value changes */\n 'update:modelValue': [payload: number | undefined]\n}\n\nexport const [injectStepperRootContext, provideStepperRootContext]\n = createContext<StepperRootContext>('StepperRoot')\n</script>\n\n<script setup lang=\"ts\">\nconst props = withDefaults(defineProps<StepperRootProps>(), {\n orientation: 'horizontal',\n linear: true,\n defaultValue: 1,\n})\nconst emits = defineEmits<StepperRootEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current step */\n modelValue: number | undefined\n /** Total number of steps */\n totalSteps: number\n /** Whether or not the next step is disabled */\n isNextDisabled: boolean\n /** Whether or not the previous step is disabled */\n isPrevDisabled: boolean\n /** Whether or not the first step is active */\n isFirstStep: boolean\n /** Whether or not the last step is active */\n isLastStep: boolean\n /** Go to a specific step */\n goToStep: (step: number) => void\n /** Go to the next step */\n nextStep: () => void\n /** Go to the previous step */\n prevStep: () => void\n /** Whether or not there is a next step */\n hasNext: () => boolean\n /** Whether or not there is a previous step */\n hasPrev: () => boolean\n }) => any\n}>()\n\nconst { dir: propDir, orientation: propOrientation, linear } = toRefs(props)\nconst dir = useDirection(propDir)\nuseForwardExpose()\n\nconst totalStepperItems = ref<Set<HTMLElement>>(new Set())\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n})\n\nconst totalStepperItemsArray = computed(() => Array.from(totalStepperItems.value))\n\nconst isFirstStep = computed(() => modelValue.value === 1)\nconst isLastStep = computed(() => modelValue.value === totalStepperItemsArray.value.length)\n\nconst totalSteps = computed(() => totalStepperItems.value.size)\n\nfunction goToStep(step: number) {\n if (step > totalSteps.value)\n return\n\n if (step < 1)\n return\n\n if (totalStepperItems.value.size && !!totalStepperItemsArray.value[step] && !!totalStepperItemsArray.value[step].getAttribute('disabled'))\n return\n\n if (linear.value) {\n if (step > (modelValue.value ?? 1) + 1)\n return\n }\n\n modelValue.value = step\n}\n\nfunction nextStep() {\n goToStep((modelValue.value ?? 1) + 1)\n}\n\nfunction prevStep() {\n goToStep((modelValue.value ?? 1) - 1)\n}\n\nfunction hasNext() {\n return (modelValue.value ?? 1) < totalSteps.value\n}\n\nfunction hasPrev() {\n return (modelValue.value ?? 1) > 1\n}\n\nconst nextStepperItem = ref<HTMLElement | null>(null)\nconst prevStepperItem = ref<HTMLElement | null>(null)\nconst isNextDisabled = computed(() => nextStepperItem.value ? nextStepperItem.value.getAttribute('disabled') === '' : true)\nconst isPrevDisabled = computed(() => prevStepperItem.value ? prevStepperItem.value.getAttribute('disabled') === '' : true)\n\nwatch(modelValue, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\nwatch(totalStepperItemsArray, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\n\nprovideStepperRootContext({\n modelValue,\n changeModelValue: (value: number) => {\n modelValue.value = value\n },\n orientation: propOrientation,\n dir,\n linear,\n totalStepperItems,\n})\n\ndefineExpose({\n goToStep,\n nextStep,\n prevStep,\n modelValue,\n totalSteps,\n isNextDisabled,\n isPrevDisabled,\n isFirstStep,\n isLastStep,\n hasNext,\n hasPrev,\n})\n</script>\n\n<template>\n <Primitive\n role=\"group\"\n aria-label=\"progress\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-linear=\"linear ? '' : undefined\"\n :data-orientation=\"orientation\"\n >\n <slot\n :model-value=\"modelValue\"\n :total-steps=\"totalStepperItems.size\"\n :is-next-disabled=\"isNextDisabled\"\n :is-prev-disabled=\"isPrevDisabled\"\n :is-first-step=\"isFirstStep\"\n :is-last-step=\"isLastStep\"\n :go-to-step=\"goToStep\"\n :next-step=\"nextStep\"\n :prev-step=\"prevStep\"\n :has-next=\"hasNext\"\n :has-prev=\"hasPrev\"\n />\n\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n role=\"status\"\n :style=\"{\n transform: 'translateX(-100%)',\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }\"\n >\n Step {{ modelValue }} of {{ totalStepperItems.size }}\n </div>\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","useDirection","useForwardExpose","ref","useVModel","computed","watch","nextTick"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,CAAC,wBAAA,EAA0B,yBAAyB,CAAA,GAC7DA,mCAAkC,aAAa;;;;;;;;;;;;;;AAInD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AA6Bd,IAAM,MAAA,EAAE,KAAK,OAAS,EAAA,WAAA,EAAa,iBAAiB,MAAO,EAAA,GAAIC,WAAO,KAAK,CAAA;AAC3E,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA;AAChC,IAAiBC,wCAAA,EAAA;AAEjB,IAAA,MAAM,iBAAoB,GAAAC,OAAA,iBAA0B,IAAA,GAAA,EAAK,CAAA;AAEzD,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,MAAM,yBAAyBC,YAAS,CAAA,MAAM,MAAM,IAAK,CAAA,iBAAA,CAAkB,KAAK,CAAC,CAAA;AAEjF,IAAA,MAAM,WAAc,GAAAA,YAAA,CAAS,MAAM,UAAA,CAAW,UAAU,CAAC,CAAA;AACzD,IAAA,MAAM,aAAaA,YAAS,CAAA,MAAM,WAAW,KAAU,KAAA,s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CAAA;AAAA,KACF,CAAA;AAED,IAA0B,yBAAA,CAAA;AAAA,MACxB,UAAA;AAAA,MACA,gBAAA,EAAkB,CAAC,KAAkB,KAAA;AACnC,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA;AAAA,OACrB;AAAA,MACA,WAAa,EAAA,eAAA;AAAA,MACb,GAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"StepperRoot.cjs","sources":["../../src/Stepper/StepperRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { DataOrientation, Direction } from '../shared/types'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { computed, nextTick, ref, toRefs, watch } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\n\nexport interface StepperRootContext {\n modelValue: Ref<number | undefined>\n changeModelValue: (value: number) => void\n orientation: Ref<DataOrientation>\n dir: Ref<Direction>\n linear: Ref<boolean>\n totalStepperItems: Ref<Set<HTMLElement>>\n}\n\nexport interface StepperRootProps extends PrimitiveProps {\n /**\n * The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.\n */\n defaultValue?: number\n /**\n * The orientation the steps are laid out.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down).\n * @defaultValue horizontal\n */\n orientation?: DataOrientation\n /**\n * The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode.\n */\n dir?: Direction\n /** The controlled value of the step to activate. Can be bound as `v-model`. */\n modelValue?: number\n /** Whether or not the steps must be completed in order. */\n linear?: boolean\n}\nexport type StepperRootEmits = {\n /** Event handler called when the value changes */\n 'update:modelValue': [payload: number | undefined]\n}\n\nexport const [injectStepperRootContext, provideStepperRootContext]\n = createContext<StepperRootContext>('StepperRoot')\n</script>\n\n<script setup lang=\"ts\">\nconst props = withDefaults(defineProps<StepperRootProps>(), {\n orientation: 'horizontal',\n linear: true,\n defaultValue: 1,\n})\nconst emits = defineEmits<StepperRootEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current step */\n modelValue: number | undefined\n /** Total number of steps */\n totalSteps: number\n /** Whether or not the next step is disabled */\n isNextDisabled: boolean\n /** Whether or not the previous step is disabled */\n isPrevDisabled: boolean\n /** Whether or not the first step is active */\n isFirstStep: boolean\n /** Whether or not the last step is active */\n isLastStep: boolean\n /** Go to a specific step */\n goToStep: (step: number) => void\n /** Go to the next step */\n nextStep: () => void\n /** Go to the previous step */\n prevStep: () => void\n /** Whether or not there is a next step */\n hasNext: () => boolean\n /** Whether or not there is a previous step */\n hasPrev: () => boolean\n }) => any\n}>()\n\nconst { dir: propDir, orientation: propOrientation, linear } = toRefs(props)\nconst dir = useDirection(propDir)\n\nconst totalStepperItems = ref<Set<HTMLElement>>(new Set())\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n})\n\nconst totalStepperItemsArray = computed(() => Array.from(totalStepperItems.value))\n\nconst isFirstStep = computed(() => modelValue.value === 1)\nconst isLastStep = computed(() => modelValue.value === totalStepperItemsArray.value.length)\n\nconst totalSteps = computed(() => totalStepperItems.value.size)\n\nfunction goToStep(step: number) {\n if (step > totalSteps.value)\n return\n\n if (step < 1)\n return\n\n if (totalStepperItems.value.size && !!totalStepperItemsArray.value[step] && !!totalStepperItemsArray.value[step].getAttribute('disabled'))\n return\n\n if (linear.value) {\n if (step > (modelValue.value ?? 1) + 1)\n return\n }\n\n modelValue.value = step\n}\n\nfunction nextStep() {\n goToStep((modelValue.value ?? 1) + 1)\n}\n\nfunction prevStep() {\n goToStep((modelValue.value ?? 1) - 1)\n}\n\nfunction hasNext() {\n return (modelValue.value ?? 1) < totalSteps.value\n}\n\nfunction hasPrev() {\n return (modelValue.value ?? 1) > 1\n}\n\nconst nextStepperItem = ref<HTMLElement | null>(null)\nconst prevStepperItem = ref<HTMLElement | null>(null)\nconst isNextDisabled = computed(() => nextStepperItem.value ? nextStepperItem.value.getAttribute('disabled') === '' : true)\nconst isPrevDisabled = computed(() => prevStepperItem.value ? prevStepperItem.value.getAttribute('disabled') === '' : true)\n\nwatch(modelValue, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\nwatch(totalStepperItemsArray, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\n\nprovideStepperRootContext({\n modelValue,\n changeModelValue: (value: number) => {\n modelValue.value = value\n },\n orientation: propOrientation,\n dir,\n linear,\n totalStepperItems,\n})\n\ndefineExpose({\n goToStep,\n nextStep,\n prevStep,\n modelValue,\n totalSteps,\n isNextDisabled,\n isPrevDisabled,\n isFirstStep,\n isLastStep,\n hasNext,\n hasPrev,\n})\n\nuseForwardExpose()\n</script>\n\n<template>\n <Primitive\n role=\"group\"\n aria-label=\"progress\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-linear=\"linear ? '' : undefined\"\n :data-orientation=\"orientation\"\n >\n <slot\n :model-value=\"modelValue\"\n :total-steps=\"totalStepperItems.size\"\n :is-next-disabled=\"isNextDisabled\"\n :is-prev-disabled=\"isPrevDisabled\"\n :is-first-step=\"isFirstStep\"\n :is-last-step=\"isLastStep\"\n :go-to-step=\"goToStep\"\n :next-step=\"nextStep\"\n :prev-step=\"prevStep\"\n :has-next=\"hasNext\"\n :has-prev=\"hasPrev\"\n />\n\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n role=\"status\"\n :style=\"{\n transform: 'translateX(-100%)',\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }\"\n >\n Step {{ modelValue }} of {{ totalStepperItems.size }}\n </div>\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","useDirection","ref","useVModel","computed","watch","nextTick","useForwardExpose"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CO,MAAM,CAAC,wBAAA,EAA0B,yBAAyB,CAAA,GAC7DA,mCAAkC,aAAa;;;;;;;;;;;;;;AAInD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AA6Bd,IAAM,MAAA,EAAE,KAAK,OAAS,EAAA,WAAA,EAAa,iBAAiB,MAAO,EAAA,GAAIC,WAAO,KAAK,CAAA;AAC3E,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA;AAEhC,IAAA,MAAM,iBAAoB,GAAAC,OAAA,iBAA0B,IAAA,GAAA,EAAK,CAAA;AAEzD,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,MAAM,yBAAyBC,YAAS,CAAA,MAAM,MAAM,IAAK,CAAA,iBAAA,CAAkB,KAAK,CAAC,CAAA;AAEjF,IAAA,MAAM,WAAc,GAAAA,YAAA,CAAS,MAAM,UAAA,CAAW,UAAU,CAA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AM,CAAA,UAAA,CAAW,KAAS,GAAA,CAAC,CAAI,GAAA,IAAA;AAAA,OAC9I,CAAA;AAAA,KACF,CAAA;AAED,IAA0B,yBAAA,CAAA;AAAA,MACxB,UAAA;AAAA,MACA,gBAAA,EAAkB,CAAC,KAAkB,KAAA;AACnC,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA;AAAA,OACrB;AAAA,MACA,WAAa,EAAA,eAAA;AAAA,MACb,GAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAiBC,wCAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -35,7 +35,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
35
35
  const emits = __emit;
36
36
  const { dir: propDir, orientation: propOrientation, linear } = toRefs(props);
37
37
  const dir = useDirection(propDir);
38
- useForwardExpose();
39
38
  const totalStepperItems = ref(/* @__PURE__ */ new Set());
40
39
  const modelValue = useVModel(props, "modelValue", emits, {
41
40
  defaultValue: props.defaultValue,
@@ -109,6 +108,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
109
108
  hasNext,
110
109
  hasPrev
111
110
  });
111
+ useForwardExpose();
112
112
  return (_ctx, _cache) => {
113
113
  return openBlock(), createBlock(unref(Primitive), {
114
114
  role: "group",
@@ -1 +1 @@
1
- {"version":3,"file":"StepperRoot.js","sources":["../../src/Stepper/StepperRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { DataOrientation, Direction } from '../shared/types'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { computed, nextTick, ref, toRefs, watch } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\n\nexport interface StepperRootContext {\n modelValue: Ref<number | undefined>\n changeModelValue: (value: number) => void\n orientation: Ref<DataOrientation>\n dir: Ref<Direction>\n linear: Ref<boolean>\n totalStepperItems: Ref<Set<HTMLElement>>\n}\n\nexport interface StepperRootProps extends PrimitiveProps {\n /**\n * The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.\n */\n defaultValue?: number\n /**\n * The orientation the steps are laid out.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down).\n * @defaultValue horizontal\n */\n orientation?: DataOrientation\n /**\n * The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode.\n */\n dir?: Direction\n /** The controlled value of the step to activate. Can be bound as `v-model`. */\n modelValue?: number\n /** Whether or not the steps must be completed in order. */\n linear?: boolean\n}\nexport type StepperRootEmits = {\n /** Event handler called when the value changes */\n 'update:modelValue': [payload: number | undefined]\n}\n\nexport const [injectStepperRootContext, provideStepperRootContext]\n = createContext<StepperRootContext>('StepperRoot')\n</script>\n\n<script setup lang=\"ts\">\nconst props = withDefaults(defineProps<StepperRootProps>(), {\n orientation: 'horizontal',\n linear: true,\n defaultValue: 1,\n})\nconst emits = defineEmits<StepperRootEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current step */\n modelValue: number | undefined\n /** Total number of steps */\n totalSteps: number\n /** Whether or not the next step is disabled */\n isNextDisabled: boolean\n /** Whether or not the previous step is disabled */\n isPrevDisabled: boolean\n /** Whether or not the first step is active */\n isFirstStep: boolean\n /** Whether or not the last step is active */\n isLastStep: boolean\n /** Go to a specific step */\n goToStep: (step: number) => void\n /** Go to the next step */\n nextStep: () => void\n /** Go to the previous step */\n prevStep: () => void\n /** Whether or not there is a next step */\n hasNext: () => boolean\n /** Whether or not there is a previous step */\n hasPrev: () => boolean\n }) => any\n}>()\n\nconst { dir: propDir, orientation: propOrientation, linear } = toRefs(props)\nconst dir = useDirection(propDir)\nuseForwardExpose()\n\nconst totalStepperItems = ref<Set<HTMLElement>>(new Set())\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n})\n\nconst totalStepperItemsArray = computed(() => Array.from(totalStepperItems.value))\n\nconst isFirstStep = computed(() => modelValue.value === 1)\nconst isLastStep = computed(() => modelValue.value === totalStepperItemsArray.value.length)\n\nconst totalSteps = computed(() => totalStepperItems.value.size)\n\nfunction goToStep(step: number) {\n if (step > totalSteps.value)\n return\n\n if (step < 1)\n return\n\n if (totalStepperItems.value.size && !!totalStepperItemsArray.value[step] && !!totalStepperItemsArray.value[step].getAttribute('disabled'))\n return\n\n if (linear.value) {\n if (step > (modelValue.value ?? 1) + 1)\n return\n }\n\n modelValue.value = step\n}\n\nfunction nextStep() {\n goToStep((modelValue.value ?? 1) + 1)\n}\n\nfunction prevStep() {\n goToStep((modelValue.value ?? 1) - 1)\n}\n\nfunction hasNext() {\n return (modelValue.value ?? 1) < totalSteps.value\n}\n\nfunction hasPrev() {\n return (modelValue.value ?? 1) > 1\n}\n\nconst nextStepperItem = ref<HTMLElement | null>(null)\nconst prevStepperItem = ref<HTMLElement | null>(null)\nconst isNextDisabled = computed(() => nextStepperItem.value ? nextStepperItem.value.getAttribute('disabled') === '' : true)\nconst isPrevDisabled = computed(() => prevStepperItem.value ? prevStepperItem.value.getAttribute('disabled') === '' : true)\n\nwatch(modelValue, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\nwatch(totalStepperItemsArray, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\n\nprovideStepperRootContext({\n modelValue,\n changeModelValue: (value: number) => {\n modelValue.value = value\n },\n orientation: propOrientation,\n dir,\n linear,\n totalStepperItems,\n})\n\ndefineExpose({\n goToStep,\n nextStep,\n prevStep,\n modelValue,\n totalSteps,\n isNextDisabled,\n isPrevDisabled,\n isFirstStep,\n isLastStep,\n hasNext,\n hasPrev,\n})\n</script>\n\n<template>\n <Primitive\n role=\"group\"\n aria-label=\"progress\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-linear=\"linear ? '' : undefined\"\n :data-orientation=\"orientation\"\n >\n <slot\n :model-value=\"modelValue\"\n :total-steps=\"totalStepperItems.size\"\n :is-next-disabled=\"isNextDisabled\"\n :is-prev-disabled=\"isPrevDisabled\"\n :is-first-step=\"isFirstStep\"\n :is-last-step=\"isLastStep\"\n :go-to-step=\"goToStep\"\n :next-step=\"nextStep\"\n :prev-step=\"prevStep\"\n :has-next=\"hasNext\"\n :has-prev=\"hasPrev\"\n />\n\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n role=\"status\"\n :style=\"{\n transform: 'translateX(-100%)',\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }\"\n >\n Step {{ modelValue }} of {{ totalStepperItems.size }}\n </div>\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2CO,MAAM,CAAC,wBAAA,EAA0B,yBAAyB,CAAA,GAC7D,cAAkC,aAAa;;;;;;;;;;;;;;AAInD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AA6Bd,IAAM,MAAA,EAAE,KAAK,OAAS,EAAA,WAAA,EAAa,iBAAiB,MAAO,EAAA,GAAI,OAAO,KAAK,CAAA;AA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,KAAS,GAAA,CAAC,CAAI,GAAA,IAAA;AAAA,OAC9I,CAAA;AAAA,KACF,CAAA;AACD,IAAA,KAAA,CAAM,wBAAwB,YAAY;AACxC,MAAA,MAAM,SAAS,MAAM;AACnB,QAAA,eAAA,CAAgB,KAAQ,GAAA,sBAAA,CAAuB,KAAM,CAAA,MAAA,IAAU,UAAW,CAAA,KAAA,GAAS,sBAAuB,CAAA,KAAA,CAAM,MAAS,GAAA,sBAAA,CAAuB,KAAM,CAAA,UAAA,CAAW,KAAM,CAAI,GAAA,IAAA;AAC3K,QAAA,eAAA,CAAgB,KAAQ,GAAA,sBAAA,CAAuB,KAAM,CAAA,MAAA,IAAU,UAAW,CAAA,KAAA,GAAS,CAAI,GAAA,sBAAA,CAAuB,KAAM,CAAA,UAAA,CAAW,KAAS,GAAA,CAAC,CAAI,GAAA,IAAA;AAAA,OAC9I,CAAA;AAAA,KACF,CAAA;AAED,IAA0B,yBAAA,CAAA;AAAA,MACxB,UAAA;AAAA,MACA,gBAAA,EAAkB,CAAC,KAAkB,KAAA;AACnC,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA;AAAA,OACrB;AAAA,MACA,WAAa,EAAA,eAAA;AAAA,MACb,GAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"StepperRoot.js","sources":["../../src/Stepper/StepperRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { DataOrientation, Direction } from '../shared/types'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\nimport { computed, nextTick, ref, toRefs, watch } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\n\nexport interface StepperRootContext {\n modelValue: Ref<number | undefined>\n changeModelValue: (value: number) => void\n orientation: Ref<DataOrientation>\n dir: Ref<Direction>\n linear: Ref<boolean>\n totalStepperItems: Ref<Set<HTMLElement>>\n}\n\nexport interface StepperRootProps extends PrimitiveProps {\n /**\n * The value of the step that should be active when initially rendered. Use when you do not need to control the state of the steps.\n */\n defaultValue?: number\n /**\n * The orientation the steps are laid out.\n * Mainly so arrow navigation is done accordingly (left & right vs. up & down).\n * @defaultValue horizontal\n */\n orientation?: DataOrientation\n /**\n * The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode.\n */\n dir?: Direction\n /** The controlled value of the step to activate. Can be bound as `v-model`. */\n modelValue?: number\n /** Whether or not the steps must be completed in order. */\n linear?: boolean\n}\nexport type StepperRootEmits = {\n /** Event handler called when the value changes */\n 'update:modelValue': [payload: number | undefined]\n}\n\nexport const [injectStepperRootContext, provideStepperRootContext]\n = createContext<StepperRootContext>('StepperRoot')\n</script>\n\n<script setup lang=\"ts\">\nconst props = withDefaults(defineProps<StepperRootProps>(), {\n orientation: 'horizontal',\n linear: true,\n defaultValue: 1,\n})\nconst emits = defineEmits<StepperRootEmits>()\n\ndefineSlots<{\n default?: (props: {\n /** Current step */\n modelValue: number | undefined\n /** Total number of steps */\n totalSteps: number\n /** Whether or not the next step is disabled */\n isNextDisabled: boolean\n /** Whether or not the previous step is disabled */\n isPrevDisabled: boolean\n /** Whether or not the first step is active */\n isFirstStep: boolean\n /** Whether or not the last step is active */\n isLastStep: boolean\n /** Go to a specific step */\n goToStep: (step: number) => void\n /** Go to the next step */\n nextStep: () => void\n /** Go to the previous step */\n prevStep: () => void\n /** Whether or not there is a next step */\n hasNext: () => boolean\n /** Whether or not there is a previous step */\n hasPrev: () => boolean\n }) => any\n}>()\n\nconst { dir: propDir, orientation: propOrientation, linear } = toRefs(props)\nconst dir = useDirection(propDir)\n\nconst totalStepperItems = ref<Set<HTMLElement>>(new Set())\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n})\n\nconst totalStepperItemsArray = computed(() => Array.from(totalStepperItems.value))\n\nconst isFirstStep = computed(() => modelValue.value === 1)\nconst isLastStep = computed(() => modelValue.value === totalStepperItemsArray.value.length)\n\nconst totalSteps = computed(() => totalStepperItems.value.size)\n\nfunction goToStep(step: number) {\n if (step > totalSteps.value)\n return\n\n if (step < 1)\n return\n\n if (totalStepperItems.value.size && !!totalStepperItemsArray.value[step] && !!totalStepperItemsArray.value[step].getAttribute('disabled'))\n return\n\n if (linear.value) {\n if (step > (modelValue.value ?? 1) + 1)\n return\n }\n\n modelValue.value = step\n}\n\nfunction nextStep() {\n goToStep((modelValue.value ?? 1) + 1)\n}\n\nfunction prevStep() {\n goToStep((modelValue.value ?? 1) - 1)\n}\n\nfunction hasNext() {\n return (modelValue.value ?? 1) < totalSteps.value\n}\n\nfunction hasPrev() {\n return (modelValue.value ?? 1) > 1\n}\n\nconst nextStepperItem = ref<HTMLElement | null>(null)\nconst prevStepperItem = ref<HTMLElement | null>(null)\nconst isNextDisabled = computed(() => nextStepperItem.value ? nextStepperItem.value.getAttribute('disabled') === '' : true)\nconst isPrevDisabled = computed(() => prevStepperItem.value ? prevStepperItem.value.getAttribute('disabled') === '' : true)\n\nwatch(modelValue, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\nwatch(totalStepperItemsArray, async () => {\n await nextTick(() => {\n nextStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! < totalStepperItemsArray.value.length ? totalStepperItemsArray.value[modelValue.value!] : null\n prevStepperItem.value = totalStepperItemsArray.value.length && modelValue.value! > 1 ? totalStepperItemsArray.value[modelValue.value! - 2] : null\n })\n})\n\nprovideStepperRootContext({\n modelValue,\n changeModelValue: (value: number) => {\n modelValue.value = value\n },\n orientation: propOrientation,\n dir,\n linear,\n totalStepperItems,\n})\n\ndefineExpose({\n goToStep,\n nextStep,\n prevStep,\n modelValue,\n totalSteps,\n isNextDisabled,\n isPrevDisabled,\n isFirstStep,\n isLastStep,\n hasNext,\n hasPrev,\n})\n\nuseForwardExpose()\n</script>\n\n<template>\n <Primitive\n role=\"group\"\n aria-label=\"progress\"\n :as=\"as\"\n :as-child=\"asChild\"\n :data-linear=\"linear ? '' : undefined\"\n :data-orientation=\"orientation\"\n >\n <slot\n :model-value=\"modelValue\"\n :total-steps=\"totalStepperItems.size\"\n :is-next-disabled=\"isNextDisabled\"\n :is-prev-disabled=\"isPrevDisabled\"\n :is-first-step=\"isFirstStep\"\n :is-last-step=\"isLastStep\"\n :go-to-step=\"goToStep\"\n :next-step=\"nextStep\"\n :prev-step=\"prevStep\"\n :has-next=\"hasNext\"\n :has-prev=\"hasPrev\"\n />\n\n <div\n aria-live=\"polite\"\n aria-atomic=\"true\"\n role=\"status\"\n :style=\"{\n transform: 'translateX(-100%)',\n position: 'absolute',\n pointerEvents: 'none',\n opacity: 0,\n margin: 0,\n }\"\n >\n Step {{ modelValue }} of {{ totalStepperItems.size }}\n </div>\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2CO,MAAM,CAAC,wBAAA,EAA0B,yBAAyB,CAAA,GAC7D,cAAkC,aAAa;;;;;;;;;;;;;;AAInD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAKd,IAAA,MAAM,KAAQ,GAAA,MAAA;AA6Bd,IAAM,MAAA,EAAE,KAAK,OAAS,EAAA,WAAA,EAAa,iBAAiB,MAAO,EAAA,GAAI,O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GAAA,CAAC,CAAI,GAAA,IAAA;AAAA,OAC9I,CAAA;AAAA,KACF,CAAA;AACD,IAAA,KAAA,CAAM,wBAAwB,YAAY;AACxC,MAAA,MAAM,SAAS,MAAM;AACnB,QAAA,eAAA,CAAgB,KAAQ,GAAA,sBAAA,CAAuB,KAAM,CAAA,MAAA,IAAU,UAAW,CAAA,KAAA,GAAS,sBAAuB,CAAA,KAAA,CAAM,MAAS,GAAA,sBAAA,CAAuB,KAAM,CAAA,UAAA,CAAW,KAAM,CAAI,GAAA,IAAA;AAC3K,QAAA,eAAA,CAAgB,KAAQ,GAAA,sBAAA,CAAuB,KAAM,CAAA,MAAA,IAAU,UAAW,CAAA,KAAA,GAAS,CAAI,GAAA,sBAAA,CAAuB,KAAM,CAAA,UAAA,CAAW,KAAS,GAAA,CAAC,CAAI,GAAA,IAAA;AAAA,OAC9I,CAAA;AAAA,KACF,CAAA;AAED,IAA0B,yBAAA,CAAA;AAAA,MACxB,UAAA;AAAA,MACA,gBAAA,EAAkB,CAAC,KAAkB,KAAA;AACnC,QAAA,UAAA,CAAW,KAAQ,GAAA,KAAA;AAAA,OACrB;AAAA,MACA,WAAa,EAAA,eAAA;AAAA,MACb,GAAA;AAAA,MACA,MAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAa,QAAA,CAAA;AAAA,MACX,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAA;AAAA,MACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAiB,gBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,12 +2,12 @@
2
2
 
3
3
  const vue = require('vue');
4
4
  const core = require('@vueuse/core');
5
- const DismissableLayer_DismissableLayerBranch = require('../DismissableLayer/DismissableLayerBranch.cjs');
6
5
  const FocusScope_utils = require('../FocusScope/utils.cjs');
7
6
  const Toast_FocusProxy = require('./FocusProxy.cjs');
8
7
  const Toast_utils = require('./utils.cjs');
9
8
  const Collection_Collection = require('../Collection/Collection.cjs');
10
9
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
10
+ const DismissableLayer_DismissableLayerBranch = require('../DismissableLayer/DismissableLayerBranch.cjs');
11
11
  const Primitive_Primitive = require('../Primitive/Primitive.cjs');
12
12
  const shared_getActiveElement = require('../shared/getActiveElement.cjs');
13
13
  const Toast_ToastProvider = require('./ToastProvider.cjs');
@@ -1,11 +1,11 @@
1
1
  import { defineComponent, toRefs, computed, ref, onMounted, watchEffect, createBlock, openBlock, unref, normalizeStyle, withCtx, createCommentVNode, createVNode, mergeProps, renderSlot } from 'vue';
2
2
  import { onKeyStroke, unrefElement } from '@vueuse/core';
3
- import { _ as _sfc_main$1 } from '../DismissableLayer/DismissableLayerBranch.js';
4
3
  import { f as focusFirst, g as getTabbableCandidates } from '../FocusScope/utils.js';
5
4
  import { _ as _sfc_main$2 } from './FocusProxy.js';
6
5
  import { V as VIEWPORT_PAUSE, a as VIEWPORT_RESUME } from './utils.js';
7
6
  import { u as useCollection } from '../Collection/Collection.js';
8
7
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
8
+ import { _ as _sfc_main$1 } from '../DismissableLayer/DismissableLayerBranch.js';
9
9
  import { P as Primitive } from '../Primitive/Primitive.js';
10
10
  import { g as getActiveElement } from '../shared/getActiveElement.js';
11
11
  import { i as injectToastProviderContext } from './ToastProvider.js';
@@ -2,11 +2,11 @@
2
2
 
3
3
  const vue = require('vue');
4
4
  const core = require('@vueuse/core');
5
- const DismissableLayer_DismissableLayer = require('../DismissableLayer/DismissableLayer.cjs');
6
5
  const Popper_PopperContent = require('../Popper/PopperContent.cjs');
7
6
  const Tooltip_utils = require('./utils.cjs');
8
7
  const Tooltip_TooltipRoot = require('./TooltipRoot.cjs');
9
8
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
9
+ const DismissableLayer_DismissableLayer = require('../DismissableLayer/DismissableLayer.cjs');
10
10
  const VisuallyHidden_VisuallyHidden = require('../VisuallyHidden/VisuallyHidden.cjs');
11
11
 
12
12
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
@@ -1,10 +1,10 @@
1
1
  import { defineComponent, useSlots, computed, onMounted, createBlock, openBlock, unref, withModifiers, withCtx, createVNode, mergeProps, renderSlot, createTextVNode, toDisplayString, Comment } from 'vue';
2
2
  import { useEventListener } from '@vueuse/core';
3
- import { _ as _sfc_main$1 } from '../DismissableLayer/DismissableLayer.js';
4
3
  import { _ as _sfc_main$2 } from '../Popper/PopperContent.js';
5
4
  import { T as TOOLTIP_OPEN } from './utils.js';
6
5
  import { i as injectTooltipRootContext } from './TooltipRoot.js';
7
6
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
7
+ import { _ as _sfc_main$1 } from '../DismissableLayer/DismissableLayer.js';
8
8
  import { _ as _sfc_main$3 } from '../VisuallyHidden/VisuallyHidden.js';
9
9
 
10
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
package/dist/index.d.ts CHANGED
@@ -5028,7 +5028,7 @@ export declare type FlattenedItem<T> = {
5028
5028
  };
5029
5029
  };
5030
5030
 
5031
- declare type FocusOutsideEvent = CustomEvent<{
5031
+ export declare type FocusOutsideEvent = CustomEvent<{
5032
5032
  originalEvent: FocusEvent;
5033
5033
  }>;
5034
5034
 
@@ -6929,6 +6929,7 @@ declare interface PinInputRootContext<Type extends PinInputType = 'text'> {
6929
6929
  isCompleted: ComputedRef<boolean>;
6930
6930
  inputElements?: Ref<Set<HTMLInputElement>>;
6931
6931
  onInputElementChange: (el: HTMLInputElement) => void;
6932
+ isNumericMode: ComputedRef<boolean>;
6932
6933
  }
6933
6934
 
6934
6935
  export declare type PinInputRootEmits<Type extends PinInputType = 'text'> = {
@@ -6961,7 +6962,7 @@ declare type PinInputType = 'text' | 'number';
6961
6962
 
6962
6963
  declare type PinInputValue<Type extends PinInputType = 'text'> = Type extends 'number' ? number[] : string[];
6963
6964
 
6964
- declare type PointerDownOutsideEvent = CustomEvent<{
6965
+ export declare type PointerDownOutsideEvent = CustomEvent<{
6965
6966
  originalEvent: PointerEvent;
6966
6967
  }>;
6967
6968
 
@@ -12,16 +12,14 @@ function useForwardProps(props) {
12
12
  }, {});
13
13
  const refProps = vue.toRef(props);
14
14
  return vue.computed(() => {
15
- const propsAsRefs = vue.toRefs(refProps.value);
16
15
  const preservedProps = {};
17
16
  const assignedProps = vm?.vnode.props ?? {};
18
17
  Object.keys(assignedProps).forEach((key) => {
19
18
  preservedProps[vue.camelize(key)] = assignedProps[key];
20
19
  });
21
20
  return Object.keys({ ...defaultProps, ...preservedProps }).reduce((prev, curr) => {
22
- const val = propsAsRefs[curr]?.value;
23
- if (val !== void 0)
24
- prev[curr] = val;
21
+ if (refProps.value[curr] !== void 0)
22
+ prev[curr] = refProps.value[curr];
25
23
  return prev;
26
24
  }, {});
27
25
  });