@nexus-cross/design-system 1.0.3 → 1.0.4

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.
Files changed (109) hide show
  1. package/cursor-rules/nexus-ui-api.mdc +208 -0
  2. package/dist/alert.d.mts +17 -0
  3. package/dist/alert.d.ts +17 -0
  4. package/dist/alert.js +16 -0
  5. package/dist/alert.mjs +3 -0
  6. package/dist/badge.d.mts +18 -0
  7. package/dist/badge.d.ts +18 -0
  8. package/dist/badge.js +16 -0
  9. package/dist/badge.mjs +3 -0
  10. package/dist/breadcrumb.d.mts +15 -0
  11. package/dist/breadcrumb.d.ts +15 -0
  12. package/dist/breadcrumb.js +12 -0
  13. package/dist/breadcrumb.mjs +3 -0
  14. package/dist/chunks/chunk-2N2EPBO4.js +120 -0
  15. package/dist/chunks/chunk-2UPGFY6E.mjs +76 -0
  16. package/dist/chunks/chunk-3ZWN66YH.js +53 -0
  17. package/dist/chunks/chunk-5PQ3UCKF.js +99 -0
  18. package/dist/chunks/chunk-6BWOKTVQ.mjs +87 -0
  19. package/dist/chunks/chunk-6DBRL6NA.mjs +81 -0
  20. package/dist/chunks/chunk-B5O6W3Z4.mjs +73 -0
  21. package/dist/chunks/chunk-C2DSAJTL.js +109 -0
  22. package/dist/chunks/chunk-CUTMLBC3.mjs +86 -0
  23. package/dist/chunks/chunk-CV4GMFWP.js +174 -0
  24. package/dist/chunks/chunk-DICN6GKE.js +99 -0
  25. package/dist/chunks/chunk-DYPPVXQF.js +143 -0
  26. package/dist/chunks/chunk-EJY7IVSK.mjs +31 -0
  27. package/dist/chunks/chunk-FUIBYZZ4.mjs +98 -0
  28. package/dist/chunks/chunk-H2G5FMRN.mjs +75 -0
  29. package/dist/chunks/chunk-H2V7RHYV.mjs +120 -0
  30. package/dist/chunks/chunk-KZ7S5VN2.js +7 -0
  31. package/dist/chunks/chunk-MMCA33FW.mjs +85 -0
  32. package/dist/chunks/chunk-NZHK76R3.js +109 -0
  33. package/dist/chunks/chunk-P73MEU7N.mjs +150 -0
  34. package/dist/chunks/chunk-PDJTSQOC.js +59 -0
  35. package/dist/chunks/chunk-PI464222.mjs +5 -0
  36. package/dist/chunks/chunk-S2GMEC43.js +109 -0
  37. package/dist/chunks/chunk-X3CTJ7TD.js +108 -0
  38. package/dist/chunks/chunk-YO5MSDPX.mjs +36 -0
  39. package/dist/chunks/chunk-ZI4LN2B2.js +96 -0
  40. package/dist/date-picker.d.mts +17 -0
  41. package/dist/date-picker.d.ts +17 -0
  42. package/dist/date-picker.js +12 -0
  43. package/dist/date-picker.mjs +3 -0
  44. package/dist/dropdown-menu.d.mts +30 -0
  45. package/dist/dropdown-menu.d.ts +30 -0
  46. package/dist/dropdown-menu.js +32 -0
  47. package/dist/dropdown-menu.mjs +3 -0
  48. package/dist/empty-state.d.mts +16 -0
  49. package/dist/empty-state.d.ts +16 -0
  50. package/dist/empty-state.js +16 -0
  51. package/dist/empty-state.mjs +3 -0
  52. package/dist/index.d.mts +14 -0
  53. package/dist/index.d.ts +14 -0
  54. package/dist/index.js +267 -155
  55. package/dist/index.mjs +28 -16
  56. package/dist/modal/index.js +12 -12
  57. package/dist/modal/index.mjs +3 -3
  58. package/dist/nx-image.d.mts +13 -0
  59. package/dist/nx-image.d.ts +13 -0
  60. package/dist/nx-image.js +12 -0
  61. package/dist/nx-image.mjs +3 -0
  62. package/dist/progress.d.mts +18 -0
  63. package/dist/progress.d.ts +18 -0
  64. package/dist/progress.js +16 -0
  65. package/dist/progress.mjs +3 -0
  66. package/dist/schemas/_all.json +787 -4
  67. package/dist/schemas/alert.json +49 -0
  68. package/dist/schemas/badge.json +76 -0
  69. package/dist/schemas/breadcrumb.json +47 -0
  70. package/dist/schemas/datePicker.json +56 -0
  71. package/dist/schemas/dropdownMenu.json +83 -0
  72. package/dist/schemas/emptyState.json +44 -0
  73. package/dist/schemas/nxImage.json +56 -0
  74. package/dist/schemas/progress.json +63 -0
  75. package/dist/schemas/slider.json +78 -0
  76. package/dist/schemas/stepper.json +73 -0
  77. package/dist/schemas/tagInput.json +70 -0
  78. package/dist/schemas/toggleGroup.json +88 -0
  79. package/dist/schemas.d.mts +603 -143
  80. package/dist/schemas.d.ts +603 -143
  81. package/dist/schemas.js +160 -0
  82. package/dist/schemas.mjs +149 -1
  83. package/dist/slider.d.mts +20 -0
  84. package/dist/slider.d.ts +20 -0
  85. package/dist/slider.js +16 -0
  86. package/dist/slider.mjs +3 -0
  87. package/dist/stepper.d.mts +20 -0
  88. package/dist/stepper.d.ts +20 -0
  89. package/dist/stepper.js +16 -0
  90. package/dist/stepper.mjs +3 -0
  91. package/dist/styles/layer.js +2 -2
  92. package/dist/styles/layer.mjs +1 -1
  93. package/dist/styles.css +1190 -69
  94. package/dist/styles.js +2 -2
  95. package/dist/styles.layered.css +1190 -69
  96. package/dist/styles.mjs +1 -1
  97. package/dist/tag-input.d.mts +21 -0
  98. package/dist/tag-input.d.ts +21 -0
  99. package/dist/tag-input.js +16 -0
  100. package/dist/tag-input.mjs +3 -0
  101. package/dist/toggle-group.d.mts +36 -0
  102. package/dist/toggle-group.d.ts +36 -0
  103. package/dist/toggle-group.js +16 -0
  104. package/dist/toggle-group.mjs +3 -0
  105. package/package.json +67 -2
  106. package/dist/chunks/chunk-RLPPNY5F.js +0 -7
  107. package/dist/chunks/chunk-W7IPMNN2.mjs +0 -5
  108. package/dist/chunks/{chunk-3VFBPFZF.mjs → chunk-CWMLTXOH.mjs} +2 -2
  109. package/dist/chunks/{chunk-U53UA76K.js → chunk-HFBTS42N.js} +2 -2
