@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.
Files changed (135) hide show
  1. package/DESIGN.md +185 -0
  2. package/cursor-rules/nexus-ui-api.mdc +223 -7
  3. package/cursor-rules/nexus-ui-components.mdc +44 -17
  4. package/dist/alert.d.mts +17 -0
  5. package/dist/alert.d.ts +17 -0
  6. package/dist/alert.js +16 -0
  7. package/dist/alert.mjs +3 -0
  8. package/dist/badge.d.mts +18 -0
  9. package/dist/badge.d.ts +18 -0
  10. package/dist/badge.js +16 -0
  11. package/dist/badge.mjs +3 -0
  12. package/dist/breadcrumb.d.mts +15 -0
  13. package/dist/breadcrumb.d.ts +15 -0
  14. package/dist/breadcrumb.js +12 -0
  15. package/dist/breadcrumb.mjs +3 -0
  16. package/dist/chunks/chunk-2N2EPBO4.js +120 -0
  17. package/dist/chunks/{chunk-AFSEYJZT.js → chunk-2T7RUYEK.js} +175 -50
  18. package/dist/chunks/chunk-2UPGFY6E.mjs +76 -0
  19. package/dist/chunks/chunk-3ZWN66YH.js +53 -0
  20. package/dist/chunks/chunk-5PQ3UCKF.js +99 -0
  21. package/dist/chunks/chunk-6BWOKTVQ.mjs +87 -0
  22. package/dist/chunks/chunk-6DBRL6NA.mjs +81 -0
  23. package/dist/chunks/chunk-B5O6W3Z4.mjs +73 -0
  24. package/dist/chunks/chunk-BJM3NDT2.mjs +368 -0
  25. package/dist/chunks/chunk-C2DSAJTL.js +109 -0
  26. package/dist/chunks/chunk-CUTMLBC3.mjs +86 -0
  27. package/dist/chunks/chunk-CV4GMFWP.js +174 -0
  28. package/dist/chunks/chunk-DICN6GKE.js +99 -0
  29. package/dist/chunks/chunk-DYPPVXQF.js +143 -0
  30. package/dist/chunks/chunk-EJY7IVSK.mjs +31 -0
  31. package/dist/chunks/chunk-FUIBYZZ4.mjs +98 -0
  32. package/dist/chunks/{chunk-HNLI646G.mjs → chunk-GN6X27QI.mjs} +9 -2
  33. package/dist/chunks/chunk-H2G5FMRN.mjs +75 -0
  34. package/dist/chunks/chunk-H2V7RHYV.mjs +120 -0
  35. package/dist/chunks/chunk-MMCA33FW.mjs +85 -0
  36. package/dist/chunks/chunk-NZHK76R3.js +109 -0
  37. package/dist/chunks/chunk-P73MEU7N.mjs +150 -0
  38. package/dist/chunks/chunk-PDJTSQOC.js +59 -0
  39. package/dist/chunks/chunk-PXBZEAZQ.mjs +5 -0
  40. package/dist/chunks/chunk-QRNHFOLG.js +7 -0
  41. package/dist/chunks/chunk-S2GMEC43.js +109 -0
  42. package/dist/chunks/{chunk-VGO4Z2WH.js → chunk-SUIT4XKB.js} +8 -1
  43. package/dist/chunks/chunk-X3CTJ7TD.js +108 -0
  44. package/dist/chunks/chunk-XGIJZ3NZ.js +160 -0
  45. package/dist/chunks/chunk-YO5MSDPX.mjs +36 -0
  46. package/dist/chunks/chunk-ZI4LN2B2.js +96 -0
  47. package/dist/chunks/chunk-ZU4AWAFT.mjs +137 -0
  48. package/dist/date-picker.d.mts +17 -0
  49. package/dist/date-picker.d.ts +17 -0
  50. package/dist/date-picker.js +12 -0
  51. package/dist/date-picker.mjs +3 -0
  52. package/dist/dropdown-menu.d.mts +30 -0
  53. package/dist/dropdown-menu.d.ts +30 -0
  54. package/dist/dropdown-menu.js +32 -0
  55. package/dist/dropdown-menu.mjs +3 -0
  56. package/dist/empty-state.d.mts +16 -0
  57. package/dist/empty-state.d.ts +16 -0
  58. package/dist/empty-state.js +16 -0
  59. package/dist/empty-state.mjs +3 -0
  60. package/dist/index.d.mts +14 -0
  61. package/dist/index.d.ts +14 -0
  62. package/dist/index.js +269 -157
  63. package/dist/index.mjs +30 -18
  64. package/dist/modal/index.js +12 -12
  65. package/dist/modal/index.mjs +3 -3
  66. package/dist/number-input.d.mts +5 -6
  67. package/dist/number-input.d.ts +5 -6
  68. package/dist/number-input.js +4 -4
  69. package/dist/number-input.mjs +1 -1
  70. package/dist/nx-image.d.mts +13 -0
  71. package/dist/nx-image.d.ts +13 -0
  72. package/dist/nx-image.js +12 -0
  73. package/dist/nx-image.mjs +3 -0
  74. package/dist/progress.d.mts +18 -0
  75. package/dist/progress.d.ts +18 -0
  76. package/dist/progress.js +16 -0
  77. package/dist/progress.mjs +3 -0
  78. package/dist/schemas/_all.json +840 -13
  79. package/dist/schemas/alert.json +49 -0
  80. package/dist/schemas/badge.json +76 -0
  81. package/dist/schemas/breadcrumb.json +47 -0
  82. package/dist/schemas/datePicker.json +56 -0
  83. package/dist/schemas/dropdownMenu.json +83 -0
  84. package/dist/schemas/emptyState.json +44 -0
  85. package/dist/schemas/numberInput.json +27 -8
  86. package/dist/schemas/nxImage.json +56 -0
  87. package/dist/schemas/progress.json +63 -0
  88. package/dist/schemas/slider.json +78 -0
  89. package/dist/schemas/stepper.json +73 -0
  90. package/dist/schemas/tagInput.json +70 -0
  91. package/dist/schemas/textArea.json +26 -1
  92. package/dist/schemas/toggleGroup.json +88 -0
  93. package/dist/schemas.d.mts +628 -144
  94. package/dist/schemas.d.ts +628 -144
  95. package/dist/schemas.js +177 -7
  96. package/dist/schemas.mjs +166 -8
  97. package/dist/slider.d.mts +20 -0
  98. package/dist/slider.d.ts +20 -0
  99. package/dist/slider.js +16 -0
  100. package/dist/slider.mjs +3 -0
  101. package/dist/stepper.d.mts +20 -0
  102. package/dist/stepper.d.ts +20 -0
  103. package/dist/stepper.js +16 -0
  104. package/dist/stepper.mjs +3 -0
  105. package/dist/styles/layer.js +2 -2
  106. package/dist/styles/layer.mjs +1 -1
  107. package/dist/styles.css +1615 -185
  108. package/dist/styles.js +2 -2
  109. package/dist/styles.layered.css +1615 -185
  110. package/dist/styles.mjs +1 -1
  111. package/dist/table.d.mts +40 -25
  112. package/dist/table.d.ts +40 -25
  113. package/dist/table.js +7 -7
  114. package/dist/table.mjs +1 -1
  115. package/dist/tag-input.d.mts +21 -0
  116. package/dist/tag-input.d.ts +21 -0
  117. package/dist/tag-input.js +16 -0
  118. package/dist/tag-input.mjs +3 -0
  119. package/dist/text-area.d.mts +5 -1
  120. package/dist/text-area.d.ts +5 -1
  121. package/dist/text-area.js +3 -3
  122. package/dist/text-area.mjs +1 -1
  123. package/dist/toggle-group.d.mts +36 -0
  124. package/dist/toggle-group.d.ts +36 -0
  125. package/dist/toggle-group.js +16 -0
  126. package/dist/toggle-group.mjs +3 -0
  127. package/package.json +69 -3
  128. package/scripts/setup-cursor-rules.cjs +15 -1
  129. package/dist/chunks/chunk-26BUGBOY.mjs +0 -57
  130. package/dist/chunks/chunk-CLGH2RTS.js +0 -7
  131. package/dist/chunks/chunk-ECVAVQUY.mjs +0 -243
  132. package/dist/chunks/chunk-UPCWJWXR.mjs +0 -5
  133. package/dist/chunks/chunk-WR55D4ZS.js +0 -80
  134. package/dist/chunks/{chunk-3VFBPFZF.mjs → chunk-CWMLTXOH.mjs} +2 -2
  135. package/dist/chunks/{chunk-U53UA76K.js → chunk-HFBTS42N.js} +2 -2
