@ngrok/mantle 0.79.3 → 0.81.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 (222) hide show
  1. package/dist/accordion.d.ts +158 -19
  2. package/dist/accordion.js +1 -1
  3. package/dist/agent.json +5 -1
  4. package/dist/alert-dialog.d.ts +465 -32
  5. package/dist/alert-dialog.js +1 -1
  6. package/dist/alert.d.ts +116 -14
  7. package/dist/alert.js +1 -1
  8. package/dist/anchor-DfeXTpKW.js +1 -0
  9. package/dist/anchor.d.ts +2 -2
  10. package/dist/anchor.js +1 -1
  11. package/dist/area-chart.d.ts +504 -0
  12. package/dist/area-chart.js +1 -0
  13. package/dist/as-child-D23mGo4f.d.ts +49 -0
  14. package/dist/badge.d.ts +44 -5
  15. package/dist/badge.js +1 -1
  16. package/dist/bar-chart.d.ts +491 -0
  17. package/dist/bar-chart.js +1 -0
  18. package/dist/breadcrumb.d.ts +196 -14
  19. package/dist/breadcrumb.js +1 -1
  20. package/dist/button-BAno7KIU.js +1 -0
  21. package/dist/{index-BSAizFod.d.ts → button-C-gMbPso.d.ts} +5 -5
  22. package/dist/{icon-button-BvQvT790.d.ts → button-C7vAl6lS.d.ts} +22 -63
  23. package/dist/button-D9n09xUg.js +1 -0
  24. package/dist/{button-DcXOWUYo.d.ts → button-DARFK2KJ.d.ts} +4 -4
  25. package/dist/button-DjpEKt2X.js +1 -0
  26. package/dist/button-DvHMWAPl.js +1 -0
  27. package/dist/button.d.ts +5 -5
  28. package/dist/button.js +1 -1
  29. package/dist/calendar.d.ts +0 -3
  30. package/dist/calendar.js +1 -1
  31. package/dist/card.d.ts +131 -9
  32. package/dist/card.js +1 -1
  33. package/dist/centered-layout.d.ts +209 -8
  34. package/dist/centered-layout.js +1 -1
  35. package/dist/chart-BROa2gqt.js +2 -0
  36. package/dist/chart-BcOC6Qj0.d.ts +275 -0
  37. package/dist/checkbox-0EoxOyMA.js +1 -0
  38. package/dist/checkbox.d.ts +13 -11
  39. package/dist/checkbox.js +1 -1
  40. package/dist/choice-BHwFSSyv.js +1 -0
  41. package/dist/choice-BNRQXszu.d.ts +254 -0
  42. package/dist/choice.d.ts +1 -252
  43. package/dist/choice.js +1 -1
  44. package/dist/code-block.d.ts +242 -52
  45. package/dist/code-block.js +6 -6
  46. package/dist/code-block_highlight-utils.d.ts +1 -1
  47. package/dist/code-block_highlight-utils.js +1 -1
  48. package/dist/code.d.ts +3 -2
  49. package/dist/code.js +1 -1
  50. package/dist/combobox.d.ts +171 -16
  51. package/dist/combobox.js +1 -1
  52. package/dist/command.d.ts +279 -81
  53. package/dist/command.js +1 -1
  54. package/dist/compose-refs-BdBMM9ga.js +1 -0
  55. package/dist/data-table.d.ts +28 -6
  56. package/dist/data-table.js +1 -1
  57. package/dist/description-list.d.ts +67 -6
  58. package/dist/description-list.js +1 -1
  59. package/dist/dialog-BM4wPCft.d.ts +24 -0
  60. package/dist/dialog-DWZWd5Jt.js +1 -0
  61. package/dist/dialog.d.ts +226 -35
  62. package/dist/dialog.js +1 -1
  63. package/dist/{dropdown-menu-DP_Ne9Mr.d.ts → dropdown-menu-DZg-Cd69.d.ts} +137 -32
  64. package/dist/dropdown-menu-Dw-OtXPm.d.ts +1 -0
  65. package/dist/dropdown-menu-RyDWoKHx.js +1 -0
  66. package/dist/dropdown-menu.d.ts +2 -2
  67. package/dist/dropdown-menu.js +1 -1
  68. package/dist/empty.d.ts +7 -22
  69. package/dist/empty.js +1 -1
  70. package/dist/field-B1wqeZr4.js +1 -0
  71. package/dist/field.d.ts +568 -47
  72. package/dist/field.js +1 -1
  73. package/dist/flag.d.ts +0 -3
  74. package/dist/flag.js +1 -1
  75. package/dist/hooks.d.ts +3 -4
  76. package/dist/hooks.js +1 -1
  77. package/dist/hover-card.d.ts +48 -7
  78. package/dist/hover-card.js +1 -1
  79. package/dist/{svg-only-BFeFS1aa.d.ts → icon-CX_gj6sW.d.ts} +2 -2
  80. package/dist/icon-d-nMCfAI.js +1 -0
  81. package/dist/{icon-Cevjo93X.d.ts → icon-k4E9yNWD.d.ts} +2 -2
  82. package/dist/icon-lZ48P8Nn.js +1 -0
  83. package/dist/icon.d.ts +3 -3
  84. package/dist/icon.js +1 -1
  85. package/dist/{sort-BPX2Fk9t.js → icons-B_DDQcVD.js} +1 -1
  86. package/dist/{traffic-policy-file-0g5RXFqu.js → icons-CF1lbWtp.js} +1 -1
  87. package/dist/icons-DLCs1hLP.js +1 -0
  88. package/dist/icons.d.ts +7 -15
  89. package/dist/icons.js +1 -1
  90. package/dist/{in-view-nkSOdED2.d.ts → in-view-DDEGUKDR.d.ts} +17 -9
  91. package/dist/{index-D47aqlpz.d.ts → index-DA4ig3gj.d.ts} +1 -1
  92. package/dist/input-BnlpQF0c.js +1 -0
  93. package/dist/{types-C19IR7jf.d.ts → input-BuYDU6CF.d.ts} +42 -2
  94. package/dist/input.d.ts +5 -56
  95. package/dist/input.js +1 -1
  96. package/dist/{label-v2-bv98k.d.ts → label-C6YH9skg.d.ts} +8 -6
  97. package/dist/label-D-D11mlp.js +1 -0
  98. package/dist/label.d.ts +1 -1
  99. package/dist/label.js +1 -1
  100. package/dist/line-chart.d.ts +490 -0
  101. package/dist/line-chart.js +1 -0
  102. package/dist/list-51KQvENW.js +1 -0
  103. package/dist/list.d.ts +135 -6
  104. package/dist/list.js +1 -1
  105. package/dist/llms.txt +5 -1
  106. package/dist/main.d.ts +20 -4
  107. package/dist/main.js +1 -1
  108. package/dist/mantle-dark-high-contrast.css +17 -0
  109. package/dist/mantle-dark.css +13 -0
  110. package/dist/mantle-light-high-contrast.css +15 -0
  111. package/dist/mantle.css +29 -0
  112. package/dist/media-object.d.ts +18 -4
  113. package/dist/media-object.js +1 -1
  114. package/dist/multi-select.d.ts +282 -24
  115. package/dist/multi-select.js +1 -1
  116. package/dist/otp-input.d.ts +118 -6
  117. package/dist/otp-input.js +1 -1
  118. package/dist/pagination.d.ts +61 -6
  119. package/dist/pagination.js +1 -1
  120. package/dist/popover-CE4OlWkd.d.ts +208 -0
  121. package/dist/popover-CQ9s7jG5.js +1 -0
  122. package/dist/popover.d.ts +1 -181
  123. package/dist/popover.js +1 -1
  124. package/dist/primitive-trJDqIXJ.js +1 -0
  125. package/dist/progress.d.ts +2 -8
  126. package/dist/progress.js +1 -1
  127. package/dist/qr-code.d.ts +101 -5
  128. package/dist/qr-code.js +1 -1
  129. package/dist/radio-group.d.ts +110 -35
  130. package/dist/radio-group.js +1 -1
  131. package/dist/sandboxed-on-click.d.ts +2 -2
  132. package/dist/sandboxed-on-click.js +1 -1
  133. package/dist/scatter-plot.d.ts +495 -0
  134. package/dist/scatter-plot.js +1 -0
  135. package/dist/select-0z7HVS6r.d.ts +579 -0
  136. package/dist/select-BCHWvmyC.js +1 -0
  137. package/dist/select.d.ts +1 -1
  138. package/dist/select.js +1 -1
  139. package/dist/selectable-list.d.ts +225 -298
  140. package/dist/selectable-list.js +1 -1
  141. package/dist/separator-B5UmkVRL.d.ts +75 -0
  142. package/dist/separator-bpE_kooz.js +1 -0
  143. package/dist/separator.d.ts +1 -52
  144. package/dist/separator.js +1 -1
  145. package/dist/sheet.d.ts +285 -38
  146. package/dist/sheet.js +1 -1
  147. package/dist/skeleton-CsbUHbBA.js +1 -0
  148. package/dist/skeleton.d.ts +4 -7
  149. package/dist/skeleton.js +1 -1
  150. package/dist/skip-to-main-link.d.ts +24 -4
  151. package/dist/skip-to-main-link.js +1 -1
  152. package/dist/slider.js +1 -1
  153. package/dist/{index-Rv8RL7xy.d.ts → slot-BtwKJTLq.d.ts} +1 -1
  154. package/dist/slot-CDk0Bb9z.js +1 -0
  155. package/dist/slot.d.ts +1 -1
  156. package/dist/slot.js +1 -1
  157. package/dist/split-button.d.ts +14 -14
  158. package/dist/split-button.js +1 -1
  159. package/dist/switch.d.ts +10 -7
  160. package/dist/switch.js +1 -1
  161. package/dist/table-Bo0vNxIJ.d.ts +848 -0
  162. package/dist/table-CGxJwtbL.js +1 -0
  163. package/dist/table.d.ts +1 -1
  164. package/dist/table.js +1 -1
  165. package/dist/tabs.d.ts +124 -25
  166. package/dist/tabs.js +1 -1
  167. package/dist/text-area.d.ts +2 -2
  168. package/dist/text-area.js +1 -1
  169. package/dist/theme-C26-Xolp.js +1 -0
  170. package/dist/theme-switcher.d.ts +105 -33
  171. package/dist/theme-switcher.js +1 -1
  172. package/dist/theme.d.ts +54 -15
  173. package/dist/theme.js +1 -1
  174. package/dist/toast.d.ts +86 -10
  175. package/dist/toast.js +1 -1
  176. package/dist/tooltip.d.ts +50 -5
  177. package/dist/tooltip.js +1 -1
  178. package/dist/types.d.ts +2 -2
  179. package/dist/utils.d.ts +1 -1
  180. package/dist/utils.js +1 -1
  181. package/dist/well.d.ts +3 -3
  182. package/dist/well.js +1 -1
  183. package/package.json +9 -3
  184. package/dist/anchor-C_tjSVy6.js +0 -1
  185. package/dist/as-child-CYEVu1WY.d.ts +0 -23
  186. package/dist/button-5t6-JS_I.js +0 -1
  187. package/dist/button-ClC60Nzg.js +0 -1
  188. package/dist/checkbox-DJ2xl7Rc.js +0 -1
  189. package/dist/choice-DOdyNzFC.js +0 -1
  190. package/dist/compose-refs-Cjf2gfB8.js +0 -1
  191. package/dist/dialog-vxLIvB8M.js +0 -1
  192. package/dist/dropdown-menu-Bt1aKF1g.js +0 -1
  193. package/dist/field-context-BR01g789.js +0 -1
  194. package/dist/icon-CDtYjF_H.js +0 -1
  195. package/dist/icon-button-DV2-GZHf.js +0 -1
  196. package/dist/index-g2rfwNCH.d.ts +0 -1
  197. package/dist/input-Ct1YOqSy.js +0 -1
  198. package/dist/label-BMlHW_2D.js +0 -1
  199. package/dist/popover-D5WxxnBY.js +0 -1
  200. package/dist/primitive-C64-m48O.d.ts +0 -13
  201. package/dist/primitive-IKruV2iB.js +0 -1
  202. package/dist/select-Bwt2YduR.d.ts +0 -345
  203. package/dist/select-D-5u0Blc.js +0 -1
  204. package/dist/separator-kBnnv3Cw.js +0 -1
  205. package/dist/skeleton-Bu3tgNcW.js +0 -1
  206. package/dist/slot-DmPrjM7N.js +0 -1
  207. package/dist/svg-only-DDx6FtJd.js +0 -1
  208. package/dist/table-CPH2md2-.js +0 -1
  209. package/dist/table-CwFHXC-G.d.ts +0 -414
  210. package/dist/theme-D3MDng6U.js +0 -1
  211. package/dist/theme-provider-C9zpDyJW.js +0 -1
  212. package/dist/toast-BsCjaMVS.js +0 -1
  213. package/dist/virtual-DZMBu7Ch.js +0 -1
  214. /package/dist/{sizes-BCoI4bhP.d.ts → button-BCoI4bhP.d.ts} +0 -0
  215. /package/dist/{intents-DdSKSj1c.d.ts → button-DdSKSj1c.d.ts} +0 -0
  216. /package/dist/{resolve-pre-rendered-props-B6OlZrSI.d.ts → code-block-B6OlZrSI.d.ts} +0 -0
  217. /package/dist/{resolve-pre-rendered-props-C9uaM9-V.js → code-block-C9uaM9-V.js} +0 -0
  218. /package/dist/{validation-7QeiTFwl.d.ts → field-7QeiTFwl.d.ts} +0 -0
  219. /package/dist/{validation-Bpptk_9t.js → field-Bpptk_9t.js} +0 -0
  220. /package/dist/{types-D1RY5Tcj.d.ts → icon-D1RY5Tcj.d.ts} +0 -0
  221. /package/dist/{is-input-CXmS0OFN.js → input-CXmS0OFN.js} +0 -0
  222. /package/dist/{themes-CYNpplwN.d.ts → theme-CYNpplwN.d.ts} +0 -0
