@plexui/vue 0.8.0 → 0.9.0

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 (185) hide show
  1. package/dist/es/components/Badge/Badge.js +1 -1
  2. package/dist/es/components/Badge/Badge.js.map +1 -1
  3. package/dist/es/components/Button/Button.js +13 -5
  4. package/dist/es/components/Button/Button.js.map +1 -1
  5. package/dist/es/components/Button/ButtonLink.js +7 -1
  6. package/dist/es/components/Button/ButtonLink.js.map +1 -1
  7. package/dist/es/components/Button/NavigationButton.js +27 -0
  8. package/dist/es/components/Button/NavigationButton.js.map +1 -0
  9. package/dist/es/components/Button/NavigationGlyph.js +27 -0
  10. package/dist/es/components/Button/NavigationGlyph.js.map +1 -0
  11. package/dist/es/components/Button/index.js +1 -0
  12. package/dist/es/components/Button/index.js.map +1 -1
  13. package/dist/es/components/Checkbox/Checkbox.js +14 -4
  14. package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
  15. package/dist/es/components/DateInput/DateInput.js +7 -3
  16. package/dist/es/components/DateInput/DateInput.js.map +1 -1
  17. package/dist/es/components/DatePicker/Calendar.js +130 -86
  18. package/dist/es/components/DatePicker/Calendar.js.map +1 -1
  19. package/dist/es/components/DatePicker/CalendarNavigationIcon.js +31 -0
  20. package/dist/es/components/DatePicker/CalendarNavigationIcon.js.map +1 -0
  21. package/dist/es/components/DatePicker/DatePicker.js +16 -4
  22. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  23. package/dist/es/components/DatePicker/context.js.map +1 -1
  24. package/dist/es/components/DatePicker/useCalendarGutter.js +14 -0
  25. package/dist/es/components/DatePicker/useCalendarGutter.js.map +1 -0
  26. package/dist/es/components/DateRangePicker/Calendar.js +92 -71
  27. package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
  28. package/dist/es/components/DateRangePicker/DateRangePicker.js +13 -4
  29. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  30. package/dist/es/components/DateRangePicker/Trigger.js +1 -0
  31. package/dist/es/components/DateRangePicker/Trigger.js.map +1 -1
  32. package/dist/es/components/Dialog/Dialog.js +125 -52
  33. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  34. package/dist/es/components/Dialog/index.js.map +1 -1
  35. package/dist/es/components/Dialog/sheetDrag.js +77 -24
  36. package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
  37. package/dist/es/components/Field/Field.js +58 -5
  38. package/dist/es/components/Field/Field.js.map +1 -1
  39. package/dist/es/components/FieldGroup/FieldGroup.js +3 -1
  40. package/dist/es/components/FieldGroup/FieldGroup.js.map +1 -1
  41. package/dist/es/components/FileUpload/FileUpload.js +50 -11
  42. package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
  43. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +24 -13
  44. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js.map +1 -1
  45. package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js +9 -3
  46. package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js.map +1 -1
  47. package/dist/es/components/Icon/index.js +1 -0
  48. package/dist/es/components/Icon/index.js.map +1 -1
  49. package/dist/es/components/Icon/svg/Disclosure.js +10 -0
  50. package/dist/es/components/Icon/svg/Disclosure.js.map +1 -0
  51. package/dist/es/components/Indicator/LoadingIndicator.js +2 -2
  52. package/dist/es/components/Indicator/LoadingIndicator.js.map +1 -1
  53. package/dist/es/components/Input/Input.js +15 -5
  54. package/dist/es/components/Input/Input.js.map +1 -1
  55. package/dist/es/components/InputGroup/InputGroup.js +3 -1
  56. package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
  57. package/dist/es/components/MarkdownEditor/MarkdownEditor.js +126 -151
  58. package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
  59. package/dist/es/components/Menu/Menu.js +217 -35
  60. package/dist/es/components/Menu/Menu.js.map +1 -1
  61. package/dist/es/components/Menu/internal.js +2 -1
  62. package/dist/es/components/Menu/internal.js.map +1 -1
  63. package/dist/es/components/OTPInput/OTPInput.js +7 -4
  64. package/dist/es/components/OTPInput/OTPInput.js.map +1 -1
  65. package/dist/es/components/Page/Page.js +93 -14
  66. package/dist/es/components/Page/Page.js.map +1 -1
  67. package/dist/es/components/Page/index.js +1 -1
  68. package/dist/es/components/Page/index.js.map +1 -1
  69. package/dist/es/components/Popover/Popover.js +16 -6
  70. package/dist/es/components/Popover/Popover.js.map +1 -1
  71. package/dist/es/components/Popover/deferredPointerDownOutside.js +6 -0
  72. package/dist/es/components/Popover/deferredPointerDownOutside.js.map +1 -1
  73. package/dist/es/components/RadioGroup/RadioGroup.js +31 -13
  74. package/dist/es/components/RadioGroup/RadioGroup.js.map +1 -1
  75. package/dist/es/components/Select/Select.js +75 -25
  76. package/dist/es/components/Select/Select.js.map +1 -1
  77. package/dist/es/components/SelectControl/SelectControl.js +58 -25
  78. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  79. package/dist/es/components/SelectControl/index.js +1 -1
  80. package/dist/es/components/SelectControl/index.js.map +1 -1
  81. package/dist/es/components/ShimmerText/ShimmerText.js +16 -3
  82. package/dist/es/components/ShimmerText/ShimmerText.js.map +1 -1
  83. package/dist/es/components/Slider/Slider.js +56 -16
  84. package/dist/es/components/Slider/Slider.js.map +1 -1
  85. package/dist/es/components/Sortable/Sortable.js +20 -13
  86. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  87. package/dist/es/components/Switch/Switch.js +6 -3
  88. package/dist/es/components/Switch/Switch.js.map +1 -1
  89. package/dist/es/components/Tabs/Tabs.js +12 -11
  90. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  91. package/dist/es/components/TagInput/TagInput.js +46 -6
  92. package/dist/es/components/TagInput/TagInput.js.map +1 -1
  93. package/dist/es/components/Textarea/Textarea.js +13 -2
  94. package/dist/es/components/Textarea/Textarea.js.map +1 -1
  95. package/dist/es/components/Toast/ToastRenderer.js +144 -0
  96. package/dist/es/components/Toast/ToastRenderer.js.map +1 -0
  97. package/dist/es/components/Toast/Toaster.js +23 -1
  98. package/dist/es/components/Toast/Toaster.js.map +1 -1
  99. package/dist/es/components/Toast/toastLifecycle.js +283 -0
  100. package/dist/es/components/Toast/toastLifecycle.js.map +1 -0
  101. package/dist/es/components/Toolbar/Toolbar.js +107 -0
  102. package/dist/es/components/Toolbar/Toolbar.js.map +1 -0
  103. package/dist/es/components/Toolbar/index.js +2 -0
  104. package/dist/es/components/Toolbar/index.js.map +1 -0
  105. package/dist/es/components/Tooltip/CopyTooltip.js +39 -13
  106. package/dist/es/components/Tooltip/CopyTooltip.js.map +1 -1
  107. package/dist/es/components/Tooltip/Tooltip.js +35 -14
  108. package/dist/es/components/Tooltip/Tooltip.js.map +1 -1
  109. package/dist/es/composables/useFloatingBoundary.js +48 -0
  110. package/dist/es/composables/useFloatingBoundary.js.map +1 -0
  111. package/dist/es/composables/usePhoneSubmenu.js +19 -0
  112. package/dist/es/composables/usePhoneSubmenu.js.map +1 -0
  113. package/dist/es/lib/copyToClipboard.js +16 -7
  114. package/dist/es/lib/copyToClipboard.js.map +1 -1
  115. package/dist/es/lib/floatingBoundary.js +90 -0
  116. package/dist/es/lib/floatingBoundary.js.map +1 -0
  117. package/dist/es/lib/focusRestore.js +56 -0
  118. package/dist/es/lib/focusRestore.js.map +1 -0
  119. package/dist/es/lib/helpers.js +0 -18
  120. package/dist/es/lib/helpers.js.map +1 -1
  121. package/dist/es/lib/inputMode.js +9 -0
  122. package/dist/es/lib/inputMode.js.map +1 -0
  123. package/dist/es/lib/menuInitialFocus.js +100 -0
  124. package/dist/es/lib/menuInitialFocus.js.map +1 -0
  125. package/dist/es/lib/menuSubmenuPlacement.js +219 -0
  126. package/dist/es/lib/menuSubmenuPlacement.js.map +1 -0
  127. package/dist/es/lib/observeTextareaWidth.js +49 -0
  128. package/dist/es/lib/observeTextareaWidth.js.map +1 -0
  129. package/dist/es/lib/selectPress.js +34 -0
  130. package/dist/es/lib/selectPress.js.map +1 -0
  131. package/dist/es/lib/sortable.js +74 -20
  132. package/dist/es/lib/sortable.js.map +1 -1
  133. package/dist/types/components/Button/Button.d.ts +6 -2
  134. package/dist/types/components/Button/ButtonLink.d.ts +6 -2
  135. package/dist/types/components/Button/NavigationButton.d.ts +27 -0
  136. package/dist/types/components/Button/NavigationGlyph.d.ts +16 -0
  137. package/dist/types/components/Button/index.d.ts +1 -0
  138. package/dist/types/components/Checkbox/Checkbox.d.ts +12 -12
  139. package/dist/types/components/DateInput/DateInput.d.ts +4 -4
  140. package/dist/types/components/DatePicker/CalendarNavigationIcon.d.ts +6 -0
  141. package/dist/types/components/DatePicker/DatePicker.d.ts +13 -13
  142. package/dist/types/components/DatePicker/context.d.ts +1 -0
  143. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +2 -0
  144. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +13 -13
  145. package/dist/types/components/Dialog/Dialog.d.ts +46 -11
  146. package/dist/types/components/Dialog/index.d.ts +1 -1
  147. package/dist/types/components/Field/Field.d.ts +2 -2
  148. package/dist/types/components/FileUpload/FileUpload.d.ts +6 -6
  149. package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +4 -4
  150. package/dist/types/components/Icon/index.d.ts +1 -0
  151. package/dist/types/components/Icon/svg/Disclosure.d.ts +3 -0
  152. package/dist/types/components/Indicator/LoadingIndicator.d.ts +2 -2
  153. package/dist/types/components/Input/Input.d.ts +2 -2
  154. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +8 -8
  155. package/dist/types/components/Menu/Menu.d.ts +18 -25
  156. package/dist/types/components/OTPInput/OTPInput.d.ts +6 -6
  157. package/dist/types/components/Page/Page.d.ts +48 -7
  158. package/dist/types/components/Page/index.d.ts +1 -1
  159. package/dist/types/components/Popover/Popover.d.ts +17 -6
  160. package/dist/types/components/RadioGroup/RadioGroup.d.ts +10 -10
  161. package/dist/types/components/SelectControl/index.d.ts +1 -1
  162. package/dist/types/components/Sortable/Sortable.d.ts +8 -8
  163. package/dist/types/components/Switch/Switch.d.ts +34 -12
  164. package/dist/types/components/Tabs/Tabs.d.ts +6 -6
  165. package/dist/types/components/TagInput/TagInput.d.ts +4 -4
  166. package/dist/types/components/Textarea/Textarea.d.ts +2 -2
  167. package/dist/types/components/Toast/ToastRenderer.d.ts +79 -0
  168. package/dist/types/components/Toast/Toaster.d.ts +6 -2
  169. package/dist/types/components/Toast/toastLifecycle.d.ts +90 -0
  170. package/dist/types/components/Toolbar/Toolbar.d.ts +149 -0
  171. package/dist/types/components/Toolbar/index.d.ts +1 -0
  172. package/dist/types/components/Tooltip/CopyTooltip.d.ts +2 -2
  173. package/dist/types/components/Tooltip/Tooltip.d.ts +6 -6
  174. package/dist/types/composables/useFloatingBoundary.d.ts +24 -0
  175. package/dist/types/composables/usePhoneSubmenu.d.ts +3 -0
  176. package/dist/types/lib/floatingBoundary.d.ts +9 -0
  177. package/dist/types/lib/focusRestore.d.ts +5 -0
  178. package/dist/types/lib/helpers.d.ts +0 -4
  179. package/dist/types/lib/inputMode.d.ts +7 -0
  180. package/dist/types/lib/menuInitialFocus.d.ts +9 -0
  181. package/dist/types/lib/menuSubmenuPlacement.d.ts +44 -0
  182. package/dist/types/lib/observeTextareaWidth.d.ts +2 -0
  183. package/dist/types/lib/selectPress.d.ts +23 -0
  184. package/dist/types/lib/sortable.d.ts +1 -1
  185. package/package.json +2 -2