package/dist/badge.js ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var chunkS2GMEC43_js = require('./chunks/chunk-S2GMEC43.js');
4
+ require('./chunks/chunk-CZC76ZD5.js');
5
+ require('./chunks/chunk-JNMCYWGY.js');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "Badge", {
10
+ enumerable: true,
11
+ get: function () { return chunkS2GMEC43_js.Badge; }
12
+ });
13
+ Object.defineProperty(exports, "badgeVariants", {
14
+ enumerable: true,
15
+ get: function () { return chunkS2GMEC43_js.badgeVariants; }
16
+ });
package/dist/badge.mjs ADDED
@@ -0,0 +1,3 @@
1
+ export { Badge, badgeVariants } from './chunks/chunk-CUTMLBC3.mjs';
2
+ import './chunks/chunk-MCKOWMLS.mjs';
3
+ import './chunks/chunk-CVYXRSXT.mjs';
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ interface BreadcrumbItem {
4
+ label: React.ReactNode;
5
+ href?: string;
6
+ onClick?: () => void;
7
+ }
8
+ interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
9
+ items: BreadcrumbItem[];
10
+ separator?: React.ReactNode;
11
+ maxItems?: number;
12
+ }
13
+ declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
14
+
15
+ export { Breadcrumb, type BreadcrumbItem, type BreadcrumbProps };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+
3
+ interface BreadcrumbItem {
4
+ label: React.ReactNode;
5
+ href?: string;
6
+ onClick?: () => void;
7
+ }
8
+ interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
9
+ items: BreadcrumbItem[];
10
+ separator?: React.ReactNode;
11
+ maxItems?: number;
12
+ }
13
+ declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
14
+
15
+ export { Breadcrumb, type BreadcrumbItem, type BreadcrumbProps };
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var chunk3ZWN66YH_js = require('./chunks/chunk-3ZWN66YH.js');
4
+ require('./chunks/chunk-CZC76ZD5.js');
5
+ require('./chunks/chunk-JNMCYWGY.js');
6
+
7
+
8
+
9
+ Object.defineProperty(exports, "Breadcrumb", {
10
+ enumerable: true,
11
+ get: function () { return chunk3ZWN66YH_js.Breadcrumb; }
12
+ });
@@ -0,0 +1,3 @@
1
+ export { Breadcrumb } from './chunks/chunk-EJY7IVSK.mjs';
2
+ import './chunks/chunk-MCKOWMLS.mjs';
3
+ import './chunks/chunk-CVYXRSXT.mjs';
@@ -0,0 +1,120 @@
1
+ 'use strict';
2
+
3
+ var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
4
+ var React = require('react');
5
+ var reactDayPicker = require('react-day-picker');
6
+ var dateFns = require('date-fns');
7
+ var locale = require('date-fns/locale');
8
+ var jsxRuntime = require('react/jsx-runtime');
9
+
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ var n = Object.create(null);
13
+ if (e) {
14
+ Object.keys(e).forEach(function (k) {
15
+ if (k !== 'default') {
16
+ var d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: function () { return e[k]; }
20
+ });
21
+ }
22
+ });
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+
28
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+
30
+ var CalendarIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { className, viewBox: "0 0 20 20", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
31
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "3", y: "4", width: "14", height: "14", rx: "2" }),
32
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 8h14M7 2v4M13 2v4", strokeLinecap: "round" })
33
+ ] });
34
+ var DatePicker = ({
35
+ value,
36
+ defaultValue,
37
+ onChange,
38
+ placeholder = "\uB0A0\uC9DC \uC120\uD0DD",
39
+ disabled = false,
40
+ minDate,
41
+ maxDate,
42
+ locale: localeProp = "ko",
43
+ formatStr = "yyyy-MM-dd",
44
+ className
45
+ }) => {
46
+ const [internalDate, setInternalDate] = React__namespace.useState(defaultValue);
47
+ const [open, setOpen] = React__namespace.useState(false);
48
+ const wrapperRef = React__namespace.useRef(null);
49
+ const selected = value ?? internalDate;
50
+ const handleSelect = React__namespace.useCallback(
51
+ (date) => {
52
+ if (!value) setInternalDate(date);
53
+ onChange?.(date);
54
+ setOpen(false);
55
+ },
56
+ [value, onChange]
57
+ );
58
+ React__namespace.useEffect(() => {
59
+ const handleClickOutside = (e) => {
60
+ if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
61
+ setOpen(false);
62
+ }
63
+ };
64
+ if (open) document.addEventListener("mousedown", handleClickOutside);
65
+ return () => document.removeEventListener("mousedown", handleClickOutside);
66
+ }, [open]);
67
+ const displayText = selected ? dateFns.format(selected, formatStr, { locale: localeProp === "ko" ? locale.ko : void 0 }) : placeholder;
68
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrapperRef, className: chunkCZC76ZD5_js.cn("nexus-datepicker", className), children: [
69
+ /* @__PURE__ */ jsxRuntime.jsxs(
70
+ "button",
71
+ {
72
+ type: "button",
73
+ className: chunkCZC76ZD5_js.cn(
74
+ "nexus-datepicker__trigger",
75
+ !selected && "nexus-datepicker__trigger--placeholder"
76
+ ),
77
+ onClick: () => !disabled && setOpen(!open),
78
+ disabled,
79
+ children: [
80
+ /* @__PURE__ */ jsxRuntime.jsx(CalendarIcon, { className: "nexus-datepicker__icon" }),
81
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: displayText })
82
+ ]
83
+ }
84
+ ),
85
+ open && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "nexus-datepicker__popover", children: /* @__PURE__ */ jsxRuntime.jsx(
86
+ reactDayPicker.DayPicker,
87
+ {
88
+ mode: "single",
89
+ selected,
90
+ onSelect: handleSelect,
91
+ locale: localeProp === "ko" ? locale.ko : void 0,
92
+ disabled: [
93
+ ...minDate ? [{ before: minDate }] : [],
94
+ ...maxDate ? [{ after: maxDate }] : []
95
+ ],
96
+ classNames: {
97
+ root: "nexus-calendar",
98
+ months: "nexus-calendar__months",
99
+ month_caption: "nexus-calendar__caption",
100
+ nav: "nexus-calendar__nav",
101
+ button_previous: "nexus-calendar__nav-btn",
102
+ button_next: "nexus-calendar__nav-btn",
103
+ month_grid: "nexus-calendar__grid",
104
+ weekdays: "nexus-calendar__head-row",
105
+ weekday: "nexus-calendar__head-cell",
106
+ week: "nexus-calendar__row",
107
+ day: "nexus-calendar__cell",
108
+ day_button: "nexus-calendar__day",
109
+ selected: "nexus-calendar__day--selected",
110
+ today: "nexus-calendar__day--today",
111
+ outside: "nexus-calendar__day--outside",
112
+ disabled: "nexus-calendar__day--disabled"
113
+ }
114
+ }
115
+ ) })
116
+ ] });
117
+ };
118
+ DatePicker.displayName = "DatePicker";
119
+
120
+ exports.DatePicker = DatePicker;
@@ -27,21 +27,62 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
27
 