@@ -1,5 +1,6 @@
1
- import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
2
- import { o as WithValidation } from "./validation-7QeiTFwl.js";
1
+ import { n as WithAsChild } from "./as-child-D23mGo4f.js";
2
+ import { o as WithValidation } from "./field-7QeiTFwl.js";
3
+ import { n as Separator } from "./separator-B5UmkVRL.js";
3
4
  import { ComponentProps, ReactNode } from "react";
4
5
  import * as Primitive from "@ariakit/react";
5
6
  //#region src/components/multi-select/multi-select.d.ts
@@ -37,10 +38,28 @@ type MultiSelectProps = Primitive.ComboboxProviderProps<string[]>;
37
38
  * </MultiSelect.Root>
38
39
  * ```
39
40
  */
40
- declare const Root: {
41
- ({ children, defaultSelectedValue, ...props }: MultiSelectProps): import("react").JSX.Element;
42
- displayName: string;
43
- };
41
+ declare const Root: ({ children, defaultSelectedValue, ...props }: MultiSelectProps) => import("react").JSX.Element;
42
+ type MultiSelectTriggerProps = ComponentProps<"div"> & WithValidation;
43
+ /**
44
+ * The trigger container for the multi-select. Wraps the input and selected
45
+ * value tags in a styled container that looks like a form input.
46
+ *
47
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttrigger
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * <MultiSelect.Root>
52
+ * <MultiSelect.Trigger>
53
+ * <MultiSelect.TagValues />
54
+ * <MultiSelect.Input placeholder="Select items..." />
55
+ * </MultiSelect.Trigger>
56
+ * <MultiSelect.Content>
57
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
58
+ * </MultiSelect.Content>
59
+ * </MultiSelect.Root>
60
+ * ```
61
+ */
62
+ declare const Trigger: ({ "aria-invalid": _ariaInvalid, className, children, onKeyDown, onMouseDown, ref, validation: _validation, ...props }: MultiSelectTriggerProps) => import("react").JSX.Element;
44
63
  type TagProps = Omit<ComponentProps<"span">, "children"> & {
45
64
  /**
46
65
  * The value to display in the tag label.
@@ -56,6 +75,31 @@ type TagProps = Omit<ComponentProps<"span">, "children"> & {
56
75
  */
57
76
  locked?: boolean;
58
77
  };
78
+ /**
79
+ * The default tag rendered inside `MultiSelect.TagValues` for each selected value.
80
+ * Displays the value label with a remove button and full keyboard navigation support.
81
+ *
82
+ * Use this when building a custom `TagValues`-like component and you want the
83
+ * default tag chrome with consistent styling.
84
+ *
85
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttag
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * <MultiSelect.Root>
90
+ * <MultiSelect.Trigger>
91
+ * <MultiSelect.TagValues>
92
+ * {(props) => <MultiSelect.Tag key={props.value} {...props} />}
93
+ * </MultiSelect.TagValues>
94
+ * <MultiSelect.Input placeholder="Select items..." />
95
+ * </MultiSelect.Trigger>
96
+ * <MultiSelect.Content>
97
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
98
+ * </MultiSelect.Content>
99
+ * </MultiSelect.Root>
100
+ * ```
101
+ */
102
+ declare const Tag: ({ className, value, onRemove, locked, onKeyDown, ref, ...props }: TagProps) => import("react").JSX.Element;
59
103
  /**
60
104
  * Props passed to the children render function of `MultiSelect.TagValues`.
61
105
  * Spread these onto `MultiSelect.Tag` (or your own tag component) to
@@ -115,10 +159,7 @@ type MultiSelectTagValuesProps = {
115
159
  * </MultiSelect.Root>
116
160
  * ```
117
161
  */
118
- declare const TagValues: {
119
- ({ children, lockedValues }: MultiSelectTagValuesProps): import("react").JSX.Element;
120
- displayName: string;
121
- };
162
+ declare const TagValues: ({ children, lockedValues }: MultiSelectTagValuesProps) => import("react").JSX.Element;
122
163
  type MultiSelectInputProps = Omit<Primitive.ComboboxProps, "render"> & {
123
164
  /**
124
165
  * Called with the raw string value whenever the input text changes.
@@ -127,10 +168,230 @@ type MultiSelectInputProps = Omit<Primitive.ComboboxProps, "render"> & {
127
168
  */
128
169
  onValueChange?: (value: string) => void;
129
170
  };
