@nexus-cross/design-system 1.0.6-beta.2 → 1.0.6
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/DESIGN.md +185 -0
- package/cursor-rules/nexus-ui-api.mdc +223 -7
- package/cursor-rules/nexus-ui-components.mdc +44 -17
- package/dist/alert.d.mts +17 -0
- package/dist/alert.d.ts +17 -0
- package/dist/alert.js +16 -0
- package/dist/alert.mjs +3 -0
- package/dist/badge.d.mts +18 -0
- package/dist/badge.d.ts +18 -0
- package/dist/badge.js +16 -0
- package/dist/badge.mjs +3 -0
- package/dist/breadcrumb.d.mts +15 -0
- package/dist/breadcrumb.d.ts +15 -0
- package/dist/breadcrumb.js +12 -0
- package/dist/breadcrumb.mjs +3 -0
- package/dist/chunks/chunk-2N2EPBO4.js +120 -0
- package/dist/chunks/{chunk-AFSEYJZT.js → chunk-2T7RUYEK.js} +175 -50
- package/dist/chunks/chunk-2UPGFY6E.mjs +76 -0
- package/dist/chunks/chunk-3ZWN66YH.js +53 -0
- package/dist/chunks/chunk-5PQ3UCKF.js +99 -0
- package/dist/chunks/chunk-6BWOKTVQ.mjs +87 -0
- package/dist/chunks/chunk-6DBRL6NA.mjs +81 -0
- package/dist/chunks/chunk-B5O6W3Z4.mjs +73 -0
- package/dist/chunks/chunk-BJM3NDT2.mjs +368 -0
- package/dist/chunks/chunk-C2DSAJTL.js +109 -0
- package/dist/chunks/chunk-CUTMLBC3.mjs +86 -0
- package/dist/chunks/chunk-CV4GMFWP.js +174 -0
- package/dist/chunks/chunk-DICN6GKE.js +99 -0
- package/dist/chunks/chunk-DYPPVXQF.js +143 -0
- package/dist/chunks/chunk-EJY7IVSK.mjs +31 -0
- package/dist/chunks/chunk-FUIBYZZ4.mjs +98 -0
- package/dist/chunks/{chunk-HNLI646G.mjs → chunk-GN6X27QI.mjs} +9 -2
- package/dist/chunks/chunk-H2G5FMRN.mjs +75 -0
- package/dist/chunks/chunk-H2V7RHYV.mjs +120 -0
- package/dist/chunks/chunk-MMCA33FW.mjs +85 -0
- package/dist/chunks/chunk-NZHK76R3.js +109 -0
- package/dist/chunks/chunk-P73MEU7N.mjs +150 -0
- package/dist/chunks/chunk-PDJTSQOC.js +59 -0
- package/dist/chunks/chunk-PXBZEAZQ.mjs +5 -0
- package/dist/chunks/chunk-QRNHFOLG.js +7 -0
- package/dist/chunks/chunk-S2GMEC43.js +109 -0
- package/dist/chunks/{chunk-VGO4Z2WH.js → chunk-SUIT4XKB.js} +8 -1
- package/dist/chunks/chunk-X3CTJ7TD.js +108 -0
- package/dist/chunks/chunk-XGIJZ3NZ.js +160 -0
- package/dist/chunks/chunk-YO5MSDPX.mjs +36 -0
- package/dist/chunks/chunk-ZI4LN2B2.js +96 -0
- package/dist/chunks/chunk-ZU4AWAFT.mjs +137 -0
- package/dist/date-picker.d.mts +17 -0
- package/dist/date-picker.d.ts +17 -0
- package/dist/date-picker.js +12 -0
- package/dist/date-picker.mjs +3 -0
- package/dist/dropdown-menu.d.mts +30 -0
- package/dist/dropdown-menu.d.ts +30 -0
- package/dist/dropdown-menu.js +32 -0
- package/dist/dropdown-menu.mjs +3 -0
- package/dist/empty-state.d.mts +16 -0
- package/dist/empty-state.d.ts +16 -0
- package/dist/empty-state.js +16 -0
- package/dist/empty-state.mjs +3 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +269 -157
- package/dist/index.mjs +30 -18
- package/dist/modal/index.js +12 -12
- package/dist/modal/index.mjs +3 -3
- package/dist/number-input.d.mts +5 -6
- package/dist/number-input.d.ts +5 -6
- package/dist/number-input.js +4 -4
- package/dist/number-input.mjs +1 -1
- package/dist/nx-image.d.mts +13 -0
- package/dist/nx-image.d.ts +13 -0
- package/dist/nx-image.js +12 -0
- package/dist/nx-image.mjs +3 -0
- package/dist/progress.d.mts +18 -0
- package/dist/progress.d.ts +18 -0
- package/dist/progress.js +16 -0
- package/dist/progress.mjs +3 -0
- package/dist/schemas/_all.json +840 -13
- package/dist/schemas/alert.json +49 -0
- package/dist/schemas/badge.json +76 -0
- package/dist/schemas/breadcrumb.json +47 -0
- package/dist/schemas/datePicker.json +56 -0
- package/dist/schemas/dropdownMenu.json +83 -0
- package/dist/schemas/emptyState.json +44 -0
- package/dist/schemas/numberInput.json +27 -8
- package/dist/schemas/nxImage.json +56 -0
- package/dist/schemas/progress.json +63 -0
- package/dist/schemas/slider.json +78 -0
- package/dist/schemas/stepper.json +73 -0
- package/dist/schemas/tagInput.json +70 -0
- package/dist/schemas/textArea.json +26 -1
- package/dist/schemas/toggleGroup.json +88 -0
- package/dist/schemas.d.mts +628 -144
- package/dist/schemas.d.ts +628 -144
- package/dist/schemas.js +177 -7
- package/dist/schemas.mjs +166 -8
- package/dist/slider.d.mts +20 -0
- package/dist/slider.d.ts +20 -0
- package/dist/slider.js +16 -0
- package/dist/slider.mjs +3 -0
- package/dist/stepper.d.mts +20 -0
- package/dist/stepper.d.ts +20 -0
- package/dist/stepper.js +16 -0
- package/dist/stepper.mjs +3 -0
- package/dist/styles/layer.js +2 -2
- package/dist/styles/layer.mjs +1 -1
- package/dist/styles.css +1615 -185
- package/dist/styles.js +2 -2
- package/dist/styles.layered.css +1615 -185
- package/dist/styles.mjs +1 -1
- package/dist/table.d.mts +40 -25
- package/dist/table.d.ts +40 -25
- package/dist/table.js +7 -7
- package/dist/table.mjs +1 -1
- package/dist/tag-input.d.mts +21 -0
- package/dist/tag-input.d.ts +21 -0
- package/dist/tag-input.js +16 -0
- package/dist/tag-input.mjs +3 -0
- package/dist/text-area.d.mts +5 -1
- package/dist/text-area.d.ts +5 -1
- package/dist/text-area.js +3 -3
- package/dist/text-area.mjs +1 -1
- package/dist/toggle-group.d.mts +36 -0
- package/dist/toggle-group.d.ts +36 -0
- package/dist/toggle-group.js +16 -0
- package/dist/toggle-group.mjs +3 -0
- package/package.json +69 -3
- package/scripts/setup-cursor-rules.cjs +15 -1
- package/dist/chunks/chunk-26BUGBOY.mjs +0 -57
- package/dist/chunks/chunk-CLGH2RTS.js +0 -7
- package/dist/chunks/chunk-ECVAVQUY.mjs +0 -243
- package/dist/chunks/chunk-UPCWJWXR.mjs +0 -5
- package/dist/chunks/chunk-WR55D4ZS.js +0 -80
- package/dist/chunks/{chunk-3VFBPFZF.mjs → chunk-CWMLTXOH.mjs} +2 -2
- package/dist/chunks/{chunk-U53UA76K.js → chunk-HFBTS42N.js} +2 -2
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var tagInputVariants = cva("nexus-tag-input", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
sm: "nexus-tag-input--sm",
|
|
10
|
+
md: "nexus-tag-input--md",
|
|
11
|
+
lg: "nexus-tag-input--lg"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { size: "md" }
|
|
15
|
+
});
|
|
16
|
+
var CloseIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8", strokeLinecap: "round" }) });
|
|
17
|
+
var TagInput = React.forwardRef(
|
|
18
|
+
({
|
|
19
|
+
className,
|
|
20
|
+
size,
|
|
21
|
+
value,
|
|
22
|
+
defaultValue = [],
|
|
23
|
+
onChange,
|
|
24
|
+
placeholder = "\uD0DC\uADF8 \uC785\uB825 \uD6C4 Enter",
|
|
25
|
+
max,
|
|
26
|
+
disabled,
|
|
27
|
+
allowDuplicates = false,
|
|
28
|
+
label,
|
|
29
|
+
description,
|
|
30
|
+
...props
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const [internalTags, setInternalTags] = React.useState(defaultValue);
|
|
33
|
+
const [inputValue, setInputValue] = React.useState("");
|
|
34
|
+
const inputRef = React.useRef(null);
|
|
35
|
+
const tags = value ?? internalTags;
|
|
36
|
+
const updateTags = React.useCallback(
|
|
37
|
+
(next) => {
|
|
38
|
+
if (!value) setInternalTags(next);
|
|
39
|
+
onChange?.(next);
|
|
40
|
+
},
|
|
41
|
+
[value, onChange]
|
|
42
|
+
);
|
|
43
|
+
const addTag = React.useCallback(
|
|
44
|
+
(tag) => {
|
|
45
|
+
const trimmed = tag.trim();
|
|
46
|
+
if (!trimmed) return;
|
|
47
|
+
if (!allowDuplicates && tags.includes(trimmed)) return;
|
|
48
|
+
if (max && tags.length >= max) return;
|
|
49
|
+
updateTags([...tags, trimmed]);
|
|
50
|
+
setInputValue("");
|
|
51
|
+
},
|
|
52
|
+
[tags, allowDuplicates, max, updateTags]
|
|
53
|
+
);
|
|
54
|
+
const removeTag = React.useCallback(
|
|
55
|
+
(index) => {
|
|
56
|
+
updateTags(tags.filter((_, i) => i !== index));
|
|
57
|
+
},
|
|
58
|
+
[tags, updateTags]
|
|
59
|
+
);
|
|
60
|
+
const handleKeyDown = React.useCallback(
|
|
61
|
+
(e) => {
|
|
62
|
+
if (e.key === "Enter") {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
addTag(inputValue);
|
|
65
|
+
} else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
|
|
66
|
+
removeTag(tags.length - 1);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
[inputValue, tags, addTag, removeTag]
|
|
70
|
+
);
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cn("nexus-tag-input-wrapper", className), ...props, children: [
|
|
72
|
+
label && /* @__PURE__ */ jsx("label", { className: "nexus-tag-input__label", children: label }),
|
|
73
|
+
/* @__PURE__ */ jsxs(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: cn(
|
|
77
|
+
tagInputVariants({ size }),
|
|
78
|
+
disabled && "nexus-tag-input--disabled"
|
|
79
|
+
),
|
|
80
|
+
onClick: () => inputRef.current?.focus(),
|
|
81
|
+
children: [
|
|
82
|
+
tags.map((tag, i) => /* @__PURE__ */ jsxs("span", { className: "nexus-tag-input__tag", children: [
|
|
83
|
+
/* @__PURE__ */ jsx("span", { children: tag }),
|
|
84
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
type: "button",
|
|
88
|
+
className: "nexus-tag-input__tag-close",
|
|
89
|
+
onClick: (e) => {
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
removeTag(i);
|
|
92
|
+
},
|
|
93
|
+
"aria-label": `Remove ${tag}`,
|
|
94
|
+
children: /* @__PURE__ */ jsx(CloseIcon, { className: "nexus-tag-input__tag-close-icon" })
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }, `${tag}-${i}`)),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
"input",
|
|
100
|
+
{
|
|
101
|
+
ref: inputRef,
|
|
102
|
+
className: "nexus-tag-input__input",
|
|
103
|
+
value: inputValue,
|
|
104
|
+
onChange: (e) => setInputValue(e.target.value),
|
|
105
|
+
onKeyDown: handleKeyDown,
|
|
106
|
+
placeholder: tags.length === 0 ? placeholder : "",
|
|
107
|
+
disabled,
|
|
108
|
+
"aria-label": label ?? "Tag input"
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
description && /* @__PURE__ */ jsx("p", { className: "nexus-tag-input__description", children: description })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
TagInput.displayName = "TagInput";
|
|
119
|
+
|
|
120
|
+
export { TagInput, tagInputVariants };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var stepperVariants = cva("nexus-stepper", {
|
|
7
|
+
variants: {
|
|
8
|
+
orientation: {
|
|
9
|
+
horizontal: "nexus-stepper--horizontal",
|
|
10
|
+
vertical: "nexus-stepper--vertical"
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
sm: "nexus-stepper--sm",
|
|
14
|
+
md: "nexus-stepper--md"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
orientation: "horizontal",
|
|
19
|
+
size: "md"
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var CheckIcon = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-6", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
23
|
+
var Stepper = React.forwardRef(
|
|
24
|
+
({ className, orientation, size, steps, current = 0, status = "process", ...props }, ref) => {
|
|
25
|
+
const isHorizontal = orientation !== "vertical";
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
ref,
|
|
30
|
+
className: cn(stepperVariants({ orientation, size }), className),
|
|
31
|
+
"aria-label": "Progress",
|
|
32
|
+
...props,
|
|
33
|
+
children: steps.map((step, i) => {
|
|
34
|
+
const state = i < current ? "completed" : i === current ? status === "error" ? "error" : "active" : "pending";
|
|
35
|
+
const isFirst = i === 0;
|
|
36
|
+
const isLast = i === steps.length - 1;
|
|
37
|
+
const prevCompleted = i <= current;
|
|
38
|
+
const nextCompleted = i < current;
|
|
39
|
+
return /* @__PURE__ */ jsxs(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: cn("nexus-stepper__step", `nexus-stepper__step--${state}`),
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("div", { className: "nexus-stepper__indicator-wrap", children: isHorizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
className: cn(
|
|
49
|
+
"nexus-stepper__connector",
|
|
50
|
+
isFirst && "nexus-stepper__connector--hidden",
|
|
51
|
+
prevCompleted && "nexus-stepper__connector--completed"
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx("div", { className: "nexus-stepper__indicator", children: state === "completed" ? /* @__PURE__ */ jsx(CheckIcon, { className: "nexus-stepper__check" }) : /* @__PURE__ */ jsx("span", { children: i + 1 }) }),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: cn(
|
|
60
|
+
"nexus-stepper__connector",
|
|
61
|
+
isLast && "nexus-stepper__connector--hidden",
|
|
62
|
+
nextCompleted && "nexus-stepper__connector--completed"
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
+
!isFirst && /* @__PURE__ */ jsx("div", { className: cn("nexus-stepper__connector", prevCompleted && "nexus-stepper__connector--completed") }),
|
|
68
|
+
/* @__PURE__ */ jsx("div", { className: "nexus-stepper__indicator", children: state === "completed" ? /* @__PURE__ */ jsx(CheckIcon, { className: "nexus-stepper__check" }) : /* @__PURE__ */ jsx("span", { children: i + 1 }) })
|
|
69
|
+
] }) }),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { className: "nexus-stepper__content", children: [
|
|
71
|
+
/* @__PURE__ */ jsx("span", { className: "nexus-stepper__label", children: step.label }),
|
|
72
|
+
step.description && /* @__PURE__ */ jsx("span", { className: "nexus-stepper__description", children: step.description })
|
|
73
|
+
] })
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
i
|
|
77
|
+
);
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
Stepper.displayName = "Stepper";
|
|
84
|
+
|
|
85
|
+
export { Stepper, stepperVariants };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var React = require('react');
|
|
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 React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
var ImageIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
30
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M21 15l-5-5L5 21" })
|
|
31
|
+
] });
|
|
32
|
+
var NxImage = React__namespace.forwardRef(
|
|
33
|
+
({
|
|
34
|
+
className,
|
|
35
|
+
src,
|
|
36
|
+
alt,
|
|
37
|
+
fallback,
|
|
38
|
+
fallbackSrc,
|
|
39
|
+
aspectRatio,
|
|
40
|
+
objectFit = "cover",
|
|
41
|
+
lazy = true,
|
|
42
|
+
wrapperClassName,
|
|
43
|
+
style,
|
|
44
|
+
onError,
|
|
45
|
+
onLoad,
|
|
46
|
+
...props
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const [status, setStatus] = React__namespace.useState(
|
|
49
|
+
"loading"
|
|
50
|
+
);
|
|
51
|
+
React__namespace.useEffect(() => {
|
|
52
|
+
setStatus("loading");
|
|
53
|
+
}, [src]);
|
|
54
|
+
const handleLoad = React__namespace.useCallback(
|
|
55
|
+
(e) => {
|
|
56
|
+
setStatus("loaded");
|
|
57
|
+
onLoad?.(e);
|
|
58
|
+
},
|
|
59
|
+
[onLoad]
|
|
60
|
+
);
|
|
61
|
+
const handleError = React__namespace.useCallback(
|
|
62
|
+
(e) => {
|
|
63
|
+
if (fallbackSrc && e.currentTarget.src !== fallbackSrc) {
|
|
64
|
+
e.currentTarget.src = fallbackSrc;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setStatus("error");
|
|
68
|
+
onError?.(e);
|
|
69
|
+
},
|
|
70
|
+
[fallbackSrc, onError]
|
|
71
|
+
);
|
|
72
|
+
const wrapperStyle = {
|
|
73
|
+
...style,
|
|
74
|
+
...aspectRatio ? { aspectRatio } : {}
|
|
75
|
+
};
|
|
76
|
+
const showFallback = status === "error" || !src;
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: chunkCZC76ZD5_js.cn("nexus-image", wrapperClassName),
|
|
81
|
+
style: wrapperStyle,
|
|
82
|
+
children: showFallback ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-image__fallback", children: fallback ?? /* @__PURE__ */ jsxRuntime.jsx(ImageIcon, { className: "nexus-image__fallback-icon" }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
83
|
+
status === "loading" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-image__skeleton" }),
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
85
|
+
"img",
|
|
86
|
+
{
|
|
87
|
+
ref,
|
|
88
|
+
src,
|
|
89
|
+
alt: alt ?? "",
|
|
90
|
+
loading: lazy ? "lazy" : "eager",
|
|
91
|
+
className: chunkCZC76ZD5_js.cn(
|
|
92
|
+
"nexus-image__img",
|
|
93
|
+
`nexus-image__img--${objectFit}`,
|
|
94
|
+
status === "loaded" && "nexus-image__img--loaded",
|
|
95
|
+
className
|
|
96
|
+
),
|
|
97
|
+
onLoad: handleLoad,
|
|
98
|
+
onError: handleError,
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
] })
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
NxImage.displayName = "NxImage";
|
|
108
|
+
|
|
109
|
+
exports.NxImage = NxImage;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var toggleGroupVariants = cva("nexus-toggle-group", {
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "nexus-toggle-group--default",
|
|
11
|
+
outline: "nexus-toggle-group--outline"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
sm: "nexus-toggle-group--sm",
|
|
15
|
+
md: "nexus-toggle-group--md",
|
|
16
|
+
lg: "nexus-toggle-group--lg"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "default",
|
|
21
|
+
size: "md"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var ToggleGroup = React.forwardRef(
|
|
25
|
+
({ className, variant, size, items, disabled, ...props }, ref) => {
|
|
26
|
+
const rootRef = React.useRef(null);
|
|
27
|
+
const [animated, setAnimated] = React.useState(false);
|
|
28
|
+
const [pos, setPos] = React.useState(null);
|
|
29
|
+
const combinedRef = React.useCallback(
|
|
30
|
+
(node) => {
|
|
31
|
+
rootRef.current = node;
|
|
32
|
+
if (typeof ref === "function") ref(node);
|
|
33
|
+
else if (ref) ref.current = node;
|
|
34
|
+
},
|
|
35
|
+
[ref]
|
|
36
|
+
);
|
|
37
|
+
const currentValue = props.type === "multiple" ? props.value ?? props.defaultValue : props.value ?? props.defaultValue;
|
|
38
|
+
const [trackedValue, setTrackedValue] = React.useState(currentValue);
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
if (currentValue !== void 0) setTrackedValue(currentValue);
|
|
41
|
+
}, [currentValue]);
|
|
42
|
+
const isDefault = variant !== "outline";
|
|
43
|
+
React.useLayoutEffect(() => {
|
|
44
|
+
const root = rootRef.current;
|
|
45
|
+
if (!root || !isDefault) return;
|
|
46
|
+
const activeVal = Array.isArray(trackedValue) ? trackedValue[0] : trackedValue;
|
|
47
|
+
if (!activeVal) {
|
|
48
|
+
setPos(null);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const idx = items.findIndex((item) => item.value === activeVal);
|
|
52
|
+
if (idx === -1) {
|
|
53
|
+
setPos(null);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const itemEls = root.querySelectorAll(
|
|
57
|
+
".nexus-toggle-group__item"
|
|
58
|
+
);
|
|
59
|
+
const el = itemEls[idx];
|
|
60
|
+
if (!el) return;
|
|
61
|
+
const rootRect = root.getBoundingClientRect();
|
|
62
|
+
const elRect = el.getBoundingClientRect();
|
|
63
|
+
setPos({
|
|
64
|
+
width: elRect.width,
|
|
65
|
+
height: elRect.height,
|
|
66
|
+
x: elRect.left - rootRect.left,
|
|
67
|
+
y: elRect.top - rootRect.top
|
|
68
|
+
});
|
|
69
|
+
}, [trackedValue, items, isDefault]);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
const frame = requestAnimationFrame(() => {
|
|
72
|
+
requestAnimationFrame(() => setAnimated(true));
|
|
73
|
+
});
|
|
74
|
+
return () => cancelAnimationFrame(frame);
|
|
75
|
+
}, []);
|
|
76
|
+
const handleSingleChange = React.useCallback(
|
|
77
|
+
(val) => {
|
|
78
|
+
setTrackedValue(val);
|
|
79
|
+
if (props.type !== "multiple") {
|
|
80
|
+
props.onValueChange?.(val);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[props.type, props.onValueChange]
|
|
84
|
+
);
|
|
85
|
+
const handleMultipleChange = React.useCallback(
|
|
86
|
+
(val) => {
|
|
87
|
+
setTrackedValue(val);
|
|
88
|
+
if (props.type === "multiple") {
|
|
89
|
+
props.onValueChange?.(val);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
[props.type, props.onValueChange]
|
|
93
|
+
);
|
|
94
|
+
const rootProps = props.type === "multiple" ? {
|
|
95
|
+
type: "multiple",
|
|
96
|
+
value: props.value,
|
|
97
|
+
defaultValue: props.defaultValue,
|
|
98
|
+
onValueChange: handleMultipleChange
|
|
99
|
+
} : {
|
|
100
|
+
type: "single",
|
|
101
|
+
value: props.value,
|
|
102
|
+
defaultValue: props.defaultValue,
|
|
103
|
+
onValueChange: handleSingleChange
|
|
104
|
+
};
|
|
105
|
+
const indicatorStyle = pos ? {
|
|
106
|
+
width: pos.width,
|
|
107
|
+
height: pos.height,
|
|
108
|
+
transform: `translate(${pos.x}px, ${pos.y}px)`,
|
|
109
|
+
opacity: 1
|
|
110
|
+
} : { opacity: 0 };
|
|
111
|
+
return /* @__PURE__ */ jsxs(
|
|
112
|
+
ToggleGroupPrimitive.Root,
|
|
113
|
+
{
|
|
114
|
+
ref: combinedRef,
|
|
115
|
+
className: cn(toggleGroupVariants({ variant, size }), className),
|
|
116
|
+
disabled,
|
|
117
|
+
...rootProps,
|
|
118
|
+
children: [
|
|
119
|
+
isDefault && /* @__PURE__ */ jsx(
|
|
120
|
+
"span",
|
|
121
|
+
{
|
|
122
|
+
className: cn(
|
|
123
|
+
"nexus-toggle-group__indicator",
|
|
124
|
+
animated && "nexus-toggle-group__indicator--animated"
|
|
125
|
+
),
|
|
126
|
+
style: indicatorStyle,
|
|
127
|
+
"aria-hidden": true
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
items.map((item) => /* @__PURE__ */ jsxs(
|
|
131
|
+
ToggleGroupPrimitive.Item,
|
|
132
|
+
{
|
|
133
|
+
value: item.value,
|
|
134
|
+
disabled: item.disabled,
|
|
135
|
+
className: "nexus-toggle-group__item",
|
|
136
|
+
children: [
|
|
137
|
+
item.icon && /* @__PURE__ */ jsx("span", { className: "nexus-toggle-group__icon", children: item.icon }),
|
|
138
|
+
item.label && /* @__PURE__ */ jsx("span", { children: item.label })
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
item.value
|
|
142
|
+
))
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
ToggleGroup.displayName = "ToggleGroup";
|
|
149
|
+
|
|
150
|
+
export { ToggleGroup, toggleGroupVariants };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
|
+
var React = require('react');
|
|
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 React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
var emptyStateVariants = classVarianceAuthority.cva("nexus-empty-state", {
|
|
29
|
+
variants: {
|
|
30
|
+
size: {
|
|
31
|
+
sm: "nexus-empty-state--sm",
|
|
32
|
+
md: "nexus-empty-state--md",
|
|
33
|
+
lg: "nexus-empty-state--lg"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: { size: "md" }
|
|
37
|
+
});
|
|
38
|
+
var DefaultIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
39
|
+
var EmptyState = React__namespace.forwardRef(
|
|
40
|
+
({ className, size, icon, title, description, action, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
className: chunkCZC76ZD5_js.cn(emptyStateVariants({ size }), className),
|
|
45
|
+
...props,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-empty-state__icon", children: icon ?? /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, { className: "nexus-empty-state__default-icon" }) }),
|
|
48
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "nexus-empty-state__title", children: title }),
|
|
49
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "nexus-empty-state__description", children: description }),
|
|
50
|
+
children,
|
|
51
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-empty-state__action", children: action })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
EmptyState.displayName = "EmptyState";
|
|
57
|
+
|
|
58
|
+
exports.EmptyState = EmptyState;
|
|
59
|
+
exports.emptyStateVariants = emptyStateVariants;
|