laif-ds 0.2.49 → 0.2.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/kanban.js +21 -20
- package/dist/components/ui/app-kanban.js +89 -95
- package/dist/components/ui/app-radio-group.js +62 -48
- package/dist/components/ui/app-select.js +93 -90
- package/dist/components/ui/async-select.js +134 -126
- package/dist/components/ui/badge.js +38 -31
- package/dist/components/ui/button.js +49 -40
- package/dist/components/ui/card.js +36 -28
- package/dist/components/ui/checkbox.js +23 -20
- package/dist/components/ui/date-picker.js +64 -59
- package/dist/components/ui/dialog.js +54 -42
- package/dist/components/ui/input.js +116 -111
- package/dist/components/ui/popover.js +15 -13
- package/dist/components/ui/radio-group.js +29 -27
- package/dist/components/ui/select.js +74 -67
- package/dist/components/ui/sheet.js +39 -28
- package/dist/components/ui/slider.js +34 -28
- package/dist/components/ui/switch.js +16 -13
- package/dist/components/ui/tabs.js +35 -26
- package/dist/components/ui/textarea.js +26 -17
- package/dist/index.d.ts +2 -2
- package/dist/lib/design-tokens.js +43 -0
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
|
@@ -1,93 +1,99 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Root as
|
|
4
|
-
import * as
|
|
5
|
-
import { Label as
|
|
2
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { Root as f, Portal as g, Content as x, Viewport as h, Group as v, Item as b, ItemIndicator as y, ItemText as S, Label as z, Separator as w, Trigger as N, Icon as C, Value as I, ScrollUpButton as _, ScrollDownButton as j } from "../../node_modules/@radix-ui/react-select/dist/index.js";
|
|
4
|
+
import * as u from "react";
|
|
5
|
+
import { Label as k } from "./label.js";
|
|
6
|
+
import { designTokens as r } from "../../lib/design-tokens.js";
|
|
6
7
|
import { cn as o } from "../../lib/utils.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
8
|
+
import B from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
9
|
+
import p from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
|
|
10
|
+
import L from "../../node_modules/lucide-react/dist/esm/icons/chevron-up.js";
|
|
11
|
+
function E({
|
|
11
12
|
size: t = "default",
|
|
12
13
|
label: a,
|
|
13
14
|
className: s,
|
|
14
|
-
labelClassName:
|
|
15
|
+
labelClassName: n,
|
|
15
16
|
...d
|
|
16
17
|
}) {
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
a && /* @__PURE__ */ e(
|
|
20
|
-
/* @__PURE__ */ e(m.Provider, { value: { size: t, id:
|
|
18
|
+
const l = u.useId();
|
|
19
|
+
return /* @__PURE__ */ c("div", { className: o("space-y-1.5", s), children: [
|
|
20
|
+
a && /* @__PURE__ */ e(k, { htmlFor: l, className: n, children: a }),
|
|
21
|
+
/* @__PURE__ */ e(m.Provider, { value: { size: t, id: l }, children: /* @__PURE__ */ e(f, { "data-slot": "select", ...d }) })
|
|
21
22
|
] });
|
|
22
23
|
}
|
|
23
|
-
const m =
|
|
24
|
-
function
|
|
24
|
+
const m = u.createContext({ size: "default" }), T = () => u.useContext(m);
|
|
25
|
+
function H({
|
|
25
26
|
...t
|
|
26
27
|
}) {
|
|
27
|
-
return /* @__PURE__ */ e(
|
|
28
|
+
return /* @__PURE__ */ e(v, { "data-slot": "select-group", ...t });
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function J({
|
|
30
31
|
...t
|
|
31
32
|
}) {
|
|
32
|
-
return /* @__PURE__ */ e(
|
|
33
|
+
return /* @__PURE__ */ e(I, { "data-slot": "select-value", ...t });
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function K({
|
|
35
36
|
className: t,
|
|
36
37
|
size: a,
|
|
37
38
|
children: s,
|
|
38
|
-
...
|
|
39
|
+
...n
|
|
39
40
|
}) {
|
|
40
|
-
const { size: d, id:
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
41
|
+
const { size: d, id: l } = T(), i = a || d;
|
|
42
|
+
return /* @__PURE__ */ c(
|
|
43
|
+
N,
|
|
43
44
|
{
|
|
44
|
-
id:
|
|
45
|
+
id: l,
|
|
45
46
|
"data-slot": "select-trigger",
|
|
46
|
-
"data-size":
|
|
47
|
+
"data-size": i,
|
|
47
48
|
className: o(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
49
|
+
r.input.base,
|
|
50
|
+
r.radius.default,
|
|
51
|
+
r.text.base,
|
|
52
|
+
r.text.placeholder,
|
|
53
|
+
r.interaction.disabled,
|
|
54
|
+
"flex items-center justify-between px-3 py-2 whitespace-nowrap [&>span]:line-clamp-1",
|
|
55
|
+
// Focus states
|
|
56
|
+
"focus-visible:ring-d-ring/50 focus-visible:border-d-ring focus:outline-none focus-visible:ring-[3px]",
|
|
57
|
+
"data-[state=open]:ring-d-ring/50 data-[state=open]:border-d-ring data-[state=open]:ring-[3px]",
|
|
58
|
+
r.input.invalid,
|
|
54
59
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
55
60
|
"*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
56
|
-
"transition-all duration-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
"transition-all duration-200",
|
|
62
|
+
i === "default" && "h-9",
|
|
63
|
+
i === "sm" && "h-8 text-xs",
|
|
64
|
+
i === "lg" && "h-10 text-lg",
|
|
60
65
|
t
|
|
61
66
|
),
|
|
62
|
-
...
|
|
67
|
+
...n,
|
|
63
68
|
children: [
|
|
64
69
|
s,
|
|
65
|
-
/* @__PURE__ */ e(
|
|
70
|
+
/* @__PURE__ */ e(C, { asChild: !0, children: /* @__PURE__ */ e(p, { className: "size-4 opacity-50" }) })
|
|
66
71
|
]
|
|
67
72
|
}
|
|
68
73
|
);
|
|
69
74
|
}
|
|
70
|
-
function
|
|
75
|
+
function M({
|
|
71
76
|
className: t,
|
|
72
77
|
children: a,
|
|
73
78
|
position: s = "popper",
|
|
74
|
-
...
|
|
79
|
+
...n
|
|
75
80
|
}) {
|
|
76
|
-
return /* @__PURE__ */ e(
|
|
77
|
-
|
|
81
|
+
return /* @__PURE__ */ e(g, { children: /* @__PURE__ */ c(
|
|
82
|
+
x,
|
|
78
83
|
{
|
|
79
84
|
"data-slot": "select-content",
|
|
80
85
|
className: o(
|
|
81
|
-
|
|
86
|
+
r.radius.default,
|
|
87
|
+
"bg-d-popover text-d-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-d-border relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto border shadow-md",
|
|
82
88
|
s === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
83
89
|
t
|
|
84
90
|
),
|
|
85
91
|
position: s,
|
|
86
|
-
...
|
|
92
|
+
...n,
|
|
87
93
|
children: [
|
|
88
94
|
/* @__PURE__ */ e(D, {}),
|
|
89
95
|
/* @__PURE__ */ e(
|
|
90
|
-
|
|
96
|
+
h,
|
|
91
97
|
{
|
|
92
98
|
className: o(
|
|
93
99
|
"p-1",
|
|
@@ -101,49 +107,50 @@ function J({
|
|
|
101
107
|
}
|
|
102
108
|
) });
|
|
103
109
|
}
|
|
104
|
-
function
|
|
110
|
+
function O({
|
|
105
111
|
className: t,
|
|
106
112
|
...a
|
|
107
113
|
}) {
|
|
108
114
|
return /* @__PURE__ */ e(
|
|
109
|
-
|
|
115
|
+
z,
|
|
110
116
|
{
|
|
111
117
|
"data-slot": "select-label",
|
|
112
118
|
className: o(
|
|
113
|
-
"text-d-secondary-foreground px-2 py-1.5 text-xs",
|
|
119
|
+
"text-d-secondary-foreground px-2 py-1.5 text-xs font-medium",
|
|
114
120
|
t
|
|
115
121
|
),
|
|
116
122
|
...a
|
|
117
123
|
}
|
|
118
124
|
);
|
|
119
125
|
}
|
|
120
|
-
function
|
|
126
|
+
function Q({
|
|
121
127
|
className: t,
|
|
122
128
|
children: a,
|
|
123
129
|
...s
|
|
124
130
|
}) {
|
|
125
|
-
return /* @__PURE__ */
|
|
126
|
-
|
|
131
|
+
return /* @__PURE__ */ c(
|
|
132
|
+
b,
|
|
127
133
|
{
|
|
128
134
|
"data-slot": "select-item",
|
|
129
135
|
className: o(
|
|
130
|
-
|
|
136
|
+
r.radius.sm,
|
|
137
|
+
"focus:bg-d-accent focus:text-d-accent-foreground [&_svg:not([class*='text-'])]:text-d-secondary-foreground relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
131
138
|
t
|
|
132
139
|
),
|
|
133
140
|
...s,
|
|
134
141
|
children: [
|
|
135
|
-
/* @__PURE__ */ e("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ e(
|
|
136
|
-
/* @__PURE__ */ e(
|
|
142
|
+
/* @__PURE__ */ e("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ e(y, { children: /* @__PURE__ */ e(B, { className: "size-4" }) }) }),
|
|
143
|
+
/* @__PURE__ */ e(S, { children: a })
|
|
137
144
|
]
|
|
138
145
|
}
|
|
139
146
|
);
|
|
140
147
|
}
|
|
141
|
-
function
|
|
148
|
+
function W({
|
|
142
149
|
className: t,
|
|
143
150
|
...a
|
|
144
151
|
}) {
|
|
145
152
|
return /* @__PURE__ */ e(
|
|
146
|
-
|
|
153
|
+
w,
|
|
147
154
|
{
|
|
148
155
|
"data-slot": "select-separator",
|
|
149
156
|
className: o(
|
|
@@ -159,7 +166,7 @@ function D({
|
|
|
159
166
|
...a
|
|
160
167
|
}) {
|
|
161
168
|
return /* @__PURE__ */ e(
|
|
162
|
-
|
|
169
|
+
_,
|
|
163
170
|
{
|
|
164
171
|
"data-slot": "select-scroll-up-button",
|
|
165
172
|
className: o(
|
|
@@ -167,7 +174,7 @@ function D({
|
|
|
167
174
|
t
|
|
168
175
|
),
|
|
169
176
|
...a,
|
|
170
|
-
children: /* @__PURE__ */ e(
|
|
177
|
+
children: /* @__PURE__ */ e(L, { className: "size-4" })
|
|
171
178
|
}
|
|
172
179
|
);
|
|
173
180
|
}
|
|
@@ -176,7 +183,7 @@ function R({
|
|
|
176
183
|
...a
|
|
177
184
|
}) {
|
|
178
185
|
return /* @__PURE__ */ e(
|
|
179
|
-
|
|
186
|
+
j,
|
|
180
187
|
{
|
|
181
188
|
"data-slot": "select-scroll-down-button",
|
|
182
189
|
className: o(
|
|
@@ -184,19 +191,19 @@ function R({
|
|
|
184
191
|
t
|
|
185
192
|
),
|
|
186
193
|
...a,
|
|
187
|
-
children: /* @__PURE__ */ e(
|
|
194
|
+
children: /* @__PURE__ */ e(p, { className: "size-4" })
|
|
188
195
|
}
|
|
189
196
|
);
|
|
190
197
|
}
|
|
191
198
|
export {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
199
|
+
E as Select,
|
|
200
|
+
M as SelectContent,
|
|
201
|
+
H as SelectGroup,
|
|
202
|
+
Q as SelectItem,
|
|
203
|
+
O as SelectLabel,
|
|
197
204
|
R as SelectScrollDownButton,
|
|
198
205
|
D as SelectScrollUpButton,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
206
|
+
W as SelectSeparator,
|
|
207
|
+
K as SelectTrigger,
|
|
208
|
+
J as SelectValue
|
|
202
209
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
-
import { Root as
|
|
3
|
+
import { Root as i, Content as l, Close as c, Description as f, Title as m, Trigger as u, Portal as h, Overlay as p } from "../../node_modules/@radix-ui/react-dialog/dist/index.js";
|
|
4
|
+
import { designTokens as n } from "../../lib/design-tokens.js";
|
|
4
5
|
import { cn as a } from "../../lib/utils.js";
|
|
5
|
-
import
|
|
6
|
-
function
|
|
7
|
-
return /* @__PURE__ */ o(
|
|
6
|
+
import b from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
7
|
+
function T({ ...t }) {
|
|
8
|
+
return /* @__PURE__ */ o(i, { "data-slot": "sheet", ...t });
|
|
8
9
|
}
|
|
9
|
-
function
|
|
10
|
+
function k({
|
|
10
11
|
...t
|
|
11
12
|
}) {
|
|
12
13
|
return /* @__PURE__ */ o(u, { "data-slot": "sheet-trigger", ...t });
|
|
@@ -14,14 +15,14 @@ function w({
|
|
|
14
15
|
function g({
|
|
15
16
|
...t
|
|
16
17
|
}) {
|
|
17
|
-
return /* @__PURE__ */ o(
|
|
18
|
+
return /* @__PURE__ */ o(h, { "data-slot": "sheet-portal", ...t });
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function x({
|
|
20
21
|
className: t,
|
|
21
22
|
...e
|
|
22
23
|
}) {
|
|
23
24
|
return /* @__PURE__ */ o(
|
|
24
|
-
|
|
25
|
+
p,
|
|
25
26
|
{
|
|
26
27
|
"data-slot": "sheet-overlay",
|
|
27
28
|
className: a(
|
|
@@ -36,12 +37,12 @@ function C({
|
|
|
36
37
|
className: t,
|
|
37
38
|
children: e,
|
|
38
39
|
side: r = "right",
|
|
39
|
-
...
|
|
40
|
+
...d
|
|
40
41
|
}) {
|
|
41
42
|
return /* @__PURE__ */ s(g, { children: [
|
|
42
|
-
/* @__PURE__ */ o(
|
|
43
|
+
/* @__PURE__ */ o(x, {}),
|
|
43
44
|
/* @__PURE__ */ s(
|
|
44
|
-
|
|
45
|
+
l,
|
|
45
46
|
{
|
|
46
47
|
"data-slot": "sheet-content",
|
|
47
48
|
className: a(
|
|
@@ -52,19 +53,29 @@ function C({
|
|
|
52
53
|
r === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom border-d-border inset-x-0 bottom-0 h-auto border-t",
|
|
53
54
|
t
|
|
54
55
|
),
|
|
55
|
-
...
|
|
56
|
+
...d,
|
|
56
57
|
children: [
|
|
57
58
|
e,
|
|
58
|
-
/* @__PURE__ */ s(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
/* @__PURE__ */ s(
|
|
60
|
+
c,
|
|
61
|
+
{
|
|
62
|
+
className: a(
|
|
63
|
+
"ring-offset-d-background data-[state=open]:bg-d-secondary absolute top-4 right-4 opacity-70 transition-opacity hover:opacity-100 disabled:pointer-events-none",
|
|
64
|
+
n.focusRing,
|
|
65
|
+
n.radius.sm
|
|
66
|
+
),
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ o(b, { className: "size-4" }),
|
|
69
|
+
/* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
62
73
|
]
|
|
63
74
|
}
|
|
64
75
|
)
|
|
65
76
|
] });
|
|
66
77
|
}
|
|
67
|
-
function
|
|
78
|
+
function z({ className: t, ...e }) {
|
|
68
79
|
return /* @__PURE__ */ o(
|
|
69
80
|
"div",
|
|
70
81
|
{
|
|
@@ -74,7 +85,7 @@ function T({ className: t, ...e }) {
|
|
|
74
85
|
}
|
|
75
86
|
);
|
|
76
87
|
}
|
|
77
|
-
function
|
|
88
|
+
function j({ className: t, ...e }) {
|
|
78
89
|
return /* @__PURE__ */ o(
|
|
79
90
|
"div",
|
|
80
91
|
{
|
|
@@ -84,12 +95,12 @@ function k({ className: t, ...e }) {
|
|
|
84
95
|
}
|
|
85
96
|
);
|
|
86
97
|
}
|
|
87
|
-
function
|
|
98
|
+
function D({
|
|
88
99
|
className: t,
|
|
89
100
|
...e
|
|
90
101
|
}) {
|
|
91
102
|
return /* @__PURE__ */ o(
|
|
92
|
-
|
|
103
|
+
m,
|
|
93
104
|
{
|
|
94
105
|
"data-slot": "sheet-title",
|
|
95
106
|
className: a("text-d-foreground font-semibold", t),
|
|
@@ -97,12 +108,12 @@ function z({
|
|
|
97
108
|
}
|
|
98
109
|
);
|
|
99
110
|
}
|
|
100
|
-
function
|
|
111
|
+
function O({
|
|
101
112
|
className: t,
|
|
102
113
|
...e
|
|
103
114
|
}) {
|
|
104
115
|
return /* @__PURE__ */ o(
|
|
105
|
-
|
|
116
|
+
f,
|
|
106
117
|
{
|
|
107
118
|
"data-slot": "sheet-description",
|
|
108
119
|
className: a("text-d-secondary-foreground text-sm", t),
|
|
@@ -111,11 +122,11 @@ function j({
|
|
|
111
122
|
);
|
|
112
123
|
}
|
|
113
124
|
export {
|
|
114
|
-
|
|
125
|
+
T as Sheet,
|
|
115
126
|
C as SheetContent,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
O as SheetDescription,
|
|
128
|
+
j as SheetFooter,
|
|
129
|
+
z as SheetHeader,
|
|
130
|
+
D as SheetTitle,
|
|
131
|
+
k as SheetTrigger
|
|
121
132
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as u, jsx as l, Fragment as k } from "react/jsx-runtime";
|
|
3
|
-
import * as F from "react";
|
|
4
|
-
import { Root as y, Track as M, Range as P, Thumb as b } from "../../node_modules/@radix-ui/react-slider/dist/index.js";
|
|
5
|
-
import { Badge as x } from "./badge.js";
|
|
6
3
|
import { cn as c } from "../../lib/utils.js";
|
|
4
|
+
import { Root as y, Track as F, Range as M, Thumb as b } from "../../node_modules/@radix-ui/react-slider/dist/index.js";
|
|
7
5
|
import { cva as w } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
6
|
+
import * as P from "react";
|
|
7
|
+
import { Badge as x } from "./badge.js";
|
|
8
8
|
const S = w(
|
|
9
9
|
"relative w-full grow overflow-hidden rounded-full bg-d-primary/20",
|
|
10
10
|
{
|
|
@@ -20,26 +20,32 @@ const S = w(
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
), N = w(
|
|
23
|
-
|
|
23
|
+
c(
|
|
24
|
+
"block rounded-full bg-d-background shadow transition-all duration-200 disabled:pointer-events-none disabled:opacity-50",
|
|
25
|
+
// Use standard focus ring but adapted for circular slider thumb
|
|
26
|
+
"focus-visible:outline-none focus-visible:ring-d-primary focus-visible:ring-[3px]",
|
|
27
|
+
"border border-d-primary/50 hover:border-d-primary"
|
|
28
|
+
// Added subtle border interaction
|
|
29
|
+
),
|
|
24
30
|
{
|
|
25
31
|
variants: {
|
|
26
32
|
size: {
|
|
27
|
-
base: "h-4 w-4
|
|
28
|
-
medium: "h-5 w-5
|
|
29
|
-
large: "h-6 w-6
|
|
33
|
+
base: "h-4 w-4",
|
|
34
|
+
medium: "h-5 w-5",
|
|
35
|
+
large: "h-6 w-6"
|
|
30
36
|
}
|
|
31
37
|
},
|
|
32
38
|
defaultVariants: {
|
|
33
39
|
size: "base"
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
|
-
), B =
|
|
42
|
+
), B = P.forwardRef(
|
|
37
43
|
({
|
|
38
44
|
className: C,
|
|
39
45
|
size: m,
|
|
40
|
-
formatValue:
|
|
46
|
+
formatValue: t,
|
|
41
47
|
showValues: $ = !1,
|
|
42
|
-
showStickyLabel:
|
|
48
|
+
showStickyLabel: s = !1,
|
|
43
49
|
stickyLabelSuffix: h = "",
|
|
44
50
|
fillOffset: o = !1,
|
|
45
51
|
offsetValue: v,
|
|
@@ -47,20 +53,20 @@ const S = w(
|
|
|
47
53
|
showStepMarkers: z = !1,
|
|
48
54
|
...e
|
|
49
55
|
}, R) => {
|
|
50
|
-
const
|
|
56
|
+
const r = v !== void 0 ? v : e.min !== void 0 && e.max !== void 0 ? (e.min + e.max) / 2 : 50, f = () => {
|
|
51
57
|
if (!o) return 0;
|
|
52
|
-
const a = e.min || 0,
|
|
53
|
-
return (
|
|
54
|
-
}, g = (a) => d ? d.reduce((n,
|
|
58
|
+
const a = e.min || 0, i = (e.max || 100) - a;
|
|
59
|
+
return (r - a) / i * 100;
|
|
60
|
+
}, g = (a) => d ? d.reduce((n, i) => Math.abs(i - a) < Math.abs(n - a) ? i : n) : a, T = (a) => {
|
|
55
61
|
if (!d || !e.onValueChange) {
|
|
56
62
|
e.onValueChange && e.onValueChange(a);
|
|
57
63
|
return;
|
|
58
64
|
}
|
|
59
|
-
const n = g(a[0]),
|
|
60
|
-
e.onValueChange(
|
|
65
|
+
const n = g(a[0]), i = a.length > 1 ? [n, g(a[1])] : [n];
|
|
66
|
+
e.onValueChange(i);
|
|
61
67
|
}, j = (a) => {
|
|
62
|
-
const n = e.min || 0,
|
|
63
|
-
return (a - n) / (
|
|
68
|
+
const n = e.min || 0, i = e.max || 100;
|
|
69
|
+
return (a - n) / (i - n) * 100;
|
|
64
70
|
};
|
|
65
71
|
return /* @__PURE__ */ u("div", { className: "flex w-full flex-col gap-1", children: [
|
|
66
72
|
/* @__PURE__ */ u(
|
|
@@ -75,7 +81,7 @@ const S = w(
|
|
|
75
81
|
onValueChange: void 0,
|
|
76
82
|
onValueChange: d ? T : e.onValueChange,
|
|
77
83
|
children: [
|
|
78
|
-
/* @__PURE__ */ u(
|
|
84
|
+
/* @__PURE__ */ u(F, { className: c(S({ size: m })), children: [
|
|
79
85
|
d && z && /* @__PURE__ */ l("div", { className: "absolute h-full w-full", children: d.map((a, n) => /* @__PURE__ */ l(
|
|
80
86
|
"div",
|
|
81
87
|
{
|
|
@@ -95,23 +101,23 @@ const S = w(
|
|
|
95
101
|
{
|
|
96
102
|
className: "bg-d-primary absolute h-full",
|
|
97
103
|
style: {
|
|
98
|
-
left: e.value[0] <
|
|
99
|
-
right: e.value[0] >
|
|
104
|
+
left: e.value[0] < r ? `${(e.value[0] - (e.min || 0)) / ((e.max || 100) - (e.min || 0)) * 100}%` : `${f()}%`,
|
|
105
|
+
right: e.value[0] > r ? `${100 - (e.value[0] - (e.min || 0)) / ((e.max || 100) - (e.min || 0)) * 100}%` : `${100 - f()}%`
|
|
100
106
|
}
|
|
101
107
|
}
|
|
102
108
|
)
|
|
103
|
-
] }) : /* @__PURE__ */ l(
|
|
109
|
+
] }) : /* @__PURE__ */ l(M, { className: "bg-d-primary absolute h-full" })
|
|
104
110
|
] }),
|
|
105
111
|
/* @__PURE__ */ l(
|
|
106
112
|
b,
|
|
107
113
|
{
|
|
108
114
|
className: c(N({ size: m }), "relative"),
|
|
109
|
-
children:
|
|
115
|
+
children: s && e.value && /* @__PURE__ */ l(
|
|
110
116
|
x,
|
|
111
117
|
{
|
|
112
118
|
variant: "default",
|
|
113
119
|
className: "absolute -top-5 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2",
|
|
114
|
-
children:
|
|
120
|
+
children: t ? t(e.value[0]) : `${e.value[0]}${h}`
|
|
115
121
|
}
|
|
116
122
|
)
|
|
117
123
|
}
|
|
@@ -120,12 +126,12 @@ const S = w(
|
|
|
120
126
|
b,
|
|
121
127
|
{
|
|
122
128
|
className: c(N({ size: m }), "relative"),
|
|
123
|
-
children:
|
|
129
|
+
children: s && /* @__PURE__ */ l(
|
|
124
130
|
x,
|
|
125
131
|
{
|
|
126
132
|
variant: "default",
|
|
127
133
|
className: "absolute -top-5 left-1/2 z-10 -translate-x-1/2 -translate-y-1/2",
|
|
128
|
-
children:
|
|
134
|
+
children: t ? t(e.value[1]) : `${e.value[1]}${h}`
|
|
129
135
|
}
|
|
130
136
|
)
|
|
131
137
|
}
|
|
@@ -134,8 +140,8 @@ const S = w(
|
|
|
134
140
|
}
|
|
135
141
|
),
|
|
136
142
|
$ && e.value && /* @__PURE__ */ u("div", { className: "text-d-muted-foreground flex justify-between text-xs font-medium", children: [
|
|
137
|
-
/* @__PURE__ */ l("span", { children:
|
|
138
|
-
e.value.length > 1 ? /* @__PURE__ */ l("span", { children:
|
|
143
|
+
/* @__PURE__ */ l("span", { children: t ? t(e.value[0]) : e.value[0] }),
|
|
144
|
+
e.value.length > 1 ? /* @__PURE__ */ l("span", { children: t ? t(e.value[1]) : e.value[1] }) : e.max !== void 0 ? /* @__PURE__ */ l("span", { children: t ? t(e.max) : e.max }) : null
|
|
139
145
|
] })
|
|
140
146
|
] });
|
|
141
147
|
}
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Root as a, Thumb as
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Root as a, Thumb as s } from "../../node_modules/@radix-ui/react-switch/dist/index.js";
|
|
4
|
+
import { designTokens as e } from "../../lib/design-tokens.js";
|
|
5
|
+
import { cn as r } from "../../lib/utils.js";
|
|
6
|
+
function l({
|
|
7
|
+
className: n,
|
|
7
8
|
...o
|
|
8
9
|
}) {
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ t(
|
|
10
11
|
a,
|
|
11
12
|
{
|
|
12
13
|
"data-slot": "switch",
|
|
13
|
-
className:
|
|
14
|
-
"peer data-[state=checked]:bg-d-primary data-[state=unchecked]:bg-d-foreground/20
|
|
15
|
-
|
|
14
|
+
className: r(
|
|
15
|
+
"peer data-[state=checked]:bg-d-primary data-[state=unchecked]:bg-d-foreground/20 inline-flex h-[1.25rem] w-8 shrink-0 cursor-pointer items-center justify-start rounded-full border-0 px-0.5 py-0.5 transition-colors duration-300 outline-none",
|
|
16
|
+
e.focusRing,
|
|
17
|
+
e.interaction.disabled,
|
|
18
|
+
n
|
|
16
19
|
),
|
|
17
20
|
...o,
|
|
18
|
-
children: /* @__PURE__ */
|
|
19
|
-
|
|
21
|
+
children: /* @__PURE__ */ t(
|
|
22
|
+
s,
|
|
20
23
|
{
|
|
21
24
|
"data-slot": "switch-thumb",
|
|
22
|
-
className:
|
|
25
|
+
className: r(
|
|
23
26
|
// Smooth slide: track w-8 (32px) with px-0.5 (2px) each side => inner 28px.
|
|
24
27
|
// Thumb size is 16px, so travel distance = 28 - 16 = 12px.
|
|
25
28
|
"bg-d-foreground data-[state=unchecked]:bg-d-foreground data-[state=checked]:bg-d-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform duration-200 ease-out will-change-transform data-[state=checked]:translate-x-[12px] data-[state=unchecked]:translate-x-0"
|
|
@@ -30,5 +33,5 @@ function c({
|
|
|
30
33
|
);
|
|
31
34
|
}
|
|
32
35
|
export {
|
|
33
|
-
|
|
36
|
+
l as Switch
|
|
34
37
|
};
|