171
+ /**
172
+ * The combobox input for filtering items. Place this inside `MultiSelect.Trigger`,
173
+ * after `MultiSelect.TagValues`.
174
+ *
175
+ * `MultiSelect.Input` is the focusable element of the multi-select. When the
176
+ * surrounding `MultiSelect.Root` is wrapped in `Field.Control`, the generated
177
+ * `id`, `aria-invalid`, `aria-describedby`, and `aria-errormessage` flow onto
178
+ * the input here via `FieldControlContext`.
179
+ *
180
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectinput
181
+ *
182
+ * @example
183
+ * ```tsx
184
+ * <MultiSelect.Root>
185
+ * <MultiSelect.Trigger>
186
+ * <MultiSelect.TagValues />
187
+ * <MultiSelect.Input placeholder="Select items..." />
188
+ * </MultiSelect.Trigger>
189
+ * <MultiSelect.Content>
190
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
191
+ * </MultiSelect.Content>
192
+ * </MultiSelect.Root>
193
+ * ```
194
+ */
195
+ declare const Input: ({ className, onBlur, onChange, onFocus, onKeyDown, onValueChange, placeholder, ref, ...props }: MultiSelectInputProps) => import("react").JSX.Element;
130
196
  type MultiSelectContentProps = Omit<Primitive.ComboboxPopoverProps, "render"> & WithAsChild;
197
+ /**
198
+ * Renders a popover that contains multi-select content, such as items, groups,
199
+ * and separators. Opens below the trigger.
200
+ *
201
+ * `MultiSelect.Content` renders at Tailwind `z-50`, Mantle's shared floating
202
+ * z-index. When multiple shared layers are open, the most recently mounted
203
+ * layer renders on top.
204
+ *
205
+ * By default, mantle disables Ariakit's body scroll lock when the trigger is
206
+ * inside a mantle modal (`Dialog`, `Sheet`, `AlertDialog`) — the modal already
207
+ * locks body scroll — and enables it otherwise. Pass `preventBodyScroll` to
208
+ * override.
209
+ *
210
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectcontent
211
+ *
212
+ * @example
213
+ * ```tsx
214
+ * <MultiSelect.Root>
215
+ * <MultiSelect.Trigger>
216
+ * <MultiSelect.TagValues />
217
+ * <MultiSelect.Input placeholder="Select items..." />
218
+ * </MultiSelect.Trigger>
219
+ * <MultiSelect.Content>
220
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
221
+ * <MultiSelect.Item value="banana">Banana</MultiSelect.Item>
222
+ * </MultiSelect.Content>
223
+ * </MultiSelect.Root>
224
+ * ```
225
+ */
226
+ declare const Content: ({ asChild, backdrop, children, className, modal, portalElement, preventBodyScroll, ref, sameWidth, unmountOnHide, ...props }: MultiSelectContentProps) => import("react").JSX.Element;
131
227
  type MultiSelectItemProps = Omit<Primitive.ComboboxItemProps, "render"> & WithAsChild;
228
+ /**
229
+ * Renders a selectable item inside a `MultiSelect.Content` component.
230
+ * Items display a checkbox indicator when selected.
231
+ *
232
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectitem
233
+ *
234
+ * @example
235
+ * ```tsx
236
+ * <MultiSelect.Root>
237
+ * <MultiSelect.Trigger>
238
+ * <MultiSelect.TagValues />
239
+ * <MultiSelect.Input placeholder="Select items..." />
240
+ * </MultiSelect.Trigger>
241
+ * <MultiSelect.Content>
242
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
243
+ * <MultiSelect.Item value="banana">Banana</MultiSelect.Item>
244
+ * </MultiSelect.Content>
245
+ * </MultiSelect.Root>
246
+ * ```
247
+ */
248
+ declare const Item: ({ asChild, children, className, focusOnHover, value, onClick, ref, ...props }: MultiSelectItemProps) => import("react").JSX.Element;
132
249
  type MultiSelectGroupProps = Omit<Primitive.ComboboxGroupProps, "render"> & WithAsChild;
250
+ /**
251
+ * Renders a group for MultiSelect.Item elements.
252
+ *
253
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectgroup
254
+ *
255
+ * @example
256
+ * ```tsx
257
+ * <MultiSelect.Root>
258
+ * <MultiSelect.Trigger>
259
+ * <MultiSelect.TagValues />
260
+ * <MultiSelect.Input placeholder="Select items..." />
261
+ * </MultiSelect.Trigger>
262
+ * <MultiSelect.Content>
263
+ * <MultiSelect.Group>
264
+ * <MultiSelect.GroupLabel>Fruits</MultiSelect.GroupLabel>
265
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
266
+ * <MultiSelect.Item value="banana">Banana</MultiSelect.Item>
267
+ * </MultiSelect.Group>
268
+ * </MultiSelect.Content>
269
+ * </MultiSelect.Root>
270
+ * ```
271
+ */
272
+ declare const Group: ({ asChild, children, ref, ...props }: MultiSelectGroupProps) => import("react").JSX.Element;
133
273
  type MultiSelectGroupLabelProps = Omit<Primitive.ComboboxGroupLabelProps, "render"> & WithAsChild;
274
+ /**
275
+ * Renders a label in a multi-select group.
276
+ *
277
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectgrouplabel
278
+ *
279
+ * @example
280
+ * ```tsx
281
+ * <MultiSelect.Root>
282
+ * <MultiSelect.Trigger>
283
+ * <MultiSelect.TagValues />
284
+ * <MultiSelect.Input placeholder="Select items..." />
285
+ * </MultiSelect.Trigger>
286
+ * <MultiSelect.Content>
287
+ * <MultiSelect.Group>
288
+ * <MultiSelect.GroupLabel>Fruits</MultiSelect.GroupLabel>
289
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
290
+ * </MultiSelect.Group>
291
+ * </MultiSelect.Content>
292
+ * </MultiSelect.Root>
293
+ * ```
294
+ */
295
+ declare const GroupLabel: ({ asChild, children, className, ref, ...props }: MultiSelectGroupLabelProps) => import("react").JSX.Element;
296
+ type MultiSelectGroupDescriptionProps = ComponentProps<"p">;
297
+ /**
298
+ * Renders a description below a `MultiSelect.GroupLabel` inside a `MultiSelect.Group`.
299
+ * Provides context about the group's purpose or constraints.
300
+ *
301
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectgroupdescription
302
+ *
303
+ * @example
304
+ * ```tsx
305
+ * <MultiSelect.Root>
306
+ * <MultiSelect.Trigger>
307
+ * <MultiSelect.TagValues />
308
+ * <MultiSelect.Input placeholder="Select regions..." />
309
+ * </MultiSelect.Trigger>
310
+ * <MultiSelect.Content>
311
+ * <MultiSelect.Group>
312
+ * <MultiSelect.GroupLabel>Regional Aliases</MultiSelect.GroupLabel>
313
+ * <MultiSelect.GroupDescription>
314
+ * Include all points of presence that are geographically within the region.
315
+ * </MultiSelect.GroupDescription>
316
+ * <MultiSelect.Item value="global">global</MultiSelect.Item>
317
+ * </MultiSelect.Group>
318
+ * </MultiSelect.Content>
319
+ * </MultiSelect.Root>
320
+ * ```
321
+ */
322
+ declare const GroupDescription: ({ className, children, ref, ...props }: MultiSelectGroupDescriptionProps) => import("react").JSX.Element;
323
+ /**
324
+ * Renders a separator between MultiSelect.Items or MultiSelect.Groups.
325
+ *
326
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectseparator
327
+ *
328
+ * @example
329
+ * ```tsx
330
+ * <MultiSelect.Root>
331
+ * <MultiSelect.Trigger>
332
+ * <MultiSelect.TagValues />
333
+ * <MultiSelect.Input placeholder="Select items..." />
334
+ * </MultiSelect.Trigger>
335
+ * <MultiSelect.Content>
336
+ * <MultiSelect.Group>
337
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
338
+ * </MultiSelect.Group>
339
+ * <MultiSelect.Separator />
340
+ * <MultiSelect.Group>
341
+ * <MultiSelect.Item value="carrot">Carrot</MultiSelect.Item>
342
+ * </MultiSelect.Group>
343
+ * </MultiSelect.Content>
344
+ * </MultiSelect.Root>
345
+ * ```
346
+ */
347
+ declare const MultiSelectSeparatorComponent: ({ className, ref, ...props }: ComponentProps<typeof Separator>) => import("react").JSX.Element;
348
+ type MultiSelectEmptyProps = ComponentProps<"div">;
349
+ /**
350
+ * Renders a message when no items match the current filter.
351
+ *
352
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectempty
353
+ *
354
+ * @example
355
+ * ```tsx
356
+ * <MultiSelect.Root>
357
+ * <MultiSelect.Trigger>
358
+ * <MultiSelect.TagValues />
359
+ * <MultiSelect.Input placeholder="Select items..." />
360
+ * </MultiSelect.Trigger>
361
+ * <MultiSelect.Content>
362
+ * {matches.length === 0 && (
363
+ * <MultiSelect.Empty>No results found</MultiSelect.Empty>
364
+ * )}
365
+ * </MultiSelect.Content>
366
+ * </MultiSelect.Root>
367
+ * ```
368
+ */
369
+ declare const Empty: ({ className, children, ref, ...props }: MultiSelectEmptyProps) => import("react").JSX.Element;
370
+ type MultiSelectContentFooterProps = ComponentProps<"div">;
371
+ /**
372
+ * Renders a sticky footer pinned to the bottom inside `MultiSelect.Content`,
373
+ * with a separator border at the top.
374
+ *
375
+ * @see https://mantle.ngrok.com/components/forms/multi-select#multiselectcontentfooter
376
+ *
377
+ * @example
378
+ * ```tsx
379
+ * <MultiSelect.Root>
380
+ * <MultiSelect.Trigger>
381
+ * <MultiSelect.TagValues />
382
+ * <MultiSelect.Input placeholder="Select items..." />
383
+ * </MultiSelect.Trigger>
384
+ * <MultiSelect.Content>
385
+ * <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
386
+ * <MultiSelect.ContentFooter>
387
+ * <p>Upgrade to unlock more options.</p>
388
+ * <Button appearance="filled" intent="accent">Upgrade</Button>
389
+ * </MultiSelect.ContentFooter>
390
+ * </MultiSelect.Content>
391
+ * </MultiSelect.Root>
392
+ * ```
393
+ */
394
+ declare const ContentFooter: ({ className, children, ref, ...props }: MultiSelectContentFooterProps) => import("react").JSX.Element;
134
395
  /**
135
396
  * A multi-select combobox that allows users to select multiple values with
136
397
  * typeahead filtering. Selected values are displayed as removable tags.
@@ -230,7 +491,7 @@ declare const MultiSelect: {
230
491
  * </MultiSelect.Root>
231
492
  * ```
232
493
  */
