@neut/ui 0.0.7 → 0.0.8
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/README.md +3 -0
- package/dist/components/alert-dialog/AlertDialogCancel/AlertDialogCancel.js +5 -2
- package/dist/components/alert-dialog/AlertDialogCancel/AlertDialogCancel.js.map +1 -1
- package/dist/components/alert-dialog/AlertDialogCancel/AlertDialogCancel.types.d.ts +1 -1
- package/dist/components/button/Button.js +26 -55
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/button/Button.types.d.ts +25 -7
- package/dist/components/collapsible/CollapsibleContent/CollapsibleContent.js +3 -3
- package/dist/components/collapsible/CollapsibleContent/CollapsibleContent.js.map +1 -1
- package/dist/components/collapsible/CollapsibleTrigger/CollapsibleTrigger.js +2 -2
- package/dist/components/collapsible/CollapsibleTrigger/CollapsibleTrigger.js.map +1 -1
- package/dist/components/dialog/Dialog/Dialog.context.d.ts +10 -0
- package/dist/components/dialog/Dialog/Dialog.context.js +11 -0
- package/dist/components/dialog/Dialog/Dialog.context.js.map +1 -0
- package/dist/components/dialog/Dialog/Dialog.d.ts +2 -0
- package/dist/components/dialog/Dialog/Dialog.js +23 -0
- package/dist/components/dialog/Dialog/Dialog.js.map +1 -0
- package/dist/components/dialog/Dialog/Dialog.styles.d.ts +0 -0
- package/dist/components/dialog/Dialog/Dialog.types.d.ts +2 -0
- package/dist/components/dialog/Dialog/index.d.ts +2 -0
- package/dist/components/dialog/DialogClose/DialogClose.d.ts +2 -0
- package/dist/components/dialog/DialogClose/DialogClose.js +46 -0
- package/dist/components/dialog/DialogClose/DialogClose.js.map +1 -0
- package/dist/components/dialog/DialogClose/DialogClose.styles.d.ts +1 -0
- package/dist/components/dialog/DialogClose/DialogClose.styles.js +6 -0
- package/dist/components/dialog/DialogClose/DialogClose.styles.js.map +1 -0
- package/dist/components/dialog/DialogClose/DialogClose.types.d.ts +2 -0
- package/dist/components/dialog/DialogClose/index.d.ts +1 -0
- package/dist/components/dialog/DialogContent/DialogContent.context.d.ts +8 -0
- package/dist/components/dialog/DialogContent/DialogContent.context.js +11 -0
- package/dist/components/dialog/DialogContent/DialogContent.context.js.map +1 -0
- package/dist/components/dialog/DialogContent/DialogContent.d.ts +2 -0
- package/dist/components/dialog/DialogContent/DialogContent.js +71 -0
- package/dist/components/dialog/DialogContent/DialogContent.js.map +1 -0
- package/dist/components/dialog/DialogContent/DialogContent.styles.d.ts +1 -0
- package/dist/components/dialog/DialogContent/DialogContent.styles.js +6 -0
- package/dist/components/dialog/DialogContent/DialogContent.styles.js.map +1 -0
- package/dist/components/dialog/DialogContent/DialogContent.types.d.ts +4 -0
- package/dist/components/dialog/DialogContent/index.d.ts +2 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.d.ts +2 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.js +21 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.js.map +1 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.styles.d.ts +1 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.styles.js +6 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.styles.js.map +1 -0
- package/dist/components/dialog/DialogDescription/DialogDescription.types.d.ts +2 -0
- package/dist/components/dialog/DialogDescription/index.d.ts +1 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.d.ts +2 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.js +18 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.js.map +1 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.styles.d.ts +1 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.styles.js +6 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.styles.js.map +1 -0
- package/dist/components/dialog/DialogFooter/DialogFooter.types.d.ts +2 -0
- package/dist/components/dialog/DialogFooter/index.d.ts +1 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.d.ts +2 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.js +18 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.js.map +1 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.styles.d.ts +1 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.styles.js +6 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.styles.js.map +1 -0
- package/dist/components/dialog/DialogHeader/DialogHeader.types.d.ts +2 -0
- package/dist/components/dialog/DialogHeader/index.d.ts +1 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.d.ts +2 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.js +27 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.js.map +1 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.styles.d.ts +1 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.styles.js +6 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.styles.js.map +1 -0
- package/dist/components/dialog/DialogOverlay/DialogOverlay.types.d.ts +2 -0
- package/dist/components/dialog/DialogOverlay/index.d.ts +1 -0
- package/dist/components/dialog/DialogPortal/DialogPortal.d.ts +2 -0
- package/dist/components/dialog/DialogPortal/DialogPortal.js +10 -0
- package/dist/components/dialog/DialogPortal/DialogPortal.js.map +1 -0
- package/dist/components/dialog/DialogPortal/DialogPortal.types.d.ts +2 -0
- package/dist/components/dialog/DialogPortal/index.d.ts +1 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.d.ts +2 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.js +21 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.js.map +1 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.styles.d.ts +1 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.styles.js +6 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.styles.js.map +1 -0
- package/dist/components/dialog/DialogTitle/DialogTitle.types.d.ts +2 -0
- package/dist/components/dialog/DialogTitle/index.d.ts +1 -0
- package/dist/components/dialog/DialogTrigger/DialogTrigger.d.ts +2 -0
- package/dist/components/dialog/DialogTrigger/DialogTrigger.js +11 -0
- package/dist/components/dialog/DialogTrigger/DialogTrigger.js.map +1 -0
- package/dist/components/dialog/DialogTrigger/DialogTrigger.types.d.ts +0 -0
- package/dist/components/dialog/DialogTrigger/index.d.ts +1 -0
- package/dist/components/dialog/DialogTrigger/useDialogTrigger.d.ts +2 -0
- package/dist/components/dialog/DialogTrigger/useDialogTrigger.js +26 -0
- package/dist/components/dialog/DialogTrigger/useDialogTrigger.js.map +1 -0
- package/dist/components/dialog/index.d.ts +10 -0
- package/dist/components/dialog/index.js +13 -0
- package/dist/components/input-group/InputGroupButton/InputGroupButton.js +13 -13
- package/dist/components/input-group/InputGroupButton/InputGroupButton.js.map +1 -1
- package/dist/components/pagination/PaginationLink/PaginationLink.js.map +1 -1
- package/dist/components/pagination/PaginationLink/PaginationLink.types.d.ts +3 -2
- package/dist/components/switch/Switch.js +23 -30
- package/dist/components/switch/Switch.js.map +1 -1
- package/dist/components/switch/Switch.styles.d.ts +0 -1
- package/dist/components/switch/Switch.styles.js +2 -3
- package/dist/components/switch/Switch.styles.js.map +1 -1
- package/dist/components/switch/Switch.types.d.ts +2 -1
- package/dist/components/toast/components/Toast.js +4 -1
- package/dist/components/toast/components/Toast.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +92 -80
- package/dist/types/props.types.d.ts +4 -2
- package/dist/ui.css +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,10 +5,13 @@ import { mergeProps as i } from "solid-js";
|
|
|
5
5
|
//#region src/components/alert-dialog/AlertDialogCancel/AlertDialogCancel.tsx
|
|
6
6
|
var a = (a) => {
|
|
7
7
|
let { setOpen: o } = e();
|
|
8
|
-
return n(t, r(
|
|
8
|
+
return n(t, r(i({
|
|
9
9
|
variant: "outline",
|
|
10
10
|
size: "md"
|
|
11
|
-
}, a), {
|
|
11
|
+
}, a), {
|
|
12
|
+
"data-slot": "alert-dialog-cancel",
|
|
13
|
+
onClick: () => o(!1)
|
|
14
|
+
}));
|
|
12
15
|
};
|
|
13
16
|
//#endregion
|
|
14
17
|
export { a as AlertDialogCancel };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialogCancel.js","names":["mergeProps","AlertDialogCancelProps","Button","useAlertDialogContext","AlertDialogCancel","props","setOpen","merged","variant","size","const","_$createComponent","_$mergeProps","onClick"],"sources":["../../../../src/components/alert-dialog/AlertDialogCancel/AlertDialogCancel.tsx"],"sourcesContent":["import { mergeProps } from \"solid-js\";\nimport type { AlertDialogCancelProps } from \"./AlertDialogCancel.types\";\nimport { Button } from \"~/components/button\";\nimport { useAlertDialogContext } from \"../AlertDialog\";\n\nexport const AlertDialogCancel = (props: AlertDialogCancelProps) => {\n const { setOpen } = useAlertDialogContext();\n\n const merged = mergeProps({ variant: \"outline\", size: \"md\" } as const, props);\n\n return (\n <Button\n data-slot=\"alert-dialog-cancel\"\n
|
|
1
|
+
{"version":3,"file":"AlertDialogCancel.js","names":["mergeProps","AlertDialogCancelProps","Button","useAlertDialogContext","AlertDialogCancel","props","setOpen","merged","variant","size","const","_$createComponent","_$mergeProps","onClick"],"sources":["../../../../src/components/alert-dialog/AlertDialogCancel/AlertDialogCancel.tsx"],"sourcesContent":["import { mergeProps } from \"solid-js\";\nimport type { AlertDialogCancelProps } from \"./AlertDialogCancel.types\";\nimport { Button } from \"~/components/button\";\nimport { useAlertDialogContext } from \"../AlertDialog\";\n\nexport const AlertDialogCancel = (props: AlertDialogCancelProps) => {\n const { setOpen } = useAlertDialogContext();\n\n const merged = mergeProps({ variant: \"outline\", size: \"md\" } as const, props);\n\n return (\n <Button\n {...merged}\n data-slot=\"alert-dialog-cancel\"\n onClick={() => setOpen(false)}\n />\n );\n};\n"],"mappings":";;;;;AAKA,IAAaI,KAAqBC,MAAkC;CAClE,IAAM,EAAEC,eAAYH,GAAuB;AAI3C,QAAAQ,EACGT,GAAMU,EAHMZ,EAAW;EAAEQ,SAAS;EAAWC,MAAM;EAAM,EAAWJ,EAAM,EAI/D;EAAA,aAAA;EAEVQ,eAAeP,EAAQ,GAAK;EAAC,CAAA,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ButtonProps } from '../../button';
|
|
2
|
-
export type AlertDialogCancelProps =
|
|
2
|
+
export type AlertDialogCancelProps = ButtonProps<"button">;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { clsx as e } from "../../utils/clsx.js";
|
|
2
2
|
import t from "./Button.styles.js";
|
|
3
3
|
import { Dynamic as n, createComponent as r, insert as i, memo as a, mergeProps as o, setAttribute as s, template as c } from "solid-js/web";
|
|
4
|
-
import {
|
|
4
|
+
import { children as l, createMemo as u, createUniqueId as d, mergeProps as f, splitProps as p } from "solid-js";
|
|
5
5
|
//#region src/components/button/Button.tsx
|
|
6
|
-
var m = /* @__PURE__ */ c("<span>"), h = (c) => {
|
|
7
|
-
let [
|
|
6
|
+
var m = /* @__PURE__ */ c("<span>"), h = /* @__PURE__ */ c("<span class=sr-only>"), g = (c) => {
|
|
7
|
+
let [g, _] = p(f({
|
|
8
8
|
variant: "primary",
|
|
9
9
|
size: "md",
|
|
10
10
|
as: "button",
|
|
11
|
-
iconPosition: "left",
|
|
12
11
|
id: d()
|
|
13
12
|
}, c), [
|
|
14
13
|
"as",
|
|
@@ -20,68 +19,40 @@ var m = /* @__PURE__ */ c("<span>"), h = (c) => {
|
|
|
20
19
|
"classList",
|
|
21
20
|
"children",
|
|
22
21
|
"onClick"
|
|
23
|
-
]),
|
|
24
|
-
var
|
|
25
|
-
return s(
|
|
26
|
-
})()
|
|
22
|
+
]), v = u(() => g.icon && typeof g.icon == "object" && "ariaLabel" in g.icon && "icon" in g.icon || !!g.icon && !g.children), y = (e, t) => (() => {
|
|
23
|
+
var n = m();
|
|
24
|
+
return s(n, "data-icon", t), i(n, e), n;
|
|
25
|
+
})(), b = l(() => g.icon ? typeof g.icon == "object" && "ariaLabel" in g.icon && "icon" in g.icon ? [a(() => g.icon.icon), (() => {
|
|
26
|
+
var e = h();
|
|
27
|
+
return i(e, () => g.icon.ariaLabel), e;
|
|
28
|
+
})()] : [
|
|
29
|
+
a(() => a(() => !g.iconPosition || g.iconPosition === "left")() && y(g.icon, "inline-start")),
|
|
30
|
+
a(() => g.children),
|
|
31
|
+
a(() => a(() => g.iconPosition === "right")() && y(g.icon, "inline-end"))
|
|
32
|
+
] : g.children);
|
|
27
33
|
return r(n, o({
|
|
28
34
|
"data-slot": "button",
|
|
29
35
|
get component() {
|
|
30
|
-
return
|
|
36
|
+
return g.as;
|
|
37
|
+
},
|
|
38
|
+
get type() {
|
|
39
|
+
return a(() => g.as === "button")() ? _.type ?? "button" : void 0;
|
|
31
40
|
},
|
|
32
41
|
get onClick() {
|
|
33
|
-
return
|
|
42
|
+
return g.onClick;
|
|
34
43
|
},
|
|
35
44
|
get class() {
|
|
36
45
|
return e(t({
|
|
37
|
-
variant:
|
|
38
|
-
size:
|
|
39
|
-
iconSize:
|
|
40
|
-
}),
|
|
46
|
+
variant: g.variant,
|
|
47
|
+
size: v() ? void 0 : g.size,
|
|
48
|
+
iconSize: v() ? g.size : void 0
|
|
49
|
+
}), g.class);
|
|
41
50
|
}
|
|
42
|
-
},
|
|
43
|
-
return
|
|
44
|
-
r(l, {
|
|
45
|
-
get when() {
|
|
46
|
-
return a(() => !!h.icon)() && h.iconPosition === "left";
|
|
47
|
-
},
|
|
48
|
-
get children() {
|
|
49
|
-
return r(l, {
|
|
50
|
-
get when() {
|
|
51
|
-
return !_();
|
|
52
|
-
},
|
|
53
|
-
get fallback() {
|
|
54
|
-
return h.icon;
|
|
55
|
-
},
|
|
56
|
-
get children() {
|
|
57
|
-
return v("inline-start");
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}),
|
|
62
|
-
a(() => h.children),
|
|
63
|
-
r(l, {
|
|
64
|
-
get when() {
|
|
65
|
-
return a(() => !!h.icon)() && h.iconPosition === "right";
|
|
66
|
-
},
|
|
67
|
-
get children() {
|
|
68
|
-
return r(l, {
|
|
69
|
-
get when() {
|
|
70
|
-
return !_();
|
|
71
|
-
},
|
|
72
|
-
get fallback() {
|
|
73
|
-
return h.icon;
|
|
74
|
-
},
|
|
75
|
-
get children() {
|
|
76
|
-
return v("inline-end");
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
];
|
|
51
|
+
}, _, { get children() {
|
|
52
|
+
return b();
|
|
82
53
|
} }));
|
|
83
54
|
};
|
|
84
55
|
//#endregion
|
|
85
|
-
export {
|
|
56
|
+
export { g as Button };
|
|
86
57
|
|
|
87
58
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["createMemo","createUniqueId","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["children","createMemo","createUniqueId","JSXElement","mergeProps","splitProps","Dynamic","clsx","s","ButtonProps","ButtonValidElement","DefaultStyleProps","ResolvedButtonProps","Button","props","T","merged","variant","size","as","id","Partial","local","others","iconOnly","icon","iconWithAttr","position","_el$","_tmpl$","_$setAttribute","_$insert","resolved","_$memo","_el$2","_tmpl$2","ariaLabel","iconPosition","_$createComponent","_$mergeProps","component","type","undefined","onClick","class","iconSize"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import {\n children,\n createMemo,\n createUniqueId,\n type JSXElement,\n mergeProps,\n splitProps,\n} from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { clsx } from \"~/utils\";\nimport s from \"./Button.styles\";\nimport type {\n ButtonProps,\n ButtonValidElement,\n DefaultStyleProps,\n ResolvedButtonProps,\n} from \"./Button.types\";\n\nexport const Button = <T extends ButtonValidElement = \"button\">(\n props: ButtonProps<T>,\n) => {\n const merged = mergeProps(\n {\n variant: \"primary\",\n size: \"md\",\n as: \"button\",\n id: createUniqueId(),\n } satisfies Partial<DefaultStyleProps>,\n props as ResolvedButtonProps<T>,\n );\n\n const [local, others] = splitProps(merged, [\n \"as\",\n \"variant\",\n \"size\",\n \"icon\",\n \"iconPosition\",\n \"class\",\n \"classList\",\n \"children\",\n \"onClick\",\n ]);\n\n const iconOnly = createMemo(\n () =>\n (local.icon &&\n typeof local.icon === \"object\" &&\n \"ariaLabel\" in local.icon &&\n \"icon\" in local.icon) ||\n (!!local.icon && !local.children),\n );\n\n const iconWithAttr = (\n icon: JSXElement,\n position: \"inline-start\" | \"inline-end\",\n ) => <span data-icon={position}>{icon}</span>;\n\n const resolved = children(() =>\n local.icon ? (\n typeof local.icon === \"object\" &&\n \"ariaLabel\" in local.icon &&\n \"icon\" in local.icon ? (\n <>\n {local.icon.icon}\n <span class=\"sr-only\">{local.icon.ariaLabel}</span>\n </>\n ) : (\n <>\n {(!local.iconPosition || local.iconPosition === \"left\") &&\n iconWithAttr(local.icon, \"inline-start\")}\n {local.children}\n {local.iconPosition === \"right\" &&\n iconWithAttr(local.icon, \"inline-end\")}\n </>\n )\n ) : (\n local.children\n ),\n );\n\n return (\n // @ts-expect-error\n <Dynamic\n data-slot=\"button\"\n component={local.as}\n type={local.as === \"button\" ? (others.type ?? \"button\") : undefined}\n onClick={local.onClick}\n class={clsx(\n s({\n variant: local.variant,\n size: iconOnly() ? undefined : local.size,\n iconSize: iconOnly() ? local.size : undefined,\n }),\n local.class,\n )}\n {...others}\n >\n {resolved()}\n </Dynamic>\n );\n};\n"],"mappings":";;;;;oFAkBaa,KACXC,MACG;CAWH,IAAM,CAACQ,GAAOC,KAAUlB,EAVTD,EACb;EACEa,SAAS;EACTC,MAAM;EACNC,IAAI;EACJC,IAAIlB,GAAe;EACpB,EACDY,EACD,EAE0C;EACzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,EAEIU,IAAWvB,QAEZqB,EAAMG,QACL,OAAOH,EAAMG,QAAS,YACtB,eAAeH,EAAMG,QACrB,UAAUH,EAAMG,QACjB,CAAC,CAACH,EAAMG,QAAQ,CAACH,EAAMtB,SAC3B,EAEK0B,KACJD,GACAE,aAAuC;EAAA,IAAAC,IAAAC,GAAA;AACJ,SADIC,EAAAF,GAAA,aACnBD,EAAQ,EAAAI,EAAAH,GAAGH,EAAI,EAAAG;KAAQ,EAEvCI,IAAWhC,QACfsB,EAAMG,OACJ,OAAOH,EAAMG,QAAS,YACtB,eAAeH,EAAMG,QACrB,UAAUH,EAAMG,OAAI,CAAAQ,QAEfX,EAAMG,KAAKA,KAAI,SAAA;EAAA,IAAAS,IAAAC,GAAA;AAC2B,SAD3BJ,EAAAG,SACOZ,EAAMG,KAAKW,UAAS,EAAAF;KAAA,CAAA,GAAA;EAAAD,QAI1CA,QAAC,CAACX,EAAMe,gBAAgBf,EAAMe,iBAAiB,OAAM,EAAA,IACpDX,EAAaJ,EAAMG,MAAM,eAAe,CAAA;EAAAQ,QACzCX,EAAMtB,SAAQ;EAAAiC,QACdA,QAAAX,EAAMe,iBAAiB,QAAO,EAAA,IAC7BX,EAAaJ,EAAMG,MAAM,aAAa,CAAA;EAE3C,GAEDH,EAAMtB,SAET;AAED,QACEsC,EACChC,GAAOiC,EAAA;EAAA,aAAA;EAAA,IAENC,YAAS;AAAA,UAAElB,EAAMH;;EAAE,IACnBsB,OAAI;AAAA,UAAER,QAAAX,EAAMH,OAAO,SAAQ,EAAA,GAAII,EAAOkB,QAAQ,WAAYC,KAAAA;;EAAS,IACnEC,UAAO;AAAA,UAAErB,EAAMqB;;EAAO,IAAA,QAAA;AAAA,UACfpC,EACLC,EAAE;IACAS,SAASK,EAAML;IACfC,MAAMM,GAAU,GAAGkB,KAAAA,IAAYpB,EAAMJ;IACrC2B,UAAUrB,GAAU,GAAGF,EAAMJ,OAAOwB,KAAAA;IACrC,CAAC,EACFpB,EAAMsB,MACP;;EAAA,EACGrB,GAAM,EAAA,IAAAvB,WAAA;AAAA,SAETgC,GAAU;IAAA,CAAA,CAAA"}
|
|
@@ -2,23 +2,41 @@ import { JSXElement } from 'solid-js';
|
|
|
2
2
|
import { BaseProps, MakeRequired, MouseEventHandler, PolymorphicProps } from '../../types';
|
|
3
3
|
export type ButtonVariant = "primary" | "outline" | "secondary" | "ghost" | "destructive" | "link";
|
|
4
4
|
export type ButtonSize = "md" | "xs" | "sm" | "lg";
|
|
5
|
-
interface BaseButtonProps extends BaseProps {
|
|
5
|
+
export interface BaseButtonProps extends BaseProps {
|
|
6
6
|
variant?: ButtonVariant;
|
|
7
7
|
size?: ButtonSize;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export type ButtonIconProps = {
|
|
8
11
|
/** Button content */
|
|
9
|
-
children
|
|
12
|
+
children: JSXElement;
|
|
10
13
|
icon?: JSXElement;
|
|
11
14
|
iconPosition?: "left" | "right";
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
} | {
|
|
16
|
+
icon: {
|
|
17
|
+
icon: JSXElement;
|
|
18
|
+
ariaLabel: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
14
21
|
export type ButtonValidElement = "button" | "a";
|
|
15
|
-
export type ButtonProps<T extends ButtonValidElement> = PolymorphicProps<T, BaseButtonProps & {
|
|
22
|
+
export type ButtonProps<T extends ButtonValidElement> = Omit<PolymorphicProps<T, BaseButtonProps & {
|
|
16
23
|
onClick?: MouseEventHandler<T>;
|
|
17
|
-
}
|
|
24
|
+
}>, "children"> & ButtonIconProps;
|
|
25
|
+
export type ResolvedBaseButtonProps = {
|
|
26
|
+
/** Button content */
|
|
27
|
+
children?: JSXElement;
|
|
28
|
+
icon?: JSXElement | {
|
|
29
|
+
icon: JSXElement;
|
|
30
|
+
ariaLabel: string;
|
|
31
|
+
};
|
|
32
|
+
iconPosition?: "left" | "right";
|
|
33
|
+
};
|
|
34
|
+
export type ResolvedButtonProps<T extends ButtonValidElement> = PolymorphicProps<T, BaseButtonProps & {
|
|
35
|
+
onClick?: MouseEventHandler<T>;
|
|
36
|
+
}> & ResolvedBaseButtonProps;
|
|
18
37
|
export type DefaultStyleProps = MakeRequired<BaseButtonProps, "size" | "variant"> & {
|
|
19
38
|
as: ButtonValidElement;
|
|
20
39
|
};
|
|
21
40
|
export type ButtonPropsWithDefault<T extends ButtonValidElement> = PolymorphicProps<T, BaseButtonProps & {
|
|
22
41
|
onClick?: MouseEventHandler<T>;
|
|
23
42
|
}>;
|
|
24
|
-
export {};
|
|
@@ -3,14 +3,14 @@ import { createComponent as t, insert as n, spread as r, template as i } from "s
|
|
|
3
3
|
import { Show as a, splitProps as o } from "solid-js";
|
|
4
4
|
//#region src/components/collapsible/CollapsibleContent/CollapsibleContent.tsx
|
|
5
5
|
var s = /* @__PURE__ */ i("<div data-slot=collapsible-content>"), c = (i) => {
|
|
6
|
-
let {
|
|
6
|
+
let { open: c } = e(), [l, u] = o(i, ["children"]);
|
|
7
7
|
return t(a, {
|
|
8
8
|
get when() {
|
|
9
|
-
return
|
|
9
|
+
return c();
|
|
10
10
|
},
|
|
11
11
|
get children() {
|
|
12
12
|
var e = s();
|
|
13
|
-
return r(e,
|
|
13
|
+
return r(e, u, !1, !0), n(e, () => l.children), e;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleContent.js","names":["Show","splitProps","CollapsibleContentProps","useCollapsibleContext","CollapsibleContent","props","
|
|
1
|
+
{"version":3,"file":"CollapsibleContent.js","names":["Show","splitProps","CollapsibleContentProps","useCollapsibleContext","CollapsibleContent","props","open","local","others","_$createComponent","when","children","_el$","_tmpl$","_$spread","_$insert"],"sources":["../../../../src/components/collapsible/CollapsibleContent/CollapsibleContent.tsx"],"sourcesContent":["import { Show, splitProps } from \"solid-js\";\nimport type { CollapsibleContentProps } from \"./CollapsibleContent.types\";\nimport { useCollapsibleContext } from \"../Collapsible\";\n\nexport const CollapsibleContent = (props: CollapsibleContentProps) => {\n const { open } = useCollapsibleContext();\n\n const [local, others] = splitProps(props, [\"children\"]);\n\n return (\n <Show when={open()}>\n <div data-slot=\"collapsible-content\" {...others}>\n {local.children}\n </div>\n </Show>\n );\n};\n"],"mappings":";;;;kEAIaI,KAAsBC,MAAmC;CACpE,IAAM,EAAEC,YAASH,GAAuB,EAElC,CAACI,GAAOC,KAAUP,EAAWI,GAAO,CAAC,WAAW,CAAC;AAEvD,QAAAI,EACGT,GAAI;EAAA,IAACU,OAAI;AAAA,UAAEJ,GAAM;;EAAA,IAAAK,WAAA;GAAA,IAAAC,IAAAC,GAAA;AAEC,UAFDC,EAAAF,GACyBJ,GAAM,IAAA,GAAA,EAAAO,EAAAH,SAC5CL,EAAMI,SAAQ,EAAAC;;EAAA,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { createComponent as n, mergeProps as r } from "solid-js/web";
|
|
|
4
4
|
//#region src/components/collapsible/CollapsibleTrigger/CollapsibleTrigger.tsx
|
|
5
5
|
var i = (i) => {
|
|
6
6
|
let { onOpenChange: a, open: o, setInternalOpen: s } = t();
|
|
7
|
-
return n(e, r({
|
|
7
|
+
return n(e, r(i, {
|
|
8
8
|
"data-slot": "collapsible-trigger",
|
|
9
9
|
get "data-panel-open"() {
|
|
10
10
|
return o();
|
|
@@ -16,7 +16,7 @@ var i = (i) => {
|
|
|
16
16
|
let e = !o();
|
|
17
17
|
s(e), a?.(e);
|
|
18
18
|
}
|
|
19
|
-
}
|
|
19
|
+
}));
|
|
20
20
|
};
|
|
21
21
|
//#endregion
|
|
22
22
|
export { i as CollapsibleTrigger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsibleTrigger.js","names":["useCollapsibleContext","CollapsibleTriggerProps","Button","CollapsibleTrigger","props","onOpenChange","open","setInternalOpen","handleClick","next","_$createComponent","_$mergeProps","data-panel-open","aria-expanded","onClick"],"sources":["../../../../src/components/collapsible/CollapsibleTrigger/CollapsibleTrigger.tsx"],"sourcesContent":["import { useCollapsibleContext } from \"../Collapsible\";\nimport type { CollapsibleTriggerProps } from \"./CollapsibleTrigger.types\";\nimport { Button } from \"~/components/button\";\n\nexport const CollapsibleTrigger = (props: CollapsibleTriggerProps) => {\n const { onOpenChange, open, setInternalOpen } = useCollapsibleContext();\n\n const handleClick = () => {\n const next = !open();\n setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n return (\n <Button\n data-slot=\"collapsible-trigger\"\n data-panel-open={open()}\n aria-expanded={open()}\n onClick={handleClick}\n
|
|
1
|
+
{"version":3,"file":"CollapsibleTrigger.js","names":["useCollapsibleContext","CollapsibleTriggerProps","Button","CollapsibleTrigger","props","onOpenChange","open","setInternalOpen","handleClick","next","_$createComponent","_$mergeProps","data-panel-open","aria-expanded","onClick"],"sources":["../../../../src/components/collapsible/CollapsibleTrigger/CollapsibleTrigger.tsx"],"sourcesContent":["import { useCollapsibleContext } from \"../Collapsible\";\nimport type { CollapsibleTriggerProps } from \"./CollapsibleTrigger.types\";\nimport { Button } from \"~/components/button\";\n\nexport const CollapsibleTrigger = (props: CollapsibleTriggerProps) => {\n const { onOpenChange, open, setInternalOpen } = useCollapsibleContext();\n\n const handleClick = () => {\n const next = !open();\n setInternalOpen(next);\n onOpenChange?.(next);\n };\n\n return (\n // @ts-expect-error\n <Button\n {...props}\n data-slot=\"collapsible-trigger\"\n data-panel-open={open()}\n aria-expanded={open()}\n onClick={handleClick}\n />\n );\n};\n"],"mappings":";;;;AAIA,IAAaG,KAAsBC,MAAmC;CACpE,IAAM,EAAEC,iBAAcC,SAAMC,uBAAoBP,GAAuB;AAQvE,QACEU,EACCR,GAAMS,EACDP,GAAK;EAAA,aAAA;EAAA,IAAA,oBAAA;AAAA,UAEQE,GAAM;;EAAA,IAAA,kBAAA;AAAA,UACRA,GAAM;;EACrBQ,eAbsB;GACxB,IAAML,IAAO,CAACH,GAAM;AAEpBD,GADAE,EAAgBE,EAAK,EACrBJ,IAAeI,EAAK;;EAUE,CAAA,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Accessor, Setter } from 'solid-js';
|
|
2
|
+
interface DialogContextValue {
|
|
3
|
+
show: Accessor<boolean>;
|
|
4
|
+
setShow: Setter<boolean>;
|
|
5
|
+
open: Accessor<boolean>;
|
|
6
|
+
setOpen: Setter<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare const DialogContext: import('solid-js').Context<DialogContextValue | undefined>;
|
|
9
|
+
export declare const useDialogContext: () => DialogContextValue;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "solid-js";
|
|
2
|
+
//#region src/components/dialog/Dialog/Dialog.context.ts
|
|
3
|
+
var n = e(), r = () => {
|
|
4
|
+
let e = t(n);
|
|
5
|
+
if (!e) throw Error("useDialogContext must be used within a DialogProvider");
|
|
6
|
+
return e;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as DialogContext, r as useDialogContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=Dialog.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.context.js","names":[],"sources":["../../../../src/components/dialog/Dialog/Dialog.context.ts"],"sourcesContent":["import {\n type Accessor,\n createContext,\n type Setter,\n useContext,\n} from \"solid-js\";\n\ninterface DialogContextValue {\n show: Accessor<boolean>;\n setShow: Setter<boolean>;\n open: Accessor<boolean>;\n setOpen: Setter<boolean>;\n}\n\nexport const DialogContext = createContext<DialogContextValue>();\n\nexport const useDialogContext = () => {\n const context = useContext(DialogContext);\n if (!context) {\n throw new Error(\"useDialogContext must be used within a DialogProvider\");\n }\n return context;\n};\n"],"mappings":";;AAcA,IAAa,IAAgB,GAAmC,EAEnD,UAAyB;CACpC,IAAM,IAAU,EAAW,EAAc;AACzC,KAAI,CAAC,EACH,OAAU,MAAM,wDAAwD;AAE1E,QAAO"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DialogContext as e } from "./Dialog.context.js";
|
|
2
|
+
import { createComponent as t, spread as n, template as r } from "solid-js/web";
|
|
3
|
+
import { createSignal as i } from "solid-js";
|
|
4
|
+
//#region src/components/dialog/Dialog/Dialog.tsx
|
|
5
|
+
var a = /* @__PURE__ */ r("<div data-slot=dialog role=alert>"), o = (r) => {
|
|
6
|
+
let [o, s] = i(!1), [c, l] = i(!1);
|
|
7
|
+
return t(e.Provider, {
|
|
8
|
+
value: {
|
|
9
|
+
show: o,
|
|
10
|
+
setShow: s,
|
|
11
|
+
open: c,
|
|
12
|
+
setOpen: l
|
|
13
|
+
},
|
|
14
|
+
get children() {
|
|
15
|
+
var e = a();
|
|
16
|
+
return n(e, r, !1, !1), e;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { o as Dialog };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=Dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["createSignal","DialogProps","DialogContext","Dialog","props","show","setShow","open","setOpen","_$createComponent","Provider","value","children","_el$","_tmpl$","_$spread"],"sources":["../../../../src/components/dialog/Dialog/Dialog.tsx"],"sourcesContent":["import { createSignal } from \"solid-js\";\nimport type { DialogProps } from \"./Dialog.types\";\nimport { DialogContext } from \"./Dialog.context\";\n\nexport const Dialog = (props: DialogProps) => {\n // 实际显示或卸载信号\n const [show, setShow] = createSignal(false);\n // 动画控制信号\n const [open, setOpen] = createSignal(false);\n\n return (\n <DialogContext.Provider\n value={{\n show,\n setShow,\n open,\n setOpen,\n }}\n >\n <div data-slot=\"dialog\" role=\"alert\" {...props} />\n </DialogContext.Provider>\n );\n};\n"],"mappings":";;;;gEAIaG,KAAUC,MAAuB;CAE5C,IAAM,CAACC,GAAMC,KAAWN,EAAa,GAAM,EAErC,CAACO,GAAMC,KAAWR,EAAa,GAAM;AAE3C,QAAAS,EACGP,EAAcQ,UAAQ;EACrBC,OAAO;GACLN;GACAC;GACAC;GACAC;GACD;EAAA,IAAAI,WAAA;GAAA,IAAAC,IAAAC,GAAA;AAE6C,UAF7CC,EAAAF,GAEwCT,GAAK,IAAA,GAAA,EAAAS;;EAAA,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { Button as t } from "../../button/Button.js";
|
|
3
|
+
import { useDialogContext as n } from "../Dialog/Dialog.context.js";
|
|
4
|
+
import { classes as r } from "./DialogClose.styles.js";
|
|
5
|
+
import { createComponent as i, memo as a, mergeProps as o } from "solid-js/web";
|
|
6
|
+
import { Show as s, mergeProps as c } from "solid-js";
|
|
7
|
+
import { X as l } from "lucide-solid";
|
|
8
|
+
//#region src/components/dialog/DialogClose/DialogClose.tsx
|
|
9
|
+
var u = (u) => {
|
|
10
|
+
let { setOpen: d } = n(), f = c({
|
|
11
|
+
variant: "ghost",
|
|
12
|
+
size: "sm"
|
|
13
|
+
}, u), p = () => {
|
|
14
|
+
d(!1), f.onClick?.();
|
|
15
|
+
};
|
|
16
|
+
return i(s, {
|
|
17
|
+
get when() {
|
|
18
|
+
return a(() => !f.children)() && !f.icon;
|
|
19
|
+
},
|
|
20
|
+
get fallback() {
|
|
21
|
+
return i(t, o(f, {
|
|
22
|
+
"data-slot": "dialog-close",
|
|
23
|
+
onClick: p
|
|
24
|
+
}));
|
|
25
|
+
},
|
|
26
|
+
get children() {
|
|
27
|
+
return i(t, o(f, {
|
|
28
|
+
"data-slot": "dialog-close",
|
|
29
|
+
get class() {
|
|
30
|
+
return e(r);
|
|
31
|
+
},
|
|
32
|
+
onClick: p,
|
|
33
|
+
get icon() {
|
|
34
|
+
return {
|
|
35
|
+
icon: i(l, {}),
|
|
36
|
+
ariaLabel: "Close"
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { u as DialogClose };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=DialogClose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogClose.js","names":["mergeProps","Show","DialogCloseProps","Button","clsx","classes","X","useDialogContext","ButtonProps","ResolvedButtonProps","DialogClose","props","setOpen","merged","variant","size","const","handleClick","onClick","_$createComponent","when","_$memo","children","icon","fallback","_$mergeProps","class","ariaLabel"],"sources":["../../../../src/components/dialog/DialogClose/DialogClose.tsx"],"sourcesContent":["import { mergeProps, Show } from \"solid-js\";\nimport type { DialogCloseProps } from \"./DialogClose.types\";\nimport { Button } from \"~/components/button\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./DialogClose.styles\";\nimport { X } from \"lucide-solid\";\nimport { useDialogContext } from \"../Dialog\";\nimport type {\n ButtonProps,\n ResolvedButtonProps,\n} from \"~/components/button/Button.types\";\n\nexport const DialogClose = (props: DialogCloseProps) => {\n const { setOpen } = useDialogContext();\n\n const merged = mergeProps(\n {\n variant: \"ghost\",\n size: \"sm\",\n } as const,\n props as ResolvedButtonProps<\"button\">,\n );\n\n const handleClick = () => {\n setOpen(false);\n merged.onClick?.();\n };\n\n return (\n <Show\n when={!merged.children && !merged.icon}\n fallback={\n <Button\n {...(merged as ButtonProps<\"button\">)}\n data-slot=\"dialog-close\"\n onClick={handleClick}\n />\n }\n >\n <Button\n {...(merged as ButtonProps<\"button\">)}\n data-slot=\"dialog-close\"\n class={clsx(classes)}\n onClick={handleClick}\n icon={{ icon: <X />, ariaLabel: \"Close\" }}\n />\n </Show>\n );\n};\n"],"mappings":";;;;;;;;AAYA,IAAaU,KAAeC,MAA4B;CACtD,IAAM,EAAEC,eAAYL,GAAkB,EAEhCM,IAASb,EACb;EACEc,SAAS;EACTC,MAAM;EACP,EACDJ,EACD,EAEKM,UAAoB;AAExBJ,EADAD,EAAQ,GAAM,EACdC,EAAOK,WAAW;;AAGpB,QAAAC,EACGlB,GAAI;EAAA,IACHmB,OAAI;AAAA,UAAEC,QAAA,CAACR,EAAOS,SAAQ,EAAA,IAAI,CAACT,EAAOU;;EAAI,IACtCC,WAAQ;AAAA,UAAAL,EACLhB,GAAMsB,EACAZ,GAA+B;IAAA,aAAA;IAEpCK,SAASD;IAAW,CAAA,CAAA;;EAAA,IAAAK,WAAA;AAAA,UAAAH,EAIvBhB,GAAMsB,EACAZ,GAA+B;IAAA,aAAA;IAAA,IAAA,QAAA;AAAA,YAE7BT,EAAKC,EAAQ;;IACpBa,SAASD;IAAW,IACpBM,OAAI;AAAA,YAAE;MAAEA,MAAIJ,EAAGb,GAAC,EAAA,CAAG;MAAEqB,WAAW;MAAS;;IAAA,CAAA,CAAA;;EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "absolute top-2 right-2";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogClose.styles.js","names":[],"sources":["../../../../src/components/dialog/DialogClose/DialogClose.styles.ts"],"sourcesContent":["export const classes = \"absolute top-2 right-2\";\n"],"mappings":";AAAA,IAAa,IAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { DialogClose } from './DialogClose';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Setter } from 'solid-js';
|
|
2
|
+
interface DialogContentContextValue {
|
|
3
|
+
setTitleID: Setter<string | undefined>;
|
|
4
|
+
setDescriptionID: Setter<string | undefined>;
|
|
5
|
+
}
|
|
6
|
+
export declare const DialogContentContext: import('solid-js').Context<DialogContentContextValue | undefined>;
|
|
7
|
+
export declare const useDialogContentContext: () => DialogContentContextValue;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext as e, useContext as t } from "solid-js";
|
|
2
|
+
//#region src/components/dialog/DialogContent/DialogContent.context.ts
|
|
3
|
+
var n = e(), r = () => {
|
|
4
|
+
let e = t(n);
|
|
5
|
+
if (!e) throw Error("useDialogContentContext must be used within an DialogContentProvider");
|
|
6
|
+
return e;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { n as DialogContentContext, r as useDialogContentContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=DialogContent.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContent.context.js","names":[],"sources":["../../../../src/components/dialog/DialogContent/DialogContent.context.ts"],"sourcesContent":["import { createContext, useContext, type Setter } from \"solid-js\";\n\ninterface DialogContentContextValue {\n setTitleID: Setter<string | undefined>;\n setDescriptionID: Setter<string | undefined>;\n}\n\nexport const DialogContentContext = createContext<DialogContentContextValue>();\n\nexport const useDialogContentContext = () => {\n const ctx = useContext(DialogContentContext);\n if (!ctx)\n throw new Error(\n \"useDialogContentContext must be used within an DialogContentProvider\",\n );\n\n return ctx;\n};\n"],"mappings":";;AAOA,IAAa,IAAuB,GAA0C,EAEjE,UAAgC;CAC3C,IAAM,IAAM,EAAW,EAAqB;AAC5C,KAAI,CAAC,EACH,OAAU,MACR,uEACD;AAEH,QAAO"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { useDialogContext as t } from "../Dialog/Dialog.context.js";
|
|
3
|
+
import { DialogClose as n } from "../DialogClose/DialogClose.js";
|
|
4
|
+
import { classes as r } from "./DialogContent.styles.js";
|
|
5
|
+
import { DialogPortal as i } from "../DialogPortal/DialogPortal.js";
|
|
6
|
+
import { DialogOverlay as a } from "../DialogOverlay/DialogOverlay.js";
|
|
7
|
+
import { DialogContentContext as o } from "./DialogContent.context.js";
|
|
8
|
+
import { createComponent as s, insert as c, mergeProps as l, spread as u, template as d } from "solid-js/web";
|
|
9
|
+
import { Show as f, createSignal as p, mergeProps as m, splitProps as h } from "solid-js";
|
|
10
|
+
//#region src/components/dialog/DialogContent/DialogContent.tsx
|
|
11
|
+
var g = /* @__PURE__ */ d("<div role=presentation class=\"fixed inset-0 select-none\"aria-hidden=true>"), _ = /* @__PURE__ */ d("<span data-type=inside class=sr-only aria-hidden=true>"), v = /* @__PURE__ */ d("<div data-slot=dialog-content role=dialog>"), y = (d) => {
|
|
12
|
+
let { show: y, open: b, setShow: x } = t(), [S, C] = h(m({ showCloseButton: !0 }, d), [
|
|
13
|
+
"showCloseButton",
|
|
14
|
+
"class",
|
|
15
|
+
"classList",
|
|
16
|
+
"children"
|
|
17
|
+
]), [w, T] = p(), [E, D] = p();
|
|
18
|
+
return s(f, {
|
|
19
|
+
get when() {
|
|
20
|
+
return y();
|
|
21
|
+
},
|
|
22
|
+
get children() {
|
|
23
|
+
return s(o.Provider, {
|
|
24
|
+
value: {
|
|
25
|
+
setTitleID: T,
|
|
26
|
+
setDescriptionID: D
|
|
27
|
+
},
|
|
28
|
+
get children() {
|
|
29
|
+
return s(i, { get children() {
|
|
30
|
+
return [
|
|
31
|
+
g(),
|
|
32
|
+
s(a, {}),
|
|
33
|
+
_(),
|
|
34
|
+
(() => {
|
|
35
|
+
var t = v();
|
|
36
|
+
return t.addEventListener("animationend", () => {
|
|
37
|
+
b() || x(!1);
|
|
38
|
+
}), u(t, l({
|
|
39
|
+
get "data-open"() {
|
|
40
|
+
return b();
|
|
41
|
+
},
|
|
42
|
+
get class() {
|
|
43
|
+
return e(r, S.class);
|
|
44
|
+
},
|
|
45
|
+
get "aria-labelledby"() {
|
|
46
|
+
return w();
|
|
47
|
+
},
|
|
48
|
+
get "aria-describedby"() {
|
|
49
|
+
return E();
|
|
50
|
+
}
|
|
51
|
+
}, C), !1, !0), c(t, () => S.children, null), c(t, s(f, {
|
|
52
|
+
get when() {
|
|
53
|
+
return S.showCloseButton;
|
|
54
|
+
},
|
|
55
|
+
get children() {
|
|
56
|
+
return s(n, {});
|
|
57
|
+
}
|
|
58
|
+
}), null), t;
|
|
59
|
+
})(),
|
|
60
|
+
_()
|
|
61
|
+
];
|
|
62
|
+
} });
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { y as DialogContent };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=DialogContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContent.js","names":["createSignal","mergeProps","Show","splitProps","DialogContentProps","clsx","classes","DialogPortal","DialogOverlay","DialogContentContext","useDialogContext","DialogClose","DialogContent","props","show","open","setShow","merged","showCloseButton","const","local","others","titleID","setTitleID","descriptionID","setDescriptionID","_$createComponent","when","children","Provider","value","_tmpl$","_tmpl$2","_el$3","_tmpl$3","addEventListener","_$spread","_$mergeProps","data-open","class","aria-labelledby","aria-describedby","_$insert"],"sources":["../../../../src/components/dialog/DialogContent/DialogContent.tsx"],"sourcesContent":["import { createSignal, mergeProps, Show, splitProps } from \"solid-js\";\nimport type { DialogContentProps } from \"./DialogContent.types\";\nimport { clsx } from \"~/utils\";\nimport { classes } from \"./DialogContent.styles\";\nimport { DialogPortal } from \"../DialogPortal\";\nimport { DialogOverlay } from \"../DialogOverlay\";\nimport { DialogContentContext } from \"./DialogContent.context\";\nimport { useDialogContext } from \"../Dialog\";\nimport { DialogClose } from \"../DialogClose\";\n\nexport const DialogContent = (props: DialogContentProps) => {\n const { show, open, setShow } = useDialogContext();\n\n const merged = mergeProps({ showCloseButton: true } as const, props);\n\n const [local, others] = splitProps(merged, [\n \"showCloseButton\",\n \"class\",\n \"classList\",\n \"children\",\n ]);\n\n const [titleID, setTitleID] = createSignal<string>();\n const [descriptionID, setDescriptionID] = createSignal<string>();\n\n return (\n <Show when={show()}>\n <DialogContentContext.Provider value={{ setTitleID, setDescriptionID }}>\n <DialogPortal>\n <div\n role=\"presentation\"\n class=\"fixed inset-0 select-none\"\n aria-hidden=\"true\"\n />\n <DialogOverlay />\n <span data-type=\"inside\" class=\"sr-only\" aria-hidden=\"true\" />\n <div\n data-slot=\"dialog-content\"\n data-open={open()}\n class={clsx(classes, local.class)}\n role=\"dialog\"\n aria-labelledby={titleID()}\n aria-describedby={descriptionID()}\n onAnimationEnd={() => {\n if (open()) return;\n setShow(false);\n }}\n {...others}\n >\n {local.children}\n <Show when={local.showCloseButton}>\n <DialogClose />\n </Show>\n </div>\n <span data-type=\"inside\" class=\"sr-only\" aria-hidden=\"true\" />\n </DialogPortal>\n </DialogContentContext.Provider>\n </Show>\n );\n};\n"],"mappings":";;;;;;;;;;gQAUaY,KAAiBC,MAA8B;CAC1D,IAAM,EAAEC,SAAMC,SAAMC,eAAYN,GAAkB,EAI5C,CAACU,GAAOC,KAAUlB,EAFTF,EAAW,EAAEiB,iBAAiB,IAAM,EAAWL,EAAM,EAEzB;EACzC;EACA;EACA;EACA;EACD,CAAC,EAEI,CAACS,GAASC,KAAcvB,GAAsB,EAC9C,CAACwB,GAAeC,KAAoBzB,GAAsB;AAEhE,QAAA0B,EACGxB,GAAI;EAAA,IAACyB,OAAI;AAAA,UAAEb,GAAM;;EAAA,IAAAc,WAAA;AAAA,UAAAF,EACfjB,EAAqBoB,UAAQ;IAACC,OAAO;KAAEP;KAAYE;KAAkB;IAAA,IAAAG,WAAA;AAAA,YAAAF,EACnEnB,GAAY,EAAA,IAAAqB,WAAA;AAAA,aAAA;OAAAG,GAAA;OAAAL,EAMVlB,GAAa,EAAA,CAAA;OAAAwB,GAAA;cAAA;QAAA,IAAAC,IAAAC,GAAA;AAiBE,eAjBFD,EAAAE,iBAAA,sBASU;AAChBpB,YAAM,IACVC,EAAQ,GAAM;UACf,EAAAoB,EAAAH,GAAAI,EAAA;SAAA,IAAA,cAAA;AAAA,iBARUtB,GAAM;;SAAA,IAAA,QAAA;AAAA,iBACVV,EAAKC,GAASc,EAAMmB,MAAM;;SAAA,IAAA,oBAAA;AAAA,iBAEhBjB,GAAS;;SAAA,IAAA,qBAAA;AAAA,iBACRE,GAAe;;SAAA,EAK7BH,EAAM,EAAA,IAAA,GAAA,EAAAqB,EAAAT,SAETb,EAAMQ,UAAQ,KAAA,EAAAc,EAAAT,GAAAP,EACdxB,GAAI;SAAA,IAACyB,OAAI;AAAA,iBAAEP,EAAMF;;SAAe,IAAAU,WAAA;AAAA,iBAAAF,EAC9Bf,GAAW,EAAA,CAAA;;SAAA,CAAA,EAAA,KAAA,EAAAsB;WAAA;OAAAD,GAAA;OAAA;QAAA,CAAA;;IAAA,CAAA;;EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const classes = "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-white dark:bg-neutral-900 p-4 text-sm text-neutral-950 dark:text-neutral-50 ring-1 ring-neutral-950/10 dark:ring-neutral-50/10 duration-100 outline-none sm:max-w-sm data-[open=true]:animate-in data-[open=true]:fade-in-0 data-[open=true]:zoom-in-95 data-[open=false]:animate-out data-[open=false]:fade-out-0 data-[open=false]:zoom-out-95";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/components/dialog/DialogContent/DialogContent.styles.ts
|
|
2
|
+
var e = "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-white dark:bg-neutral-900 p-4 text-sm text-neutral-950 dark:text-neutral-50 ring-1 ring-neutral-950/10 dark:ring-neutral-50/10 duration-100 outline-none sm:max-w-sm data-[open=true]:animate-in data-[open=true]:fade-in-0 data-[open=true]:zoom-in-95 data-[open=false]:animate-out data-[open=false]:fade-out-0 data-[open=false]:zoom-out-95";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as classes };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=DialogContent.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogContent.styles.js","names":[],"sources":["../../../../src/components/dialog/DialogContent/DialogContent.styles.ts"],"sourcesContent":["export const classes =\n \"fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-white dark:bg-neutral-900 p-4 text-sm text-neutral-950 dark:text-neutral-50 ring-1 ring-neutral-950/10 dark:ring-neutral-50/10 duration-100 outline-none sm:max-w-sm data-[open=true]:animate-in data-[open=true]:fade-in-0 data-[open=true]:zoom-in-95 data-[open=false]:animate-out data-[open=false]:fade-out-0 data-[open=false]:zoom-out-95\";\n"],"mappings":";AAAA,IAAa,IACX"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clsx as e } from "../../../utils/clsx.js";
|
|
2
|
+
import { useDialogContentContext as t } from "../DialogContent/DialogContent.context.js";
|
|
3
|
+
import { classes as n } from "./DialogDescription.styles.js";
|
|
4
|
+
import { mergeProps as r, setAttribute as i, spread as a, template as o } from "solid-js/web";
|
|
5
|
+
import { createUniqueId as s, onMount as c, splitProps as l } from "solid-js";
|
|
6
|
+
//#region src/components/dialog/DialogDescription/DialogDescription.tsx
|
|
7
|
+
var u = /* @__PURE__ */ o("<p data-slot=dialog-description>"), d = (o) => {
|
|
8
|
+
let { setDescriptionID: d } = t(), [f, p] = l(o, ["class", "classList"]), m = s();
|
|
9
|
+
return c(() => {
|
|
10
|
+
d(m);
|
|
11
|
+
}), (() => {
|
|
12
|
+
var t = u();
|
|
13
|
+
return i(t, "id", m), a(t, r({ get class() {
|
|
14
|
+
return e(n, f.class);
|
|
15
|
+
} }, p), !1, !1), t;
|
|
16
|
+
})();
|
|
17
|
+
};
|
|
18
|
+
//#endregion
|
|
19
|
+
export { d as DialogDescription };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=DialogDescription.js.map
|