@pylerai/design-system 1.2.4 → 2.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/README.md +169 -316
- package/dist/components/ui/badge.d.ts +2 -1
- package/dist/components/ui/badge.js +49 -0
- package/dist/components/ui/body.js +52 -0
- package/dist/components/ui/button.d.ts +2 -1
- package/dist/components/ui/button.js +172 -0
- package/dist/components/ui/calendar.js +275 -0
- package/dist/components/ui/checkbox.d.ts +7 -0
- package/dist/components/ui/checkbox.js +45 -0
- package/dist/components/ui/chip.d.ts +4 -3
- package/dist/components/ui/chip.js +66 -0
- package/dist/components/ui/dropdown.d.ts +8 -2
- package/dist/components/ui/dropdown.js +256 -0
- package/dist/components/ui/headline.js +50 -0
- package/dist/components/ui/input.d.ts +3 -2
- package/dist/components/ui/input.js +129 -0
- package/dist/components/ui/label.js +43 -0
- package/dist/components/ui/loading-bar.d.ts +2 -1
- package/dist/components/ui/loading-bar.js +64 -0
- package/dist/components/ui/modal.d.ts +3 -2
- package/dist/components/ui/modal.js +170 -0
- package/dist/components/ui/pagination.js +106 -0
- package/dist/components/ui/radio.d.ts +7 -0
- package/dist/components/ui/radio.js +42 -0
- package/dist/components/ui/search-field.d.ts +3 -2
- package/dist/components/ui/search-field.js +98 -0
- package/dist/components/ui/table.js +206 -0
- package/dist/components/ui/tabs.js +149 -0
- package/dist/components/ui/tag.d.ts +2 -1
- package/dist/components/ui/tag.js +31 -0
- package/dist/components/ui/tips.d.ts +2 -1
- package/dist/components/ui/tips.js +25 -0
- package/dist/components/ui/toast.js +70 -0
- package/dist/components/ui/toggle.d.ts +1 -2
- package/dist/components/ui/toggle.js +41 -0
- package/dist/components/ui/use-modal.js +94 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +75 -5779
- package/dist/lib/icons.js +225 -0
- package/dist/lib/size.d.ts +8 -0
- package/dist/lib/use-dialog-a11y.d.ts +2 -0
- package/dist/lib/use-dialog-a11y.js +50 -0
- package/dist/lib/utils.js +16 -0
- package/dist/style.css +1 -1
- package/dist/tokens/pyler-light.js +134 -0
- package/dist/tokens/typography.js +84 -0
- package/package.json +14 -1
- package/pyler-tailwind-colors.cjs +4 -0
- package/dist/index.css.d.ts +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
3
|
+
import { cn as T } from "../../lib/utils.js";
|
|
4
|
+
import * as o from "react";
|
|
5
|
+
const A = o.createContext(null);
|
|
6
|
+
function I() {
|
|
7
|
+
const e = o.useContext(A);
|
|
8
|
+
if (!e) throw new Error("TabsTrigger must be used within Tabs");
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
const R = o.forwardRef(
|
|
12
|
+
({
|
|
13
|
+
value: e,
|
|
14
|
+
defaultValue: t = "",
|
|
15
|
+
onValueChange: d,
|
|
16
|
+
variant: l = "underline",
|
|
17
|
+
children: i,
|
|
18
|
+
className: c
|
|
19
|
+
}, f) => {
|
|
20
|
+
const [x, p] = o.useState(t), g = e !== void 0, b = g ? e : x, m = o.useId(), [w, s] = o.useState(() => /* @__PURE__ */ new Set()), y = o.useCallback((u) => (s((a) => {
|
|
21
|
+
if (a.has(u)) return a;
|
|
22
|
+
const r = new Set(a);
|
|
23
|
+
return r.add(u), r;
|
|
24
|
+
}), () => s((a) => {
|
|
25
|
+
if (!a.has(u)) return a;
|
|
26
|
+
const r = new Set(a);
|
|
27
|
+
return r.delete(u), r;
|
|
28
|
+
})), []), k = (u) => {
|
|
29
|
+
g || p(u), d == null || d(u);
|
|
30
|
+
}, n = o.useMemo(
|
|
31
|
+
() => ({ value: b, onValueChange: k, variant: l, baseId: m, panels: w, registerPanel: y }),
|
|
32
|
+
// handleChange 는 렌더마다 새로 만들어지지만 참조하는 값이 아래 의존성에 모두 들어 있다
|
|
33
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
34
|
+
[b, g, d, l, m, w, y]
|
|
35
|
+
);
|
|
36
|
+
return /* @__PURE__ */ h(A.Provider, { value: n, children: /* @__PURE__ */ h("div", { ref: f, className: T("flex flex-col", c), children: i }) });
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
R.displayName = "Tabs";
|
|
40
|
+
const P = o.forwardRef(
|
|
41
|
+
({ children: e, className: t }, d) => {
|
|
42
|
+
const { variant: l } = I();
|
|
43
|
+
return /* @__PURE__ */ h(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
ref: d,
|
|
47
|
+
role: "tablist",
|
|
48
|
+
className: T(
|
|
49
|
+
"flex items-center",
|
|
50
|
+
l === "underline" && "gap-5",
|
|
51
|
+
l === "outline" && "gap-1",
|
|
52
|
+
l === "round" && "bg-ds-surface-strong p-1 rounded-lg",
|
|
53
|
+
t
|
|
54
|
+
),
|
|
55
|
+
children: e
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
P.displayName = "TabsList";
|
|
61
|
+
const S = o.forwardRef(
|
|
62
|
+
({ value: e, disabled: t, children: d, className: l, onClick: i, onKeyDown: c, ...f }, x) => {
|
|
63
|
+
const { value: p, onValueChange: g, variant: b, baseId: m, panels: w } = I(), s = p === e, y = w.has(e), k = (n) => {
|
|
64
|
+
if (c == null || c(n), n.defaultPrevented || !["ArrowRight", "ArrowLeft", "Home", "End"].includes(n.key)) return;
|
|
65
|
+
const a = n.currentTarget.closest('[role="tablist"]'), r = Array.from(
|
|
66
|
+
(a == null ? void 0 : a.querySelectorAll('[role="tab"]:not([disabled])')) ?? []
|
|
67
|
+
);
|
|
68
|
+
if (r.length === 0) return;
|
|
69
|
+
n.preventDefault();
|
|
70
|
+
const N = r.indexOf(n.currentTarget), $ = n.key === "Home" ? 0 : n.key === "End" ? r.length - 1 : n.key === "ArrowRight" ? (N + 1 + r.length) % r.length : (N - 1 + r.length) % r.length;
|
|
71
|
+
r[$].focus(), r[$].click();
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ h(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
ref: x,
|
|
77
|
+
role: "tab",
|
|
78
|
+
type: "button",
|
|
79
|
+
id: `${m}-tab-${e}`,
|
|
80
|
+
"aria-selected": s,
|
|
81
|
+
"aria-controls": y ? `${m}-panel-${e}` : void 0,
|
|
82
|
+
tabIndex: s ? 0 : -1,
|
|
83
|
+
disabled: t,
|
|
84
|
+
onClick: (n) => {
|
|
85
|
+
t || g(e), i == null || i(n);
|
|
86
|
+
},
|
|
87
|
+
onKeyDown: k,
|
|
88
|
+
className: T(
|
|
89
|
+
"inline-flex items-center justify-center whitespace-nowrap shrink-0 transition-colors focus-visible:outline-none",
|
|
90
|
+
b === "underline" && [
|
|
91
|
+
"h-11 text-body-2-sb",
|
|
92
|
+
s && !t && "border-b-2 border-ds-text-strong text-ds-text-strong",
|
|
93
|
+
!s && !t && "text-ds-text-normal",
|
|
94
|
+
t && "text-ds-text-disabled cursor-not-allowed"
|
|
95
|
+
],
|
|
96
|
+
b === "box" && [
|
|
97
|
+
"h-10 px-3 rounded-lg text-body-3-m",
|
|
98
|
+
s && !t && "bg-ds-surface-normal text-ds-text-strong",
|
|
99
|
+
!s && !t && "bg-ds-background-default text-ds-text-normal",
|
|
100
|
+
t && "bg-ds-background-default text-ds-text-disabled cursor-not-allowed"
|
|
101
|
+
],
|
|
102
|
+
b === "outline" && [
|
|
103
|
+
"h-8 px-3 rounded-full text-body-4-m",
|
|
104
|
+
s && !t && "bg-ds-surface-normal text-ds-text-strong",
|
|
105
|
+
!s && !t && "bg-ds-background-default border border-ds-line-normal text-ds-text-normal",
|
|
106
|
+
t && "bg-ds-background-default border border-ds-line-normal text-ds-text-disabled cursor-not-allowed"
|
|
107
|
+
],
|
|
108
|
+
b === "round" && [
|
|
109
|
+
"h-7 px-2.5 rounded text-body-4-r",
|
|
110
|
+
s && !t && "bg-ds-surface-alternative text-ds-text-strong",
|
|
111
|
+
!s && !t && "bg-ds-surface-strong text-ds-text-normal",
|
|
112
|
+
t && "bg-ds-surface-strong text-ds-text-disabled cursor-not-allowed"
|
|
113
|
+
],
|
|
114
|
+
l
|
|
115
|
+
),
|
|
116
|
+
...f,
|
|
117
|
+
children: d
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
S.displayName = "TabsTrigger";
|
|
123
|
+
const E = o.forwardRef(
|
|
124
|
+
({ value: e, children: t, className: d }, l) => {
|
|
125
|
+
const { value: i, baseId: c, registerPanel: f } = I(), x = i === e;
|
|
126
|
+
return o.useEffect(() => {
|
|
127
|
+
if (x)
|
|
128
|
+
return f(e);
|
|
129
|
+
}, [x, e, f]), x ? /* @__PURE__ */ h(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
ref: l,
|
|
133
|
+
role: "tabpanel",
|
|
134
|
+
id: `${c}-panel-${e}`,
|
|
135
|
+
"aria-labelledby": `${c}-tab-${e}`,
|
|
136
|
+
tabIndex: 0,
|
|
137
|
+
className: T("mt-4", d),
|
|
138
|
+
children: t
|
|
139
|
+
}
|
|
140
|
+
) : null;
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
E.displayName = "TabsContent";
|
|
144
|
+
export {
|
|
145
|
+
R as Tabs,
|
|
146
|
+
E as TabsContent,
|
|
147
|
+
P as TabsList,
|
|
148
|
+
S as TabsTrigger
|
|
149
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DsSize } from '../../lib/size';
|
|
1
2
|
import * as React from "react";
|
|
2
|
-
export type TagSize = "
|
|
3
|
+
export type TagSize = Extract<DsSize, "md" | "sm" | "xs">;
|
|
3
4
|
export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
5
|
size?: TagSize;
|
|
5
6
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { cn as p } from "../../lib/utils.js";
|
|
4
|
+
import * as i from "react";
|
|
5
|
+
const x = {
|
|
6
|
+
md: { padding: "px-2 py-1", text: "text-body-3-r" },
|
|
7
|
+
sm: { padding: "px-2 py-0.5", text: "text-body-4-r" },
|
|
8
|
+
xs: { padding: "px-2 py-0.5", text: "text-label-1-r" }
|
|
9
|
+
}, l = i.forwardRef(
|
|
10
|
+
({ size: t = "md", className: e, children: r, ...s }, d) => {
|
|
11
|
+
const { padding: n, text: a } = x[t];
|
|
12
|
+
return /* @__PURE__ */ o(
|
|
13
|
+
"span",
|
|
14
|
+
{
|
|
15
|
+
ref: d,
|
|
16
|
+
className: p(
|
|
17
|
+
"inline-flex items-center justify-center border border-ds-line-strong rounded-full bg-ds-background-default text-ds-text-strong whitespace-nowrap",
|
|
18
|
+
n,
|
|
19
|
+
a,
|
|
20
|
+
e
|
|
21
|
+
),
|
|
22
|
+
...s,
|
|
23
|
+
children: r
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
l.displayName = "Tag";
|
|
29
|
+
export {
|
|
30
|
+
l as Tag
|
|
31
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { DsSize } from '../../lib/size';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
export type TipsColor = "white" | "black";
|
|
3
|
-
export type TipsSize = "
|
|
4
|
+
export type TipsSize = Extract<DsSize, "md" | "sm">;
|
|
4
5
|
export interface TipsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
6
|
color?: TipsColor;
|
|
6
7
|
size?: TipsSize;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
3
|
+
import { cn as s } from "../../lib/utils.js";
|
|
4
|
+
import * as a from "react";
|
|
5
|
+
const x = a.forwardRef(
|
|
6
|
+
({ color: e = "white", size: t = "md", className: r, children: d, ...o }, i) => /* @__PURE__ */ p(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
ref: i,
|
|
10
|
+
className: s(
|
|
11
|
+
"inline-flex flex-col items-start justify-center rounded-[8px] shadow-[0px_5px_16px_0px_rgba(0,0,0,0.05)]",
|
|
12
|
+
t === "md" ? "px-2.5 py-2" : "px-2 py-1.5",
|
|
13
|
+
e === "black" ? "bg-ds-primitive-black text-white" : "bg-ds-background-default border border-ds-line-normal text-ds-text-strong",
|
|
14
|
+
t === "md" ? "text-body-4-r" : "text-label-1-r",
|
|
15
|
+
r
|
|
16
|
+
),
|
|
17
|
+
...o,
|
|
18
|
+
children: d
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
x.displayName = "Tips";
|
|
23
|
+
export {
|
|
24
|
+
x as Tips
|
|
25
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
import { CautionIcon as a, NegativeIcon as m, PositiveIcon as l, ChevronRightIcon as p } from "../../lib/icons.js";
|
|
4
|
+
import { cn as u } from "../../lib/utils.js";
|
|
5
|
+
import { toast as s, Toaster as x } from "sonner";
|
|
6
|
+
function r({ icon: t, message: o }) {
|
|
7
|
+
return /* @__PURE__ */ i("div", { className: "bg-ds-primitive-black flex items-center gap-1.5 p-3 rounded-lg w-[336px]", children: [
|
|
8
|
+
t,
|
|
9
|
+
/* @__PURE__ */ e("p", { className: "text-white text-body-2-r flex-1 min-w-0", children: o })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
function f({ position: t = "bottom-center" }) {
|
|
13
|
+
return /* @__PURE__ */ e(
|
|
14
|
+
x,
|
|
15
|
+
{
|
|
16
|
+
position: t,
|
|
17
|
+
toastOptions: { unstyled: !0, classNames: { toast: "!p-0 !bg-transparent !shadow-none !border-none" } }
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
const g = {
|
|
22
|
+
success: (t, o) => s.custom(() => /* @__PURE__ */ e(r, { icon: /* @__PURE__ */ e(l, {}), message: t }), o),
|
|
23
|
+
error: (t, o) => s.custom(() => /* @__PURE__ */ e(r, { icon: /* @__PURE__ */ e(m, {}), message: t }), o),
|
|
24
|
+
caution: (t, o) => s.custom(() => /* @__PURE__ */ e(r, { icon: /* @__PURE__ */ e(a, {}), message: t }), o)
|
|
25
|
+
};
|
|
26
|
+
function c({
|
|
27
|
+
icon: t,
|
|
28
|
+
message: o,
|
|
29
|
+
action: n
|
|
30
|
+
}) {
|
|
31
|
+
return /* @__PURE__ */ i("div", { className: "bg-ds-primitive-black flex items-center gap-1.5 px-3 py-4 rounded-lg w-[336px] shadow-[0px_5px_16px_0px_rgba(0,0,0,0.05)]", children: [
|
|
32
|
+
t,
|
|
33
|
+
/* @__PURE__ */ e("p", { className: "text-white text-body-2-r flex-1 min-w-0", children: o }),
|
|
34
|
+
n && /* @__PURE__ */ i(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
type: "button",
|
|
38
|
+
onClick: n.onClick,
|
|
39
|
+
className: u(
|
|
40
|
+
"inline-flex items-center shrink-0 text-white text-body-3-m whitespace-nowrap",
|
|
41
|
+
n.withIcon ? "gap-0.5" : ""
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
n.label,
|
|
45
|
+
n.withIcon && /* @__PURE__ */ e(p, {})
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
const k = {
|
|
52
|
+
success: (t, o, n) => s.custom(
|
|
53
|
+
() => /* @__PURE__ */ e(c, { icon: /* @__PURE__ */ e(l, {}), message: t, action: o }),
|
|
54
|
+
n
|
|
55
|
+
),
|
|
56
|
+
error: (t, o, n) => s.custom(
|
|
57
|
+
() => /* @__PURE__ */ e(c, { icon: /* @__PURE__ */ e(m, {}), message: t, action: o }),
|
|
58
|
+
n
|
|
59
|
+
),
|
|
60
|
+
caution: (t, o, n) => s.custom(
|
|
61
|
+
() => /* @__PURE__ */ e(c, { icon: /* @__PURE__ */ e(a, {}), message: t, action: o }),
|
|
62
|
+
n
|
|
63
|
+
)
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
c as SnackbarContent,
|
|
67
|
+
f as Toaster,
|
|
68
|
+
k as snackbar,
|
|
69
|
+
g as toast
|
|
70
|
+
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export interface ToggleProps {
|
|
2
|
+
export interface ToggleProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "type"> {
|
|
3
3
|
checked?: boolean;
|
|
4
4
|
neutral?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
onChange?: (checked: boolean) => void;
|
|
7
|
-
className?: string;
|
|
8
7
|
}
|
|
9
8
|
declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
9
|
export { Toggle };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { cn as s } from "../../lib/utils.js";
|
|
4
|
+
import * as p from "react";
|
|
5
|
+
const b = p.forwardRef(
|
|
6
|
+
({ checked: r, neutral: l, disabled: o, onChange: t, className: i, ...a }, e) => {
|
|
7
|
+
const m = l ? "left-[11px]" : r ? "left-[17px]" : "left-[3px]", u = o ? r ? "bg-ds-primary-blue-disabled" : "bg-ds-line-normal" : r ? "bg-ds-primary-blue-normal" : "bg-ds-line-normal";
|
|
8
|
+
return /* @__PURE__ */ n(
|
|
9
|
+
"button",
|
|
10
|
+
{
|
|
11
|
+
ref: e,
|
|
12
|
+
type: "button",
|
|
13
|
+
role: "switch",
|
|
14
|
+
"aria-checked": l ? "mixed" : r,
|
|
15
|
+
disabled: o,
|
|
16
|
+
onClick: () => !o && (t == null ? void 0 : t(!r)),
|
|
17
|
+
className: s(
|
|
18
|
+
"relative inline-flex h-6 w-10 shrink-0 rounded-full border border-ds-line-normal transition-colors",
|
|
19
|
+
o && !r ? "bg-ds-surface-normal" : "bg-ds-background-default",
|
|
20
|
+
o ? "cursor-not-allowed" : "cursor-pointer",
|
|
21
|
+
i
|
|
22
|
+
),
|
|
23
|
+
...a,
|
|
24
|
+
children: /* @__PURE__ */ n(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
className: s(
|
|
28
|
+
"absolute top-1/2 -translate-y-1/2 h-[18px] w-[18px] rounded-full transition-all duration-200",
|
|
29
|
+
m,
|
|
30
|
+
u
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
b.displayName = "Toggle";
|
|
39
|
+
export {
|
|
40
|
+
b as Toggle
|
|
41
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as a, jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import * as c from "react";
|
|
4
|
+
import { InformationModal as x, ActionModal as w, ContentModal as P } from "./modal.js";
|
|
5
|
+
const p = c.createContext(null);
|
|
6
|
+
let h = 0;
|
|
7
|
+
function C() {
|
|
8
|
+
return `modal-${++h}`;
|
|
9
|
+
}
|
|
10
|
+
function y({ children: o }) {
|
|
11
|
+
const [b, s] = c.useState([]), i = c.useCallback((e, n) => {
|
|
12
|
+
s((r) => {
|
|
13
|
+
const t = r.find((u) => u.id === e);
|
|
14
|
+
return t == null || t.resolve(n), r.filter((u) => u.id !== e);
|
|
15
|
+
});
|
|
16
|
+
}, []), l = c.useCallback((e) => new Promise((n) => {
|
|
17
|
+
const r = C();
|
|
18
|
+
s((t) => [...t, { ...e, id: r, type: "information", resolve: n }]);
|
|
19
|
+
}), []), M = c.useCallback((e) => new Promise((n) => {
|
|
20
|
+
const r = C();
|
|
21
|
+
s((t) => [...t, { ...e, id: r, type: "action", resolve: n }]);
|
|
22
|
+
}), []), L = c.useCallback((e) => new Promise((n) => {
|
|
23
|
+
const r = C();
|
|
24
|
+
s((t) => [...t, { ...e, id: r, type: "content", resolve: n }]);
|
|
25
|
+
}), []);
|
|
26
|
+
return /* @__PURE__ */ a(p.Provider, { value: { openInformationModal: l, openActionModal: M, openContentModal: L }, children: [
|
|
27
|
+
o,
|
|
28
|
+
b.map((e) => e.type === "information" ? /* @__PURE__ */ f(
|
|
29
|
+
x,
|
|
30
|
+
{
|
|
31
|
+
open: !0,
|
|
32
|
+
title: e.title,
|
|
33
|
+
description: e.description,
|
|
34
|
+
confirmLabel: e.confirmLabel,
|
|
35
|
+
onConfirm: () => {
|
|
36
|
+
var n;
|
|
37
|
+
(n = e.onConfirm) == null || n.call(e), i(e.id, !0);
|
|
38
|
+
},
|
|
39
|
+
onClose: () => i(e.id, !1)
|
|
40
|
+
},
|
|
41
|
+
e.id
|
|
42
|
+
) : e.type === "action" ? /* @__PURE__ */ f(
|
|
43
|
+
w,
|
|
44
|
+
{
|
|
45
|
+
open: !0,
|
|
46
|
+
title: e.title,
|
|
47
|
+
description: e.description,
|
|
48
|
+
cancelLabel: e.cancelLabel,
|
|
49
|
+
confirmLabel: e.confirmLabel,
|
|
50
|
+
onCancel: () => {
|
|
51
|
+
var n;
|
|
52
|
+
(n = e.onCancel) == null || n.call(e), i(e.id, !1);
|
|
53
|
+
},
|
|
54
|
+
onConfirm: () => {
|
|
55
|
+
var n;
|
|
56
|
+
(n = e.onConfirm) == null || n.call(e), i(e.id, !0);
|
|
57
|
+
},
|
|
58
|
+
onClose: () => i(e.id, !1)
|
|
59
|
+
},
|
|
60
|
+
e.id
|
|
61
|
+
) : /* @__PURE__ */ f(
|
|
62
|
+
P,
|
|
63
|
+
{
|
|
64
|
+
open: !0,
|
|
65
|
+
title: e.title,
|
|
66
|
+
description: e.description,
|
|
67
|
+
size: e.size,
|
|
68
|
+
cancelLabel: e.cancelLabel,
|
|
69
|
+
confirmLabel: e.confirmLabel,
|
|
70
|
+
onCancel: () => {
|
|
71
|
+
var n;
|
|
72
|
+
(n = e.onCancel) == null || n.call(e), i(e.id, !1);
|
|
73
|
+
},
|
|
74
|
+
onConfirm: () => {
|
|
75
|
+
var n;
|
|
76
|
+
(n = e.onConfirm) == null || n.call(e), i(e.id, !0);
|
|
77
|
+
},
|
|
78
|
+
onClose: () => i(e.id, !1),
|
|
79
|
+
children: e.content
|
|
80
|
+
},
|
|
81
|
+
e.id
|
|
82
|
+
))
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
function I() {
|
|
86
|
+
const o = c.useContext(p);
|
|
87
|
+
if (!o)
|
|
88
|
+
throw new Error("useModal must be used within a ModalProvider");
|
|
89
|
+
return o;
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
y as ModalProvider,
|
|
93
|
+
I as useModal
|
|
94
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { PYLER_LIGHT_COLOR_TOKENS, flatPylerLightTokens, PYLER_LIGHT_GROUP_ORDER
|
|
|
2
2
|
export type { HexColor, DsCssVar, PylerLightCssVar, PylerLightGroup, PylerLightFlatToken, } from './tokens/pyler-light';
|
|
3
3
|
export { PYLER_TYPOGRAPHY_STYLE } from './tokens/typography';
|
|
4
4
|
export type { PylerTypographyStyleKey, PylerTypographyScale, PylerTypographyUtilityClass, } from './tokens/typography';
|
|
5
|
+
export type { DsSize } from './lib/size';
|
|
5
6
|
export { Button, ButtonIndicator, buttonVariants } from './components/ui/button';
|
|
6
7
|
export type { ButtonProps, ButtonIndicatorProps } from './components/ui/button';
|
|
7
8
|
export { InputField, TextField } from './components/ui/input';
|