@nexus-cross/design-system 1.0.11 → 1.0.13
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/cursor-rules/CLAUDE.md +80 -0
- package/dist/chunks/{chunk-XKJO5Y4J.mjs → chunk-5J63FUAS.mjs} +3 -3
- package/dist/chunks/{chunk-6J7TZ4GP.mjs → chunk-6ECGMUT6.mjs} +1 -1
- package/dist/chunks/{chunk-CV4GMFWP.js → chunk-K574BYHQ.js} +11 -9
- package/dist/chunks/{chunk-2XV3XP3Y.js → chunk-LAGQ7J5A.js} +3 -3
- package/dist/chunks/{chunk-7B2CTQKB.js → chunk-V35IEPRL.js} +1 -1
- package/dist/chunks/{chunk-P73MEU7N.mjs → chunk-Z4YM7LU3.mjs} +11 -9
- package/dist/components/ImageUpload.d.ts.map +1 -1
- package/dist/components/ToggleGroup.d.ts +4 -1
- package/dist/components/ToggleGroup.d.ts.map +1 -1
- package/dist/image-upload.js +3 -3
- package/dist/image-upload.mjs +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +2 -2
- package/dist/schemas/_all.json +12 -2
- package/dist/schemas/toggle-group.d.ts +11 -3
- package/dist/schemas/toggle-group.d.ts.map +1 -1
- package/dist/schemas/toggleGroup.json +12 -2
- package/dist/schemas.js +4 -2
- package/dist/schemas.mjs +4 -2
- package/dist/styles/.generated/built.d.ts +1 -1
- package/dist/styles/.generated/built.d.ts.map +1 -1
- package/dist/styles/layer.js +2 -2
- package/dist/styles/layer.mjs +1 -1
- package/dist/styles.css +31 -16
- package/dist/styles.js +2 -2
- package/dist/styles.layered.css +31 -16
- package/dist/styles.mjs +1 -1
- package/dist/toggle-group.js +3 -3
- package/dist/toggle-group.mjs +1 -1
- package/package.json +2 -2
- package/scripts/setup-cursor-rules.cjs +14 -0
|
@@ -31,7 +31,8 @@ var toggleGroupVariants = classVarianceAuthority.cva("nexus-toggle-group", {
|
|
|
31
31
|
variants: {
|
|
32
32
|
variant: {
|
|
33
33
|
default: "nexus-toggle-group--default",
|
|
34
|
-
|
|
34
|
+
primary: "nexus-toggle-group--primary",
|
|
35
|
+
secondary: "nexus-toggle-group--secondary"
|
|
35
36
|
},
|
|
36
37
|
size: {
|
|
37
38
|
sm: "nexus-toggle-group--sm",
|
|
@@ -45,7 +46,7 @@ var toggleGroupVariants = classVarianceAuthority.cva("nexus-toggle-group", {
|
|
|
45
46
|
}
|
|
46
47
|
});
|
|
47
48
|
var ToggleGroup = React__namespace.forwardRef(
|
|
48
|
-
({ className, variant, size, items, disabled, ...props }, ref) => {
|
|
49
|
+
({ className, variant, size, items, disabled, required = true, ...props }, ref) => {
|
|
49
50
|
const rootRef = React__namespace.useRef(null);
|
|
50
51
|
const [animated, setAnimated] = React__namespace.useState(false);
|
|
51
52
|
const [pos, setPos] = React__namespace.useState(null);
|
|
@@ -62,10 +63,9 @@ var ToggleGroup = React__namespace.forwardRef(
|
|
|
62
63
|
React__namespace.useEffect(() => {
|
|
63
64
|
if (currentValue !== void 0) setTrackedValue(currentValue);
|
|
64
65
|
}, [currentValue]);
|
|
65
|
-
const isDefault = variant !== "outline";
|
|
66
66
|
React__namespace.useLayoutEffect(() => {
|
|
67
67
|
const root = rootRef.current;
|
|
68
|
-
if (!root
|
|
68
|
+
if (!root) return;
|
|
69
69
|
const activeVal = Array.isArray(trackedValue) ? trackedValue[0] : trackedValue;
|
|
70
70
|
if (!activeVal) {
|
|
71
71
|
setPos(null);
|
|
@@ -89,7 +89,7 @@ var ToggleGroup = React__namespace.forwardRef(
|
|
|
89
89
|
x: elRect.left - rootRect.left,
|
|
90
90
|
y: elRect.top - rootRect.top
|
|
91
91
|
});
|
|
92
|
-
}, [trackedValue, items
|
|
92
|
+
}, [trackedValue, items]);
|
|
93
93
|
React__namespace.useEffect(() => {
|
|
94
94
|
const frame = requestAnimationFrame(() => {
|
|
95
95
|
requestAnimationFrame(() => setAnimated(true));
|
|
@@ -98,21 +98,23 @@ var ToggleGroup = React__namespace.forwardRef(
|
|
|
98
98
|
}, []);
|
|
99
99
|
const handleSingleChange = React__namespace.useCallback(
|
|
100
100
|
(val) => {
|
|
101
|
+
if (required && !val) return;
|
|
101
102
|
setTrackedValue(val);
|
|
102
103
|
if (props.type !== "multiple") {
|
|
103
104
|
props.onValueChange?.(val);
|
|
104
105
|
}
|
|
105
106
|
},
|
|
106
|
-
[props.type, props.onValueChange]
|
|
107
|
+
[props.type, props.onValueChange, required]
|
|
107
108
|
);
|
|
108
109
|
const handleMultipleChange = React__namespace.useCallback(
|
|
109
110
|
(val) => {
|
|
111
|
+
if (required && val.length === 0) return;
|
|
110
112
|
setTrackedValue(val);
|
|
111
113
|
if (props.type === "multiple") {
|
|
112
114
|
props.onValueChange?.(val);
|
|
113
115
|
}
|
|
114
116
|
},
|
|
115
|
-
[props.type, props.onValueChange]
|
|
117
|
+
[props.type, props.onValueChange, required]
|
|
116
118
|
);
|
|
117
119
|
const rootProps = props.type === "multiple" ? {
|
|
118
120
|
type: "multiple",
|
|
@@ -139,7 +141,7 @@ var ToggleGroup = React__namespace.forwardRef(
|
|
|
139
141
|
disabled,
|
|
140
142
|
...rootProps,
|
|
141
143
|
children: [
|
|
142
|
-
|
|
144
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
143
145
|
"span",
|
|
144
146
|
{
|
|
145
147
|
className: chunkCZC76ZD5_js.cn(
|
|
@@ -155,7 +157,7 @@ var ToggleGroup = React__namespace.forwardRef(
|
|
|
155
157
|
{
|
|
156
158
|
value: item.value,
|
|
157
159
|
disabled: item.disabled,
|
|
158
|
-
className: "nexus-toggle-group__item",
|
|
160
|
+
className: chunkCZC76ZD5_js.cn("nexus-toggle-group__item", item.className),
|
|
159
161
|
children: [
|
|
160
162
|
item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-toggle-group__icon", children: item.icon }),
|
|
161
163
|
item.label && /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
|
|
@@ -193,15 +193,15 @@ var ImageUpload = React__namespace.forwardRef(
|
|
|
193
193
|
!hasField && className
|
|
194
194
|
),
|
|
195
195
|
children: [
|
|
196
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-image-upload__preview-
|
|
197
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
196
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-image-upload__preview-area", children: [
|
|
197
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-image-upload__preview-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
198
198
|
"img",
|
|
199
199
|
{
|
|
200
200
|
src: preview,
|
|
201
201
|
alt: "Uploaded preview",
|
|
202
202
|
className: "nexus-image-upload__preview"
|
|
203
203
|
}
|
|
204
|
-
),
|
|
204
|
+
) }),
|
|
205
205
|
!disabled && /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
206
|
"button",
|
|
207
207
|
{
|