czero 0.2.0 → 0.2.5

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 (62) hide show
  1. package/README.md +209 -209
  2. package/dist/cli/index.js +970 -72
  3. package/dist/components.css +2158 -1913
  4. package/dist/react/core/component-defaults.d.ts.map +1 -1
  5. package/dist/react/core/types/config.d.ts +161 -2
  6. package/dist/react/core/types/config.d.ts.map +1 -1
  7. package/dist/react/index.cjs +695 -12
  8. package/dist/react/index.cjs.map +1 -1
  9. package/dist/react/index.d.ts +138 -11
  10. package/dist/react/index.js +693 -13
  11. package/dist/react/index.js.map +1 -1
  12. package/dist/react/react/components/button.d.ts +1 -0
  13. package/dist/react/react/components/button.d.ts.map +1 -1
  14. package/dist/react/react/components/data-table.d.ts +39 -0
  15. package/dist/react/react/components/data-table.d.ts.map +1 -0
  16. package/dist/react/react/components/input.d.ts +5 -2
  17. package/dist/react/react/components/input.d.ts.map +1 -1
  18. package/dist/react/react/components/modal.d.ts +44 -0
  19. package/dist/react/react/components/modal.d.ts.map +1 -0
  20. package/dist/react/react/components/search-input.d.ts +13 -0
  21. package/dist/react/react/components/search-input.d.ts.map +1 -0
  22. package/dist/react/react/components/status-badge.d.ts +11 -0
  23. package/dist/react/react/components/status-badge.d.ts.map +1 -0
  24. package/dist/react/react/components/tabs.d.ts +42 -7
  25. package/dist/react/react/components/tabs.d.ts.map +1 -1
  26. package/dist/react/react/index.d.ts +4 -1
  27. package/dist/react/react/index.d.ts.map +1 -1
  28. package/dist/reset.css +6 -15
  29. package/dist/styles.css +2244 -2008
  30. package/package.json +93 -92
  31. package/dist/cli-new/cli/build-css.d.ts +0 -19
  32. package/dist/cli-new/cli/build-css.js +0 -88
  33. package/dist/cli-new/cli/generators/button.d.ts +0 -9
  34. package/dist/cli-new/cli/generators/button.js +0 -224
  35. package/dist/cli-new/cli/generators/card.d.ts +0 -9
  36. package/dist/cli-new/cli/generators/card.js +0 -104
  37. package/dist/cli-new/cli/generators/checkbox.d.ts +0 -6
  38. package/dist/cli-new/cli/generators/checkbox.js +0 -163
  39. package/dist/cli-new/cli/generators/index.d.ts +0 -10
  40. package/dist/cli-new/cli/generators/index.js +0 -40
  41. package/dist/cli-new/cli/generators/input.d.ts +0 -9
  42. package/dist/cli-new/cli/generators/input.js +0 -231
  43. package/dist/cli-new/cli/generators/switch.d.ts +0 -6
  44. package/dist/cli-new/cli/generators/switch.js +0 -156
  45. package/dist/cli-new/cli/generators/utilities.d.ts +0 -9
  46. package/dist/cli-new/cli/generators/utilities.js +0 -150
  47. package/dist/cli-new/cli/index.d.ts +0 -8
  48. package/dist/cli-new/cli/index.js +0 -288
  49. package/dist/cli-new/cli/token-resolver.d.ts +0 -44
  50. package/dist/cli-new/cli/token-resolver.js +0 -137
  51. package/dist/cli-new/cli/utils/deep-merge.d.ts +0 -15
  52. package/dist/cli-new/cli/utils/deep-merge.js +0 -41
  53. package/dist/cli-new/cli/validate-config.d.ts +0 -19
  54. package/dist/cli-new/cli/validate-config.js +0 -151
  55. package/dist/cli-new/src/core/component-defaults.d.ts +0 -7
  56. package/dist/cli-new/src/core/component-defaults.js +0 -467
  57. package/dist/cli-new/src/core/types/config.d.ts +0 -489
  58. package/dist/cli-new/src/core/types/config.js +0 -5
  59. package/dist/cli-new/src/presets/index.d.ts +0 -44
  60. package/dist/cli-new/src/presets/index.js +0 -194
  61. package/dist/react/react/lib/cn.d.ts +0 -7
  62. package/dist/react/react/lib/cn.d.ts.map +0 -1
@@ -139,12 +139,13 @@ function getElementRef$6(element) {
139
139
  return element.props.ref || element.ref;
140
140
  }
141
141
 