233
- readonly Trigger: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & WithValidation & import("react").RefAttributes<HTMLDivElement>>;
494
+ readonly Trigger: typeof Trigger;
234
495
  /**
235
496
  * Renders the selected values as removable tags. Place this inside
236
497
  * `MultiSelect.Trigger`, followed by `MultiSelect.Input`.
@@ -289,7 +550,7 @@ declare const MultiSelect: {
289
550
  * </MultiSelect.Root>
290
551
  * ```
291
552
  */
292
- readonly Input: import("react").ForwardRefExoticComponent<Omit<MultiSelectInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
553
+ readonly Input: typeof Input;
293
554
  /**
294
555
  * The default tag rendered inside `MultiSelect.TagValues` for each selected value.
295
556
  * Displays the value label with a remove button and keyboard navigation support.
@@ -311,7 +572,7 @@ declare const MultiSelect: {
311
572
  * </MultiSelect.Root>
312
573
  * ```
313
574
  */
314
- readonly Tag: import("react").ForwardRefExoticComponent<Omit<TagProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>>;
575
+ readonly Tag: typeof Tag;
315
576
  /**
316
577
  * Renders a popover that contains multi-select content.
317
578
  *
@@ -335,7 +596,7 @@ declare const MultiSelect: {
335
596
  * </MultiSelect.Root>
336
597
  * ```
337
598
  */
338
- readonly Content: import("react").ForwardRefExoticComponent<Omit<MultiSelectContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
599
+ readonly Content: typeof Content;
339
600
  /**
340
601
  * Renders a sticky footer pinned to the bottom inside `MultiSelect.Content`,
341
602
  * with a separator border at the top.
@@ -358,7 +619,7 @@ declare const MultiSelect: {
358
619
  * </MultiSelect.Root>
359
620
  * ```
360
621
  */
361
- readonly ContentFooter: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
622
+ readonly ContentFooter: typeof ContentFooter;
362
623
  /**
363
624
  * Renders a selectable item with a checkbox indicator inside a `MultiSelect.Content`.
364
625
  *
@@ -378,7 +639,7 @@ declare const MultiSelect: {
378
639
  * </MultiSelect.Root>
379
640
  * ```
380
641
  */
381
- readonly Item: import("react").ForwardRefExoticComponent<Omit<MultiSelectItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
642
+ readonly Item: typeof Item;
382
643
  /**
383
644
  * Renders a group for MultiSelect.Item elements.
384
645
  *
@@ -400,7 +661,7 @@ declare const MultiSelect: {
400
661
  * </MultiSelect.Root>
401
662
  * ```
402
663
  */
403
- readonly Group: import("react").ForwardRefExoticComponent<Omit<MultiSelectGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
664
+ readonly Group: typeof Group;
404
665
  /**
405
666
  * Renders a label in a multi-select group.
406
667
  *
@@ -422,7 +683,7 @@ declare const MultiSelect: {
422
683
  * </MultiSelect.Root>
423
684
  * ```
424
685
  */
425
- readonly GroupLabel: import("react").ForwardRefExoticComponent<Omit<MultiSelectGroupLabelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
686
+ readonly GroupLabel: typeof GroupLabel;
426
687
  /**
427
688
  * Renders a description below a `MultiSelect.GroupLabel` inside a `MultiSelect.Group`.
428
689
  *
@@ -447,7 +708,7 @@ declare const MultiSelect: {
447
708
  * </MultiSelect.Root>
448
709
  * ```
449
710
  */
450
- readonly GroupDescription: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
711
+ readonly GroupDescription: typeof GroupDescription;
451
712
  /**
452
713
  * Renders a separator between items or groups.
453
714
  *
@@ -472,10 +733,7 @@ declare const MultiSelect: {
472
733
  * </MultiSelect.Root>
473
734
  * ```
474
735
  */
475
- readonly Separator: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & WithAsChild & {
476
- orientation?: "horizontal" | "vertical";
477
- semantic?: boolean;
478
- }, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
736
+ readonly Separator: typeof MultiSelectSeparatorComponent;
479
737
  /**
480
738
  * Renders a message when no items match the current filter.
481
739
  *
@@ -496,7 +754,7 @@ declare const MultiSelect: {
496
754
  * </MultiSelect.Root>
497
755
  * ```
498
756
  */
499
- readonly Empty: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
757
+ readonly Empty: typeof Empty;
500
758
  };
501
759
  //#endregion
502
760
  export { MultiSelect };
