@spark-ui/components 10.0.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/CHANGELOG.md +15 -0
- package/LICENSE.md +21 -0
- package/README.md +19 -0
- package/dist/DialogTrigger-5SI4dvpK.d.mts +142 -0
- package/dist/DialogTrigger-5SI4dvpK.d.ts +142 -0
- package/dist/Input-g0LpWuv0.d.mts +17 -0
- package/dist/Input-g0LpWuv0.d.ts +17 -0
- package/dist/InputGroup-aoaZxCLk.d.mts +28 -0
- package/dist/InputGroup-aoaZxCLk.d.ts +28 -0
- package/dist/InputTrailingIcon-BBp7sE6D.d.mts +20 -0
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +20 -0
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.mts +19 -0
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +19 -0
- package/dist/accordion/index.d.mts +85 -0
- package/dist/accordion/index.d.ts +85 -0
- package/dist/accordion/index.js +461 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/accordion/index.mjs +249 -0
- package/dist/accordion/index.mjs.map +1 -0
- package/dist/alert-dialog/index.d.mts +119 -0
- package/dist/alert-dialog/index.d.ts +119 -0
- package/dist/alert-dialog/index.js +1451 -0
- package/dist/alert-dialog/index.js.map +1 -0
- package/dist/alert-dialog/index.mjs +177 -0
- package/dist/alert-dialog/index.mjs.map +1 -0
- package/dist/badge/index.d.mts +47 -0
- package/dist/badge/index.d.ts +47 -0
- package/dist/badge/index.js +122 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/badge/index.mjs +95 -0
- package/dist/badge/index.mjs.map +1 -0
- package/dist/breadcrumb/index.d.mts +64 -0
- package/dist/breadcrumb/index.d.ts +64 -0
- package/dist/breadcrumb/index.js +326 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/breadcrumb/index.mjs +149 -0
- package/dist/breadcrumb/index.mjs.map +1 -0
- package/dist/button/index.d.mts +40 -0
- package/dist/button/index.d.ts +40 -0
- package/dist/button/index.js +877 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button/index.mjs +10 -0
- package/dist/button/index.mjs.map +1 -0
- package/dist/carousel/index.d.mts +253 -0
- package/dist/carousel/index.d.ts +253 -0
- package/dist/carousel/index.js +1678 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/carousel/index.mjs +716 -0
- package/dist/carousel/index.mjs.map +1 -0
- package/dist/checkbox/index.d.mts +120 -0
- package/dist/checkbox/index.d.ts +120 -0
- package/dist/checkbox/index.js +873 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/checkbox/index.mjs +349 -0
- package/dist/checkbox/index.mjs.map +1 -0
- package/dist/chip/index.d.mts +97 -0
- package/dist/chip/index.d.ts +97 -0
- package/dist/chip/index.js +905 -0
- package/dist/chip/index.js.map +1 -0
- package/dist/chip/index.mjs +793 -0
- package/dist/chip/index.mjs.map +1 -0
- package/dist/chunk-2KPFQEAA.mjs +52 -0
- package/dist/chunk-2KPFQEAA.mjs.map +1 -0
- package/dist/chunk-4F5DOL57.mjs +26 -0
- package/dist/chunk-4F5DOL57.mjs.map +1 -0
- package/dist/chunk-6JOA37TZ.mjs +742 -0
- package/dist/chunk-6JOA37TZ.mjs.map +1 -0
- package/dist/chunk-7PMPYEHJ.mjs +379 -0
- package/dist/chunk-7PMPYEHJ.mjs.map +1 -0
- package/dist/chunk-AESXFMCC.mjs +68 -0
- package/dist/chunk-AESXFMCC.mjs.map +1 -0
- package/dist/chunk-B42LOFIZ.mjs +308 -0
- package/dist/chunk-B42LOFIZ.mjs.map +1 -0
- package/dist/chunk-FGOZHKBT.mjs +97 -0
- package/dist/chunk-FGOZHKBT.mjs.map +1 -0
- package/dist/chunk-HLXYG643.mjs +52 -0
- package/dist/chunk-HLXYG643.mjs.map +1 -0
- package/dist/chunk-JKNBJHD5.mjs +601 -0
- package/dist/chunk-JKNBJHD5.mjs.map +1 -0
- package/dist/chunk-K7VP7DH3.mjs +66 -0
- package/dist/chunk-K7VP7DH3.mjs.map +1 -0
- package/dist/chunk-MUNDKRAE.mjs +80 -0
- package/dist/chunk-MUNDKRAE.mjs.map +1 -0
- package/dist/chunk-NBZKMCHF.mjs +36 -0
- package/dist/chunk-NBZKMCHF.mjs.map +1 -0
- package/dist/chunk-PZWESKAR.mjs +314 -0
- package/dist/chunk-PZWESKAR.mjs.map +1 -0
- package/dist/collapsible/index.d.mts +60 -0
- package/dist/collapsible/index.d.ts +60 -0
- package/dist/collapsible/index.js +140 -0
- package/dist/collapsible/index.js.map +1 -0
- package/dist/collapsible/index.mjs +8 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/combobox/index.d.mts +285 -0
- package/dist/combobox/index.d.ts +285 -0
- package/dist/combobox/index.js +2920 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/combobox/index.mjs +1267 -0
- package/dist/combobox/index.mjs.map +1 -0
- package/dist/dialog/index.d.mts +33 -0
- package/dist/dialog/index.d.ts +33 -0
- package/dist/dialog/index.js +1286 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/dialog/index.mjs +13 -0
- package/dist/dialog/index.mjs.map +1 -0
- package/dist/divider/index.d.mts +61 -0
- package/dist/divider/index.d.ts +61 -0
- package/dist/divider/index.js +223 -0
- package/dist/divider/index.js.map +1 -0
- package/dist/divider/index.mjs +196 -0
- package/dist/divider/index.mjs.map +1 -0
- package/dist/drawer/index.d.mts +148 -0
- package/dist/drawer/index.d.ts +148 -0
- package/dist/drawer/index.js +1266 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/drawer/index.mjs +299 -0
- package/dist/drawer/index.mjs.map +1 -0
- package/dist/dropdown/index.d.mts +233 -0
- package/dist/dropdown/index.d.ts +233 -0
- package/dist/dropdown/index.js +2402 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/dropdown/index.mjs +741 -0
- package/dist/dropdown/index.mjs.map +1 -0
- package/dist/form-field/index.d.mts +176 -0
- package/dist/form-field/index.d.ts +176 -0
- package/dist/form-field/index.js +540 -0
- package/dist/form-field/index.js.map +1 -0
- package/dist/form-field/index.mjs +13 -0
- package/dist/form-field/index.mjs.map +1 -0
- package/dist/icon/index.d.mts +28 -0
- package/dist/icon/index.d.ts +28 -0
- package/dist/icon/index.js +127 -0
- package/dist/icon/index.js.map +1 -0
- package/dist/icon/index.mjs +9 -0
- package/dist/icon/index.mjs.map +1 -0
- package/dist/icon-button/index.d.mts +16 -0
- package/dist/icon-button/index.d.ts +16 -0
- package/dist/icon-button/index.js +921 -0
- package/dist/icon-button/index.js.map +1 -0
- package/dist/icon-button/index.mjs +11 -0
- package/dist/icon-button/index.mjs.map +1 -0
- package/dist/input/index.d.mts +78 -0
- package/dist/input/index.d.ts +78 -0
- package/dist/input/index.js +1119 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/index.mjs +16 -0
- package/dist/input/index.mjs.map +1 -0
- package/dist/kbd/index.d.mts +9 -0
- package/dist/kbd/index.d.ts +9 -0
- package/dist/kbd/index.js +46 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/kbd/index.mjs +19 -0
- package/dist/kbd/index.mjs.map +1 -0
- package/dist/label/index.d.mts +11 -0
- package/dist/label/index.d.ts +11 -0
- package/dist/label/index.js +78 -0
- package/dist/label/index.js.map +1 -0
- package/dist/label/index.mjs +7 -0
- package/dist/label/index.mjs.map +1 -0
- package/dist/link-box/index.d.mts +34 -0
- package/dist/link-box/index.d.ts +34 -0
- package/dist/link-box/index.js +92 -0
- package/dist/link-box/index.js.map +1 -0
- package/dist/link-box/index.mjs +58 -0
- package/dist/link-box/index.mjs.map +1 -0
- package/dist/pagination/index.d.mts +143 -0
- package/dist/pagination/index.d.ts +143 -0
- package/dist/pagination/index.js +1303 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/index.mjs +326 -0
- package/dist/pagination/index.mjs.map +1 -0
- package/dist/popover/index.d.mts +93 -0
- package/dist/popover/index.d.ts +93 -0
- package/dist/popover/index.js +1280 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/index.mjs +13 -0
- package/dist/popover/index.mjs.map +1 -0
- package/dist/portal/index.d.mts +13 -0
- package/dist/portal/index.d.ts +13 -0
- package/dist/portal/index.js +37 -0
- package/dist/portal/index.js.map +1 -0
- package/dist/portal/index.mjs +10 -0
- package/dist/portal/index.mjs.map +1 -0
- package/dist/progress/index.d.mts +48 -0
- package/dist/progress/index.d.ts +48 -0
- package/dist/progress/index.js +201 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/index.mjs +174 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/progress-tracker/index.d.mts +81 -0
- package/dist/progress-tracker/index.d.ts +81 -0
- package/dist/progress-tracker/index.js +834 -0
- package/dist/progress-tracker/index.js.map +1 -0
- package/dist/progress-tracker/index.mjs +716 -0
- package/dist/progress-tracker/index.mjs.map +1 -0
- package/dist/radio-group/index.d.mts +100 -0
- package/dist/radio-group/index.d.ts +100 -0
- package/dist/radio-group/index.js +824 -0
- package/dist/radio-group/index.js.map +1 -0
- package/dist/radio-group/index.mjs +297 -0
- package/dist/radio-group/index.mjs.map +1 -0
- package/dist/rating/index.d.mts +78 -0
- package/dist/rating/index.d.ts +78 -0
- package/dist/rating/index.js +362 -0
- package/dist/rating/index.js.map +1 -0
- package/dist/rating/index.mjs +247 -0
- package/dist/rating/index.mjs.map +1 -0
- package/dist/scrolling-list/index.d.mts +105 -0
- package/dist/scrolling-list/index.d.ts +105 -0
- package/dist/scrolling-list/index.js +1367 -0
- package/dist/scrolling-list/index.js.map +1 -0
- package/dist/scrolling-list/index.mjs +407 -0
- package/dist/scrolling-list/index.mjs.map +1 -0
- package/dist/select/index.d.mts +167 -0
- package/dist/select/index.d.ts +167 -0
- package/dist/select/index.js +991 -0
- package/dist/select/index.js.map +1 -0
- package/dist/select/index.mjs +470 -0
- package/dist/select/index.mjs.map +1 -0
- package/dist/skeleton/index.d.mts +67 -0
- package/dist/skeleton/index.d.ts +67 -0
- package/dist/skeleton/index.js +206 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/skeleton/index.mjs +147 -0
- package/dist/skeleton/index.mjs.map +1 -0
- package/dist/slider/index.d.mts +97 -0
- package/dist/slider/index.d.ts +97 -0
- package/dist/slider/index.js +209 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slider/index.mjs +182 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/slot/index.d.mts +17 -0
- package/dist/slot/index.d.ts +17 -0
- package/dist/slot/index.js +51 -0
- package/dist/slot/index.js.map +1 -0
- package/dist/slot/index.mjs +11 -0
- package/dist/slot/index.mjs.map +1 -0
- package/dist/snackbar/index.d.mts +158 -0
- package/dist/snackbar/index.d.ts +158 -0
- package/dist/snackbar/index.js +1693 -0
- package/dist/snackbar/index.js.map +1 -0
- package/dist/snackbar/index.mjs +733 -0
- package/dist/snackbar/index.mjs.map +1 -0
- package/dist/spinner/index.d.mts +21 -0
- package/dist/spinner/index.d.ts +21 -0
- package/dist/spinner/index.js +139 -0
- package/dist/spinner/index.js.map +1 -0
- package/dist/spinner/index.mjs +9 -0
- package/dist/spinner/index.mjs.map +1 -0
- package/dist/stepper/index.d.mts +82 -0
- package/dist/stepper/index.d.ts +82 -0
- package/dist/stepper/index.js +2178 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/stepper/index.mjs +229 -0
- package/dist/stepper/index.mjs.map +1 -0
- package/dist/switch/index.d.mts +64 -0
- package/dist/switch/index.d.ts +64 -0
- package/dist/switch/index.js +768 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/switch/index.mjs +245 -0
- package/dist/switch/index.mjs.map +1 -0
- package/dist/tabs/index.d.mts +103 -0
- package/dist/tabs/index.d.ts +103 -0
- package/dist/tabs/index.js +1315 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/tabs/index.mjs +391 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/tag/index.d.mts +27 -0
- package/dist/tag/index.d.ts +27 -0
- package/dist/tag/index.js +269 -0
- package/dist/tag/index.js.map +1 -0
- package/dist/tag/index.mjs +237 -0
- package/dist/tag/index.mjs.map +1 -0
- package/dist/text-link/index.d.mts +20 -0
- package/dist/text-link/index.d.ts +20 -0
- package/dist/text-link/index.js +99 -0
- package/dist/text-link/index.js.map +1 -0
- package/dist/text-link/index.mjs +8 -0
- package/dist/text-link/index.mjs.map +1 -0
- package/dist/textarea/index.d.mts +47 -0
- package/dist/textarea/index.d.ts +47 -0
- package/dist/textarea/index.js +1180 -0
- package/dist/textarea/index.js.map +1 -0
- package/dist/textarea/index.mjs +77 -0
- package/dist/textarea/index.mjs.map +1 -0
- package/dist/visually-hidden/index.d.mts +16 -0
- package/dist/visually-hidden/index.d.ts +16 -0
- package/dist/visually-hidden/index.js +67 -0
- package/dist/visually-hidden/index.js.map +1 -0
- package/dist/visually-hidden/index.mjs +8 -0
- package/dist/visually-hidden/index.mjs.map +1 -0
- package/global.d.ts +12 -0
- package/package.json +75 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +11 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Slot
|
|
3
|
+
} from "./chunk-4F5DOL57.mjs";
|
|
4
|
+
|
|
5
|
+
// src/text-link/TextLink.tsx
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var textLinkStyles = cva(["inline-flex items-center focus-visible:u-outline"], {
|
|
9
|
+
variants: {
|
|
10
|
+
intent: {
|
|
11
|
+
current: "text-current hover:opacity-dim-1",
|
|
12
|
+
main: "text-main hover:text-main-hovered",
|
|
13
|
+
support: "text-support hover:text-support-hovered",
|
|
14
|
+
accent: "text-accent hover:text-accent-hovered",
|
|
15
|
+
basic: "text-basic hover:text-basic-hovered",
|
|
16
|
+
success: "text-success hover:text-success-hovered",
|
|
17
|
+
alert: "text-alert hover:text-alert-hovered",
|
|
18
|
+
danger: "text-error hover:text-error-hovered",
|
|
19
|
+
info: "text-info hover:text-info-hovered",
|
|
20
|
+
neutral: "text-neutral hover:text-neutral-hovered"
|
|
21
|
+
},
|
|
22
|
+
/** By default, TextLink inherits the current font weight. Use `bold` to highlight it. */
|
|
23
|
+
bold: {
|
|
24
|
+
true: "font-bold"
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Underline is enabled by default.
|
|
28
|
+
* You can remove it, but be careful about a11y, as you should make obvious to users what is a link or not.
|
|
29
|
+
*/
|
|
30
|
+
underline: {
|
|
31
|
+
true: "underline",
|
|
32
|
+
false: "hover:underline focus:underline"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
intent: "current",
|
|
37
|
+
bold: false,
|
|
38
|
+
underline: true
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
var TextLink = ({
|
|
42
|
+
asChild = false,
|
|
43
|
+
bold = false,
|
|
44
|
+
children,
|
|
45
|
+
className,
|
|
46
|
+
intent = "current",
|
|
47
|
+
underline = true,
|
|
48
|
+
ref,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
51
|
+
const Component = asChild ? Slot : "a";
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
Component,
|
|
54
|
+
{
|
|
55
|
+
ref,
|
|
56
|
+
className: textLinkStyles({ className, bold, intent, underline }),
|
|
57
|
+
...props,
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
TextLink
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=chunk-K7VP7DH3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/text-link/TextLink.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority'\nimport { type ComponentPropsWithRef } from 'react'\n\nimport { Slot } from '../slot'\n\nconst textLinkStyles = cva(['inline-flex items-center focus-visible:u-outline'], {\n variants: {\n intent: {\n current: 'text-current hover:opacity-dim-1',\n main: 'text-main hover:text-main-hovered',\n support: 'text-support hover:text-support-hovered',\n accent: 'text-accent hover:text-accent-hovered',\n basic: 'text-basic hover:text-basic-hovered',\n success: 'text-success hover:text-success-hovered',\n alert: 'text-alert hover:text-alert-hovered',\n danger: 'text-error hover:text-error-hovered',\n info: 'text-info hover:text-info-hovered',\n neutral: 'text-neutral hover:text-neutral-hovered',\n },\n /** By default, TextLink inherits the current font weight. Use `bold` to highlight it. */\n bold: {\n true: 'font-bold',\n },\n /**\n * Underline is enabled by default.\n * You can remove it, but be careful about a11y, as you should make obvious to users what is a link or not.\n */\n underline: {\n true: 'underline',\n false: 'hover:underline focus:underline',\n },\n },\n defaultVariants: {\n intent: 'current',\n bold: false,\n underline: true,\n },\n})\n\nexport type StylesProps = VariantProps<typeof textLinkStyles>\n\nexport type TextLinkProps = ComponentPropsWithRef<'a'> &\n StylesProps & {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n }\n\nexport const TextLink = ({\n asChild = false,\n bold = false,\n children,\n className,\n intent = 'current',\n underline = true,\n ref,\n ...props\n}: TextLinkProps) => {\n const Component = asChild ? Slot : 'a'\n\n return (\n <Component\n ref={ref}\n className={textLinkStyles({ className, bold, intent, underline })}\n {...props}\n >\n {children}\n </Component>\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,WAA8B;AA8DnC;AAzDJ,IAAM,iBAAiB,IAAI,CAAC,kDAAkD,GAAG;AAAA,EAC/E,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,SAAS;AAAA,MACT,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AAAA;AAAA,IAEA,MAAM;AAAA,MACJ,MAAM;AAAA,IACR;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,WAAW;AAAA,EACb;AACF,CAAC;AAYM,IAAM,WAAW,CAAC;AAAA,EACvB,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,MAAqB;AACnB,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,eAAe,EAAE,WAAW,MAAM,QAAQ,UAAU,CAAC;AAAA,MAC/D,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VisuallyHidden
|
|
3
|
+
} from "./chunk-NBZKMCHF.mjs";
|
|
4
|
+
|
|
5
|
+
// src/spinner/Spinner.styles.tsx
|
|
6
|
+
import { makeVariants } from "@spark-ui/internal-utils";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
var defaultVariants = {
|
|
9
|
+
intent: "current",
|
|
10
|
+
size: "current",
|
|
11
|
+
isBackgroundVisible: false
|
|
12
|
+
};
|
|
13
|
+
var spinnerStyles = cva(
|
|
14
|
+
["inline-block", "border-solid", "rounded-full", "border-md", "animate-spin"],
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
/**
|
|
18
|
+
* Use `size` prop to set the size of the spinner. If you want to set the full size for the spinner, don't forget to add a wrapping container with its own size.
|
|
19
|
+
*/
|
|
20
|
+
size: {
|
|
21
|
+
current: ["u-current-font-size"],
|
|
22
|
+
sm: ["w-sz-20", "h-sz-20"],
|
|
23
|
+
md: ["w-sz-28", "h-sz-28"],
|
|
24
|
+
full: ["w-full", "h-full"]
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Color scheme of the spinner.
|
|
28
|
+
*/
|
|
29
|
+
intent: makeVariants({
|
|
30
|
+
current: ["border-current"],
|
|
31
|
+
main: ["border-main"],
|
|
32
|
+
support: ["border-support"],
|
|
33
|
+
accent: ["border-accent"],
|
|
34
|
+
basic: ["border-basic"],
|
|
35
|
+
success: ["border-success"],
|
|
36
|
+
alert: ["border-alert"],
|
|
37
|
+
error: ["border-error"],
|
|
38
|
+
info: ["border-info"],
|
|
39
|
+
neutral: ["border-neutral"]
|
|
40
|
+
}),
|
|
41
|
+
/**
|
|
42
|
+
* Size of the button.
|
|
43
|
+
*/
|
|
44
|
+
isBackgroundVisible: {
|
|
45
|
+
true: ["border-b-neutral-container", "border-l-neutral-container"],
|
|
46
|
+
false: ["border-b-transparent", "border-l-transparent"]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// src/spinner/Spinner.tsx
|
|
54
|
+
import { jsx } from "react/jsx-runtime";
|
|
55
|
+
var Spinner = ({
|
|
56
|
+
className,
|
|
57
|
+
size = "current",
|
|
58
|
+
intent = "current",
|
|
59
|
+
label,
|
|
60
|
+
isBackgroundVisible,
|
|
61
|
+
ref,
|
|
62
|
+
...others
|
|
63
|
+
}) => {
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
"span",
|
|
66
|
+
{
|
|
67
|
+
role: "status",
|
|
68
|
+
"data-spark-component": "spinner",
|
|
69
|
+
ref,
|
|
70
|
+
className: spinnerStyles({ className, size, intent, isBackgroundVisible }),
|
|
71
|
+
...others,
|
|
72
|
+
children: label && /* @__PURE__ */ jsx(VisuallyHidden, { children: label })
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
Spinner
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=chunk-MUNDKRAE.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/spinner/Spinner.styles.tsx","../src/spinner/Spinner.tsx"],"sourcesContent":["import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nconst defaultVariants = {\n intent: 'current',\n size: 'current',\n isBackgroundVisible: false,\n} as const\n\nexport const spinnerStyles = cva(\n ['inline-block', 'border-solid', 'rounded-full', 'border-md', 'animate-spin'],\n {\n variants: {\n /**\n * Use `size` prop to set the size of the spinner. If you want to set the full size for the spinner, don't forget to add a wrapping container with its own size.\n */\n size: {\n current: ['u-current-font-size'],\n sm: ['w-sz-20', 'h-sz-20'],\n md: ['w-sz-28', 'h-sz-28'],\n full: ['w-full', 'h-full'],\n },\n /**\n * Color scheme of the spinner.\n */\n intent: makeVariants<\n 'intent',\n [\n 'current',\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'error',\n 'info',\n 'neutral',\n ]\n >({\n current: ['border-current'],\n main: ['border-main'],\n support: ['border-support'],\n accent: ['border-accent'],\n basic: ['border-basic'],\n success: ['border-success'],\n alert: ['border-alert'],\n error: ['border-error'],\n info: ['border-info'],\n neutral: ['border-neutral'],\n }),\n /**\n * Size of the button.\n */\n isBackgroundVisible: {\n true: ['border-b-neutral-container', 'border-l-neutral-container'],\n false: ['border-b-transparent', 'border-l-transparent'],\n },\n },\n defaultVariants,\n }\n)\n\nexport type SpinnerStylesProps = VariantProps<typeof spinnerStyles>\n","import { ComponentPropsWithRef, PropsWithChildren } from 'react'\n\nimport { VisuallyHidden } from '../visually-hidden'\nimport { spinnerStyles, SpinnerStylesProps } from './Spinner.styles'\n\nexport interface SpinnerProps extends ComponentPropsWithRef<'div'>, SpinnerStylesProps {\n /**\n * Use `label` prop for accessibility, it is important to add a fallback loading text. This text will be visible to screen readers.\n */\n label?: string\n}\n\nexport const Spinner = ({\n className,\n size = 'current',\n intent = 'current',\n label,\n isBackgroundVisible,\n ref,\n ...others\n}: PropsWithChildren<SpinnerProps>) => {\n return (\n <span\n role=\"status\"\n data-spark-component=\"spinner\"\n ref={ref}\n className={spinnerStyles({ className, size, intent, isBackgroundVisible })}\n {...others}\n >\n {label && <VisuallyHidden>{label}</VisuallyHidden>}\n </span>\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,WAAyB;AAElC,IAAM,kBAAkB;AAAA,EACtB,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,qBAAqB;AACvB;AAEO,IAAM,gBAAgB;AAAA,EAC3B,CAAC,gBAAgB,gBAAgB,gBAAgB,aAAa,cAAc;AAAA,EAC5E;AAAA,IACE,UAAU;AAAA;AAAA;AAAA;AAAA,MAIR,MAAM;AAAA,QACJ,SAAS,CAAC,qBAAqB;AAAA,QAC/B,IAAI,CAAC,WAAW,SAAS;AAAA,QACzB,IAAI,CAAC,WAAW,SAAS;AAAA,QACzB,MAAM,CAAC,UAAU,QAAQ;AAAA,MAC3B;AAAA;AAAA;AAAA;AAAA,MAIA,QAAQ,aAcN;AAAA,QACA,SAAS,CAAC,gBAAgB;AAAA,QAC1B,MAAM,CAAC,aAAa;AAAA,QACpB,SAAS,CAAC,gBAAgB;AAAA,QAC1B,QAAQ,CAAC,eAAe;AAAA,QACxB,OAAO,CAAC,cAAc;AAAA,QACtB,SAAS,CAAC,gBAAgB;AAAA,QAC1B,OAAO,CAAC,cAAc;AAAA,QACtB,OAAO,CAAC,cAAc;AAAA,QACtB,MAAM,CAAC,aAAa;AAAA,QACpB,SAAS,CAAC,gBAAgB;AAAA,MAC5B,CAAC;AAAA;AAAA;AAAA;AAAA,MAID,qBAAqB;AAAA,QACnB,MAAM,CAAC,8BAA8B,4BAA4B;AAAA,QACjE,OAAO,CAAC,wBAAwB,sBAAsB;AAAA,MACxD;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;;;AChCgB;AAjBT,IAAM,UAAU,CAAC;AAAA,EACtB;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAuC;AACrC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,wBAAqB;AAAA,MACrB;AAAA,MACA,WAAW,cAAc,EAAE,WAAW,MAAM,QAAQ,oBAAoB,CAAC;AAAA,MACxE,GAAG;AAAA,MAEH,mBAAS,oBAAC,kBAAgB,iBAAM;AAAA;AAAA,EACnC;AAEJ;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Slot
|
|
3
|
+
} from "./chunk-4F5DOL57.mjs";
|
|
4
|
+
|
|
5
|
+
// src/visually-hidden/VisuallyHidden.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
|
|
8
|
+
const Component = asChild ? Slot : "span";
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
Component,
|
|
11
|
+
{
|
|
12
|
+
...props,
|
|
13
|
+
ref,
|
|
14
|
+
style: {
|
|
15
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
16
|
+
position: "absolute",
|
|
17
|
+
border: 0,
|
|
18
|
+
width: 1,
|
|
19
|
+
height: 1,
|
|
20
|
+
padding: 0,
|
|
21
|
+
margin: -1,
|
|
22
|
+
overflow: "hidden",
|
|
23
|
+
clip: "rect(0, 0, 0, 0)",
|
|
24
|
+
whiteSpace: "nowrap",
|
|
25
|
+
wordWrap: "normal",
|
|
26
|
+
...props.style
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
VisuallyHidden.displayName = "VisuallyHidden";
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
VisuallyHidden
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=chunk-NBZKMCHF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/visually-hidden/VisuallyHidden.tsx"],"sourcesContent":["import { HTMLAttributes, PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport type VisuallyHiddenProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLElement>\n}\n\nexport const VisuallyHidden = ({ asChild = false, ref, ...props }: VisuallyHiddenProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n {...props}\n ref={ref}\n style={{\n // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss\n position: 'absolute',\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n wordWrap: 'normal',\n ...props.style,\n }}\n />\n )\n}\n\nVisuallyHidden.displayName = 'VisuallyHidden'\n"],"mappings":";;;;;AAgBI;AAJG,IAAM,iBAAiB,CAAC,EAAE,UAAU,OAAO,KAAK,GAAG,MAAM,MAA2B;AACzF,QAAM,YAAY,UAAU,OAAO;AAEnC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA,OAAO;AAAA;AAAA,QAEL,UAAU;AAAA,QACV,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,GAAG,MAAM;AAAA,MACX;AAAA;AAAA,EACF;AAEJ;AAEA,eAAe,cAAc;","names":[]}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconButton
|
|
3
|
+
} from "./chunk-2KPFQEAA.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Icon
|
|
6
|
+
} from "./chunk-AESXFMCC.mjs";
|
|
7
|
+
|
|
8
|
+
// src/dialog/Dialog.tsx
|
|
9
|
+
import { Dialog as RadixDialog } from "radix-ui";
|
|
10
|
+
import { useEffect, useRef } from "react";
|
|
11
|
+
|
|
12
|
+
// src/dialog/DialogContext.tsx
|
|
13
|
+
import { createContext, useContext, useState } from "react";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var DialogContext = createContext(null);
|
|
16
|
+
var DialogProvider = ({ children: childrenProp }) => {
|
|
17
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
DialogContext.Provider,
|
|
20
|
+
{
|
|
21
|
+
value: {
|
|
22
|
+
isFullScreen,
|
|
23
|
+
setIsFullScreen
|
|
24
|
+
},
|
|
25
|
+
children: childrenProp
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
var useDialog = () => {
|
|
30
|
+
const context = useContext(DialogContext);
|
|
31
|
+
if (!context) {
|
|
32
|
+
throw Error("useDialog must be used within a Dialog provider");
|
|
33
|
+
}
|
|
34
|
+
return context;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/dialog/Dialog.tsx
|
|
38
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
39
|
+
var Dialog = ({ children, ...rest }) => {
|
|
40
|
+
const open = rest.open;
|
|
41
|
+
const activeElementRef = useRef(null);
|
|
42
|
+
function handleActiveElementFocus() {
|
|
43
|
+
if (open && document.activeElement) {
|
|
44
|
+
activeElementRef.current = document.activeElement;
|
|
45
|
+
}
|
|
46
|
+
if (!open) {
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
if (!(activeElementRef.current instanceof HTMLElement)) return;
|
|
49
|
+
activeElementRef.current.focus();
|
|
50
|
+
}, 0);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
useEffect(handleActiveElementFocus, [open]);
|
|
54
|
+
return /* @__PURE__ */ jsx2(DialogProvider, { children: /* @__PURE__ */ jsx2(RadixDialog.Root, { ...rest, children }) });
|
|
55
|
+
};
|
|
56
|
+
Dialog.displayName = "Dialog.Root";
|
|
57
|
+
|
|
58
|
+
// src/dialog/DialogBody.styles.ts
|
|
59
|
+
import { cva } from "class-variance-authority";
|
|
60
|
+
var dialogBodyStyles = cva(
|
|
61
|
+
["grow", "overflow-y-auto", "outline-hidden", "focus-visible:u-outline"],
|
|
62
|
+
{
|
|
63
|
+
variants: {
|
|
64
|
+
inset: {
|
|
65
|
+
true: "",
|
|
66
|
+
false: "px-xl py-lg"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
// src/dialog/DialogBody.tsx
|
|
73
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
74
|
+
var Body = ({
|
|
75
|
+
children,
|
|
76
|
+
className,
|
|
77
|
+
inset = false,
|
|
78
|
+
ref,
|
|
79
|
+
...rest
|
|
80
|
+
}) => /* @__PURE__ */ jsx3("div", { ref, className: dialogBodyStyles({ inset, className }), ...rest, children });
|
|
81
|
+
Body.displayName = "Dialog.Body";
|
|
82
|
+
|
|
83
|
+
// src/dialog/DialogClose.tsx
|
|
84
|
+
import { Dialog as RadixDialog2 } from "radix-ui";
|
|
85
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
86
|
+
var Close = (props) => /* @__PURE__ */ jsx4(RadixDialog2.Close, { ...props });
|
|
87
|
+
Close.displayName = "Dialog.Close";
|
|
88
|
+
|
|
89
|
+
// src/dialog/DialogCloseButton.tsx
|
|
90
|
+
import { Close as CloseSVG } from "@spark-ui/icons/Close";
|
|
91
|
+
import { cx } from "class-variance-authority";
|
|
92
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
93
|
+
var Root = ({
|
|
94
|
+
"aria-label": ariaLabel,
|
|
95
|
+
className,
|
|
96
|
+
size = "md",
|
|
97
|
+
intent = "neutral",
|
|
98
|
+
design = "ghost",
|
|
99
|
+
children = /* @__PURE__ */ jsx5(CloseSVG, {}),
|
|
100
|
+
ref,
|
|
101
|
+
...rest
|
|
102
|
+
}) => {
|
|
103
|
+
return /* @__PURE__ */ jsx5(
|
|
104
|
+
Close,
|
|
105
|
+
{
|
|
106
|
+
"data-part": "close",
|
|
107
|
+
ref,
|
|
108
|
+
className: cx(["absolute", "top-md", "right-xl"], className),
|
|
109
|
+
asChild: true,
|
|
110
|
+
...rest,
|
|
111
|
+
children: /* @__PURE__ */ jsx5(IconButton, { intent, size, design, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx5(Icon, { children }) })
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
var CloseButton = Object.assign(Root, {
|
|
116
|
+
id: "CloseButton"
|
|
117
|
+
});
|
|
118
|
+
Root.displayName = "Dialog.CloseButton";
|
|
119
|
+
|
|
120
|
+
// src/dialog/DialogContent.tsx
|
|
121
|
+
import { Dialog as RadixDialog3 } from "radix-ui";
|
|
122
|
+
import { useEffect as useEffect2 } from "react";
|
|
123
|
+
|
|
124
|
+
// src/dialog/DialogContent.styles.tsx
|
|
125
|
+
import { cva as cva2 } from "class-variance-authority";
|
|
126
|
+
var dialogContentStyles = cva2(
|
|
127
|
+
[
|
|
128
|
+
"z-modal flex flex-col bg-surface group",
|
|
129
|
+
"focus-visible:outline-hidden focus-visible:u-outline",
|
|
130
|
+
"[&:not(:has(footer))]:pb-lg",
|
|
131
|
+
"[&:not(:has(header))]:pt-lg"
|
|
132
|
+
],
|
|
133
|
+
{
|
|
134
|
+
variants: {
|
|
135
|
+
size: {
|
|
136
|
+
fullscreen: "fixed size-full top-0 left-0",
|
|
137
|
+
sm: "max-w-sz-480",
|
|
138
|
+
md: "max-w-sz-672",
|
|
139
|
+
lg: "max-w-sz-864"
|
|
140
|
+
},
|
|
141
|
+
isNarrow: {
|
|
142
|
+
true: [],
|
|
143
|
+
false: []
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
compoundVariants: [
|
|
147
|
+
{
|
|
148
|
+
size: ["sm", "md", "lg"],
|
|
149
|
+
class: [
|
|
150
|
+
"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",
|
|
151
|
+
"max-h-[80%]",
|
|
152
|
+
"shadow-md rounded-lg",
|
|
153
|
+
"data-[state=open]:animate-fade-in",
|
|
154
|
+
"data-[state=closed]:animate-fade-out"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
size: ["sm", "md", "lg"],
|
|
159
|
+
isNarrow: false,
|
|
160
|
+
class: ["w-full"]
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
defaultVariants: {
|
|
164
|
+
size: "md",
|
|
165
|
+
isNarrow: false
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// src/dialog/DialogContent.tsx
|
|
171
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
172
|
+
var Content = ({
|
|
173
|
+
children,
|
|
174
|
+
className,
|
|
175
|
+
isNarrow = false,
|
|
176
|
+
size = "md",
|
|
177
|
+
onInteractOutside,
|
|
178
|
+
ref,
|
|
179
|
+
...rest
|
|
180
|
+
}) => {
|
|
181
|
+
const { setIsFullScreen } = useDialog();
|
|
182
|
+
useEffect2(() => {
|
|
183
|
+
if (size === "fullscreen") setIsFullScreen(true);
|
|
184
|
+
return () => setIsFullScreen(false);
|
|
185
|
+
}, [setIsFullScreen, size]);
|
|
186
|
+
return /* @__PURE__ */ jsx6(
|
|
187
|
+
RadixDialog3.Content,
|
|
188
|
+
{
|
|
189
|
+
"data-spark-component": "dialog-content",
|
|
190
|
+
ref,
|
|
191
|
+
className: dialogContentStyles({
|
|
192
|
+
className,
|
|
193
|
+
isNarrow,
|
|
194
|
+
size
|
|
195
|
+
}),
|
|
196
|
+
onInteractOutside: (e) => {
|
|
197
|
+
const isForegroundElement = e.target.closest(".z-toast, .z-popover");
|
|
198
|
+
if (isForegroundElement) {
|
|
199
|
+
e.preventDefault();
|
|
200
|
+
}
|
|
201
|
+
onInteractOutside?.(e);
|
|
202
|
+
},
|
|
203
|
+
...rest,
|
|
204
|
+
children
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
};
|
|
208
|
+
Content.displayName = "Dialog.Content";
|
|
209
|
+
|
|
210
|
+
// src/dialog/DialogDescription.tsx
|
|
211
|
+
import { Dialog as RadixDialog4 } from "radix-ui";
|
|
212
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
213
|
+
var Description = (props) => /* @__PURE__ */ jsx7(RadixDialog4.Description, { ...props });
|
|
214
|
+
Description.displayName = "Dialog.Description";
|
|
215
|
+
|
|
216
|
+
// src/dialog/DialogFooter.tsx
|
|
217
|
+
import { cx as cx2 } from "class-variance-authority";
|
|
218
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
219
|
+
var Footer = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx8("footer", { ref, className: cx2(className, ["px-xl", "py-lg"]), ...rest, children });
|
|
220
|
+
Footer.displayName = "Dialog.Footer";
|
|
221
|
+
|
|
222
|
+
// src/dialog/DialogHeader.tsx
|
|
223
|
+
import { cx as cx3 } from "class-variance-authority";
|
|
224
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
225
|
+
var Header = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx9("header", { ref, className: cx3(className, ["px-xl", "py-lg"]), ...rest, children });
|
|
226
|
+
Header.displayName = "Dialog.Header";
|
|
227
|
+
|
|
228
|
+
// src/dialog/DialogOverlay.tsx
|
|
229
|
+
import { cx as cx4 } from "class-variance-authority";
|
|
230
|
+
import { Dialog as RadixDialog5 } from "radix-ui";
|
|
231
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
232
|
+
var Overlay = ({ className, ref, ...rest }) => {
|
|
233
|
+
const { isFullScreen } = useDialog();
|
|
234
|
+
return /* @__PURE__ */ jsx10(
|
|
235
|
+
RadixDialog5.Overlay,
|
|
236
|
+
{
|
|
237
|
+
ref,
|
|
238
|
+
className: cx4(
|
|
239
|
+
isFullScreen ? "hidden" : "fixed",
|
|
240
|
+
["top-0", "left-0", "w-screen", "h-screen", "z-overlay"],
|
|
241
|
+
["bg-overlay/dim-3"],
|
|
242
|
+
["data-[state=open]:animate-fade-in"],
|
|
243
|
+
["data-[state=closed]:animate-fade-out"],
|
|
244
|
+
className
|
|
245
|
+
),
|
|
246
|
+
...rest
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
Overlay.displayName = "Dialog.Overlay";
|
|
251
|
+
|
|
252
|
+
// src/dialog/DialogPortal.tsx
|
|
253
|
+
import { Dialog as RadixDialog6 } from "radix-ui";
|
|
254
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
255
|
+
var Portal = ({ children, ...rest }) => /* @__PURE__ */ jsx11(RadixDialog6.Portal, { ...rest, children });
|
|
256
|
+
Portal.displayName = "Dialog.Portal";
|
|
257
|
+
|
|
258
|
+
// src/dialog/DialogTitle.tsx
|
|
259
|
+
import { cx as cx5 } from "class-variance-authority";
|
|
260
|
+
import { Dialog as RadixDialog7 } from "radix-ui";
|
|
261
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
262
|
+
var Title = ({ className, ref, ...others }) => {
|
|
263
|
+
return /* @__PURE__ */ jsx12(
|
|
264
|
+
RadixDialog7.Title,
|
|
265
|
+
{
|
|
266
|
+
ref,
|
|
267
|
+
className: cx5(
|
|
268
|
+
"text-headline-1 text-on-surface",
|
|
269
|
+
"group-has-data-[part=close]:pr-3xl",
|
|
270
|
+
className
|
|
271
|
+
),
|
|
272
|
+
...others
|
|
273
|
+
}
|
|
274
|
+
);
|
|
275
|
+
};
|
|
276
|
+
Title.displayName = "Dialog.Title";
|
|
277
|
+
|
|
278
|
+
// src/dialog/DialogTrigger.tsx
|
|
279
|
+
import { Dialog as RadixDialog8 } from "radix-ui";
|
|
280
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
281
|
+
var Trigger = (props) => /* @__PURE__ */ jsx13(RadixDialog8.Trigger, { ...props });
|
|
282
|
+
Trigger.displayName = "Dialog.Trigger";
|
|
283
|
+
|
|
284
|
+
// src/dialog/index.ts
|
|
285
|
+
var Dialog2 = Object.assign(Dialog, {
|
|
286
|
+
Trigger,
|
|
287
|
+
Portal,
|
|
288
|
+
Overlay,
|
|
289
|
+
Content,
|
|
290
|
+
Header,
|
|
291
|
+
Body,
|
|
292
|
+
Footer,
|
|
293
|
+
Close,
|
|
294
|
+
CloseButton,
|
|
295
|
+
Title,
|
|
296
|
+
Description
|
|
297
|
+
});
|
|
298
|
+
Dialog2.displayName = "Dialog";
|
|
299
|
+
Dialog2.Trigger.displayName = "Dialog.Trigger";
|
|
300
|
+
Trigger.displayName = "Dialog.Trigger";
|
|
301
|
+
Portal.displayName = "Dialog.Portal";
|
|
302
|
+
Overlay.displayName = "Dialog.Overlay";
|
|
303
|
+
Content.displayName = "Dialog.Content";
|
|
304
|
+
Header.displayName = "Dialog.Header";
|
|
305
|
+
Body.displayName = "Dialog.Body";
|
|
306
|
+
Footer.displayName = "Dialog.Footer";
|
|
307
|
+
CloseButton.displayName = "Dialog.CloseButton";
|
|
308
|
+
Title.displayName = "Dialog.Title";
|
|
309
|
+
Description.displayName = "Dialog.Description";
|
|
310
|
+
|
|
311
|
+
export {
|
|
312
|
+
Dialog2 as Dialog
|
|
313
|
+
};
|
|
314
|
+
//# sourceMappingURL=chunk-PZWESKAR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dialog/Dialog.tsx","../src/dialog/DialogContext.tsx","../src/dialog/DialogBody.styles.ts","../src/dialog/DialogBody.tsx","../src/dialog/DialogClose.tsx","../src/dialog/DialogCloseButton.tsx","../src/dialog/DialogContent.tsx","../src/dialog/DialogContent.styles.tsx","../src/dialog/DialogDescription.tsx","../src/dialog/DialogFooter.tsx","../src/dialog/DialogHeader.tsx","../src/dialog/DialogOverlay.tsx","../src/dialog/DialogPortal.tsx","../src/dialog/DialogTitle.tsx","../src/dialog/DialogTrigger.tsx","../src/dialog/index.ts"],"sourcesContent":["import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, useEffect, useRef } from 'react'\n\nimport { DialogProvider } from './DialogContext'\n\nexport interface DialogProps {\n /**\n * Children of the component.\n */\n children?: RadixDialog.DialogProps['children']\n /**\n * Specifies if the dialog is open or not.\n */\n open?: RadixDialog.DialogProps['open']\n /**\n * Default open state.\n */\n defaultOpen?: RadixDialog.DialogProps['defaultOpen']\n /**\n * Handler executen on every dialog open state change.\n */\n onOpenChange?: RadixDialog.DialogProps['onOpenChange']\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: RadixDialog.DialogProps['modal']\n}\n\nexport const Dialog = ({ children, ...rest }: DialogProps): ReactElement => {\n const open = rest.open\n const activeElementRef = useRef<Element>(null)\n\n /**\n * This function captures the active element when the Dialog is opened\n * and sets focus back to it when the Dialog is closed.\n */\n function handleActiveElementFocus() {\n if (open && document.activeElement) {\n activeElementRef.current = document.activeElement\n }\n\n if (!open) {\n setTimeout(() => {\n if (!(activeElementRef.current instanceof HTMLElement)) return\n activeElementRef.current.focus()\n }, 0)\n }\n }\n\n useEffect(handleActiveElementFocus, [open])\n\n return (\n <DialogProvider>\n <RadixDialog.Root {...rest}>{children}</RadixDialog.Root>\n </DialogProvider>\n )\n}\n\nDialog.displayName = 'Dialog.Root'\n","import { createContext, type ReactNode, useContext, useState } from 'react'\n\nexport interface DialogContextState {\n isFullScreen: boolean\n setIsFullScreen: (value: boolean) => void\n}\n\nconst DialogContext = createContext<DialogContextState | null>(null)\n\nexport const DialogProvider = ({ children: childrenProp }: { children: ReactNode }) => {\n const [isFullScreen, setIsFullScreen] = useState(false)\n\n return (\n <DialogContext.Provider\n value={{\n isFullScreen,\n setIsFullScreen,\n }}\n >\n {childrenProp}\n </DialogContext.Provider>\n )\n}\n\nexport const useDialog = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw Error('useDialog must be used within a Dialog provider')\n }\n\n return context\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const dialogBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n }\n)\n\nexport type DialogBodyStylesProps = VariantProps<typeof dialogBodyStyles>\n","import { type ReactElement, type ReactNode, Ref } from 'react'\n\nimport { dialogBodyStyles, type DialogBodyStylesProps } from './DialogBody.styles'\nexport interface BodyProps extends DialogBodyStylesProps {\n children: ReactNode\n className?: string\n tabIndex?: number\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Body = ({\n children,\n className,\n inset = false,\n ref,\n ...rest\n}: BodyProps): ReactElement => (\n <div ref={ref} className={dialogBodyStyles({ inset, className })} {...rest}>\n {children}\n </div>\n)\n\nBody.displayName = 'Dialog.Body'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type CloseProps = RadixDialog.DialogCloseProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Close = (props: CloseProps) => <RadixDialog.Close {...props} />\n\nClose.displayName = 'Dialog.Close'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { Close, CloseProps } from './DialogClose'\n\nexport type CloseButtonProps = CloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nconst Root = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <Close\n data-part=\"close\"\n ref={ref}\n className={cx(['absolute', 'top-md', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </Close>\n )\n}\n\nexport const CloseButton = Object.assign(Root, {\n id: 'CloseButton',\n})\n\nRoot.displayName = 'Dialog.CloseButton'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, Ref, useEffect } from 'react'\n\nimport { dialogContentStyles, type DialogContentStylesProps } from './DialogContent.styles'\nimport { useDialog } from './DialogContext'\n\nexport interface ContentProps extends RadixDialog.DialogContentProps, DialogContentStylesProps {\n /**\n * When set to true, the content will adjust its width to fit the content rather than taking up the full available width.\n */\n isNarrow?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Content = ({\n children,\n className,\n isNarrow = false,\n size = 'md',\n onInteractOutside,\n ref,\n ...rest\n}: ContentProps): ReactElement => {\n const { setIsFullScreen } = useDialog()\n\n useEffect(() => {\n if (size === 'fullscreen') setIsFullScreen(true)\n\n return () => setIsFullScreen(false)\n }, [setIsFullScreen, size])\n\n return (\n <RadixDialog.Content\n data-spark-component=\"dialog-content\"\n ref={ref}\n className={dialogContentStyles({\n className,\n isNarrow,\n size,\n })}\n onInteractOutside={e => {\n const isForegroundElement = (e.target as HTMLElement).closest('.z-toast, .z-popover')\n\n /**\n * The focus trap of the dialog applies `pointer-events-none` on the body of the page in the background, but\n * some components with an higher z-index have `pointer-events-auto` applied on them to remain interactive and ignore the focust trap (ex: a Snackbar with actions).\n *\n * Clicking on the snackbar will be considered as an \"outside click\" and close the dialog. We want to prevent this.\n */\n if (isForegroundElement) {\n e.preventDefault()\n }\n\n onInteractOutside?.(e)\n }}\n {...rest}\n >\n {children}\n </RadixDialog.Content>\n )\n}\n\nContent.displayName = 'Dialog.Content'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const dialogContentStyles = cva(\n [\n 'z-modal flex flex-col bg-surface group',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n '[&:not(:has(footer))]:pb-lg',\n '[&:not(:has(header))]:pt-lg',\n ],\n {\n variants: {\n size: {\n fullscreen: 'fixed size-full top-0 left-0',\n sm: 'max-w-sz-480',\n md: 'max-w-sz-672',\n lg: 'max-w-sz-864',\n },\n isNarrow: {\n true: [],\n false: [],\n },\n },\n compoundVariants: [\n {\n size: ['sm', 'md', 'lg'],\n class: [\n 'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',\n 'max-h-[80%]',\n 'shadow-md rounded-lg',\n 'data-[state=open]:animate-fade-in',\n 'data-[state=closed]:animate-fade-out',\n ],\n },\n {\n size: ['sm', 'md', 'lg'],\n isNarrow: false,\n class: ['w-full'],\n },\n ],\n defaultVariants: {\n size: 'md',\n isNarrow: false,\n },\n }\n)\n\nexport type DialogContentStylesProps = VariantProps<typeof dialogContentStyles>\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DescriptionProps = RadixDialog.DialogDescriptionProps & {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const Description = (props: DescriptionProps) => <RadixDialog.Description {...props} />\n\nDescription.displayName = 'Dialog.Description'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface FooterProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Footer = ({ children, className, ref, ...rest }: FooterProps): ReactElement => (\n <footer ref={ref} className={cx(className, ['px-xl', 'py-lg'])} {...rest}>\n {children}\n </footer>\n)\n\nFooter.displayName = 'Dialog.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps): ReactElement => (\n <header ref={ref} className={cx(className, ['px-xl', 'py-lg'])} {...rest}>\n {children}\n </header>\n)\n\nHeader.displayName = 'Dialog.Header'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport type OverlayProps = RadixDialog.DialogOverlayProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Overlay = ({ className, ref, ...rest }: OverlayProps): ReactElement | null => {\n const { isFullScreen } = useDialog()\n\n return (\n <RadixDialog.Overlay\n ref={ref}\n className={cx(\n isFullScreen ? 'hidden' : 'fixed',\n ['top-0', 'left-0', 'w-screen', 'h-screen', 'z-overlay'],\n ['bg-overlay/dim-3'],\n ['data-[state=open]:animate-fade-in'],\n ['data-[state=closed]:animate-fade-out'],\n className\n )}\n {...rest}\n />\n )\n}\n\nOverlay.displayName = 'Dialog.Overlay'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement } from 'react'\n\nexport type PortalProps = RadixDialog.DialogPortalProps\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixDialog.Portal {...rest}>{children}</RadixDialog.Portal>\n)\n\nPortal.displayName = 'Dialog.Portal'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TitleProps = RadixDialog.DialogTitleProps & {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const Title = ({ className, ref, ...others }: TitleProps) => {\n return (\n <RadixDialog.Title\n ref={ref}\n className={cx(\n 'text-headline-1 text-on-surface',\n 'group-has-data-[part=close]:pr-3xl',\n className\n )}\n {...others}\n />\n )\n}\n\nTitle.displayName = 'Dialog.Title'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, ReactNode, Ref } from 'react'\n\nexport interface TriggerProps {\n /**\n * Children of the component.\n */\n children?: ReactNode\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: RadixDialog.DialogTriggerProps['asChild']\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = (props: TriggerProps): ReactElement => <RadixDialog.Trigger {...props} />\n\nTrigger.displayName = 'Dialog.Trigger'\n","import { Dialog as Root } from './Dialog'\nimport { Body } from './DialogBody'\nimport { Close } from './DialogClose'\nimport { CloseButton } from './DialogCloseButton'\nimport { Content } from './DialogContent'\nimport { Description } from './DialogDescription' // aria-describedby\nimport { Footer } from './DialogFooter'\nimport { Header } from './DialogHeader'\nimport { Overlay } from './DialogOverlay'\nimport { Portal } from './DialogPortal'\nimport { Title } from './DialogTitle' // aria-labelledby\nimport { Trigger } from './DialogTrigger'\n\nexport const Dialog: typeof Root & {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Overlay: typeof Overlay\n Content: typeof Content\n Header: typeof Header\n Body: typeof Body\n Footer: typeof Footer\n Close: typeof Close\n CloseButton: typeof CloseButton\n Title: typeof Title\n Description: typeof Description\n} = Object.assign(Root, {\n Trigger,\n Portal,\n Overlay,\n Content,\n Header,\n Body,\n Footer,\n Close,\n CloseButton,\n Title,\n Description,\n})\n\nDialog.displayName = 'Dialog'\nDialog.Trigger.displayName = 'Dialog.Trigger'\nTrigger.displayName = 'Dialog.Trigger'\nPortal.displayName = 'Dialog.Portal'\nOverlay.displayName = 'Dialog.Overlay'\nContent.displayName = 'Dialog.Content'\nHeader.displayName = 'Dialog.Header'\nBody.displayName = 'Dialog.Body'\nFooter.displayName = 'Dialog.Footer'\nCloseButton.displayName = 'Dialog.CloseButton'\nTitle.displayName = 'Dialog.Title'\nDescription.displayName = 'Dialog.Description'\n\nexport { type DialogProps } from './Dialog'\nexport { type ContentProps as DialogContentProps } from './DialogContent'\nexport { type HeaderProps as DialogHeaderProps } from './DialogHeader'\nexport { type BodyProps as DialogBodyProps } from './DialogBody'\nexport { type FooterProps as DialogFooterProps } from './DialogFooter'\nexport { type TriggerProps as DialogTriggerProps } from './DialogTrigger'\nexport { type OverlayProps as DialogOverlayProps } from './DialogOverlay'\nexport { type PortalProps as DialogPortalProps } from './DialogPortal'\nexport { type TitleProps as DialogTitleProps } from './DialogTitle'\nexport { type DescriptionProps as DialogDescriptionProps } from './DialogDescription'\nexport { type CloseProps as Dialog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,UAAUC,oBAAmB;AAMpC,gBAAAC,aAAA;AADK,IAAM,SAAS,CAAC,EAAE,UAAU,GAAG,KAAK,MACzC,gBAAAA,MAACD,aAAY,QAAZ,EAAoB,GAAG,MAAO,UAAS;AAG1C,OAAO,cAAc;;;ACTrB,SAAS,MAAAE,WAAU;AACnB,SAAS,UAAUC,oBAAmB;AASlC,gBAAAC,aAAA;AAFG,IAAM,QAAQ,CAAC,EAAE,WAAW,KAAK,GAAG,OAAO,MAAkB;AAClE,SACE,gBAAAA;AAAA,IAACD,aAAY;AAAA,IAAZ;AAAA,MACC;AAAA,MACA,WAAWD;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,MAAM,cAAc;;;ACtBpB,SAAS,UAAUG,oBAAmB;AAewB,gBAAAC,aAAA;AAAvD,IAAM,UAAU,CAAC,UAAsC,gBAAAA,MAACD,aAAY,SAAZ,EAAqB,GAAG,OAAO;AAE9F,QAAQ,cAAc;;;ACJf,IAAME,UAYT,OAAO,OAAO,QAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDA,QAAO,cAAc;AACrBA,QAAO,QAAQ,cAAc;AAC7B,QAAQ,cAAc;AACtB,OAAO,cAAc;AACrB,QAAQ,cAAc;AACtB,QAAQ,cAAc;AACtB,OAAO,cAAc;AACrB,KAAK,cAAc;AACnB,OAAO,cAAc;AACrB,YAAY,cAAc;AAC1B,MAAM,cAAc;AACpB,YAAY,cAAc;","names":["jsx","jsx","RadixDialog","jsx","jsx","RadixDialog","useEffect","cva","jsx","useEffect","RadixDialog","RadixDialog","jsx","cx","jsx","cx","jsx","cx","RadixDialog","jsx","RadixDialog","cx","RadixDialog","jsx","cx","RadixDialog","jsx","RadixDialog","jsx","Dialog"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as collapsible from '@zag-js/collapsible';
|
|
3
|
+
import { ComponentProps, Ref, ComponentPropsWithoutRef } from 'react';
|
|
4
|
+
|
|
5
|
+
interface CollapsibleProps extends ComponentProps<'div'> {
|
|
6
|
+
/**
|
|
7
|
+
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
8
|
+
*/
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The open state of the collapsible when it is initially rendered. Use when you do not need to control its open state.
|
|
12
|
+
*/
|
|
13
|
+
defaultOpen?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When `true`, prevents the user from interacting with the collapsible.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Event handler called when the open state of the collapsible changes.
|
|
20
|
+
*/
|
|
21
|
+
onOpenChange?: (open: boolean) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The controlled open state of the collapsible. Must be used in conjunction with `onOpenChange`.
|
|
24
|
+
*/
|
|
25
|
+
open?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The ids of the elements in the collapsible. Useful for composition
|
|
28
|
+
*/
|
|
29
|
+
ids?: collapsible.Props['ids'];
|
|
30
|
+
ref?: Ref<HTMLDivElement>;
|
|
31
|
+
}
|
|
32
|
+
declare const Collapsible$1: {
|
|
33
|
+
({ asChild, children, defaultOpen, disabled, onOpenChange, open, ids, ref, ...props }: CollapsibleProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
displayName: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
interface CollapsibleContentProps extends ComponentPropsWithoutRef<'div'> {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
ref?: Ref<HTMLDivElement>;
|
|
40
|
+
}
|
|
41
|
+
declare const Content: {
|
|
42
|
+
({ asChild, className, children, ref, ...props }: CollapsibleContentProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
displayName: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
interface CollapsibleTriggerProps extends ComponentPropsWithoutRef<'button'> {
|
|
47
|
+
asChild?: boolean;
|
|
48
|
+
ref?: Ref<HTMLButtonElement>;
|
|
49
|
+
}
|
|
50
|
+
declare const Trigger: {
|
|
51
|
+
({ asChild, children, ref, ...props }: CollapsibleTriggerProps): react_jsx_runtime.JSX.Element;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
declare const Collapsible: typeof Collapsible$1 & {
|
|
56
|
+
Trigger: typeof Trigger;
|
|
57
|
+
Content: typeof Content;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { Collapsible, type CollapsibleContentProps, type CollapsibleProps, type CollapsibleTriggerProps };
|