@@ -0,0 +1,174 @@
1
+ 'use strict';
2
+
3
+ var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
4
+ var React = require('react');
5
+ var ToggleGroupPrimitive = require('@radix-ui/react-toggle-group');
6
+ var classVarianceAuthority = require('class-variance-authority');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+ var ToggleGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(ToggleGroupPrimitive);
29
+
30
+ var toggleGroupVariants = classVarianceAuthority.cva("nexus-toggle-group", {
31
+ variants: {
32
+ variant: {
33
+ default: "nexus-toggle-group--default",
34
+ outline: "nexus-toggle-group--outline"
35
+ },
36
+ size: {
37
+ sm: "nexus-toggle-group--sm",
38
+ md: "nexus-toggle-group--md",
39
+ lg: "nexus-toggle-group--lg"
40
+ }
41
+ },
42
+ defaultVariants: {
43
+ variant: "default",
44
+ size: "md"
45
+ }
46
+ });
47
+ var ToggleGroup = React__namespace.forwardRef(
48
+ ({ className, variant, size, items, disabled, ...props }, ref) => {
49
+ const rootRef = React__namespace.useRef(null);
50
+ const [animated, setAnimated] = React__namespace.useState(false);
51
+ const [pos, setPos] = React__namespace.useState(null);
52
+ const combinedRef = React__namespace.useCallback(
53
+ (node) => {
54
+ rootRef.current = node;
55
+ if (typeof ref === "function") ref(node);
56
+ else if (ref) ref.current = node;
57
+ },
58
+ [ref]
59
+ );
60
+ const currentValue = props.type === "multiple" ? props.value ?? props.defaultValue : props.value ?? props.defaultValue;
61
+ const [trackedValue, setTrackedValue] = React__namespace.useState(currentValue);
62
+ React__namespace.useEffect(() => {
63
+ if (currentValue !== void 0) setTrackedValue(currentValue);
64
+ }, [currentValue]);
65
+ const isDefault = variant !== "outline";
66
+ React__namespace.useLayoutEffect(() => {
67
+ const root = rootRef.current;
68
+ if (!root || !isDefault) return;
69
+ const activeVal = Array.isArray(trackedValue) ? trackedValue[0] : trackedValue;
70
+ if (!activeVal) {
71
+ setPos(null);
72
+ return;
73
+ }
74
+ const idx = items.findIndex((item) => item.value === activeVal);
75
+ if (idx === -1) {
76
+ setPos(null);
77
+ return;
78
+ }
79
+ const itemEls = root.querySelectorAll(
80
+ ".nexus-toggle-group__item"
81
+ );
82
+ const el = itemEls[idx];
83
+ if (!el) return;
84
+ const rootRect = root.getBoundingClientRect();
85
+ const elRect = el.getBoundingClientRect();
86
+ setPos({
87
+ width: elRect.width,
88
+ height: elRect.height,
89
+ x: elRect.left - rootRect.left,
90
+ y: elRect.top - rootRect.top
91
+ });
92
+ }, [trackedValue, items, isDefault]);
93
+ React__namespace.useEffect(() => {
94
+ const frame = requestAnimationFrame(() => {
95
+ requestAnimationFrame(() => setAnimated(true));
96
+ });
97
+ return () => cancelAnimationFrame(frame);
98
+ }, []);
99
+ const handleSingleChange = React__namespace.useCallback(
100
+ (val) => {
101
+ setTrackedValue(val);
102
+ if (props.type !== "multiple") {
103
+ props.onValueChange?.(val);
104
+ }
105
+ },
106
+ [props.type, props.onValueChange]
107
+ );
108
+ const handleMultipleChange = React__namespace.useCallback(
109
+ (val) => {
110
+ setTrackedValue(val);
111
+ if (props.type === "multiple") {
112
+ props.onValueChange?.(val);
113
+ }
114
+ },
115
+ [props.type, props.onValueChange]
116
+ );
117
+ const rootProps = props.type === "multiple" ? {
118
+ type: "multiple",
119
+ value: props.value,
120
+ defaultValue: props.defaultValue,
121
+ onValueChange: handleMultipleChange
122
+ } : {
123
+ type: "single",
124
+ value: props.value,
125
+ defaultValue: props.defaultValue,
126
+ onValueChange: handleSingleChange
127
+ };
128
+ const indicatorStyle = pos ? {
129
+ width: pos.width,
130
+ height: pos.height,
131
+ transform: `translate(${pos.x}px, ${pos.y}px)`,
132
+ opacity: 1
133
+ } : { opacity: 0 };
134
+ return /* @__PURE__ */ jsxRuntime.jsxs(
135
+ ToggleGroupPrimitive__namespace.Root,
136
+ {
137
+ ref: combinedRef,
138
+ className: chunkCZC76ZD5_js.cn(toggleGroupVariants({ variant, size }), className),
139
+ disabled,
140
+ ...rootProps,
141
+ children: [
142
+ isDefault && /* @__PURE__ */ jsxRuntime.jsx(
143
+ "span",
144
+ {
145
+ className: chunkCZC76ZD5_js.cn(
146
+ "nexus-toggle-group__indicator",
147
+ animated && "nexus-toggle-group__indicator--animated"
148
+ ),
149
+ style: indicatorStyle,
150
+ "aria-hidden": true
151
+ }
152
+ ),
153
+ items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(
154
+ ToggleGroupPrimitive__namespace.Item,
155
+ {
156
+ value: item.value,
157
+ disabled: item.disabled,
158
+ className: "nexus-toggle-group__item",
159
+ children: [
160
+ item.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-toggle-group__icon", children: item.icon }),
161
+ item.label && /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label })
162
+ ]
163
+ },
164
+ item.value
165
+ ))
166
+ ]
167
+ }
168
+ );
169
+ }
170
+ );
171
+ ToggleGroup.displayName = "ToggleGroup";
172
+
173
+ exports.ToggleGroup = ToggleGroup;
174
+ exports.toggleGroupVariants = toggleGroupVariants;
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
4
+ var React = require('react');
5
+ var SliderPrimitive = require('@radix-ui/react-slider');
6
+ var classVarianceAuthority = require('class-variance-authority');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+ var SliderPrimitive__namespace = /*#__PURE__*/_interopNamespace(SliderPrimitive);
29
+
30
+ var sliderVariants = classVarianceAuthority.cva("nexus-slider", {
31
+ variants: {
32
+ size: {
33
+ sm: "nexus-slider--sm",
34
+ md: "nexus-slider--md",
35
+ lg: "nexus-slider--lg"
36
+ }
37
+ },
38
+ defaultVariants: { size: "md" }
39
+ });
40
+ var Slider = React__namespace.forwardRef(
41
+ ({
42
+ className,
43
+ size,
44
+ value,
45
+ defaultValue,
46
+ onValueChange,
47
+ onValueCommit,
48
+ showValue = false,
49
+ formatValue,
50
+ label,
51
+ min = 0,
52
+ max = 100,
53
+ step = 1,
54
+ disabled,
55
+ ...props
56
+ }, ref) => {
57
+ const [internalValue, setInternalValue] = React__namespace.useState(
58
+ defaultValue ?? [min]
59
+ );
60
+ const currentValue = value ?? internalValue;
61
+ const handleChange = React__namespace.useCallback(
62
+ (val) => {
63
+ if (!value) setInternalValue(val);
64
+ onValueChange?.(val);
65
+ },
66
+ [value, onValueChange]
67
+ );
68
+ const display = formatValue ? currentValue.map(formatValue).join(" \u2013 ") : currentValue.join(" \u2013 ");
69
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkCZC76ZD5_js.cn("nexus-slider-wrapper", className), children: [
70
+ (label || showValue) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-slider__header", children: [
71
+ label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-slider__label", children: label }),
72
+ showValue && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-slider__value", children: display })
73
+ ] }),
74
+ /* @__PURE__ */ jsxRuntime.jsxs(
75
+ SliderPrimitive__namespace.Root,
76
+ {
77
+ ref,
78
+ className: chunkCZC76ZD5_js.cn(sliderVariants({ size })),
79
+ value: currentValue,
80
+ onValueChange: handleChange,
81
+ onValueCommit,
82
+ min,
83
+ max,
84
+ step,
85
+ disabled,
86
+ ...props,
87
+ children: [
88
+ /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Track, { className: "nexus-slider__track", children: /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Range, { className: "nexus-slider__range" }) }),
89
+ currentValue.map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(SliderPrimitive__namespace.Thumb, { className: "nexus-slider__thumb" }, i))
90
+ ]
91
+ }
92
+ )
93
+ ] });
94
+ }
95
+ );
96
+ Slider.displayName = "Slider";
97
+
98
+ exports.Slider = Slider;
99
+ exports.sliderVariants = sliderVariants;
@@ -0,0 +1,143 @@
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 tagInputVariants = classVarianceAuthority.cva("nexus-tag-input", {
29
+ variants: {
30
+ size: {
31
+ sm: "nexus-tag-input--sm",
32
+ md: "nexus-tag-input--md",
33
+ lg: "nexus-tag-input--lg"
34
+ }
35
+ },
36
+ defaultVariants: { size: "md" }
37
+ });
38
+ var CloseIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4l8 8M12 4l-8 8", strokeLinecap: "round" }) });
39
+ var TagInput = React__namespace.forwardRef(
40
+ ({
41
+ className,
42
+ size,
43
+ value,
44
+ defaultValue = [],
45
+ onChange,
46
+ placeholder = "\uD0DC\uADF8 \uC785\uB825 \uD6C4 Enter",
47
+ max,
48
+ disabled,
49
+ allowDuplicates = false,
50
+ label,
51
+ description,
52
+ ...props
53
+ }, ref) => {
54
+ const [internalTags, setInternalTags] = React__namespace.useState(defaultValue);
55
+ const [inputValue, setInputValue] = React__namespace.useState("");
56
+ const inputRef = React__namespace.useRef(null);
57
+ const tags = value ?? internalTags;
58
+ const updateTags = React__namespace.useCallback(
59
+ (next) => {
60
+ if (!value) setInternalTags(next);
61
+ onChange?.(next);
62
+ },
63
+ [value, onChange]
64
+ );
65
+ const addTag = React__namespace.useCallback(
66
+ (tag) => {
67
+ const trimmed = tag.trim();
68
+ if (!trimmed) return;
69
+ if (!allowDuplicates && tags.includes(trimmed)) return;
70
+ if (max && tags.length >= max) return;
71
+ updateTags([...tags, trimmed]);
72
+ setInputValue("");
73
+ },
74
+ [tags, allowDuplicates, max, updateTags]
75
+ );
76
+ const removeTag = React__namespace.useCallback(
77
+ (index) => {
78
+ updateTags(tags.filter((_, i) => i !== index));
79
+ },
80
+ [tags, updateTags]
81
+ );
82
+ const handleKeyDown = React__namespace.useCallback(
83
+ (e) => {
84
+ if (e.key === "Enter") {
85
+ e.preventDefault();
86
+ addTag(inputValue);
87
+ } else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
88
+ removeTag(tags.length - 1);
89
+ }
90
+ },
91
+ [inputValue, tags, addTag, removeTag]
92
+ );
93
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: chunkCZC76ZD5_js.cn("nexus-tag-input-wrapper", className), ...props, children: [
94
+ label && /* @__PURE__ */ jsxRuntime.jsx("label", { className: "nexus-tag-input__label", children: label }),
95
+ /* @__PURE__ */ jsxRuntime.jsxs(
96
+ "div",
97
+ {
98
+ className: chunkCZC76ZD5_js.cn(
99
+ tagInputVariants({ size }),
100
+ disabled && "nexus-tag-input--disabled"
101
+ ),
102
+ onClick: () => inputRef.current?.focus(),
103
+ children: [
104
+ tags.map((tag, i) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nexus-tag-input__tag", children: [
105
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: tag }),
106
+ !disabled && /* @__PURE__ */ jsxRuntime.jsx(
107
+ "button",
108
+ {
109
+ type: "button",
110
+ className: "nexus-tag-input__tag-close",
111
+ onClick: (e) => {
112
+ e.stopPropagation();
113
+ removeTag(i);
114
+ },
115
+ "aria-label": `Remove ${tag}`,
116
+ children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { className: "nexus-tag-input__tag-close-icon" })
117
+ }
118
+ )
119
+ ] }, `${tag}-${i}`)),
120
+ /* @__PURE__ */ jsxRuntime.jsx(
121
+ "input",
122
+ {
123
+ ref: inputRef,
124
+ className: "nexus-tag-input__input",
125
+ value: inputValue,
126
+ onChange: (e) => setInputValue(e.target.value),
127
+ onKeyDown: handleKeyDown,
128
+ placeholder: tags.length === 0 ? placeholder : "",
129
+ disabled,
130
+ "aria-label": label ?? "Tag input"
131
+ }
132
+ )
133
+ ]
134
+ }
135
+ ),
136
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "nexus-tag-input__description", children: description })
137
+ ] });
138
+ }
139
+ );
140
+ TagInput.displayName = "TagInput";
141
+
142
+ exports.TagInput = TagInput;
143
+ exports.tagInputVariants = tagInputVariants;
@@ -0,0 +1,31 @@
1
+ import { cn } from './chunk-MCKOWMLS.mjs';
2
+ import * as React from 'react';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ var ChevronRight = ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M6 4l4 4-4 4", strokeLinecap: "round", strokeLinejoin: "round" }) });
6
+ var Breadcrumb = React.forwardRef(
7
+ ({ className, items, separator, maxItems, ...props }, ref) => {
8
+ let displayItems = items;
9
+ let collapsed = false;
10
+ if (maxItems && maxItems > 2 && items.length > maxItems) {
11
+ displayItems = [
12
+ items[0],
13
+ { label: "..." },
14
+ ...items.slice(-(maxItems - 2))
15
+ ];
16
+ collapsed = true;
17
+ }
18
+ const sep = separator ?? /* @__PURE__ */ jsx(ChevronRight, { className: "nexus-breadcrumb__separator-icon" });
19
+ return /* @__PURE__ */ jsx("nav", { ref, "aria-label": "Breadcrumb", className: cn("nexus-breadcrumb", className), ...props, children: /* @__PURE__ */ jsx("ol", { className: "nexus-breadcrumb__list", children: displayItems.map((item, i) => {
20
+ const isLast = i === displayItems.length - 1;
21
+ const isCollapsed = collapsed && i === 1;
22
+ return /* @__PURE__ */ jsxs("li", { className: "nexus-breadcrumb__item", children: [
23
+ i > 0 && /* @__PURE__ */ jsx("span", { className: "nexus-breadcrumb__separator", "aria-hidden": "true", children: sep }),
24
+ isCollapsed ? /* @__PURE__ */ jsx("span", { className: "nexus-breadcrumb__ellipsis", children: "\u2026" }) : isLast ? /* @__PURE__ */ jsx("span", { className: "nexus-breadcrumb__current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ jsx("a", { href: item.href, className: "nexus-breadcrumb__link", onClick: item.onClick, children: item.label }) : item.onClick ? /* @__PURE__ */ jsx("button", { type: "button", className: "nexus-breadcrumb__link nexus-breadcrumb__link--btn", onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsx("span", { className: "nexus-breadcrumb__link", children: item.label })
25
+ ] }, i);
26
+ }) }) });
27
+ }
28
+ );
29
+ Breadcrumb.displayName = "Breadcrumb";
30
+
31
+ export { Breadcrumb };
@@ -0,0 +1,98 @@
1
+ import { cn } from './chunk-MCKOWMLS.mjs';
2
+ import * as React from 'react';
3
+ import { DayPicker } from 'react-day-picker';
4
+ import { format } from 'date-fns';
5
+ import { ko } from 'date-fns/locale';
6
+ import { jsxs, jsx } from 'react/jsx-runtime';
7
+
8
+ var CalendarIcon = ({ className }) => /* @__PURE__ */ jsxs("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
9
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "14", height: "14", rx: "2" }),
10
+ /* @__PURE__ */ jsx("path", { d: "M3 8h14M7 2v4M13 2v4", strokeLinecap: "round" })
11
+ ] });
12
+ var DatePicker = ({
13
+ value,
14
+ defaultValue,
15
+ onChange,
16
+ placeholder = "\uB0A0\uC9DC \uC120\uD0DD",
17
+ disabled = false,
18
+ minDate,
19
+ maxDate,
20
+ locale: localeProp = "ko",
21
+ formatStr = "yyyy-MM-dd",
22
+ className
23
+ }) => {
24
+ const [internalDate, setInternalDate] = React.useState(defaultValue);
25
+ const [open, setOpen] = React.useState(false);
26
+ const wrapperRef = React.useRef(null);
27
+ const selected = value ?? internalDate;
28
+ const handleSelect = React.useCallback(
29
+ (date) => {
30
+ if (!value) setInternalDate(date);
31
+ onChange?.(date);
32
+ setOpen(false);
33
+ },
34
+ [value, onChange]
35
+ );
36
+ React.useEffect(() => {
37
+ const handleClickOutside = (e) => {
38
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
39
+ setOpen(false);
40
+ }
41
+ };
42
+ if (open) document.addEventListener("mousedown", handleClickOutside);
43
+ return () => document.removeEventListener("mousedown", handleClickOutside);
44
+ }, [open]);
45
+ const displayText = selected ? format(selected, formatStr, { locale: localeProp === "ko" ? ko : void 0 }) : placeholder;
46
+ return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: cn("nexus-datepicker", className), children: [
47
+ /* @__PURE__ */ jsxs(
48
+ "button",
49
+ {
50
+ type: "button",
51
+ className: cn(
52
+ "nexus-datepicker__trigger",
53
+ !selected && "nexus-datepicker__trigger--placeholder"
54
+ ),
55
+ onClick: () => !disabled && setOpen(!open),
56
+ disabled,
57
+ children: [
58
+ /* @__PURE__ */ jsx(CalendarIcon, { className: "nexus-datepicker__icon" }),
59
+ /* @__PURE__ */ jsx("span", { children: displayText })
60
+ ]
61
+ }
62
+ ),
63
+ open && /* @__PURE__ */ jsx("div", { className: "nexus-datepicker__popover", children: /* @__PURE__ */ jsx(
64
+ DayPicker,
65
+ {
66
+ mode: "single",
67
+ selected,
68
+ onSelect: handleSelect,
69
+ locale: localeProp === "ko" ? ko : void 0,
70
+ disabled: [
71
+ ...minDate ? [{ before: minDate }] : [],
72
+ ...maxDate ? [{ after: maxDate }] : []
73
+ ],
74
+ classNames: {
75
+ root: "nexus-calendar",
76
+ months: "nexus-calendar__months",
77
+ month_caption: "nexus-calendar__caption",
78
+ nav: "nexus-calendar__nav",
79
+ button_previous: "nexus-calendar__nav-btn",
80
+ button_next: "nexus-calendar__nav-btn",
81
+ month_grid: "nexus-calendar__grid",
82
+ weekdays: "nexus-calendar__head-row",
83
+ weekday: "nexus-calendar__head-cell",
84
+ week: "nexus-calendar__row",
85
+ day: "nexus-calendar__cell",
86
+ day_button: "nexus-calendar__day",
87
+ selected: "nexus-calendar__day--selected",
88
+ today: "nexus-calendar__day--today",
89
+ outside: "nexus-calendar__day--outside",
90
+ disabled: "nexus-calendar__day--disabled"
91
+ }
92
+ }
93
+ ) })
94
+ ] });
95
+ };
96
+ DatePicker.displayName = "DatePicker";
97
+
98
+ export { DatePicker };
@@ -0,0 +1,75 @@
1
+ import { cn } from './chunk-MCKOWMLS.mjs';
2
+ import * as React from 'react';
3
+ import * as SliderPrimitive from '@radix-ui/react-slider';
4
+ import { cva } from 'class-variance-authority';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+
7
+ var sliderVariants = cva("nexus-slider", {
8
+ variants: {
9
+ size: {
10
+ sm: "nexus-slider--sm",
11
+ md: "nexus-slider--md",
12
+ lg: "nexus-slider--lg"
13
+ }
14
+ },
15
+ defaultVariants: { size: "md" }
16
+ });
17
+ var Slider = React.forwardRef(
18
+ ({
19
+ className,
20
+ size,
21
+ value,
22
+ defaultValue,
23
+ onValueChange,
24
+ onValueCommit,
25
+ showValue = false,
26
+ formatValue,
27
+ label,
28
+ min = 0,
29
+ max = 100,
30
+ step = 1,
31
+ disabled,
32
+ ...props
33
+ }, ref) => {
34
+ const [internalValue, setInternalValue] = React.useState(
35
+ defaultValue ?? [min]
36
+ );
37
+ const currentValue = value ?? internalValue;
38
+ const handleChange = React.useCallback(
39
+ (val) => {
40
+ if (!value) setInternalValue(val);
41
+ onValueChange?.(val);
42
+ },
43
+ [value, onValueChange]
44
+ );
45
+ const display = formatValue ? currentValue.map(formatValue).join(" \u2013 ") : currentValue.join(" \u2013 ");
46
+ return /* @__PURE__ */ jsxs("div", { className: cn("nexus-slider-wrapper", className), children: [
47
+ (label || showValue) && /* @__PURE__ */ jsxs("div", { className: "nexus-slider__header", children: [
48
+ label && /* @__PURE__ */ jsx("span", { className: "nexus-slider__label", children: label }),
49
+ showValue && /* @__PURE__ */ jsx("span", { className: "nexus-slider__value", children: display })
50
+ ] }),
51
+ /* @__PURE__ */ jsxs(
52
+ SliderPrimitive.Root,
53
+ {
54
+ ref,
55
+ className: cn(sliderVariants({ size })),
56
+ value: currentValue,
57
+ onValueChange: handleChange,
58
+ onValueCommit,
59
+ min,
60
+ max,
61
+ step,
62
+ disabled,
63
+ ...props,
64
+ children: [
65
+ /* @__PURE__ */ jsx(SliderPrimitive.Track, { className: "nexus-slider__track", children: /* @__PURE__ */ jsx(SliderPrimitive.Range, { className: "nexus-slider__range" }) }),
66
+ currentValue.map((_, i) => /* @__PURE__ */ jsx(SliderPrimitive.Thumb, { className: "nexus-slider__thumb" }, i))
67
+ ]
68
+ }
69
+ )
70
+ ] });
71
+ }
72
+ );
73
+ Slider.displayName = "Slider";
74
+
75
+ export { Slider, sliderVariants };