strata-ui-react 0.1.10 → 0.1.12
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/avatar-fallback.cjs +42 -0
- package/dist/avatar-fallback.js +42 -0
- package/dist/avatar-image.cjs +42 -0
- package/dist/avatar-image.js +42 -0
- package/dist/avatar.cjs +47 -0
- package/dist/avatar.js +47 -0
- package/dist/badge.cjs +63 -0
- package/dist/badge.js +63 -0
- package/dist/badge.types.cjs +100 -0
- package/dist/badge.types.js +100 -0
- package/dist/button.cjs +58 -0
- package/dist/button.js +58 -0
- package/dist/button.types.cjs +519 -0
- package/dist/button.types.js +519 -0
- package/dist/checkbox-indicator.cjs +36 -0
- package/dist/checkbox-indicator.js +36 -0
- package/dist/checkbox.cjs +84 -0
- package/dist/checkbox.js +84 -0
- package/dist/cn.cjs +6 -0
- package/dist/cn.js +6 -0
- package/dist/dialog-close.cjs +57 -0
- package/dist/dialog-close.js +57 -0
- package/dist/dialog-description.cjs +46 -0
- package/dist/dialog-description.js +46 -0
- package/dist/dialog-popup.cjs +72 -0
- package/dist/dialog-popup.js +72 -0
- package/dist/dialog-title.cjs +46 -0
- package/dist/dialog-title.js +46 -0
- package/dist/dialog-trigger.cjs +46 -0
- package/dist/dialog-trigger.js +46 -0
- package/dist/dialog.cjs +20 -0
- package/dist/dialog.js +20 -0
- package/dist/field-errors.cjs +63 -0
- package/dist/field-errors.js +63 -0
- package/dist/field-input.cjs +80 -0
- package/dist/field-input.js +80 -0
- package/dist/form-errors.cjs +73 -0
- package/dist/form-errors.js +73 -0
- package/dist/form-submit.cjs +65 -0
- package/dist/form-submit.js +65 -0
- package/dist/form.cjs +19 -0
- package/dist/form.js +19 -0
- package/dist/form.types.cjs +6 -0
- package/dist/form.types.js +3 -0
- package/dist/index.cjs +82 -0
- package/dist/index.d.cts +312 -0
- package/dist/index.d.ts +312 -1
- package/dist/index.js +42 -0
- package/dist/input.cjs +83 -0
- package/dist/input.js +83 -0
- package/dist/label.cjs +46 -0
- package/dist/label.js +46 -0
- package/dist/profile.cjs +127 -0
- package/dist/profile.js +127 -0
- package/dist/scroll-area.cjs +97 -0
- package/dist/scroll-area.js +97 -0
- package/dist/separator.cjs +45 -0
- package/dist/separator.js +45 -0
- package/dist/slider-handle.cjs +34 -0
- package/dist/slider-handle.js +34 -0
- package/dist/slider-segment.cjs +17 -0
- package/dist/slider-segment.js +17 -0
- package/dist/slider-tick-label.cjs +12 -0
- package/dist/slider-tick-label.js +12 -0
- package/dist/slider-tick.cjs +13 -0
- package/dist/slider-tick.js +13 -0
- package/dist/slider-track.cjs +12 -0
- package/dist/slider-track.js +12 -0
- package/dist/slider.cjs +69 -0
- package/dist/slider.js +69 -0
- package/dist/switch.cjs +71 -0
- package/dist/switch.js +71 -0
- package/dist/tabs-indicator.cjs +57 -0
- package/dist/tabs-indicator.js +57 -0
- package/dist/tabs-list.cjs +57 -0
- package/dist/tabs-list.js +57 -0
- package/dist/tabs-panel.cjs +40 -0
- package/dist/tabs-panel.js +40 -0
- package/dist/tabs-tab.cjs +36 -0
- package/dist/tabs-tab.js +36 -0
- package/dist/tabs.cjs +73 -0
- package/dist/tabs.js +73 -0
- package/dist/tabs.types.cjs +4 -0
- package/dist/tabs.types.js +4 -0
- package/dist/toast-provider.cjs +86 -0
- package/dist/toast-provider.js +86 -0
- package/dist/toast.cjs +40 -0
- package/dist/toast.js +40 -0
- package/dist/tooltip-context.cjs +56 -0
- package/dist/tooltip-context.js +56 -0
- package/dist/tooltip-trigger.cjs +29 -0
- package/dist/tooltip-trigger.js +29 -0
- package/dist/tooltip.cjs +29 -0
- package/dist/tooltip.js +29 -0
- package/package.json +18 -10
- package/dist/strata-ui-react.js +0 -13543
- package/dist/strata-ui-react.umd.cjs +0 -24
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { cn } from "./cn.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
5
|
+
const ScrollArea$1 = (t0) => {
|
|
6
|
+
const $ = c(26);
|
|
7
|
+
let children;
|
|
8
|
+
let className;
|
|
9
|
+
let props;
|
|
10
|
+
let ref;
|
|
11
|
+
let t1;
|
|
12
|
+
if ($[0] !== t0) {
|
|
13
|
+
({orientation: t1, className, children, ref, ...props} = t0);
|
|
14
|
+
$[0] = t0;
|
|
15
|
+
$[1] = children;
|
|
16
|
+
$[2] = className;
|
|
17
|
+
$[3] = props;
|
|
18
|
+
$[4] = ref;
|
|
19
|
+
$[5] = t1;
|
|
20
|
+
} else {
|
|
21
|
+
children = $[1];
|
|
22
|
+
className = $[2];
|
|
23
|
+
props = $[3];
|
|
24
|
+
ref = $[4];
|
|
25
|
+
t1 = $[5];
|
|
26
|
+
}
|
|
27
|
+
const orientation = t1 === void 0 ? "vertical" : t1;
|
|
28
|
+
const t2 = orientation === "horizontal" && "h-full";
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[6] !== className || $[7] !== t2) {
|
|
31
|
+
t3 = cn("h-[200px] rounded-lg bg-surface-container", t2, className);
|
|
32
|
+
$[6] = className;
|
|
33
|
+
$[7] = t2;
|
|
34
|
+
$[8] = t3;
|
|
35
|
+
} else t3 = $[8];
|
|
36
|
+
let t4;
|
|
37
|
+
if ($[9] !== children) {
|
|
38
|
+
t4 = /* @__PURE__ */ jsx(ScrollArea.Viewport, {
|
|
39
|
+
className: "h-full overscroll-contain flex flex-col gap-xs py-2xs pr-sm pl-sm prose-step-0",
|
|
40
|
+
children
|
|
41
|
+
});
|
|
42
|
+
$[9] = children;
|
|
43
|
+
$[10] = t4;
|
|
44
|
+
} else t4 = $[10];
|
|
45
|
+
const t5 = orientation === "vertical" && "w-2xs mr-2xs my-2xs";
|
|
46
|
+
const t6 = orientation === "horizontal" && "h-2xs flex-col mb-2xs mx-xs";
|
|
47
|
+
let t7;
|
|
48
|
+
if ($[11] !== className || $[12] !== t5 || $[13] !== t6) {
|
|
49
|
+
t7 = cn("inset-shadow-1-shadow flex justify-center rounded p-[2px] bg-surface-dim opacity-0 transition-opacity delay-300 data-hovering:opacity-100 data-hovering:delay-0 data-hovering:duration-75 data-scrolling:opacity-100 data-scrolling:delay-0 data-scrolling:duration-75 hover:cursor-pointer", t5, t6, className);
|
|
50
|
+
$[11] = className;
|
|
51
|
+
$[12] = t5;
|
|
52
|
+
$[13] = t6;
|
|
53
|
+
$[14] = t7;
|
|
54
|
+
} else t7 = $[14];
|
|
55
|
+
let t8;
|
|
56
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
57
|
+
t8 = /* @__PURE__ */ jsx(ScrollArea.Thumb, { className: "w-full h-full rounded-full bg-accent rounded-1" });
|
|
58
|
+
$[15] = t8;
|
|
59
|
+
} else t8 = $[15];
|
|
60
|
+
let t9;
|
|
61
|
+
if ($[16] !== orientation || $[17] !== t7) {
|
|
62
|
+
t9 = /* @__PURE__ */ jsx(ScrollArea.Scrollbar, {
|
|
63
|
+
orientation,
|
|
64
|
+
className: t7,
|
|
65
|
+
children: t8
|
|
66
|
+
});
|
|
67
|
+
$[16] = orientation;
|
|
68
|
+
$[17] = t7;
|
|
69
|
+
$[18] = t9;
|
|
70
|
+
} else t9 = $[18];
|
|
71
|
+
let t10;
|
|
72
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
73
|
+
t10 = /* @__PURE__ */ jsx(ScrollArea.Corner, {});
|
|
74
|
+
$[19] = t10;
|
|
75
|
+
} else t10 = $[19];
|
|
76
|
+
let t11;
|
|
77
|
+
if ($[20] !== props || $[21] !== ref || $[22] !== t3 || $[23] !== t4 || $[24] !== t9) {
|
|
78
|
+
t11 = /* @__PURE__ */ jsxs(ScrollArea.Root, {
|
|
79
|
+
className: t3,
|
|
80
|
+
ref,
|
|
81
|
+
...props,
|
|
82
|
+
children: [
|
|
83
|
+
t4,
|
|
84
|
+
t9,
|
|
85
|
+
t10
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
$[20] = props;
|
|
89
|
+
$[21] = ref;
|
|
90
|
+
$[22] = t3;
|
|
91
|
+
$[23] = t4;
|
|
92
|
+
$[24] = t9;
|
|
93
|
+
$[25] = t11;
|
|
94
|
+
} else t11 = $[25];
|
|
95
|
+
return t11;
|
|
96
|
+
};
|
|
97
|
+
export { ScrollArea$1 as ScrollArea };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const require_cn = require("./cn.cjs");
|
|
2
|
+
let react_compiler_runtime = require("react/compiler-runtime");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
const Separator = (t0) => {
|
|
5
|
+
const $ = (0, react_compiler_runtime.c)(12);
|
|
6
|
+
let children;
|
|
7
|
+
let className;
|
|
8
|
+
let props;
|
|
9
|
+
let ref;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({className, children, ref, ...props} = t0);
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
$[1] = children;
|
|
14
|
+
$[2] = className;
|
|
15
|
+
$[3] = props;
|
|
16
|
+
$[4] = ref;
|
|
17
|
+
} else {
|
|
18
|
+
children = $[1];
|
|
19
|
+
className = $[2];
|
|
20
|
+
props = $[3];
|
|
21
|
+
ref = $[4];
|
|
22
|
+
}
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[5] !== className) {
|
|
25
|
+
t1 = require_cn.cn("", className);
|
|
26
|
+
$[5] = className;
|
|
27
|
+
$[6] = t1;
|
|
28
|
+
} else t1 = $[6];
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[7] !== children || $[8] !== props || $[9] !== ref || $[10] !== t1) {
|
|
31
|
+
t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
32
|
+
className: t1,
|
|
33
|
+
ref,
|
|
34
|
+
...props,
|
|
35
|
+
children
|
|
36
|
+
});
|
|
37
|
+
$[7] = children;
|
|
38
|
+
$[8] = props;
|
|
39
|
+
$[9] = ref;
|
|
40
|
+
$[10] = t1;
|
|
41
|
+
$[11] = t2;
|
|
42
|
+
} else t2 = $[11];
|
|
43
|
+
return t2;
|
|
44
|
+
};
|
|
45
|
+
exports.Separator = Separator;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn } from "./cn.js";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const Separator = (t0) => {
|
|
5
|
+
const $ = c(12);
|
|
6
|
+
let children;
|
|
7
|
+
let className;
|
|
8
|
+
let props;
|
|
9
|
+
let ref;
|
|
10
|
+
if ($[0] !== t0) {
|
|
11
|
+
({className, children, ref, ...props} = t0);
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
$[1] = children;
|
|
14
|
+
$[2] = className;
|
|
15
|
+
$[3] = props;
|
|
16
|
+
$[4] = ref;
|
|
17
|
+
} else {
|
|
18
|
+
children = $[1];
|
|
19
|
+
className = $[2];
|
|
20
|
+
props = $[3];
|
|
21
|
+
ref = $[4];
|
|
22
|
+
}
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[5] !== className) {
|
|
25
|
+
t1 = cn("", className);
|
|
26
|
+
$[5] = className;
|
|
27
|
+
$[6] = t1;
|
|
28
|
+
} else t1 = $[6];
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[7] !== children || $[8] !== props || $[9] !== ref || $[10] !== t1) {
|
|
31
|
+
t2 = /* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: t1,
|
|
33
|
+
ref,
|
|
34
|
+
...props,
|
|
35
|
+
children
|
|
36
|
+
});
|
|
37
|
+
$[7] = children;
|
|
38
|
+
$[8] = props;
|
|
39
|
+
$[9] = ref;
|
|
40
|
+
$[10] = t1;
|
|
41
|
+
$[11] = t2;
|
|
42
|
+
} else t2 = $[11];
|
|
43
|
+
return t2;
|
|
44
|
+
};
|
|
45
|
+
export { Separator };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
const require_cn = require("./cn.cjs");
|
|
3
|
+
const require_tooltip = require("./tooltip.cjs");
|
|
4
|
+
const require_tooltip_trigger = require("./tooltip-trigger.cjs");
|
|
5
|
+
const require_tooltip_context = require("./tooltip-context.cjs");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let react = require("react");
|
|
8
|
+
const SliderHandle = ({ sliderInstance, isActive, onKeyDownHandler, onMouseDownHandler, onTouchStart, value, className, children, ref, ...props }) => {
|
|
9
|
+
const [isHovering, setIsHovering] = (0, react.useState)(false);
|
|
10
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_tooltip.Tooltip, {
|
|
11
|
+
open: isActive || isHovering,
|
|
12
|
+
trackCursorAxis: "x",
|
|
13
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tooltip_trigger.TooltipTrigger, { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
14
|
+
onKeyDown: onKeyDownHandler,
|
|
15
|
+
onMouseDown: onMouseDownHandler,
|
|
16
|
+
onTouchStart,
|
|
17
|
+
onMouseEnter: () => setIsHovering(true),
|
|
18
|
+
onMouseLeave: () => setIsHovering(false),
|
|
19
|
+
role: "slider",
|
|
20
|
+
"aria-valuemin": sliderInstance.options.min,
|
|
21
|
+
"aria-valuemax": sliderInstance.options.max,
|
|
22
|
+
"aria-valuenow": value,
|
|
23
|
+
style: {
|
|
24
|
+
left: `${sliderInstance.getPercentageForValue(value)}%`,
|
|
25
|
+
zIndex: isActive ? "1" : "0"
|
|
26
|
+
},
|
|
27
|
+
className: require_cn.cn("absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full outline-none border-2 border-primary bg-surface-container hover:cursor-pointer active:border-secondary hover:border-secondary transition-[width,height,border] aspect-square", isActive ? "size-md shadow-4-shadow" : "size-sm shadow-1-shadow", className),
|
|
28
|
+
ref,
|
|
29
|
+
...props,
|
|
30
|
+
children
|
|
31
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_tooltip_context.TooltipContent, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: value }) })]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
exports.SliderHandle = SliderHandle;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { Tooltip } from "./tooltip.js";
|
|
4
|
+
import { TooltipTrigger } from "./tooltip-trigger.js";
|
|
5
|
+
import { TooltipContent } from "./tooltip-context.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
const SliderHandle = ({ sliderInstance, isActive, onKeyDownHandler, onMouseDownHandler, onTouchStart, value, className, children, ref, ...props }) => {
|
|
9
|
+
const [isHovering, setIsHovering] = useState(false);
|
|
10
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
11
|
+
open: isActive || isHovering,
|
|
12
|
+
trackCursorAxis: "x",
|
|
13
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, { render: /* @__PURE__ */ jsx("button", {
|
|
14
|
+
onKeyDown: onKeyDownHandler,
|
|
15
|
+
onMouseDown: onMouseDownHandler,
|
|
16
|
+
onTouchStart,
|
|
17
|
+
onMouseEnter: () => setIsHovering(true),
|
|
18
|
+
onMouseLeave: () => setIsHovering(false),
|
|
19
|
+
role: "slider",
|
|
20
|
+
"aria-valuemin": sliderInstance.options.min,
|
|
21
|
+
"aria-valuemax": sliderInstance.options.max,
|
|
22
|
+
"aria-valuenow": value,
|
|
23
|
+
style: {
|
|
24
|
+
left: `${sliderInstance.getPercentageForValue(value)}%`,
|
|
25
|
+
zIndex: isActive ? "1" : "0"
|
|
26
|
+
},
|
|
27
|
+
className: cn("absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full outline-none border-2 border-primary bg-surface-container hover:cursor-pointer active:border-secondary hover:border-secondary transition-[width,height,border] aspect-square", isActive ? "size-md shadow-4-shadow" : "size-sm shadow-1-shadow", className),
|
|
28
|
+
ref,
|
|
29
|
+
...props,
|
|
30
|
+
children
|
|
31
|
+
}) }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("span", { children: value }) })]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export { SliderHandle };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
const require_cn = require("./cn.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
const SliderSegment = ({ index, steps, left, width, className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6
|
+
className: require_cn.cn("absolute bg-primary h-full rounded-full inset-shadow-1-shadow", className),
|
|
7
|
+
style: {
|
|
8
|
+
background: `${index === steps - 1 ? "transparent" : "var(--color-primary)"}`,
|
|
9
|
+
left: `${left}%`,
|
|
10
|
+
width: `${width}%`
|
|
11
|
+
},
|
|
12
|
+
ref,
|
|
13
|
+
...props,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.SliderSegment = SliderSegment;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const SliderSegment = ({ index, steps, left, width, className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: cn("absolute bg-primary h-full rounded-full inset-shadow-1-shadow", className),
|
|
7
|
+
style: {
|
|
8
|
+
background: `${index === steps - 1 ? "transparent" : "var(--color-primary)"}`,
|
|
9
|
+
left: `${left}%`,
|
|
10
|
+
width: `${width}%`
|
|
11
|
+
},
|
|
12
|
+
ref,
|
|
13
|
+
...props,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
export { SliderSegment };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
const require_cn = require("./cn.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
const SliderTickLabel = ({ className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
6
|
+
className: require_cn.cn("absolute text-[0.6rem] top-full -translate-x-1/2 translate-y-[1.2rem] whitespace-nowrap style-text-default--1 text-on-surface-variant", className),
|
|
7
|
+
ref,
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
exports.SliderTickLabel = SliderTickLabel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const SliderTickLabel = ({ className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx("p", {
|
|
6
|
+
className: cn("absolute text-[0.6rem] top-full -translate-x-1/2 translate-y-[1.2rem] whitespace-nowrap style-text-default--1 text-on-surface-variant", className),
|
|
7
|
+
ref,
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { SliderTickLabel };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
const require_cn = require("./cn.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
const SliderTick = ({ percentage, className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
6
|
+
className: require_cn.cn("absolute top-2xs -translate-x-1/2", className),
|
|
7
|
+
ref,
|
|
8
|
+
...props,
|
|
9
|
+
style: { left: `${percentage}%` },
|
|
10
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "absolute bg-on-surface-variant rounded-full left-0 h-2xs w-[2px] -translate-x-1/2 translate-y-[0.7rem]" }), children]
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
exports.SliderTick = SliderTick;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
const SliderTick = ({ percentage, className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
6
|
+
className: cn("absolute top-2xs -translate-x-1/2", className),
|
|
7
|
+
ref,
|
|
8
|
+
...props,
|
|
9
|
+
style: { left: `${percentage}%` },
|
|
10
|
+
children: [/* @__PURE__ */ jsx("span", { className: "absolute bg-on-surface-variant rounded-full left-0 h-2xs w-[2px] -translate-x-1/2 translate-y-[0.7rem]" }), children]
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { SliderTick };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
const require_cn = require("./cn.cjs");
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
const SliderTrack = ({ className, children, sliderRef, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
6
|
+
className: require_cn.cn("relative h-2xs inset-shadow-1-shadow rounded-full bg-surface-dim grow", className),
|
|
7
|
+
ref: sliderRef,
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
exports.SliderTrack = SliderTrack;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const SliderTrack = ({ className, children, sliderRef, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx("div", {
|
|
6
|
+
className: cn("relative h-2xs inset-shadow-1-shadow rounded-full bg-surface-dim grow", className),
|
|
7
|
+
ref: sliderRef,
|
|
8
|
+
...props,
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
export { SliderTrack };
|
package/dist/slider.cjs
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
const require_cn = require("./cn.cjs");
|
|
3
|
+
const require_slider_handle = require("./slider-handle.cjs");
|
|
4
|
+
const require_slider_segment = require("./slider-segment.cjs");
|
|
5
|
+
const require_slider_tick_label = require("./slider-tick-label.cjs");
|
|
6
|
+
const require_slider_tick = require("./slider-tick.cjs");
|
|
7
|
+
const require_slider_track = require("./slider-track.cjs");
|
|
8
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let react = require("react");
|
|
10
|
+
let __tanstack_react_ranger = require("@tanstack/react-ranger");
|
|
11
|
+
const Slider = ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, min, max, stepSize, defaultValues, showTickLabels, label, className, ref, ...props }) => {
|
|
12
|
+
const sliderRef = (0, react.useRef)(null);
|
|
13
|
+
const [values, setValues] = (0, react.useState)(defaultValues || [50]);
|
|
14
|
+
const sliderInstance = (0, __tanstack_react_ranger.useRanger)({
|
|
15
|
+
getRangerElement: () => sliderRef.current,
|
|
16
|
+
values,
|
|
17
|
+
min: min ?? 0,
|
|
18
|
+
max: max ?? 100,
|
|
19
|
+
stepSize: stepSize ?? 1,
|
|
20
|
+
onChange: (instance) => {
|
|
21
|
+
setValues(instance.sortedValues);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25
|
+
ref,
|
|
26
|
+
className: require_cn.cn("space-y-2xs", className),
|
|
27
|
+
...props,
|
|
28
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
29
|
+
className: "style-text-default--1 text-on-surface-variant",
|
|
30
|
+
children: label
|
|
31
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
32
|
+
className: "flex items-center w-full gap-sm",
|
|
33
|
+
children: [
|
|
34
|
+
LeadingIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LeadingIcon, {
|
|
35
|
+
className: "size-sm",
|
|
36
|
+
weight: "bold"
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_slider_track.SliderTrack, {
|
|
39
|
+
sliderRef,
|
|
40
|
+
children: [
|
|
41
|
+
showTickLabels && sliderInstance.getTicks().map(({ value, key, percentage }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slider_tick.SliderTick, {
|
|
42
|
+
percentage,
|
|
43
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slider_tick_label.SliderTickLabel, { children: value })
|
|
44
|
+
}, key)),
|
|
45
|
+
sliderInstance.getSteps().map(({ left, width }, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slider_segment.SliderSegment, {
|
|
46
|
+
index,
|
|
47
|
+
steps: sliderInstance.getSteps().length,
|
|
48
|
+
left,
|
|
49
|
+
width
|
|
50
|
+
}, index)),
|
|
51
|
+
sliderInstance.handles().map(({ isActive, onKeyDownHandler, onMouseDownHandler, onTouchStart, value: value_0 }, index_0) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_slider_handle.SliderHandle, {
|
|
52
|
+
sliderInstance,
|
|
53
|
+
isActive,
|
|
54
|
+
onKeyDownHandler,
|
|
55
|
+
onMouseDownHandler,
|
|
56
|
+
onTouchStart,
|
|
57
|
+
value: value_0
|
|
58
|
+
}, index_0))
|
|
59
|
+
]
|
|
60
|
+
}),
|
|
61
|
+
TrailingIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TrailingIcon, {
|
|
62
|
+
className: "size-sm",
|
|
63
|
+
weight: "bold"
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
exports.Slider = Slider;
|
package/dist/slider.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use no memo";
|
|
2
|
+
import { cn } from "./cn.js";
|
|
3
|
+
import { SliderHandle } from "./slider-handle.js";
|
|
4
|
+
import { SliderSegment } from "./slider-segment.js";
|
|
5
|
+
import { SliderTickLabel } from "./slider-tick-label.js";
|
|
6
|
+
import { SliderTick } from "./slider-tick.js";
|
|
7
|
+
import { SliderTrack } from "./slider-track.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { useRef, useState } from "react";
|
|
10
|
+
import { useRanger } from "@tanstack/react-ranger";
|
|
11
|
+
const Slider = ({ leadingIcon: LeadingIcon, trailingIcon: TrailingIcon, min, max, stepSize, defaultValues, showTickLabels, label, className, ref, ...props }) => {
|
|
12
|
+
const sliderRef = useRef(null);
|
|
13
|
+
const [values, setValues] = useState(defaultValues || [50]);
|
|
14
|
+
const sliderInstance = useRanger({
|
|
15
|
+
getRangerElement: () => sliderRef.current,
|
|
16
|
+
values,
|
|
17
|
+
min: min ?? 0,
|
|
18
|
+
max: max ?? 100,
|
|
19
|
+
stepSize: stepSize ?? 1,
|
|
20
|
+
onChange: (instance) => {
|
|
21
|
+
setValues(instance.sortedValues);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
25
|
+
ref,
|
|
26
|
+
className: cn("space-y-2xs", className),
|
|
27
|
+
...props,
|
|
28
|
+
children: [label && /* @__PURE__ */ jsx("p", {
|
|
29
|
+
className: "style-text-default--1 text-on-surface-variant",
|
|
30
|
+
children: label
|
|
31
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "flex items-center w-full gap-sm",
|
|
33
|
+
children: [
|
|
34
|
+
LeadingIcon && /* @__PURE__ */ jsx(LeadingIcon, {
|
|
35
|
+
className: "size-sm",
|
|
36
|
+
weight: "bold"
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ jsxs(SliderTrack, {
|
|
39
|
+
sliderRef,
|
|
40
|
+
children: [
|
|
41
|
+
showTickLabels && sliderInstance.getTicks().map(({ value, key, percentage }) => /* @__PURE__ */ jsx(SliderTick, {
|
|
42
|
+
percentage,
|
|
43
|
+
children: /* @__PURE__ */ jsx(SliderTickLabel, { children: value })
|
|
44
|
+
}, key)),
|
|
45
|
+
sliderInstance.getSteps().map(({ left, width }, index) => /* @__PURE__ */ jsx(SliderSegment, {
|
|
46
|
+
index,
|
|
47
|
+
steps: sliderInstance.getSteps().length,
|
|
48
|
+
left,
|
|
49
|
+
width
|
|
50
|
+
}, index)),
|
|
51
|
+
sliderInstance.handles().map(({ isActive, onKeyDownHandler, onMouseDownHandler, onTouchStart, value: value_0 }, index_0) => /* @__PURE__ */ jsx(SliderHandle, {
|
|
52
|
+
sliderInstance,
|
|
53
|
+
isActive,
|
|
54
|
+
onKeyDownHandler,
|
|
55
|
+
onMouseDownHandler,
|
|
56
|
+
onTouchStart,
|
|
57
|
+
value: value_0
|
|
58
|
+
}, index_0))
|
|
59
|
+
]
|
|
60
|
+
}),
|
|
61
|
+
TrailingIcon && /* @__PURE__ */ jsx(TrailingIcon, {
|
|
62
|
+
className: "size-sm",
|
|
63
|
+
weight: "bold"
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
export { Slider };
|
package/dist/switch.cjs
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const require_cn = require("./cn.cjs");
|
|
2
|
+
const require_label = require("./label.cjs");
|
|
3
|
+
let react_compiler_runtime = require("react/compiler-runtime");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let __base_ui_react_switch = require("@base-ui/react/switch");
|
|
6
|
+
const Switch = (t0) => {
|
|
7
|
+
const $ = (0, react_compiler_runtime.c)(18);
|
|
8
|
+
let className;
|
|
9
|
+
let label;
|
|
10
|
+
let props;
|
|
11
|
+
let ref;
|
|
12
|
+
if ($[0] !== t0) {
|
|
13
|
+
({label, className, ref, ...props} = t0);
|
|
14
|
+
$[0] = t0;
|
|
15
|
+
$[1] = className;
|
|
16
|
+
$[2] = label;
|
|
17
|
+
$[3] = props;
|
|
18
|
+
$[4] = ref;
|
|
19
|
+
} else {
|
|
20
|
+
className = $[1];
|
|
21
|
+
label = $[2];
|
|
22
|
+
props = $[3];
|
|
23
|
+
ref = $[4];
|
|
24
|
+
}
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[5] !== className) {
|
|
27
|
+
t1 = require_cn.cn("relative group transition-colors flex items-center h-[26px] w-[50px] rounded-full bg-surface-dim bg-size-[6.5rem_100%] inset-shadow-1-shadow p-0.5 ease-[cubic-bezier(0.26,0.75,0.38,0.45)] before:absolute before:rounded-full data-checked:bg-accent data-checked:active:bg-gray-500 outline-2 outline-transparent not-disabled:hover:outline-accent hover:cursor-pointer disabled:opacity-50 disabled:pointer-events-none", className);
|
|
28
|
+
$[5] = className;
|
|
29
|
+
$[6] = t1;
|
|
30
|
+
} else t1 = $[6];
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
33
|
+
t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__base_ui_react_switch.Switch.Thumb, { className: "size-[14px] data-checked:size-[18px] rounded-full bg-accent transition-transform duration-500 ease-[cubic-bezier(0.68,-0.55,0.27,1.55)] translate-x-[6px] shadow-xs data-checked:translate-x-[26px] data-checked:scale-[1.1] data-unchecked:bg-accent data-checked:bg-on-accent" });
|
|
34
|
+
$[7] = t2;
|
|
35
|
+
} else t2 = $[7];
|
|
36
|
+
let t3;
|
|
37
|
+
if ($[8] !== props || $[9] !== ref || $[10] !== t1) {
|
|
38
|
+
t3 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__base_ui_react_switch.Switch.Root, {
|
|
39
|
+
className: t1,
|
|
40
|
+
ref,
|
|
41
|
+
...props,
|
|
42
|
+
children: t2
|
|
43
|
+
});
|
|
44
|
+
$[8] = props;
|
|
45
|
+
$[9] = ref;
|
|
46
|
+
$[10] = t1;
|
|
47
|
+
$[11] = t3;
|
|
48
|
+
} else t3 = $[11];
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[12] !== label || $[13] !== props) {
|
|
51
|
+
t4 = label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_label.Label, {
|
|
52
|
+
htmlFor: props.id,
|
|
53
|
+
children: label
|
|
54
|
+
});
|
|
55
|
+
$[12] = label;
|
|
56
|
+
$[13] = props;
|
|
57
|
+
$[14] = t4;
|
|
58
|
+
} else t4 = $[14];
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[15] !== t3 || $[16] !== t4) {
|
|
61
|
+
t5 = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
62
|
+
className: "flex items-center gap-xs",
|
|
63
|
+
children: [t3, t4]
|
|
64
|
+
});
|
|
65
|
+
$[15] = t3;
|
|
66
|
+
$[16] = t4;
|
|
67
|
+
$[17] = t5;
|
|
68
|
+
} else t5 = $[17];
|
|
69
|
+
return t5;
|
|
70
|
+
};
|
|
71
|
+
exports.Switch = Switch;
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { cn } from "./cn.js";
|
|
2
|
+
import { Label } from "./label.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Switch } from "@base-ui/react/switch";
|
|
6
|
+
const Switch$1 = (t0) => {
|
|
7
|
+
const $ = c(18);
|
|
8
|
+
let className;
|
|
9
|
+
let label;
|
|
10
|
+
let props;
|
|
11
|
+
let ref;
|
|
12
|
+
if ($[0] !== t0) {
|
|
13
|
+
({label, className, ref, ...props} = t0);
|
|
14
|
+
$[0] = t0;
|
|
15
|
+
$[1] = className;
|
|
16
|
+
$[2] = label;
|
|
17
|
+
$[3] = props;
|
|
18
|
+
$[4] = ref;
|
|
19
|
+
} else {
|
|
20
|
+
className = $[1];
|
|
21
|
+
label = $[2];
|
|
22
|
+
props = $[3];
|
|
23
|
+
ref = $[4];
|
|
24
|
+
}
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[5] !== className) {
|
|
27
|
+
t1 = cn("relative group transition-colors flex items-center h-[26px] w-[50px] rounded-full bg-surface-dim bg-size-[6.5rem_100%] inset-shadow-1-shadow p-0.5 ease-[cubic-bezier(0.26,0.75,0.38,0.45)] before:absolute before:rounded-full data-checked:bg-accent data-checked:active:bg-gray-500 outline-2 outline-transparent not-disabled:hover:outline-accent hover:cursor-pointer disabled:opacity-50 disabled:pointer-events-none", className);
|
|
28
|
+
$[5] = className;
|
|
29
|
+
$[6] = t1;
|
|
30
|
+
} else t1 = $[6];
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
33
|
+
t2 = /* @__PURE__ */ jsx(Switch.Thumb, { className: "size-[14px] data-checked:size-[18px] rounded-full bg-accent transition-transform duration-500 ease-[cubic-bezier(0.68,-0.55,0.27,1.55)] translate-x-[6px] shadow-xs data-checked:translate-x-[26px] data-checked:scale-[1.1] data-unchecked:bg-accent data-checked:bg-on-accent" });
|
|
34
|
+
$[7] = t2;
|
|
35
|
+
} else t2 = $[7];
|
|
36
|
+
let t3;
|
|
37
|
+
if ($[8] !== props || $[9] !== ref || $[10] !== t1) {
|
|
38
|
+
t3 = /* @__PURE__ */ jsx(Switch.Root, {
|
|
39
|
+
className: t1,
|
|
40
|
+
ref,
|
|
41
|
+
...props,
|
|
42
|
+
children: t2
|
|
43
|
+
});
|
|
44
|
+
$[8] = props;
|
|
45
|
+
$[9] = ref;
|
|
46
|
+
$[10] = t1;
|
|
47
|
+
$[11] = t3;
|
|
48
|
+
} else t3 = $[11];
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[12] !== label || $[13] !== props) {
|
|
51
|
+
t4 = label && /* @__PURE__ */ jsx(Label, {
|
|
52
|
+
htmlFor: props.id,
|
|
53
|
+
children: label
|
|
54
|
+
});
|
|
55
|
+
$[12] = label;
|
|
56
|
+
$[13] = props;
|
|
57
|
+
$[14] = t4;
|
|
58
|
+
} else t4 = $[14];
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[15] !== t3 || $[16] !== t4) {
|
|
61
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
className: "flex items-center gap-xs",
|
|
63
|
+
children: [t3, t4]
|
|
64
|
+
});
|
|
65
|
+
$[15] = t3;
|
|
66
|
+
$[16] = t4;
|
|
67
|
+
$[17] = t5;
|
|
68
|
+
} else t5 = $[17];
|
|
69
|
+
return t5;
|
|
70
|
+
};
|
|
71
|
+
export { Switch$1 as Switch };
|