@ngrok/mantle 0.77.0 → 0.79.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.
- package/dist/accordion.d.ts +63 -21
- package/dist/accordion.js +1 -1
- package/dist/agent.json +4 -1
- package/dist/alert-dialog.d.ts +102 -70
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +39 -39
- package/dist/alert.js +1 -1
- package/dist/{anchor-BtgEJoPN.js → anchor-C_tjSVy6.js} +1 -1
- package/dist/anchor.d.ts +3 -4
- package/dist/anchor.js +1 -1
- package/dist/{as-child-uN_018tj.d.ts → as-child-CYEVu1WY.d.ts} +0 -7
- package/dist/badge.d.ts +5 -56
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.d.ts +212 -0
- package/dist/breadcrumb.js +1 -0
- package/dist/browser-only.d.ts +2 -6
- package/dist/{button-CERx95KE.js → button-5t6-JS_I.js} +1 -1
- package/dist/button-ClC60Nzg.js +1 -0
- package/dist/button-DcXOWUYo.d.ts +131 -0
- package/dist/button.d.ts +6 -4
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +2 -8
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +8 -8
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +147 -0
- package/dist/centered-layout.js +1 -0
- package/dist/checkbox-DJ2xl7Rc.js +1 -0
- package/dist/checkbox.d.ts +9 -11
- package/dist/checkbox.js +1 -1
- package/dist/{choice-D6S38dPs.js → choice-DOdyNzFC.js} +1 -1
- package/dist/choice.d.ts +16 -14
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +5 -17
- package/dist/code-block.js +1 -1
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/code.d.ts +4 -5
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +40 -19
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +71 -49
- package/dist/command.js +1 -1
- package/dist/cx-IiQEAKf5.js +1 -0
- package/dist/cx.js +1 -1
- package/dist/data-slot-CChfb_cv.d.ts +17 -0
- package/dist/data-table.d.ts +77 -137
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +7 -7
- package/dist/description-list.js +1 -1
- package/dist/{dialog-uyJcNks7.js → dialog-ZCgG41hx.js} +1 -1
- package/dist/dialog.d.ts +213 -88
- package/dist/dialog.js +1 -1
- package/dist/{direction-CcTY0FmA.d.ts → direction-BjU0bPST.d.ts} +1 -1
- package/dist/{dropdown-menu-OEuW4GLp.js → dropdown-menu-ByUQkAvJ.js} +1 -1
- package/dist/{dropdown-menu-CADgs9gz.d.ts → dropdown-menu-DMNw8ItM.d.ts} +26 -27
- package/dist/dropdown-menu.d.ts +2 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +139 -59
- package/dist/empty.js +1 -1
- package/dist/{field-context-4k1kI7Bo.js → field-context-BR01g789.js} +1 -1
- package/dist/field.d.ts +41 -36
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +2 -9
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +13 -15
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +42 -20
- package/dist/hover-card.js +1 -1
- package/dist/icon-CDtYjF_H.js +1 -0
- package/dist/{icon-n49kOh4_.d.ts → icon-Cevjo93X.d.ts} +2 -3
- package/dist/{icon-button-D7hs6bX2.d.ts → icon-button-B7uEj1qq.d.ts} +73 -11
- package/dist/icon-button-DV2-GZHf.js +1 -0
- package/dist/icon.d.ts +3 -3
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +7 -19
- package/dist/icons.js +1 -1
- package/dist/{in-view-bItE1fkG.d.ts → in-view-nkSOdED2.d.ts} +1 -6
- package/dist/{index-CTU6apE6.d.ts → index-BivvYYs-.d.ts} +8 -7
- package/dist/{index-Bed_XLWa.d.ts → index-D47aqlpz.d.ts} +3 -2
- package/dist/index-DZRbVkZa.d.ts +1 -0
- package/dist/index-Rv8RL7xy.d.ts +25 -0
- package/dist/{input-B3TS9yAP.js → input-Ct1YOqSy.js} +1 -1
- package/dist/input.d.ts +10 -11
- package/dist/input.js +1 -1
- package/dist/intents-DdSKSj1c.d.ts +28 -0
- package/dist/{kbd-D6k4Dnrf.js → kbd-K8iaZ-Ti.js} +1 -1
- package/dist/kbd.d.ts +3 -8
- package/dist/kbd.js +1 -1
- package/dist/{label-BLXfnQmn.js → label-BMlHW_2D.js} +1 -1
- package/dist/{label-PY0qM0G5.d.ts → label-v2-bv98k.d.ts} +1 -1
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/list.d.ts +18 -60
- package/dist/list.js +1 -1
- package/dist/llms.txt +4 -1
- package/dist/main.d.ts +4 -27
- package/dist/main.js +1 -1
- package/dist/mantle.css +6 -6
- package/dist/media-object.d.ts +6 -7
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +80 -33
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +7 -8
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +11 -22
- package/dist/pagination.js +1 -1
- package/dist/{popover-Bq52EC7X.js → popover-D5WxxnBY.js} +1 -1
- package/dist/popover.d.ts +17 -18
- package/dist/popover.js +1 -1
- package/dist/{primitive-FoWela9a.d.ts → primitive-C64-m48O.d.ts} +0 -1
- package/dist/{primitive-BuVqb6zf.js → primitive-M-kZdNIS.js} +1 -1
- package/dist/progress.d.ts +55 -46
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +10 -9
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +71 -60
- package/dist/radio-group.js +1 -1
- package/dist/{resolve-pre-rendered-props-DxJ9-DAl.d.ts → resolve-pre-rendered-props-B6OlZrSI.d.ts} +13 -26
- package/dist/{resolve-pre-rendered-props-DwIF_M_K.js → resolve-pre-rendered-props-C3e5Auo3.js} +1 -1
- package/dist/sandboxed-on-click.d.ts +4 -8
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/{select-BUGOJMER.d.ts → select-Bwt2YduR.d.ts} +11 -12
- package/dist/{select-Bxq_N-_o.js → select-D-5u0Blc.js} +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +160 -146
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-CqohKk4z.js → separator-kBnnv3Cw.js} +1 -1
- package/dist/separator.d.ts +6 -37
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +302 -89
- package/dist/sheet.js +1 -1
- package/dist/sizes-BCoI4bhP.d.ts +29 -0
- package/dist/skeleton-Bu3tgNcW.js +1 -0
- package/dist/skeleton.d.ts +2 -2
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +4 -34
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slider.d.ts +2 -21
- package/dist/slider.js +1 -1
- package/dist/slot-DmPrjM7N.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/split-button.d.ts +21 -13
- package/dist/split-button.js +1 -1
- package/dist/{svg-only-f6ToFLH0.d.ts → svg-only-BFeFS1aa.d.ts} +2 -3
- package/dist/{svg-only-CSOaF1tL.js → svg-only-DDx6FtJd.js} +1 -1
- package/dist/switch.d.ts +4 -5
- package/dist/switch.js +1 -1
- package/dist/{table-CAitdL78.js → table-CPH2md2-.js} +1 -1
- package/dist/{table-BWD9IlIN.d.ts → table-CwFHXC-G.d.ts} +10 -10
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +29 -15
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +2 -3
- package/dist/text-area.js +1 -1
- package/dist/theme-D8kZCOzM.js +1 -0
- package/dist/theme-provider-Djj_jBo6.js +1 -0
- package/dist/theme-switcher.d.ts +53 -0
- package/dist/theme-switcher.js +1 -0
- package/dist/theme.d.ts +15 -101
- package/dist/theme.js +1 -1
- package/dist/toast-D3ntBmn4.js +1 -0
- package/dist/toast.d.ts +32 -50
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +16 -50
- package/dist/tooltip.js +1 -1
- package/dist/{types-CTam1uIW.d.ts → types-C19IR7jf.d.ts} +1 -0
- package/dist/{types-BvUzforF.d.ts → types-D1RY5Tcj.d.ts} +0 -1
- package/dist/types.d.ts +3 -3
- package/dist/use-prefers-reduced-motion-CagaNRgm.js +1 -0
- package/dist/utils.d.ts +2 -3
- package/dist/{validation-xyX_6kph.d.ts → validation-7QeiTFwl.d.ts} +3 -12
- package/dist/{validation-DCyx-ceH.js → validation-Bpptk_9t.js} +1 -1
- package/dist/{virtual-PBNiHjMK.js → virtual-DZMBu7Ch.js} +1 -1
- package/dist/well.d.ts +3 -3
- package/dist/well.js +1 -1
- package/dist/{with-style-props-CyImx7vd.d.ts → with-style-props-Dq5Vntqy.d.ts} +0 -1
- package/package.json +17 -14
- package/dist/button-C9GW9nAr.js +0 -1
- package/dist/button-mfYak6Rx.d.ts +0 -71
- package/dist/checkbox-Apow0ipK.js +0 -1
- package/dist/cx-C1UYP5We.js +0 -1
- package/dist/icon-SUx16Sl3.js +0 -1
- package/dist/icon-button-DiX9iZ9n.js +0 -1
- package/dist/index-CJbKEKr2.d.ts +0 -20
- package/dist/slot-DT_E5BQx.js +0 -1
- package/dist/theme-provider-C5XYi2-H.js +0 -1
- package/dist/toast-CZBWjXcP.js +0 -1
- package/dist/use-prefers-reduced-motion-DBqNw1wB.js +0 -1
package/dist/list.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as WithAsChild } from "./as-child-
|
|
1
|
+
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
2
|
import { CSSProperties, ComponentProps, ReactNode, Ref } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/components/list/primitive.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* ARIA semantics for a {@link Root} / `VirtualRoot` collection and its
|
|
@@ -16,7 +15,7 @@ import { CSSProperties, ComponentProps, ReactNode, Ref } from "react";
|
|
|
16
15
|
* `SelectableList`): a single tab stop with `aria-activedescendant`
|
|
17
16
|
* navigation that works across a virtualized window.
|
|
18
17
|
*
|
|
19
|
-
* @see https://mantle.ngrok.com/components/list
|
|
18
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
20
19
|
*
|
|
21
20
|
* @example
|
|
22
21
|
* ```tsx
|
|
@@ -28,14 +27,13 @@ import { CSSProperties, ComponentProps, ReactNode, Ref } from "react";
|
|
|
28
27
|
* ```
|
|
29
28
|
*/
|
|
30
29
|
type ListSemantics = "list" | "grid";
|
|
31
|
-
/** Shared collection semantics, provided by {@link Root} / `VirtualRoot` and read by every {@link Item}. */
|
|
32
30
|
/**
|
|
33
31
|
* Props for {@link Root} / `VirtualRoot`. Standard `<div>` props (on the scroll
|
|
34
32
|
* viewport) plus the collection `semantics` and the grid activation callback;
|
|
35
33
|
* `aria-label` / `aria-labelledby` name the inner collection element, and
|
|
36
34
|
* `children` are the composed {@link Item}s.
|
|
37
35
|
*
|
|
38
|
-
* @see https://mantle.ngrok.com/components/list
|
|
36
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
39
37
|
*
|
|
40
38
|
* @example
|
|
41
39
|
* ```tsx
|
|
@@ -47,7 +45,8 @@ type ListSemantics = "list" | "grid";
|
|
|
47
45
|
* ```
|
|
48
46
|
*/
|
|
49
47
|
type ListRootProps$1 = ComponentProps<"div"> & {
|
|
50
|
-
/** ARIA semantics for the collection and its rows. Defaults to `"list"`. */
|
|
48
|
+
/** ARIA semantics for the collection and its rows. Defaults to `"list"`. */
|
|
49
|
+
semantics?: ListSemantics;
|
|
51
50
|
/**
|
|
52
51
|
* Called with the active row's index when it is activated under `"grid"`
|
|
53
52
|
* semantics — by keyboard (`Space` / `Enter`) or by a bare click anywhere on
|
|
@@ -71,20 +70,13 @@ type ListRootProps$1 = ComponentProps<"div"> & {
|
|
|
71
70
|
*/
|
|
72
71
|
isItemDisabled?: (index: number) => boolean;
|
|
73
72
|
};
|
|
74
|
-
/**
|
|
75
|
-
* Whether a composed row child is disabled — read from the `disabled` prop it
|
|
76
|
-
* declares (e.g. `<Item disabled>`). The default keyboard-navigation disabled
|
|
77
|
-
* source (see `ListRootProps["isItemDisabled"]`), derived from the row *elements*
|
|
78
|
-
* (not the live DOM) so it works for windowed rows that aren't mounted. Safe
|
|
79
|
-
* over an arbitrary node: non-elements and rows without the prop read as enabled.
|
|
80
|
-
*/
|
|
81
73
|
//#endregion
|
|
82
74
|
//#region src/components/list/virtual.d.ts
|
|
83
75
|
/**
|
|
84
76
|
* Props for {@link VirtualRoot}. The same surface as the plain `Root` plus the
|
|
85
77
|
* virtualizer knobs.
|
|
86
78
|
*
|
|
87
|
-
* @see https://mantle.ngrok.com/components/list
|
|
79
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
88
80
|
*
|
|
89
81
|
* @example
|
|
90
82
|
* ```tsx
|
|
@@ -96,45 +88,11 @@ type ListRootProps$1 = ComponentProps<"div"> & {
|
|
|
96
88
|
* ```
|
|
97
89
|
*/
|
|
98
90
|
type VirtualRootProps = ListRootProps$1 & {
|
|
99
|
-
/** Estimated item height in px, used to seed the virtualizer before items are measured. */
|
|
91
|
+
/** Estimated item height in px, used to seed the virtualizer before items are measured. */
|
|
92
|
+
estimateItemHeight?: number;
|
|
93
|
+
/** Rows rendered beyond the visible window on each side. The buffer keeps the active row mounted for `aria-activedescendant`. */
|
|
100
94
|
overscan?: number;
|
|
101
95
|
};
|
|
102
|
-
/**
|
|
103
|
-
* The windowed counterpart to `Root`: renders only the visible slice of its
|
|
104
|
-
* composed `Item` children via `@tanstack/react-virtual`, sharing the plain
|
|
105
|
-
* shell's chrome, semantics, and — for a grid — `aria-activedescendant`
|
|
106
|
-
* keyboard navigation. Authored identically to `Root` (you still compose `<Item>`
|
|
107
|
-
* children), so swapping in virtualization never changes the call site. This
|
|
108
|
-
* module is the sole importer of `@tanstack/react-virtual`; because the `List`
|
|
109
|
-
* namespace (and both higher-level list components) re-export `VirtualRoot`,
|
|
110
|
-
* the dependency ships with every list entrypoint — it is small (~a few kB
|
|
111
|
-
* gzipped) and does no windowing work until a `VirtualRoot` actually renders.
|
|
112
|
-
*
|
|
113
|
-
* Grid navigation works across the **full** collection, not just the window:
|
|
114
|
-
* arrow keys move an active index over all rows, `scrollToIndex` reveals + mounts
|
|
115
|
-
* the active row, and focus stays on the collection (never on a row) so it
|
|
116
|
-
* survives windowing. Each windowed row still carries its position —
|
|
117
|
-
* `aria-posinset` / `aria-setsize` on a listitem, `aria-rowindex` (with
|
|
118
|
-
* `aria-rowcount` on the grid) on a grid row. `overscan` keeps the active row
|
|
119
|
-
* mounted through nearby scrolling; if it is mouse-scrolled fully out of the
|
|
120
|
-
* window, the `aria-activedescendant` reference is dropped until keyboard
|
|
121
|
-
* navigation re-mounts it. **Bound the height** so the virtualizer has a
|
|
122
|
-
* viewport to measure.
|
|
123
|
-
*
|
|
124
|
-
* @see https://mantle.ngrok.com/components/list
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```tsx
|
|
128
|
-
* <VirtualRoot semantics="grid" aria-label="Access keys" className="max-h-80" onActivate={toggleByIndex}>
|
|
129
|
-
* {keys.map((key) => (
|
|
130
|
-
* <Item key={key.id} selected={selected.has(key.id)}>
|
|
131
|
-
* <div role="gridcell"><Checkbox checked={selected.has(key.id)} tabIndex={-1} /></div>
|
|
132
|
-
* <div role="gridcell">{key.name}</div>
|
|
133
|
-
* </Item>
|
|
134
|
-
* ))}
|
|
135
|
-
* </VirtualRoot>
|
|
136
|
-
* ```
|
|
137
|
-
*/
|
|
138
96
|
//#endregion
|
|
139
97
|
//#region src/components/list/list.d.ts
|
|
140
98
|
/**
|
|
@@ -142,7 +100,7 @@ type VirtualRootProps = ListRootProps$1 & {
|
|
|
142
100
|
* `semantics` (a `List` is always a `role="list"`) and the grid-only
|
|
143
101
|
* `onActivate` / `itemId` knobs (inert under list semantics).
|
|
144
102
|
*
|
|
145
|
-
* @see https://mantle.ngrok.com/components/list
|
|
103
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
146
104
|
*
|
|
147
105
|
* @example
|
|
148
106
|
* ```tsx
|
|
@@ -160,7 +118,7 @@ type ListRootProps = Omit<ListRootProps$1, "semantics" | "onActivate" | "itemId"
|
|
|
160
118
|
* `VirtualRoot` props (viewport props plus `estimateItemHeight` / `overscan`),
|
|
161
119
|
* minus `semantics` and the grid-only `onActivate` / `itemId` knobs.
|
|
162
120
|
*
|
|
163
|
-
* @see https://mantle.ngrok.com/components/list
|
|
121
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
164
122
|
*
|
|
165
123
|
* @example
|
|
166
124
|
* ```tsx
|
|
@@ -177,7 +135,7 @@ type ListVirtualRootProps = Omit<VirtualRootProps, "semantics" | "onActivate" |
|
|
|
177
135
|
* Props for `List.Item`. Extends `<button>` props (minus `type`, which is fixed
|
|
178
136
|
* to `"button"`) with `asChild` and the optional `current` accent.
|
|
179
137
|
*
|
|
180
|
-
* @see https://mantle.ngrok.com/components/list
|
|
138
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
181
139
|
*
|
|
182
140
|
* @example
|
|
183
141
|
* ```tsx
|
|
@@ -213,7 +171,7 @@ type ListItemProps = Omit<ComponentProps<"button">, "type"> & WithAsChild & {
|
|
|
213
171
|
* also move focus between them — the focused item tints like hover instead of
|
|
214
172
|
* drawing a focus ring.
|
|
215
173
|
*
|
|
216
|
-
* @see https://mantle.ngrok.com/components/list
|
|
174
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
217
175
|
*
|
|
218
176
|
* @example
|
|
219
177
|
* Composition:
|
|
@@ -243,7 +201,7 @@ declare const List: {
|
|
|
243
201
|
* The scrollable container (non-virtualized). Give it an `aria-label` and
|
|
244
202
|
* bound its height. Compose `Item` children.
|
|
245
203
|
*
|
|
246
|
-
* @see https://mantle.ngrok.com/components/list
|
|
204
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
247
205
|
*
|
|
248
206
|
* @example
|
|
249
207
|
* ```tsx
|
|
@@ -262,7 +220,7 @@ declare const List: {
|
|
|
262
220
|
* The virtualized container — windows the same `Item` children. Opt in for
|
|
263
221
|
* long lists; authored identically to `Root`.
|
|
264
222
|
*
|
|
265
|
-
* @see https://mantle.ngrok.com/components/list
|
|
223
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
266
224
|
*
|
|
267
225
|
* @example
|
|
268
226
|
* ```tsx
|
|
@@ -281,7 +239,7 @@ declare const List: {
|
|
|
281
239
|
* A clickable item — a `<button>` by default, or your own element via
|
|
282
240
|
* `asChild` (e.g. an `<a>`). Optional `current` gives the accent treatment.
|
|
283
241
|
*
|
|
284
|
-
* @see https://mantle.ngrok.com/components/list
|
|
242
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
285
243
|
*
|
|
286
244
|
* @example
|
|
287
245
|
* ```tsx
|
|
@@ -299,7 +257,7 @@ declare const List: {
|
|
|
299
257
|
/**
|
|
300
258
|
* Emphasized title line inside a `List.Item`.
|
|
301
259
|
*
|
|
302
|
-
* @see https://mantle.ngrok.com/components/list
|
|
260
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
303
261
|
*
|
|
304
262
|
* @example
|
|
305
263
|
* ```tsx
|
|
@@ -317,7 +275,7 @@ declare const List: {
|
|
|
317
275
|
/**
|
|
318
276
|
* De-emphasized sub-line inside a `List.Item`.
|
|
319
277
|
*
|
|
320
|
-
* @see https://mantle.ngrok.com/components/list
|
|
278
|
+
* @see https://mantle.ngrok.com/components/data-display/list
|
|
321
279
|
*
|
|
322
280
|
* @example
|
|
323
281
|
* ```tsx
|
package/dist/list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DmPrjM7N.js";import{n,r,t as i}from"./virtual-DZMBu7Ch.js";import{forwardRef as a}from"react";import{jsx as o}from"react/jsx-runtime";const s=a((e,t)=>o(r,{ref:t,semantics:`list`,...e}));s.displayName=`ListRoot`;const c=a((e,t)=>o(i,{ref:t,semantics:`list`,...e}));c.displayName=`ListVirtualRoot`;const l=a(({asChild:r,className:i,current:a,disabled:s,onClick:c,...l},u)=>o(n,{selected:a,disabled:s,children:o(r?t:`button`,{ref:u,"data-slot":`list-item-control`,"aria-current":a||void 0,...r?{"aria-disabled":s||void 0,tabIndex:s?-1:void 0}:{type:`button`,disabled:s},onClick:e=>{if(r&&s){e.preventDefault(),e.stopPropagation();return}c?.(e)},className:e(`flex w-full cursor-pointer flex-col gap-0.5 rounded-md bg-transparent px-2 py-1.5 text-left text-sm`,`disabled:cursor-default disabled:opacity-50 aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:pointer-events-none`,`focus-visible:outline-hidden`,i),...l,onClickCapture:r&&s?e=>{e.preventDefault(),e.stopPropagation()}:l.onClickCapture})}));l.displayName=`ListItem`;const u=a(({className:t,...n},r)=>o(`span`,{ref:r,"data-slot":`list-item-title`,className:e(`text-strong font-medium`,t),...n}));u.displayName=`ListItemTitle`;const d=a(({className:t,...n},r)=>o(`span`,{ref:r,"data-slot":`list-item-description`,className:e(`text-body leading-4`,t),...n}));d.displayName=`ListItemDescription`;const f={Root:s,VirtualRoot:c,Item:l,ItemTitle:u,ItemDescription:d};export{f as List};
|
package/dist/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @ngrok/mantle (0.
|
|
1
|
+
# @ngrok/mantle (0.79.0)
|
|
2
2
|
|
|
3
3
|
> Offline discovery hint shipped inside the @ngrok/mantle npm package. Authoritative metadata lives at https://mantle.ngrok.com/for-ai-agents.
|
|
4
4
|
|
|
@@ -24,10 +24,12 @@ Full text: https://mantle.ngrok.com/llms-full.txt
|
|
|
24
24
|
- `@ngrok/mantle/alert-dialog`
|
|
25
25
|
- `@ngrok/mantle/anchor`
|
|
26
26
|
- `@ngrok/mantle/badge`
|
|
27
|
+
- `@ngrok/mantle/breadcrumb`
|
|
27
28
|
- `@ngrok/mantle/browser-only`
|
|
28
29
|
- `@ngrok/mantle/button`
|
|
29
30
|
- `@ngrok/mantle/calendar`
|
|
30
31
|
- `@ngrok/mantle/card`
|
|
32
|
+
- `@ngrok/mantle/centered-layout`
|
|
31
33
|
- `@ngrok/mantle/checkbox`
|
|
32
34
|
- `@ngrok/mantle/choice`
|
|
33
35
|
- `@ngrok/mantle/code`
|
|
@@ -76,6 +78,7 @@ Full text: https://mantle.ngrok.com/llms-full.txt
|
|
|
76
78
|
- `@ngrok/mantle/tabs`
|
|
77
79
|
- `@ngrok/mantle/text-area`
|
|
78
80
|
- `@ngrok/mantle/theme`
|
|
81
|
+
- `@ngrok/mantle/theme-switcher`
|
|
79
82
|
- `@ngrok/mantle/toast`
|
|
80
83
|
- `@ngrok/mantle/tooltip`
|
|
81
84
|
- `@ngrok/mantle/types`
|
package/dist/main.d.ts
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
|
|
3
2
|
//#region src/components/main/main.d.ts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* a visible focus ring on the region itself (`focus:outline-hidden`).
|
|
9
|
-
*
|
|
10
|
-
* Pair with the `<SkipToMainLink>` component at the top of the document.
|
|
11
|
-
*
|
|
12
|
-
* @see https://mantle.ngrok.com/components/main
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* <SkipToMainLink />
|
|
17
|
-
* <Header />
|
|
18
|
-
* <Main>
|
|
19
|
-
* <h1>Page title</h1>
|
|
20
|
-
* </Main>
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare const Main: {
|
|
24
|
-
({
|
|
25
|
-
className,
|
|
26
|
-
...props
|
|
27
|
-
}: ComponentProps<"main">): import("react").JSX.Element;
|
|
28
|
-
displayName: string;
|
|
29
|
-
};
|
|
3
|
+
declare function Main({ className, ...props }: ComponentProps<"main">): import("react").JSX.Element;
|
|
4
|
+
declare namespace Main {
|
|
5
|
+
var displayName: string;
|
|
6
|
+
}
|
|
30
7
|
//#endregion
|
|
31
8
|
export { Main };
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{jsx as t}from"react/jsx-runtime";const n=({className:n,...r})=>t(`main`,{...r,"data-slot":`main`,id:`main`,tabIndex:-1,className:e(`focus:outline-hidden`,n)});n.displayName=`Main`;export{n as Main};
|
package/dist/mantle.css
CHANGED
|
@@ -501,12 +501,12 @@ MARK: UTILITIES
|
|
|
501
501
|
linear-gradient(var(--background-color-base) 30%, --alpha(var(--background-color-base) / 0%))
|
|
502
502
|
center top,
|
|
503
503
|
/* Shadow Cover BOTTOM */
|
|
504
|
-
|
|
504
|
+
linear-gradient(--alpha(var(--background-color-base) / 0%), var(--background-color-base) 70%)
|
|
505
505
|
center bottom,
|
|
506
506
|
/* Shadow TOP */
|
|
507
|
-
|
|
507
|
+
radial-gradient(farthest-side at 50% 0, var(--navigation-shadow), rgb(0 0 0 / 0%)) center top,
|
|
508
508
|
/* Shadow BOTTOM */
|
|
509
|
-
|
|
509
|
+
radial-gradient(farthest-side at 50% 100%, var(--navigation-shadow), rgb(0 0 0 / 0%)) center
|
|
510
510
|
bottom;
|
|
511
511
|
background-repeat: no-repeat;
|
|
512
512
|
background-size:
|
|
@@ -719,15 +719,15 @@ MARK: UTILITIES
|
|
|
719
719
|
)
|
|
720
720
|
center top,
|
|
721
721
|
/* Shadow Cover BOTTOM */
|
|
722
|
-
|
|
722
|
+
linear-gradient(
|
|
723
723
|
--alpha(var(--background-color-popover) / 0%),
|
|
724
724
|
var(--background-color-popover) 70%
|
|
725
725
|
)
|
|
726
726
|
center bottom,
|
|
727
727
|
/* Shadow TOP */
|
|
728
|
-
|
|
728
|
+
radial-gradient(farthest-side at 50% 0, var(--navigation-shadow), rgb(0 0 0 / 0%)) center top,
|
|
729
729
|
/* Shadow BOTTOM */
|
|
730
|
-
|
|
730
|
+
radial-gradient(farthest-side at 50% 100%, var(--navigation-shadow), rgb(0 0 0 / 0%)) center
|
|
731
731
|
bottom;
|
|
732
732
|
background-repeat: no-repeat;
|
|
733
733
|
background-size:
|
package/dist/media-object.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as WithAsChild } from "./as-child-
|
|
1
|
+
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
-
|
|
4
3
|
//#region src/components/media-object/media-object.d.ts
|
|
5
4
|
type Props = ComponentProps<"div"> & WithAsChild;
|
|
6
5
|
/**
|
|
@@ -17,7 +16,7 @@ type Props = ComponentProps<"div"> & WithAsChild;
|
|
|
17
16
|
* - Feature lists, profile cards, attachment previews.
|
|
18
17
|
*
|
|
19
18
|
* **When not to use**
|
|
20
|
-
* - For complex multi-region layouts — reach for {@link https://mantle.ngrok.com/components/card Card} or build a bespoke flex/grid.
|
|
19
|
+
* - For complex multi-region layouts — reach for {@link https://mantle.ngrok.com/components/structure/card Card} or build a bespoke flex/grid.
|
|
21
20
|
* - When the media is purely decorative and adds no information — drop it
|
|
22
21
|
* and use a plain block.
|
|
23
22
|
*
|
|
@@ -29,7 +28,7 @@ type Props = ComponentProps<"div"> & WithAsChild;
|
|
|
29
28
|
* **Polymorphism.** Each part accepts `asChild` for swapping the rendered
|
|
30
29
|
* element (e.g. render `Root` as an `<a>` to make the whole row clickable).
|
|
31
30
|
*
|
|
32
|
-
* @see https://mantle.ngrok.com/components/media-object
|
|
31
|
+
* @see https://mantle.ngrok.com/components/structure/media-object
|
|
33
32
|
*
|
|
34
33
|
* @example
|
|
35
34
|
* Composition:
|
|
@@ -68,7 +67,7 @@ declare const MediaObject: {
|
|
|
68
67
|
* Compose the media object with the `MediaObject.Media` and `MediaObject.Content`
|
|
69
68
|
* components as direct children.
|
|
70
69
|
*
|
|
71
|
-
* @see https://mantle.ngrok.com/components/media-object#mediaobjectroot
|
|
70
|
+
* @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectroot
|
|
72
71
|
*
|
|
73
72
|
* @example
|
|
74
73
|
* ```tsx
|
|
@@ -86,7 +85,7 @@ declare const MediaObject: {
|
|
|
86
85
|
/**
|
|
87
86
|
* The container for an image or icon to display in the media slot of the media object.
|
|
88
87
|
*
|
|
89
|
-
* @see https://mantle.ngrok.com/components/media-object#mediaobjectmedia
|
|
88
|
+
* @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectmedia
|
|
90
89
|
*
|
|
91
90
|
* @example
|
|
92
91
|
* ```tsx
|
|
@@ -104,7 +103,7 @@ declare const MediaObject: {
|
|
|
104
103
|
/**
|
|
105
104
|
* The container for the content slot of a media object.
|
|
106
105
|
*
|
|
107
|
-
* @see https://mantle.ngrok.com/components/media-object#mediaobjectcontent
|
|
106
|
+
* @see https://mantle.ngrok.com/components/structure/media-object#mediaobjectcontent
|
|
108
107
|
*
|
|
109
108
|
* @example
|
|
110
109
|
* ```tsx
|
package/dist/media-object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-
|
|
1
|
+
import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./slot-DmPrjM7N.js";import{forwardRef as n}from"react";import{jsx as r}from"react/jsx-runtime";const i=n(({asChild:n=!1,className:i,children:a,style:o},s)=>r(n?t:`div`,{ref:s,"data-slot":`media-object`,className:e(`flex gap-4`,i),style:o,children:a}));i.displayName=`MediaObject`;const a=n(({asChild:n=!1,className:i,children:a,style:o},s)=>r(n?t:`div`,{ref:s,"data-slot":`media-object-media`,className:e(`shrink-0 leading-none`,i),style:o,children:a}));a.displayName=`MediaObjectMedia`;const o=n(({asChild:n=!1,className:i,children:a,style:o},s)=>r(n?t:`div`,{ref:s,"data-slot":`media-object-content`,className:e(`min-w-0 flex-1`,i),style:o,children:a}));o.displayName=`MediaObject.Content`;const s={Root:i,Media:a,Content:o};export{s as MediaObject};
|
package/dist/multi-select.d.ts
CHANGED
|
@@ -1,10 +1,46 @@
|
|
|
1
|
-
import { t as WithAsChild } from "./as-child-
|
|
2
|
-
import { o as WithValidation } from "./validation-
|
|
1
|
+
import { t as WithAsChild } from "./as-child-CYEVu1WY.js";
|
|
2
|
+
import { o as WithValidation } from "./validation-7QeiTFwl.js";
|
|
3
3
|
import { ComponentProps, ReactNode } from "react";
|
|
4
4
|
import * as Primitive from "@ariakit/react";
|
|
5
|
-
|
|
6
5
|
//#region src/components/multi-select/multi-select.d.ts
|
|
7
6
|
type MultiSelectProps = Primitive.ComboboxProviderProps<string[]>;
|
|
7
|
+
/**
|
|
8
|
+
* Root component for a multi-select combobox. Provides state management for
|
|
9
|
+
* selecting multiple values with typeahead filtering.
|
|
10
|
+
*
|
|
11
|
+
* Use MultiSelect when the user can choose multiple values from a list, with selected
|
|
12
|
+
* items rendered as removable tags/chips. For single selection, use Combobox (with search)
|
|
13
|
+
* or Select (without).
|
|
14
|
+
*
|
|
15
|
+
* When composing with `Field.Item`, wrap `MultiSelect.Root` in `Field.Control`.
|
|
16
|
+
* `Field.Control` flows the generated `id`, `name`, `aria-describedby`,
|
|
17
|
+
* `aria-errormessage`, and `aria-invalid` through to the focusable
|
|
18
|
+
* `MultiSelect.Input` via `FieldControlContext`.
|
|
19
|
+
*
|
|
20
|
+
* `MultiSelect.Content` renders at Tailwind `z-50`, Mantle's shared floating
|
|
21
|
+
* z-index. When multiple shared layers are open, the most recently mounted
|
|
22
|
+
* layer renders on top.
|
|
23
|
+
*
|
|
24
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectroot
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <MultiSelect.Root>
|
|
29
|
+
* <MultiSelect.Trigger>
|
|
30
|
+
* <MultiSelect.TagValues />
|
|
31
|
+
* <MultiSelect.Input placeholder="Select items..." />
|
|
32
|
+
* </MultiSelect.Trigger>
|
|
33
|
+
* <MultiSelect.Content>
|
|
34
|
+
* <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
|
|
35
|
+
* <MultiSelect.Item value="banana">Banana</MultiSelect.Item>
|
|
36
|
+
* </MultiSelect.Content>
|
|
37
|
+
* </MultiSelect.Root>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const Root: {
|
|
41
|
+
({ children, defaultSelectedValue, ...props }: MultiSelectProps): import("react").JSX.Element;
|
|
42
|
+
displayName: string;
|
|
43
|
+
};
|
|
8
44
|
type TagProps = Omit<ComponentProps<"span">, "children"> & {
|
|
9
45
|
/**
|
|
10
46
|
* The value to display in the tag label.
|
|
@@ -31,7 +67,8 @@ type TagProps = Omit<ComponentProps<"span">, "children"> & {
|
|
|
31
67
|
* - `onClick` — focuses the tag and ensures the popover opens/stays open
|
|
32
68
|
*/
|
|
33
69
|
type TagRenderProps = TagProps & {
|
|
34
|
-
/** Ref callback — forward this to the tag element to enable keyboard navigation between tags. */
|
|
70
|
+
/** Ref callback — forward this to the tag element to enable keyboard navigation between tags. */
|
|
71
|
+
ref: (node: HTMLSpanElement | null) => void;
|
|
35
72
|
};
|
|
36
73
|
type MultiSelectTagValuesProps = {
|
|
37
74
|
/**
|
|
@@ -59,6 +96,29 @@ type MultiSelectTagValuesProps = {
|
|
|
59
96
|
*/
|
|
60
97
|
children?: (props: TagRenderProps) => ReactNode;
|
|
61
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Renders the selected values as removable tags. Place this inside
|
|
101
|
+
* `MultiSelect.Trigger`, followed by `MultiSelect.Input`.
|
|
102
|
+
*
|
|
103
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttagvalues
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <MultiSelect.Root>
|
|
108
|
+
* <MultiSelect.Trigger>
|
|
109
|
+
* <MultiSelect.TagValues />
|
|
110
|
+
* <MultiSelect.Input placeholder="Select items..." />
|
|
111
|
+
* </MultiSelect.Trigger>
|
|
112
|
+
* <MultiSelect.Content>
|
|
113
|
+
* <MultiSelect.Item value="apple">Apple</MultiSelect.Item>
|
|
114
|
+
* </MultiSelect.Content>
|
|
115
|
+
* </MultiSelect.Root>
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare const TagValues: {
|
|
119
|
+
({ children, lockedValues }: MultiSelectTagValuesProps): import("react").JSX.Element;
|
|
120
|
+
displayName: string;
|
|
121
|
+
};
|
|
62
122
|
type MultiSelectInputProps = Omit<Primitive.ComboboxProps, "render"> & {
|
|
63
123
|
/**
|
|
64
124
|
* Called with the raw string value whenever the input text changes.
|
|
@@ -86,7 +146,7 @@ type MultiSelectGroupLabelProps = Omit<Primitive.ComboboxGroupLabelProps, "rende
|
|
|
86
146
|
* z-index. When multiple shared layers are open, the most recently mounted
|
|
87
147
|
* layer renders on top.
|
|
88
148
|
*
|
|
89
|
-
* @see https://mantle.ngrok.com/components/multi-select
|
|
149
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select
|
|
90
150
|
* @see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
91
151
|
* @see https://ariakit.org/components/combobox
|
|
92
152
|
*
|
|
@@ -135,7 +195,7 @@ declare const MultiSelect: {
|
|
|
135
195
|
* floating z-index. When multiple shared layers are open, the most recently
|
|
136
196
|
* mounted layer renders on top.
|
|
137
197
|
*
|
|
138
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectroot
|
|
198
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectroot
|
|
139
199
|
*
|
|
140
200
|
* @example
|
|
141
201
|
* ```tsx
|
|
@@ -150,19 +210,12 @@ declare const MultiSelect: {
|
|
|
150
210
|
* </MultiSelect.Root>
|
|
151
211
|
* ```
|
|
152
212
|
*/
|
|
153
|
-
readonly Root:
|
|
154
|
-
({
|
|
155
|
-
children,
|
|
156
|
-
defaultSelectedValue,
|
|
157
|
-
...props
|
|
158
|
-
}: MultiSelectProps): import("react").JSX.Element;
|
|
159
|
-
displayName: string;
|
|
160
|
-
};
|
|
213
|
+
readonly Root: typeof Root;
|
|
161
214
|
/**
|
|
162
215
|
* The trigger container for the multi-select. Wraps the tags and input
|
|
163
216
|
* in a styled container.
|
|
164
217
|
*
|
|
165
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselecttrigger
|
|
218
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttrigger
|
|
166
219
|
*
|
|
167
220
|
* @example
|
|
168
221
|
* ```tsx
|
|
@@ -185,7 +238,7 @@ declare const MultiSelect: {
|
|
|
185
238
|
* Use `lockedValues` to prevent specific tags from being removed. Locked tags
|
|
186
239
|
* have their remove button disabled and shake when Backspace is pressed.
|
|
187
240
|
*
|
|
188
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselecttagvalues
|
|
241
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttagvalues
|
|
189
242
|
*
|
|
190
243
|
* @example
|
|
191
244
|
* ```tsx
|
|
@@ -216,18 +269,12 @@ declare const MultiSelect: {
|
|
|
216
269
|
* </MultiSelect.Root>
|
|
217
270
|
* ```
|
|
218
271
|
*/
|
|
219
|
-
readonly TagValues:
|
|
220
|
-
({
|
|
221
|
-
children,
|
|
222
|
-
lockedValues
|
|
223
|
-
}: MultiSelectTagValuesProps): import("react").JSX.Element;
|
|
224
|
-
displayName: string;
|
|
225
|
-
};
|
|
272
|
+
readonly TagValues: typeof TagValues;
|
|
226
273
|
/**
|
|
227
274
|
* The combobox input for filtering items. Place this inside
|
|
228
275
|
* `MultiSelect.Trigger`, after `MultiSelect.TagValues`.
|
|
229
276
|
*
|
|
230
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectinput
|
|
277
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectinput
|
|
231
278
|
*
|
|
232
279
|
* @example
|
|
233
280
|
* ```tsx
|
|
@@ -247,7 +294,7 @@ declare const MultiSelect: {
|
|
|
247
294
|
* The default tag rendered inside `MultiSelect.TagValues` for each selected value.
|
|
248
295
|
* Displays the value label with a remove button and keyboard navigation support.
|
|
249
296
|
*
|
|
250
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselecttag
|
|
297
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselecttag
|
|
251
298
|
*
|
|
252
299
|
* @example
|
|
253
300
|
* ```tsx
|
|
@@ -272,7 +319,7 @@ declare const MultiSelect: {
|
|
|
272
319
|
* floating z-index. When multiple shared layers are open, the most recently
|
|
273
320
|
* mounted layer renders on top.
|
|
274
321
|
*
|
|
275
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectcontent
|
|
322
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectcontent
|
|
276
323
|
*
|
|
277
324
|
* @example
|
|
278
325
|
* ```tsx
|
|
@@ -293,7 +340,7 @@ declare const MultiSelect: {
|
|
|
293
340
|
* Renders a sticky footer pinned to the bottom inside `MultiSelect.Content`,
|
|
294
341
|
* with a separator border at the top.
|
|
295
342
|
*
|
|
296
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectcontentfooter
|
|
343
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectcontentfooter
|
|
297
344
|
*
|
|
298
345
|
* @example
|
|
299
346
|
* ```tsx
|
|
@@ -315,7 +362,7 @@ declare const MultiSelect: {
|
|
|
315
362
|
/**
|
|
316
363
|
* Renders a selectable item with a checkbox indicator inside a `MultiSelect.Content`.
|
|
317
364
|
*
|
|
318
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectitem
|
|
365
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectitem
|
|
319
366
|
*
|
|
320
367
|
* @example
|
|
321
368
|
* ```tsx
|
|
@@ -335,7 +382,7 @@ declare const MultiSelect: {
|
|
|
335
382
|
/**
|
|
336
383
|
* Renders a group for MultiSelect.Item elements.
|
|
337
384
|
*
|
|
338
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectgroup
|
|
385
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectgroup
|
|
339
386
|
*
|
|
340
387
|
* @example
|
|
341
388
|
* ```tsx
|
|
@@ -357,7 +404,7 @@ declare const MultiSelect: {
|
|
|
357
404
|
/**
|
|
358
405
|
* Renders a label in a multi-select group.
|
|
359
406
|
*
|
|
360
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectgrouplabel
|
|
407
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectgrouplabel
|
|
361
408
|
*
|
|
362
409
|
* @example
|
|
363
410
|
* ```tsx
|
|
@@ -379,7 +426,7 @@ declare const MultiSelect: {
|
|
|
379
426
|
/**
|
|
380
427
|
* Renders a description below a `MultiSelect.GroupLabel` inside a `MultiSelect.Group`.
|
|
381
428
|
*
|
|
382
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectgroupdescription
|
|
429
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectgroupdescription
|
|
383
430
|
*
|
|
384
431
|
* @example
|
|
385
432
|
* ```tsx
|
|
@@ -404,7 +451,7 @@ declare const MultiSelect: {
|
|
|
404
451
|
/**
|
|
405
452
|
* Renders a separator between items or groups.
|
|
406
453
|
*
|
|
407
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectseparator
|
|
454
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectseparator
|
|
408
455
|
*
|
|
409
456
|
* @example
|
|
410
457
|
* ```tsx
|
|
@@ -432,7 +479,7 @@ declare const MultiSelect: {
|
|
|
432
479
|
/**
|
|
433
480
|
* Renders a message when no items match the current filter.
|
|
434
481
|
*
|
|
435
|
-
* @see https://mantle.ngrok.com/components/multi-select#multiselectempty
|
|
482
|
+
* @see https://mantle.ngrok.com/components/forms/multi-select#multiselectempty
|
|
436
483
|
*
|
|
437
484
|
* @example
|
|
438
485
|
* ```tsx
|
package/dist/multi-select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-Cjf2gfB8.js";import{t}from"./cx-C1UYP5We.js";import{t as n}from"./icon-SUx16Sl3.js";import{t as r}from"./slot-DT_E5BQx.js";import{a as i,r as a}from"./validation-DCyx-ceH.js";import{t as o}from"./field-context-4k1kI7Bo.js";import{n as s}from"./separator-CqohKk4z.js";import{t as c}from"./use-prefers-reduced-motion-DBqNw1wB.js";import{createContext as l,forwardRef as u,useCallback as d,useContext as f,useEffect as p,useMemo as m,useRef 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=h(null),i=h(void 0),a=h(null),o=h([]),s=m(()=>({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})})})})};O.displayName=`MultiSelect`;const k=u(({"aria-invalid":n,className:r,children:o,onKeyDown:s,onMouseDown:c,validation:l,...u},d)=>{let p=f(T),{inputRef:m}=f(D),h=x.useComboboxContext(),g=i(),{validation:v}=a({"aria-invalid":n,validation:l??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,d),...u,children:o})});k.displayName=`MultiSelectTrigger`;const A=u(({className:r,value:i,onRemove:a,locked:o=!1,onKeyDown:s,...c},l)=>{let u=h(null);return v(`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(),H(e.currentTarget);return}s?.(e)},...c,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&&H(e);return}a?.()},onMouseDown:e=>{e.preventDefault()},children:_(n,{svg:o?_(S,{}):_(y,{weight:`bold`}),className:`size-4`})})]})});A.displayName=`MultiSelectTag`;const j=({children:e,lockedValues:t=w})=>{let n=x.useComboboxContext(),r=x.useStoreState(n,`selectedValue`),i=(C(r)?r:void 0)??w,a=h(i);a.current=i;let o=f(E);o.current=t;let s=m(()=>new Set(t),[t]),c=h(new Map),{onInputKeyDownRef:l,inputRef:u}=f(D),d=h(new Set);p(()=>()=>{d.current.forEach(cancelAnimationFrame)},[]);let v=e=>{let t=requestAnimationFrame(()=>{d.current.delete(t),e()});d.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&&H(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&&H(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&&H(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)})})};j.displayName=`MultiSelectTagValues`;const M=u(({className:n,onBlur:r,onChange:i,onFocus:a,onKeyDown:s,onValueChange:c,placeholder:l,...u},d)=>{let p=x.useComboboxContext(),{onInputKeyDownRef:m,inputRef:h}=f(D),g=f(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,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})});M.displayName=`MultiSelectInput`;const N=u(({asChild:e=!1,backdrop:n=!1,children:i,className:a,modal:o=!0,portalElement:s,sameWidth:c=!0,unmountOnHide:l=!0,...u},p)=>{let m=f(T),h=d(()=>m.current?.getBoundingClientRect()??null,[m]),g=d(e=>typeof s==`function`?s(e):s??m.current?.closest(`[data-mantle-modal-content]`)??e.ownerDocument.body,[s,m]),v=d(e=>!(e.target instanceof Node&&m.current?.contains(e.target)),[m]);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:h,gutter:4,hideOnInteractOutside:v,modal:o,portalElement:g,ref:p,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,sameWidth:c,unmountOnHide:l,...u,children:i})});N.displayName=`MultiSelectContent`;const P=u(({asChild:e=!1,children:i,className:a,focusOnHover:o=!0,value:s,onClick:c,...l},u)=>{let d=f(E),p=s!=null&&d.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:u,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,resetValueOnSelect:!0,value:s,...l,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`})})]})});P.displayName=`MultiSelectItem`;const F=u(({asChild:e=!1,children:t,...n},i)=>_(x.ComboboxGroup,{"data-slot":`multi-select-group`,className:`mx-1`,ref:i,render:e?({ref:e,...t})=>_(r,{ref:e,...t}):void 0,...n,children:t}));F.displayName=`MultiSelectGroup`;const I=u(({asChild:e=!1,children:n,className:i,...a},o)=>_(x.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})=>_(r,{ref:e,...t}):void 0,...a,children:n}));I.displayName=`MultiSelectGroupLabel`;const L=u(({className:e,children:n,...r},i)=>_(`p`,{"data-slot":`multi-select-group-description`,className:t(`text-muted px-2 pb-1 text-xs`,e),ref:i,...r,children:n}));L.displayName=`MultiSelectGroupDescription`;const R=u(({className:e,...n},r)=>_(s,{"data-slot":`multi-select-separator`,ref:r,className:t(`my-1 w-auto`,e),...n}));R.displayName=`MultiSelectSeparator`;const z=u(({className:e,children:n,...r},i)=>_(`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}));z.displayName=`MultiSelectEmpty`;const B=u(({className:e,children:n,...r},i)=>_(`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}));B.displayName=`MultiSelectContentFooter`;const V={Root:O,Trigger:k,TagValues:j,Input:M,Tag:A,Content:N,ContentFooter:B,Item:P,Group:F,GroupLabel:I,GroupDescription:L,Separator:R,Empty:z};function H(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{V as MultiSelect};
|
|
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};
|