@ngrok/mantle 0.79.3 → 0.80.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 +169 -12
- package/dist/accordion.js +1 -1
- package/dist/agent.json +1 -1
- package/dist/alert-dialog.d.ts +496 -30
- package/dist/alert-dialog.js +1 -1
- package/dist/alert.d.ts +129 -9
- package/dist/alert.js +1 -1
- package/dist/anchor-_2meGDfj.js +1 -0
- package/dist/anchor.d.ts +2 -2
- package/dist/anchor.js +1 -1
- package/dist/as-child-D23mGo4f.d.ts +49 -0
- package/dist/badge.d.ts +44 -5
- package/dist/badge.js +1 -1
- package/dist/breadcrumb.d.ts +214 -14
- package/dist/breadcrumb.js +1 -1
- package/dist/button-5WsvzIQ6.js +1 -0
- package/dist/{button-DcXOWUYo.d.ts → button-BPMwa2jN.d.ts} +3 -3
- package/dist/button-D9n09xUg.js +1 -0
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +0 -3
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +146 -9
- package/dist/card.js +1 -1
- package/dist/centered-layout.d.ts +224 -8
- package/dist/centered-layout.js +1 -1
- package/dist/checkbox-Cq17y0-R.js +1 -0
- package/dist/checkbox.d.ts +12 -10
- package/dist/checkbox.js +1 -1
- package/dist/choice-Cc8dA5r8.js +1 -0
- package/dist/choice-Ct0KK8jw.d.ts +269 -0
- package/dist/choice.d.ts +1 -252
- package/dist/choice.js +1 -1
- package/dist/code-block.d.ts +270 -50
- package/dist/code-block.js +6 -6
- package/dist/code.d.ts +3 -2
- package/dist/code.js +1 -1
- package/dist/combobox.d.ts +190 -11
- package/dist/combobox.js +1 -1
- package/dist/command.d.ts +285 -81
- package/dist/command.js +1 -1
- package/dist/compose-refs-BdBMM9ga.js +1 -0
- package/dist/data-table.d.ts +33 -5
- package/dist/data-table.js +1 -1
- package/dist/description-list.d.ts +79 -6
- package/dist/description-list.js +1 -1
- package/dist/dialog-CQ2C6vkE.js +1 -0
- package/dist/dialog.d.ts +239 -18
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-CSCDdA3K.js +1 -0
- package/dist/{dropdown-menu-DP_Ne9Mr.d.ts → dropdown-menu-CoyozLzy.d.ts} +170 -29
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/dropdown-menu.js +1 -1
- package/dist/empty.d.ts +1 -1
- package/dist/empty.js +1 -1
- package/dist/field.d.ts +596 -45
- package/dist/field.js +1 -1
- package/dist/flag.d.ts +0 -3
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +3 -4
- package/dist/hooks.js +1 -1
- package/dist/hover-card.d.ts +54 -4
- package/dist/hover-card.js +1 -1
- package/dist/{icon-Cevjo93X.d.ts → icon-BDqpcZ-n.d.ts} +1 -1
- package/dist/icon-CGgMKpJg.js +1 -0
- package/dist/{icon-button-BvQvT790.d.ts → icon-button-C1AfGnQx.d.ts} +6 -60
- package/dist/icon-button-DiOhreJD.js +1 -0
- package/dist/icon.d.ts +2 -2
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +5 -13
- package/dist/icons.js +1 -1
- package/dist/{in-view-nkSOdED2.d.ts → in-view-DDEGUKDR.d.ts} +17 -9
- package/dist/index-B8mIWKIU.d.ts +211 -0
- package/dist/{index-Rv8RL7xy.d.ts → index-BtwKJTLq.d.ts} +1 -1
- package/dist/{index-BSAizFod.d.ts → index-C2jj8U4a.d.ts} +5 -5
- package/dist/index-CdPXa9h1.d.ts +1 -0
- package/dist/{index-D47aqlpz.d.ts → index-DA4ig3gj.d.ts} +1 -1
- package/dist/input-CVyAVbim.js +1 -0
- package/dist/{types-C19IR7jf.d.ts → input-DV9M6K4v.d.ts} +42 -2
- package/dist/input.d.ts +4 -55
- package/dist/input.js +1 -1
- package/dist/{label-v2-bv98k.d.ts → label-C6YH9skg.d.ts} +8 -6
- package/dist/label-D-D11mlp.js +1 -0
- package/dist/label.d.ts +1 -1
- package/dist/label.js +1 -1
- package/dist/list.d.ts +150 -6
- package/dist/list.js +1 -1
- package/dist/llms.txt +1 -1
- package/dist/main.d.ts +20 -4
- package/dist/main.js +1 -1
- package/dist/media-object.d.ts +27 -4
- package/dist/media-object.js +1 -1
- package/dist/multi-select.d.ts +312 -15
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +129 -5
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +70 -6
- package/dist/pagination.js +1 -1
- package/dist/popover-CBMADtjV.js +1 -0
- package/dist/popover.d.ts +1 -181
- package/dist/popover.js +1 -1
- package/dist/primitive-CJRIlrLz.d.ts +31 -0
- package/dist/primitive-DCPHJsRs.js +1 -0
- package/dist/progress.js +1 -1
- package/dist/qr-code.d.ts +113 -5
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.d.ts +128 -23
- package/dist/radio-group.js +1 -1
- package/dist/sandboxed-on-click.d.ts +2 -2
- package/dist/sandboxed-on-click.js +1 -1
- package/dist/select-SR_9-bxA.js +1 -0
- package/dist/select-idm1jy7y.d.ts +600 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +252 -298
- package/dist/selectable-list.js +1 -1
- package/dist/separator-B5UmkVRL.d.ts +75 -0
- package/dist/separator-bpE_kooz.js +1 -0
- package/dist/separator.d.ts +1 -52
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +295 -21
- package/dist/sheet.js +1 -1
- package/dist/skeleton-CsbUHbBA.js +1 -0
- package/dist/skeleton.d.ts +4 -7
- package/dist/skeleton.js +1 -1
- package/dist/skip-to-main-link.d.ts +24 -4
- package/dist/skip-to-main-link.js +1 -1
- package/dist/slot-CDk0Bb9z.js +1 -0
- package/dist/slot.d.ts +1 -1
- package/dist/slot.js +1 -1
- package/dist/{sort-BPX2Fk9t.js → sort-B_DDQcVD.js} +1 -1
- package/dist/split-button.d.ts +28 -13
- package/dist/split-button.js +1 -1
- package/dist/{svg-only-BFeFS1aa.d.ts → svg-only-CdI_v82i.d.ts} +1 -1
- package/dist/svg-only-d-nMCfAI.js +1 -0
- package/dist/switch.d.ts +9 -6
- package/dist/switch.js +1 -1
- package/dist/table-DUSvU_Jw.d.ts +875 -0
- package/dist/table-GDkapNFi.js +1 -0
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +135 -21
- package/dist/tabs.js +1 -1
- package/dist/text-area.d.ts +1 -1
- package/dist/text-area.js +1 -1
- package/dist/theme-provider-BftkIiZn.js +1 -0
- package/dist/theme-switcher.d.ts +110 -29
- package/dist/theme-switcher.js +1 -1
- package/dist/theme-wVnzzx2F.js +1 -0
- package/dist/theme.d.ts +53 -14
- package/dist/theme.js +1 -1
- package/dist/toast-DKgMRv4F.js +1 -0
- package/dist/toast.d.ts +98 -10
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +28 -1
- package/dist/tooltip.js +1 -1
- package/dist/{traffic-policy-file-0g5RXFqu.js → traffic-policy-file-CF1lbWtp.js} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/virtual-UrzmaSQm.js +1 -0
- package/dist/well.d.ts +3 -3
- package/dist/well.js +1 -1
- package/package.json +3 -3
- package/dist/anchor-C_tjSVy6.js +0 -1
- package/dist/as-child-CYEVu1WY.d.ts +0 -23
- package/dist/button-5t6-JS_I.js +0 -1
- package/dist/button-ClC60Nzg.js +0 -1
- package/dist/checkbox-DJ2xl7Rc.js +0 -1
- package/dist/choice-DOdyNzFC.js +0 -1
- package/dist/compose-refs-Cjf2gfB8.js +0 -1
- package/dist/dialog-vxLIvB8M.js +0 -1
- package/dist/dropdown-menu-Bt1aKF1g.js +0 -1
- package/dist/icon-CDtYjF_H.js +0 -1
- package/dist/icon-button-DV2-GZHf.js +0 -1
- package/dist/index-g2rfwNCH.d.ts +0 -1
- package/dist/input-Ct1YOqSy.js +0 -1
- package/dist/label-BMlHW_2D.js +0 -1
- package/dist/popover-D5WxxnBY.js +0 -1
- package/dist/primitive-C64-m48O.d.ts +0 -13
- package/dist/primitive-IKruV2iB.js +0 -1
- package/dist/select-Bwt2YduR.d.ts +0 -345
- package/dist/select-D-5u0Blc.js +0 -1
- package/dist/separator-kBnnv3Cw.js +0 -1
- package/dist/skeleton-Bu3tgNcW.js +0 -1
- package/dist/slot-DmPrjM7N.js +0 -1
- package/dist/svg-only-DDx6FtJd.js +0 -1
- package/dist/table-CPH2md2-.js +0 -1
- package/dist/table-CwFHXC-G.d.ts +0 -414
- package/dist/theme-D3MDng6U.js +0 -1
- package/dist/theme-provider-C9zpDyJW.js +0 -1
- package/dist/toast-BsCjaMVS.js +0 -1
- package/dist/virtual-DZMBu7Ch.js +0 -1
package/dist/accordion.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as IconProps } from "./icon-
|
|
3
|
-
import {
|
|
1
|
+
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
|
+
import { n as IconProps } from "./icon-BDqpcZ-n.js";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
4
|
//#region src/components/accordion/accordion.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* `"single"` mode props: at most one item open at a time — opening a section
|
|
@@ -56,7 +56,103 @@ type AccordionMultipleProps = {
|
|
|
56
56
|
* accordion that keeps at most one section open at a time. Also accepts all
|
|
57
57
|
* standard `<div>` props (forwarded to the container) plus `asChild`.
|
|
58
58
|
*/
|
|
59
|
-
type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit<
|
|
59
|
+
type AccordionRootProps = (AccordionSingleProps | AccordionMultipleProps) & Omit<ComponentProps<"div">, "defaultValue"> & WithAsChild;
|
|
60
|
+
/**
|
|
61
|
+
* A vertically stacked set of disclosure sections. The root owns the open/closed
|
|
62
|
+
* state and provides it to its items.
|
|
63
|
+
*
|
|
64
|
+
* Built without a UI framework's collapsible: each section's collapsed content
|
|
65
|
+
* stays in the DOM with `hidden="until-found"`, so the browser's find-in-page
|
|
66
|
+
* (⌘F / Ctrl-F) can discover and auto-reveal matches inside closed sections (the
|
|
67
|
+
* `beforematch` event syncs that reveal back into this component's state). Works
|
|
68
|
+
* with controlled (`value` + `onValueChange`) and uncontrolled (`defaultValue`)
|
|
69
|
+
* usage in both `"single"` and `"multiple"` modes.
|
|
70
|
+
*
|
|
71
|
+
* `type` is optional and **defaults to `"multiple"`** — sections open
|
|
72
|
+
* independently and opening one never closes another. Pass `type="single"` for
|
|
73
|
+
* the classic accordion where opening a section auto-closes the previously open
|
|
74
|
+
* one.
|
|
75
|
+
*
|
|
76
|
+
* Items are separated by a hairline divider drawn with `divide-y` on the root,
|
|
77
|
+
* colored with the shared `separator` token so it matches `Separator` and every
|
|
78
|
+
* other divider in the system. Disable the dividers with `divide-y-0` on the root
|
|
79
|
+
* (e.g. pair it with `space-y-*` for a spaced-card layout).
|
|
80
|
+
*
|
|
81
|
+
* @see https://mantle.ngrok.com/components/data-display/accordion#api-accordion
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* <Accordion.Root type="single" defaultValue="shipping">
|
|
85
|
+
* <Accordion.Item value="shipping">
|
|
86
|
+
* <Accordion.Trigger>
|
|
87
|
+
* How long does shipping take?
|
|
88
|
+
* <Accordion.TriggerIcon />
|
|
89
|
+
* </Accordion.Trigger>
|
|
90
|
+
* <Accordion.Content>
|
|
91
|
+
* <Accordion.Body>Two to five business days.</Accordion.Body>
|
|
92
|
+
* </Accordion.Content>
|
|
93
|
+
* </Accordion.Item>
|
|
94
|
+
* </Accordion.Root>
|
|
95
|
+
*/
|
|
96
|
+
declare const Root: {
|
|
97
|
+
(props: AccordionRootProps): import("react").JSX.Element;
|
|
98
|
+
displayName: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* A single collapsible section, rendered as a plain `<div role="group">` — the
|
|
102
|
+
* same accessibility role the browser gives a native `<details>`. Derives its
|
|
103
|
+
* open state from {@link Root}.
|
|
104
|
+
*
|
|
105
|
+
* Because the item is just a `<div>`, its header can be any layout — e.g. a flex
|
|
106
|
+
* row with the {@link Trigger} alongside a separate, non-toggling action button.
|
|
107
|
+
*
|
|
108
|
+
* @see https://mantle.ngrok.com/components/data-display/accordion#api-accordion-item
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* <Accordion.Root type="single" defaultValue="item-1">
|
|
112
|
+
* <Accordion.Item value="item-1">
|
|
113
|
+
* <Accordion.Trigger>
|
|
114
|
+
* Is it accessible?
|
|
115
|
+
* <Accordion.TriggerIcon />
|
|
116
|
+
* </Accordion.Trigger>
|
|
117
|
+
* <Accordion.Content>
|
|
118
|
+
* <Accordion.Body>Yes. It adheres to the WAI-ARIA disclosure pattern.</Accordion.Body>
|
|
119
|
+
* </Accordion.Content>
|
|
120
|
+
* </Accordion.Item>
|
|
121
|
+
* </Accordion.Root>
|
|
122
|
+
*/
|
|
123
|
+
declare const Item: {
|
|
124
|
+
({ children, value, ref, ...props }: ComponentProps<"div"> & {
|
|
125
|
+
/** The unique value identifying this item within its accordion. */
|
|
126
|
+
value: string;
|
|
127
|
+
}): import("react").JSX.Element;
|
|
128
|
+
displayName: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* The interactive header that toggles its section, rendered as a `<button>` with
|
|
132
|
+
* `aria-expanded` — the disclosure semantics a native `<summary>` provides, but
|
|
133
|
+
* via a real button so the role is consistent across browsers (native summary's
|
|
134
|
+
* role varies). Place the {@link TriggerIcon} as the last child so the default
|
|
135
|
+
* `justify-between` layout pushes it to the trailing edge.
|
|
136
|
+
*
|
|
137
|
+
* @see https://mantle.ngrok.com/components/data-display/accordion#api-accordion-trigger
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* <Accordion.Root type="single" defaultValue="item-1">
|
|
141
|
+
* <Accordion.Item value="item-1">
|
|
142
|
+
* <Accordion.Trigger>
|
|
143
|
+
* Is it accessible?
|
|
144
|
+
* <Accordion.TriggerIcon />
|
|
145
|
+
* </Accordion.Trigger>
|
|
146
|
+
* <Accordion.Content>
|
|
147
|
+
* <Accordion.Body>Yes. It adheres to the WAI-ARIA disclosure pattern.</Accordion.Body>
|
|
148
|
+
* </Accordion.Content>
|
|
149
|
+
* </Accordion.Item>
|
|
150
|
+
* </Accordion.Root>
|
|
151
|
+
*/
|
|
152
|
+
declare const Trigger: {
|
|
153
|
+
({ className, children, onClick, ref, ...props }: Omit<ComponentProps<"button">, "type">): import("react").JSX.Element;
|
|
154
|
+
displayName: string;
|
|
155
|
+
};
|
|
60
156
|
/**
|
|
61
157
|
* The icon that indicates the open/closed state of its {@link Trigger}. Defaults
|
|
62
158
|
* to a downward caret that rotates 180° when the section is open. Pass `svg` to
|
|
@@ -102,6 +198,70 @@ declare const TriggerIcon: {
|
|
|
102
198
|
}): import("react").JSX.Element;
|
|
103
199
|
displayName: string;
|
|
104
200
|
};
|
|
201
|
+
/**
|
|
202
|
+
* The collapsible region of an {@link Item} — the zero-padding viewport that
|
|
203
|
+
* slides open and closed. Wrap its children in {@link Body} for the standard
|
|
204
|
+
* padding (text inherits the ambient size); `Content` itself stays unpadded so
|
|
205
|
+
* its `h-0` collapse can reach zero height. Always rendered into the DOM; when
|
|
206
|
+
* collapsed (in
|
|
207
|
+
* supporting browsers) it carries `hidden="until-found"` so its text stays
|
|
208
|
+
* discoverable by the browser's find-in-page, and a `beforematch` listener opens
|
|
209
|
+
* the section when the browser reveals a match. It is flow content, so it may
|
|
210
|
+
* contain anything — including interactive elements.
|
|
211
|
+
*
|
|
212
|
+
* @see https://mantle.ngrok.com/components/data-display/accordion#api-accordion-content
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* <Accordion.Root type="single" defaultValue="item-1">
|
|
216
|
+
* <Accordion.Item value="item-1">
|
|
217
|
+
* <Accordion.Trigger>
|
|
218
|
+
* Is it accessible?
|
|
219
|
+
* <Accordion.TriggerIcon />
|
|
220
|
+
* </Accordion.Trigger>
|
|
221
|
+
* <Accordion.Content>
|
|
222
|
+
* <Accordion.Body>Yes. It adheres to the WAI-ARIA disclosure pattern.</Accordion.Body>
|
|
223
|
+
* </Accordion.Content>
|
|
224
|
+
* </Accordion.Item>
|
|
225
|
+
* </Accordion.Root>
|
|
226
|
+
*/
|
|
227
|
+
declare const Content: {
|
|
228
|
+
({ className, children, ref, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
229
|
+
displayName: string;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* The padded inner region of an {@link Item}'s {@link Content} — where the
|
|
233
|
+
* section's body content lives. Owns the body's padding so {@link Content} can
|
|
234
|
+
* stay a zero-padding animation viewport: a padded `h-0` border-box can't
|
|
235
|
+
* collapse below its padding, so keeping the padding here lets the closed slide
|
|
236
|
+
* reach zero height. The `pt-2` doubles as the focus ring's vertical clearance —
|
|
237
|
+
* it pairs with the trigger's open-state `pb-2` so the gap below the trigger
|
|
238
|
+
* stays a uniform 16px while 8px of it sits outside the button box, keeping the
|
|
239
|
+
* ring off the body's first line (see {@link Trigger}). Text inherits the ambient
|
|
240
|
+
* size — it isn't forced — so set a size on the content where you need one.
|
|
241
|
+
* Override `className` to retune the padding (e.g. `pb-0`, `px-6`); `cx` resolves
|
|
242
|
+
* last-wins.
|
|
243
|
+
*
|
|
244
|
+
* @see https://mantle.ngrok.com/components/data-display/accordion#api-accordion-body
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* <Accordion.Root type="single" defaultValue="item-1">
|
|
248
|
+
* <Accordion.Item value="item-1">
|
|
249
|
+
* <Accordion.Trigger>
|
|
250
|
+
* Is it accessible?
|
|
251
|
+
* <Accordion.TriggerIcon />
|
|
252
|
+
* </Accordion.Trigger>
|
|
253
|
+
* <Accordion.Content>
|
|
254
|
+
* <Accordion.Body className="pb-6">
|
|
255
|
+
* Yes. It adheres to the WAI-ARIA disclosure pattern.
|
|
256
|
+
* </Accordion.Body>
|
|
257
|
+
* </Accordion.Content>
|
|
258
|
+
* </Accordion.Item>
|
|
259
|
+
* </Accordion.Root>
|
|
260
|
+
*/
|
|
261
|
+
declare const Body: {
|
|
262
|
+
({ className, ref, ...props }: ComponentProps<"div">): import("react").JSX.Element;
|
|
263
|
+
displayName: string;
|
|
264
|
+
};
|
|
105
265
|
/**
|
|
106
266
|
* A vertically stacked set of disclosure sections styled after the shadcn /
|
|
107
267
|
* ngrok.com accordion.
|
|
@@ -159,7 +319,7 @@ declare const Accordion: {
|
|
|
159
319
|
* </Accordion.Item>
|
|
160
320
|
* </Accordion.Root>
|
|
161
321
|
*/
|
|
162
|
-
readonly Root:
|
|
322
|
+
readonly Root: typeof Root;
|
|
163
323
|
/**
|
|
164
324
|
* A single collapsible section. See {@link Item}.
|
|
165
325
|
*
|
|
@@ -176,10 +336,7 @@ declare const Accordion: {
|
|
|
176
336
|
* </Accordion.Item>
|
|
177
337
|
* </Accordion.Root>
|
|
178
338
|
*/
|
|
179
|
-
readonly Item:
|
|
180
|
-
/** The unique value identifying this item within its accordion. */
|
|
181
|
-
value: string;
|
|
182
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
339
|
+
readonly Item: typeof Item;
|
|
183
340
|
/**
|
|
184
341
|
* The `<button>` header that toggles a section. See {@link Trigger}.
|
|
185
342
|
*
|
|
@@ -196,7 +353,7 @@ declare const Accordion: {
|
|
|
196
353
|
* </Accordion.Item>
|
|
197
354
|
* </Accordion.Root>
|
|
198
355
|
*/
|
|
199
|
-
readonly Trigger:
|
|
356
|
+
readonly Trigger: typeof Trigger;
|
|
200
357
|
/**
|
|
201
358
|
* The caret indicating open/closed state. See {@link TriggerIcon}.
|
|
202
359
|
*
|
|
@@ -230,7 +387,7 @@ declare const Accordion: {
|
|
|
230
387
|
* </Accordion.Item>
|
|
231
388
|
* </Accordion.Root>
|
|
232
389
|
*/
|
|
233
|
-
readonly Content:
|
|
390
|
+
readonly Content: typeof Content;
|
|
234
391
|
/**
|
|
235
392
|
* The padded inner region of a {@link Content}. See {@link Body}.
|
|
236
393
|
*
|
|
@@ -249,7 +406,7 @@ declare const Accordion: {
|
|
|
249
406
|
* </Accordion.Item>
|
|
250
407
|
* </Accordion.Root>
|
|
251
408
|
*/
|
|
252
|
-
readonly Body:
|
|
409
|
+
readonly Body: typeof Body;
|
|
253
410
|
};
|
|
254
411
|
//#endregion
|
|
255
412
|
export { Accordion };
|
package/dist/accordion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-
|
|
1
|
+
import{t as e}from"./use-isomorphic-layout-effect-DdTRtMY-.js";import{n as t}from"./compose-refs-BdBMM9ga.js";import{t as n}from"./cx-IiQEAKf5.js";import{t as r}from"./icon-CGgMKpJg.js";import{t as i}from"./slot-CDk0Bb9z.js";import{CaretDownIcon as a}from"@phosphor-icons/react/CaretDown";import{createContext as o,useCallback as s,useContext as c,useEffect as l,useMemo as u,useRef as d,useState as f}from"react";import p from"tiny-invariant";import{jsx as m}from"react/jsx-runtime";function h(e,t){return e.includes(t)}function g(e,t,n,r){let i=e.includes(t);return n?r===`single`?i&&e.length===1?e:[t]:i?e:[...e,t]:i?e.filter(e=>e!==t):e}function _(e){return e==null?[]:typeof e==`string`?e===``?[]:[e]:e}function v(e,t){e.type===`single`?e.onValueChange?.(t[0]??``):e.onValueChange?.([...t])}function y(){return typeof document<`u`&&document.body!=null&&`onbeforematch`in document.body}const b=o(null);function x(e){let t=c(b);return p(t,`\`${e}\` must be rendered within \`Accordion.Root\`.`),t}const S=o(null);function C(e){let t=c(S);return p(t,`\`${e}\` must be rendered within \`Accordion.Item\`.`),t}const w=e=>{let{type:t=`multiple`,value:r,defaultValue:a,onValueChange:o,asChild:s,children:c,className:l,ref:d,...p}=e,h=r!=null,[y,x]=f(()=>_(a)),S=h?_(r):y,C=u(()=>({type:t,openValues:S,setItemOpen:(n,r)=>{let i=g(S,n,r,t);i!==S&&(h||x(i),v(e,i))}}),[t,S,h,e]),w={...p,"data-slot":`accordion`,className:n(`w-full divide-y divide-separator`,l)};return m(b.Provider,{value:C,children:m(s?i:`div`,{ref:d,...w,children:c})})};w.displayName=`Accordion`;const T=({children:e,value:t,ref:n,...r})=>{let{openValues:i,setItemOpen:a}=x(`Accordion.Item`),o=h(i,t),c=s(e=>{a(t,e)},[a,t]),l=u(()=>({open:o,setOpen:c}),[o,c]);return m(S.Provider,{value:l,children:m(`div`,{ref:n,...r,role:`group`,"data-slot":`accordion-item`,"data-state":o?`open`:`closed`,children:e})})};T.displayName=`AccordionItem`;const E=({className:e,children:t,onClick:r,ref:i,...a})=>{let{open:o,setOpen:s}=C(`Accordion.Trigger`);return m(`button`,{ref:i,type:`button`,...a,"data-slot":`accordion-trigger`,"data-state":o?`open`:`closed`,"aria-expanded":o,className:n(`group flex w-full cursor-pointer items-center justify-between gap-4 py-4 text-left font-medium outline-none`,`-mx-2 rounded-md px-2`,`transition-[padding] duration-200 ease-out data-state-open:pb-2 motion-reduce:transition-none`,`focus:outline-hidden focus-visible:ring-4 focus-visible:ring-focus-accent`,e),onClick:e=>{r?.(e),s(!o)},children:t})};E.displayName=`AccordionTrigger`;const D=m(a,{weight:`bold`}),O=({className:e,svg:t=D,...i})=>m(r,{...i,"data-slot":`accordion-trigger-icon`,svg:t,className:n(`size-4 shrink-0 text-muted transition-transform duration-200 group-data-state-open:rotate-180`,e)});O.displayName=`AccordionTriggerIcon`;const k=({className:r,children:i,ref:a,...o})=>{let{open:s,setOpen:c}=C(`Accordion.Content`),u=d(null),f=t(u,a);return l(()=>{let e=u.current;if(!e||!y())return;let t=()=>{e.removeAttribute(`hidden`),e.style.height=`auto`,c(!0)};return e.addEventListener(`beforematch`,t),()=>{e.removeEventListener(`beforematch`,t)}},[c]),e(()=>{let e=u.current;e&&(s||!y()?e.removeAttribute(`hidden`):(e.setAttribute(`hidden`,`until-found`),e.style.height=``))},[s]),m(`div`,{ref:f,...o,"data-slot":`accordion-content`,"data-state":s?`open`:`closed`,className:n(`h-0 overflow-hidden transition-[height,content-visibility] duration-200 ease-out [interpolate-size:allow-keywords] transition-discrete data-state-open:h-auto motion-reduce:transition-none`,r),children:i})};k.displayName=`AccordionContent`;const A=({className:e,ref:t,...r})=>m(`div`,{ref:t,...r,"data-slot":`accordion-body`,className:n(`pt-2 pb-4`,e)});A.displayName=`AccordionBody`;const j={Root:w,Item:T,Trigger:E,TriggerIcon:O,Content:k,Body:A};export{j as Accordion};
|