@@ -1 +1 @@
1
- import{t as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-CDtYjF_H.js";import{t as r}from"./slot-DmPrjM7N.js";import{a as i,r as a}from"./validation-Bpptk_9t.js";import{t as o}from"./field-context-BR01g789.js";import{n as s}from"./separator-kBnnv3Cw.js";import{t as c}from"./use-prefers-reduced-motion-CagaNRgm.js";import{createContext as l,forwardRef as u,useCallback as d,useContext as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{XIcon as b}from"@phosphor-icons/react/X";import{CheckIcon as x}from"@phosphor-icons/react/Check";import*as S from"@ariakit/react";import{LockIcon as C}from"@phosphor-icons/react/Lock";const w=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),T=[],E=l({current:null}),D=l({current:[]}),O=l({onInputKeyDownRef:{current:void 0},inputRef:{current:null}}),k=({children:e,defaultSelectedValue:t=T,...n})=>{let r=h(null),i=h(void 0),a=h(null),o=h([]),s=m(()=>({onInputKeyDownRef:i,inputRef:a}),[]);return v(E.Provider,{value:r,children:v(O.Provider,{value:s,children:v(D.Provider,{value:o,children:v(S.ComboboxProvider,{defaultSelectedValue:t,...n,children:e})})})})};k.displayName=`MultiSelect`;const A=u(({"aria-invalid":n,className:r,children:o,onKeyDown:s,onMouseDown:c,validation:l,...u},d)=>{let p=f(E),{inputRef:m}=f(O),h=S.useComboboxContext(),g=i(),{validation:_}=a({"aria-invalid":n,validation:l??g});return v(`div`,{role:`group`,"data-slot":`multi-select-trigger`,className:t(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-[[data-slot=multi-select-tag]]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger`,r),"data-validation":_||void 0,onKeyDown:e=>{e.key===`Escape`&&h?.getState().open&&(e.preventDefault(),h.hide()),s?.(e)},onMouseDown:e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [role='option']`)&&(e.preventDefault(),m.current?.focus()),c?.(e)},ref:e(p,d),...u,children:o})});A.displayName=`MultiSelectTrigger`;const j=u(({className:r,value:i,onRemove:a,locked:o=!1,onKeyDown:s,...c},l)=>{let u=h(null);return y(`span`,{ref:e(u,l),role:`option`,"aria-selected":!0,tabIndex:-1,"data-slot":`multi-select-tag`,"data-locked":o||void 0,className:t(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,r),onKeyDown:e=>{if(o&&(e.key===`Backspace`||e.key===`Delete`)){e.preventDefault(),U(e.currentTarget);return}s?.(e)},...c,children:[i,v(`button`,{type:`button`,"aria-label":`Remove ${i}`,tabIndex:-1,"aria-disabled":o||void 0,className:t(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),onClick:e=>{if(e.stopPropagation(),o){let e=u.current;e&&U(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:v(n,{svg:o?v(C,{}):v(b,{weight:`bold`}),className:`size-4`})})]})});j.displayName=`MultiSelectTag`;const M=({children:e,lockedValues:t=T})=>{let n=S.useComboboxContext(),r=S.useStoreState(n,`selectedValue`),i=(w(r)?r:void 0)??T,a=h(i);a.current=i;let o=f(D);o.current=t;let s=m(()=>new Set(t),[t]),c=h(new Map),{onInputKeyDownRef:l,inputRef:u}=f(O),d=h(new Set);p(()=>()=>{d.current.forEach(cancelAnimationFrame)},[]);let g=e=>{let t=requestAnimationFrame(()=>{d.current.delete(t),e()});d.current.add(t)},y=e=>{if(n){let t=n.getState().selectedValue;if(!w(t))return;n.setSelectedValue(t.filter(t=>t!==e))}},b=e=>{let t=a.current[e];if(t==null)return;let r=c.current.get(t);r&&(r.focus(),n?.show())},x=()=>{u.current?.focus()},C=(e,t)=>{let n=i[t];switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&b(t-1);break;case`ArrowRight`:e.preventDefault(),t<i.length-1?b(t+1):x();break;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(s.has(n)){let e=c.current.get(n);e&&U(e);break}if(y(n),e.key===`Backspace`)if(t>0){let e=t-1;g(()=>b(e))}else g(()=>{a.current.length>0?b(0):x()});else g(()=>{t<a.current.length?b(t):x()})}break;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),x(),u.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&x();break}};return l.current=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&i.length>0){e.preventDefault(),b(i.length-1);return}if(e.key===`Backspace`&&e.currentTarget.value===``&&i.length>0){let e=i[i.length-1];if(e!=null)if(o.current.includes(e)){let t=c.current.get(e);t&&U(t)}else y(e)}},v(_,{children:i.map((t,n)=>{let r={value:t,locked:s.has(t),onRemove:()=>{if(s.has(t)){let e=c.current.get(t);e&&U(e);return}y(t)},ref:e=>{e?c.current.set(t,e):c.current.delete(t)},onKeyDown:e=>C(e,n),onClick:()=>b(n)};return e?e(r):v(j,{...r},t)})})};M.displayName=`MultiSelectTagValues`;const N=u(({className:n,onBlur:r,onChange:i,onFocus:a,onKeyDown:s,onValueChange:c,placeholder:l,...u},d)=>{let p=S.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=f(O),g=f(o),_=S.useStoreState(p,`selectedValue`),y=((w(_)?_:void 0)?.length??0)>0;return v(S.Combobox,{autoSelect:!0,"data-slot":`multi-select-input`,className:t(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,n),onChange:e=>{c?.(e.target.value),i?.(e)},onKeyDown:e=>{m.current?.(e),s?.(e)},onBlur:e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot="multi-select-tag"]`)&&p?.show(),r?.(e)},onFocus:e=>{p?.show(),a?.(e)},placeholder:y?void 0:l,ref:e(h,d),...u,...g?{"aria-describedby":g[`aria-describedby`],"aria-errormessage":g[`aria-errormessage`],"aria-invalid":g[`aria-invalid`],id:g.id,name:g.name}:void 0})});N.displayName=`MultiSelectInput`;const P=u(({asChild:e=!1,backdrop:n=!1,children:i,className:a,modal:o=!0,portalElement:s,preventBodyScroll:c,sameWidth:l=!0,unmountOnHide:u=!0,...m},h)=>{let _=f(E),[y,b]=g(!1);p(()=>{b(_.current?.closest(`[data-mantle-modal-content]`)!=null)},[_]);let x=d(()=>_.current?.getBoundingClientRect()??null,[_]),C=d(e=>typeof s==`function`?s(e):s??_.current?.closest(`[data-mantle-modal-content]`)??e.ownerDocument.body,[s,_]),w=d(e=>!(e.target instanceof Node&&_.current?.contains(e.target)),[_]);return v(S.ComboboxPopover,{"data-slot":`multi-select-content`,className:t(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,a),backdrop:n,getAnchorRect:x,gutter:4,hideOnInteractOutside:w,modal:o,portalElement:C,preventBodyScroll:c??!y,ref:h,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,sameWidth:l,unmountOnHide:u,...m,children:i})});P.displayName=`MultiSelectContent`;const F=u(({asChild:e=!1,children:i,className:a,focusOnHover:o=!0,value:s,onClick:c,...l},u)=>{let d=f(D),p=s!=null&&d.current.includes(s);return y(S.ComboboxItem,{"data-slot":`multi-select-item`,className:t(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),focusOnHover:o,onClick:e=>{if(p){e.preventDefault();return}c?.(e)},ref:u,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...l,children:[i,v(S.ComboboxItemCheck,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:v(n,{svg:v(x,{weight:`bold`}),className:`size-4 text-accent-600`})})]})});F.displayName=`MultiSelectItem`;const I=u(({asChild:e=!1,children:t,...n},i)=>v(S.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:i,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,...n,children:t}));I.displayName=`MultiSelectGroup`;const L=u(({asChild:e=!1,children:n,className:i,...a},o)=>v(S.ComboboxGroupLabel,{"data-slot":`multi-select-group-label`,className:t(`text-muted px-2 py-1 text-xs font-medium`,i),ref:o,render:e?({ref:e,...t})=>v(r,{ref:e,...t}):void 0,...a,children:n}));L.displayName=`MultiSelectGroupLabel`;const R=u(({className:e,children:n,...r},i)=>v(`p`,{"data-slot":`multi-select-group-description`,className:t(`text-muted px-2 pb-1 text-xs`,e),ref:i,...r,children:n}));R.displayName=`MultiSelectGroupDescription`;const z=u(({className:e,...n},r)=>v(s,{"data-slot":`multi-select-separator`,ref:r,className:t(`my-1 w-auto`,e),...n}));z.displayName=`MultiSelectSeparator`;const B=u(({className:e,children:n,...r},i)=>v(`div`,{"data-slot":`multi-select-empty`,className:t(`mx-1 text-muted px-2 py-6 text-center text-sm`,e),ref:i,role:`presentation`,...r,children:n}));B.displayName=`MultiSelectEmpty`;const V=u(({className:e,children:n,...r},i)=>v(`div`,{ref:i,"data-slot":`multi-select-content-footer`,"data-content-footer":!0,className:t(`bg-popover sticky bottom-0 border-t border-popover`,e),...r,children:n}));V.displayName=`MultiSelectContentFooter`;const H={Root:k,Trigger:A,TagValues:M,Input:N,Tag:j,Content:P,ContentFooter:V,Item:F,Group:I,GroupLabel:L,GroupDescription:R,Separator:z,Empty:B};function U(e){c()||e.animate([{transform:`translateX(0)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(0)`}],{duration:300,easing:`ease-in-out`})}export{H as MultiSelect};
1
+ import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-CDk0Bb9z.js";import{a as i,r as a}from"./field-Bpptk_9t.js";import{t as o}from"./field-B1wqeZr4.js";import{n as s}from"./separator-bpE_kooz.js";import{t as c}from"./use-prefers-reduced-motion-CagaNRgm.js";import{createContext as l,useCallback as u,useContext as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{XIcon as y}from"@phosphor-icons/react/X";import{CheckIcon as b}from"@phosphor-icons/react/Check";import*as x from"@ariakit/react";import{LockIcon as S}from"@phosphor-icons/react/Lock";const C=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`),w=[],T=l({current:null}),E=l({current:[]}),D=l({onInputKeyDownRef:{current:void 0},inputRef:{current:null}}),O=({children:e,defaultSelectedValue:t=w,...n})=>{let r=m(null),i=m(void 0),a=m(null),o=m([]),s=p(()=>({onInputKeyDownRef:i,inputRef:a}),[]);return _(T.Provider,{value:r,children:_(D.Provider,{value:s,children:_(E.Provider,{value:o,children:_(x.ComboboxProvider,{defaultSelectedValue:t,...n,children:e})})})})},k=({"aria-invalid":n,className:r,children:o,onKeyDown:s,onMouseDown:c,ref:l,validation:u,...f})=>{let p=d(T),{inputRef:m}=d(D),h=x.useComboboxContext(),g=i(),{validation:v}=a({"aria-invalid":n,validation:u??g});return _(`div`,{role:`group`,"data-slot":`multi-select-trigger`,className:t(`cursor-text select-none font-sans text-sm`,`border-form bg-form text-strong flex min-h-9 w-full flex-wrap items-center gap-1 rounded-md border px-3 py-1 has-[[data-slot=multi-select-tag]]:px-1`,`has-focus:outline-hidden has-focus-within:ring-4 has-aria-expanded:ring-4`,`has-focus-within:border-accent-600 has-focus-within:ring-focus-accent has-aria-expanded:border-accent-600 has-aria-expanded:ring-focus-accent`,`data-validation-success:border-success-600 data-validation-success:has-focus-within:border-success-600 data-validation-success:has-focus-within:ring-focus-success data-validation-success:has-aria-expanded:border-success-600 data-validation-success:has-aria-expanded:ring-focus-success`,`data-validation-warning:border-warning-600 data-validation-warning:has-focus-within:border-warning-600 data-validation-warning:has-focus-within:ring-focus-warning data-validation-warning:has-aria-expanded:border-warning-600 data-validation-warning:has-aria-expanded:ring-focus-warning`,`data-validation-error:border-danger-600 data-validation-error:has-focus-within:border-danger-600 data-validation-error:has-focus-within:ring-focus-danger data-validation-error:has-aria-expanded:border-danger-600 data-validation-error:has-aria-expanded:ring-focus-danger`,r),"data-validation":v||void 0,onKeyDown:e=>{e.key===`Escape`&&h?.getState().open&&(e.preventDefault(),h.hide()),s?.(e)},onMouseDown:e=>{e.target instanceof HTMLElement&&!e.target.closest(`button, input, [role='option']`)&&(e.preventDefault(),m.current?.focus()),c?.(e)},ref:e(p,l),...f,children:o})},A=({className:r,value:i,onRemove:a,locked:o=!1,onKeyDown:s,ref:c,...l})=>{let u=m(null);return v(`span`,{ref:e(u,c),role:`option`,"aria-selected":!0,tabIndex:-1,"data-slot":`multi-select-tag`,"data-locked":o||void 0,className:t(`cursor-default bg-neutral-500/10 border border-neutral-500/20 rounded-xs text-strong inline-flex items-center gap-1 pl-2 pr-0.5 py-0.5 text-sm font-normal`,`focus-visible:outline-hidden focus-visible:border-accent-600/50 focus-visible:ring-3 focus-visible:ring-focus-accent`,r),onKeyDown:e=>{if(o&&(e.key===`Backspace`||e.key===`Delete`)){e.preventDefault(),M(e.currentTarget);return}s?.(e)},...l,children:[i,_(`button`,{type:`button`,"aria-label":`Remove ${i}`,tabIndex:-1,"aria-disabled":o||void 0,className:t(`cursor-pointer text-strong/40 hover:bg-neutral-500/15 hover:text-strong rounded-xs p-0.5`,`aria-disabled:cursor-default aria-disabled:hover:bg-transparent aria-disabled:hover:text-strong/40`),onClick:e=>{if(e.stopPropagation(),o){let e=u.current;e&&M(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:_(n,{svg:o?_(S,{}):_(y,{weight:`bold`}),className:`size-4`})})]})},j={Root:O,Trigger:k,TagValues:({children:e,lockedValues:t=w})=>{let n=x.useComboboxContext(),r=x.useStoreState(n,`selectedValue`),i=(C(r)?r:void 0)??w,a=m(i);a.current=i;let o=d(E);o.current=t;let s=p(()=>new Set(t),[t]),c=m(new Map),{onInputKeyDownRef:l,inputRef:u}=d(D),h=m(new Set);f(()=>()=>{h.current.forEach(cancelAnimationFrame)},[]);let v=e=>{let t=requestAnimationFrame(()=>{h.current.delete(t),e()});h.current.add(t)},y=e=>{if(n){let t=n.getState().selectedValue;if(!C(t))return;n.setSelectedValue(t.filter(t=>t!==e))}},b=e=>{let t=a.current[e];if(t==null)return;let r=c.current.get(t);r&&(r.focus(),n?.show())},S=()=>{u.current?.focus()},T=(e,t)=>{let n=i[t];switch(e.key){case`ArrowLeft`:e.preventDefault(),t>0&&b(t-1);break;case`ArrowRight`:e.preventDefault(),t<i.length-1?b(t+1):S();break;case`Backspace`:case`Delete`:if(e.preventDefault(),n!=null){if(s.has(n)){let e=c.current.get(n);e&&M(e);break}if(y(n),e.key===`Backspace`)if(t>0){let e=t-1;v(()=>b(e))}else v(()=>{a.current.length>0?b(0):S()});else v(()=>{t<a.current.length?b(t):S()})}break;case`ArrowUp`:case`ArrowDown`:e.preventDefault(),S(),u.current?.dispatchEvent(new KeyboardEvent(`keydown`,{key:e.key,bubbles:!0,cancelable:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}));break;default:e.key.length===1&&!e.ctrlKey&&!e.metaKey&&S();break}};return l.current=e=>{if(e.key===`ArrowLeft`&&e.currentTarget.selectionStart===0&&e.currentTarget.selectionEnd===0&&i.length>0){e.preventDefault(),b(i.length-1);return}if(e.key===`Backspace`&&e.currentTarget.value===``&&i.length>0){let e=i[i.length-1];if(e!=null)if(o.current.includes(e)){let t=c.current.get(e);t&&M(t)}else y(e)}},_(g,{children:i.map((t,n)=>{let r={value:t,locked:s.has(t),onRemove:()=>{if(s.has(t)){let e=c.current.get(t);e&&M(e);return}y(t)},ref:e=>{e?c.current.set(t,e):c.current.delete(t)},onKeyDown:e=>T(e,n),onClick:()=>b(n)};return e?e(r):_(A,{...r},t)})})},Input:({className:n,onBlur:r,onChange:i,onFocus:a,onKeyDown:s,onValueChange:c,placeholder:l,ref:u,...f})=>{let p=x.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=d(D),g=d(o),v=x.useStoreState(p,`selectedValue`),y=((C(v)?v:void 0)?.length??0)>0;return _(x.Combobox,{autoSelect:!0,"data-slot":`multi-select-input`,className:t(`pointer-coarse:text-base min-w-20 flex-1 select-text border-0 bg-transparent text-sm outline-hidden`,`placeholder:select-none placeholder:text-placeholder`,n),onChange:e=>{c?.(e.target.value),i?.(e)},onKeyDown:e=>{m.current?.(e),s?.(e)},onBlur:e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.closest(`[data-slot="multi-select-tag"]`)&&p?.show(),r?.(e)},onFocus:e=>{p?.show(),a?.(e)},placeholder:y?void 0:l,ref:e(h,u),...f,...g?{"aria-describedby":g[`aria-describedby`],"aria-errormessage":g[`aria-errormessage`],"aria-invalid":g[`aria-invalid`],id:g.id,name:g.name}:void 0})},Tag:A,Content:({asChild:e=!1,backdrop:n=!1,children:i,className:a,modal:o=!0,portalElement:s,preventBodyScroll:c,ref:l,sameWidth:p=!0,unmountOnHide:m=!0,...g})=>{let v=d(T),[y,b]=h(!1);f(()=>{b(v.current?.closest(`[data-mantle-modal-content]`)!=null)},[v]);let S=u(()=>v.current?.getBoundingClientRect()??null,[v]),C=u(e=>typeof s==`function`?s(e):s??v.current?.closest(`[data-mantle-modal-content]`)??e.ownerDocument.body,[s,v]),w=u(e=>!(e.target instanceof Node&&v.current?.contains(e.target)),[v]);return _(x.ComboboxPopover,{"data-slot":`multi-select-content`,className:t(`border-popover bg-popover relative z-50 max-h-96 min-w-32 scrollbar overflow-y-scroll overflow-x-hidden overscroll-y-none rounded-md border shadow-md pt-1 pb-1 has-data-content-footer:pb-0 font-sans flex flex-col gap-px focus:outline-hidden`,a),backdrop:n,getAnchorRect:S,gutter:4,hideOnInteractOutside:w,modal:o,portalElement:C,preventBodyScroll:c??!y,ref:l,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,sameWidth:p,unmountOnHide:m,...g,children:i})},ContentFooter:({className:e,children:n,ref:r,...i})=>_(`div`,{ref:r,"data-slot":`multi-select-content-footer`,"data-content-footer":!0,className:t(`bg-popover sticky bottom-0 border-t border-popover`,e),...i,children:n}),Item:({asChild:e=!1,children:i,className:a,focusOnHover:o=!0,value:s,onClick:c,ref:l,...u})=>{let f=d(E),p=s!=null&&f.current.includes(s);return v(x.ComboboxItem,{"data-slot":`multi-select-item`,className:t(`relative mx-1 cursor-pointer rounded-md pl-2 pr-8 py-1.5 text-strong text-sm font-normal flex min-w-0 items-center gap-2`,`[[role=option]+&]:mt-px`,`data-active-item:bg-active-menu-item`,`aria-disabled:opacity-50`,`aria-selected:bg-selected-menu-item aria-selected:data-active-item:bg-active-selected-menu-item`,a),focusOnHover:o,onClick:e=>{if(p){e.preventDefault();return}c?.(e)},ref:l,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...u,children:[i,_(x.ComboboxItemCheck,{className:`absolute right-2 flex h-3.5 w-3.5 items-center justify-center`,children:_(n,{svg:_(b,{weight:`bold`}),className:`size-4 text-accent-600`})})]})},Group:({asChild:e=!1,children:t,ref:n,...i})=>_(x.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:n,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,...i,children:t}),GroupLabel:({asChild:e=!1,children:n,className:i,ref:a,...o})=>_(x.ComboboxGroupLabel,{"data-slot":`multi-select-group-label`,className:t(`text-muted px-2 py-1 text-xs font-medium`,i),ref:a,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,...o,children:n}),GroupDescription:({className:e,children:n,ref:r,...i})=>_(`p`,{"data-slot":`multi-select-group-description`,className:t(`text-muted px-2 pb-1 text-xs`,e),ref:r,...i,children:n}),Separator:({className:e,ref:n,...r})=>_(s,{"data-slot":`multi-select-separator`,ref:n,className:t(`my-1 w-auto`,e),...r}),Empty:({className:e,children:n,ref:r,...i})=>_(`div`,{"data-slot":`multi-select-empty`,className:t(`mx-1 text-muted px-2 py-6 text-center text-sm`,e),ref:r,role:`presentation`,...i,children:n})};function M(e){c()||e.animate([{transform:`translateX(0)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(-4px)`},{transform:`translateX(4px)`},{transform:`translateX(0)`}],{duration:300,easing:`ease-in-out`})}export{j as MultiSelect};
@@ -1,12 +1,74 @@
1
- import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
2
- import { o as WithValidation } from "./validation-7QeiTFwl.js";
1
+ import { n as WithAsChild } from "./as-child-D23mGo4f.js";
2
+ import { o as WithValidation } from "./field-7QeiTFwl.js";
3
3
  import { ComponentProps, ReactNode } from "react";
4
4
  import { OTPInput, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
5
5
  //#region src/components/otp-input/otp-input.d.ts
6
6
  type OtpInputRootProps = Omit<ComponentProps<typeof OTPInput>, "render" | "children"> & WithValidation & {
7
7
  children?: ReactNode;
8
8
  };
9
+ /**
10
+ * The root of the OTP input. Renders an accessible single hidden input that
11
+ * captures keystrokes, paste events, and autofill, and exposes per-slot state
12
+ * (active, char, fake caret) to descendant `OtpInput.Slot` parts via context.
13
+ *
14
+ * Wraps the `input-otp` library by Guilherme Rodz.
15
+ *
16
+ * Pass `validation="error"` (or `"success"` / `"warning"`) to recolor each
17
+ * group's outer borders and the active focus ring with the matching validation hue.
18
+ * `validation="error"` also sets `aria-invalid` on the underlying input so
19
+ * assistive tech announces the failure state.
20
+ *
21
+ * When composing with `Field.Item`, wrap `OtpInput.Root` in `Field.Control`.
22
+ * `Field.Control` flows the generated `id`, `aria-invalid`, `aria-describedby`,
23
+ * and `aria-errormessage` through to the underlying focusable input via
24
+ * `FieldControlContext`.
25
+ *
26
+ * @see https://mantle.ngrok.com/components/forms/otp-input
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * <OtpInput.Root maxLength={6}>
31
+ * <OtpInput.Group>
32
+ * <OtpInput.Slot index={0} />
33
+ * <OtpInput.Slot index={1} />
34
+ * <OtpInput.Slot index={2} />
35
+ * </OtpInput.Group>
36
+ * <OtpInput.Separator />
37
+ * <OtpInput.Group>
38
+ * <OtpInput.Slot index={3} />
39
+ * <OtpInput.Slot index={4} />
40
+ * <OtpInput.Slot index={5} />
41
+ * </OtpInput.Group>
42
+ * </OtpInput.Root>
43
+ * ```
44
+ */
45
+ declare const Root: ({ "aria-invalid": ariaInvalid, children, className, containerClassName, ref, validation: _validation, ...props }: OtpInputRootProps) => import("react").JSX.Element;
9
46
  type OtpInputGroupProps = ComponentProps<"div"> & WithAsChild;
47
+ /**
48
+ * Groups one or more `OtpInput.Slot` parts into a visually-connected segment.
49
+ * Slots inside a group share rounded corners on the outer edges and join with
50
+ * shared borders between adjacent slots.
51
+ *
52
+ * @see https://mantle.ngrok.com/components/forms/otp-input
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <OtpInput.Root maxLength={6}>
57
+ * <OtpInput.Group>
58
+ * <OtpInput.Slot index={0} />
59
+ * <OtpInput.Slot index={1} />
60
+ * <OtpInput.Slot index={2} />
61
+ * </OtpInput.Group>
62
+ * <OtpInput.Separator />
63
+ * <OtpInput.Group>
64
+ * <OtpInput.Slot index={3} />
65
+ * <OtpInput.Slot index={4} />
66
+ * <OtpInput.Slot index={5} />
67
+ * </OtpInput.Group>
68
+ * </OtpInput.Root>
69
+ * ```
70
+ */
71
+ declare const Group: ({ asChild, children, className, ref, ...props }: OtpInputGroupProps) => import("react").JSX.Element;
10
72
  type OtpInputSlotProps = ComponentProps<"div"> & {
11
73
  /**
12
74
  * The zero-based index of the character slot to render. Must be a valid
@@ -14,6 +76,32 @@ type OtpInputSlotProps = ComponentProps<"div"> & {
14
76
  */
15
77
  index: number;
16
78
  };
79
+ /**
80
+ * Renders a single character slot for the OTP input. Reads its display state
81
+ * (the typed character, active/focused state, and fake caret position) from
82
+ * the nearest `OtpInput.Root` via context — so this part must always be
83
+ * rendered inside an `OtpInput.Root`.
84
+ *
85
+ * @see https://mantle.ngrok.com/components/forms/otp-input
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * <OtpInput.Root maxLength={6}>
90
+ * <OtpInput.Group>
91
+ * <OtpInput.Slot index={0} />
92
+ * <OtpInput.Slot index={1} />
93
+ * <OtpInput.Slot index={2} />
94
+ * </OtpInput.Group>
95
+ * <OtpInput.Separator />
96
+ * <OtpInput.Group>
97
+ * <OtpInput.Slot index={3} />
98
+ * <OtpInput.Slot index={4} />
99
+ * <OtpInput.Slot index={5} />
100
+ * </OtpInput.Group>
101
+ * </OtpInput.Root>
102
+ * ```
103
+ */
104
+ declare const OtpInputSlotImpl: ({ className, index, ref, ...props }: OtpInputSlotProps) => import("react").JSX.Element;
17
105
  type OtpInputSeparatorProps = ComponentProps<"div"> & WithAsChild & {
18
106
  /**
19
107
  * If `true`, the separator will be rendered with `role="separator"` so
@@ -26,6 +114,30 @@ type OtpInputSeparatorProps = ComponentProps<"div"> & WithAsChild & {
26
114
  */
27
115
  semantic?: boolean;
28
116
  };
117
+ /**
118
+ * A visual separator between two `OtpInput.Group` segments. Renders a minus
119
+ * icon by default; pass `children` to override the visual.
120
+ *
121
+ * @see https://mantle.ngrok.com/components/forms/otp-input
122
+ *
123
+ * @example
124
+ * ```tsx
125
+ * <OtpInput.Root maxLength={6}>
126
+ * <OtpInput.Group>
127
+ * <OtpInput.Slot index={0} />
128
+ * <OtpInput.Slot index={1} />
129
+ * <OtpInput.Slot index={2} />
130
+ * </OtpInput.Group>
131
+ * <OtpInput.Separator />
132
+ * <OtpInput.Group>
133
+ * <OtpInput.Slot index={3} />
134
+ * <OtpInput.Slot index={4} />
135
+ * <OtpInput.Slot index={5} />
136
+ * </OtpInput.Group>
137
+ * </OtpInput.Root>
138
+ * ```
139
+ */
140
+ declare const Separator: ({ asChild, children, className, ref, semantic, ...props }: OtpInputSeparatorProps) => import("react").JSX.Element;
29
141
  /**
30
142
  * Compound component for capturing one-time passcodes (OTP). Combines a
31
143
  * single hidden input (handling paste, autofill, and IME) with a row of
@@ -86,7 +198,7 @@ declare const OtpInput: {
86
198
  * </OtpInput.Root>
87
199
  * ```
88
200
  */
89
- readonly Root: import("react").ForwardRefExoticComponent<Omit<OtpInputRootProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
201
+ readonly Root: typeof Root;
90
202
  /**
91
203
  * Groups one or more `OtpInput.Slot` parts into a visually-connected
92
204
  * segment with shared rounded corners and joined borders.
@@ -110,7 +222,7 @@ declare const OtpInput: {
110
222
  * </OtpInput.Root>
111
223
  * ```
112
224
  */
113
- readonly Group: import("react").ForwardRefExoticComponent<Omit<OtpInputGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
225
+ readonly Group: typeof Group;
114
226
  /**
115
227
  * A single character slot. Must be rendered inside an `OtpInput.Root`.
116
228
  * Reads its character, active state, and fake caret position from the
@@ -135,7 +247,7 @@ declare const OtpInput: {
135
247
  * </OtpInput.Root>
136
248
  * ```
137
249
  */
138
- readonly Slot: import("react").ForwardRefExoticComponent<Omit<OtpInputSlotProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
250
+ readonly Slot: typeof OtpInputSlotImpl;
139
251
  /**
140
252
  * A visual separator between two `OtpInput.Group` segments. Renders a
141
253
  * minus icon by default; pass `children` to override.
@@ -159,7 +271,7 @@ declare const OtpInput: {
159
271
  * </OtpInput.Root>
160
272
  * ```
161
273
  */
162
- readonly Separator: import("react").ForwardRefExoticComponent<Omit<OtpInputSeparatorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
274
+ readonly Separator: typeof Separator;
163
275
  };
164
276
  //#endregion
165
277
  export { OtpInput, REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
package/dist/otp-input.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DmPrjM7N.js";import{t as n}from"./types-D85fCNV3.js";import{a as r,r as i}from"./validation-Bpptk_9t.js";import{t as a}from"./field-context-BR01g789.js";import{forwardRef as o,useContext as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{MinusIcon as u}from"@phosphor-icons/react/Minus";import{OTPInput as d,OTPInputContext as f,REGEXP_ONLY_CHARS as p,REGEXP_ONLY_DIGITS as m,REGEXP_ONLY_DIGITS_AND_CHARS as h}from"input-otp";const g={error:`danger`,success:`success`,warning:`warning`},_=e=>`var(--color-${e}-600)`,v=e=>`var(--ring-color-focus-${e})`,y=({totalActive:e,total:t})=>e===0?`idle`:e===1?`caret`:e===t?`all`:`range`,b=({children:e,validation:t})=>{let r=s(f),i=r.slots.length,a=r.slots.reduce((e,t)=>e+ +!!t.isActive,0),o=y({totalActive:a,total:i}),l=t?g[t]:void 0,u=l?n({"--otp-validation-border":_(l),"--otp-validation-ring":v(l)}):void 0;return c(`div`,{className:`group/otp contents`,"data-otp-state":o,"data-validation":t||void 0,style:u,children:e})},x=o(({"aria-invalid":t,children:n,className:o,containerClassName:l,validation:u,...f},p)=>{let m=r(),h=s(a),{ariaInvalid:g,validation:_}=i({"aria-invalid":t,defaultAriaInvalid:!1,validation:u??m});return c(d,{ref:p,"aria-invalid":g,"data-slot":`otp-input`,containerClassName:e(`flex items-center gap-2 has-disabled:opacity-50`,l),className:e(`disabled:cursor-not-allowed`,o),...f,...h?{"aria-describedby":h[`aria-describedby`],"aria-errormessage":h[`aria-errormessage`],id:h.id,name:h.name}:void 0,children:c(b,{validation:_,children:n})})});x.displayName=`OtpInput`;const S=o(({asChild:n,children:r,className:i,...a},o)=>c(n?t:`div`,{ref:o,"data-slot":`otp-input-group`,className:e(`relative flex items-center rounded-md`,`has-[[data-active]~[data-active]]:ring-focus-accent has-[[data-active]~[data-active]]:ring-4`,`group-data-validation/otp:has-[[data-active]~[data-active]]:ring-(--otp-validation-ring)`,i),...a,children:r}));S.displayName=`OtpInputGroup`;const C=o(({className:t,index:n,...r},i)=>{let a=s(f).slots[n],o=a?.char??null,u=a?.hasFakeCaret??!1;return l(`div`,{ref:i,"data-slot":`otp-input-slot`,"data-active":a?.isActive??!1?``:void 0,className:e(`border-form bg-form text-strong relative flex h-10 w-10 items-center justify-center border-y border-r text-sm shadow-sm outline-hidden transition-all duration-150 ease-out`,`first:rounded-l-md first:border-l last:rounded-r-md`,`[&:has(+[data-active])]:group-data-[otp-state=caret]/otp:border-r-transparent`,`data-active:group-data-[otp-state=caret]/otp:border-accent-600`,`data-active:group-data-[otp-state=caret]/otp:border-l`,`data-active:group-data-[otp-state=caret]/otp:ring-focus-accent`,`data-active:group-data-[otp-state=caret]/otp:z-20`,`data-active:group-data-[otp-state=caret]/otp:ring-4`,`group-data-[otp-state=all]/otp:border-accent-600`,`group-data-validation/otp:border-y-(--otp-validation-border)`,`group-data-validation/otp:first:border-l-(--otp-validation-border)`,`group-data-validation/otp:last:border-r-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:border-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:ring-(--otp-validation-ring)`,`group-data-validation/otp:group-data-[otp-state=all]/otp:border-(--otp-validation-border)`,t),...r,children:[o,u&&c(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:c(`div`,{className:`bg-strong h-4 w-px animate-pulse`})})]})});C.displayName=`OtpInputSlot`;const w=o(({asChild:n,children:r,className:i,semantic:a=!1,...o},s)=>{let l=n?t:`div`,d=a?{role:`separator`}:{"aria-hidden":!0,role:`none`};return c(l,{ref:s,"data-slot":`otp-input-separator`,className:e(`text-separator flex items-center`,i),...d,...o,children:r??c(u,{weight:`bold`})})});w.displayName=`OtpInputSeparator`;const T={Root:x,Group:S,Slot:C,Separator:w};export{T as OtpInput,p as REGEXP_ONLY_CHARS,m as REGEXP_ONLY_DIGITS,h as REGEXP_ONLY_DIGITS_AND_CHARS};
1
+ import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-CDk0Bb9z.js";import{t as n}from"./types-D85fCNV3.js";import{a as r,r as i}from"./field-Bpptk_9t.js";import{t as a}from"./field-B1wqeZr4.js";import{useContext as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{MinusIcon as l}from"@phosphor-icons/react/Minus";import{OTPInput as u,OTPInputContext as d,REGEXP_ONLY_CHARS as f,REGEXP_ONLY_DIGITS as p,REGEXP_ONLY_DIGITS_AND_CHARS as m}from"input-otp";const h={error:`danger`,success:`success`,warning:`warning`},g=e=>`var(--color-${e}-600)`,_=e=>`var(--ring-color-focus-${e})`,v=({totalActive:e,total:t})=>e===0?`idle`:e===1?`caret`:e===t?`all`:`range`,y=({children:e,validation:t})=>{let r=o(d),i=r.slots.length,a=r.slots.reduce((e,t)=>e+ +!!t.isActive,0),c=v({totalActive:a,total:i}),l=t?h[t]:void 0,u=l?n({"--otp-validation-border":g(l),"--otp-validation-ring":_(l)}):void 0;return s(`div`,{className:`group/otp contents`,"data-otp-state":c,"data-validation":t||void 0,style:u,children:e})},b={Root:({"aria-invalid":t,children:n,className:c,containerClassName:l,ref:d,validation:f,...p})=>{let m=r(),h=o(a),{ariaInvalid:g,validation:_}=i({"aria-invalid":t,defaultAriaInvalid:!1,validation:f??m});return s(u,{ref:d,"aria-invalid":g,"data-slot":`otp-input`,containerClassName:e(`flex items-center gap-2 has-disabled:opacity-50`,l),className:e(`disabled:cursor-not-allowed`,c),...p,...h?{"aria-describedby":h[`aria-describedby`],"aria-errormessage":h[`aria-errormessage`],id:h.id,name:h.name}:void 0,children:s(y,{validation:_,children:n})})},Group:({asChild:n,children:r,className:i,ref:a,...o})=>s(n?t:`div`,{ref:a,"data-slot":`otp-input-group`,className:e(`relative flex items-center rounded-md`,`has-[[data-active]~[data-active]]:ring-focus-accent has-[[data-active]~[data-active]]:ring-4`,`group-data-validation/otp:has-[[data-active]~[data-active]]:ring-(--otp-validation-ring)`,i),...o,children:r}),Slot:({className:t,index:n,ref:r,...i})=>{let a=o(d).slots[n],l=a?.char??null,u=a?.hasFakeCaret??!1;return c(`div`,{ref:r,"data-slot":`otp-input-slot`,"data-active":a?.isActive??!1?``:void 0,className:e(`border-form bg-form text-strong relative flex h-10 w-10 items-center justify-center border-y border-r text-sm shadow-sm outline-hidden transition-all duration-150 ease-out`,`first:rounded-l-md first:border-l last:rounded-r-md`,`[&:has(+[data-active])]:group-data-[otp-state=caret]/otp:border-r-transparent`,`data-active:group-data-[otp-state=caret]/otp:border-accent-600`,`data-active:group-data-[otp-state=caret]/otp:border-l`,`data-active:group-data-[otp-state=caret]/otp:ring-focus-accent`,`data-active:group-data-[otp-state=caret]/otp:z-20`,`data-active:group-data-[otp-state=caret]/otp:ring-4`,`group-data-[otp-state=all]/otp:border-accent-600`,`group-data-validation/otp:border-y-(--otp-validation-border)`,`group-data-validation/otp:first:border-l-(--otp-validation-border)`,`group-data-validation/otp:last:border-r-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:border-(--otp-validation-border)`,`group-data-validation/otp:data-active:group-data-[otp-state=caret]/otp:ring-(--otp-validation-ring)`,`group-data-validation/otp:group-data-[otp-state=all]/otp:border-(--otp-validation-border)`,t),...i,children:[l,u&&s(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:s(`div`,{className:`bg-strong h-4 w-px animate-pulse`})})]})},Separator:({asChild:n,children:r,className:i,ref:a,semantic:o=!1,...c})=>{let u=n?t:`div`,d=o?{role:`separator`}:{"aria-hidden":!0,role:`none`};return s(u,{ref:a,"data-slot":`otp-input-separator`,className:e(`text-separator flex items-center`,i),...d,...c,children:r??s(l,{weight:`bold`})})}};export{b as OtpInput,f as REGEXP_ONLY_CHARS,p as REGEXP_ONLY_DIGITS,m as REGEXP_ONLY_DIGITS_AND_CHARS};