@adamosuiteservices/ui 2.18.5 → 2.19.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 -1
- package/dist/accordion-rounded.cjs +8 -8
- package/dist/accordion-rounded.js +12 -12
- package/dist/alert.cjs +32 -23
- package/dist/alert.js +53 -43
- package/dist/amount-input.cjs +8 -0
- package/dist/amount-input.js +191 -0
- package/dist/avatar.cjs +7 -7
- package/dist/avatar.js +18 -18
- package/dist/badge.cjs +24 -28
- package/dist/badge.js +45 -42
- package/dist/breadcrumb.cjs +2 -3
- package/dist/breadcrumb.js +16 -17
- package/dist/button-CXFZVTXF.cjs +87 -0
- package/dist/button-dT8nqgU3.js +156 -0
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-xBaFu2sB.js → calendar-6NvJv-sP.js} +238 -239
- package/dist/{calendar-Dorq3-wv.cjs → calendar-B8S5a0TG.cjs} +20 -22
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.cjs +3 -3
- package/dist/card.js +4 -4
- package/dist/checkbox-BBlvCoB1.cjs +24 -0
- package/dist/{checkbox-DL_jFvgl.js → checkbox-BuzBXARX.js} +54 -52
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/colors.css +1 -1
- package/dist/combobox-B002BLsg.js +692 -0
- package/dist/combobox-B2BkUl7v.cjs +57 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/components/layout/sidebar/sidebar.d.ts +2 -1
- package/dist/components/layout/toaster/toaster.d.ts +1 -1
- package/dist/components/ui/alert/alert.d.ts +1 -1
- package/dist/components/ui/amount-input/amount-input.d.ts +32 -0
- package/dist/components/ui/amount-input/index.d.ts +1 -0
- package/dist/components/ui/badge/badge.d.ts +3 -2
- package/dist/components/ui/calendar/calendar.d.ts +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +3 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +3 -1
- package/dist/components/ui/selectable-card/index.d.ts +1 -0
- package/dist/components/ui/selectable-card/selectable-card.d.ts +22 -0
- package/dist/components/ui/timeline/index.d.ts +1 -0
- package/dist/components/ui/timeline/timeline.d.ts +30 -0
- package/dist/components/ui/typography/typography.d.ts +1 -1
- package/dist/context-menu.cjs +18 -19
- package/dist/context-menu.js +36 -37
- package/dist/date-picker-selector.cjs +1 -1
- package/dist/date-picker-selector.js +3 -3
- package/dist/dialog.cjs +7 -9
- package/dist/dialog.js +36 -38
- package/dist/dropdown-menu.cjs +57 -36
- package/dist/dropdown-menu.js +205 -172
- package/dist/field.cjs +12 -7
- package/dist/field.js +51 -45
- package/dist/file-upload-v2.cjs +11 -5
- package/dist/file-upload-v2.js +75 -60
- package/dist/file-upload.cjs +11 -5
- package/dist/file-upload.js +117 -109
- package/dist/index-BBT2EGq8.js +18 -0
- package/dist/index-DCsgSkBj.cjs +1 -0
- package/dist/input-8sEO5zwD.js +44 -0
- package/dist/input-AONeSXcs.cjs +22 -0
- package/dist/input-group-13VFVAxD.cjs +86 -0
- package/dist/input-group-D4S18xiq.js +240 -0
- package/dist/input-group.cjs +1 -84
- package/dist/input-group.js +7 -234
- package/dist/input-otp.cjs +5 -7
- package/dist/input-otp.js +58 -60
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/kbd.cjs +6 -7
- package/dist/kbd.js +14 -15
- package/dist/{label-DqfX9cHc.cjs → label-B7Z1D5-Q.cjs} +5 -4
- package/dist/{label-C6zVnc3d.js → label-_BWRIH7C.js} +14 -13
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/pagination.cjs +5 -5
- package/dist/pagination.js +18 -18
- package/dist/radio-group.cjs +12 -9
- package/dist/radio-group.js +65 -62
- package/dist/select.cjs +18 -16
- package/dist/select.js +17 -15
- package/dist/selectable-card.cjs +29 -0
- package/dist/selectable-card.js +129 -0
- package/dist/separator-DXdc7LcC.cjs +7 -0
- package/dist/{separator-CsaqP20m.js → separator-DZfXXbNt.js} +1 -1
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +1 -1
- package/dist/{sheet-C9vce0ut.js → sheet-DNwg4a6M.js} +8 -5
- package/dist/{sheet-Cnq7TCzu.cjs → sheet-va7o2x0w.cjs} +10 -10
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.cjs +10 -10
- package/dist/sidebar.js +83 -92
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/switch.cjs +2 -4
- package/dist/switch.js +71 -73
- package/dist/table.cjs +14 -14
- package/dist/table.js +12 -12
- package/dist/tabs-underline.cjs +11 -15
- package/dist/tabs-underline.js +20 -24
- package/dist/tabs.cjs +10 -14
- package/dist/tabs.js +20 -24
- package/dist/tailwind-colors.css +1 -1
- package/dist/tailwind-theme.css +1 -1
- package/dist/textarea-BSooGyp-.cjs +18 -0
- package/dist/textarea-D_sj6ivo.js +39 -0
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/themes.css +1 -1
- package/dist/timeline.cjs +4 -0
- package/dist/timeline.js +189 -0
- package/dist/toaster.cjs +5 -4
- package/dist/toaster.js +33 -32
- package/dist/toggle.cjs +4 -4
- package/dist/toggle.js +17 -17
- package/dist/tooltip.cjs +5 -6
- package/dist/tooltip.js +4 -5
- package/docs/components/layout/sidebar.md +81 -53
- package/docs/components/layout/toaster.md +35 -55
- package/docs/components/ui/accordion-rounded.md +12 -11
- package/docs/components/ui/alert.md +66 -36
- package/docs/components/ui/amount-input.md +229 -0
- package/docs/components/ui/avatar.md +28 -32
- package/docs/components/ui/badge.md +85 -32
- package/docs/components/ui/breadcrumb.md +5 -7
- package/docs/components/ui/button-group.md +16 -16
- package/docs/components/ui/button.md +23 -36
- package/docs/components/ui/calendar.md +54 -27
- package/docs/components/ui/card.md +5 -4
- package/docs/components/ui/checkbox.md +3 -3
- package/docs/components/ui/combobox.md +35 -1
- package/docs/components/ui/command.md +7 -7
- package/docs/components/ui/context-menu.md +14 -15
- package/docs/components/ui/date-picker-selector.md +31 -31
- package/docs/components/ui/dialog.md +47 -49
- package/docs/components/ui/dropdown-menu.md +34 -37
- package/docs/components/ui/field.md +25 -31
- package/docs/components/ui/file-upload-v2.md +11 -0
- package/docs/components/ui/file-upload.md +105 -108
- package/docs/components/ui/hover-card.md +28 -6
- package/docs/components/ui/icon.md +10 -9
- package/docs/components/ui/input-group.md +9 -9
- package/docs/components/ui/input.md +30 -33
- package/docs/components/ui/kbd.md +10 -9
- package/docs/components/ui/label.md +6 -6
- package/docs/components/ui/pagination.md +3 -3
- package/docs/components/ui/popover.md +1 -0
- package/docs/components/ui/progress.md +3 -3
- package/docs/components/ui/radio-group.md +18 -6
- package/docs/components/ui/scroll-area.md +4 -4
- package/docs/components/ui/select.md +14 -12
- package/docs/components/ui/selectable-card.md +204 -0
- package/docs/components/ui/separator.md +4 -4
- package/docs/components/ui/sheet.md +21 -3
- package/docs/components/ui/slider.md +3 -3
- package/docs/components/ui/switch.md +7 -7
- package/docs/components/ui/table.md +7 -4
- package/docs/components/ui/tabs-underline.md +36 -36
- package/docs/components/ui/tabs.md +6 -4
- package/docs/components/ui/textarea.md +6 -4
- package/docs/components/ui/timeline.md +214 -0
- package/docs/components/ui/toggle.md +1 -1
- package/docs/components/ui/tooltip.md +3 -3
- package/llm.txt +7 -4
- package/package.json +13 -1
- package/dist/button-BnUlAtuD.js +0 -132
- package/dist/button-CFJs0esR.cjs +0 -63
- package/dist/checkbox-3RIZX2HF.cjs +0 -22
- package/dist/combobox-MkeJiTXj.js +0 -637
- package/dist/combobox-jJRxvUsB.cjs +0 -40
- package/dist/input-BCiOr4Fy.js +0 -44
- package/dist/input-Bz5k4w94.cjs +0 -22
- package/dist/separator-CCGaTo09.cjs +0 -7
- package/dist/textarea-BRCnIxdB.js +0 -33
- package/dist/textarea-DkFUS_oS.cjs +0 -14
package/dist/toaster.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { j as
|
|
2
|
+
import { j as i } from "./jsx-runtime-BzflLqGi.js";
|
|
3
3
|
import { P as l } from "./index-CZWDxvEo.js";
|
|
4
4
|
import { c as f } from "./index-CRiPKpXj.js";
|
|
5
5
|
import { c as b } from "./index-BqtVL8d-.js";
|
|
@@ -17,74 +17,75 @@ class g {
|
|
|
17
17
|
}
|
|
18
18
|
const c = new g(), x = b(
|
|
19
19
|
`
|
|
20
|
-
adm:fixed adm:right-0 adm:bottom-0 adm:left-0 adm:z-50 adm:flex adm:
|
|
21
|
-
adm:justify-center adm:p-4
|
|
20
|
+
adm:fixed adm:right-0 adm:bottom-0 adm:left-0 adm:z-50 adm:flex adm:h-13
|
|
21
|
+
adm:w-full adm:items-center adm:justify-center adm:p-4 adm:text-center
|
|
22
|
+
adm:text-sm
|
|
22
23
|
`,
|
|
23
24
|
{
|
|
24
25
|
variants: {
|
|
25
26
|
variant: {
|
|
26
|
-
|
|
27
|
-
success: "adm:bg-success-50 adm:text-success",
|
|
28
|
-
warning: "adm:bg-warning-50 adm:text-warning",
|
|
29
|
-
destructive: "adm:bg-destructive-50 adm:text-destructive"
|
|
27
|
+
info: "adm:bg-accent adm:text-foreground",
|
|
28
|
+
success: "adm:bg-success-50 adm:text-success-foreground-subtle",
|
|
29
|
+
warning: "adm:bg-warning-50 adm:text-warning-foreground-subtle",
|
|
30
|
+
destructive: "adm:bg-destructive-50 adm:text-destructive-foreground-subtle"
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
defaultVariants: {
|
|
33
|
-
variant: "
|
|
34
|
+
variant: "info"
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
|
-
),
|
|
37
|
+
), h = 3e3;
|
|
37
38
|
function _() {
|
|
38
|
-
const [
|
|
39
|
+
const [e, t] = m(null), [s, a] = m(!1);
|
|
39
40
|
u(() => {
|
|
40
41
|
const r = c.subscribe((o) => {
|
|
41
|
-
t(o),
|
|
42
|
+
t(o), a(!1);
|
|
42
43
|
});
|
|
43
44
|
return () => {
|
|
44
45
|
r();
|
|
45
46
|
};
|
|
46
47
|
}, []);
|
|
47
|
-
const
|
|
48
|
-
r.animationName === "toast-slide-down" && (t(null),
|
|
48
|
+
const n = (r) => {
|
|
49
|
+
r.animationName === "toast-slide-down" && (t(null), a(!1));
|
|
49
50
|
};
|
|
50
|
-
return
|
|
51
|
-
|
|
51
|
+
return e ? /* @__PURE__ */ i.jsx(l, { children: /* @__PURE__ */ i.jsx(
|
|
52
|
+
T,
|
|
52
53
|
{
|
|
53
54
|
closing: s,
|
|
54
|
-
onClosing: () =>
|
|
55
|
-
animationEnded:
|
|
56
|
-
...
|
|
55
|
+
onClosing: () => a(!0),
|
|
56
|
+
animationEnded: n,
|
|
57
|
+
...e
|
|
57
58
|
}
|
|
58
|
-
) },
|
|
59
|
+
) }, e.id) : null;
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
variant:
|
|
61
|
+
function T({
|
|
62
|
+
variant: e,
|
|
62
63
|
message: t,
|
|
63
64
|
autoClose: s,
|
|
64
|
-
onClose:
|
|
65
|
-
closing:
|
|
65
|
+
onClose: a,
|
|
66
|
+
closing: n,
|
|
66
67
|
onClosing: r,
|
|
67
68
|
animationEnded: o
|
|
68
69
|
}) {
|
|
69
70
|
return u(() => {
|
|
70
71
|
let d;
|
|
71
72
|
return d = setTimeout(() => {
|
|
72
|
-
r(),
|
|
73
|
-
}, s ||
|
|
73
|
+
r(), a && a();
|
|
74
|
+
}, s || h), () => {
|
|
74
75
|
clearTimeout(d);
|
|
75
76
|
};
|
|
76
|
-
}, []), /* @__PURE__ */
|
|
77
|
+
}, []), /* @__PURE__ */ i.jsx(
|
|
77
78
|
"div",
|
|
78
79
|
{
|
|
79
80
|
onAnimationEnd: o,
|
|
80
81
|
className: f(
|
|
81
|
-
x({ variant:
|
|
82
|
+
x({ variant: e }),
|
|
82
83
|
{
|
|
83
|
-
"adm:animate-toast-slide-up": !
|
|
84
|
-
"adm:animate-toast-slide-down":
|
|
84
|
+
"adm:animate-toast-slide-up": !n,
|
|
85
|
+
"adm:animate-toast-slide-down": n
|
|
85
86
|
}
|
|
86
87
|
),
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ i.jsx("p", { children: t })
|
|
88
89
|
}
|
|
89
90
|
);
|
|
90
91
|
}
|
|
@@ -96,8 +97,8 @@ class p {
|
|
|
96
97
|
}
|
|
97
98
|
const A = new p();
|
|
98
99
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
h as TOAST_AUTO_CLOSE_DEFAULT,
|
|
101
|
+
T as Toast,
|
|
101
102
|
A as ToastManager,
|
|
102
103
|
c as ToastObservable,
|
|
103
104
|
_ as Toaster,
|
package/dist/toggle.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-BB_1_6y_.cjs"),g=require("react"),r=require("./index-BWaO7kQK.cjs"),b=require("./index-CocSS1YK.cjs"),f=require("./index-DoxiiusW.cjs"),v=require("./index-BTzZJcis.cjs");function p(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const x=p(g);var o="Toggle",i=x.forwardRef((e,t)=>{const{pressed:a,defaultPressed:n,onPressedChange:m,...c}=e,[d,u]=r.useControllableState({prop:a,onChange:m,defaultProp:n??!1,caller:o});return s.jsxRuntimeExports.jsx(b.Primitive.button,{type:"button","aria-pressed":d,"data-state":d?"on":"off","data-disabled":e.disabled?"":void 0,...c,ref:t,onClick:r.composeEventHandlers(e.onClick,()=>{e.disabled||u(!d)})})});i.displayName=o;var h=i;const l=v.cva(`
|
|
2
2
|
adm:inline-flex adm:items-center adm:justify-center adm:gap-2 adm:rounded-md
|
|
3
3
|
adm:text-sm adm:font-medium adm:whitespace-nowrap
|
|
4
4
|
adm:transition-[color,box-shadow] adm:outline-none
|
|
5
|
-
adm:hover:bg-
|
|
5
|
+
adm:hover:bg-subtle adm:hover:text-foreground
|
|
6
6
|
adm:focus-visible:border-ring adm:focus-visible:ring-[3px]
|
|
7
7
|
adm:focus-visible:ring-ring/50
|
|
8
8
|
adm:disabled:pointer-events-none adm:disabled:opacity-50
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
adm:[&_svg:not([class*=size-])]:size-4
|
|
17
17
|
`,{variants:{variant:{default:"adm:bg-transparent",outline:`
|
|
18
18
|
adm:border adm:border-input adm:bg-transparent adm:shadow-xs
|
|
19
|
-
adm:hover:bg-
|
|
20
|
-
`},size:{default:"adm:h-9 adm:min-w-9 adm:px-2",sm:"adm:h-8 adm:min-w-8 adm:px-1.5",lg:"adm:h-10 adm:min-w-10 adm:px-2.5"}},defaultVariants:{variant:"default",size:"default"}});function j({className:e,variant:t,size:a,...n}){return
|
|
19
|
+
adm:hover:bg-subtle
|
|
20
|
+
`},size:{default:"adm:h-9 adm:min-w-9 adm:px-2",sm:"adm:h-8 adm:min-w-8 adm:px-1.5",lg:"adm:h-10 adm:min-w-10 adm:px-2.5"}},defaultVariants:{variant:"default",size:"default"}});function j({className:e,variant:t,size:a,...n}){return s.jsxRuntimeExports.jsx(h,{"data-slot":"toggle",className:f.cn(l({variant:t,size:a,className:e})),...n})}exports.Toggle=j;exports.toggleVariants=l;
|
package/dist/toggle.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { j as
|
|
2
|
+
import { j as o } from "./jsx-runtime-BzflLqGi.js";
|
|
3
3
|
import * as c from "react";
|
|
4
4
|
import { u, c as g } from "./index-C0UREtMP.js";
|
|
5
5
|
import { P as f } from "./index-BMWt1NBG.js";
|
|
6
|
-
import { c as
|
|
7
|
-
import { c as
|
|
8
|
-
var
|
|
9
|
-
const { pressed: t, defaultPressed: d, onPressedChange: i, ...m } = a, [
|
|
6
|
+
import { c as p } from "./index-CRiPKpXj.js";
|
|
7
|
+
import { c as v } from "./index-BqtVL8d-.js";
|
|
8
|
+
var r = "Toggle", n = c.forwardRef((a, e) => {
|
|
9
|
+
const { pressed: t, defaultPressed: d, onPressedChange: i, ...m } = a, [s, l] = u({
|
|
10
10
|
prop: t,
|
|
11
11
|
onChange: i,
|
|
12
12
|
defaultProp: d ?? !1,
|
|
13
|
-
caller:
|
|
13
|
+
caller: r
|
|
14
14
|
});
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ o.jsx(
|
|
16
16
|
f.button,
|
|
17
17
|
{
|
|
18
18
|
type: "button",
|
|
19
|
-
"aria-pressed":
|
|
20
|
-
"data-state":
|
|
19
|
+
"aria-pressed": s,
|
|
20
|
+
"data-state": s ? "on" : "off",
|
|
21
21
|
"data-disabled": a.disabled ? "" : void 0,
|
|
22
22
|
...m,
|
|
23
23
|
ref: e,
|
|
24
24
|
onClick: g(a.onClick, () => {
|
|
25
|
-
a.disabled || l(!
|
|
25
|
+
a.disabled || l(!s);
|
|
26
26
|
})
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
});
|
|
30
|
-
|
|
31
|
-
var b =
|
|
32
|
-
const x =
|
|
30
|
+
n.displayName = r;
|
|
31
|
+
var b = n;
|
|
32
|
+
const x = v(
|
|
33
33
|
`
|
|
34
34
|
adm:inline-flex adm:items-center adm:justify-center adm:gap-2 adm:rounded-md
|
|
35
35
|
adm:text-sm adm:font-medium adm:whitespace-nowrap
|
|
36
36
|
adm:transition-[color,box-shadow] adm:outline-none
|
|
37
|
-
adm:hover:bg-
|
|
37
|
+
adm:hover:bg-subtle adm:hover:text-foreground
|
|
38
38
|
adm:focus-visible:border-ring adm:focus-visible:ring-[3px]
|
|
39
39
|
adm:focus-visible:ring-ring/50
|
|
40
40
|
adm:disabled:pointer-events-none adm:disabled:opacity-50
|
|
@@ -53,7 +53,7 @@ const x = p(
|
|
|
53
53
|
default: "adm:bg-transparent",
|
|
54
54
|
outline: `
|
|
55
55
|
adm:border adm:border-input adm:bg-transparent adm:shadow-xs
|
|
56
|
-
adm:hover:bg-
|
|
56
|
+
adm:hover:bg-subtle
|
|
57
57
|
`
|
|
58
58
|
},
|
|
59
59
|
size: {
|
|
@@ -74,11 +74,11 @@ function k({
|
|
|
74
74
|
size: t,
|
|
75
75
|
...d
|
|
76
76
|
}) {
|
|
77
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ o.jsx(
|
|
78
78
|
b,
|
|
79
79
|
{
|
|
80
80
|
"data-slot": "toggle",
|
|
81
|
-
className:
|
|
81
|
+
className: p(x({ variant: e, size: t, className: a })),
|
|
82
82
|
...d
|
|
83
83
|
}
|
|
84
84
|
);
|
package/dist/tooltip.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-BB_1_6y_.cjs"),K=require("react"),E=require("./index-BWaO7kQK.cjs"),M=require("./index-_XxjJPRD.cjs"),W=require("./index-cwZN7ZY3.cjs"),J=require("./index-BaCYnOIG.cjs"),Q=require("./index-WIv2ndLu.cjs"),R=require("./index-Cqf5g2f_.cjs"),Z=require("./index-CBuLZ39k.cjs"),N=require("./index-DE3jjVoC.cjs"),ee=require("./index-CocSS1YK.cjs"),te=require("./index-BDs8lUfq.cjs"),oe=require("./index-DoxiiusW.cjs");function re(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const s=re(K);var ne=Symbol("radix.slottable");function se(e){const o=({children:t})=>c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:t});return o.displayName=`${e}.Slottable`,o.__radixId=ne,o}var[O]=W.createContextScope("Tooltip",[R.createPopperScope]),D=R.createPopperScope(),q="TooltipProvider",ie=700,L="tooltip.open",[ae,k]=O(q),$=e=>{const{__scopeTooltip:o,delayDuration:t=ie,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:l}=e,a=s.useRef(!0),f=s.useRef(!1),i=s.useRef(0);return s.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsxRuntimeExports.jsx(ae,{scope:o,isOpenDelayedRef:a,delayDuration:t,onOpen:s.useCallback(()=>{window.clearTimeout(i.current),a.current=!1},[]),onClose:s.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:f,onPointerInTransitChange:s.useCallback(p=>{f.current=p},[]),disableHoverableContent:n,children:l})};$.displayName=q;var P="Tooltip",[le,_]=O(P),F=e=>{const{__scopeTooltip:o,children:t,open:r,defaultOpen:n,onOpenChange:l,disableHoverableContent:a,delayDuration:f}=e,i=k(P,e.__scopeTooltip),p=D(o),[u,x]=s.useState(null),m=Q.useId(),d=s.useRef(0),v=a??i.disableHoverableContent,
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./jsx-runtime-BB_1_6y_.cjs"),K=require("react"),E=require("./index-BWaO7kQK.cjs"),M=require("./index-_XxjJPRD.cjs"),W=require("./index-cwZN7ZY3.cjs"),J=require("./index-BaCYnOIG.cjs"),Q=require("./index-WIv2ndLu.cjs"),R=require("./index-Cqf5g2f_.cjs"),Z=require("./index-CBuLZ39k.cjs"),N=require("./index-DE3jjVoC.cjs"),ee=require("./index-CocSS1YK.cjs"),te=require("./index-BDs8lUfq.cjs"),oe=require("./index-DoxiiusW.cjs");function re(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const s=re(K);var ne=Symbol("radix.slottable");function se(e){const o=({children:t})=>c.jsxRuntimeExports.jsx(c.jsxRuntimeExports.Fragment,{children:t});return o.displayName=`${e}.Slottable`,o.__radixId=ne,o}var[O]=W.createContextScope("Tooltip",[R.createPopperScope]),D=R.createPopperScope(),q="TooltipProvider",ie=700,L="tooltip.open",[ae,k]=O(q),$=e=>{const{__scopeTooltip:o,delayDuration:t=ie,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:l}=e,a=s.useRef(!0),f=s.useRef(!1),i=s.useRef(0);return s.useEffect(()=>{const p=i.current;return()=>window.clearTimeout(p)},[]),c.jsxRuntimeExports.jsx(ae,{scope:o,isOpenDelayedRef:a,delayDuration:t,onOpen:s.useCallback(()=>{window.clearTimeout(i.current),a.current=!1},[]),onClose:s.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:f,onPointerInTransitChange:s.useCallback(p=>{f.current=p},[]),disableHoverableContent:n,children:l})};$.displayName=q;var P="Tooltip",[le,_]=O(P),F=e=>{const{__scopeTooltip:o,children:t,open:r,defaultOpen:n,onOpenChange:l,disableHoverableContent:a,delayDuration:f}=e,i=k(P,e.__scopeTooltip),p=D(o),[u,x]=s.useState(null),m=Q.useId(),d=s.useRef(0),v=a??i.disableHoverableContent,T=f??i.delayDuration,h=s.useRef(!1),[y,g]=E.useControllableState({prop:r,defaultProp:n??!1,onChange:H=>{H?(i.onOpen(),document.dispatchEvent(new CustomEvent(L))):i.onClose(),l?.(H)},caller:P}),b=s.useMemo(()=>y?h.current?"delayed-open":"instant-open":"closed",[y]),j=s.useCallback(()=>{window.clearTimeout(d.current),d.current=0,h.current=!1,g(!0)},[g]),w=s.useCallback(()=>{window.clearTimeout(d.current),d.current=0,g(!1)},[g]),I=s.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>{h.current=!0,g(!0),d.current=0},T)},[T,g]);return s.useEffect(()=>()=>{d.current&&(window.clearTimeout(d.current),d.current=0)},[]),c.jsxRuntimeExports.jsx(R.Root2,{...p,children:c.jsxRuntimeExports.jsx(le,{scope:o,contentId:m,open:y,stateAttribute:b,trigger:u,onTriggerChange:x,onTriggerEnter:s.useCallback(()=>{i.isOpenDelayedRef.current?I():j()},[i.isOpenDelayedRef,I,j]),onTriggerLeave:s.useCallback(()=>{v?w():(window.clearTimeout(d.current),d.current=0)},[w,v]),onOpen:j,onClose:w,disableHoverableContent:v,children:t})})};F.displayName=P;var A="TooltipTrigger",G=s.forwardRef((e,o)=>{const{__scopeTooltip:t,...r}=e,n=_(A,t),l=k(A,t),a=D(t),f=s.useRef(null),i=M.useComposedRefs(o,f,n.onTriggerChange),p=s.useRef(!1),u=s.useRef(!1),x=s.useCallback(()=>p.current=!1,[]);return s.useEffect(()=>()=>document.removeEventListener("pointerup",x),[x]),c.jsxRuntimeExports.jsx(R.Anchor,{asChild:!0,...a,children:c.jsxRuntimeExports.jsx(ee.Primitive.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:i,onPointerMove:E.composeEventHandlers(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!l.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:E.composeEventHandlers(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:E.composeEventHandlers(e.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",x,{once:!0})}),onFocus:E.composeEventHandlers(e.onFocus,()=>{p.current||n.onOpen()}),onBlur:E.composeEventHandlers(e.onBlur,n.onClose),onClick:E.composeEventHandlers(e.onClick,n.onClose)})})});G.displayName=A;var S="TooltipPortal",[ce,ue]=O(S,{forceMount:void 0}),z=e=>{const{__scopeTooltip:o,forceMount:t,children:r,container:n}=e,l=_(S,o);return c.jsxRuntimeExports.jsx(ce,{scope:o,forceMount:t,children:c.jsxRuntimeExports.jsx(N.Presence,{present:t||l.open,children:c.jsxRuntimeExports.jsx(Z.Portal,{asChild:!0,container:n,children:r})})})};z.displayName=S;var C="TooltipContent",B=s.forwardRef((e,o)=>{const t=ue(C,e.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...l}=e,a=_(C,e.__scopeTooltip);return c.jsxRuntimeExports.jsx(N.Presence,{present:r||a.open,children:a.disableHoverableContent?c.jsxRuntimeExports.jsx(U,{side:n,...l,ref:o}):c.jsxRuntimeExports.jsx(de,{side:n,...l,ref:o})})}),de=s.forwardRef((e,o)=>{const t=_(C,e.__scopeTooltip),r=k(C,e.__scopeTooltip),n=s.useRef(null),l=M.useComposedRefs(o,n),[a,f]=s.useState(null),{trigger:i,onClose:p}=t,u=n.current,{onPointerInTransitChange:x}=r,m=s.useCallback(()=>{f(null),x(!1)},[x]),d=s.useCallback((v,T)=>{const h=v.currentTarget,y={x:v.clientX,y:v.clientY},g=me(y,h.getBoundingClientRect()),b=ve(y,g),j=he(T.getBoundingClientRect()),w=ge([...b,...j]);f(w),x(!0)},[x]);return s.useEffect(()=>()=>m(),[m]),s.useEffect(()=>{if(i&&u){const v=h=>d(h,u),T=h=>d(h,i);return i.addEventListener("pointerleave",v),u.addEventListener("pointerleave",T),()=>{i.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",T)}}},[i,u,d,m]),s.useEffect(()=>{if(a){const v=T=>{const h=T.target,y={x:T.clientX,y:T.clientY},g=i?.contains(h)||u?.contains(h),b=!Te(y,a);g?m():b&&(m(),p())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[i,u,a,p,m]),c.jsxRuntimeExports.jsx(U,{...e,ref:l})}),[pe,xe]=O(P,{isInside:!1}),fe=se("TooltipContent"),U=s.forwardRef((e,o)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:l,onPointerDownOutside:a,...f}=e,i=_(C,t),p=D(t),{onClose:u}=i;return s.useEffect(()=>(document.addEventListener(L,u),()=>document.removeEventListener(L,u)),[u]),s.useEffect(()=>{if(i.trigger){const x=m=>{m.target?.contains(i.trigger)&&u()};return window.addEventListener("scroll",x,{capture:!0}),()=>window.removeEventListener("scroll",x,{capture:!0})}},[i.trigger,u]),c.jsxRuntimeExports.jsx(J.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:x=>x.preventDefault(),onDismiss:u,children:c.jsxRuntimeExports.jsxs(R.Content,{"data-state":i.stateAttribute,...p,...f,ref:o,style:{...f.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsxRuntimeExports.jsx(fe,{children:r}),c.jsxRuntimeExports.jsx(pe,{scope:t,isInside:!0,children:c.jsxRuntimeExports.jsx(te.Root,{id:i.contentId,role:"tooltip",children:n||r})})]})})});B.displayName=C;var V="TooltipArrow",Y=s.forwardRef((e,o)=>{const{__scopeTooltip:t,...r}=e,n=D(t);return xe(V,t).isInside?null:c.jsxRuntimeExports.jsx(R.Arrow,{...n,...r,ref:o})});Y.displayName=V;function me(e,o){const t=Math.abs(o.top-e.y),r=Math.abs(o.bottom-e.y),n=Math.abs(o.right-e.x),l=Math.abs(o.left-e.x);switch(Math.min(t,r,n,l)){case l:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ve(e,o,t=5){const r=[];switch(o){case"top":r.push({x:e.x-t,y:e.y+t},{x:e.x+t,y:e.y+t});break;case"bottom":r.push({x:e.x-t,y:e.y-t},{x:e.x+t,y:e.y-t});break;case"left":r.push({x:e.x+t,y:e.y-t},{x:e.x+t,y:e.y+t});break;case"right":r.push({x:e.x-t,y:e.y-t},{x:e.x-t,y:e.y+t});break}return r}function he(e){const{top:o,right:t,bottom:r,left:n}=e;return[{x:n,y:o},{x:t,y:o},{x:t,y:r},{x:n,y:r}]}function Te(e,o){const{x:t,y:r}=e;let n=!1;for(let l=0,a=o.length-1;l<o.length;a=l++){const f=o[l],i=o[a],p=f.x,u=f.y,x=i.x,m=i.y;u>r!=m>r&&t<(x-p)*(r-u)/(m-u)+p&&(n=!n)}return n}function ge(e){const o=e.slice();return o.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),ye(o)}function ye(e){if(e.length<=1)return e.slice();const o=[];for(let r=0;r<e.length;r++){const n=e[r];for(;o.length>=2;){const l=o[o.length-1],a=o[o.length-2];if((l.x-a.x)*(n.y-a.y)>=(l.y-a.y)*(n.x-a.x))o.pop();else break}o.push(n)}o.pop();const t=[];for(let r=e.length-1;r>=0;r--){const n=e[r];for(;t.length>=2;){const l=t[t.length-1],a=t[t.length-2];if((l.x-a.x)*(n.y-a.y)>=(l.y-a.y)*(n.x-a.x))t.pop();else break}t.push(n)}return t.pop(),o.length===1&&t.length===1&&o[0].x===t[0].x&&o[0].y===t[0].y?o:o.concat(t)}var Ee=$,Ce=F,Re=G,be=z,je=B,we=Y;function X({delayDuration:e=0,...o}){return c.jsxRuntimeExports.jsx(Ee,{"data-slot":"tooltip-provider",delayDuration:e,...o})}function Pe({...e}){return c.jsxRuntimeExports.jsx(X,{children:c.jsxRuntimeExports.jsx(Ce,{"data-slot":"tooltip",...e})})}function _e({...e}){return c.jsxRuntimeExports.jsx(Re,{"data-slot":"tooltip-trigger",...e})}function Oe({className:e,sideOffset:o=0,children:t,...r}){return c.jsxRuntimeExports.jsx(be,{children:c.jsxRuntimeExports.jsxs(je,{"data-slot":"tooltip-content",sideOffset:o,className:oe.cn(`
|
|
2
2
|
adm:z-50 adm:w-fit
|
|
3
3
|
adm:origin-(--radix-tooltip-content-transform-origin) adm:animate-in
|
|
4
|
-
adm:rounded-md adm:bg-
|
|
5
|
-
adm:text-balance adm:text-
|
|
6
|
-
adm:zoom-in-95
|
|
4
|
+
adm:rounded-md adm:bg-neutrals-900 adm:px-3 adm:py-1.5 adm:text-xs
|
|
5
|
+
adm:text-balance adm:text-neutrals-0 adm:fade-in-0 adm:zoom-in-95
|
|
7
6
|
adm:data-[side=bottom]:slide-in-from-top-2
|
|
8
7
|
adm:data-[side=left]:slide-in-from-right-2
|
|
9
8
|
adm:data-[side=right]:slide-in-from-left-2
|
|
@@ -12,6 +11,6 @@
|
|
|
12
11
|
adm:data-[state=closed]:fade-out-0
|
|
13
12
|
adm:data-[state=closed]:zoom-out-95
|
|
14
13
|
`,e),...r,children:[t,c.jsxRuntimeExports.jsx(we,{className:`
|
|
15
|
-
adm:z-50 adm:size-2.5 adm:translate-y-[calc(-50
|
|
16
|
-
adm:rounded-[2px] adm:bg-
|
|
14
|
+
adm:z-50 adm:size-2.5 adm:translate-y-[calc(-50%-2px)] adm:rotate-45
|
|
15
|
+
adm:rounded-[2px] adm:bg-neutrals-900 adm:fill-neutrals-900
|
|
17
16
|
`})]})})}exports.Tooltip=Pe;exports.TooltipContent=Oe;exports.TooltipProvider=X;exports.TooltipTrigger=_e;
|
package/dist/tooltip.js
CHANGED
|
@@ -366,9 +366,8 @@ function Ue({
|
|
|
366
366
|
`
|
|
367
367
|
adm:z-50 adm:w-fit
|
|
368
368
|
adm:origin-(--radix-tooltip-content-transform-origin) adm:animate-in
|
|
369
|
-
adm:rounded-md adm:bg-
|
|
370
|
-
adm:text-balance adm:text-
|
|
371
|
-
adm:zoom-in-95
|
|
369
|
+
adm:rounded-md adm:bg-neutrals-900 adm:px-3 adm:py-1.5 adm:text-xs
|
|
370
|
+
adm:text-balance adm:text-neutrals-0 adm:fade-in-0 adm:zoom-in-95
|
|
372
371
|
adm:data-[side=bottom]:slide-in-from-top-2
|
|
373
372
|
adm:data-[side=left]:slide-in-from-right-2
|
|
374
373
|
adm:data-[side=right]:slide-in-from-left-2
|
|
@@ -386,8 +385,8 @@ function Ue({
|
|
|
386
385
|
je,
|
|
387
386
|
{
|
|
388
387
|
className: `
|
|
389
|
-
adm:z-50 adm:size-2.5 adm:translate-y-[calc(-50
|
|
390
|
-
adm:rounded-[2px] adm:bg-
|
|
388
|
+
adm:z-50 adm:size-2.5 adm:translate-y-[calc(-50%-2px)] adm:rotate-45
|
|
389
|
+
adm:rounded-[2px] adm:bg-neutrals-900 adm:fill-neutrals-900
|
|
391
390
|
`
|
|
392
391
|
}
|
|
393
392
|
)
|
|
@@ -20,13 +20,13 @@ import {
|
|
|
20
20
|
} from "@adamosuiteservices/ui/sidebar";
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
**
|
|
23
|
+
**Note**: If you use `SidebarMenuItem` with `asChild`, you can also import navigation components:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { Link } from "react-router-dom"; //
|
|
26
|
+
import { Link } from "react-router-dom"; // or Next.js Link
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Basic usage
|
|
30
30
|
|
|
31
31
|
```tsx
|
|
32
32
|
<Sidebar>
|
|
@@ -112,76 +112,82 @@ Individual menu item with hover effects.
|
|
|
112
112
|
|
|
113
113
|
### Sidebar
|
|
114
114
|
|
|
115
|
-
| Prop | Type | Description
|
|
116
|
-
| -------- | ----------- |
|
|
117
|
-
| children | `ReactNode` | Sidebar content (must include SidebarContent)
|
|
115
|
+
| Prop | Type | Description |
|
|
116
|
+
| -------- | ----------- | --------------------------------------------- |
|
|
117
|
+
| children | `ReactNode` | Sidebar content (must include SidebarContent) |
|
|
118
118
|
|
|
119
119
|
### SidebarContent
|
|
120
120
|
|
|
121
|
-
| Prop | Type | Description |
|
|
122
|
-
| --------- | ----------------------- | ------------------------------- |
|
|
123
|
-
| className | `string` | Additional classes for container|
|
|
124
|
-
| children | `ReactNode` | Sidebar content |
|
|
125
|
-
| ...props | `ComponentProps<"div">` | Native div props |
|
|
126
|
-
|
|
127
|
-
### SidebarInset
|
|
128
|
-
|
|
129
121
|
| Prop | Type | Description |
|
|
130
122
|
| --------- | ----------------------- | -------------------------------- |
|
|
131
|
-
| className | `string` | Additional classes
|
|
132
|
-
| children | `ReactNode` |
|
|
123
|
+
| className | `string` | Additional classes for container |
|
|
124
|
+
| children | `ReactNode` | Sidebar content |
|
|
133
125
|
| ...props | `ComponentProps<"div">` | Native div props |
|
|
134
126
|
|
|
127
|
+
### SidebarInset
|
|
128
|
+
|
|
129
|
+
| Prop | Type | Description |
|
|
130
|
+
| --------- | ----------------------- | ------------------------ |
|
|
131
|
+
| className | `string` | Additional classes |
|
|
132
|
+
| children | `ReactNode` | Main application content |
|
|
133
|
+
| ...props | `ComponentProps<"div">` | Native div props |
|
|
134
|
+
|
|
135
135
|
### SidebarTopBar
|
|
136
136
|
|
|
137
|
-
| Prop | Type | Description
|
|
138
|
-
| --------- | ----------------------- |
|
|
139
|
-
| className | `string` | Additional classes
|
|
140
|
-
| children | `ReactNode` | Bar content (trigger, title, actions)
|
|
141
|
-
| ...props | `ComponentProps<"div">` | Native div props
|
|
137
|
+
| Prop | Type | Description |
|
|
138
|
+
| --------- | ----------------------- | ------------------------------------- |
|
|
139
|
+
| className | `string` | Additional classes |
|
|
140
|
+
| children | `ReactNode` | Bar content (trigger, title, actions) |
|
|
141
|
+
| ...props | `ComponentProps<"div">` | Native div props |
|
|
142
142
|
|
|
143
|
-
**Default styles**: sticky, top-0, flex, gap-2, items-center, justify-between, bg-background, p-4, border-b
|
|
143
|
+
**Default styles**: sticky, top-0, z-50, flex, gap-2, items-center, justify-between, bg-background, p-4, border-b
|
|
144
144
|
|
|
145
145
|
### SidebarTrigger
|
|
146
146
|
|
|
147
|
-
| Prop | Type | Description
|
|
148
|
-
| --------- | -------------------------- |
|
|
149
|
-
| className | `string` | Additional classes
|
|
150
|
-
| ...props | `ComponentProps<"button">` | Native button props
|
|
147
|
+
| Prop | Type | Description |
|
|
148
|
+
| --------- | -------------------------- | ------------------- |
|
|
149
|
+
| className | `string` | Additional classes |
|
|
150
|
+
| ...props | `ComponentProps<"button">` | Native button props |
|
|
151
151
|
|
|
152
152
|
**Behavior**: Automatically hidden on desktop (xl:hidden). Includes segment icon from Material Symbols.
|
|
153
153
|
|
|
154
154
|
### SidebarHeader
|
|
155
155
|
|
|
156
|
-
| Prop | Type | Description
|
|
157
|
-
| --------- | -------------------------- |
|
|
158
|
-
| className | `string` | Additional classes
|
|
159
|
-
| children | `ReactNode` | Header content (logo, title)
|
|
160
|
-
| ...props | `ComponentProps<"header">` | Native header props
|
|
156
|
+
| Prop | Type | Description |
|
|
157
|
+
| --------- | -------------------------- | ---------------------------- |
|
|
158
|
+
| className | `string` | Additional classes |
|
|
159
|
+
| children | `ReactNode` | Header content (logo, title) |
|
|
160
|
+
| ...props | `ComponentProps<"header">` | Native header props |
|
|
161
161
|
|
|
162
162
|
### SidebarFooter
|
|
163
163
|
|
|
164
|
-
| Prop | Type | Description
|
|
165
|
-
| --------- | -------------------------- |
|
|
166
|
-
| className | `string` | Additional classes
|
|
167
|
-
| children | `ReactNode` | Footer content (user, logout)
|
|
168
|
-
| ...props | `ComponentProps<"footer">` | Native footer props
|
|
164
|
+
| Prop | Type | Description |
|
|
165
|
+
| --------- | -------------------------- | ----------------------------- |
|
|
166
|
+
| className | `string` | Additional classes |
|
|
167
|
+
| children | `ReactNode` | Footer content (user, logout) |
|
|
168
|
+
| ...props | `ComponentProps<"footer">` | Native footer props |
|
|
169
169
|
|
|
170
170
|
### SidebarMenu
|
|
171
171
|
|
|
172
|
-
| Prop | Type | Description |
|
|
173
|
-
| --------- | ----------------------- | ---------------------------- |
|
|
174
|
-
|
|
|
175
|
-
|
|
|
176
|
-
|
|
|
172
|
+
| Prop | Type | Default | Description |
|
|
173
|
+
| --------- | ----------------------- | ------- | ---------------------------- |
|
|
174
|
+
| asChild | `boolean` | `false` | Renders as child element |
|
|
175
|
+
| className | `string` | - | Additional classes |
|
|
176
|
+
| children | `ReactNode` | - | Menu items (SidebarMenuItem) |
|
|
177
|
+
| ...props | `ComponentProps<"div">` | - | Native div props |
|
|
177
178
|
|
|
178
179
|
### SidebarMenuItem
|
|
179
180
|
|
|
180
|
-
| Prop | Type | Default | Description
|
|
181
|
-
| --------- | -------------------------- | ------- |
|
|
182
|
-
| asChild | `boolean` | `false` | If true, renders the direct child instead of a button
|
|
183
|
-
|
|
|
184
|
-
|
|
|
181
|
+
| Prop | Type | Default | Description |
|
|
182
|
+
| --------- | -------------------------- | ------- | ----------------------------------------------------- |
|
|
183
|
+
| asChild | `boolean` | `false` | If true, renders the direct child instead of a button |
|
|
184
|
+
| isActive | `boolean` | `false` | Marks the item as active, applying `bg-white/10` |
|
|
185
|
+
| className | `string` | - | Additional classes |
|
|
186
|
+
| ...props | `ComponentProps<"button">` | - | Native button props |
|
|
187
|
+
|
|
188
|
+
**Default styles**: `h-[72px]`, `px-6`, `gap-3`, `rounded-2xl`, `mx-4`, `hover:bg-white/5`
|
|
189
|
+
|
|
190
|
+
When `isActive` is `true`: `bg-white/10` is applied and `data-active` attribute is set.
|
|
185
191
|
|
|
186
192
|
## Key features
|
|
187
193
|
|
|
@@ -336,23 +342,45 @@ import Link from "next/link";
|
|
|
336
342
|
|
|
337
343
|
### Active states
|
|
338
344
|
|
|
345
|
+
Use the `isActive` prop to mark the current active item. It applies `bg-white/10` and sets `data-active` on the element.
|
|
346
|
+
|
|
339
347
|
```tsx
|
|
340
348
|
const pathname = usePathname(); // Next.js or similar
|
|
341
349
|
|
|
342
350
|
<SidebarMenu>
|
|
343
|
-
<SidebarMenuItem
|
|
344
|
-
className={pathname === "/dashboard" ? "adm:bg-white/20" : ""}
|
|
345
|
-
>
|
|
351
|
+
<SidebarMenuItem isActive={pathname === "/dashboard"}>
|
|
346
352
|
<Icon symbol="home" /> Dashboard
|
|
347
353
|
</SidebarMenuItem>
|
|
348
|
-
<SidebarMenuItem
|
|
349
|
-
className={pathname === "/settings" ? "adm:bg-white/20" : ""}
|
|
350
|
-
>
|
|
354
|
+
<SidebarMenuItem isActive={pathname === "/settings"}>
|
|
351
355
|
<Icon symbol="settings" /> Settings
|
|
352
356
|
</SidebarMenuItem>
|
|
353
357
|
</SidebarMenu>;
|
|
354
358
|
```
|
|
355
359
|
|
|
360
|
+
For local state (e.g., in Storybook or a SPA):
|
|
361
|
+
|
|
362
|
+
```tsx
|
|
363
|
+
const [active, setActive] = useState("Dashboard");
|
|
364
|
+
|
|
365
|
+
const navItems = [
|
|
366
|
+
{ label: "Dashboard", icon: "home" },
|
|
367
|
+
{ label: "Projects", icon: "folder" },
|
|
368
|
+
{ label: "Settings", icon: "settings" },
|
|
369
|
+
];
|
|
370
|
+
|
|
371
|
+
<SidebarMenu>
|
|
372
|
+
{navItems.map((item) => (
|
|
373
|
+
<SidebarMenuItem
|
|
374
|
+
key={item.label}
|
|
375
|
+
isActive={active === item.label}
|
|
376
|
+
onClick={() => setActive(item.label)}
|
|
377
|
+
>
|
|
378
|
+
<Icon symbol={item.icon} /> {item.label}
|
|
379
|
+
</SidebarMenuItem>
|
|
380
|
+
))}
|
|
381
|
+
</SidebarMenu>;
|
|
382
|
+
```
|
|
383
|
+
|
|
356
384
|
### Color customization
|
|
357
385
|
|
|
358
386
|
The sidebar uses CSS theme variables. You can customize them:
|
|
@@ -381,7 +409,7 @@ The sidebar uses CSS theme variables. You can customize them:
|
|
|
381
409
|
- `sidebar-header` - Sidebar header
|
|
382
410
|
- `sidebar-footer` - Sidebar footer
|
|
383
411
|
- `sidebar-menu` - Menu items container
|
|
384
|
-
- `sidebar-menu-item` - Individual menu item
|
|
412
|
+
- `sidebar-menu-item` - Individual menu item (also exposes `data-active` when `isActive` is true)
|
|
385
413
|
|
|
386
414
|
## Accessibility
|
|
387
415
|
|