@@ -60,7 +60,7 @@ const InputComponent = defineComponent({
60
60
  autoComplete: String,
61
61
  },
62
62
  emits: {
63
- "update:value": (_value) => true,
63
+ "update:value": (value) => typeof value === "string",
64
64
  "autofill": () => true,
65
65
  },
66
66
  setup(props, { attrs, slots, emit, expose }) {
@@ -130,7 +130,15 @@ const InputComponent = defineComponent({
130
130
  inputRef.value?.select();
131
131
  }
132
132
  };
133
- onMounted(selectIfAuto);
133
+ onMounted(() => {
134
+ selectIfAuto();
135
+ // An enclosing focus scope may focus the input during the same mount.
136
+ // Reconcile after the mount finishes without focusing it a second time.
137
+ void nextTick(() => {
138
+ const input = inputRef.value;
139
+ focused.value = !!input && input.ownerDocument.activeElement === input;
140
+ });
141
+ });
134
142
  watch(() => props.autoSelect, selectIfAuto, { flush: "post" });
135
143
  // The clear button unmounts once the value is gone, so keep focus in the input
136
144
  const handleClear = (evt) => {
@@ -167,7 +175,7 @@ const InputComponent = defineComponent({
167
175
  const hasStartAdornment = hasContent(startAdornment);
168
176
  const hasEndAdornment = hasContent(endAdornment);
169
177
  // Determine if clear button should be shown
170
- const hasValue = value !== undefined ? !!value : !!defaultValue;
178
+ const hasValue = String((value !== undefined ? value : defaultValue) ?? "") !== "";
171
179
  const showClearButton = !!props.onClear && hasValue && !disabled && !readOnly;
172
180
  return h("div", {
173
181
  "class": clsx(s.Container, className),
@@ -202,10 +210,12 @@ const InputComponent = defineComponent({
202
210
  "readonly": readOnly,
203
211
  "disabled": disabled,
204
212
  "onInput": handleInput,
205
- "onFocus": () => {
213
+ // Use bubbling focus events for state, independently of a layer
214
+ // capture listener. Caller @focus/@blur still receive their native events.
215
+ "onFocusin": () => {
206
216
  focused.value = true;
207
217
  },
208
- "onBlur": () => {
218
+ "onFocusout": () => {
209
219
  focused.value = false;
210
220
  },
211
221
  "onAnimationstart": handleAnimationStart,
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/Input/Input.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAsE,MAAM,KAAK,CAAA;AAEhL,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,0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AC,CAAC,CAClE;gBACD,eAAe;oBACb,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,EAAE;wBACvG,CAAC,CAAC,CAAC,CAAC;qBACL,CAAC;oBACJ,CAAC,CAAC,IAAI;gBACR,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI;aACtC,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,sFAAsF;AACtF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA;AAEjG;;;;GAIG;AACH,MAAM,6BAA6B,GAAG,eAAe,CAAC;IACpD,IAAI,EAAE,sBAAsB;IAC5B,KAAK,EAAE;QACL,wBAAwB;QACxB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAiD,EAAE,OAAO,EAAE,QAAQ,EAAE;QACpF;;;WAGG;QACH,KAAK,EAAE,MAAiC;KACzC;IACD,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE;QACpB,OAAO,GAAG,EAAE,CACV,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,eAAe,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACjH,CAAC;CACF,CAAC,CAAA;AAQF,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAEnC,CAAA","sourcesContent":["import clsx, { type ClassValue } from \"clsx\"\nimport { defineComponent, h, mergeProps, nextTick, onMounted, ref, useId, watch, withDirectives, type ButtonHTMLAttributes, type InputHTMLAttributes, type PropType } from \"vue\"\nimport type { ControlSize, SemanticColor, Sizes, Variants } from \"@plexui/styles/types\"\nimport { X } from \"../Icon/index.js\"\nimport { vDefaultValue } from \"../../lib/defaultValue.js\"\nimport { useFieldRowPill } from \"../../lib/fieldRow.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Input/Input.module.css\"\n\n// Vue port of packages/ui/src/components/Input/Input.tsx.\n// - `class` goes to the container; every other attribute and native listener\n// (`@input`, `@change`, `@focus`, `style`, `placeholder`, ...) goes to the\n// <input>, as React spreads its rest props there.\n// - `value` + `update:value` support `v-model:value`; `default-value` sets the\n// initial value of an uncontrolled input through `vDefaultValue` (server\n// markup, hydration and later changes as in React), so re-renders never\n// reset what the user typed.\n// - `startAdornment` / `endAdornment` are slots. `onClear` stays a function\n// prop (`@clear` in templates) because its presence adds the clear button.\n// - `autoComplete` reaches the <input> as `autocomplete`, and `invalid` also\n// sets `aria-invalid` there unless the caller passes its own, as in React.\n\nconst InputComponent = defineComponent({\n name: \"Input\",\n inheritAttrs: false,\n props: {\n /** Visual style of the input. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\" | \"ghost\">>, default: \"outline\" },\n /** Controls the size of the input: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Controls gutter on the edges of the input, defaults to value from `size`. */\n gutterSize: String as PropType<Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">>,\n /** Disables the input visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Makes the input read-only. @default false */\n readOnly: { type: Boolean, default: false },\n /** Native spelling of `readOnly` (`<Input readonly />`). @default false */\n readonly: { type: Boolean, default: false },\n /** Mark the input as invalid. @default false */\n invalid: { type: Boolean, default: false },\n /**\n * Allow autofill extensions to appear in the input.\n * @default true when `type=\"password\"` or `name` is set, otherwise false\n */\n allowAutofillExtensions: { type: Boolean, default: undefined },\n /** Select all contents of the input when mounted, and whenever it turns true. @default false */\n autoSelect: { type: Boolean, default: undefined },\n /** Shows the clear button while the input has a value; called when it is clicked. */\n onClear: Function as PropType<(event: MouseEvent) => void>,\n /** Fully rounded pill shape. @default false, or true at the end of a `Field row` */\n pill: { type: Boolean, default: undefined },\n /** Applies a negative margin using the current gutter to optically align the input with surrounding content. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n id: String,\n name: String,\n /** @default \"text\" */\n type: { type: String, default: \"text\" },\n /** Controlled value. Bind `v-model:value` to keep it in sync. */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value when uncontrolled. */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Native `autocomplete` of the <input>. */\n autoComplete: String,\n },\n emits: {\n \"update:value\": (_value: string) => true,\n \"autofill\": () => true,\n },\n setup(props, { attrs, slots, emit, expose }) {\n const inputRef = ref<HTMLInputElement | null>(null)\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${useId()}`\n const pill = useFieldRowPill(() => props.pill)\n const focused = ref(false)\n\n // Redirect clicks on the container and adornments\n const handleMouseDown = (evt: MouseEvent) => {\n const input = inputRef.value\n // Bail out if the target is not an element or the input is not found\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n // Bail out if the target is inside the input\n if (input.contains(evt.target)) {\n return\n }\n // Bail out if the target is a button\n if (evt.target.closest(\"button, [type='button'], [role='button'], [role='menuitem']\")) {\n return\n }\n\n evt.preventDefault()\n // If the input is not focused, focus it\n if (document.activeElement !== input) {\n input.focus()\n }\n\n const { left, top } = input.getBoundingClientRect()\n const { clientX, clientY } = evt\n // \"Before\" the input: top/left\n const isBefore = clientY < top || clientX < left\n // email, number and other types without the selection API throw on setSelectionRange\n const hasSelection = input.selectionStart !== null\n\n // If this is the first click, clear the selection.\n if (evt.detail === 1) {\n if (!hasSelection) return\n if (isBefore) {\n input.setSelectionRange(0, 0)\n } else {\n const length = input.value.length\n input.setSelectionRange(length, length)\n }\n }\n // If this is the second click, select the first or last word\n else if (evt.detail === 2) {\n if (!hasSelection) return\n // Split the input value into words and non-word characters\n const words = input.value.match(/\\w+|[^\\w\\s]/g) || []\n const selectedWord = isBefore ? words.at(0) : words.at(-1)\n if (selectedWord) {\n const wordIndex = isBefore ? input.value.indexOf(selectedWord) : input.value.lastIndexOf(selectedWord)\n input.setSelectionRange(wordIndex, wordIndex + selectedWord.length)\n }\n }\n // If this is the third click or greater, select the entire input\n else {\n input.select()\n }\n }\n\n const selectIfAuto = () => {\n if (props.autoSelect) {\n inputRef.value?.select()\n }\n }\n onMounted(selectIfAuto)\n watch(() => props.autoSelect, selectIfAuto, { flush: \"post\" })\n\n // The clear button unmounts once the value is gone, so keep focus in the input\n const handleClear = (evt: MouseEvent) => {\n inputRef.value?.focus()\n props.onClear?.(evt)\n }\n\n const handleAnimationStart = (evt: AnimationEvent) => {\n if (evt.animationName === \"native-autofill-in\") {\n emit(\"autofill\")\n }\n }\n\n const handleInput = (evt: Event) => {\n const target = evt.currentTarget as HTMLInputElement\n emit(\"update:value\", target.value)\n // Like a React controlled input, a `value` the parent does not update\n // is put back (Vue only re-applies `value` when this component renders)\n void nextTick(() => {\n if (props.value === undefined) return\n const value = String(props.value)\n if (target.value !== value) target.value = value\n })\n }\n\n expose({ focus: () => inputRef.value?.focus(), input: inputRef })\n\n return () => {\n const { class: className, ...restAttrs } = attrs\n const { value, defaultValue, disabled } = props\n const readOnly = props.readOnly || props.readonly\n // Default to `true` when type=\"password\" or presence of `name`\n const allowAutofillExtensions = props.allowAutofillExtensions ?? (props.type === \"password\" || !!props.name)\n const startAdornment = slots.startAdornment?.()\n const endAdornment = slots.endAdornment?.()\n const hasStartAdornment = hasContent(startAdornment)\n const hasEndAdornment = hasContent(endAdornment)\n\n // Determine if clear button should be shown\n const hasValue = value !== undefined ? !!value : !!defaultValue\n const showClearButton = !!props.onClear && hasValue && !disabled && !readOnly\n\n return h(\n \"div\",\n {\n \"class\": clsx(s.Container, className as ClassValue),\n \"data-slot\": \"input\",\n \"data-variant\": props.variant,\n \"data-size\": props.size,\n \"data-gutter-size\": props.gutterSize,\n \"data-focused\": focused.value,\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-readonly\": readOnly ? \"\" : undefined,\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"data-pill\": pill.value ? \"\" : undefined,\n \"data-optically-align\": props.opticallyAlign,\n \"data-has-start-adornment\": hasStartAdornment ? \"\" : undefined,\n \"data-has-end-adornment\": hasEndAdornment || showClearButton ? \"\" : undefined,\n \"onMousedown\": handleMouseDown,\n },\n [\n hasStartAdornment ? startAdornment : null,\n withDirectives(\n h(\n \"input\",\n mergeProps(restAttrs, {\n \"ref\": inputRef,\n \"id\": props.id || (allowAutofillExtensions ? undefined : onePasswordPreventionId),\n \"class\": s.Input,\n \"type\": props.type,\n // Only when set, so a native `autocomplete` attribute still applies\n ...(props.autoComplete !== undefined ? { autocomplete: props.autoComplete } : {}),\n // Expose the visual invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": restAttrs[\"aria-invalid\"] ?? (props.invalid || undefined),\n \"name\": props.name,\n // Controlled: the `value` property follows the prop. Uncontrolled:\n // `vDefaultValue` below sets the initial value, as in React.\n ...(value !== undefined ? { value } : {}),\n \"readonly\": readOnly,\n \"disabled\": disabled,\n \"onInput\": handleInput,\n \"onFocus\": () => {\n focused.value = true\n },\n \"onBlur\": () => {\n focused.value = false\n },\n \"onAnimationstart\": handleAnimationStart,\n // Prevent LastPass and 1Password from appearing\n \"data-lpignore\": allowAutofillExtensions ? undefined : true,\n \"data-1p-ignore\": allowAutofillExtensions ? undefined : true,\n }),\n ),\n [[vDefaultValue, value === undefined ? defaultValue : undefined]],\n ),\n showClearButton\n ? h(\"button\", { \"type\": \"button\", \"aria-label\": \"Clear input\", \"class\": s.Clear, \"onClick\": handleClear }, [\n h(X),\n ])\n : null,\n hasEndAdornment ? endAdornment : null,\n ],\n )\n }\n },\n})\n\ntype InputOwnProps = InstanceType<typeof InputComponent>[\"$props\"]\n\n/** Input props plus the native <input> attributes that fall through to it, as in React. */\nexport type InputProps = InputOwnProps & Omit<InputHTMLAttributes, keyof InputOwnProps>\n\n/** Text input with adornment slots, a clear button and autofill-extension control. */\nexport const Input = InputComponent as typeof InputComponent & { new (): { $props: InputProps } }\n\n/**\n * Canonical inline action button for Input adornments (React\n * `Input.AdornmentButton`): mic toggle, visibility toggle, copy, ... It sizes\n * itself off the parent Input so it matches the built-in clear button.\n */\nconst InputAdornmentButtonComponent = defineComponent({\n name: \"InputAdornmentButton\",\n props: {\n /** @default \"button\" */\n type: { type: String as PropType<\"button\" | \"submit\" | \"reset\">, default: \"button\" },\n /**\n * Semantic color tint for the pressed (`aria-pressed=\"true\"`) state, the\n * same palette Button accepts. Unset keeps the neutral primary-soft tint.\n */\n color: String as PropType<SemanticColor>,\n },\n setup(props, { slots }) {\n return () =>\n h(\"button\", { \"type\": props.type, \"class\": s.AdornmentButton, \"data-color\": props.color }, slots.default?.())\n },\n})\n\ntype InputAdornmentButtonOwnProps = InstanceType<typeof InputAdornmentButtonComponent>[\"$props\"]\n\n/** AdornmentButton props plus the native <button> attributes that fall through to it. */\nexport type InputAdornmentButtonProps = InputAdornmentButtonOwnProps &\n Omit<ButtonHTMLAttributes, keyof InputAdornmentButtonOwnProps>\n\nexport const InputAdornmentButton = InputAdornmentButtonComponent as typeof InputAdornmentButtonComponent & {\n new (): { $props: InputAdornmentButtonProps }\n}\n"]}
1
+ {"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../../src/components/Input/Input.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAsE,MAAM,KAAK,CAAA;AAEhL,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,aAA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,CACV,CAAC,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,eAAe,EAAE,YAAY,EAAE,KAAK,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACjH,CAAC;CACF,CAAC,CAAA;AAQF,MAAM,CAAC,MAAM,oBAAoB,GAAG,6BAEnC,CAAA","sourcesContent":["import clsx, { type ClassValue } from \"clsx\"\nimport { defineComponent, h, mergeProps, nextTick, onMounted, ref, useId, watch, withDirectives, type ButtonHTMLAttributes, type InputHTMLAttributes, type PropType } from \"vue\"\nimport type { ControlSize, SemanticColor, Sizes, Variants } from \"@plexui/styles/types\"\nimport { X } from \"../Icon/index.js\"\nimport { vDefaultValue } from \"../../lib/defaultValue.js\"\nimport { useFieldRowPill } from \"../../lib/fieldRow.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Input/Input.module.css\"\n\n// Vue port of packages/ui/src/components/Input/Input.tsx.\n// - `class` goes to the container; every other attribute and native listener\n// (`@input`, `@change`, `@focus`, `style`, `placeholder`, ...) goes to the\n// <input>, as React spreads its rest props there.\n// - `value` + `update:value` support `v-model:value`; `default-value` sets the\n// initial value of an uncontrolled input through `vDefaultValue` (server\n// markup, hydration and later changes as in React), so re-renders never\n// reset what the user typed.\n// - `startAdornment` / `endAdornment` are slots. `onClear` stays a function\n// prop (`@clear` in templates) because its presence adds the clear button.\n// - `autoComplete` reaches the <input> as `autocomplete`, and `invalid` also\n// sets `aria-invalid` there unless the caller passes its own, as in React.\n\nconst InputComponent = defineComponent({\n name: \"Input\",\n inheritAttrs: false,\n props: {\n /** Visual style of the input. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\" | \"ghost\">>, default: \"outline\" },\n /** Controls the size of the input: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Controls gutter on the edges of the input, defaults to value from `size`. */\n gutterSize: String as PropType<Sizes<\"2xs\" | \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\">>,\n /** Disables the input visually and from interactions. @default false */\n disabled: { type: Boolean, default: false },\n /** Makes the input read-only. @default false */\n readOnly: { type: Boolean, default: false },\n /** Native spelling of `readOnly` (`<Input readonly />`). @default false */\n readonly: { type: Boolean, default: false },\n /** Mark the input as invalid. @default false */\n invalid: { type: Boolean, default: false },\n /**\n * Allow autofill extensions to appear in the input.\n * @default true when `type=\"password\"` or `name` is set, otherwise false\n */\n allowAutofillExtensions: { type: Boolean, default: undefined },\n /** Select all contents of the input when mounted, and whenever it turns true. @default false */\n autoSelect: { type: Boolean, default: undefined },\n /** Shows the clear button while the input has a value; called when it is clicked. */\n onClear: Function as PropType<(event: MouseEvent) => void>,\n /** Fully rounded pill shape. @default false, or true at the end of a `Field row` */\n pill: { type: Boolean, default: undefined },\n /** Applies a negative margin using the current gutter to optically align the input with surrounding content. */\n opticallyAlign: String as PropType<\"start\" | \"end\">,\n id: String,\n name: String,\n /** @default \"text\" */\n type: { type: String, default: \"text\" },\n /** Controlled value. Bind `v-model:value` to keep it in sync. */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value when uncontrolled. */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Native `autocomplete` of the <input>. */\n autoComplete: String,\n },\n emits: {\n \"update:value\": (value: string) => typeof value === \"string\",\n \"autofill\": () => true,\n },\n setup(props, { attrs, slots, emit, expose }) {\n const inputRef = ref<HTMLInputElement | null>(null)\n // Prevent 1Password from appearing: 1Password won't display if it thinks this field is for searching\n // Allow user to override this for connecting to labels.\n const onePasswordPreventionId = `search-ui-input-${useId()}`\n const pill = useFieldRowPill(() => props.pill)\n const focused = ref(false)\n\n // Redirect clicks on the container and adornments\n const handleMouseDown = (evt: MouseEvent) => {\n const input = inputRef.value\n // Bail out if the target is not an element or the input is not found\n if (!evt.target || !(evt.target instanceof Element) || !input) {\n return\n }\n // Bail out if the target is inside the input\n if (input.contains(evt.target)) {\n return\n }\n // Bail out if the target is a button\n if (evt.target.closest(\"button, [type='button'], [role='button'], [role='menuitem']\")) {\n return\n }\n\n evt.preventDefault()\n // If the input is not focused, focus it\n if (document.activeElement !== input) {\n input.focus()\n }\n\n const { left, top } = input.getBoundingClientRect()\n const { clientX, clientY } = evt\n // \"Before\" the input: top/left\n const isBefore = clientY < top || clientX < left\n // email, number and other types without the selection API throw on setSelectionRange\n const hasSelection = input.selectionStart !== null\n\n // If this is the first click, clear the selection.\n if (evt.detail === 1) {\n if (!hasSelection) return\n if (isBefore) {\n input.setSelectionRange(0, 0)\n } else {\n const length = input.value.length\n input.setSelectionRange(length, length)\n }\n }\n // If this is the second click, select the first or last word\n else if (evt.detail === 2) {\n if (!hasSelection) return\n // Split the input value into words and non-word characters\n const words = input.value.match(/\\w+|[^\\w\\s]/g) || []\n const selectedWord = isBefore ? words.at(0) : words.at(-1)\n if (selectedWord) {\n const wordIndex = isBefore ? input.value.indexOf(selectedWord) : input.value.lastIndexOf(selectedWord)\n input.setSelectionRange(wordIndex, wordIndex + selectedWord.length)\n }\n }\n // If this is the third click or greater, select the entire input\n else {\n input.select()\n }\n }\n\n const selectIfAuto = () => {\n if (props.autoSelect) {\n inputRef.value?.select()\n }\n }\n onMounted(() => {\n selectIfAuto()\n // An enclosing focus scope may focus the input during the same mount.\n // Reconcile after the mount finishes without focusing it a second time.\n void nextTick(() => {\n const input = inputRef.value\n focused.value = !!input && input.ownerDocument.activeElement === input\n })\n })\n watch(() => props.autoSelect, selectIfAuto, { flush: \"post\" })\n\n // The clear button unmounts once the value is gone, so keep focus in the input\n const handleClear = (evt: MouseEvent) => {\n inputRef.value?.focus()\n props.onClear?.(evt)\n }\n\n const handleAnimationStart = (evt: AnimationEvent) => {\n if (evt.animationName === \"native-autofill-in\") {\n emit(\"autofill\")\n }\n }\n\n const handleInput = (evt: Event) => {\n const target = evt.currentTarget as HTMLInputElement\n emit(\"update:value\", target.value)\n // Like a React controlled input, a `value` the parent does not update\n // is put back (Vue only re-applies `value` when this component renders)\n void nextTick(() => {\n if (props.value === undefined) return\n const value = String(props.value)\n if (target.value !== value) target.value = value\n })\n }\n\n expose({ focus: () => inputRef.value?.focus(), input: inputRef })\n\n return () => {\n const { class: className, ...restAttrs } = attrs\n const { value, defaultValue, disabled } = props\n const readOnly = props.readOnly || props.readonly\n // Default to `true` when type=\"password\" or presence of `name`\n const allowAutofillExtensions = props.allowAutofillExtensions ?? (props.type === \"password\" || !!props.name)\n const startAdornment = slots.startAdornment?.()\n const endAdornment = slots.endAdornment?.()\n const hasStartAdornment = hasContent(startAdornment)\n const hasEndAdornment = hasContent(endAdornment)\n\n // Determine if clear button should be shown\n const hasValue = String((value !== undefined ? value : defaultValue) ?? \"\") !== \"\"\n const showClearButton = !!props.onClear && hasValue && !disabled && !readOnly\n\n return h(\n \"div\",\n {\n \"class\": clsx(s.Container, className as ClassValue),\n \"data-slot\": \"input\",\n \"data-variant\": props.variant,\n \"data-size\": props.size,\n \"data-gutter-size\": props.gutterSize,\n \"data-focused\": focused.value,\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-readonly\": readOnly ? \"\" : undefined,\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"data-pill\": pill.value ? \"\" : undefined,\n \"data-optically-align\": props.opticallyAlign,\n \"data-has-start-adornment\": hasStartAdornment ? \"\" : undefined,\n \"data-has-end-adornment\": hasEndAdornment || showClearButton ? \"\" : undefined,\n \"onMousedown\": handleMouseDown,\n },\n [\n hasStartAdornment ? startAdornment : null,\n withDirectives(\n h(\n \"input\",\n mergeProps(restAttrs, {\n \"ref\": inputRef,\n \"id\": props.id || (allowAutofillExtensions ? undefined : onePasswordPreventionId),\n \"class\": s.Input,\n \"type\": props.type,\n // Only when set, so a native `autocomplete` attribute still applies\n ...(props.autoComplete !== undefined ? { autocomplete: props.autoComplete } : {}),\n // Expose the visual invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": restAttrs[\"aria-invalid\"] ?? (props.invalid || undefined),\n \"name\": props.name,\n // Controlled: the `value` property follows the prop. Uncontrolled:\n // `vDefaultValue` below sets the initial value, as in React.\n ...(value !== undefined ? { value } : {}),\n \"readonly\": readOnly,\n \"disabled\": disabled,\n \"onInput\": handleInput,\n // Use bubbling focus events for state, independently of a layer\n // capture listener. Caller @focus/@blur still receive their native events.\n \"onFocusin\": () => {\n focused.value = true\n },\n \"onFocusout\": () => {\n focused.value = false\n },\n \"onAnimationstart\": handleAnimationStart,\n // Prevent LastPass and 1Password from appearing\n \"data-lpignore\": allowAutofillExtensions ? undefined : true,\n \"data-1p-ignore\": allowAutofillExtensions ? undefined : true,\n }),\n ),\n [[vDefaultValue, value === undefined ? defaultValue : undefined]],\n ),\n showClearButton\n ? h(\"button\", { \"type\": \"button\", \"aria-label\": \"Clear input\", \"class\": s.Clear, \"onClick\": handleClear }, [\n h(X),\n ])\n : null,\n hasEndAdornment ? endAdornment : null,\n ],\n )\n }\n },\n})\n\ntype InputOwnProps = InstanceType<typeof InputComponent>[\"$props\"]\n\n/** Input props plus the native <input> attributes that fall through to it, as in React. */\nexport type InputProps = InputOwnProps & Omit<InputHTMLAttributes, keyof InputOwnProps>\n\n/** Text input with adornment slots, a clear button and autofill-extension control. */\nexport const Input = InputComponent as typeof InputComponent & { new (): { $props: InputProps } }\n\n/**\n * Canonical inline action button for Input adornments (React\n * `Input.AdornmentButton`): mic toggle, visibility toggle, copy, ... It sizes\n * itself off the parent Input so it matches the built-in clear button.\n */\nconst InputAdornmentButtonComponent = defineComponent({\n name: \"InputAdornmentButton\",\n props: {\n /** @default \"button\" */\n type: { type: String as PropType<\"button\" | \"submit\" | \"reset\">, default: \"button\" },\n /**\n * Semantic color tint for the pressed (`aria-pressed=\"true\"`) state, the\n * same palette Button accepts. Unset keeps the neutral primary-soft tint.\n */\n color: String as PropType<SemanticColor>,\n },\n setup(props, { slots }) {\n return () =>\n h(\"button\", { \"type\": props.type, \"class\": s.AdornmentButton, \"data-color\": props.color }, slots.default?.())\n },\n})\n\ntype InputAdornmentButtonOwnProps = InstanceType<typeof InputAdornmentButtonComponent>[\"$props\"]\n\n/** AdornmentButton props plus the native <button> attributes that fall through to it. */\nexport type InputAdornmentButtonProps = InputAdornmentButtonOwnProps &\n Omit<ButtonHTMLAttributes, keyof InputAdornmentButtonOwnProps>\n\nexport const InputAdornmentButton = InputAdornmentButtonComponent as typeof InputAdornmentButtonComponent & {\n new (): { $props: InputAdornmentButtonProps }\n}\n"]}
@@ -60,7 +60,9 @@ const InputGroupComponent = defineComponent({
60
60
  callListeners(attrs.onMousedown, evt);
61
61
  const control = evt.currentTarget.querySelector(CONTROL_SELECTOR);
62
62
  const { target } = evt;
63
- if (evt.defaultPrevented || !control || !(target instanceof Element) || control.contains(target)) {
63
+ // Only the physical input frame redirects a press to its control.
64
+ if (evt.defaultPrevented || !control || !(target instanceof Element) ||
65
+ !(evt.currentTarget instanceof HTMLElement) || !evt.currentTarget.contains(target) || control.contains(target)) {
64
66
  return;
65
67
  }
66
68
  // Buttons, links, menus and other controls in the addons take their own clicks
@@ -1 +1 @@
1
- {"version":3,"file":"InputGroup.js","sourceRoot":"","sources":["../../../../src/components/InputGroup/InputGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,EACL,cAAc,GAMf,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAsC,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,CAAC,MAAM,4DAA4D,CAAA;AAmB1E,MAAM,aAAa,GAAoC,MAAM,CAAC,YAAY,CAAC,CAAA;AAE3E,MAAM,gBAAgB,GAAG,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AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAE/B,CAAA;AAED,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QACrB,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACjG,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n inject,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n withDirectives,\n type HTMLAttributes,\n type InjectionKey,\n type InputHTMLAttributes,\n type PropType,\n type TextareaHTMLAttributes,\n} from \"vue\"\nimport type { ControlSize, Variants } from \"@plexui/styles/types\"\nimport { Button, type ButtonColor, type ButtonProps } from \"../Button/index.js\"\nimport { vDefaultValue, vServerText } from \"../../lib/defaultValue.js\"\nimport { useFieldRowPill } from \"../../lib/fieldRow.js\"\nimport s from \"@plexui/styles/components/InputGroup/InputGroup.module.css\"\n\n// Vue port of packages/ui/src/components/InputGroup/InputGroup.tsx.\n// Exports are flat (`InputGroupInput` for `InputGroup.Input`, ...). The group\n// provides its size, pill, disabled and invalid state to the parts, as the\n// React context does. React spreads the remaining props after its own\n// attributes, so caller attributes win; Vue's attribute fallthrough merges\n// them the same way. `InputGroupInput` / `InputGroupTextarea` take\n// `v-model:value` and `default-value` like Input and Textarea (the textarea's\n// text content follows the value and its value is set imperatively, as in\n// Textarea).\n\ntype InputGroupContext = {\n readonly size: ControlSize\n readonly pill: boolean\n readonly disabled: boolean\n readonly invalid: boolean\n}\n\nconst InputGroupKey: InjectionKey<InputGroupContext> = Symbol(\"InputGroup\")\n\nconst CONTROL_SELECTOR = \"[data-slot='input-group-control']\"\n\n// A fallthrough listener is a function or, when merged, an array of them\nconst callListeners = (listener: unknown, evt: Event) => {\n for (const fn of Array.isArray(listener) ? listener : [listener]) {\n if (typeof fn === \"function\") fn(evt)\n }\n}\n\n/** Button size for each group size: the closest Button that fits inside the control */\nconst BUTTON_SIZE: Record<ControlSize, ControlSize> = {\n \"3xs\": \"3xs\",\n \"2xs\": \"3xs\",\n \"xs\": \"3xs\",\n \"sm\": \"3xs\",\n \"md\": \"2xs\",\n \"lg\": \"sm\",\n \"xl\": \"md\",\n \"2xl\": \"lg\",\n \"3xl\": \"xl\",\n}\n\nconst InputGroupComponent = defineComponent({\n name: \"InputGroup\",\n inheritAttrs: false,\n props: {\n /** Visual style of the group. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\">>, default: \"outline\" },\n /** Controls the size of the group, on the same scale as Input: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Fully rounded group, with pill buttons inside. @default false, or true at the end of a `Field row` */\n pill: { type: Boolean, default: undefined },\n /** Disables the control and the buttons inside the group. @default false */\n disabled: { type: Boolean, default: false },\n /** Mark the group as invalid. @default false */\n invalid: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const pill = useFieldRowPill(() => props.pill)\n\n provide(InputGroupKey, {\n get size() {\n return props.size\n },\n get pill() {\n return pill.value\n },\n get disabled() {\n return props.disabled\n },\n get invalid() {\n return props.invalid\n },\n })\n\n // Clicks on the frame, icons and text focus the control, as in Input\n const handleMouseDown = (evt: MouseEvent) => {\n callListeners(attrs.onMousedown, evt)\n const control = (evt.currentTarget as HTMLElement).querySelector<HTMLElement>(CONTROL_SELECTOR)\n const { target } = evt\n if (evt.defaultPrevented || !control || !(target instanceof Element) || control.contains(target)) {\n return\n }\n // Buttons, links, menus and other controls in the addons take their own clicks\n if (target.closest(\"button, a, input, textarea, select, [role='button'], [role='menuitem']\")) {\n return\n }\n evt.preventDefault()\n control.focus()\n }\n\n return () => {\n const { class: className, onMousedown: _onMousedown, ...restAttrs } = attrs\n return h(\n \"div\",\n {\n \"data-slot\": \"input-group\",\n \"data-variant\": props.variant,\n \"data-size\": props.size,\n \"data-pill\": pill.value ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"class\": [s.InputGroup, className],\n \"onMousedown\": handleMouseDown,\n ...restAttrs,\n },\n slots.default?.(),\n )\n }\n },\n})\n\ntype InputGroupOwnProps = InstanceType<typeof InputGroupComponent>[\"$props\"]\n\n/** InputGroup props plus the native <div> attributes that fall through to it, as in React. */\nexport type InputGroupProps = InputGroupOwnProps & Omit<HTMLAttributes, keyof InputGroupOwnProps>\n\n/** An input or textarea with icons, text, buttons and menus attached inside one frame. */\nexport const InputGroup = InputGroupComponent as typeof InputGroupComponent & {\n new (): { $props: InputGroupProps }\n}\n\n// `value` / `default-value` / `update:value` for the native control, as in Input\nconst controlProps = {\n /** Controlled value; use with `v-model:value` */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value of an uncontrolled control */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Disables the control; defaults to the group's `disabled` */\n disabled: { type: Boolean, default: undefined },\n}\n\nconst useControl = (props: { value?: string | number }, emit: (event: \"update:value\", value: string) => void) => {\n const group = inject(InputGroupKey, null)\n const handleInput = (evt: Event) => {\n const target = evt.currentTarget as HTMLInputElement | HTMLTextAreaElement\n emit(\"update:value\", target.value)\n // Like a React controlled input, a `value` the parent does not update is put back\n void nextTick(() => {\n if (props.value === undefined) return\n const value = String(props.value)\n if (target.value !== value) target.value = value\n })\n }\n return { group, handleInput }\n}\n\nconst InputGroupInputComponent = defineComponent({\n name: \"InputGroupInput\",\n props: {\n ...controlProps,\n /** @default \"text\" */\n type: { type: String, default: \"text\" },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const { group, handleInput } = useControl(props, emit)\n return () =>\n withDirectives(\n h(\"input\", {\n \"type\": props.type,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n // Expose the group's invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": group?.invalid || undefined,\n ...(props.value !== undefined ? { value: props.value } : {}),\n \"onInput\": handleInput,\n }),\n [[vDefaultValue, props.value === undefined ? props.defaultValue : undefined]],\n )\n },\n})\n\ntype InputGroupInputOwnProps = InstanceType<typeof InputGroupInputComponent>[\"$props\"]\n\n/** InputGroupInput props plus the native <input> attributes that fall through to it. */\nexport type InputGroupInputProps = InputGroupInputOwnProps &\n Omit<InputHTMLAttributes, keyof InputGroupInputOwnProps | \"size\">\n\n/** The native <input> of the group, without its own frame (React `InputGroup.Input`). */\nexport const InputGroupInput = InputGroupInputComponent as typeof InputGroupInputComponent & {\n new (): { $props: InputGroupInputProps }\n}\n\nconst InputGroupTextareaComponent = defineComponent({\n name: \"InputGroupTextarea\",\n props: {\n ...controlProps,\n /** @default 3 */\n rows: { type: [Number, String] as PropType<number | string>, default: 3 },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const group = inject(InputGroupKey, null)\n const textareaRef = ref<HTMLTextAreaElement | null>(null)\n\n // Set imperatively, like React DOM: a `value` prop would make Vue mirror\n // it into a `value` attribute, which React never renders\n const syncValue = () => {\n const textarea = textareaRef.value\n if (!textarea || props.value === undefined) return\n const value = String(props.value)\n if (textarea.value !== value) textarea.value = value\n }\n onMounted(() => {\n // React's initTextarea: the initial text becomes the (dirty) value\n const textarea = textareaRef.value\n const initialValue = textarea?.textContent ?? \"\"\n if (textarea && initialValue !== \"\") textarea.value = initialValue\n })\n watch(() => props.value, syncValue, { flush: \"post\" })\n\n const handleInput = (evt: Event) => {\n emit(\"update:value\", (evt.currentTarget as HTMLTextAreaElement).value)\n // A controlled value the parent did not update wins over the typed text\n void nextTick(syncValue)\n }\n\n return () => {\n // React keeps the textarea's text content in sync with the controlled\n // value, else with `defaultValue`\n const textContent = String(props.value ?? props.defaultValue ?? \"\")\n return withDirectives(\n h(\"textarea\", {\n \"ref\": textareaRef,\n \"rows\": props.rows,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n \"aria-invalid\": group?.invalid || undefined,\n textContent,\n \"onInput\": handleInput,\n }),\n [[vServerText, textContent]],\n )\n }\n },\n})\n\ntype InputGroupTextareaOwnProps = InstanceType<typeof InputGroupTextareaComponent>[\"$props\"]\n\n/** InputGroupTextarea props plus the native <textarea> attributes that fall through to it. */\nexport type InputGroupTextareaProps = InputGroupTextareaOwnProps &\n Omit<TextareaHTMLAttributes, keyof InputGroupTextareaOwnProps>\n\n/** The native <textarea> of the group (React `InputGroup.Textarea`). */\nexport const InputGroupTextarea = InputGroupTextareaComponent as typeof InputGroupTextareaComponent & {\n new (): { $props: InputGroupTextareaProps }\n}\n\nexport type InputGroupAddonAlign = \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\"\n\n/** Icons, text and buttons beside, above or below the control (React `InputGroup.Addon`). */\nexport const InputGroupAddon = defineComponent({\n name: \"InputGroupAddon\",\n props: {\n /**\n * Where the addon sits: before or after the control on its line, or as a\n * row above or below it.\n * @default \"inline-start\"\n */\n align: { type: String as PropType<InputGroupAddonAlign>, default: \"inline-start\" },\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n { \"data-slot\": \"input-group-addon\", \"data-align\": props.align, \"class\": s.Addon },\n slots.default?.(),\n )\n },\n})\n\nexport type InputGroupAddonProps = InstanceType<typeof InputGroupAddon>[\"$props\"] &\n Omit<HTMLAttributes, keyof InstanceType<typeof InputGroupAddon>[\"$props\"]>\n\nconst InputGroupButtonComponent = defineComponent({\n name: \"InputGroupButton\",\n props: {\n /** Color for the button. @default \"secondary\" */\n color: { type: String as PropType<ButtonColor>, default: \"secondary\" },\n /** Style variant. @default \"ghost\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\" | \"ghost\">>, default: \"ghost\" },\n pill: { type: Boolean, default: undefined },\n disabled: { type: Boolean, default: undefined },\n },\n setup(props, { slots }) {\n const group = inject(InputGroupKey, null)\n return () =>\n h(\n Button,\n {\n color: props.color,\n variant: props.variant,\n size: BUTTON_SIZE[group?.size ?? \"md\"],\n pill: props.pill ?? group?.pill,\n disabled: props.disabled ?? group?.disabled,\n class: s.Button,\n },\n slots,\n )\n },\n})\n\ntype InputGroupButtonOwnProps = InstanceType<typeof InputGroupButtonComponent>[\"$props\"]\n\n/** InputGroupButton props plus the Button props (except `size`) that fall through to it, as in React. */\nexport type InputGroupButtonProps = InputGroupButtonOwnProps &\n Omit<ButtonProps, keyof InputGroupButtonOwnProps | \"size\">\n\n/**\n * A ghost `Button` sized from the group (React `InputGroup.Button`). Takes the\n * Button props except `size`; `pill` and `disabled` default to the group's.\n */\nexport const InputGroupButton = InputGroupButtonComponent as typeof InputGroupButtonComponent & {\n new (): { $props: InputGroupButtonProps }\n}\n\n/** Text and icons inside an addon: prefixes, units, counters (React `InputGroup.Text`). */\nexport const InputGroupText = defineComponent({\n name: \"InputGroupText\",\n setup(_props, { slots }) {\n return () => h(\"span\", { \"data-slot\": \"input-group-text\", \"class\": s.Text }, slots.default?.())\n },\n})\n\nexport type InputGroupTextProps = HTMLAttributes\n"]}
1
+ {"version":3,"file":"InputGroup.js","sourceRoot":"","sources":["../../../../src/components/InputGroup/InputGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,CAAC,EACD,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,EACH,KAAK,EACL,cAAc,GAMf,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAsC,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,CAAC,MAAM,4DAA4D,C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,EAAE,KAAK,CAAC,IAAI,IAAI,KAAK,EAAE,IAAI;YAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,EAAE,QAAQ;YAC3C,KAAK,EAAE,CAAC,CAAC,MAAM;SAChB,EACD,KAAK,CACN,CAAA;IACL,CAAC;CACF,CAAC,CAAA;AAQF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAE/B,CAAA;AAED,2FAA2F;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,gBAAgB;IACtB,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE;QACrB,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;IACjG,CAAC;CACF,CAAC,CAAA","sourcesContent":["import {\n defineComponent,\n h,\n inject,\n nextTick,\n onMounted,\n provide,\n ref,\n watch,\n withDirectives,\n type HTMLAttributes,\n type InjectionKey,\n type InputHTMLAttributes,\n type PropType,\n type TextareaHTMLAttributes,\n} from \"vue\"\nimport type { ControlSize, Variants } from \"@plexui/styles/types\"\nimport { Button, type ButtonColor, type ButtonProps } from \"../Button/index.js\"\nimport { vDefaultValue, vServerText } from \"../../lib/defaultValue.js\"\nimport { useFieldRowPill } from \"../../lib/fieldRow.js\"\nimport s from \"@plexui/styles/components/InputGroup/InputGroup.module.css\"\n\n// Vue port of packages/ui/src/components/InputGroup/InputGroup.tsx.\n// Exports are flat (`InputGroupInput` for `InputGroup.Input`, ...). The group\n// provides its size, pill, disabled and invalid state to the parts, as the\n// React context does. React spreads the remaining props after its own\n// attributes, so caller attributes win; Vue's attribute fallthrough merges\n// them the same way. `InputGroupInput` / `InputGroupTextarea` take\n// `v-model:value` and `default-value` like Input and Textarea (the textarea's\n// text content follows the value and its value is set imperatively, as in\n// Textarea).\n\ntype InputGroupContext = {\n readonly size: ControlSize\n readonly pill: boolean\n readonly disabled: boolean\n readonly invalid: boolean\n}\n\nconst InputGroupKey: InjectionKey<InputGroupContext> = Symbol(\"InputGroup\")\n\nconst CONTROL_SELECTOR = \"[data-slot='input-group-control']\"\n\n// A fallthrough listener is a function or, when merged, an array of them\nconst callListeners = (listener: unknown, evt: Event) => {\n for (const fn of Array.isArray(listener) ? listener : [listener]) {\n if (typeof fn === \"function\") fn(evt)\n }\n}\n\n/** Button size for each group size: the closest Button that fits inside the control */\nconst BUTTON_SIZE: Record<ControlSize, ControlSize> = {\n \"3xs\": \"3xs\",\n \"2xs\": \"3xs\",\n \"xs\": \"3xs\",\n \"sm\": \"3xs\",\n \"md\": \"2xs\",\n \"lg\": \"sm\",\n \"xl\": \"md\",\n \"2xl\": \"lg\",\n \"3xl\": \"xl\",\n}\n\nconst InputGroupComponent = defineComponent({\n name: \"InputGroup\",\n inheritAttrs: false,\n props: {\n /** Visual style of the group. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"outline\" | \"soft\">>, default: \"outline\" },\n /** Controls the size of the group, on the same scale as Input: `3xs` 22px up to `3xl` 48px. @default \"md\" */\n size: { type: String as PropType<ControlSize>, default: \"md\" },\n /** Fully rounded group, with pill buttons inside. @default false, or true at the end of a `Field row` */\n pill: { type: Boolean, default: undefined },\n /** Disables the control and the buttons inside the group. @default false */\n disabled: { type: Boolean, default: false },\n /** Mark the group as invalid. @default false */\n invalid: { type: Boolean, default: false },\n },\n setup(props, { attrs, slots }) {\n const pill = useFieldRowPill(() => props.pill)\n\n provide(InputGroupKey, {\n get size() {\n return props.size\n },\n get pill() {\n return pill.value\n },\n get disabled() {\n return props.disabled\n },\n get invalid() {\n return props.invalid\n },\n })\n\n // Clicks on the frame, icons and text focus the control, as in Input\n const handleMouseDown = (evt: MouseEvent) => {\n callListeners(attrs.onMousedown, evt)\n const control = (evt.currentTarget as HTMLElement).querySelector<HTMLElement>(CONTROL_SELECTOR)\n const { target } = evt\n // Only the physical input frame redirects a press to its control.\n if (evt.defaultPrevented || !control || !(target instanceof Element) ||\n !(evt.currentTarget instanceof HTMLElement) || !evt.currentTarget.contains(target) || control.contains(target)) {\n return\n }\n // Buttons, links, menus and other controls in the addons take their own clicks\n if (target.closest(\"button, a, input, textarea, select, [role='button'], [role='menuitem']\")) {\n return\n }\n evt.preventDefault()\n control.focus()\n }\n\n return () => {\n const { class: className, onMousedown: _onMousedown, ...restAttrs } = attrs\n return h(\n \"div\",\n {\n \"data-slot\": \"input-group\",\n \"data-variant\": props.variant,\n \"data-size\": props.size,\n \"data-pill\": pill.value ? \"\" : undefined,\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-invalid\": props.invalid ? \"\" : undefined,\n \"class\": [s.InputGroup, className],\n \"onMousedown\": handleMouseDown,\n ...restAttrs,\n },\n slots.default?.(),\n )\n }\n },\n})\n\ntype InputGroupOwnProps = InstanceType<typeof InputGroupComponent>[\"$props\"]\n\n/** InputGroup props plus the native <div> attributes that fall through to it, as in React. */\nexport type InputGroupProps = InputGroupOwnProps & Omit<HTMLAttributes, keyof InputGroupOwnProps>\n\n/** An input or textarea with icons, text, buttons and menus attached inside one frame. */\nexport const InputGroup = InputGroupComponent as typeof InputGroupComponent & {\n new (): { $props: InputGroupProps }\n}\n\n// `value` / `default-value` / `update:value` for the native control, as in Input\nconst controlProps = {\n /** Controlled value; use with `v-model:value` */\n value: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Initial value of an uncontrolled control */\n defaultValue: { type: [String, Number] as PropType<string | number>, default: undefined },\n /** Disables the control; defaults to the group's `disabled` */\n disabled: { type: Boolean, default: undefined },\n}\n\nconst useControl = (props: { value?: string | number }, emit: (event: \"update:value\", value: string) => void) => {\n const group = inject(InputGroupKey, null)\n const handleInput = (evt: Event) => {\n const target = evt.currentTarget as HTMLInputElement | HTMLTextAreaElement\n emit(\"update:value\", target.value)\n // Like a React controlled input, a `value` the parent does not update is put back\n void nextTick(() => {\n if (props.value === undefined) return\n const value = String(props.value)\n if (target.value !== value) target.value = value\n })\n }\n return { group, handleInput }\n}\n\nconst InputGroupInputComponent = defineComponent({\n name: \"InputGroupInput\",\n props: {\n ...controlProps,\n /** @default \"text\" */\n type: { type: String, default: \"text\" },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const { group, handleInput } = useControl(props, emit)\n return () =>\n withDirectives(\n h(\"input\", {\n \"type\": props.type,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n // Expose the group's invalid state to assistive tech; an explicit aria-invalid wins\n \"aria-invalid\": group?.invalid || undefined,\n ...(props.value !== undefined ? { value: props.value } : {}),\n \"onInput\": handleInput,\n }),\n [[vDefaultValue, props.value === undefined ? props.defaultValue : undefined]],\n )\n },\n})\n\ntype InputGroupInputOwnProps = InstanceType<typeof InputGroupInputComponent>[\"$props\"]\n\n/** InputGroupInput props plus the native <input> attributes that fall through to it. */\nexport type InputGroupInputProps = InputGroupInputOwnProps &\n Omit<InputHTMLAttributes, keyof InputGroupInputOwnProps | \"size\">\n\n/** The native <input> of the group, without its own frame (React `InputGroup.Input`). */\nexport const InputGroupInput = InputGroupInputComponent as typeof InputGroupInputComponent & {\n new (): { $props: InputGroupInputProps }\n}\n\nconst InputGroupTextareaComponent = defineComponent({\n name: \"InputGroupTextarea\",\n props: {\n ...controlProps,\n /** @default 3 */\n rows: { type: [Number, String] as PropType<number | string>, default: 3 },\n },\n emits: {\n \"update:value\": (_value: string) => true,\n },\n setup(props, { emit }) {\n const group = inject(InputGroupKey, null)\n const textareaRef = ref<HTMLTextAreaElement | null>(null)\n\n // Set imperatively, like React DOM: a `value` prop would make Vue mirror\n // it into a `value` attribute, which React never renders\n const syncValue = () => {\n const textarea = textareaRef.value\n if (!textarea || props.value === undefined) return\n const value = String(props.value)\n if (textarea.value !== value) textarea.value = value\n }\n onMounted(() => {\n // React's initTextarea: the initial text becomes the (dirty) value\n const textarea = textareaRef.value\n const initialValue = textarea?.textContent ?? \"\"\n if (textarea && initialValue !== \"\") textarea.value = initialValue\n })\n watch(() => props.value, syncValue, { flush: \"post\" })\n\n const handleInput = (evt: Event) => {\n emit(\"update:value\", (evt.currentTarget as HTMLTextAreaElement).value)\n // A controlled value the parent did not update wins over the typed text\n void nextTick(syncValue)\n }\n\n return () => {\n // React keeps the textarea's text content in sync with the controlled\n // value, else with `defaultValue`\n const textContent = String(props.value ?? props.defaultValue ?? \"\")\n return withDirectives(\n h(\"textarea\", {\n \"ref\": textareaRef,\n \"rows\": props.rows,\n \"data-slot\": \"input-group-control\",\n \"class\": s.Control,\n \"disabled\": props.disabled ?? group?.disabled,\n \"aria-invalid\": group?.invalid || undefined,\n textContent,\n \"onInput\": handleInput,\n }),\n [[vServerText, textContent]],\n )\n }\n },\n})\n\ntype InputGroupTextareaOwnProps = InstanceType<typeof InputGroupTextareaComponent>[\"$props\"]\n\n/** InputGroupTextarea props plus the native <textarea> attributes that fall through to it. */\nexport type InputGroupTextareaProps = InputGroupTextareaOwnProps &\n Omit<TextareaHTMLAttributes, keyof InputGroupTextareaOwnProps>\n\n/** The native <textarea> of the group (React `InputGroup.Textarea`). */\nexport const InputGroupTextarea = InputGroupTextareaComponent as typeof InputGroupTextareaComponent & {\n new (): { $props: InputGroupTextareaProps }\n}\n\nexport type InputGroupAddonAlign = \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\"\n\n/** Icons, text and buttons beside, above or below the control (React `InputGroup.Addon`). */\nexport const InputGroupAddon = defineComponent({\n name: \"InputGroupAddon\",\n props: {\n /**\n * Where the addon sits: before or after the control on its line, or as a\n * row above or below it.\n * @default \"inline-start\"\n */\n align: { type: String as PropType<InputGroupAddonAlign>, default: \"inline-start\" },\n },\n setup(props, { slots }) {\n return () =>\n h(\n \"div\",\n { \"data-slot\": \"input-group-addon\", \"data-align\": props.align, \"class\": s.Addon },\n slots.default?.(),\n )\n },\n})\n\nexport type InputGroupAddonProps = InstanceType<typeof InputGroupAddon>[\"$props\"] &\n Omit<HTMLAttributes, keyof InstanceType<typeof InputGroupAddon>[\"$props\"]>\n\nconst InputGroupButtonComponent = defineComponent({\n name: \"InputGroupButton\",\n props: {\n /** Color for the button. @default \"secondary\" */\n color: { type: String as PropType<ButtonColor>, default: \"secondary\" },\n /** Style variant. @default \"ghost\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\" | \"ghost\">>, default: \"ghost\" },\n pill: { type: Boolean, default: undefined },\n disabled: { type: Boolean, default: undefined },\n },\n setup(props, { slots }) {\n const group = inject(InputGroupKey, null)\n return () =>\n h(\n Button,\n {\n color: props.color,\n variant: props.variant,\n size: BUTTON_SIZE[group?.size ?? \"md\"],\n pill: props.pill ?? group?.pill,\n disabled: props.disabled ?? group?.disabled,\n class: s.Button,\n },\n slots,\n )\n },\n})\n\ntype InputGroupButtonOwnProps = InstanceType<typeof InputGroupButtonComponent>[\"$props\"]\n\n/** InputGroupButton props plus the Button props (except `size`) that fall through to it, as in React. */\nexport type InputGroupButtonProps = InputGroupButtonOwnProps &\n Omit<ButtonProps, keyof InputGroupButtonOwnProps | \"size\">\n\n/**\n * A ghost `Button` sized from the group (React `InputGroup.Button`). Takes the\n * Button props except `size`; `pill` and `disabled` default to the group's.\n */\nexport const InputGroupButton = InputGroupButtonComponent as typeof InputGroupButtonComponent & {\n new (): { $props: InputGroupButtonProps }\n}\n\n/** Text and icons inside an addon: prefixes, units, counters (React `InputGroup.Text`). */\nexport const InputGroupText = defineComponent({\n name: \"InputGroupText\",\n setup(_props, { slots }) {\n return () => h(\"span\", { \"data-slot\": \"input-group-text\", \"class\": s.Text }, slots.default?.())\n },\n})\n\nexport type InputGroupTextProps = HTMLAttributes\n"]}