142
- const Button = React.forwardRef(({ className = "", variant = "primary", size = "md", loading = false, disabled, asChild = false, children, ...props }, ref) => {
142
+ const Button = React.forwardRef(({ className = "", variant = "primary", size = "md", loading = false, fullWidth = false, disabled, asChild = false, children, ...props }, ref) => {
143
143
  const classes = [
144
144
  "cz-btn",
145
145
  `cz-btn-${variant}`,
146
146
  `cz-btn-${size}`,
147
147
  loading && "cz-btn-loading",
148
+ fullWidth && "cz-btn-full",
148
149
  className,
149
150
  ].filter(Boolean).join(" ");
150
151
  const Comp = asChild ? Slot$3 : "button";
@@ -153,28 +154,47 @@ const Button = React.forwardRef(({ className = "", variant = "primary", size = "
153
154
  if (asChild) {
154
155
  return (jsx(Comp, { ref: ref, className: classes, ...props, children: children }));
155
156
  }
156
- return (jsxs("button", { ref: ref, className: classes, disabled: disabled || loading, ...props, children: [loading && (jsx("svg", { className: "cz-btn-spinner", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeDasharray: "31.416", strokeDashoffset: "10" }) })), jsx("span", { className: loading ? "cz-btn-content" : undefined, children: children })] }));
157
+ return (jsxs("button", { ref: ref, className: classes, disabled: disabled || loading, ...props, children: [loading && (jsx("svg", { className: "cz-btn-spinner", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeDasharray: "31.416", strokeDashoffset: "10" }) })), children] }));
157
158
  });
158
159
  Button.displayName = "Button";
159
160
 
160
- const Input = React.forwardRef(({ className = "", label, description, error, size = "md", id, leftIcon, rightIcon, onClear, value, disabled, ...props }, ref) => {
161
+ const cx$1 = (...parts) => parts.filter(Boolean).join(" ");
162
+ const normalizeSize$1 = (size) => {
163
+ if (size === "small")
164
+ return "sm";
165
+ if (size === "large")
166
+ return "lg";
167
+ if (size === "medium" || size === undefined)
168
+ return "md";
169
+ return size;
170
+ };
171
+ const Input = React.forwardRef(({ className = "", label, description, error, size = "md", variant = "default", id, icon, leftIcon, rightIcon, onClear, type = "text", showPasswordToggle = true, value, disabled, readOnly, ...props }, ref) => {
161
172
  const inputId = id || React.useId();
162
173
  const hasValue = value !== undefined && value !== "";
174
+ const resolvedSize = normalizeSize$1(size);
175
+ const resolvedLeftIcon = leftIcon ?? icon;
176
+ const isPassword = type === "password";
177
+ const canTogglePassword = isPassword && showPasswordToggle && !disabled && !readOnly;
178
+ const [showPassword, setShowPassword] = React.useState(false);
179
+ const inputType = canTogglePassword ? (showPassword ? "text" : "password") : type;
163
180
  const wrapperClasses = [
164
181
  "cz-input-wrapper",
165
- `cz-input-wrapper-${size}`,
166
- leftIcon && "cz-input-has-left-icon",
167
- (rightIcon || onClear) && "cz-input-has-right-icon",
182
+ `cz-input-wrapper-${resolvedSize}`,
183
+ `cz-input-wrapper-variant-${variant}`,
184
+ resolvedLeftIcon && "cz-input-has-left-icon",
185
+ (rightIcon || onClear || canTogglePassword) && "cz-input-has-right-icon",
168
186
  error && "cz-input-wrapper-error",
187
+ readOnly && "cz-input-wrapper-readonly",
169
188
  disabled && "cz-disabled",
170
189
  ].filter(Boolean).join(" ");
171
190
  const inputClasses = [
172
191
  "cz-input",
173
- `cz-input-${size}`,
192
+ `cz-input-${resolvedSize}`,
193
+ `cz-input-variant-${variant}`,
174
194
  error && "cz-input-error",
175
195
  className,
176
196
  ].filter(Boolean).join(" ");
177
- return (jsxs("div", { className: "cz-input-field", children: [label && (jsx("label", { htmlFor: inputId, className: "cz-label", children: label })), jsxs("div", { className: wrapperClasses, children: [leftIcon && (jsx("span", { className: "cz-input-icon cz-input-icon-left", children: leftIcon })), jsx("input", { ref: ref, id: inputId, className: inputClasses, value: value, disabled: disabled, ...props }), onClear && hasValue && !disabled && (jsx("button", { type: "button", className: "cz-input-clear", onClick: onClear, tabIndex: -1, "aria-label": "Clear input", children: jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })), rightIcon && !onClear && (jsx("span", { className: "cz-input-icon cz-input-icon-right", children: rightIcon }))] }), description && !error && (jsx("span", { className: "cz-input-description", children: description })), error && jsx("span", { className: "cz-error", children: error })] }));
197
+ return (jsxs("div", { className: "cz-input-field", children: [label && (jsx("label", { htmlFor: inputId, className: "cz-label", children: label })), jsxs("div", { className: wrapperClasses, children: [resolvedLeftIcon && (jsx("span", { className: "cz-input-icon cz-input-icon-left", children: resolvedLeftIcon })), jsx("input", { ref: ref, id: inputId, className: inputClasses, type: inputType, value: value, disabled: disabled, readOnly: readOnly, ...props }), canTogglePassword ? (jsx("button", { type: "button", className: cx$1("cz-input-password-toggle", showPassword && "cz-input-password-toggle-active"), onClick: () => setShowPassword((prev) => !prev), tabIndex: -1, "aria-label": showPassword ? "Hide password" : "Show password", children: showPassword ? (jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M3 3L21 21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M10.58 10.58A2 2 0 0013.41 13.41", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M9.88 5.09A10.94 10.94 0 0112 5c5 0 9.27 3.11 11 7.5a12.3 12.3 0 01-2.87 4.31", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M6.61 6.61A13.53 13.53 0 001 12.5C2.73 16.89 7 20 12 20a10.93 10.93 0 005.39-1.39", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] })) : (jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M1 12.5C2.73 8.11 7 5 12 5s9.27 3.11 11 7.5C21.27 16.89 17 20 12 20S2.73 16.89 1 12.5z", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("circle", { cx: "12", cy: "12", r: "3", stroke: "currentColor", strokeWidth: "2" })] })) })) : null, onClear && hasValue && !disabled && !readOnly && (jsx("button", { type: "button", className: "cz-input-clear", onClick: onClear, tabIndex: -1, "aria-label": "Clear input", children: jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })), rightIcon && !onClear && !canTogglePassword && (jsx("span", { className: "cz-input-icon cz-input-icon-right", children: rightIcon }))] }), description && !error && (jsx("span", { className: "cz-input-description", children: description })), typeof error === "string" && error.length > 0 ? (jsx("span", { className: "cz-error", children: error })) : null] }));
178
198
  });
179
199
  Input.displayName = "Input";
180
200
 
