@lglab/compose-ui 0.28.0 → 0.30.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/dist/accordion.d.ts +49 -40
- package/dist/accordion.d.ts.map +1 -0
- package/dist/accordion.js +47 -45
- package/dist/accordion.js.map +1 -0
- package/dist/alert-dialog.d.ts +93 -87
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +94 -111
- package/dist/alert-dialog.js.map +1 -0
- package/dist/autocomplete.d.ts +99 -96
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete.js +92 -116
- package/dist/autocomplete.js.map +1 -0
- package/dist/avatar.d.ts +56 -47
- package/dist/avatar.d.ts.map +1 -0
- package/dist/avatar.js +66 -79
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +48 -42
- package/dist/badge.d.ts.map +1 -0
- package/dist/badge.js +195 -202
- package/dist/badge.js.map +1 -0
- package/dist/button.d.ts +26 -21
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +24 -24
- package/dist/button.js.map +1 -0
- package/dist/card.d.ts +105 -99
- package/dist/card.d.ts.map +1 -0
- package/dist/card.js +105 -66
- package/dist/card.js.map +1 -0
- package/dist/checkbox-group.d.ts +16 -12
- package/dist/checkbox-group.d.ts.map +1 -0
- package/dist/checkbox-group.js +18 -14
- package/dist/checkbox-group.js.map +1 -0
- package/dist/checkbox.d.ts +25 -19
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +26 -32
- package/dist/checkbox.js.map +1 -0
- package/dist/collapsible.d.ts +32 -26
- package/dist/collapsible.d.ts.map +1 -0
- package/dist/collapsible.js +32 -32
- package/dist/collapsible.js.map +1 -0
- package/dist/combobox.d.ts +191 -182
- package/dist/combobox.d.ts.map +1 -0
- package/dist/combobox.js +176 -250
- package/dist/combobox.js.map +1 -0
- package/dist/components/table/filters.d.ts +29 -0
- package/dist/components/table/filters.d.ts.map +1 -0
- package/dist/components/table/filters.js +47 -0
- package/dist/components/table/filters.js.map +1 -0
- package/dist/components/table/primitives.d.ts +93 -0
- package/dist/components/table/primitives.d.ts.map +1 -0
- package/dist/components/table/primitives.js +129 -0
- package/dist/components/table/primitives.js.map +1 -0
- package/dist/components/table/sort.js +17 -0
- package/dist/components/table/sort.js.map +1 -0
- package/dist/components/table/types.d.ts +101 -0
- package/dist/components/table/types.d.ts.map +1 -0
- package/dist/context-menu.d.ts +151 -138
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +151 -173
- package/dist/context-menu.js.map +1 -0
- package/dist/dialog.d.ts +101 -92
- package/dist/dialog.d.ts.map +1 -0
- package/dist/dialog.js +101 -105
- package/dist/dialog.js.map +1 -0
- package/dist/drawer.d.ts +109 -99
- package/dist/drawer.d.ts.map +1 -0
- package/dist/drawer.js +120 -111
- package/dist/drawer.js.map +1 -0
- package/dist/field.d.ts +61 -54
- package/dist/field.d.ts.map +1 -0
- package/dist/field.js +58 -27
- package/dist/field.js.map +1 -0
- package/dist/fieldset.d.ts +24 -19
- package/dist/fieldset.d.ts.map +1 -0
- package/dist/fieldset.js +26 -18
- package/dist/fieldset.js.map +1 -0
- package/dist/form.d.ts +16 -12
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +18 -8
- package/dist/form.js.map +1 -0
- package/dist/index.d.ts +48 -2115
- package/dist/index.js +47 -318
- package/dist/input.d.ts +16 -12
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +19 -9
- package/dist/input.js.map +1 -0
- package/dist/lib/arrow-svg.js +28 -0
- package/dist/lib/arrow-svg.js.map +1 -0
- package/dist/lib/button-variants.d.ts +6 -0
- package/dist/lib/button-variants.d.ts.map +1 -0
- package/dist/lib/button-variants.js +31 -0
- package/dist/lib/button-variants.js.map +1 -0
- package/dist/lib/control-variants.d.ts +6 -0
- package/dist/lib/control-variants.d.ts.map +1 -0
- package/dist/lib/control-variants.js +38 -0
- package/dist/lib/control-variants.js.map +1 -0
- package/dist/lib/form-variants.js +11 -0
- package/dist/lib/form-variants.js.map +1 -0
- package/dist/lib/tooltip-variants.d.ts +5 -0
- package/dist/lib/tooltip-variants.d.ts.map +1 -0
- package/dist/lib/tooltip-variants.js +36 -0
- package/dist/lib/tooltip-variants.js.map +1 -0
- package/dist/lib/utils.js +11 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/menu.d.ts +151 -138
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +151 -146
- package/dist/menu.js.map +1 -0
- package/dist/menubar.d.ts +168 -155
- package/dist/menubar.d.ts.map +1 -0
- package/dist/menubar.js +163 -169
- package/dist/menubar.js.map +1 -0
- package/dist/meter.d.ts +53 -43
- package/dist/meter.d.ts.map +1 -0
- package/dist/meter.js +59 -64
- package/dist/meter.js.map +1 -0
- package/dist/navigation-menu.d.ts +111 -96
- package/dist/navigation-menu.d.ts.map +1 -0
- package/dist/navigation-menu.js +117 -175
- package/dist/navigation-menu.js.map +1 -0
- package/dist/number-field.d.ts +64 -54
- package/dist/number-field.d.ts.map +1 -0
- package/dist/number-field.js +61 -69
- package/dist/number-field.js.map +1 -0
- package/dist/pagination.d.ts +184 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/pagination.js +164 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.d.ts +90 -82
- package/dist/popover.d.ts.map +1 -0
- package/dist/popover.js +85 -94
- package/dist/popover.js.map +1 -0
- package/dist/preview-card.d.ts +58 -54
- package/dist/preview-card.d.ts.map +1 -0
- package/dist/preview-card.js +57 -81
- package/dist/preview-card.js.map +1 -0
- package/dist/progress.d.ts +48 -40
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +46 -50
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.d.ts +16 -12
- package/dist/radio-group.d.ts.map +1 -0
- package/dist/radio-group.js +18 -14
- package/dist/radio-group.js.map +1 -0
- package/dist/radio.d.ts +24 -19
- package/dist/radio.d.ts.map +1 -0
- package/dist/radio.js +25 -34
- package/dist/radio.js.map +1 -0
- package/dist/scroll-area.d.ts +57 -47
- package/dist/scroll-area.d.ts.map +1 -0
- package/dist/scroll-area.js +54 -56
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.d.ts +146 -133
- package/dist/select.d.ts.map +1 -0
- package/dist/select.js +133 -167
- package/dist/select.js.map +1 -0
- package/dist/separator.d.ts +17 -12
- package/dist/separator.d.ts.map +1 -0
- package/dist/separator.js +19 -23
- package/dist/separator.js.map +1 -0
- package/dist/skeleton.d.ts +20 -0
- package/dist/skeleton.d.ts.map +1 -0
- package/dist/skeleton.js +27 -0
- package/dist/skeleton.js.map +1 -0
- package/dist/slider.d.ts +56 -47
- package/dist/slider.d.ts.map +1 -0
- package/dist/slider.js +53 -62
- package/dist/slider.js.map +1 -0
- package/dist/styles/default.css +15 -1
- package/dist/switch.d.ts +24 -19
- package/dist/switch.d.ts.map +1 -0
- package/dist/switch.js +23 -39
- package/dist/switch.js.map +1 -0
- package/dist/table/index.d.ts +5 -0
- package/dist/table/index.js +5 -0
- package/dist/table/use-table.d.ts +9 -0
- package/dist/table/use-table.d.ts.map +1 -0
- package/dist/table/use-table.js +256 -0
- package/dist/table/use-table.js.map +1 -0
- package/dist/tabs.d.ts +60 -49
- package/dist/tabs.d.ts.map +1 -0
- package/dist/tabs.js +76 -84
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.d.ts +15 -11
- package/dist/textarea.d.ts.map +1 -0
- package/dist/textarea.js +18 -14
- package/dist/textarea.js.map +1 -0
- package/dist/toast.d.ts +87 -81
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +79 -150
- package/dist/toast.js.map +1 -0
- package/dist/toggle-group.d.ts +34 -29
- package/dist/toggle-group.d.ts.map +1 -0
- package/dist/toggle-group.js +31 -34
- package/dist/toggle-group.js.map +1 -0
- package/dist/toggle.d.ts +24 -21
- package/dist/toggle.d.ts.map +1 -0
- package/dist/toggle.js +22 -15
- package/dist/toggle.js.map +1 -0
- package/dist/toolbar.d.ts +64 -56
- package/dist/toolbar.d.ts.map +1 -0
- package/dist/toolbar.js +57 -68
- package/dist/toolbar.js.map +1 -0
- package/dist/tooltip.d.ts +67 -62
- package/dist/tooltip.d.ts.map +1 -0
- package/dist/tooltip.js +65 -90
- package/dist/tooltip.js.map +1 -0
- package/package.json +25 -13
- package/dist/arrow-svg-C6zQTvgS.js +0 -40
- package/dist/button-variants-CbFMPwc8.js +0 -33
- package/dist/control-variants-Bwep4n0y.js +0 -37
- package/dist/form-variants-LJ8gIbk0.js +0 -9
- package/dist/utils-B6yFEsav.js +0 -8
package/dist/menubar.js
CHANGED
|
@@ -1,170 +1,164 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
),
|
|
19
|
-
...a
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
b.displayName = "MenubarRoot";
|
|
23
|
-
const l = (e) => /* @__PURE__ */ r(t.Root, { ...e });
|
|
24
|
-
l.displayName = "MenubarMenu";
|
|
25
|
-
const c = ({ className: e, variant: a, size: s, ...u }) => /* @__PURE__ */ r(
|
|
26
|
-
t.Trigger,
|
|
27
|
-
{
|
|
28
|
-
className: o(d({ variant: a, size: s }), e),
|
|
29
|
-
...u
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
c.displayName = "MenubarTrigger";
|
|
33
|
-
const p = (e) => /* @__PURE__ */ r(t.Portal, { ...e });
|
|
34
|
-
p.displayName = "MenubarPortal";
|
|
35
|
-
const M = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
36
|
-
t.Positioner,
|
|
37
|
-
{
|
|
38
|
-
className: o("z-50 outline-none", e),
|
|
39
|
-
sideOffset: 8,
|
|
40
|
-
...a
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
M.displayName = "MenubarPositioner";
|
|
44
|
-
const N = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
45
|
-
t.Popup,
|
|
46
|
-
{
|
|
47
|
-
className: o(
|
|
48
|
-
"rounded-md bg-background p-1 text-foreground shadow-sm border border-border transition-[transform,scale,opacity] data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-0 data-starting-style:opacity-0 dark:shadow-none",
|
|
49
|
-
"min-w-[8rem]",
|
|
50
|
-
e
|
|
51
|
-
),
|
|
52
|
-
...a
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
N.displayName = "MenubarPopup";
|
|
56
|
-
const g = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
57
|
-
t.Arrow,
|
|
58
|
-
{
|
|
59
|
-
className: o(
|
|
60
|
-
"flex data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",
|
|
61
|
-
e
|
|
62
|
-
),
|
|
63
|
-
...a,
|
|
64
|
-
children: /* @__PURE__ */ r(m, {})
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
g.displayName = "MenubarArrow";
|
|
68
|
-
const y = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
69
|
-
t.Item,
|
|
70
|
-
{
|
|
71
|
-
className: o(
|
|
72
|
-
n({ variant: "ghost", size: "sm" }),
|
|
73
|
-
"flex justify-start",
|
|
74
|
-
e
|
|
75
|
-
),
|
|
76
|
-
...a
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
y.displayName = "MenubarItem";
|
|
80
|
-
const f = ({ className: e, ...a }) => /* @__PURE__ */ r(t.Separator, { className: o("-mx-1 my-1 h-px bg-border", e), ...a });
|
|
81
|
-
f.displayName = "MenubarSeparator";
|
|
82
|
-
const I = ({ className: e, ...a }) => /* @__PURE__ */ r(t.Group, { className: o(e), ...a });
|
|
83
|
-
I.displayName = "MenubarGroup";
|
|
84
|
-
const x = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
85
|
-
t.GroupLabel,
|
|
86
|
-
{
|
|
87
|
-
className: o("px-3 py-1.5 text-sm font-semibold", e),
|
|
88
|
-
...a
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
x.displayName = "MenubarGroupLabel";
|
|
92
|
-
const h = ({ className: e, ...a }) => /* @__PURE__ */ r(t.RadioGroup, { className: o(e), ...a });
|
|
93
|
-
h.displayName = "MenubarRadioGroup";
|
|
94
|
-
const R = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
95
|
-
t.RadioItem,
|
|
96
|
-
{
|
|
97
|
-
className: o(
|
|
98
|
-
n({ variant: "ghost", size: "sm" }),
|
|
99
|
-
"grid grid-cols-[0.75rem_1fr] gap-2",
|
|
100
|
-
e
|
|
101
|
-
),
|
|
102
|
-
...a
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
R.displayName = "MenubarRadioItem";
|
|
106
|
-
const k = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
107
|
-
t.CheckboxItem,
|
|
108
|
-
{
|
|
109
|
-
className: o(
|
|
110
|
-
n({ variant: "ghost", size: "sm" }),
|
|
111
|
-
"grid grid-cols-[0.75rem_1fr] gap-2",
|
|
112
|
-
e
|
|
113
|
-
),
|
|
114
|
-
...a
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
k.displayName = "MenubarCheckboxItem";
|
|
118
|
-
const S = ({
|
|
119
|
-
className: e,
|
|
120
|
-
...a
|
|
121
|
-
}) => /* @__PURE__ */ r(t.RadioItemIndicator, { className: o("col-start-1", e), ...a });
|
|
122
|
-
S.displayName = "MenubarRadioItemIndicator";
|
|
123
|
-
const G = ({
|
|
124
|
-
className: e,
|
|
125
|
-
...a
|
|
126
|
-
}) => /* @__PURE__ */ r(t.CheckboxItemIndicator, { className: o("col-start-1", e), ...a });
|
|
127
|
-
G.displayName = "MenubarCheckboxItemIndicator";
|
|
128
|
-
const P = ({
|
|
129
|
-
className: e,
|
|
130
|
-
...a
|
|
131
|
-
}) => /* @__PURE__ */ r("span", { className: o("col-start-2", e), ...a });
|
|
132
|
-
P.displayName = "MenubarCheckboxItemLabel";
|
|
133
|
-
const w = ({ className: e, ...a }) => /* @__PURE__ */ r("span", { className: o("col-start-2", e), ...a });
|
|
134
|
-
w.displayName = "MenubarRadioItemLabel";
|
|
135
|
-
const C = ({ className: e, ...a }) => /* @__PURE__ */ r(
|
|
136
|
-
t.SubmenuTrigger,
|
|
137
|
-
{
|
|
138
|
-
className: o(
|
|
139
|
-
n({ variant: "ghost", size: "sm" }),
|
|
140
|
-
"flex justify-between",
|
|
141
|
-
e
|
|
142
|
-
),
|
|
143
|
-
...a
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
C.displayName = "MenubarSubmenuTrigger";
|
|
147
|
-
const L = (e) => /* @__PURE__ */ r(t.SubmenuRoot, { ...e });
|
|
148
|
-
L.displayName = "MenubarSubmenuRoot";
|
|
149
|
-
export {
|
|
150
|
-
g as MenubarArrow,
|
|
151
|
-
k as MenubarCheckboxItem,
|
|
152
|
-
G as MenubarCheckboxItemIndicator,
|
|
153
|
-
P as MenubarCheckboxItemLabel,
|
|
154
|
-
I as MenubarGroup,
|
|
155
|
-
x as MenubarGroupLabel,
|
|
156
|
-
y as MenubarItem,
|
|
157
|
-
l as MenubarMenu,
|
|
158
|
-
N as MenubarPopup,
|
|
159
|
-
p as MenubarPortal,
|
|
160
|
-
M as MenubarPositioner,
|
|
161
|
-
h as MenubarRadioGroup,
|
|
162
|
-
R as MenubarRadioItem,
|
|
163
|
-
S as MenubarRadioItemIndicator,
|
|
164
|
-
w as MenubarRadioItemLabel,
|
|
165
|
-
b as MenubarRoot,
|
|
166
|
-
f as MenubarSeparator,
|
|
167
|
-
L as MenubarSubmenuRoot,
|
|
168
|
-
C as MenubarSubmenuTrigger,
|
|
169
|
-
c as MenubarTrigger
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { buttonVariants } from "./lib/button-variants.js";
|
|
4
|
+
import { cn } from "./lib/utils.js";
|
|
5
|
+
import { ArrowSvg } from "./lib/arrow-svg.js";
|
|
6
|
+
import { controlVariants } from "./lib/control-variants.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { Menu } from "@base-ui/react/menu";
|
|
10
|
+
import { Menubar } from "@base-ui/react/menubar";
|
|
11
|
+
|
|
12
|
+
//#region src/components/menubar.tsx
|
|
13
|
+
const MenubarRoot = ({ className, ...props }) => {
|
|
14
|
+
return /* @__PURE__ */ jsx(Menubar, {
|
|
15
|
+
className: cn("inline-flex", "[&>button]:rounded-none [&>button:not(:first-of-type)]:-ml-px", "[&>button:first-of-type]:rounded-l-md [&>button:last-of-type]:rounded-r-md", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
170
18
|
};
|
|
19
|
+
MenubarRoot.displayName = "MenubarRoot";
|
|
20
|
+
const MenubarMenu = (props) => {
|
|
21
|
+
return /* @__PURE__ */ jsx(Menu.Root, { ...props });
|
|
22
|
+
};
|
|
23
|
+
MenubarMenu.displayName = "MenubarMenu";
|
|
24
|
+
const MenubarTrigger = ({ className, variant, size, ...props }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
26
|
+
className: cn(controlVariants({
|
|
27
|
+
variant,
|
|
28
|
+
size
|
|
29
|
+
}), className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
MenubarTrigger.displayName = "MenubarTrigger";
|
|
34
|
+
const MenubarPortal = (props) => {
|
|
35
|
+
return /* @__PURE__ */ jsx(Menu.Portal, { ...props });
|
|
36
|
+
};
|
|
37
|
+
MenubarPortal.displayName = "MenubarPortal";
|
|
38
|
+
const MenubarPositioner = ({ className, ...props }) => {
|
|
39
|
+
return /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
40
|
+
className: cn("z-50 outline-none", className),
|
|
41
|
+
sideOffset: 8,
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
MenubarPositioner.displayName = "MenubarPositioner";
|
|
46
|
+
const MenubarPopup = ({ className, ...props }) => {
|
|
47
|
+
return /* @__PURE__ */ jsx(Menu.Popup, {
|
|
48
|
+
className: cn("rounded-md bg-background p-1 text-foreground shadow-sm border border-border transition-[transform,scale,opacity] data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-0 data-starting-style:opacity-0 dark:shadow-none", "min-w-[8rem]", className),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
MenubarPopup.displayName = "MenubarPopup";
|
|
53
|
+
const MenubarArrow = ({ className, ...props }) => {
|
|
54
|
+
return /* @__PURE__ */ jsx(Menu.Arrow, {
|
|
55
|
+
className: cn("flex data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180", className),
|
|
56
|
+
...props,
|
|
57
|
+
children: /* @__PURE__ */ jsx(ArrowSvg, {})
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
MenubarArrow.displayName = "MenubarArrow";
|
|
61
|
+
const MenubarItem = ({ className, ...props }) => {
|
|
62
|
+
return /* @__PURE__ */ jsx(Menu.Item, {
|
|
63
|
+
className: cn(buttonVariants({
|
|
64
|
+
variant: "ghost",
|
|
65
|
+
size: "sm"
|
|
66
|
+
}), "flex justify-start", className),
|
|
67
|
+
...props
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
MenubarItem.displayName = "MenubarItem";
|
|
71
|
+
const MenubarSeparator = ({ className, ...props }) => {
|
|
72
|
+
return /* @__PURE__ */ jsx(Menu.Separator, {
|
|
73
|
+
className: cn("-mx-1 my-1 h-px bg-border", className),
|
|
74
|
+
...props
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
MenubarSeparator.displayName = "MenubarSeparator";
|
|
78
|
+
const MenubarGroup = ({ className, ...props }) => {
|
|
79
|
+
return /* @__PURE__ */ jsx(Menu.Group, {
|
|
80
|
+
className: cn(className),
|
|
81
|
+
...props
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
MenubarGroup.displayName = "MenubarGroup";
|
|
85
|
+
const MenubarGroupLabel = ({ className, ...props }) => {
|
|
86
|
+
return /* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
87
|
+
className: cn("px-3 py-1.5 text-sm font-semibold", className),
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
MenubarGroupLabel.displayName = "MenubarGroupLabel";
|
|
92
|
+
const MenubarRadioGroup = ({ className, ...props }) => {
|
|
93
|
+
return /* @__PURE__ */ jsx(Menu.RadioGroup, {
|
|
94
|
+
className: cn(className),
|
|
95
|
+
...props
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
MenubarRadioGroup.displayName = "MenubarRadioGroup";
|
|
99
|
+
const MenubarRadioItem = ({ className, ...props }) => {
|
|
100
|
+
return /* @__PURE__ */ jsx(Menu.RadioItem, {
|
|
101
|
+
className: cn(buttonVariants({
|
|
102
|
+
variant: "ghost",
|
|
103
|
+
size: "sm"
|
|
104
|
+
}), "grid grid-cols-[0.75rem_1fr] gap-2", className),
|
|
105
|
+
...props
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
MenubarRadioItem.displayName = "MenubarRadioItem";
|
|
109
|
+
const MenubarCheckboxItem = ({ className, ...props }) => {
|
|
110
|
+
return /* @__PURE__ */ jsx(Menu.CheckboxItem, {
|
|
111
|
+
className: cn(buttonVariants({
|
|
112
|
+
variant: "ghost",
|
|
113
|
+
size: "sm"
|
|
114
|
+
}), "grid grid-cols-[0.75rem_1fr] gap-2", className),
|
|
115
|
+
...props
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
MenubarCheckboxItem.displayName = "MenubarCheckboxItem";
|
|
119
|
+
const MenubarRadioItemIndicator = ({ className, ...props }) => {
|
|
120
|
+
return /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
121
|
+
className: cn("col-start-1", className),
|
|
122
|
+
...props
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
MenubarRadioItemIndicator.displayName = "MenubarRadioItemIndicator";
|
|
126
|
+
const MenubarCheckboxItemIndicator = ({ className, ...props }) => {
|
|
127
|
+
return /* @__PURE__ */ jsx(Menu.CheckboxItemIndicator, {
|
|
128
|
+
className: cn("col-start-1", className),
|
|
129
|
+
...props
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
MenubarCheckboxItemIndicator.displayName = "MenubarCheckboxItemIndicator";
|
|
133
|
+
const MenubarCheckboxItemLabel = ({ className, ...props }) => {
|
|
134
|
+
return /* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: cn("col-start-2", className),
|
|
136
|
+
...props
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
MenubarCheckboxItemLabel.displayName = "MenubarCheckboxItemLabel";
|
|
140
|
+
const MenubarRadioItemLabel = ({ className, ...props }) => {
|
|
141
|
+
return /* @__PURE__ */ jsx("span", {
|
|
142
|
+
className: cn("col-start-2", className),
|
|
143
|
+
...props
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
MenubarRadioItemLabel.displayName = "MenubarRadioItemLabel";
|
|
147
|
+
const MenubarSubmenuTrigger = ({ className, ...props }) => {
|
|
148
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuTrigger, {
|
|
149
|
+
className: cn(buttonVariants({
|
|
150
|
+
variant: "ghost",
|
|
151
|
+
size: "sm"
|
|
152
|
+
}), "flex justify-between", className),
|
|
153
|
+
...props
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
MenubarSubmenuTrigger.displayName = "MenubarSubmenuTrigger";
|
|
157
|
+
const MenubarSubmenuRoot = (props) => {
|
|
158
|
+
return /* @__PURE__ */ jsx(Menu.SubmenuRoot, { ...props });
|
|
159
|
+
};
|
|
160
|
+
MenubarSubmenuRoot.displayName = "MenubarSubmenuRoot";
|
|
161
|
+
|
|
162
|
+
//#endregion
|
|
163
|
+
export { MenubarArrow, MenubarCheckboxItem, MenubarCheckboxItemIndicator, MenubarCheckboxItemLabel, MenubarGroup, MenubarGroupLabel, MenubarItem, MenubarMenu, MenubarPopup, MenubarPortal, MenubarPositioner, MenubarRadioGroup, MenubarRadioItem, MenubarRadioItemIndicator, MenubarRadioItemLabel, MenubarRoot, MenubarSeparator, MenubarSubmenuRoot, MenubarSubmenuTrigger, MenubarTrigger };
|
|
164
|
+
//# sourceMappingURL=menubar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menubar.js","names":["BaseMenubar"],"sources":["../src/components/menubar.tsx"],"sourcesContent":["'use client'\n\nimport { Menu } from '@base-ui/react/menu'\nimport { Menubar as BaseMenubar } from '@base-ui/react/menubar'\nimport * as React from 'react'\n\nimport { ArrowSvg } from '../lib/arrow-svg'\nimport { buttonVariants } from '../lib/button-variants'\nimport {\n type ControlSize,\n type ControlVariant,\n controlVariants,\n} from '../lib/control-variants'\nimport { cn } from '../lib/utils'\n\n// ============================================================================\n// MenubarRoot\n// ============================================================================\n\ntype MenubarRootProps = React.ComponentProps<typeof BaseMenubar>\n\nconst MenubarRoot = ({ className, ...props }: MenubarRootProps) => {\n return (\n <BaseMenubar\n className={cn(\n 'inline-flex',\n // Connected items: collapse borders, round only outer corners\n '[&>button]:rounded-none [&>button:not(:first-of-type)]:-ml-px',\n '[&>button:first-of-type]:rounded-l-md [&>button:last-of-type]:rounded-r-md',\n className,\n )}\n {...props}\n />\n )\n}\n\nMenubarRoot.displayName = 'MenubarRoot'\n\n// ============================================================================\n// MenubarMenu\n// ============================================================================\n\ntype MenubarMenuProps = React.ComponentProps<typeof Menu.Root>\n\nconst MenubarMenu = (props: MenubarMenuProps) => {\n return <Menu.Root {...props} />\n}\n\nMenubarMenu.displayName = 'MenubarMenu'\n\n// ============================================================================\n// MenubarTrigger\n// ============================================================================\n\ntype MenubarTriggerProps = React.ComponentProps<typeof Menu.Trigger> & {\n /** Visual style of the trigger */\n variant?: ControlVariant\n /** Size of the trigger */\n size?: ControlSize\n}\n\nconst MenubarTrigger = ({ className, variant, size, ...props }: MenubarTriggerProps) => {\n return (\n <Menu.Trigger\n className={cn(controlVariants({ variant, size }), className)}\n {...props}\n />\n )\n}\n\nMenubarTrigger.displayName = 'MenubarTrigger'\n\n// ============================================================================\n// MenubarPortal\n// ============================================================================\n\ntype MenubarPortalProps = React.ComponentProps<typeof Menu.Portal>\n\nconst MenubarPortal = (props: MenubarPortalProps) => {\n return <Menu.Portal {...props} />\n}\n\nMenubarPortal.displayName = 'MenubarPortal'\n\n// ============================================================================\n// MenubarPositioner\n// ============================================================================\n\ntype MenubarPositionerProps = React.ComponentProps<typeof Menu.Positioner>\n\nconst MenubarPositioner = ({ className, ...props }: MenubarPositionerProps) => {\n return (\n <Menu.Positioner\n className={cn('z-50 outline-none', className)}\n sideOffset={8}\n {...props}\n />\n )\n}\n\nMenubarPositioner.displayName = 'MenubarPositioner'\n\n// ============================================================================\n// MenubarPopup\n// ============================================================================\n\ntype MenubarPopupProps = React.ComponentProps<typeof Menu.Popup>\n\nconst MenubarPopup = ({ className, ...props }: MenubarPopupProps) => {\n return (\n <Menu.Popup\n className={cn(\n 'rounded-md bg-background p-1 text-foreground shadow-sm border border-border transition-[transform,scale,opacity] data-ending-style:scale-90 data-ending-style:opacity-0 data-starting-style:scale-0 data-starting-style:opacity-0 dark:shadow-none',\n 'min-w-[8rem]',\n className,\n )}\n {...props}\n />\n )\n}\n\nMenubarPopup.displayName = 'MenubarPopup'\n\n// ============================================================================\n// MenubarArrow\n// ============================================================================\n\ntype MenubarArrowProps = React.ComponentProps<typeof Menu.Arrow>\n\nconst MenubarArrow = ({ className, ...props }: MenubarArrowProps) => {\n return (\n <Menu.Arrow\n className={cn(\n 'flex data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180',\n className,\n )}\n {...props}\n >\n <ArrowSvg />\n </Menu.Arrow>\n )\n}\n\nMenubarArrow.displayName = 'MenubarArrow'\n\n// ============================================================================\n// MenubarItem\n// ============================================================================\n\ntype MenubarItemProps = React.ComponentProps<typeof Menu.Item>\n\nconst MenubarItem = ({ className, ...props }: MenubarItemProps) => {\n return (\n <Menu.Item\n className={cn(\n buttonVariants({ variant: 'ghost', size: 'sm' }),\n 'flex justify-start',\n className,\n )}\n {...props}\n />\n )\n}\n\nMenubarItem.displayName = 'MenubarItem'\n\n// ============================================================================\n// MenubarSeparator\n// ============================================================================\n\ntype MenubarSeparatorProps = React.ComponentProps<typeof Menu.Separator>\n\nconst MenubarSeparator = ({ className, ...props }: MenubarSeparatorProps) => {\n return (\n <Menu.Separator className={cn('-mx-1 my-1 h-px bg-border', className)} {...props} />\n )\n}\n\nMenubarSeparator.displayName = 'MenubarSeparator'\n\n// ============================================================================\n// MenubarGroup\n// ============================================================================\n\ntype MenubarGroupProps = React.ComponentProps<typeof Menu.Group>\n\nconst MenubarGroup = ({ className, ...props }: MenubarGroupProps) => {\n return <Menu.Group className={cn(className)} {...props} />\n}\n\nMenubarGroup.displayName = 'MenubarGroup'\n\n// ============================================================================\n// MenubarGroupLabel\n// ============================================================================\n\ntype MenubarGroupLabelProps = React.ComponentProps<typeof Menu.GroupLabel>\n\nconst MenubarGroupLabel = ({ className, ...props }: MenubarGroupLabelProps) => {\n return (\n <Menu.GroupLabel\n className={cn('px-3 py-1.5 text-sm font-semibold', className)}\n {...props}\n />\n )\n}\n\nMenubarGroupLabel.displayName = 'MenubarGroupLabel'\n\n// ============================================================================\n// MenubarRadioGroup\n// ============================================================================\n\ntype MenubarRadioGroupProps = React.ComponentProps<typeof Menu.RadioGroup>\n\nconst MenubarRadioGroup = ({ className, ...props }: MenubarRadioGroupProps) => {\n return <Menu.RadioGroup className={cn(className)} {...props} />\n}\n\nMenubarRadioGroup.displayName = 'MenubarRadioGroup'\n\n// ============================================================================\n// MenubarRadioItem\n// ============================================================================\n\ntype MenubarRadioItemProps = React.ComponentProps<typeof Menu.RadioItem>\n\nconst MenubarRadioItem = ({ className, ...props }: MenubarRadioItemProps) => {\n return (\n <Menu.RadioItem\n className={cn(\n buttonVariants({ variant: 'ghost', size: 'sm' }),\n 'grid grid-cols-[0.75rem_1fr] gap-2',\n className,\n )}\n {...props}\n />\n )\n}\n\nMenubarRadioItem.displayName = 'MenubarRadioItem'\n\n// ============================================================================\n// MenubarCheckboxItem\n// ============================================================================\n\ntype MenubarCheckboxItemProps = React.ComponentProps<typeof Menu.CheckboxItem>\n\nconst MenubarCheckboxItem = ({ className, ...props }: MenubarCheckboxItemProps) => {\n return (\n <Menu.CheckboxItem\n className={cn(\n buttonVariants({ variant: 'ghost', size: 'sm' }),\n 'grid grid-cols-[0.75rem_1fr] gap-2',\n className,\n )}\n {...props}\n />\n )\n}\n\nMenubarCheckboxItem.displayName = 'MenubarCheckboxItem'\n\n// ============================================================================\n// MenubarRadioItemIndicator\n// ============================================================================\n\ntype MenubarRadioItemIndicatorProps = React.ComponentProps<typeof Menu.RadioItemIndicator>\n\nconst MenubarRadioItemIndicator = ({\n className,\n ...props\n}: MenubarRadioItemIndicatorProps) => {\n return <Menu.RadioItemIndicator className={cn('col-start-1', className)} {...props} />\n}\n\nMenubarRadioItemIndicator.displayName = 'MenubarRadioItemIndicator'\n\n// ============================================================================\n// MenubarCheckboxItemIndicator\n// ============================================================================\n\ntype MenubarCheckboxItemIndicatorProps = React.ComponentProps<\n typeof Menu.CheckboxItemIndicator\n>\n\nconst MenubarCheckboxItemIndicator = ({\n className,\n ...props\n}: MenubarCheckboxItemIndicatorProps) => {\n return (\n <Menu.CheckboxItemIndicator className={cn('col-start-1', className)} {...props} />\n )\n}\n\nMenubarCheckboxItemIndicator.displayName = 'MenubarCheckboxItemIndicator'\n\n// ============================================================================\n// MenubarCheckboxItemLabel\n// ============================================================================\n\ntype MenubarCheckboxItemLabelProps = React.ComponentProps<'span'>\n\nconst MenubarCheckboxItemLabel = ({\n className,\n ...props\n}: MenubarCheckboxItemLabelProps) => {\n return <span className={cn('col-start-2', className)} {...props} />\n}\n\nMenubarCheckboxItemLabel.displayName = 'MenubarCheckboxItemLabel'\n\n// ============================================================================\n// MenubarRadioItemLabel\n// ============================================================================\n\ntype MenubarRadioItemLabelProps = React.ComponentProps<'span'>\n\nconst MenubarRadioItemLabel = ({ className, ...props }: MenubarRadioItemLabelProps) => {\n return <span className={cn('col-start-2', className)} {...props} />\n}\n\nMenubarRadioItemLabel.displayName = 'MenubarRadioItemLabel'\n\n// ============================================================================\n// MenubarSubmenuTrigger\n// ============================================================================\n\ntype MenubarSubmenuTriggerProps = React.ComponentProps<typeof Menu.SubmenuTrigger>\n\nconst MenubarSubmenuTrigger = ({ className, ...props }: MenubarSubmenuTriggerProps) => {\n return (\n <Menu.SubmenuTrigger\n className={cn(\n buttonVariants({ variant: 'ghost', size: 'sm' }),\n 'flex justify-between',\n className,\n )}\n {...props}\n />\n )\n}\n\nMenubarSubmenuTrigger.displayName = 'MenubarSubmenuTrigger'\n\n// ============================================================================\n// MenubarSubmenuRoot\n// ============================================================================\n\ntype MenubarSubmenuRootProps = React.ComponentProps<typeof Menu.SubmenuRoot>\n\nconst MenubarSubmenuRoot = (props: MenubarSubmenuRootProps) => {\n return <Menu.SubmenuRoot {...props} />\n}\n\nMenubarSubmenuRoot.displayName = 'MenubarSubmenuRoot'\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nexport {\n MenubarRoot,\n MenubarMenu,\n MenubarTrigger,\n MenubarPortal,\n MenubarPositioner,\n MenubarPopup,\n MenubarArrow,\n MenubarItem,\n MenubarSeparator,\n MenubarGroup,\n MenubarGroupLabel,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarRadioItemIndicator,\n MenubarRadioItemLabel,\n MenubarCheckboxItem,\n MenubarCheckboxItemIndicator,\n MenubarCheckboxItemLabel,\n MenubarSubmenuTrigger,\n MenubarSubmenuRoot,\n}\n\nexport type {\n MenubarRootProps,\n MenubarMenuProps,\n MenubarTriggerProps,\n MenubarPortalProps,\n MenubarPositionerProps,\n MenubarPopupProps,\n MenubarArrowProps,\n MenubarItemProps,\n MenubarSeparatorProps,\n MenubarGroupProps,\n MenubarGroupLabelProps,\n MenubarRadioGroupProps,\n MenubarRadioItemProps,\n MenubarRadioItemIndicatorProps,\n MenubarRadioItemLabelProps,\n MenubarCheckboxItemProps,\n MenubarCheckboxItemIndicatorProps,\n MenubarCheckboxItemLabelProps,\n MenubarSubmenuTriggerProps,\n MenubarSubmenuRootProps,\n}\n"],"mappings":"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"}
|
package/dist/meter.d.ts
CHANGED
|
@@ -1,43 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as react_jsx_runtime50 from "react/jsx-runtime";
|
|
3
|
+
import { Meter } from "@base-ui/react/meter";
|
|
4
|
+
|
|
5
|
+
//#region src/components/meter.d.ts
|
|
6
|
+
type MeterRootProps = React.ComponentProps<typeof Meter.Root> & {
|
|
7
|
+
/** Whether to animate the meter from 0 to its value on mount */
|
|
8
|
+
animated?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const MeterRoot: {
|
|
11
|
+
({
|
|
12
|
+
className,
|
|
13
|
+
animated,
|
|
14
|
+
value,
|
|
15
|
+
...props
|
|
16
|
+
}: MeterRootProps): react_jsx_runtime50.JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
type MeterTrackProps = React.ComponentProps<typeof Meter.Track>;
|
|
20
|
+
declare const MeterTrack: {
|
|
21
|
+
({
|
|
22
|
+
className,
|
|
23
|
+
...props
|
|
24
|
+
}: MeterTrackProps): react_jsx_runtime50.JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
type MeterIndicatorProps = React.ComponentProps<typeof Meter.Indicator>;
|
|
28
|
+
declare const MeterIndicator: {
|
|
29
|
+
({
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}: MeterIndicatorProps): react_jsx_runtime50.JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
type MeterValueProps = React.ComponentProps<typeof Meter.Value>;
|
|
36
|
+
declare const MeterValue: {
|
|
37
|
+
({
|
|
38
|
+
className,
|
|
39
|
+
...props
|
|
40
|
+
}: MeterValueProps): react_jsx_runtime50.JSX.Element;
|
|
41
|
+
displayName: string;
|
|
42
|
+
};
|
|
43
|
+
type MeterLabelProps = React.ComponentProps<typeof Meter.Label>;
|
|
44
|
+
declare const MeterLabel: {
|
|
45
|
+
({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: MeterLabelProps): react_jsx_runtime50.JSX.Element;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { MeterIndicator, type MeterIndicatorProps, MeterLabel, type MeterLabelProps, MeterRoot, type MeterRootProps, MeterTrack, type MeterTrackProps, MeterValue, type MeterValueProps };
|
|
53
|
+
//# sourceMappingURL=meter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter.d.ts","names":[],"sources":["../src/components/meter.tsx"],"sourcesContent":[],"mappings":";;;;;KAWK,cAAA,GAAiB,KAAA,CAAM,sBAAsB,KAAA,CAAU;;;AAR9B,CAAA;cAaxB,SALa,EAAA;;IAA+B,SAAU;IAAA,QAAA;IAAA,KAAA;IAAA,GAAA;EAAA,CAAA,EAKC,cALD,CAAA,EAKe,mBAAA,CAAA,GAAA,CAAA,OALf;aAAhC,EAAA,MAAA;CAAc;AAAA,KAoCrC,eAAA,GAAkB,KAAA,CAAM,cAR5B,CAAA,OAQkD,KAAA,CAAU,KAR5D,CAAA;cAUK,UAVL,EAAA;;;;KAU4C,kBAAe,mBAAA,CAAA,GAAA,CAAA;;;KAkBvD,mBAAA,GAAsB,KAAA,CAAM,cAnD4B,CAAA,OAmDN,KAAA,CAAU,SAnDJ,CAAA;cAqDvD,cArDqE,EAAA;EAAA,CAAA;IAAA,SAAA;IAAA,GAAA;EAAA,CAAA,EAqD1B,mBArD0B,CAAA,EAqDP,mBAAA,CAAA,GAAA,CAAA,OArDO;EA+BtE,WAAA,EAAA,MAAe;CAAA;KAwCf,eAAA,GAAkB,KAAA,CAAM,cAxCgC,CAAA,OAwCV,KAAA,CAAU,KAxCA,CAAA;cA0CvD,UA1CuB,EAAA;EAAc,CAAA;IAAA,SAAA;IAAA,GAAA;EAAA,CAAA,EA0CE,eA1CF,CAAA,EA0CiB,mBAAA,CAAA,GAAA,CAAA,OA1CjB;EAErC,WAAA,EAUL,MAAA;CAAA;KA6CI,eAAA,GAAkB,KAAA,CAAM,sBAAsB,KAAA,CAAU;cAEvD,UAzDuC,EAAA;;IAAe,SAAA;IAAA,GAAA;EAAA,CAAA,EAyDf,eAzDe,CAAA,EAyDA,mBAAA,CAAA,GAAA,CAAA,OAzDA;EAAA,WAAA,EAAA,MAAA;AAAA,CAAA"}
|
package/dist/meter.js
CHANGED
|
@@ -1,66 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { cn } from "./lib/utils.js";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Meter } from "@base-ui/react/meter";
|
|
7
|
+
|
|
8
|
+
//#region src/components/meter.tsx
|
|
9
|
+
const MeterRoot = ({ className, animated, value, ...props }) => {
|
|
10
|
+
const targetValue = value ?? 0;
|
|
11
|
+
const [displayValue, setDisplayValue] = React.useState(animated ? 0 : targetValue);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (animated) {
|
|
14
|
+
const timer1 = requestAnimationFrame(() => {
|
|
15
|
+
const timer2 = requestAnimationFrame(() => {
|
|
16
|
+
setDisplayValue(targetValue ?? 0);
|
|
17
|
+
});
|
|
18
|
+
return () => cancelAnimationFrame(timer2);
|
|
19
|
+
});
|
|
20
|
+
return () => cancelAnimationFrame(timer1);
|
|
21
|
+
} else setDisplayValue(targetValue ?? 0);
|
|
22
|
+
}, [animated, targetValue]);
|
|
23
|
+
return /* @__PURE__ */ jsx(Meter.Root, {
|
|
24
|
+
className: cn("w-full", className),
|
|
25
|
+
value: displayValue,
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
20
28
|
};
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
t
|
|
28
|
-
),
|
|
29
|
-
...e
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
p.displayName = "MeterTrack";
|
|
33
|
-
const M = ({ className: t, ...e }) => /* @__PURE__ */ r(
|
|
34
|
-
a.Indicator,
|
|
35
|
-
{
|
|
36
|
-
className: o(
|
|
37
|
-
"h-full rounded-full bg-primary transition-all duration-1000 ease-out-expo",
|
|
38
|
-
t
|
|
39
|
-
),
|
|
40
|
-
...e
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
M.displayName = "MeterIndicator";
|
|
44
|
-
const N = ({ className: t, ...e }) => /* @__PURE__ */ r(
|
|
45
|
-
a.Value,
|
|
46
|
-
{
|
|
47
|
-
className: o("text-sm font-medium text-foreground", t),
|
|
48
|
-
...e
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
N.displayName = "MeterValue";
|
|
52
|
-
const y = ({ className: t, ...e }) => /* @__PURE__ */ r(
|
|
53
|
-
a.Label,
|
|
54
|
-
{
|
|
55
|
-
className: o("text-sm font-medium text-foreground", t),
|
|
56
|
-
...e
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
y.displayName = "MeterLabel";
|
|
60
|
-
export {
|
|
61
|
-
M as MeterIndicator,
|
|
62
|
-
y as MeterLabel,
|
|
63
|
-
f as MeterRoot,
|
|
64
|
-
p as MeterTrack,
|
|
65
|
-
N as MeterValue
|
|
29
|
+
MeterRoot.displayName = "MeterRoot";
|
|
30
|
+
const MeterTrack = ({ className, ...props }) => {
|
|
31
|
+
return /* @__PURE__ */ jsx(Meter.Track, {
|
|
32
|
+
className: cn("relative h-2 w-full overflow-hidden rounded-full bg-primary/20", className),
|
|
33
|
+
...props
|
|
34
|
+
});
|
|
66
35
|
};
|
|
36
|
+
MeterTrack.displayName = "MeterTrack";
|
|
37
|
+
const MeterIndicator = ({ className, ...props }) => {
|
|
38
|
+
return /* @__PURE__ */ jsx(Meter.Indicator, {
|
|
39
|
+
className: cn("h-full rounded-full bg-primary transition-all duration-1000 ease-out-expo", className),
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
MeterIndicator.displayName = "MeterIndicator";
|
|
44
|
+
const MeterValue = ({ className, ...props }) => {
|
|
45
|
+
return /* @__PURE__ */ jsx(Meter.Value, {
|
|
46
|
+
className: cn("text-sm font-medium text-foreground", className),
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
MeterValue.displayName = "MeterValue";
|
|
51
|
+
const MeterLabel = ({ className, ...props }) => {
|
|
52
|
+
return /* @__PURE__ */ jsx(Meter.Label, {
|
|
53
|
+
className: cn("text-sm font-medium text-foreground", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
MeterLabel.displayName = "MeterLabel";
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { MeterIndicator, MeterLabel, MeterRoot, MeterTrack, MeterValue };
|
|
61
|
+
//# sourceMappingURL=meter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meter.js","names":["BaseMeter"],"sources":["../src/components/meter.tsx"],"sourcesContent":["'use client'\n\nimport { Meter as BaseMeter } from '@base-ui/react/meter'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\n// ============================================================================\n// MeterRoot\n// ============================================================================\n\ntype MeterRootProps = React.ComponentProps<typeof BaseMeter.Root> & {\n /** Whether to animate the meter from 0 to its value on mount */\n animated?: boolean\n}\n\nconst MeterRoot = ({ className, animated, value, ...props }: MeterRootProps) => {\n const targetValue = value ?? 0\n const [displayValue, setDisplayValue] = React.useState(animated ? 0 : targetValue)\n\n React.useEffect(() => {\n if (animated) {\n // Double requestAnimationFrame ensures the initial 0 state is painted\n // before transitioning to the target value\n const timer1 = requestAnimationFrame(() => {\n const timer2 = requestAnimationFrame(() => {\n setDisplayValue(targetValue ?? 0)\n })\n return () => cancelAnimationFrame(timer2)\n })\n return () => cancelAnimationFrame(timer1)\n } else {\n setDisplayValue(targetValue ?? 0)\n }\n }, [animated, targetValue])\n\n return (\n <BaseMeter.Root className={cn('w-full', className)} value={displayValue} {...props} />\n )\n}\n\nMeterRoot.displayName = 'MeterRoot'\n\n// ============================================================================\n// MeterTrack\n// ============================================================================\n\ntype MeterTrackProps = React.ComponentProps<typeof BaseMeter.Track>\n\nconst MeterTrack = ({ className, ...props }: MeterTrackProps) => {\n return (\n <BaseMeter.Track\n className={cn(\n 'relative h-2 w-full overflow-hidden rounded-full bg-primary/20',\n className,\n )}\n {...props}\n />\n )\n}\n\nMeterTrack.displayName = 'MeterTrack'\n\n// ============================================================================\n// MeterIndicator\n// ============================================================================\n\ntype MeterIndicatorProps = React.ComponentProps<typeof BaseMeter.Indicator>\n\nconst MeterIndicator = ({ className, ...props }: MeterIndicatorProps) => {\n return (\n <BaseMeter.Indicator\n className={cn(\n 'h-full rounded-full bg-primary transition-all duration-1000 ease-out-expo',\n className,\n )}\n {...props}\n />\n )\n}\n\nMeterIndicator.displayName = 'MeterIndicator'\n\n// ============================================================================\n// MeterValue\n// ============================================================================\n\ntype MeterValueProps = React.ComponentProps<typeof BaseMeter.Value>\n\nconst MeterValue = ({ className, ...props }: MeterValueProps) => {\n return (\n <BaseMeter.Value\n className={cn('text-sm font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nMeterValue.displayName = 'MeterValue'\n\n// ============================================================================\n// MeterLabel\n// ============================================================================\n\ntype MeterLabelProps = React.ComponentProps<typeof BaseMeter.Label>\n\nconst MeterLabel = ({ className, ...props }: MeterLabelProps) => {\n return (\n <BaseMeter.Label\n className={cn('text-sm font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nMeterLabel.displayName = 'MeterLabel'\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nexport { MeterRoot, MeterTrack, MeterIndicator, MeterValue, MeterLabel }\n\nexport type {\n MeterRootProps,\n MeterTrackProps,\n MeterIndicatorProps,\n MeterValueProps,\n MeterLabelProps,\n}\n"],"mappings":";;;;;;;;AAgBA,MAAM,aAAa,EAAE,WAAW,UAAU,OAAO,GAAG,YAA4B;CAC9E,MAAM,cAAc,SAAS;CAC7B,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,WAAW,IAAI,YAAY;AAElF,OAAM,gBAAgB;AACpB,MAAI,UAAU;GAGZ,MAAM,SAAS,4BAA4B;IACzC,MAAM,SAAS,4BAA4B;AACzC,qBAAgB,eAAe,EAAE;MACjC;AACF,iBAAa,qBAAqB,OAAO;KACzC;AACF,gBAAa,qBAAqB,OAAO;QAEzC,iBAAgB,eAAe,EAAE;IAElC,CAAC,UAAU,YAAY,CAAC;AAE3B,QACE,oBAACA,MAAU;EAAK,WAAW,GAAG,UAAU,UAAU;EAAE,OAAO;EAAc,GAAI;GAAS;;AAI1F,UAAU,cAAc;AAQxB,MAAM,cAAc,EAAE,WAAW,GAAG,YAA6B;AAC/D,QACE,oBAACA,MAAU;EACT,WAAW,GACT,kEACA,UACD;EACD,GAAI;GACJ;;AAIN,WAAW,cAAc;AAQzB,MAAM,kBAAkB,EAAE,WAAW,GAAG,YAAiC;AACvE,QACE,oBAACA,MAAU;EACT,WAAW,GACT,6EACA,UACD;EACD,GAAI;GACJ;;AAIN,eAAe,cAAc;AAQ7B,MAAM,cAAc,EAAE,WAAW,GAAG,YAA6B;AAC/D,QACE,oBAACA,MAAU;EACT,WAAW,GAAG,uCAAuC,UAAU;EAC/D,GAAI;GACJ;;AAIN,WAAW,cAAc;AAQzB,MAAM,cAAc,EAAE,WAAW,GAAG,YAA6B;AAC/D,QACE,oBAACA,MAAU;EACT,WAAW,GAAG,uCAAuC,UAAU;EAC/D,GAAI;GACJ;;AAIN,WAAW,cAAc"}
|