@vuer-ai/vuer-uikit 0.0.2 → 0.0.3
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 +80 -0
- package/dist/chunk-263CMARJ.mjs +155 -0
- package/dist/chunk-277NQUJD.js +99 -0
- package/dist/chunk-3FR3WKI4.mjs +24 -0
- package/dist/chunk-3HXPIWL3.js +51 -0
- package/dist/chunk-3Q75Z2CT.mjs +76 -0
- package/dist/chunk-5BIQ3IN7.js +93 -0
- package/dist/chunk-5JP4AZ4C.js +302 -0
- package/dist/chunk-5U4NWZMT.mjs +78 -0
- package/dist/chunk-75QDQ67T.js +56 -0
- package/dist/chunk-7IYL2AR4.js +375 -0
- package/dist/chunk-ATDHGFVI.mjs +82 -0
- package/dist/chunk-CFXL2XYO.mjs +339 -0
- package/dist/chunk-CLTLT5XW.js +27 -0
- package/dist/chunk-CN6ISLZA.js +102 -0
- package/dist/chunk-CP7QYV4N.mjs +110 -0
- package/dist/chunk-CZSRIDXN.mjs +165 -0
- package/dist/chunk-D4C5V4EN.mjs +53 -0
- package/dist/chunk-DQGTWUID.js +186 -0
- package/dist/chunk-DWIK2CUV.mjs +45 -0
- package/dist/chunk-FXIL4NQZ.js +58 -0
- package/dist/chunk-FYEZTS4S.mjs +90 -0
- package/dist/chunk-GA2JCN3F.mjs +111 -0
- package/dist/chunk-HW6SLBO3.mjs +9 -0
- package/dist/chunk-I6VKLSAJ.js +163 -0
- package/dist/chunk-J4RFFBDJ.mjs +94 -0
- package/dist/chunk-JIXJTLEO.js +93 -0
- package/dist/chunk-JOBQTBEM.mjs +49 -0
- package/dist/chunk-JZ7V43ZL.js +136 -0
- package/dist/chunk-KAPV3EZO.mjs +271 -0
- package/dist/chunk-KJ42IGH6.js +2 -0
- package/dist/chunk-KO7BQ6RR.js +83 -0
- package/dist/chunk-KVDEBKWR.mjs +106 -0
- package/dist/chunk-KVFK3YC7.js +187 -0
- package/dist/chunk-KYKEJFJT.js +110 -0
- package/dist/chunk-LBFO3QAA.js +202 -0
- package/dist/chunk-MASRZTZC.mjs +34 -0
- package/dist/chunk-NA7TVYOP.js +21 -0
- package/dist/chunk-OE56M4MX.js +93 -0
- package/dist/chunk-PKGNHHWG.mjs +60 -0
- package/dist/chunk-Q3APPCB2.mjs +91 -0
- package/dist/chunk-QNTUEKYQ.mjs +19 -0
- package/dist/chunk-QS7WS6DD.mjs +1 -0
- package/dist/chunk-RPXWKB6F.js +103 -0
- package/dist/chunk-SDN2OTHS.js +78 -0
- package/dist/chunk-SKWTWHB7.mjs +53 -0
- package/dist/chunk-ST4P6AN6.js +2 -0
- package/dist/chunk-SUU4Z6E5.mjs +200 -0
- package/dist/chunk-SZU2TX5H.js +24 -0
- package/dist/chunk-TOZYLDAL.mjs +72 -0
- package/dist/chunk-UFR656UY.mjs +87 -0
- package/dist/chunk-UWO6RBCE.js +11 -0
- package/dist/chunk-VGCVIHBR.mjs +1 -0
- package/dist/chunk-WI2J7NIV.mjs +161 -0
- package/dist/chunk-WK3M4X72.js +2 -0
- package/dist/chunk-WOG6UIG5.mjs +71 -0
- package/dist/chunk-XACRGXGF.js +75 -0
- package/dist/chunk-YQORMF34.js +110 -0
- package/dist/chunk-Z37VNICQ.js +67 -0
- package/dist/chunk-ZCYBA6YN.mjs +1 -0
- package/dist/chunk-ZJXBC33M.js +112 -0
- package/dist/chunk-ZKYQYCKN.mjs +15 -0
- package/dist/chunk-ZYBSCTBR.js +109 -0
- package/dist/highlight-cursor/cursor-context.d.mts +7 -0
- package/dist/highlight-cursor/cursor-context.d.ts +7 -0
- package/dist/highlight-cursor/cursor-context.js +14 -0
- package/dist/highlight-cursor/cursor-context.mjs +1 -0
- package/dist/highlight-cursor/cursor-provider.d.mts +7 -0
- package/dist/highlight-cursor/cursor-provider.d.ts +7 -0
- package/dist/highlight-cursor/cursor-provider.js +12 -0
- package/dist/highlight-cursor/cursor-provider.mjs +3 -0
- package/dist/highlight-cursor/enhanced-components.d.mts +20 -0
- package/dist/highlight-cursor/enhanced-components.d.ts +20 -0
- package/dist/highlight-cursor/enhanced-components.js +36 -0
- package/dist/highlight-cursor/enhanced-components.mjs +11 -0
- package/dist/highlight-cursor/index.d.mts +16 -0
- package/dist/highlight-cursor/index.d.ts +16 -0
- package/dist/highlight-cursor/index.js +50 -0
- package/dist/highlight-cursor/index.mjs +13 -0
- package/dist/highlight-cursor/tabs-cursor-context.d.mts +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.d.ts +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.js +14 -0
- package/dist/highlight-cursor/tabs-cursor-context.mjs +1 -0
- package/dist/highlight-cursor/types.d.mts +39 -0
- package/dist/highlight-cursor/types.d.ts +39 -0
- package/dist/highlight-cursor/types.js +2 -0
- package/dist/highlight-cursor/types.mjs +1 -0
- package/dist/highlight-cursor/with-cursor.d.mts +7 -0
- package/dist/highlight-cursor/with-cursor.d.ts +7 -0
- package/dist/highlight-cursor/with-cursor.js +11 -0
- package/dist/highlight-cursor/with-cursor.mjs +2 -0
- package/dist/index.css +294 -0
- package/dist/index.d.mts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +382 -6744
- package/dist/index.mjs +31 -0
- package/dist/styles/theme.css +185 -0
- package/dist/styles/theme.d.mts +2 -0
- package/dist/styles/theme.d.ts +2 -0
- package/dist/styles/toast.css +44 -0
- package/dist/styles/toast.d.mts +2 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/variables.css +184 -0
- package/dist/styles/variables.d.mts +2 -0
- package/dist/styles/variables.d.ts +2 -0
- package/dist/ui/avatar.d.mts +16 -0
- package/dist/ui/avatar.d.ts +16 -0
- package/dist/ui/avatar.js +23 -0
- package/dist/ui/avatar.mjs +2 -0
- package/dist/ui/badge.d.mts +14 -0
- package/dist/ui/badge.d.ts +14 -0
- package/dist/ui/badge.js +16 -0
- package/dist/ui/badge.mjs +3 -0
- package/dist/ui/button.d.mts +16 -0
- package/dist/ui/button.d.ts +16 -0
- package/dist/ui/button.js +12 -0
- package/dist/ui/button.mjs +3 -0
- package/dist/ui/card.d.mts +12 -0
- package/dist/ui/card.d.ts +12 -0
- package/dist/ui/card.js +36 -0
- package/dist/ui/card.mjs +3 -0
- package/dist/ui/checkbox.d.mts +11 -0
- package/dist/ui/checkbox.d.ts +11 -0
- package/dist/ui/checkbox.js +12 -0
- package/dist/ui/checkbox.mjs +3 -0
- package/dist/ui/collapsible.d.mts +9 -0
- package/dist/ui/collapsible.d.ts +9 -0
- package/dist/ui/collapsible.js +20 -0
- package/dist/ui/collapsible.mjs +3 -0
- package/dist/ui/dropdown.d.mts +28 -0
- package/dist/ui/dropdown.d.ts +28 -0
- package/dist/ui/dropdown.js +68 -0
- package/dist/ui/dropdown.mjs +3 -0
- package/dist/ui/index.d.mts +41 -0
- package/dist/ui/index.d.ts +41 -0
- package/dist/ui/index.js +355 -0
- package/dist/ui/index.mjs +26 -0
- package/dist/ui/input-numbers.d.mts +15 -0
- package/dist/ui/input-numbers.d.ts +15 -0
- package/dist/ui/input-numbers.js +13 -0
- package/dist/ui/input-numbers.mjs +4 -0
- package/dist/ui/input.d.mts +22 -0
- package/dist/ui/input.d.ts +22 -0
- package/dist/ui/input.js +16 -0
- package/dist/ui/input.mjs +3 -0
- package/dist/ui/modal.d.mts +28 -0
- package/dist/ui/modal.d.ts +28 -0
- package/dist/ui/modal.js +48 -0
- package/dist/ui/modal.mjs +3 -0
- package/dist/ui/popover.d.mts +10 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +23 -0
- package/dist/ui/popover.mjs +2 -0
- package/dist/ui/radio-group.d.mts +8 -0
- package/dist/ui/radio-group.d.ts +8 -0
- package/dist/ui/radio-group.js +16 -0
- package/dist/ui/radio-group.mjs +3 -0
- package/dist/ui/select.d.mts +28 -0
- package/dist/{types/ui → ui}/select.d.ts +18 -14
- package/dist/ui/select.js +48 -0
- package/dist/ui/select.mjs +3 -0
- package/dist/ui/slider.d.mts +10 -0
- package/dist/ui/slider.d.ts +10 -0
- package/dist/ui/slider.js +12 -0
- package/dist/ui/slider.mjs +3 -0
- package/dist/ui/switch.d.mts +7 -0
- package/dist/ui/switch.d.ts +7 -0
- package/dist/ui/switch.js +12 -0
- package/dist/ui/switch.mjs +3 -0
- package/dist/ui/tabs.d.mts +16 -0
- package/dist/ui/tabs.d.ts +16 -0
- package/dist/ui/tabs.js +25 -0
- package/dist/ui/tabs.mjs +4 -0
- package/dist/ui/textarea.d.mts +16 -0
- package/dist/ui/textarea.d.ts +16 -0
- package/dist/ui/textarea.js +12 -0
- package/dist/ui/textarea.mjs +3 -0
- package/dist/ui/theme-context.d.mts +17 -0
- package/dist/{types/ui → ui}/theme-context.d.ts +5 -3
- package/dist/ui/theme-context.js +14 -0
- package/dist/ui/theme-context.mjs +1 -0
- package/dist/ui/toast.d.mts +7 -0
- package/dist/ui/toast.d.ts +7 -0
- package/dist/ui/toast.js +14 -0
- package/dist/ui/toast.mjs +1 -0
- package/dist/ui/toggle-group.d.mts +12 -0
- package/dist/ui/toggle-group.d.ts +12 -0
- package/dist/ui/toggle-group.js +17 -0
- package/dist/ui/toggle-group.mjs +4 -0
- package/dist/ui/toggle.d.mts +13 -0
- package/dist/ui/toggle.d.ts +13 -0
- package/dist/ui/toggle.js +16 -0
- package/dist/ui/toggle.mjs +3 -0
- package/dist/ui/tooltip.d.mts +10 -0
- package/dist/ui/tooltip.d.ts +10 -0
- package/dist/ui/tooltip.js +23 -0
- package/dist/ui/tooltip.mjs +2 -0
- package/dist/utils/cn.d.mts +5 -0
- package/dist/utils/cn.d.ts +5 -0
- package/dist/utils/cn.js +10 -0
- package/dist/utils/cn.mjs +1 -0
- package/dist/utils/index.d.mts +2 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.mjs +2 -0
- package/package.json +48 -27
- package/dist/index.umd.js +0 -74
- package/dist/types/index.d.ts +0 -4
- package/dist/types/lib/utils.d.ts +0 -2
- package/dist/types/ui/button.d.ts +0 -13
- package/dist/types/ui/input.d.ts +0 -19
- package/dist/vuer-uikit.css +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { InputRoot, InputSlot } from './chunk-KVDEBKWR.mjs';
|
|
2
|
+
import { cn } from './chunk-HW6SLBO3.mjs';
|
|
3
|
+
import { useGesture } from '@use-gesture/react';
|
|
4
|
+
import { forwardRef, useRef, useCallback } from 'react';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var getHoverElementAndIndex = (element, inputs) => {
|
|
8
|
+
if (!element) return null;
|
|
9
|
+
const container = element == null ? void 0 : element.closest("[data-input]");
|
|
10
|
+
const currentInput = container == null ? void 0 : container.querySelector("input");
|
|
11
|
+
if (!currentInput) return null;
|
|
12
|
+
return Array.from(inputs.values()).indexOf(currentInput);
|
|
13
|
+
};
|
|
14
|
+
var changeElementsHoverState = (inputs, range, changed) => {
|
|
15
|
+
const [first, last] = range;
|
|
16
|
+
Array.from(inputs.values()).forEach((input, i) => {
|
|
17
|
+
const container = input == null ? void 0 : input.closest("[data-input]");
|
|
18
|
+
if (first === null || last === null) {
|
|
19
|
+
container == null ? void 0 : container.setAttribute("data-hover", "none");
|
|
20
|
+
} else if (i >= Math.min(first, last) && i <= Math.max(first, last)) {
|
|
21
|
+
container == null ? void 0 : container.setAttribute("data-hover", changed !== "none" ? changed : "down");
|
|
22
|
+
} else {
|
|
23
|
+
container == null ? void 0 : container.setAttribute("data-hover", "none");
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var InputNumbers = forwardRef(function InputNumbers2({ size, value, onValuesChange, prefix, step = 0.1 }, ref) {
|
|
28
|
+
const inputs = useRef(/* @__PURE__ */ new Map());
|
|
29
|
+
const selectRange = useRef([null, null]);
|
|
30
|
+
const inputChange = useRef(false);
|
|
31
|
+
const stopClick = useCallback(() => {
|
|
32
|
+
const stopClick2 = (e) => {
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
document.removeEventListener("click", stopClick2, true);
|
|
36
|
+
};
|
|
37
|
+
document.addEventListener("click", stopClick2, true);
|
|
38
|
+
}, []);
|
|
39
|
+
const bind = useGesture({
|
|
40
|
+
onDrag: ({ delta: [dx], event, initial, distance: [, oy], xy, memo = 0 }) => {
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
if (selectRange.current[0] === null) {
|
|
44
|
+
selectRange.current[0] = getHoverElementAndIndex(
|
|
45
|
+
document.elementFromPoint(...initial),
|
|
46
|
+
inputs.current
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
let newMX = memo + dx / 2;
|
|
50
|
+
if (Math.abs(newMX) >= (inputChange.current ? 1 : 5)) {
|
|
51
|
+
const multiplyStep = event.shiftKey ? 5 : event.altKey ? 1 / 5 : 1;
|
|
52
|
+
const newValue = value.map((v, i) => {
|
|
53
|
+
const [first, last] = selectRange.current;
|
|
54
|
+
if (first === null || last === null) {
|
|
55
|
+
return v;
|
|
56
|
+
} else if (i <= Math.max(first, last) && i >= Math.min(first, last)) {
|
|
57
|
+
return Number(((v || 0) + Math.floor(newMX) * step * multiplyStep).toPrecision(6));
|
|
58
|
+
} else {
|
|
59
|
+
return v;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
onValuesChange == null ? void 0 : onValuesChange(newValue);
|
|
63
|
+
newMX = 0;
|
|
64
|
+
inputChange.current = true;
|
|
65
|
+
changeElementsHoverState(inputs.current, selectRange.current, "x");
|
|
66
|
+
stopClick();
|
|
67
|
+
}
|
|
68
|
+
if (!inputChange.current) {
|
|
69
|
+
const currentElement = document.elementFromPoint(...xy);
|
|
70
|
+
const currentIndex = getHoverElementAndIndex(currentElement, inputs.current);
|
|
71
|
+
selectRange.current[1] = currentIndex ?? selectRange.current[1];
|
|
72
|
+
changeElementsHoverState(inputs.current, selectRange.current, oy !== 0 ? "y" : "none");
|
|
73
|
+
stopClick();
|
|
74
|
+
}
|
|
75
|
+
return newMX;
|
|
76
|
+
},
|
|
77
|
+
onDragEnd: () => {
|
|
78
|
+
selectRange.current = [null, null];
|
|
79
|
+
inputChange.current = false;
|
|
80
|
+
changeElementsHoverState(inputs.current, selectRange.current, "none");
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const valueChangeHandler = useCallback(
|
|
84
|
+
(index) => {
|
|
85
|
+
return (e) => {
|
|
86
|
+
const inputValue = e.target.value;
|
|
87
|
+
if (inputValue === "" || !isNaN(Number(inputValue))) {
|
|
88
|
+
const newValue = value.map((v, i) => {
|
|
89
|
+
if (inputValue === "") {
|
|
90
|
+
return "";
|
|
91
|
+
}
|
|
92
|
+
return i === index ? Number(inputValue) : v;
|
|
93
|
+
});
|
|
94
|
+
onValuesChange == null ? void 0 : onValuesChange(newValue);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
[onValuesChange, value]
|
|
99
|
+
);
|
|
100
|
+
if ((value == null ? void 0 : value.length) === 0) {
|
|
101
|
+
throw new Error("`value` cannot be an empty array");
|
|
102
|
+
}
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
ref,
|
|
107
|
+
...bind(),
|
|
108
|
+
className: cn("gap-xs flex cursor-crosshair touch-none select-none flex-col"),
|
|
109
|
+
children: value.map((item, index) => /* @__PURE__ */ jsx(
|
|
110
|
+
InputRoot,
|
|
111
|
+
{
|
|
112
|
+
ref: (r) => {
|
|
113
|
+
inputs.current.set(index.toString(), r);
|
|
114
|
+
return () => {
|
|
115
|
+
inputs.current.delete(index.toString());
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
size,
|
|
119
|
+
value: item,
|
|
120
|
+
onClick: () => {
|
|
121
|
+
var _a;
|
|
122
|
+
(_a = inputs.current.get(index.toString())) == null ? void 0 : _a.focus();
|
|
123
|
+
},
|
|
124
|
+
onChange: valueChangeHandler(index),
|
|
125
|
+
"data-hover": "none",
|
|
126
|
+
className: cn([
|
|
127
|
+
"group/number-input",
|
|
128
|
+
"cursor-crosshair",
|
|
129
|
+
"data-[hover=down]:bg-bg-tertiary",
|
|
130
|
+
"data-[hover=x]:bg-bg-tertiary",
|
|
131
|
+
"data-[hover=y]:bg-bg-tertiary",
|
|
132
|
+
"data-[hover=down]:cursor-move",
|
|
133
|
+
"data-[hover=x]:cursor-col-resize",
|
|
134
|
+
"data-[hover=y]:cursor-row-resize"
|
|
135
|
+
]),
|
|
136
|
+
inputClassName: cn([
|
|
137
|
+
"cursor-crosshair",
|
|
138
|
+
"group-data-[hover=down]/number-input:cursor-move",
|
|
139
|
+
"group-data-[hover=x]/number-input:cursor-col-resize",
|
|
140
|
+
"group-data-[hover=y]/number-input:cursor-row-resize"
|
|
141
|
+
]),
|
|
142
|
+
children: /* @__PURE__ */ jsx(
|
|
143
|
+
InputSlot,
|
|
144
|
+
{
|
|
145
|
+
className: cn(
|
|
146
|
+
"cursor-crosshair",
|
|
147
|
+
"group-data-[hover=down]/number-input:cursor-move",
|
|
148
|
+
"group-data-[hover=x]/number-input:cursor-col-resize",
|
|
149
|
+
"group-data-[hover=y]/number-input:cursor-row-resize"
|
|
150
|
+
),
|
|
151
|
+
children: prefix == null ? void 0 : prefix[index]
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
},
|
|
155
|
+
index
|
|
156
|
+
))
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export { InputNumbers };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { cn } from './chunk-HW6SLBO3.mjs';
|
|
2
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
3
|
+
import { CheckIcon } from 'lucide-react';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Checkbox({ className, checkall, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
CheckboxPrimitive.Root,
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "checkbox",
|
|
11
|
+
className: cn(
|
|
12
|
+
"group",
|
|
13
|
+
"relative",
|
|
14
|
+
"w-[16px]",
|
|
15
|
+
"h-[16px]",
|
|
16
|
+
"rounded-[3px]",
|
|
17
|
+
"border-[1.5px]",
|
|
18
|
+
"border-solid",
|
|
19
|
+
"border-bg-tertiary",
|
|
20
|
+
"data-[state=checked]:bg-brand-primary",
|
|
21
|
+
"data-[state=checked]:border-none",
|
|
22
|
+
"disabled:cursor-not-allowed",
|
|
23
|
+
"disabled:bg-bg-secondary",
|
|
24
|
+
"disabled:data-[state=checked]:bg-bg-secondary",
|
|
25
|
+
"disabled:data-[state=checked]:border-[1.5px]",
|
|
26
|
+
"disabled:data-[state=checked]:border-solid",
|
|
27
|
+
"disabled:data-[state=checked]:border-bg-tertiary",
|
|
28
|
+
checkall && [
|
|
29
|
+
"data-[state=checked]:bg-bg-transparent",
|
|
30
|
+
"data-[state=checked]:border-[1.5px]",
|
|
31
|
+
"data-[state=checked]:border-solid",
|
|
32
|
+
"data-[state=checked]:border-bg-tertiary"
|
|
33
|
+
],
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props,
|
|
37
|
+
children: checkall ? /* @__PURE__ */ jsx(
|
|
38
|
+
CheckboxPrimitive.Indicator,
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "checkbox-indicator",
|
|
41
|
+
className: cn(
|
|
42
|
+
"absolute",
|
|
43
|
+
"inset-0",
|
|
44
|
+
"m-auto",
|
|
45
|
+
"w-3/5",
|
|
46
|
+
"h-3/5",
|
|
47
|
+
"bg-brand-primary",
|
|
48
|
+
"group-disabled:bg-bg-tertiary"
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
) : /* @__PURE__ */ jsx(
|
|
52
|
+
CheckboxPrimitive.Indicator,
|
|
53
|
+
{
|
|
54
|
+
"data-slot": "checkbox-indicator",
|
|
55
|
+
className: cn(
|
|
56
|
+
"flex",
|
|
57
|
+
"items-center",
|
|
58
|
+
"justify-center",
|
|
59
|
+
"text-current",
|
|
60
|
+
"transition-none",
|
|
61
|
+
"text-icon-withbg",
|
|
62
|
+
"group-disabled:text-bg-tertiary"
|
|
63
|
+
),
|
|
64
|
+
children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" })
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { Checkbox };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUWO6RBCE_js = require('./chunk-UWO6RBCE.js');
|
|
4
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
5
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var badgeVariants = classVarianceAuthority.cva(
|
|
9
|
+
[
|
|
10
|
+
"inline-flex",
|
|
11
|
+
"items-center",
|
|
12
|
+
"justify-center",
|
|
13
|
+
"rounded-md",
|
|
14
|
+
"px-md",
|
|
15
|
+
"py-xxs",
|
|
16
|
+
"align-middle",
|
|
17
|
+
"text-xs",
|
|
18
|
+
"font-normal",
|
|
19
|
+
"w-fit",
|
|
20
|
+
"whitespace-nowrap",
|
|
21
|
+
"shrink-0",
|
|
22
|
+
"[&>svg]:size-3",
|
|
23
|
+
"gap-1",
|
|
24
|
+
"[&>svg]:pointer-events-none",
|
|
25
|
+
"focus-visible:border-ring",
|
|
26
|
+
"focus-visible:ring-ring/50",
|
|
27
|
+
"focus-visible:ring-[3px]",
|
|
28
|
+
"aria-invalid:ring-destructive/20",
|
|
29
|
+
"dark:aria-invalid:ring-destructive/40",
|
|
30
|
+
"aria-invalid:border-destructive",
|
|
31
|
+
"transition-[color,box-shadow]",
|
|
32
|
+
"overflow-hidden",
|
|
33
|
+
"text-text-withbg"
|
|
34
|
+
],
|
|
35
|
+
{
|
|
36
|
+
variants: {
|
|
37
|
+
variant: {
|
|
38
|
+
default: "bg-brand-primary text-text-primary",
|
|
39
|
+
secondary: "bg-bg-secondary",
|
|
40
|
+
destructive: "bg-danger-primary",
|
|
41
|
+
success: "bg-accent-success",
|
|
42
|
+
warning: "bg-accent-warning"
|
|
43
|
+
},
|
|
44
|
+
type: {
|
|
45
|
+
default: "",
|
|
46
|
+
circle: "size-[18px] rounded-full",
|
|
47
|
+
dot: "size-[6px] rounded-full !px-0 !py-0 text-transparent"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
variant: "default",
|
|
52
|
+
type: "default"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
function Badge({
|
|
57
|
+
className,
|
|
58
|
+
variant,
|
|
59
|
+
type,
|
|
60
|
+
asChild = false,
|
|
61
|
+
...props
|
|
62
|
+
}) {
|
|
63
|
+
const Comp = asChild ? reactSlot.Slot : "span";
|
|
64
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
+
Comp,
|
|
66
|
+
{
|
|
67
|
+
"data-slot": "badge",
|
|
68
|
+
className: chunkUWO6RBCE_js.cn(badgeVariants({ variant, type }), className),
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.Badge = Badge;
|
|
75
|
+
exports.badgeVariants = badgeVariants;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUWO6RBCE_js = require('./chunk-UWO6RBCE.js');
|
|
4
|
+
var TogglePrimitive = require('@radix-ui/react-toggle');
|
|
5
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
|
|
27
|
+
|
|
28
|
+
var toggleVariants = classVarianceAuthority.cva(
|
|
29
|
+
[
|
|
30
|
+
"inline-flex",
|
|
31
|
+
"items-center",
|
|
32
|
+
"justify-center",
|
|
33
|
+
"shrink-0",
|
|
34
|
+
"whitespace-nowrap",
|
|
35
|
+
"font-normal",
|
|
36
|
+
"transition-all",
|
|
37
|
+
"[&_svg]:shrink-0 ",
|
|
38
|
+
"[&_svg]:pointer-events-none",
|
|
39
|
+
"outline-none",
|
|
40
|
+
"disabled:bg-transparent",
|
|
41
|
+
"disabled:text-bg-tertiary",
|
|
42
|
+
"disabled:cursor-not-allowed"
|
|
43
|
+
],
|
|
44
|
+
{
|
|
45
|
+
variants: {
|
|
46
|
+
variant: {
|
|
47
|
+
primary: [
|
|
48
|
+
"text-text-primary",
|
|
49
|
+
"data-[state=on]:text-text-highlight",
|
|
50
|
+
"data-[state=on]:bg-brand-primary",
|
|
51
|
+
"hover:bg-bg-secondary"
|
|
52
|
+
],
|
|
53
|
+
secondary: [
|
|
54
|
+
"text-text-secondary",
|
|
55
|
+
"data-[state=on]:text-text-highlight",
|
|
56
|
+
"data-[state=on]:bg-bg-secondary",
|
|
57
|
+
"hover:bg-bg-secondary "
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
size: {
|
|
61
|
+
sm: [
|
|
62
|
+
"text-xs",
|
|
63
|
+
"h-5.5",
|
|
64
|
+
"gap-xxs",
|
|
65
|
+
"px-md",
|
|
66
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
67
|
+
"rounded-uk-xs"
|
|
68
|
+
],
|
|
69
|
+
base: [
|
|
70
|
+
"text-xs",
|
|
71
|
+
"h-7 ",
|
|
72
|
+
"gap-xs",
|
|
73
|
+
" px-lg",
|
|
74
|
+
"[&_svg:not([class*='size-'])]:size-3.5",
|
|
75
|
+
"rounded-uk-sm"
|
|
76
|
+
],
|
|
77
|
+
lg: [
|
|
78
|
+
"text-sm",
|
|
79
|
+
"h-8",
|
|
80
|
+
" gap-xs",
|
|
81
|
+
"px-xl",
|
|
82
|
+
"[&_svg:not([class*='size-'])]:size-4",
|
|
83
|
+
"rounded-uk-md"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
variant: "primary",
|
|
89
|
+
size: "base"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
function Toggle({
|
|
94
|
+
className,
|
|
95
|
+
variant,
|
|
96
|
+
size,
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
100
|
+
TogglePrimitive__namespace.Root,
|
|
101
|
+
{
|
|
102
|
+
"data-slot": "toggle",
|
|
103
|
+
className: chunkUWO6RBCE_js.cn(toggleVariants({ variant, size, className })),
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exports.Toggle = Toggle;
|
|
110
|
+
exports.toggleVariants = toggleVariants;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUWO6RBCE_js = require('./chunk-UWO6RBCE.js');
|
|
4
|
+
var SwitchPrimitive = require('@radix-ui/react-switch');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n.default = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var SwitchPrimitive__namespace = /*#__PURE__*/_interopNamespace(SwitchPrimitive);
|
|
26
|
+
|
|
27
|
+
function Switch({ className, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
SwitchPrimitive__namespace.Root,
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "switch",
|
|
32
|
+
className: chunkUWO6RBCE_js.cn(
|
|
33
|
+
"group",
|
|
34
|
+
"w-[32px]",
|
|
35
|
+
"h-[16px]",
|
|
36
|
+
"rounded-[24px]",
|
|
37
|
+
"bg-bg-tertiary",
|
|
38
|
+
"data-[state=checked]:bg-brand-primary",
|
|
39
|
+
"disabled:bg-bg-secondary",
|
|
40
|
+
"disabled:cursor-not-allowed",
|
|
41
|
+
"disabled:data-[state=checked]:bg-bg-secondary",
|
|
42
|
+
"disabled:data-[state=unchecked]:bg-bg-secondary",
|
|
43
|
+
className
|
|
44
|
+
),
|
|
45
|
+
...props,
|
|
46
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
SwitchPrimitive__namespace.Thumb,
|
|
48
|
+
{
|
|
49
|
+
"data-slot": "switch-thumb",
|
|
50
|
+
className: chunkUWO6RBCE_js.cn(
|
|
51
|
+
"block",
|
|
52
|
+
"size-[12px]",
|
|
53
|
+
"rounded-full",
|
|
54
|
+
"bg-icon-withbg",
|
|
55
|
+
"group-disabled:bg-bg-primary",
|
|
56
|
+
"transition-transform",
|
|
57
|
+
"duration-200",
|
|
58
|
+
"translate-x-[2px]",
|
|
59
|
+
"data-[state=checked]:translate-x-[18px]"
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.Switch = Switch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCLTLT5XW_js = require('./chunk-CLTLT5XW.js');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var getVisibleRect = (element, elementRect) => {
|
|
8
|
+
let parent = element.parentElement;
|
|
9
|
+
let visibleRect = {
|
|
10
|
+
...elementRect,
|
|
11
|
+
left: elementRect.left,
|
|
12
|
+
right: elementRect.right,
|
|
13
|
+
top: elementRect.top,
|
|
14
|
+
bottom: elementRect.bottom,
|
|
15
|
+
width: elementRect.width,
|
|
16
|
+
height: elementRect.height,
|
|
17
|
+
x: elementRect.x,
|
|
18
|
+
y: elementRect.y
|
|
19
|
+
};
|
|
20
|
+
while (parent) {
|
|
21
|
+
const style = window.getComputedStyle(parent);
|
|
22
|
+
const hasOverflow = [style.overflowY, style.overflowX].some(
|
|
23
|
+
(overflow) => ["auto", "scroll", "hidden"].includes(overflow)
|
|
24
|
+
);
|
|
25
|
+
if (hasOverflow) {
|
|
26
|
+
const parentRect = parent.getBoundingClientRect();
|
|
27
|
+
const newLeft = Math.max(visibleRect.left, parentRect.left);
|
|
28
|
+
const newTop = Math.max(visibleRect.top, parentRect.top);
|
|
29
|
+
const newRight = Math.min(visibleRect.right, parentRect.right);
|
|
30
|
+
const newBottom = Math.min(visibleRect.bottom, parentRect.bottom);
|
|
31
|
+
visibleRect = {
|
|
32
|
+
...visibleRect,
|
|
33
|
+
left: newLeft,
|
|
34
|
+
top: newTop,
|
|
35
|
+
right: newRight,
|
|
36
|
+
bottom: newBottom,
|
|
37
|
+
width: Math.max(0, newRight - newLeft),
|
|
38
|
+
height: Math.max(0, newBottom - newTop),
|
|
39
|
+
x: newLeft,
|
|
40
|
+
y: newTop
|
|
41
|
+
};
|
|
42
|
+
if (visibleRect.width <= 0 || visibleRect.height <= 0) {
|
|
43
|
+
return new DOMRect(0, 0, 0, 0);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
parent = parent.parentElement;
|
|
47
|
+
}
|
|
48
|
+
return DOMRect.fromRect(visibleRect);
|
|
49
|
+
};
|
|
50
|
+
function withCursor(Component) {
|
|
51
|
+
const displayName = Component.displayName || Component.name || "Component";
|
|
52
|
+
const EnhancedComponent = react.forwardRef(
|
|
53
|
+
({ id: propId, onMouseEnter, onMouseMove, onMouseLeave, ...props }, ref) => {
|
|
54
|
+
const { registerHoveredElement, unregisterHoveredElement, updateElementDimensions } = chunkCLTLT5XW_js.useCursor();
|
|
55
|
+
const generatedId = react.useId();
|
|
56
|
+
const id = propId || `cursor-element-${generatedId}`;
|
|
57
|
+
const elementRef = react.useRef(null);
|
|
58
|
+
const handleMouseEnter = (event) => {
|
|
59
|
+
if (elementRef.current) {
|
|
60
|
+
const elementRect = elementRef.current.getBoundingClientRect();
|
|
61
|
+
const visibleRect = getVisibleRect(elementRef.current, elementRect);
|
|
62
|
+
registerHoveredElement(id, visibleRect, elementRef.current);
|
|
63
|
+
}
|
|
64
|
+
onMouseEnter == null ? void 0 : onMouseEnter(event);
|
|
65
|
+
};
|
|
66
|
+
const handleMouseMove = (event) => {
|
|
67
|
+
if (elementRef.current) {
|
|
68
|
+
const elementRect = elementRef.current.getBoundingClientRect();
|
|
69
|
+
const visibleRect = getVisibleRect(elementRef.current, elementRect);
|
|
70
|
+
updateElementDimensions(visibleRect);
|
|
71
|
+
}
|
|
72
|
+
onMouseMove == null ? void 0 : onMouseMove(event);
|
|
73
|
+
};
|
|
74
|
+
const handleMouseOut = (event) => {
|
|
75
|
+
var _a;
|
|
76
|
+
const rect = (_a = elementRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
77
|
+
if (rect) {
|
|
78
|
+
const { clientX, clientY } = event;
|
|
79
|
+
const isOutside = clientX < rect.left || clientX > rect.right || clientY < rect.top || clientY > rect.bottom;
|
|
80
|
+
if (isOutside) {
|
|
81
|
+
unregisterHoveredElement();
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
unregisterHoveredElement();
|
|
85
|
+
}
|
|
86
|
+
onMouseLeave == null ? void 0 : onMouseLeave(event);
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
Component,
|
|
90
|
+
{
|
|
91
|
+
...props,
|
|
92
|
+
id,
|
|
93
|
+
ref: (node) => {
|
|
94
|
+
if (typeof ref === "function") {
|
|
95
|
+
ref(node);
|
|
96
|
+
} else if (ref) {
|
|
97
|
+
ref.current = node;
|
|
98
|
+
}
|
|
99
|
+
elementRef.current = node;
|
|
100
|
+
},
|
|
101
|
+
onMouseEnter: handleMouseEnter,
|
|
102
|
+
onMouseMove: handleMouseMove,
|
|
103
|
+
onMouseOut: handleMouseOut
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
EnhancedComponent.displayName = `withCursor(${displayName})`;
|
|
109
|
+
return EnhancedComponent;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
exports.withCursor = withCursor;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SelectTrigger } from './chunk-KAPV3EZO.mjs';
|
|
2
|
+
import { Tabs } from './chunk-GA2JCN3F.mjs';
|
|
3
|
+
import { Textarea } from './chunk-JOBQTBEM.mjs';
|
|
4
|
+
import { Button } from './chunk-Q3APPCB2.mjs';
|
|
5
|
+
import { InputRoot } from './chunk-KVDEBKWR.mjs';
|
|
6
|
+
import { withCursor } from './chunk-CP7QYV4N.mjs';
|
|
7
|
+
|
|
8
|
+
// src/highlight-cursor/enhanced-components.tsx
|
|
9
|
+
var CursorButton = withCursor(Button);
|
|
10
|
+
var CursorTabs = withCursor(Tabs);
|
|
11
|
+
var CursorInputRoot = withCursor(InputRoot);
|
|
12
|
+
var CursorSelectTrigger = withCursor(SelectTrigger);
|
|
13
|
+
var CursorTextarea = withCursor(Textarea);
|
|
14
|
+
|
|
15
|
+
export { CursorButton, CursorInputRoot, CursorSelectTrigger, CursorTabs, CursorTextarea };
|