28
28
  var numberInputVariants = classVarianceAuthority.cva("nexus-number-input", {
29
29
  variants: {
30
+ variant: {
31
+ basic: "nexus-number-input--basic",
32
+ bind: "nexus-number-input--bind"
33
+ },
30
34
  size: {
31
- sm: "nexus-number-input--sm",
32
- md: "nexus-number-input--md",
33
35
  lg: "nexus-number-input--lg",
34
36
  xl: "nexus-number-input--xl"
35
- },
36
- state: {
37
- default: "nexus-number-input--default",
38
- error: "nexus-number-input--error"
39
37
  }
40
38
  },
41
- defaultVariants: { size: "md", state: "default" }
39
+ defaultVariants: { variant: "basic", size: "lg" }
42
40
  });
43
- var ChevronUp = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "nexus-number-input__step-icon", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 7.5L6 4.5l3 3" }) });
44
- var ChevronDown = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "nexus-number-input__step-icon", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 4.5L6 7.5l3-3" }) });
41
+ var CHEVRON_PATH = "M3.606.179C3.82-.06 4.18-.06 4.394.179L7.846 4.01C8.18 4.382 7.934 5 7.452 5H.548C.066 5-.18 4.382.154 4.01L3.606.179Z";
42
+ var ChevronUpIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
43
+ "svg",
44
+ {
45
+ className: "nexus-number-input__chevron-icon",
46
+ viewBox: "0 0 8 5",
47
+ fill: "currentColor",
48
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: CHEVRON_PATH })
49
+ }
50
+ );
51
+ var ChevronDownIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
52
+ "svg",
53
+ {
54
+ className: "nexus-number-input__chevron-icon nexus-number-input__chevron-icon--down",
55
+ viewBox: "0 0 8 5",
56
+ fill: "currentColor",
57
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: CHEVRON_PATH })
58
+ }
59
+ );
60
+ var MinusIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
61
+ "svg",
62
+ {
63
+ className: "nexus-number-input__bind-icon",
64
+ viewBox: "0 0 16 16",
65
+ fill: "none",
66
+ stroke: "currentColor",
67
+ strokeWidth: "1.33",
68
+ strokeLinecap: "round",
69
+ strokeLinejoin: "round",
70
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.333 8h9.334" })
71
+ }
72
+ );
73
+ var PlusIcon = () => /* @__PURE__ */ jsxRuntime.jsx(
74
+ "svg",
75
+ {
76
+ className: "nexus-number-input__bind-icon",
77
+ viewBox: "0 0 16 16",
78
+ fill: "none",
79
+ stroke: "currentColor",
80
+ strokeWidth: "1.33",
81
+ strokeLinecap: "round",
82
+ strokeLinejoin: "round",
83
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.333 8h9.334M8 3.333v9.334" })
84
+ }
85
+ );
45
86
  function clampValue(val, min, max) {
46
87
  let result = val;
47
88
  if (min !== void 0) result = Math.max(min, result);
@@ -65,6 +106,7 @@ function numberInputBind(ref, direction) {
65
106
  var NumberInput = React__namespace.forwardRef(
66
107
  ({
67
108
  className,
109
+ variant = "basic",
68
110
  size,
69
111
  error,
70
112
  value,
@@ -72,6 +114,9 @@ var NumberInput = React__namespace.forwardRef(
72
114
  max,
73
115
  step = 1,
74
116
  digit = 0,
117
+ label,
118
+ description,
119
+ showMax,
75
120
  hideButtons = false,
76
121
  disabled,
77
122
  readOnly,
@@ -80,8 +125,9 @@ var NumberInput = React__namespace.forwardRef(
80
125
  ...props
81
126
  }, ref) => {
82
127
  const inputRef = React__namespace.useRef(null);
83
- const state = error ? "error" : "default";
84
- const [internalValue, setInternalValue] = React__namespace.useState(value?.toString() ?? "");
128
+ const [internalValue, setInternalValue] = React__namespace.useState(
129
+ value?.toString() ?? ""
130
+ );
85
131
  const internalValueRef = React__namespace.useRef(internalValue);
86
132
  const timeoutRef = React__namespace.useRef(null);
87
133
  const pressCountRef = React__namespace.useRef(0);
@@ -189,72 +235,151 @@ var NumberInput = React__namespace.forwardRef(
189
235
  }),
190
236
  [step]
191
237
  );
192
- const padSize = size === "sm" ? "nexus-number-input__field--sm" : size === "xl" ? "nexus-number-input__field--xl" : size === "lg" ? "nexus-number-input__field--lg" : "nexus-number-input__field--md";
193
- const showButtons = !hideButtons && !readOnly && !disabled;
238
+ const handleMaxClick = React__namespace.useCallback(() => {
239
+ if (disabled || readOnly || max === void 0) return;
240
+ const maxStr = max.toString();
241
+ internalValueRef.current = maxStr;
242
+ setInternalValue(maxStr);
243
+ onValueChange?.(max);
244
+ inputRef.current?.focus();
245
+ }, [disabled, readOnly, max, onValueChange]);
194
246
  const numValue = parseFloat(internalValue) || 0;
195
247
  const isMinDisabled = min !== void 0 && numValue <= min;
196
248
  const isMaxDisabled = max !== void 0 && numValue >= max;
249
+ const isMaxExceeded = max !== void 0 && numValue > max;
250
+ const displayMax = showMax ?? max !== void 0;
251
+ const showHeader = !!label || displayMax;
252
+ const isError = error || isMaxExceeded;
253
+ const showBtns = !hideButtons && !readOnly;
254
+ const isBasic = variant !== "bind";
197
255
  return /* @__PURE__ */ jsxRuntime.jsxs(
198
256
  "div",
199
257
  {
200
258
  className: chunkCZC76ZD5_js.cn(
201
- numberInputVariants({ size, state }),
259
+ numberInputVariants({ variant, size }),
260
+ isError && "nexus-number-input--error",
202
261
  disabled && "nexus-number-input--disabled",
203
262
  className
204
263
  ),
205
264
  children: [
206
- /* @__PURE__ */ jsxRuntime.jsx(
207
- "input",
208
- {
209
- ref: inputRef,
210
- type: "text",
211
- inputMode: "decimal",
212
- role: "spinbutton",
213
- className: chunkCZC76ZD5_js.cn("nexus-number-input__field", padSize),
214
- value: internalValue,
215
- disabled,
216
- readOnly,
217
- placeholder,
218
- "aria-invalid": error || void 0,
219
- "aria-valuemin": min,
220
- "aria-valuemax": max,
221
- "aria-valuenow": internalValue ? parseFloat(internalValue) || void 0 : void 0,
222
- onChange: handleInputChange,
223
- onBlur: handleBlur,
224
- onKeyDown: handleKeyDown,
225
- ...props
226
- }
227
- ),
228
- showButtons && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-number-input__buttons", children: [
229
- /* @__PURE__ */ jsxRuntime.jsx(
265
+ showHeader && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-number-input__header", children: [
266
+ label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-number-input__label", children: label }),
267
+ displayMax && max !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
230
268
  "button",
231
269
  {
232
270
  type: "button",
271
+ className: "nexus-number-input__max",
272
+ onClick: handleMaxClick,
273
+ disabled: disabled || readOnly,
233
274
  tabIndex: -1,
234
- disabled: isMaxDisabled,
235
- className: "nexus-number-input__step nexus-number-input__step--up",
236
- onPointerDown: (e) => startRepeat(step, e),
275
+ children: [
276
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-number-input__max-text", children: "Max" }),
277
+ /* @__PURE__ */ jsxRuntime.jsx(
278
+ "span",
279
+ {
280
+ className: chunkCZC76ZD5_js.cn(
281
+ "nexus-number-input__max-value",
282
+ isMaxExceeded && "nexus-number-input__max-value--exceeded"
283
+ ),
284
+ children: max
285
+ }
286
+ )
287
+ ]
288
+ }
289
+ )
290
+ ] }),
291
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-number-input__container", children: [
292
+ !isBasic && showBtns && /* @__PURE__ */ jsxRuntime.jsx(
293
+ "button",
294
+ {
295
+ type: "button",
296
+ tabIndex: -1,
297
+ disabled: disabled || isMinDisabled,
298
+ className: "nexus-number-input__bind-btn",
299
+ onPointerDown: (e) => startRepeat(-step, e),
237
300
  onPointerUp: stopRepeat,
238
301
  onPointerLeave: stopRepeat,
239
- "aria-label": "Increase",
240
- children: /* @__PURE__ */ jsxRuntime.jsx(ChevronUp, {})
302
+ "aria-label": "Decrease",
303
+ children: /* @__PURE__ */ jsxRuntime.jsx(MinusIcon, {})
241
304
  }
242
305
  ),
243
306
  /* @__PURE__ */ jsxRuntime.jsx(
307
+ "input",
308
+ {
309
+ ref: inputRef,
310
+ type: "text",
311
+ inputMode: "decimal",
312
+ role: "spinbutton",
313
+ className: "nexus-number-input__field",
314
+ value: internalValue,
315
+ disabled,
316
+ readOnly,
317
+ placeholder: placeholder ?? "0",
318
+ "aria-invalid": isError || void 0,
319
+ "aria-valuemin": min,
320
+ "aria-valuemax": max,
321
+ "aria-valuenow": internalValue ? parseFloat(internalValue) || void 0 : void 0,
322
+ onChange: handleInputChange,
323
+ onBlur: handleBlur,
324
+ onKeyDown: handleKeyDown,
325
+ ...props
326
+ }
327
+ ),
328
+ !isBasic && showBtns && /* @__PURE__ */ jsxRuntime.jsx(
244
329
  "button",
245
330
  {
246
331
  type: "button",
247
332
  tabIndex: -1,
248
- disabled: isMinDisabled,
249
- className: "nexus-number-input__step nexus-number-input__step--down",
250
- onPointerDown: (e) => startRepeat(-step, e),
333
+ disabled: disabled || isMaxDisabled,
334
+ className: "nexus-number-input__bind-btn",
335
+ onPointerDown: (e) => startRepeat(step, e),
251
336
  onPointerUp: stopRepeat,
252
337
  onPointerLeave: stopRepeat,
253
- "aria-label": "Decrease",
254
- children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {})
338
+ "aria-label": "Increase",
339
+ children: /* @__PURE__ */ jsxRuntime.jsx(PlusIcon, {})
255
340
  }
256
- )
257
- ] })
341
+ ),
342
+ isBasic && showBtns && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nexus-number-input__buttons", children: [
343
+ /* @__PURE__ */ jsxRuntime.jsx(
344
+ "button",
345
+ {
346
+ type: "button",
347
+ tabIndex: -1,
348
+ disabled: disabled || isMaxDisabled,
349
+ className: "nexus-number-input__step nexus-number-input__step--up",
350
+ onPointerDown: (e) => startRepeat(step, e),
351
+ onPointerUp: stopRepeat,
352
+ onPointerLeave: stopRepeat,
353
+ "aria-label": "Increase",
354
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronUpIcon, {})
355
+ }
356
+ ),
357
+ /* @__PURE__ */ jsxRuntime.jsx(
358
+ "button",
359
+ {
360
+ type: "button",
361
+ tabIndex: -1,
362
+ disabled: disabled || isMinDisabled,
363
+ className: "nexus-number-input__step nexus-number-input__step--down",
364
+ onPointerDown: (e) => startRepeat(-step, e),
365
+ onPointerUp: stopRepeat,
366
+ onPointerLeave: stopRepeat,
367
+ "aria-label": "Decrease",
368
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownIcon, {})
369
+ }
370
+ )
371
+ ] })
372
+ ] }),
373
+ description && /* @__PURE__ */ jsxRuntime.jsx(
374
+ "p",
375
+ {
376
+ className: chunkCZC76ZD5_js.cn(
377
+ "nexus-number-input__description",
378
+ isError && "nexus-number-input__description--error"
379
+ ),
380
+ children: description
381
+ }
382
+ )
258
383
  ]
