asheeui 0.6.14 → 0.7.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 +1 -14
- package/dist/AsheeUIProvider.js +22 -24
- package/dist/components/accordion/Accordion.js +79 -173
- package/dist/components/accordion/accordion-config.js +12 -13
- package/dist/components/accordion/accordion-styles.js +21 -24
- package/dist/components/autocomplete/Autocomplete.js +78 -136
- package/dist/components/autocomplete/autocomplete-config.js +7 -12
- package/dist/components/button/Button.d.ts +29 -1
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +47 -108
- package/dist/components/button/button-config.js +16 -17
- package/dist/components/button/button-styles.js +10 -11
- package/dist/components/card/Card.d.ts +36 -16
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +115 -205
- package/dist/components/card/card-config.js +24 -21
- package/dist/components/card/card-styles.js +19 -22
- package/dist/components/carousel/Carousel.js +123 -248
- package/dist/components/carousel/carousel-config.js +24 -25
- package/dist/components/carousel/carousel-styles.js +14 -16
- package/dist/components/chip/Chip.js +84 -191
- package/dist/components/chip/chip-config.js +13 -14
- package/dist/components/chip/chip-styles.js +22 -26
- package/dist/components/date-picker/Calendar.d.ts +3 -3
- package/dist/components/date-picker/Calendar.d.ts.map +1 -1
- package/dist/components/date-picker/Calendar.js +141 -222
- package/dist/components/date-picker/DatePicker.d.ts +5 -5
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +122 -220
- package/dist/components/date-picker/TimeSpinner.js +58 -82
- package/dist/components/date-picker/date-picker-config.d.ts +4 -4
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -11
- package/dist/components/date-picker/date-picker-styles.js +44 -45
- package/dist/components/date-picker/date-picker.helpers.d.ts +4 -4
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.helpers.js +74 -102
- package/dist/components/drawer/Drawer.d.ts +26 -8
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -131
- package/dist/components/drawer/drawer-config.js +14 -15
- package/dist/components/drawer/drawer-styles.js +38 -42
- package/dist/components/field/FieldShell.js +49 -56
- package/dist/components/field/field-config.js +17 -18
- package/dist/components/field/field-styles.js +8 -8
- package/dist/components/image/Image.d.ts +7 -7
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +65 -132
- package/dist/components/image/image-config.js +17 -18
- package/dist/components/image/image-styles.js +14 -15
- package/dist/components/input/Input.js +65 -150
- package/dist/components/input/PasswordInput.js +30 -49
- package/dist/components/input/input-config.js +7 -7
- package/dist/components/input/input-styles.js +9 -10
- package/dist/components/keyboard/KeyboardContext.js +10 -11
- package/dist/components/keyboard/KeyboardProvider.js +100 -181
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +159 -166
- package/dist/components/keyboard/keyboard-config.js +59 -57
- package/dist/components/keyboard/keyboard-styles.js +10 -11
- package/dist/components/keyboard/use-keyboard-field.js +29 -21
- package/dist/components/link/Link.js +47 -137
- package/dist/components/link/link-config.js +14 -15
- package/dist/components/link/link-styles.js +25 -29
- package/dist/components/marquee/Marquee.js +55 -144
- package/dist/components/marquee/marquee-config.js +18 -19
- package/dist/components/marquee/marquee-styles.js +13 -15
- package/dist/components/modal/Modal.d.ts +26 -10
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +56 -136
- package/dist/components/modal/modal-config.js +15 -16
- package/dist/components/modal/modal-styles.js +13 -14
- package/dist/components/multi-select/MultiSelect.d.ts +18 -2
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +149 -283
- package/dist/components/multi-select/multi-select-config.d.ts +23 -18
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +18 -21
- package/dist/components/multi-select/multi-select-styles.js +17 -20
- package/dist/components/radio/Radio.js +43 -80
- package/dist/components/radio/RadioGroup.js +57 -155
- package/dist/components/radio/radio-config.js +15 -16
- package/dist/components/radio/radio-context.js +6 -6
- package/dist/components/radio/radio-styles.js +55 -60
- package/dist/components/resizable-screen/ResizableScreen.js +87 -177
- package/dist/components/resizable-screen/resizable-screen-config.js +16 -17
- package/dist/components/select/Select.d.ts +3 -2
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +97 -195
- package/dist/components/select/select-config.js +8 -9
- package/dist/components/select/select-styles.js +5 -5
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +102 -196
- package/dist/components/select-menu/select-menu-config.js +12 -12
- package/dist/components/select-menu/use-select-floating.d.ts +11 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -1
- package/dist/components/select-menu/use-select-floating.js +41 -48
- package/dist/components/sidebar/Sidebar.d.ts +43 -22
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +146 -331
- package/dist/components/sidebar/sidebar-config.d.ts +98 -31
- package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar-config.js +47 -33
- package/dist/components/sidebar/sidebar-styles.js +27 -32
- package/dist/components/spinner/spinner-config.js +12 -13
- package/dist/components/spinner/spinner-styles.js +13 -14
- package/dist/components/spinner/spinner.js +39 -82
- package/dist/components/switch/Switch.js +62 -154
- package/dist/components/switch/switch-config.js +11 -12
- package/dist/components/switch/switch-styles.js +14 -16
- package/dist/components/table/Table.js +64 -186
- package/dist/components/table/table-config.js +17 -18
- package/dist/components/table/table-styles.js +48 -52
- package/dist/components/tabs/Tabs.d.ts +16 -8
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +93 -208
- package/dist/components/tabs/tabs-config.d.ts +42 -20
- package/dist/components/tabs/tabs-config.d.ts.map +1 -1
- package/dist/components/tabs/tabs-config.js +26 -18
- package/dist/components/tabs/tabs-styles.js +15 -17
- package/dist/components/textarea/Textarea.js +52 -138
- package/dist/components/textarea/textarea-config.js +10 -11
- package/dist/components/textarea/textarea-styles.js +9 -10
- package/dist/components/toast/ToastContext.js +22 -26
- package/dist/components/toast/ToastItem.js +82 -144
- package/dist/components/toast/ToastProvider.d.ts.map +1 -1
- package/dist/components/toast/ToastProvider.js +128 -190
- package/dist/components/toast/toast-config.js +23 -24
- package/dist/components/toast/toast-styles.js +50 -55
- package/dist/components/toast/use-pausable-timeout.js +17 -13
- package/dist/components/tooltip/Tooltip.d.ts +5 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +68 -158
- package/dist/components/tooltip/tooltip-config.d.ts +25 -0
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +26 -22
- package/dist/components/tooltip/tooltip-styles.js +15 -17
- package/dist/config/default-config.js +11 -34
- package/dist/config/resolve-color.js +23 -23
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/config/resolve-config.js +14 -12
- package/dist/icons/ArrowLeftIcon.js +16 -19
- package/dist/icons/CalendarIcon.js +43 -24
- package/dist/icons/CheckIcon.js +16 -19
- package/dist/icons/ChevronDownIcon.js +15 -21
- package/dist/icons/ChevronLeftIcon.js +16 -19
- package/dist/icons/ChevronRightIcon.js +16 -19
- package/dist/icons/ChevronUpIcon.js +16 -19
- package/dist/icons/ClearIcon.js +26 -22
- package/dist/icons/ClockIcon.js +20 -22
- package/dist/icons/CloseIcon.js +26 -22
- package/dist/icons/ErrorIcon.js +16 -19
- package/dist/icons/ExternalLinkIcon.js +25 -23
- package/dist/icons/EyeIcon.js +20 -22
- package/dist/icons/EyeOffIcon.js +21 -22
- package/dist/icons/InfoIcon.js +16 -19
- package/dist/icons/SearchIcon.js +25 -22
- package/dist/icons/WarningIcon.js +16 -19
- package/dist/index.js +65 -163
- package/dist/libs/context.js +10 -13
- package/dist/libs/index.js +1 -0
- package/dist/libs/registry.js +10 -12
- package/dist/libs/use-floating-z-index.d.ts +32 -0
- package/dist/libs/use-floating-z-index.d.ts.map +1 -0
- package/dist/libs/use-floating-z-index.js +16 -0
- package/dist/libs/use-isomorphic-layout-effect.js +5 -5
- package/dist/scripts/AsheeThemeScript.js +35 -44
- package/dist/shared/radius.d.ts.map +1 -1
- package/dist/shared/radius.js +12 -13
- package/dist/shared/variant.js +46 -134
- package/dist/theme/color.js +28 -28
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +65 -178
- package/dist/theme/useTheme.js +13 -44
- package/dist/utils/cn.js +7 -7
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/merge-object.js +13 -14
- package/dist/utils/resolve-token.js +11 -14
- package/dist/utils/stacking.d.ts +76 -0
- package/dist/utils/stacking.d.ts.map +1 -0
- package/dist/utils/stacking.js +34 -0
- package/package.json +12 -11
|
@@ -1,209 +1,94 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import { useAsheeConfig as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
for (e.preventDefault(), a = (m + 1) % i.length; (p = i[a]) != null && p.disabled; )
|
|
96
|
-
a = (a + 1) % i.length;
|
|
97
|
-
else if (e.key === "ArrowLeft")
|
|
98
|
-
for (e.preventDefault(), a = (m - 1 + i.length) % i.length; (h = i[a]) != null && h.disabled; )
|
|
99
|
-
a = (a - 1 + i.length) % i.length;
|
|
100
|
-
else if (e.key === "Home")
|
|
101
|
-
e.preventDefault(), a = i.findIndex((l) => !l.disabled);
|
|
102
|
-
else if (e.key === "End") {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
for (let l = i.length - 1; l >= 0; l--)
|
|
105
|
-
if (!((A = i[l]) != null && A.disabled)) {
|
|
106
|
-
a = l;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (a !== -1 && i[a]) {
|
|
111
|
-
const l = i[a];
|
|
112
|
-
k(l.id), (b = S.current.get(l.id)) == null || b.focus();
|
|
113
|
-
}
|
|
114
|
-
}, d = N(
|
|
115
|
-
() => i.find((e) => e.id === w) ?? i[0],
|
|
116
|
-
[i, w]
|
|
117
|
-
), le = N(() => {
|
|
118
|
-
switch (v) {
|
|
119
|
-
case "bordered":
|
|
120
|
-
return "border border-border p-1 bg-background";
|
|
121
|
-
case "ghost":
|
|
122
|
-
return "bg-transparent gap-1";
|
|
123
|
-
default:
|
|
124
|
-
return "border-b border-border gap-2";
|
|
125
|
-
}
|
|
126
|
-
}, [v]);
|
|
127
|
-
return /* @__PURE__ */ K(
|
|
128
|
-
"div",
|
|
129
|
-
{
|
|
130
|
-
ref: U,
|
|
131
|
-
className: g("w-full h-full flex flex-col gap-4", M),
|
|
132
|
-
style: O,
|
|
133
|
-
...X,
|
|
134
|
-
children: [
|
|
135
|
-
/* @__PURE__ */ o(
|
|
136
|
-
"div",
|
|
137
|
-
{
|
|
138
|
-
role: "tablist",
|
|
139
|
-
"aria-orientation": "horizontal",
|
|
140
|
-
className: g(
|
|
141
|
-
"flex flex-row w-full items-center overflow-x-auto scrollable-hidden shrink-0",
|
|
142
|
-
le,
|
|
143
|
-
v !== "underline" && ie,
|
|
144
|
-
F
|
|
145
|
-
),
|
|
146
|
-
children: i.map((e, m) => {
|
|
147
|
-
const n = e.id === w, a = e.label ?? e.name, p = `${u}-tab-${e.id}`, h = `${u}-panel-${e.id}`, A = e.activeVariant ?? P, b = e.activeColor ?? Q;
|
|
148
|
-
return /* @__PURE__ */ K(
|
|
149
|
-
ce,
|
|
150
|
-
{
|
|
151
|
-
ref: (l) => {
|
|
152
|
-
l ? S.current.set(e.id, l) : S.current.delete(e.id);
|
|
153
|
-
},
|
|
154
|
-
id: p,
|
|
155
|
-
type: "button",
|
|
156
|
-
role: "tab",
|
|
157
|
-
"aria-selected": n,
|
|
158
|
-
"aria-controls": h,
|
|
159
|
-
"aria-disabled": e.disabled,
|
|
160
|
-
tabIndex: n ? 0 : -1,
|
|
161
|
-
radius: n ? W : R,
|
|
162
|
-
isDisabled: e.disabled,
|
|
163
|
-
size: f,
|
|
164
|
-
variant: n ? v === "underline" ? "underlined" : A : "ghost",
|
|
165
|
-
color: n ? b : "none",
|
|
166
|
-
onClick: () => k(e.id),
|
|
167
|
-
onKeyDown: (l) => re(l, m),
|
|
168
|
-
className: g(
|
|
169
|
-
"relative flex items-center justify-center gap-2 font-medium transition-all duration-200 select-none outline-none active:scale-[0.98]",
|
|
170
|
-
Y,
|
|
171
|
-
Z,
|
|
172
|
-
ee,
|
|
173
|
-
j && "flex-1",
|
|
174
|
-
G
|
|
175
|
-
),
|
|
176
|
-
children: [
|
|
177
|
-
e.icon && /* @__PURE__ */ o("span", { className: "shrink-0", children: e.icon }),
|
|
178
|
-
/* @__PURE__ */ o("span", { children: a }),
|
|
179
|
-
e.badge !== void 0 && /* @__PURE__ */ o("span", { className: "shrink-0 text-xs px-1.5 py-0.5 rounded-full bg-secondary text-foreground/70 font-normal", children: e.badge })
|
|
180
|
-
]
|
|
181
|
-
},
|
|
182
|
-
String(e.id)
|
|
183
|
-
);
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
),
|
|
187
|
-
d && /* @__PURE__ */ o(
|
|
188
|
-
"div",
|
|
189
|
-
{
|
|
190
|
-
id: `${u}-panel-${d.id}`,
|
|
191
|
-
role: "tabpanel",
|
|
192
|
-
"aria-labelledby": `${u}-tab-${d.id}`,
|
|
193
|
-
className: g(
|
|
194
|
-
"w-full h-full flex-1 outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 rounded-md transition-all duration-200 animate-in fade-in-50",
|
|
195
|
-
E
|
|
196
|
-
),
|
|
197
|
-
children: d.content
|
|
198
|
-
},
|
|
199
|
-
String(d.id)
|
|
200
|
-
)
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
pe.displayName = "Tabs";
|
|
207
|
-
export {
|
|
208
|
-
pe as Tabs
|
|
209
|
-
};
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
|
+
import { RADIUS_CLASS as n } from "../../shared/radius.js";
|
|
6
|
+
import { resolveCascade as r, resolveClassKey as i, resolveRadiusKey as a } from "../../utils/resolve-token.js";
|
|
7
|
+
import { Button as o } from "../button/Button.js";
|
|
8
|
+
import { FALLBACK_TABS_CONFIG as s } from "./tabs-config.js";
|
|
9
|
+
import { TABS_FONT_CLASS as c, TABS_HEIGHT_CLASS as l, TABS_PADDING_X_CLASS as u } from "./tabs-styles.js";
|
|
10
|
+
import { forwardRef as d, useCallback as f, useId as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
11
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
12
|
+
//#region src/components/tabs/Tabs.tsx
|
|
13
|
+
var y = d(({ tabs: d = [], activeId: y, defaultActiveId: b, onChange: x, variant: S, size: C, radius: w, options: T, fullWidth: ee = !1, tabListClassName: te, tabPanelClassName: E, className: D, style: O, ...k }, A) => {
|
|
14
|
+
let j = t(), M = j.components?.tabs, N = p(), P = h(/* @__PURE__ */ new Map()), [F, I] = g(() => b ?? d[0]?.id), L = y !== void 0, R = L ? y : F, z = r(C, M?.size, void 0, s.size), B = r(S, M?.variant, void 0, s.variant), V = r(T?.active?.variant, M?.options?.active?.variant, j.defaultVariant, s.options.active.variant), H = r(T?.active?.color, M?.options?.active?.color, j.defaultColor, s.options.active.color), U = r(T?.inactive?.variant, M?.options?.inactive?.variant, void 0, s.options.inactive.variant), W = r(T?.inactive?.color, M?.options?.inactive?.color, void 0, s.options.inactive.color), G = a(w, M?.radius, j.defaultRadius, s.radius), K = a(T?.active?.radius, M?.options?.active?.radius, j.defaultRadius, s.options.active.radius), q = a(T?.inactive?.radius, M?.options?.inactive?.radius, G, s.options.inactive.radius), J = i(z, l, s.size), Y = i(z, u, s.size), X = i(z, c, s.size), Z = i(G, n, s.radius), Q = f((e) => {
|
|
15
|
+
L || I(e), x?.(e);
|
|
16
|
+
}, [L, x]), ne = (e, t) => {
|
|
17
|
+
if (d.filter((e) => !e.disabled).length === 0) return;
|
|
18
|
+
let n = -1;
|
|
19
|
+
if (e.key === "ArrowRight") for (e.preventDefault(), n = (t + 1) % d.length; d[n]?.disabled;) n = (n + 1) % d.length;
|
|
20
|
+
else if (e.key === "ArrowLeft") for (e.preventDefault(), n = (t - 1 + d.length) % d.length; d[n]?.disabled;) n = (n - 1 + d.length) % d.length;
|
|
21
|
+
else if (e.key === "Home") e.preventDefault(), n = d.findIndex((e) => !e.disabled);
|
|
22
|
+
else if (e.key === "End") {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
for (let e = d.length - 1; e >= 0; e--) if (!d[e]?.disabled) {
|
|
25
|
+
n = e;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (n !== -1 && d[n]) {
|
|
30
|
+
let e = d[n];
|
|
31
|
+
Q(e.id), P.current.get(e.id)?.focus();
|
|
32
|
+
}
|
|
33
|
+
}, $ = m(() => d.find((e) => e.id === R) ?? d[0], [d, R]), re = m(() => {
|
|
34
|
+
switch (B) {
|
|
35
|
+
case "bordered": return "border border-border p-1 bg-background";
|
|
36
|
+
case "ghost": return "bg-transparent gap-1";
|
|
37
|
+
default: return "border-b border-border gap-2";
|
|
38
|
+
}
|
|
39
|
+
}, [B]);
|
|
40
|
+
return /* @__PURE__ */ v("div", {
|
|
41
|
+
ref: A,
|
|
42
|
+
className: e("w-full h-full flex flex-col gap-4", D),
|
|
43
|
+
style: O,
|
|
44
|
+
...k,
|
|
45
|
+
children: [/* @__PURE__ */ _("div", {
|
|
46
|
+
role: "tablist",
|
|
47
|
+
"aria-orientation": "horizontal",
|
|
48
|
+
className: e("flex flex-row w-full items-center overflow-x-auto scrollable-hidden shrink-0", re, B !== "underline" && Z, te),
|
|
49
|
+
children: d.map((t, n) => {
|
|
50
|
+
let r = t.id === R, i = t.label ?? t.name, a = `${N}-tab-${t.id}`, s = `${N}-panel-${t.id}`, c = t.activeVariant ?? V, l = t.activeColor ?? H;
|
|
51
|
+
return /* @__PURE__ */ v(o, {
|
|
52
|
+
ref: (e) => {
|
|
53
|
+
e ? P.current.set(t.id, e) : P.current.delete(t.id);
|
|
54
|
+
},
|
|
55
|
+
id: a,
|
|
56
|
+
type: "button",
|
|
57
|
+
role: "tab",
|
|
58
|
+
"aria-selected": r,
|
|
59
|
+
"aria-controls": s,
|
|
60
|
+
"aria-disabled": t.disabled,
|
|
61
|
+
tabIndex: r ? 0 : -1,
|
|
62
|
+
radius: r ? K : q,
|
|
63
|
+
isDisabled: t.disabled,
|
|
64
|
+
size: z,
|
|
65
|
+
variant: r ? B === "underline" ? "underlined" : c : U,
|
|
66
|
+
color: r ? l : W,
|
|
67
|
+
onClick: () => Q(t.id),
|
|
68
|
+
onKeyDown: (e) => ne(e, n),
|
|
69
|
+
className: e("relative flex items-center justify-center gap-2 font-medium transition-all duration-200 select-none outline-none active:scale-[0.98]", J, Y, X, ee && "flex-1", T?.tabClassName),
|
|
70
|
+
children: [
|
|
71
|
+
t.icon && /* @__PURE__ */ _("span", {
|
|
72
|
+
className: "shrink-0",
|
|
73
|
+
children: t.icon
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ _("span", { children: i }),
|
|
76
|
+
t.badge !== void 0 && /* @__PURE__ */ _("span", {
|
|
77
|
+
className: "shrink-0 text-xs px-1.5 py-0.5 rounded-full bg-secondary text-foreground/70 font-normal",
|
|
78
|
+
children: t.badge
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}, String(t.id));
|
|
82
|
+
})
|
|
83
|
+
}), $ && /* @__PURE__ */ _("div", {
|
|
84
|
+
id: `${N}-panel-${$.id}`,
|
|
85
|
+
role: "tabpanel",
|
|
86
|
+
"aria-labelledby": `${N}-tab-${$.id}`,
|
|
87
|
+
className: e("w-full h-full flex-1 outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 rounded-md transition-all duration-200 animate-in fade-in-50", E),
|
|
88
|
+
children: $.content
|
|
89
|
+
}, String($.id))]
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
y.displayName = "Tabs";
|
|
93
|
+
//#endregion
|
|
94
|
+
export { y as Tabs };
|
|
@@ -63,6 +63,29 @@ export interface TabItem {
|
|
|
63
63
|
*/
|
|
64
64
|
[key: string]: unknown;
|
|
65
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Visual styling of the active tab.
|
|
68
|
+
*/
|
|
69
|
+
export interface TabsActiveOptionConfig {
|
|
70
|
+
radius?: Radius;
|
|
71
|
+
variant?: Variant;
|
|
72
|
+
color?: Color;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Visual styling of inactive tabs.
|
|
76
|
+
*/
|
|
77
|
+
export interface TabsInactiveOptionConfig {
|
|
78
|
+
radius?: Radius;
|
|
79
|
+
variant?: Variant;
|
|
80
|
+
color?: Color;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Options configuration for the tab items.
|
|
84
|
+
*/
|
|
85
|
+
export interface TabsOptionsConfig {
|
|
86
|
+
active?: TabsActiveOptionConfig;
|
|
87
|
+
inactive?: TabsInactiveOptionConfig;
|
|
88
|
+
}
|
|
66
89
|
/**
|
|
67
90
|
* Theme configuration options for the Tabs component.
|
|
68
91
|
*
|
|
@@ -92,26 +115,9 @@ export interface TabsConfig {
|
|
|
92
115
|
*/
|
|
93
116
|
radius?: Radius;
|
|
94
117
|
/**
|
|
95
|
-
*
|
|
96
|
-
* Controls the border-radius of the selected tab trigger.
|
|
97
|
-
*
|
|
98
|
-
* @default "md"
|
|
99
|
-
*/
|
|
100
|
-
activeRadius?: Radius;
|
|
101
|
-
/**
|
|
102
|
-
* Visual variant for the active tab button.
|
|
103
|
-
* Controls the style of the selected tab trigger.
|
|
104
|
-
*
|
|
105
|
-
* @default "solid"
|
|
118
|
+
* Options configuration for the tab items.
|
|
106
119
|
*/
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Theme color for the active tab button.
|
|
110
|
-
* Controls the color of the selected tab trigger.
|
|
111
|
-
*
|
|
112
|
-
* @default "primary"
|
|
113
|
-
*/
|
|
114
|
-
activeColor?: Color;
|
|
120
|
+
options?: TabsOptionsConfig;
|
|
115
121
|
}
|
|
116
122
|
/**
|
|
117
123
|
* Default config values registered for the Tabs component.
|
|
@@ -122,7 +128,23 @@ export declare const defaultTabsConfig: TabsConfig;
|
|
|
122
128
|
* These values are used when instance props, component config,
|
|
123
129
|
* and global defaults are all undefined.
|
|
124
130
|
*/
|
|
125
|
-
export declare const FALLBACK_TABS_CONFIG:
|
|
131
|
+
export declare const FALLBACK_TABS_CONFIG: {
|
|
132
|
+
readonly size: "md";
|
|
133
|
+
readonly variant: "underline";
|
|
134
|
+
readonly radius: "md";
|
|
135
|
+
readonly options: {
|
|
136
|
+
readonly active: {
|
|
137
|
+
readonly radius: "md";
|
|
138
|
+
readonly variant: "solid";
|
|
139
|
+
readonly color: "primary";
|
|
140
|
+
};
|
|
141
|
+
readonly inactive: {
|
|
142
|
+
readonly radius: "md";
|
|
143
|
+
readonly variant: "ghost";
|
|
144
|
+
readonly color: "none";
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
126
148
|
declare module "../../libs/registry" {
|
|
127
149
|
interface ComponentTypeConfigRegistry {
|
|
128
150
|
tabs: TabsConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-config.d.ts","sourceRoot":"","sources":["../../../src/components/tabs/tabs-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;;;GAKG;A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
|
|
1
1
|
"use client";
|
|
2
|
-
import { registerComponentDefaults as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
+
//#region src/components/tabs/tabs-config.ts
|
|
4
|
+
var t = {
|
|
5
|
+
size: "md",
|
|
6
|
+
variant: "underline",
|
|
7
|
+
radius: "md",
|
|
8
|
+
options: { active: { radius: "md" } }
|
|
9
|
+
}, n = {
|
|
10
|
+
size: "md",
|
|
11
|
+
variant: "underline",
|
|
12
|
+
radius: "md",
|
|
13
|
+
options: {
|
|
14
|
+
active: {
|
|
15
|
+
radius: "md",
|
|
16
|
+
variant: "solid",
|
|
17
|
+
color: "primary"
|
|
18
|
+
},
|
|
19
|
+
inactive: {
|
|
20
|
+
radius: "md",
|
|
21
|
+
variant: "ghost",
|
|
22
|
+
color: "none"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
20
25
|
};
|
|
26
|
+
e("tabs", t);
|
|
27
|
+
//#endregion
|
|
28
|
+
export { n as FALLBACK_TABS_CONFIG, t as defaultTabsConfig };
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
S as TABS_FONT_CLASS,
|
|
17
|
-
t as TABS_HEIGHT_CLASS,
|
|
18
|
-
s as TABS_PADDING_X_CLASS
|
|
2
|
+
//#region src/components/tabs/tabs-styles.ts
|
|
3
|
+
var e = {
|
|
4
|
+
sm: "h-8",
|
|
5
|
+
md: "h-10",
|
|
6
|
+
lg: "h-12"
|
|
7
|
+
}, t = {
|
|
8
|
+
sm: "px-2.5",
|
|
9
|
+
md: "px-3.5",
|
|
10
|
+
lg: "px-4"
|
|
11
|
+
}, n = {
|
|
12
|
+
sm: "text-xs",
|
|
13
|
+
md: "text-sm",
|
|
14
|
+
lg: "text-base"
|
|
19
15
|
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as TABS_FONT_CLASS, e as TABS_HEIGHT_CLASS, t as TABS_PADDING_X_CLASS };
|