@@ -216,6 +236,77 @@ const Badge = React.forwardRef(({ className = "", variant = "default", size = "m
216
236
  });
217
237
  Badge.displayName = "Badge";
218
238
 
239
+ const STATUS_TONE_MAP = {
240
+ "checked in": "success",
241
+ active: "success",
242
+ present: "success",
243
+ success: "success",
244
+ "checked out": "danger",
245
+ inactive: "danger",
246
+ absent: "danger",
247
+ danger: "danger",
248
+ error: "danger",
249
+ maintenance: "warning",
250
+ pending: "warning",
251
+ warning: "warning",
252
+ };
253
+ const TONE_STYLES = {
254
+ success: {
255
+ bg: "var(--cz-status-badge-success-bg, var(--color-success-bg-light, hsl(var(--cz-color-success) / 0.12)))",
256
+ text: "var(--cz-status-badge-success-text, var(--color-success-dark, hsl(var(--cz-color-success))))",
257
+ dot: "var(--cz-status-badge-success-dot, var(--color-success, hsl(var(--cz-color-success))))",
258
+ },
259
+ danger: {
260
+ bg: "var(--cz-status-badge-danger-bg, var(--color-danger-bg-light, hsl(var(--cz-color-danger) / 0.12)))",
261
+ text: "var(--cz-status-badge-danger-text, var(--color-danger-dark, hsl(var(--cz-color-danger))))",
262
+ dot: "var(--cz-status-badge-danger-dot, var(--color-danger, hsl(var(--cz-color-danger))))",
263
+ },
264
+ warning: {
265
+ bg: "var(--cz-status-badge-warning-bg, var(--color-warning-bg-light, hsl(var(--cz-color-warning) / 0.12)))",
266
+ text: "var(--cz-status-badge-warning-text, var(--color-warning-dark, hsl(var(--cz-color-warning))))",
267
+ dot: "var(--cz-status-badge-warning-dot, var(--color-warning, hsl(var(--cz-color-warning))))",
268
+ },
269
+ primary: {
270
+ bg: "var(--cz-status-badge-primary-bg, var(--color-primary-bg, hsl(var(--cz-color-primary) / 0.12)))",
271
+ text: "var(--cz-status-badge-primary-text, var(--color-primary-dark, hsl(var(--cz-color-primary))))",
272
+ dot: "var(--cz-status-badge-primary-dot, var(--color-primary, hsl(var(--cz-color-primary))))",
273
+ },
274
+ };
275
+ function normalizeStatus(status) {
276
+ if (typeof status === "string")
277
+ return status.trim().toLowerCase();
278
+ return String(status ?? "").trim().toLowerCase();
279
+ }
280
+ const StatusBadge = React.forwardRef(({ status, children, tone, showDot = true, className = "", style = {}, ...props }, ref) => {
281
+ const label = children ?? status;
282
+ const normalizedStatus = normalizeStatus(status ?? label);
283
+ const resolvedTone = tone ?? STATUS_TONE_MAP[normalizedStatus] ?? "primary";
284
+ const colors = TONE_STYLES[resolvedTone];
285
+ const baseStyles = {
286
+ display: "inline-flex",
287
+ alignItems: "center",
288
+ padding: "var(--cz-status-badge-padding-y, 0.25rem) var(--cz-status-badge-padding-x, 0.625rem)",
289
+ borderRadius: "var(--cz-status-badge-border-radius, 9999px)",
290
+ fontSize: "var(--cz-status-badge-font-size, 0.75rem)",
291
+ lineHeight: "var(--cz-status-badge-line-height, 1rem)",
292
+ fontWeight: "var(--cz-status-badge-font-weight, var(--font-weight-medium, var(--cz-font-weight-medium)))",
293
+ backgroundColor: colors.bg,
294
+ color: colors.text,
295
+ whiteSpace: "nowrap",
296
+ ...style,
297
+ };
298
+ const dotStyles = {
299
+ width: "var(--cz-status-badge-dot-size, 0.5rem)",
300
+ height: "var(--cz-status-badge-dot-size, 0.5rem)",
301
+ borderRadius: "9999px",
302
+ marginRight: "var(--cz-status-badge-dot-gap, 0.375rem)",
303
+ backgroundColor: colors.dot,
304
+ flexShrink: 0,
305
+ };
306
+ return (jsxs(Badge, { ref: ref, variant: "default", size: "md", className: className, style: baseStyles, ...props, children: [showDot && jsx("span", { "aria-hidden": "true", style: dotStyles }), label] }));
307
+ });
308
+ StatusBadge.displayName = "StatusBadge";
309
+
219
310
  const Textarea = React.forwardRef(({ className = "", label, description, error, size = "md", id, autoResize = false, maxRows, disabled, onInput, style, ...props }, ref) => {
220
311
  const textareaId = id || React.useId();
221
312
  const internalRef = React.useRef(null);
@@ -5675,13 +5766,111 @@ var List = TabsList$1;
5675
5766
  var Trigger$4 = TabsTrigger$1;
5676
5767
  var Content$2 = TabsContent$1;
5677
5768
 
5678
- const TabsRoot = React.forwardRef(({ className = "", ...props }, ref) => (jsx(Root2$4, { ref: ref, className: `cz-tabs ${className}`, ...props })));
5769
+ const cx = (...parts) => parts.filter(Boolean).join(" ");
5770
+ const toTabKey = (value) => {
5771
+ if (value === undefined)
5772
+ return undefined;
5773
+ return String(value);
5774
+ };
5775
+ const coerceValueByReference = (value, reference) => {
5776
+ if (typeof reference === "number") {
5777
+ const parsed = Number(value);
5778
+ return Number.isNaN(parsed) ? value : parsed;
5779
+ }
5780
+ if (typeof reference === "boolean") {
5781
+ return value === "true";
5782
+ }
5783
+ return value;
5784
+ };
5785
+ const normalizeSize = (size) => {
5786
+ if (size === "small")
5787
+ return "sm";
5788
+ if (size === "large")
5789
+ return "lg";
5790
+ if (size === "medium" || size === undefined)
5791
+ return "md";
5792
+ return size;
5793
+ };
5794
+ const normalizeVariant = (variant) => {
5795
+ if (variant === "pills" || variant === "enclosed")
5796
+ return variant;
5797
+ return "underline";
5798
+ };
5799
+ const TabsRoot = React.forwardRef(({ className = "", children, defaultValue, value, activeTab, onValueChange, onChange, setActiveTab, items, tabs, renderItem, renderContent, variant, size = "md", fullWidth = false, showBorder = true, disabled = false, listClassName = "", listStyle, triggerClassName = "", triggerStyle, ...props }, ref) => {
5800
+ const dataItems = React.useMemo(() => {
5801
+ if (Array.isArray(items))
5802
+ return items;
5803
+ if (Array.isArray(tabs))
5804
+ return tabs;
5805
+ return undefined;
5806
+ }, [items, tabs]);
5807
+ const hasItems = Boolean(dataItems && dataItems.length > 0);
5808
+ const resolvedVariant = normalizeVariant(variant ?? (hasItems ? "pills" : "underline"));
5809
+ const resolvedSize = normalizeSize(size);
5810
+ const controlledValue = value !== undefined ? value : activeTab;
5811
+ const resolvedDefaultValue = defaultValue !== undefined
5812
+ ? defaultValue
5813
+ : controlledValue === undefined && hasItems
5814
+ ? dataItems?.[0]?.value
5815
+ : undefined;
5816
+ const controlledKey = toTabKey(controlledValue);
5817
+ const defaultKey = toTabKey(resolvedDefaultValue);
5818
+ const [internalActiveKey, setInternalActiveKey] = React.useState(controlledKey ?? defaultKey);
5819
+ React.useEffect(() => {
5820
+ if (controlledKey !== undefined) {
5821
+ setInternalActiveKey(controlledKey);
5822
+ }
5823
+ }, [controlledKey]);
5824
+ const itemValueMap = React.useMemo(() => {
5825
+ const map = new Map();
5826
+ dataItems?.forEach((item) => {
5827
+ map.set(String(item.value), item.value);
5828
+ });
5829
+ return map;
5830
+ }, [dataItems]);
5831
+ const referenceValue = controlledValue !== undefined
5832
+ ? controlledValue
5833
+ : defaultValue !== undefined
5834
+ ? defaultValue
5835
+ : dataItems?.[0]?.value;
5836
+ const handleValueChange = React.useCallback((nextKey) => {
5837
+ setInternalActiveKey(nextKey);
5838
+ onValueChange?.(nextKey);
5839
+ const resolvedValue = itemValueMap.has(nextKey)
5840
+ ? itemValueMap.get(nextKey)
5841
+ : coerceValueByReference(nextKey, referenceValue);
5842
+ onChange?.(resolvedValue);
5843
+ setActiveTab?.(resolvedValue);
5844
+ }, [itemValueMap, onChange, onValueChange, referenceValue, setActiveTab]);
5845
+ const activeKey = controlledKey ?? internalActiveKey;
5846
+ const shouldRenderAutoContent = hasItems &&
5847
+ Boolean(dataItems?.some((item) => item.content !== undefined) || renderContent);
5848
+ return (jsxs(Root2$4, { ref: ref, className: cx("cz-tabs", `cz-tabs--variant-${resolvedVariant}`, `cz-tabs--size-${resolvedSize}`, fullWidth && "cz-tabs--full-width", !showBorder && "cz-tabs--no-border", className), value: controlledKey, defaultValue: controlledKey === undefined ? defaultKey : undefined, onValueChange: handleValueChange, ...props, children: [hasItems ? (jsxs(Fragment, { children: [jsx(TabsList, { className: listClassName, style: listStyle, children: dataItems?.map((item) => {
5849
+ const itemKey = String(item.value);
5850
+ const isActive = activeKey === itemKey;
5851
+ const triggerNode = renderItem
5852
+ ? renderItem(item, { isActive })
5853
+ : item.label;
5854
+ return (jsx(TabsTrigger, { value: item.value, disabled: disabled || item.disabled, icon: item.icon, count: item.count, className: cx(triggerClassName, item.className), style: { ...triggerStyle, ...item.style }, children: triggerNode }, itemKey));
5855
+ }) }), shouldRenderAutoContent
5856
+ ? dataItems?.map((item) => {
5857
+ const itemKey = String(item.value);
5858
+ const isActive = activeKey === itemKey;
5859
+ const content = renderContent
5860
+ ? renderContent(item, { isActive })
5861
+ : item.content;
5862
+ if (content === undefined || content === null)
5863
+ return null;
5864
+ return (jsx(TabsContent, { value: item.value, children: content }, `content-${itemKey}`));
5865
+ })
5866
+ : null] })) : null, children] }));
5867
+ });
5679
5868
  TabsRoot.displayName = "Tabs";
5680
- const TabsList = React.forwardRef(({ className = "", ...props }, ref) => (jsx(List, { ref: ref, className: `cz-tabs-list ${className}`, ...props })));
5869
+ const TabsList = React.forwardRef(({ className = "", ...props }, ref) => (jsx(List, { ref: ref, className: cx("cz-tabs-list", className), ...props })));
5681
5870
  TabsList.displayName = "Tabs.List";
5682
- const TabsTrigger = React.forwardRef(({ className = "", ...props }, ref) => (jsx(Trigger$4, { ref: ref, className: `cz-tabs-trigger ${className}`, ...props })));
5871
+ const TabsTrigger = React.forwardRef(({ className = "", children, value, icon, count, ...props }, ref) => (jsxs(Trigger$4, { ref: ref, className: cx("cz-tabs-trigger", className), value: String(value), ...props, children: [icon ? jsx("span", { className: "cz-tabs-trigger-icon", children: icon }) : null, children, count !== undefined && count !== null ? (jsx("span", { className: "cz-tabs-trigger-count", children: count })) : null] })));
5683
5872
  TabsTrigger.displayName = "Tabs.Trigger";
5684
- const TabsContent = React.forwardRef(({ className = "", ...props }, ref) => (jsx(Content$2, { ref: ref, className: `cz-tabs-content ${className}`, ...props })));
5873
+ const TabsContent = React.forwardRef(({ className = "", value, ...props }, ref) => (jsx(Content$2, { ref: ref, className: cx("cz-tabs-content", className), value: String(value), ...props })));
5685
5874
  TabsContent.displayName = "Tabs.Content";
5686
5875
  // ===== Export =====
5687
5876
  const Tabs = Object.assign(TabsRoot, {
@@ -7231,6 +7420,261 @@ const Dialog = Object.assign(DialogRoot, {
7231
7420
  Overlay: DialogOverlay,
7232
7421
  });
7233
7422
 
7423
+ const SIZE_WIDTH_MAP = {
7424
+ sm: "28rem",
7425
+ md: "36rem",
7426
+ lg: "48rem",
7427
+ xl: "64rem",
7428
+ full: "min(96vw, 96rem)",
7429
+ };
7430
+ const MODAL_BASE_Z_INDEX = 60;
7431
+ const MODAL_LAYER_STEP = 2;
7432
+ let nextModalLayer = 0;
7433
+ function toCssDimension(value) {
7434
+ if (value === undefined || value === null)
7435
+ return undefined;
7436
+ return typeof value === "number" ? `${value}px` : value;
7437
+ }
7438
+ const CloseIcon = () => (jsx("svg", { width: "16", height: "16", viewBox: "0 0 15 15", fill: "none", "aria-hidden": "true", children: jsx("path", { d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor", fillRule: "evenodd", clipRule: "evenodd" }) }));
7439
+ const Modal = React.forwardRef(({ open, defaultOpen, onOpenChange, isOpen, onClose, modal = true, trigger, title, description, children, footer, tabs, activeTab, onTabChange, hideTitle = false, size = "md", width, minHeight, fullHeight = false, showCloseButton = true, closeButtonVariant = "icon", closeButtonText = "Close", closeOnOverlay = true, closeOnEsc = true, portalContainer, overlayClassName = "", headerClassName = "", bodyClassName = "", footerClassName = "", className = "", style, onInteractOutside, onEscapeKeyDown, ...props }, ref) => {
7440
+ const resolvedOpen = isOpen ?? open;
7441
+ const isControlled = resolvedOpen !== undefined;
7442
+ const resolvedDefaultOpen = defaultOpen ?? (!isControlled && !trigger ? true : undefined);
7443
+ const [isOpenState, setIsOpenState] = React.useState(() => {
7444
+ if (resolvedOpen !== undefined)
7445
+ return resolvedOpen;
7446
+ if (resolvedDefaultOpen !== undefined)
7447
+ return resolvedDefaultOpen;
7448
+ return false;
7449
+ });
7450
+ const [layerIndex, setLayerIndex] = React.useState(0);
7451
+ const assignedLayerRef = React.useRef(null);
7452
+ React.useEffect(() => {
7453
+ if (resolvedOpen !== undefined) {
7454
+ setIsOpenState(resolvedOpen);
7455
+ }
7456
+ }, [resolvedOpen]);
7457
+ React.useEffect(() => {
7458
+ if (!isOpenState) {
7459
+ assignedLayerRef.current = null;
7460
+ setLayerIndex(0);
7461
+ return;
7462
+ }
7463
+ if (assignedLayerRef.current === null) {
7464
+ assignedLayerRef.current = nextModalLayer++;
7465
+ }
7466
+ setLayerIndex(assignedLayerRef.current);
7467
+ }, [isOpenState]);
7468
+ const handleOpenChange = React.useCallback((nextOpen) => {
7469
+ setIsOpenState(nextOpen);
7470
+ if (!nextOpen) {
7471
+ assignedLayerRef.current = null;
7472
+ }
7473
+ onOpenChange?.(nextOpen);
7474
+ if (!nextOpen) {
7475
+ onClose?.();
7476
+ }
7477
+ }, [onOpenChange, onClose]);
7478
+ const hasOpenHandler = Boolean(onOpenChange || onClose);
7479
+ const resolvedWidth = toCssDimension(width) ?? SIZE_WIDTH_MAP[size];
7480
+ const resolvedMinHeight = toCssDimension(minHeight);
7481
+ const overlayStyles = {
7482
+ position: "fixed",
7483
+ inset: 0,
7484
+ zIndex: MODAL_BASE_Z_INDEX + layerIndex * MODAL_LAYER_STEP,
7485
+ backgroundColor: "var(--cz-modal-overlay-bg, var(--color-bg-modal-overlay, rgba(15, 23, 42, 0.55)))",
7486
+ backdropFilter: "blur(2px)",
7487
+ };
7488
+ const contentStyles = {
7489
+ position: "fixed",
7490
+ left: "50%",
7491
+ top: "50%",
7492
+ transform: "translate(-50%, -50%)",
7493
+ zIndex: MODAL_BASE_Z_INDEX + layerIndex * MODAL_LAYER_STEP + 1,
7494
+ backgroundColor: "var(--cz-modal-content-bg, var(--color-bg-primary, hsl(var(--cz-color-bg))))",
7495
+ borderRadius: "var(--cz-modal-content-border-radius, var(--radius-modal, var(--cz-radius-lg)))",
7496
+ border: "1px solid var(--cz-modal-content-border-color, hsl(var(--cz-color-border)))",
7497
+ boxShadow: "var(--cz-modal-content-shadow, var(--shadow-modal, var(--cz-shadow-lg)))",
7498
+ display: "flex",
7499
+ flexDirection: "column",
7500
+ overflow: "hidden",
7501
+ width: resolvedWidth,
7502
+ maxWidth: "calc(100% - 2rem)",
7503
+ maxHeight: "calc(100vh - 2rem)",
7504
+ minHeight: resolvedMinHeight,
7505
+ ...(fullHeight ? { height: "calc(100vh - 2rem)" } : null),
7506
+ ...style,
7507
+ };
7508
+ const headerStyles = {
7509
+ display: "flex",
7510
+ alignItems: "flex-start",
7511
+ justifyContent: "space-between",
7512
+ gap: "var(--cz-spacing-md, 0.75rem)",
7513
+ padding: "var(--cz-modal-header-padding, var(--cz-spacing-lg, 1rem) var(--cz-spacing-lg, 1rem) var(--cz-spacing-md, 0.75rem))",
7514
+ borderBottom: "1px solid hsl(var(--cz-color-border))",
7515
+ flexShrink: 0,
7516
+ };
7517
+ const headerTextStyles = {
7518
+ minWidth: 0,
7519
+ display: "flex",
7520
+ flexDirection: "column",
7521
+ gap: "0.25rem",
7522
+ };
7523
+ const titleStyles = {
7524
+ margin: 0,
7525
+ fontSize: "var(--cz-font-size-xl)",
7526
+ fontWeight: "var(--cz-font-weight-semibold)",
7527
+ color: "var(--color-primary, hsl(var(--cz-color-primary)))",
7528
+ lineHeight: "var(--cz-font-lineHeight-tight)",
7529
+ };
7530
+ const descriptionStyles = {
7531
+ margin: 0,
7532
+ fontSize: "var(--cz-font-size-sm)",
7533
+ color: "hsl(var(--cz-color-mutedFg))",
7534
+ };
7535
+ const bodyStyles = {
7536
+ padding: "var(--cz-modal-body-padding, var(--cz-spacing-md, 0.75rem) var(--cz-spacing-lg, 1rem) var(--cz-spacing-lg, 1rem))",
7537
+ overflowY: "auto",
7538
+ flex: 1,
7539
+ };
7540
+ const footerStyles = {
7541
+ display: "flex",
7542
+ alignItems: "center",
7543
+ justifyContent: "flex-end",
7544
+ gap: "var(--cz-modal-footer-gap, var(--cz-spacing-md, 0.75rem))",
7545
+ padding: "var(--cz-modal-footer-padding, var(--cz-spacing-md, 0.75rem) var(--cz-spacing-lg, 1rem))",
7546
+ borderTop: "1px solid hsl(var(--cz-color-border))",
7547
+ flexShrink: 0,
7548
+ };
7549
+ const hasTabs = Boolean(tabs && tabs.length > 0);
7550
+ const shouldRenderTitle = Boolean(title) && !(hasTabs && hideTitle);
7551
+ const shouldRenderDescription = Boolean(description) && !(hasTabs && hideTitle);
7552
+ const tabsLayoutStyles = {
7553
+ display: "flex",
7554
+ flexDirection: "column",
7555
+ gap: "var(--cz-spacing-sm, 0.5rem)",
7556
+ width: "100%",
7557
+ minWidth: 0,
7558
+ };
7559
+ const tabsTopRowStyles = {
7560
+ display: "flex",
7561
+ alignItems: "center",
7562
+ justifyContent: "space-between",
7563
+ gap: "var(--cz-spacing-md, 0.75rem)",
7564
+ };
7565
+ const tabsRowStyles = {
7566
+ display: "flex",
7567
+ alignItems: "center",
7568
+ gap: "var(--cz-spacing-md, 0.75rem)",
7569
+ minWidth: 0,
7570
+ };
7571
+ const tabsNavStyles = {
7572
+ display: "flex",
7573
+ alignItems: "center",
7574
+ gap: 0,
7575
+ overflowX: "auto",
7576
+ overflowY: "hidden",
7577
+ minWidth: 0,
7578
+ flex: 1,
7579
+ scrollbarWidth: "thin",
7580
+ paddingBottom: "0.25rem",
7581
+ marginBottom: "-0.25rem",
7582
+ };
7583
+ const getTabButtonStyles = (isActive, isDisabled) => ({
7584
+ display: "inline-flex",
7585
+ alignItems: "center",
7586
+ justifyContent: "center",
7587
+ gap: "0.375rem",
7588
+ padding: "0.5rem 0.75rem",
7589
+ fontSize: "var(--cz-modal-tab-font-size, 13px)",
7590
+ fontWeight: isActive
7591
+ ? "var(--cz-font-weight-semibold)"
7592
+ : "var(--cz-modal-tab-font-weight, var(--cz-font-weight-medium))",
7593
+ color: isActive
7594
+ ? "var(--cz-modal-tab-active-color, var(--color-primary, hsl(var(--cz-color-primary))))"
7595
+ : "var(--cz-modal-tab-color, var(--color-text-muted, hsl(var(--cz-color-mutedFg))))",
7596
+ backgroundColor: "transparent",
7597
+ border: 0,
7598
+ borderBottom: isActive
7599
+ ? "2px solid var(--cz-modal-tab-active-border-color, var(--color-primary, hsl(var(--cz-color-primary))))"
7600
+ : "2px solid transparent",
7601
+ marginBottom: "-1px",
7602
+ whiteSpace: "nowrap",
7603
+ outline: "none",
7604
+ boxShadow: "none",
7605
+ cursor: isDisabled ? "not-allowed" : "pointer",
7606
+ opacity: isDisabled ? 0.5 : 1,
7607
+ transition: "all var(--cz-transition-fast)",
7608
+ });
7609
+ const contentAriaDescribedBy = shouldRenderDescription
7610
+ ? props["aria-describedby"]
7611
+ : undefined;
7612
+ const contentAriaLabelledBy = shouldRenderTitle
7613
+ ? props["aria-labelledby"]
7614
+ : undefined;
7615
+ const contentAriaLabel = props["aria-label"] ??
7616
+ (typeof title === "string" && !shouldRenderTitle ? title : undefined);
7617
+ const normalizeFooter = () => {
7618
+ if (footer === undefined || footer === null)
7619
+ return footer;
7620
+ const directChildren = React.Children.toArray(footer);
7621
+ if (directChildren.length !== 1) {
7622
+ return footer;
7623
+ }
7624
+ const firstChild = directChildren[0];
7625
+ if (!React.isValidElement(firstChild) || typeof firstChild.type !== "string") {
7626
+ return footer;
7627
+ }
7628
+ const childProps = (firstChild.props ?? {});
7629
+ const nestedChildren = React.Children.toArray(childProps.children);
7630
+ if (nestedChildren.length <= 1) {
7631
+ return footer;
7632
+ }
7633
+ const existingStyle = childProps.style ?? {};
7634
+ return React.cloneElement(firstChild, {
7635
+ style: {
7636
+ display: existingStyle.display ?? "flex",
7637
+ alignItems: existingStyle.alignItems ?? "center",
7638
+ justifyContent: existingStyle.justifyContent ?? "flex-end",
7639
+ gap: existingStyle.gap ??
7640
+ "var(--cz-modal-footer-gap, var(--cz-spacing-md, 0.75rem))",
7641
+ ...existingStyle,
7642
+ },
7643
+ });
7644
+ };
7645
+ const normalizedFooter = normalizeFooter();
7646
+ const handleInteractOutside = (event) => {
7647
+ if (!closeOnOverlay) {
7648
+ event.preventDefault();
7649
+ }
7650
+ onInteractOutside?.(event);
7651
+ };
7652
+ const handleEscapeKeyDown = (event) => {
7653
+ if (!closeOnEsc) {
7654
+ event.preventDefault();
7655
+ }
7656
+ onEscapeKeyDown?.(event);
7657
+ };
7658
+ const closeButton = showCloseButton ? (jsx(Close, { asChild: true, children: closeButtonVariant === "button" ? (jsx("button", { type: "button", className: "cz-modal-close-btn cz-btn cz-btn-primary cz-btn-sm", children: closeButtonText })) : (jsx("button", { type: "button", className: "cz-modal-close-icon", "aria-label": "Close", children: jsx(CloseIcon, {}) })) })) : null;
7659
+ return (jsxs(Root$5, { open: resolvedOpen, defaultOpen: resolvedDefaultOpen, onOpenChange: hasOpenHandler ? handleOpenChange : onOpenChange, modal: modal, children: [trigger ? jsx(Trigger$3, { asChild: true, children: trigger }) : null, jsxs(Portal$2, { container: portalContainer, children: [jsx(Overlay, { className: `cz-modal-overlay ${overlayClassName}`.trim(), style: overlayStyles }), jsxs(Content$1, { ref: ref, className: `cz-modal-content cz-modal-size-${size} ${fullHeight ? "cz-modal-full-height" : ""} ${className}`.trim(), style: contentStyles, onInteractOutside: handleInteractOutside, onEscapeKeyDown: handleEscapeKeyDown, ...props, "aria-describedby": contentAriaDescribedBy, "aria-labelledby": contentAriaLabelledBy, "aria-label": contentAriaLabel, children: [(hasTabs ||
7660
+ shouldRenderTitle ||
7661
+ shouldRenderDescription ||
7662
+ closeButton) && (jsx("div", { className: `cz-modal-header ${headerClassName}`.trim(), style: headerStyles, children: hasTabs ? (jsxs("div", { className: "cz-modal-tabs-layout", style: tabsLayoutStyles, children: [!hideTitle &&
7663
+ (shouldRenderTitle ||
7664
+ shouldRenderDescription ||
7665
+ closeButton) && (jsxs("div", { className: "cz-modal-tabs-top-row", style: tabsTopRowStyles, children: [(shouldRenderTitle || shouldRenderDescription) && (jsxs("div", { className: "cz-modal-header-text", style: headerTextStyles, children: [shouldRenderTitle ? (jsx(Title, { className: "cz-modal-title", style: titleStyles, children: title })) : null, shouldRenderDescription ? (jsx(Description, { className: "cz-modal-description", style: descriptionStyles, children: description })) : null] })), closeButton] })), jsxs("div", { className: "cz-modal-tabs-row", style: tabsRowStyles, children: [jsx("div", { className: "cz-modal-tabs-nav", style: tabsNavStyles, role: "tablist", "aria-label": "Modal tabs", children: tabs?.map((tab) => {
7666
+ const tabId = String(tab.id);
7667
+ const isActive = activeTab === tabId;
7668
+ const label = tab.label ?? tab.name ?? tabId;
7669
+ const isDisabled = Boolean(tab.disabled);
7670
+ return (jsxs("button", { type: "button", className: "cz-modal-tab-btn", role: "tab", "aria-selected": isActive, tabIndex: isActive ? 0 : -1, disabled: isDisabled, onClick: () => !isDisabled && onTabChange?.(tabId), style: getTabButtonStyles(isActive, isDisabled), children: [tab.icon ? (jsx("span", { style: {
7671
+ display: "inline-flex",
7672
+ alignItems: "center",
7673
+ }, children: tab.icon })) : null, jsx("span", { children: label })] }, tabId));
7674
+ }) }), hideTitle ? closeButton : null] })] })) : (jsxs(Fragment, { children: [(shouldRenderTitle || shouldRenderDescription) && (jsxs("div", { className: "cz-modal-header-text", style: headerTextStyles, children: [shouldRenderTitle ? (jsx(Title, { className: "cz-modal-title", style: titleStyles, children: title })) : null, shouldRenderDescription ? (jsx(Description, { className: "cz-modal-description", style: descriptionStyles, children: description })) : null] })), closeButton] })) })), jsx("div", { className: `cz-modal-body ${bodyClassName}`.trim(), style: bodyStyles, children: children }), footer !== undefined && footer !== null ? (jsx("div", { className: `cz-modal-footer ${footerClassName}`.trim(), style: footerStyles, children: normalizedFooter })) : null] })] })] }));
7675
+ });
7676
+ Modal.displayName = "Modal";
7677
+
7234
7678
  // packages/core/number/src/number.ts
7235
7679
  function clamp(value, [min, max]) {
7236
7680
  return Math.min(max, Math.max(min, value));
@@ -8824,6 +9268,242 @@ const Table = Object.assign(TableRoot, {
8824
9268
  Cell: TableCell,
8825
9269
  });
8826
9270
 
9271
+ const SORT_ICON_STYLE = {
9272
+ opacity: "var(--cz-data-table-sort-icon-opacity, 0.3)",
9273
+ };
9274
+ const iconStyles = {
9275
+ display: "inline-flex",
9276
+ width: 14,
9277
+ height: 14,
9278
+ flexShrink: 0,
9279
+ };
9280
+ const SortNeutralIcon = () => (jsxs("svg", { viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", style: { ...iconStyles, ...SORT_ICON_STYLE }, children: [jsx("path", { d: "M4 5L7 2L10 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M10 9L7 12L4 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
9281
+ const SortAscIcon = () => (jsx("svg", { viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", style: iconStyles, children: jsx("path", { d: "M4 8L7 5L10 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9282
+ const SortDescIcon = () => (jsx("svg", { viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", style: iconStyles, children: jsx("path", { d: "M10 6L7 9L4 6", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9283
+ const LeftChevronIcon = () => (jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: { width: 16, height: 16 }, children: jsx("path", { d: "M9.5 3.5L5 8L9.5 12.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9284
+ const RightChevronIcon = () => (jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: { width: 16, height: 16 }, children: jsx("path", { d: "M6.5 3.5L11 8L6.5 12.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9285
+ const EmptyStateIcon = () => (jsxs("svg", { viewBox: "0 0 48 48", fill: "none", "aria-hidden": "true", style: { width: 32, height: 32 }, children: [jsx("circle", { cx: "24", cy: "24", r: "16", stroke: "currentColor", strokeWidth: "2", opacity: "0.6" }), jsx("path", { d: "M24 31.5V31.75M24 16.5C21.7 16.5 20 18 20 20C20 21.5 20.9 22.6 22.1 23.3C23.1 23.9 24 24.6 24 26", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
9286
+ function resolveValue(row, key) {
9287
+ return row[key];
9288
+ }
9289
+ function compareValues(aVal, bVal) {
9290
+ if (aVal === bVal)
9291
+ return 0;
9292
+ if (aVal === null || aVal === undefined)
9293
+ return 1;
9294
+ if (bVal === null || bVal === undefined)
9295
+ return -1;
9296
+ if (typeof aVal === "number" && typeof bVal === "number") {
9297
+ return aVal < bVal ? -1 : 1;
9298
+ }
9299
+ const aText = String(aVal).toLowerCase();
9300
+ const bText = String(bVal).toLowerCase();
9301
+ if (aText === bText)
9302
+ return 0;
9303
+ return aText < bText ? -1 : 1;
9304
+ }
9305
+ const DataTable = React.forwardRef(({ data = [], columns = [], selectable = false, selectedRows = [], onSelectionChange, sortable = false, defaultSortKey = null, defaultSortDir = "asc", pagination = false, pageSize = 10, currentPage: controlledPage, onPageChange, loading = false, isLoading = false, emptyState, emptyMessage, onRowClick, getRowId = (row, index) => row.id ??
9306
+ row._id ??
9307
+ index, variant = "default", className = "", style = {}, ...props }, ref) => {
9308
+ const isBusy = loading || isLoading;
9309
+ const [sortKey, setSortKey] = React.useState(defaultSortKey);
9310
+ const [sortDir, setSortDir] = React.useState(defaultSortDir);
9311
+ const [internalPage, setInternalPage] = React.useState(1);
9312
+ const sortedData = React.useMemo(() => {
9313
+ if (!sortKey || !sortable)
9314
+ return data;
9315
+ return [...data].sort((a, b) => {
9316
+ const aVal = resolveValue(a, sortKey);
9317
+ const bVal = resolveValue(b, sortKey);
9318
+ const result = compareValues(aVal, bVal);
9319
+ return sortDir === "asc" ? result : -result;
9320
+ });
9321
+ }, [data, sortKey, sortDir, sortable]);
9322
+ const totalPages = Math.max(1, Math.ceil(sortedData.length / pageSize));
9323
+ const page = controlledPage !== undefined ? controlledPage : internalPage;
9324
+ const paginatedData = React.useMemo(() => {
9325
+ if (!pagination)
9326
+ return sortedData;
9327
+ const start = (page - 1) * pageSize;
9328
+ return sortedData.slice(start, start + pageSize);
9329
+ }, [sortedData, pagination, page, pageSize]);
9330
+ const setPage = (nextPage) => {
9331
+ const clamped = Math.max(1, Math.min(nextPage, totalPages));
9332
+ if (controlledPage !== undefined) {
9333
+ onPageChange?.(clamped);
9334
+ }
9335
+ else {
9336
+ setInternalPage(clamped);
9337
+ }
9338
+ };
9339
+ const getPageRowId = (row, index) => getRowId(row, index);
9340
+ const pageRowIds = paginatedData.map(getPageRowId);
9341
+ const allSelected = pageRowIds.length > 0 && pageRowIds.every((rowId) => selectedRows.includes(rowId));
9342
+ const someSelected = pageRowIds.some((rowId) => selectedRows.includes(rowId));
9343
+ const handleSort = (key) => {
9344
+ if (!sortable)
9345
+ return;
9346
+ if (sortKey === key) {
9347
+ setSortDir(sortDir === "asc" ? "desc" : "asc");
9348
+ return;
9349
+ }
9350
+ setSortKey(key);
9351
+ setSortDir("asc");
9352
+ };
9353
+ const handleSelectAll = (checked) => {
9354
+ if (!onSelectionChange)
9355
+ return;
9356
+ if (checked) {
9357
+ onSelectionChange([...new Set([...selectedRows, ...pageRowIds])]);
9358
+ return;
9359
+ }
9360
+ onSelectionChange(selectedRows.filter((rowId) => !pageRowIds.includes(rowId)));
9361
+ };
9362
+ const handleSelectRow = (rowId, checked) => {
9363
+ if (!onSelectionChange)
9364
+ return;
9365
+ if (checked) {
9366
+ onSelectionChange([...selectedRows, rowId]);
9367
+ return;
9368
+ }
9369
+ onSelectionChange(selectedRows.filter((id) => id !== rowId));
9370
+ };
9371
+ const containerStyles = {
9372
+ display: "flex",
9373
+ flexDirection: "column",
9374
+ background: "var(--cz-data-table-container-bg, var(--color-bg-primary, hsl(var(--cz-color-bg))))",
9375
+ borderRadius: "var(--cz-data-table-container-border-radius, var(--radius-card, var(--cz-radius-lg)))",
9376
+ border: "1px solid var(--cz-data-table-container-border-color, var(--color-border-primary, hsl(var(--cz-color-border))))",
9377
+ boxShadow: "var(--cz-data-table-container-shadow, var(--shadow-card, var(--cz-shadow-sm)))",
9378
+ overflow: "hidden",
9379
+ ["--cz-table-row-hover-bg"]: "var(--cz-data-table-row-hover-bg, var(--color-bg-hover, hsl(var(--cz-color-muted) / 0.5)))",
9380
+ ...style,
9381
+ };
9382
+ const headerCellStyles = (column) => ({
9383
+ padding: "var(--cz-data-table-header-cell-padding, var(--spacing-3, 0.75rem) var(--spacing-4, 1rem))",
9384
+ textAlign: column.align || "left",
9385
+ fontWeight: "var(--cz-data-table-header-font-weight, var(--font-weight-medium, var(--cz-font-weight-medium)))",
9386
+ color: "var(--cz-data-table-header-color, var(--table-header-text, var(--color-text-muted, hsl(var(--cz-color-mutedFg)))))",
9387
+ fontSize: "var(--cz-data-table-header-font-size, var(--font-size-xs, var(--cz-font-size-xs)))",
9388
+ letterSpacing: "var(--cz-data-table-header-letter-spacing, 0.02em)",
9389
+ textTransform: "var(--cz-data-table-header-text-transform, uppercase)",
9390
+ whiteSpace: "nowrap",
9391
+ cursor: sortable && column.sortable !== false ? "pointer" : "default",
9392
+ userSelect: sortable && column.sortable !== false ? "none" : "auto",
9393
+ width: column.width,
9394
+ borderBottom: "1px solid var(--cz-data-table-row-border-color, var(--color-border-primary, var(--cz-table-border-color)))",
9395
+ });
9396
+ const bodyCellStyles = (align = "left") => ({
9397
+ padding: "var(--cz-data-table-body-cell-padding, var(--spacing-3-5, 0.875rem) var(--spacing-4, 1rem))",
9398
+ textAlign: align,
9399
+ color: "var(--cz-data-table-body-color, var(--color-text-body, hsl(var(--cz-color-fg))))",
9400
+ verticalAlign: "middle",
9401
+ lineHeight: "1.5",
9402
+ fontSize: "var(--cz-data-table-body-font-size, var(--font-size-sm, var(--cz-font-size-sm)))",
9403
+ borderBottom: "1px solid var(--cz-data-table-row-border-color, var(--color-border-light, var(--cz-table-border-color)))",
9404
+ });
9405
+ const renderSortIcon = (key) => {
9406
+ if (sortKey !== key)
9407
+ return jsx(SortNeutralIcon, {});
9408
+ if (sortDir === "asc") {
9409
+ return jsx("span", { style: { color: "var(--cz-data-table-sort-active-color, var(--color-primary, hsl(var(--cz-color-primary))))" }, children: jsx(SortAscIcon, {}) });
9410
+ }
9411
+ return jsx("span", { style: { color: "var(--cz-data-table-sort-active-color, var(--color-primary, hsl(var(--cz-color-primary))))" }, children: jsx(SortDescIcon, {}) });
9412
+ };
9413
+ const tableClassName = variant === "striped" ? "cz-table-striped" : "";
9414
+ const pageButtonStyles = (disabled) => ({
9415
+ display: "inline-flex",
9416
+ alignItems: "center",
9417
+ justifyContent: "center",
9418
+ width: "var(--cz-data-table-pagination-button-size, 32px)",
9419
+ height: "var(--cz-data-table-pagination-button-size, 32px)",
9420
+ borderRadius: "var(--cz-data-table-pagination-button-radius, var(--radius-md, var(--cz-radius-md)))",
9421
+ background: "transparent",
9422
+ border: "1px solid var(--cz-data-table-pagination-button-border-color, transparent)",
9423
+ color: disabled
9424
+ ? "var(--cz-data-table-pagination-button-disabled-color, var(--color-text-disabled, hsl(var(--cz-color-mutedFg))))"
9425
+ : "var(--cz-data-table-pagination-button-color, var(--color-text-body, hsl(var(--cz-color-fg))))",
9426
+ cursor: disabled ? "not-allowed" : "pointer",
9427
+ opacity: disabled ? 0.5 : 1,
9428
+ transition: "all var(--transition-fast, var(--cz-transition-fast))",
9429
+ });
9430
+ if (isBusy) {
9431
+ return (jsx("div", { ref: ref, className: className, style: containerStyles, ...props, children: jsxs(Table, { className: tableClassName, children: [jsx(Table.Header, { children: jsxs(Table.Row, { children: [selectable && jsx(Table.Head, { style: { width: 48 } }), columns.map((column) => (jsx(Table.Head, { style: headerCellStyles(column), children: column.header }, column.key)))] }) }), jsx(Table.Body, { children: Array.from({ length: 5 }).map((_, rowIndex) => (jsxs(Table.Row, { children: [selectable && (jsx(Table.Cell, { style: bodyCellStyles(), children: jsx("div", { style: {
9432
+ width: 18,
9433
+ height: 18,
9434
+ borderRadius: 4,
9435
+ background: "linear-gradient(90deg, var(--cz-data-table-loading-shimmer-base, var(--color-bg-tertiary, hsl(var(--cz-color-muted)))) 25%, var(--cz-data-table-loading-shimmer-highlight, var(--color-bg-hover, hsl(var(--cz-color-muted)/0.5))) 50%, var(--cz-data-table-loading-shimmer-base, var(--color-bg-tertiary, hsl(var(--cz-color-muted)))) 75%)",
9436
+ }, className: "cz-data-table-shimmer" }) })), columns.map((column, columnIndex) => (jsx(Table.Cell, { style: bodyCellStyles(column.align), children: jsx("div", { style: {
9437
+ width: `${40 + ((rowIndex + columnIndex * 7) % 40)}%`,
9438
+ height: 16,
9439
+ borderRadius: "var(--radius-sm, var(--cz-radius-sm))",
9440
+ background: "linear-gradient(90deg, var(--cz-data-table-loading-shimmer-base, var(--color-bg-tertiary, hsl(var(--cz-color-muted)))) 25%, var(--cz-data-table-loading-shimmer-highlight, var(--color-bg-hover, hsl(var(--cz-color-muted)/0.5))) 50%, var(--cz-data-table-loading-shimmer-base, var(--color-bg-tertiary, hsl(var(--cz-color-muted)))) 75%)",
9441
+ }, className: "cz-data-table-shimmer" }) }, `${column.key}-${columnIndex}`)))] }, `loading-${rowIndex}`))) })] }) }));
9442
+ }
9443
+ if (data.length === 0) {
9444
+ return (jsx("div", { ref: ref, className: className, style: containerStyles, ...props, children: emptyState || (jsxs("div", { style: {
9445
+ padding: "var(--spacing-16, 4rem) var(--spacing-6, 1.5rem)",
9446
+ textAlign: "center",
9447
+ color: "var(--cz-data-table-empty-state-color, var(--color-text-muted, hsl(var(--cz-color-mutedFg))))",
9448
+ display: "flex",
9449
+ flexDirection: "column",
9450
+ alignItems: "center",
9451
+ justifyContent: "center",
9452
+ gap: "var(--spacing-4, 1rem)",
9453
+ }, children: [jsx("div", { style: {
9454
+ width: 64,
9455
+ height: 64,
9456
+ borderRadius: "50%",
9457
+ background: "var(--cz-data-table-empty-state-icon-bg, var(--color-bg-secondary, hsl(var(--cz-color-muted))))",
9458
+ display: "flex",
9459
+ alignItems: "center",
9460
+ justifyContent: "center",
9461
+ color: "var(--cz-data-table-empty-state-icon-color, var(--color-text-placeholder, hsl(var(--cz-color-mutedFg))))",
9462
+ }, children: jsx(EmptyStateIcon, {}) }), jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--spacing-1, 0.25rem)" }, children: [jsx("span", { style: {
9463
+ fontSize: "var(--font-size-md, var(--cz-font-size-md))",
9464
+ fontWeight: "var(--font-weight-medium, var(--cz-font-weight-medium))",
9465
+ color: "var(--cz-data-table-empty-state-title-color, var(--color-text-secondary, hsl(var(--cz-color-fg))))",
9466
+ }, children: "No Data Found" }), jsx("span", { style: { fontSize: "var(--font-size-sm, var(--cz-font-size-sm))", maxWidth: 300 }, children: emptyMessage || "There are no records to display at this time." })] })] })) }));
9467
+ }
9468
+ return (jsxs("div", { ref: ref, className: className, style: containerStyles, ...props, children: [jsxs(Table, { className: tableClassName, children: [jsx(Table.Header, { children: jsxs(Table.Row, { children: [selectable && (jsx(Table.Head, { style: { width: 48, ...headerCellStyles({ }) }, children: jsx(Checkbox, { checked: someSelected && !allSelected ? "indeterminate" : allSelected, onCheckedChange: (checked) => handleSelectAll(checked === true) }) })), columns.map((column) => (jsx(Table.Head, { className: column.className, style: headerCellStyles(column), onClick: () => {
9469
+ if (sortable && column.sortable !== false) {
9470
+ handleSort(column.key);
9471
+ }
9472
+ }, children: jsxs("div", { style: {
9473
+ display: "flex",
9474
+ alignItems: "center",
9475
+ gap: "var(--spacing-2, 0.5rem)",
9476
+ justifyContent: column.align === "right"
9477
+ ? "flex-end"
9478
+ : column.align === "center"
9479
+ ? "center"
9480
+ : "flex-start",
9481
+ }, children: [column.customHeaderRender ? column.customHeaderRender() : column.header, sortable && column.sortable !== false && renderSortIcon(column.key)] }) }, column.key)))] }) }), jsx(Table.Body, { children: paginatedData.map((row, index) => {
9482
+ const rowId = getPageRowId(row, index);
9483
+ const isSelected = selectedRows.includes(rowId);
9484
+ return (jsxs(Table.Row, { onClick: onRowClick ? () => onRowClick(row) : undefined, style: {
9485
+ cursor: onRowClick ? "pointer" : "default",
9486
+ background: isSelected
9487
+ ? "var(--cz-data-table-selected-row-bg, var(--color-primary-bg, hsl(var(--cz-color-primary) / 0.12)))"
9488
+ : variant === "striped" && index % 2 === 1
9489
+ ? "var(--cz-data-table-striped-row-bg, var(--cz-table-striped-bg))"
9490
+ : undefined,
9491
+ }, children: [selectable && (jsx(Table.Cell, { style: bodyCellStyles(), onClick: (event) => event.stopPropagation(), children: jsx(Checkbox, { checked: isSelected, onCheckedChange: (checked) => handleSelectRow(rowId, checked === true) }) })), columns.map((column) => (jsx(Table.Cell, { className: column.className, style: bodyCellStyles(column.align), children: column.render
9492
+ ? column.render(row, resolveValue(row, column.key))
9493
+ : resolveValue(row, column.key) }, `${String(rowId)}-${column.key}`)))] }, String(rowId)));
9494
+ }) })] }), pagination && totalPages > 1 && (jsxs("div", { style: {
9495
+ display: "flex",
9496
+ alignItems: "center",
9497
+ justifyContent: "space-between",
9498
+ padding: "var(--cz-data-table-pagination-padding, var(--spacing-3, 0.75rem) var(--spacing-4, 1rem))",
9499
+ background: "var(--cz-data-table-container-bg, var(--color-bg-primary, hsl(var(--cz-color-bg))))",
9500
+ borderTop: "1px solid var(--cz-data-table-pagination-border-color, var(--color-border-light, var(--cz-table-border-color)))",
9501
+ fontSize: "var(--font-size-sm, var(--cz-font-size-sm))",
9502
+ color: "var(--cz-data-table-pagination-text-color, var(--color-text-muted, hsl(var(--cz-color-mutedFg))))",
9503
+ }, children: [jsxs("span", { style: { color: "var(--cz-data-table-pagination-text-strong-color, var(--color-text-body, hsl(var(--cz-color-fg))))" }, children: ["Showing ", jsx("strong", { children: (page - 1) * pageSize + 1 }), "-", jsx("strong", { children: Math.min(page * pageSize, sortedData.length) }), " of", " ", jsx("strong", { children: sortedData.length })] }), jsxs("div", { style: { display: "flex", alignItems: "center", gap: "var(--cz-data-table-pagination-gap, var(--spacing-2, 0.5rem))" }, children: [jsx("button", { type: "button", className: "cz-data-table-page-btn", style: pageButtonStyles(page <= 1), onClick: () => setPage(page - 1), disabled: page <= 1, "aria-label": "Previous page", children: jsx(LeftChevronIcon, {}) }), jsx("button", { type: "button", className: "cz-data-table-page-btn", style: pageButtonStyles(page >= totalPages), onClick: () => setPage(page + 1), disabled: page >= totalPages, "aria-label": "Next page", children: jsx(RightChevronIcon, {}) })] })] }))] }));
9504
+ });
9505
+ DataTable.displayName = "DataTable";
9506
+
8827
9507
  var COLLAPSIBLE_NAME = "Collapsible";
8828
9508
  var [createCollapsibleContext, createCollapsibleScope] = createContextScope$2(COLLAPSIBLE_NAME);
8829
9509
  var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
@@ -11588,5 +12268,5 @@ function useTheme() {
11588
12268
  return context;
11589
12269
  }
11590
12270
 
11591
- export { Accordion, Alert, AspectRatio, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, Code, Container, Dialog, DropdownMenu, Grid, Input, Kbd, Label$1 as Label, Progress, RadioGroup$1 as RadioGroup, ScrollArea, Select, Separator$2 as Separator, Skeleton, Spinner, Stack, Switch, Table, Tabs, Tag, Textarea, ThemeProvider, Toast, ToastProvider, Toaster, Tooltip, TooltipProvider, VisuallyHidden, useTheme, useToast };
12271
+ export { Accordion, Alert, AspectRatio, Avatar, Badge, Breadcrumb, Button, Card, Checkbox, Code, Container, DataTable, Dialog, DropdownMenu, Grid, Input, Kbd, Label$1 as Label, Modal, Progress, RadioGroup$1 as RadioGroup, ScrollArea, Select, Separator$2 as Separator, Skeleton, Spinner, Stack, StatusBadge, Switch, Table, Tabs, Tag, Textarea, ThemeProvider, Toast, ToastProvider, Toaster, Tooltip, TooltipProvider, VisuallyHidden, useTheme, useToast };
11592
12272
  //# sourceMappingURL=index.js.map