259
384
  }
260
385
  );
@@ -0,0 +1,76 @@
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 alertVariants = cva("nexus-alert", {
7
+ variants: {
8
+ variant: {
9
+ info: "nexus-alert--info",
10
+ success: "nexus-alert--success",
11
+ warning: "nexus-alert--warning",
12
+ danger: "nexus-alert--danger"
13
+ }
14
+ },
15
+ defaultVariants: {
16
+ variant: "info"
17
+ }
18
+ });
19
+ var statusIcons = {
20
+ info: ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
21
+ success: ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }) }),
22
+ warning: ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }),
23
+ danger: ({ className }) => /* @__PURE__ */ jsx("svg", { className, viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) })
24
+ };
25
+ 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" }) });
26
+ var Alert = React.forwardRef(
27
+ ({
28
+ className,
29
+ children,
30
+ variant = "info",
31
+ title,
32
+ icon,
33
+ closable = false,
34
+ onClose,
35
+ action,
36
+ ...props
37
+ }, ref) => {
38
+ const [visible, setVisible] = React.useState(true);
39
+ const handleClose = React.useCallback(() => {
40
+ setVisible(false);
41
+ onClose?.();
42
+ }, [onClose]);
43
+ if (!visible) return null;
44
+ const IconComp = icon === void 0 ? statusIcons[variant ?? "info"] : null;
45
+ return /* @__PURE__ */ jsxs(
46
+ "div",
47
+ {
48
+ ref,
49
+ role: "alert",
50
+ className: cn(alertVariants({ variant }), className),
51
+ ...props,
52
+ children: [
53
+ (icon || IconComp) && /* @__PURE__ */ jsx("span", { className: "nexus-alert__icon", children: icon ?? (IconComp && /* @__PURE__ */ jsx(IconComp, { className: "nexus-alert__icon-svg" })) }),
54
+ /* @__PURE__ */ jsxs("div", { className: "nexus-alert__body", children: [
55
+ title && /* @__PURE__ */ jsx("p", { className: "nexus-alert__title", children: title }),
56
+ children && /* @__PURE__ */ jsx("div", { className: "nexus-alert__description", children })
57
+ ] }),
58
+ action && /* @__PURE__ */ jsx("div", { className: "nexus-alert__action", children: action }),
59
+ closable && /* @__PURE__ */ jsx(
60
+ "button",
61
+ {
62
+ type: "button",
63
+ className: "nexus-alert__close",
64
+ onClick: handleClose,
65
+ "aria-label": "Close",
66
+ children: /* @__PURE__ */ jsx(CloseIcon, { className: "nexus-alert__close-icon" })
67
+ }
68
+ )
69
+ ]
70
+ }
71
+ );
72
+ }
73
+ );
74
+ Alert.displayName = "Alert";
75
+
76
+ export { Alert, alertVariants };
@@ -0,0 +1,53 @@
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 ChevronRight = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx("svg", { className, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 4l4 4-4 4", strokeLinecap: "round", strokeLinejoin: "round" }) });
28
+ var Breadcrumb = React__namespace.forwardRef(
29
+ ({ className, items, separator, maxItems, ...props }, ref) => {
30
+ let displayItems = items;
31
+ let collapsed = false;
32
+ if (maxItems && maxItems > 2 && items.length > maxItems) {
33
+ displayItems = [
34
+ items[0],
35
+ { label: "..." },
36
+ ...items.slice(-(maxItems - 2))
37
+ ];
38
+ collapsed = true;
39
+ }
40
+ const sep = separator ?? /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { className: "nexus-breadcrumb__separator-icon" });
41
+ return /* @__PURE__ */ jsxRuntime.jsx("nav", { ref, "aria-label": "Breadcrumb", className: chunkCZC76ZD5_js.cn("nexus-breadcrumb", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "nexus-breadcrumb__list", children: displayItems.map((item, i) => {
42
+ const isLast = i === displayItems.length - 1;
43
+ const isCollapsed = collapsed && i === 1;
44
+ return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "nexus-breadcrumb__item", children: [
45
+ i > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-breadcrumb__separator", "aria-hidden": "true", children: sep }),
46
+ isCollapsed ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-breadcrumb__ellipsis", children: "\u2026" }) : isLast ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-breadcrumb__current", "aria-current": "page", children: item.label }) : item.href ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: item.href, className: "nexus-breadcrumb__link", onClick: item.onClick, children: item.label }) : item.onClick ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "nexus-breadcrumb__link nexus-breadcrumb__link--btn", onClick: item.onClick, children: item.label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nexus-breadcrumb__link", children: item.label })
47
+ ] }, i);
48
+ }) }) });
49
+ }
50
+ );
51
+ Breadcrumb.displayName = "Breadcrumb";
52
+
53
+ exports.Breadcrumb = Breadcrumb;