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
@@ -159,12 +159,13 @@ function getElementRef$6(element) {
159
159
  return element.props.ref || element.ref;
160
160
  }
161
161
 
162
- const Button = React__namespace.forwardRef(({ className = "", variant = "primary", size = "md", loading = false, disabled, asChild = false, children, ...props }, ref) => {
162
+ const Button = React__namespace.forwardRef(({ className = "", variant = "primary", size = "md", loading = false, fullWidth = false, disabled, asChild = false, children, ...props }, ref) => {
163
163
  const classes = [
164
164
  "cz-btn",
165
165
  `cz-btn-${variant}`,
166
166
  `cz-btn-${size}`,
167
167
  loading && "cz-btn-loading",
168
+ fullWidth && "cz-btn-full",
168
169
  className,
169
170
  ].filter(Boolean).join(" ");
170
171
  const Comp = asChild ? Slot$3 : "button";
@@ -173,28 +174,47 @@ const Button = React__namespace.forwardRef(({ className = "", variant = "primary
173
174
  if (asChild) {
174
175
  return (jsxRuntime.jsx(Comp, { ref: ref, className: classes, ...props, children: children }));
175
176
  }
176
- return (jsxRuntime.jsxs("button", { ref: ref, className: classes, disabled: disabled || loading, ...props, children: [loading && (jsxRuntime.jsx("svg", { className: "cz-btn-spinner", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeDasharray: "31.416", strokeDashoffset: "10" }) })), jsxRuntime.jsx("span", { className: loading ? "cz-btn-content" : undefined, children: children })] }));
177
+ return (jsxRuntime.jsxs("button", { ref: ref, className: classes, disabled: disabled || loading, ...props, children: [loading && (jsxRuntime.jsx("svg", { className: "cz-btn-spinner", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeDasharray: "31.416", strokeDashoffset: "10" }) })), children] }));
177
178
  });
178
179
  Button.displayName = "Button";
179
180
 
180
- const Input = React__namespace.forwardRef(({ className = "", label, description, error, size = "md", id, leftIcon, rightIcon, onClear, value, disabled, ...props }, ref) => {
181
+ const cx$1 = (...parts) => parts.filter(Boolean).join(" ");
182
+ const normalizeSize$1 = (size) => {
183
+ if (size === "small")
184
+ return "sm";
185
+ if (size === "large")
186
+ return "lg";
187
+ if (size === "medium" || size === undefined)
188
+ return "md";
189
+ return size;
190
+ };
191
+ const Input = React__namespace.forwardRef(({ className = "", label, description, error, size = "md", variant = "default", id, icon, leftIcon, rightIcon, onClear, type = "text", showPasswordToggle = true, value, disabled, readOnly, ...props }, ref) => {
181
192
  const inputId = id || React__namespace.useId();
182
193
  const hasValue = value !== undefined && value !== "";
194
+ const resolvedSize = normalizeSize$1(size);
195
+ const resolvedLeftIcon = leftIcon ?? icon;
196
+ const isPassword = type === "password";
197
+ const canTogglePassword = isPassword && showPasswordToggle && !disabled && !readOnly;
198
+ const [showPassword, setShowPassword] = React__namespace.useState(false);
199
+ const inputType = canTogglePassword ? (showPassword ? "text" : "password") : type;
183
200
  const wrapperClasses = [
184
201
  "cz-input-wrapper",
185
- `cz-input-wrapper-${size}`,
186
- leftIcon && "cz-input-has-left-icon",
187
- (rightIcon || onClear) && "cz-input-has-right-icon",
202
+ `cz-input-wrapper-${resolvedSize}`,
203
+ `cz-input-wrapper-variant-${variant}`,
204
+ resolvedLeftIcon && "cz-input-has-left-icon",
205
+ (rightIcon || onClear || canTogglePassword) && "cz-input-has-right-icon",
188
206
  error && "cz-input-wrapper-error",
207
+ readOnly && "cz-input-wrapper-readonly",
189
208
  disabled && "cz-disabled",
190
209
  ].filter(Boolean).join(" ");
191
210
  const inputClasses = [
192
211
  "cz-input",
193
- `cz-input-${size}`,
212
+ `cz-input-${resolvedSize}`,
213
+ `cz-input-variant-${variant}`,
194
214
  error && "cz-input-error",
195
215
  className,
196
216
  ].filter(Boolean).join(" ");
197
- return (jsxRuntime.jsxs("div", { className: "cz-input-field", children: [label && (jsxRuntime.jsx("label", { htmlFor: inputId, className: "cz-label", children: label })), jsxRuntime.jsxs("div", { className: wrapperClasses, children: [leftIcon && (jsxRuntime.jsx("span", { className: "cz-input-icon cz-input-icon-left", children: leftIcon })), jsxRuntime.jsx("input", { ref: ref, id: inputId, className: inputClasses, value: value, disabled: disabled, ...props }), onClear && hasValue && !disabled && (jsxRuntime.jsx("button", { type: "button", className: "cz-input-clear", onClick: onClear, tabIndex: -1, "aria-label": "Clear input", children: jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })), rightIcon && !onClear && (jsxRuntime.jsx("span", { className: "cz-input-icon cz-input-icon-right", children: rightIcon }))] }), description && !error && (jsxRuntime.jsx("span", { className: "cz-input-description", children: description })), error && jsxRuntime.jsx("span", { className: "cz-error", children: error })] }));
217
+ return (jsxRuntime.jsxs("div", { className: "cz-input-field", children: [label && (jsxRuntime.jsx("label", { htmlFor: inputId, className: "cz-label", children: label })), jsxRuntime.jsxs("div", { className: wrapperClasses, children: [resolvedLeftIcon && (jsxRuntime.jsx("span", { className: "cz-input-icon cz-input-icon-left", children: resolvedLeftIcon })), jsxRuntime.jsx("input", { ref: ref, id: inputId, className: inputClasses, type: inputType, value: value, disabled: disabled, readOnly: readOnly, ...props }), canTogglePassword ? (jsxRuntime.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 ? (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("path", { d: "M3 3L21 21", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M10.58 10.58A2 2 0 0013.41 13.41", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.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" }), jsxRuntime.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" })] })) : (jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.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" }), jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "3", stroke: "currentColor", strokeWidth: "2" })] })) })) : null, onClear && hasValue && !disabled && !readOnly && (jsxRuntime.jsx("button", { type: "button", className: "cz-input-clear", onClick: onClear, tabIndex: -1, "aria-label": "Clear input", children: jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M12 4L4 12M4 4L12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) })), rightIcon && !onClear && !canTogglePassword && (jsxRuntime.jsx("span", { className: "cz-input-icon cz-input-icon-right", children: rightIcon }))] }), description && !error && (jsxRuntime.jsx("span", { className: "cz-input-description", children: description })), typeof error === "string" && error.length > 0 ? (jsxRuntime.jsx("span", { className: "cz-error", children: error })) : null] }));
198
218
  });
199
219
  Input.displayName = "Input";
200
220
 
@@ -236,6 +256,77 @@ const Badge = React__namespace.forwardRef(({ className = "", variant = "default"
236
256
  });
237
257
  Badge.displayName = "Badge";
238
258
 
259
+ const STATUS_TONE_MAP = {
260
+ "checked in": "success",
261
+ active: "success",
262
+ present: "success",
263
+ success: "success",
264
+ "checked out": "danger",
265
+ inactive: "danger",
266
+ absent: "danger",
267
+ danger: "danger",
268
+ error: "danger",
269
+ maintenance: "warning",
270
+ pending: "warning",
271
+ warning: "warning",
272
+ };
273
+ const TONE_STYLES = {
274
+ success: {
275
+ bg: "var(--cz-status-badge-success-bg, var(--color-success-bg-light, hsl(var(--cz-color-success) / 0.12)))",
276
+ text: "var(--cz-status-badge-success-text, var(--color-success-dark, hsl(var(--cz-color-success))))",
277
+ dot: "var(--cz-status-badge-success-dot, var(--color-success, hsl(var(--cz-color-success))))",
278
+ },
279
+ danger: {
280
+ bg: "var(--cz-status-badge-danger-bg, var(--color-danger-bg-light, hsl(var(--cz-color-danger) / 0.12)))",
281
+ text: "var(--cz-status-badge-danger-text, var(--color-danger-dark, hsl(var(--cz-color-danger))))",
282
+ dot: "var(--cz-status-badge-danger-dot, var(--color-danger, hsl(var(--cz-color-danger))))",
283
+ },
284
+ warning: {
285
+ bg: "var(--cz-status-badge-warning-bg, var(--color-warning-bg-light, hsl(var(--cz-color-warning) / 0.12)))",
286
+ text: "var(--cz-status-badge-warning-text, var(--color-warning-dark, hsl(var(--cz-color-warning))))",
287
+ dot: "var(--cz-status-badge-warning-dot, var(--color-warning, hsl(var(--cz-color-warning))))",
288
+ },
289
+ primary: {
290
+ bg: "var(--cz-status-badge-primary-bg, var(--color-primary-bg, hsl(var(--cz-color-primary) / 0.12)))",
291
+ text: "var(--cz-status-badge-primary-text, var(--color-primary-dark, hsl(var(--cz-color-primary))))",
292
+ dot: "var(--cz-status-badge-primary-dot, var(--color-primary, hsl(var(--cz-color-primary))))",
293
+ },
294
+ };
295
+ function normalizeStatus(status) {
296
+ if (typeof status === "string")
297
+ return status.trim().toLowerCase();
298
+ return String(status ?? "").trim().toLowerCase();
299
+ }
300
+ const StatusBadge = React__namespace.forwardRef(({ status, children, tone, showDot = true, className = "", style = {}, ...props }, ref) => {
301
+ const label = children ?? status;
302
+ const normalizedStatus = normalizeStatus(status ?? label);
303
+ const resolvedTone = tone ?? STATUS_TONE_MAP[normalizedStatus] ?? "primary";
304
+ const colors = TONE_STYLES[resolvedTone];
305
+ const baseStyles = {
306
+ display: "inline-flex",
307
+ alignItems: "center",
308
+ padding: "var(--cz-status-badge-padding-y, 0.25rem) var(--cz-status-badge-padding-x, 0.625rem)",
309
+ borderRadius: "var(--cz-status-badge-border-radius, 9999px)",
310
+ fontSize: "var(--cz-status-badge-font-size, 0.75rem)",
311
+ lineHeight: "var(--cz-status-badge-line-height, 1rem)",
312
+ fontWeight: "var(--cz-status-badge-font-weight, var(--font-weight-medium, var(--cz-font-weight-medium)))",
313
+ backgroundColor: colors.bg,
314
+ color: colors.text,
315
+ whiteSpace: "nowrap",
316
+ ...style,
317
+ };
318
+ const dotStyles = {
319
+ width: "var(--cz-status-badge-dot-size, 0.5rem)",
320
+ height: "var(--cz-status-badge-dot-size, 0.5rem)",
321
+ borderRadius: "9999px",
322
+ marginRight: "var(--cz-status-badge-dot-gap, 0.375rem)",
323
+ backgroundColor: colors.dot,
324
+ flexShrink: 0,
325
+ };
326
+ return (jsxRuntime.jsxs(Badge, { ref: ref, variant: "default", size: "md", className: className, style: baseStyles, ...props, children: [showDot && jsxRuntime.jsx("span", { "aria-hidden": "true", style: dotStyles }), label] }));
327
+ });
328
+ StatusBadge.displayName = "StatusBadge";
329
+
239
330
  const Textarea = React__namespace.forwardRef(({ className = "", label, description, error, size = "md", id, autoResize = false, maxRows, disabled, onInput, style, ...props }, ref) => {
240
331
  const textareaId = id || React__namespace.useId();
241
332
  const internalRef = React__namespace.useRef(null);
@@ -5695,13 +5786,111 @@ var List = TabsList$1;
5695
5786
  var Trigger$4 = TabsTrigger$1;
5696
5787
  var Content$2 = TabsContent$1;
5697
5788
 
5698
- const TabsRoot = React__namespace.forwardRef(({ className = "", ...props }, ref) => (jsxRuntime.jsx(Root2$4, { ref: ref, className: `cz-tabs ${className}`, ...props })));
5789
+ const cx = (...parts) => parts.filter(Boolean).join(" ");
5790
+ const toTabKey = (value) => {
5791
+ if (value === undefined)
5792
+ return undefined;
5793
+ return String(value);
5794
+ };
5795
+ const coerceValueByReference = (value, reference) => {
5796
+ if (typeof reference === "number") {
5797
+ const parsed = Number(value);
5798
+ return Number.isNaN(parsed) ? value : parsed;
5799
+ }
5800
+ if (typeof reference === "boolean") {
5801
+ return value === "true";
5802
+ }
5803
+ return value;
5804
+ };
5805
+ const normalizeSize = (size) => {
5806
+ if (size === "small")
5807
+ return "sm";
5808
+ if (size === "large")
5809
+ return "lg";
5810
+ if (size === "medium" || size === undefined)
5811
+ return "md";
5812
+ return size;
5813
+ };
5814
+ const normalizeVariant = (variant) => {
5815
+ if (variant === "pills" || variant === "enclosed")
5816
+ return variant;
5817
+ return "underline";
5818
+ };
5819
+ const TabsRoot = React__namespace.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) => {
5820
+ const dataItems = React__namespace.useMemo(() => {
5821
+ if (Array.isArray(items))
5822
+ return items;
5823
+ if (Array.isArray(tabs))
5824
+ return tabs;
5825
+ return undefined;
5826
+ }, [items, tabs]);
5827
+ const hasItems = Boolean(dataItems && dataItems.length > 0);
5828
+ const resolvedVariant = normalizeVariant(variant ?? (hasItems ? "pills" : "underline"));
5829
+ const resolvedSize = normalizeSize(size);
5830
+ const controlledValue = value !== undefined ? value : activeTab;
5831
+ const resolvedDefaultValue = defaultValue !== undefined
5832
+ ? defaultValue
5833
+ : controlledValue === undefined && hasItems
5834
+ ? dataItems?.[0]?.value
5835
+ : undefined;
5836
+ const controlledKey = toTabKey(controlledValue);
5837
+ const defaultKey = toTabKey(resolvedDefaultValue);
5838
+ const [internalActiveKey, setInternalActiveKey] = React__namespace.useState(controlledKey ?? defaultKey);
5839
+ React__namespace.useEffect(() => {
5840
+ if (controlledKey !== undefined) {
5841
+ setInternalActiveKey(controlledKey);
5842
+ }
5843
+ }, [controlledKey]);
5844
+ const itemValueMap = React__namespace.useMemo(() => {
5845
+ const map = new Map();
5846
+ dataItems?.forEach((item) => {
5847
+ map.set(String(item.value), item.value);
5848
+ });
5849
+ return map;
5850
+ }, [dataItems]);
5851
+ const referenceValue = controlledValue !== undefined
5852
+ ? controlledValue
5853
+ : defaultValue !== undefined
5854
+ ? defaultValue
5855
+ : dataItems?.[0]?.value;
5856
+ const handleValueChange = React__namespace.useCallback((nextKey) => {
5857
+ setInternalActiveKey(nextKey);
5858
+ onValueChange?.(nextKey);
5859
+ const resolvedValue = itemValueMap.has(nextKey)
5860
+ ? itemValueMap.get(nextKey)
5861
+ : coerceValueByReference(nextKey, referenceValue);
5862
+ onChange?.(resolvedValue);
5863
+ setActiveTab?.(resolvedValue);
5864
+ }, [itemValueMap, onChange, onValueChange, referenceValue, setActiveTab]);
5865
+ const activeKey = controlledKey ?? internalActiveKey;
5866
+ const shouldRenderAutoContent = hasItems &&
5867
+ Boolean(dataItems?.some((item) => item.content !== undefined) || renderContent);
5868
+ return (jsxRuntime.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 ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TabsList, { className: listClassName, style: listStyle, children: dataItems?.map((item) => {
5869
+ const itemKey = String(item.value);
5870
+ const isActive = activeKey === itemKey;
5871
+ const triggerNode = renderItem
5872
+ ? renderItem(item, { isActive })
5873
+ : item.label;
5874
+ return (jsxRuntime.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));
5875
+ }) }), shouldRenderAutoContent
5876
+ ? dataItems?.map((item) => {
5877
+ const itemKey = String(item.value);
5878
+ const isActive = activeKey === itemKey;
5879
+ const content = renderContent
5880
+ ? renderContent(item, { isActive })
5881
+ : item.content;
5882
+ if (content === undefined || content === null)
5883
+ return null;
5884
+ return (jsxRuntime.jsx(TabsContent, { value: item.value, children: content }, `content-${itemKey}`));
5885
+ })
5886
+ : null] })) : null, children] }));
5887
+ });
5699
5888
  TabsRoot.displayName = "Tabs";
5700
- const TabsList = React__namespace.forwardRef(({ className = "", ...props }, ref) => (jsxRuntime.jsx(List, { ref: ref, className: `cz-tabs-list ${className}`, ...props })));
5889
+ const TabsList = React__namespace.forwardRef(({ className = "", ...props }, ref) => (jsxRuntime.jsx(List, { ref: ref, className: cx("cz-tabs-list", className), ...props })));
5701
5890
  TabsList.displayName = "Tabs.List";
5702
- const TabsTrigger = React__namespace.forwardRef(({ className = "", ...props }, ref) => (jsxRuntime.jsx(Trigger$4, { ref: ref, className: `cz-tabs-trigger ${className}`, ...props })));
5891
+ const TabsTrigger = React__namespace.forwardRef(({ className = "", children, value, icon, count, ...props }, ref) => (jsxRuntime.jsxs(Trigger$4, { ref: ref, className: cx("cz-tabs-trigger", className), value: String(value), ...props, children: [icon ? jsxRuntime.jsx("span", { className: "cz-tabs-trigger-icon", children: icon }) : null, children, count !== undefined && count !== null ? (jsxRuntime.jsx("span", { className: "cz-tabs-trigger-count", children: count })) : null] })));
5703
5892
  TabsTrigger.displayName = "Tabs.Trigger";
5704
- const TabsContent = React__namespace.forwardRef(({ className = "", ...props }, ref) => (jsxRuntime.jsx(Content$2, { ref: ref, className: `cz-tabs-content ${className}`, ...props })));
5893
+ const TabsContent = React__namespace.forwardRef(({ className = "", value, ...props }, ref) => (jsxRuntime.jsx(Content$2, { ref: ref, className: cx("cz-tabs-content", className), value: String(value), ...props })));
5705
5894
  TabsContent.displayName = "Tabs.Content";
5706
5895
  // ===== Export =====
5707
5896
  const Tabs = Object.assign(TabsRoot, {
@@ -7251,6 +7440,261 @@ const Dialog = Object.assign(DialogRoot, {
7251
7440
  Overlay: DialogOverlay,
7252
7441
  });
7253
7442
 
7443
+ const SIZE_WIDTH_MAP = {
7444
+ sm: "28rem",
7445
+ md: "36rem",
7446
+ lg: "48rem",
7447
+ xl: "64rem",
7448
+ full: "min(96vw, 96rem)",
7449
+ };
7450
+ const MODAL_BASE_Z_INDEX = 60;
7451
+ const MODAL_LAYER_STEP = 2;
7452
+ let nextModalLayer = 0;
7453
+ function toCssDimension(value) {
7454
+ if (value === undefined || value === null)
7455
+ return undefined;
7456
+ return typeof value === "number" ? `${value}px` : value;
7457
+ }
7458
+ const CloseIcon = () => (jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 15 15", fill: "none", "aria-hidden": "true", children: jsxRuntime.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" }) }));
7459
+ const Modal = React__namespace.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) => {
7460
+ const resolvedOpen = isOpen ?? open;
7461
+ const isControlled = resolvedOpen !== undefined;
7462
+ const resolvedDefaultOpen = defaultOpen ?? (!isControlled && !trigger ? true : undefined);
7463
+ const [isOpenState, setIsOpenState] = React__namespace.useState(() => {
7464
+ if (resolvedOpen !== undefined)
7465
+ return resolvedOpen;
7466
+ if (resolvedDefaultOpen !== undefined)
7467
+ return resolvedDefaultOpen;
7468
+ return false;
7469
+ });
7470
+ const [layerIndex, setLayerIndex] = React__namespace.useState(0);
7471
+ const assignedLayerRef = React__namespace.useRef(null);
7472
+ React__namespace.useEffect(() => {
7473
+ if (resolvedOpen !== undefined) {
7474
+ setIsOpenState(resolvedOpen);
7475
+ }
7476
+ }, [resolvedOpen]);
7477
+ React__namespace.useEffect(() => {
7478
+ if (!isOpenState) {
7479
+ assignedLayerRef.current = null;
7480
+ setLayerIndex(0);
7481
+ return;
7482
+ }
7483
+ if (assignedLayerRef.current === null) {
7484
+ assignedLayerRef.current = nextModalLayer++;
7485
+ }
7486
+ setLayerIndex(assignedLayerRef.current);
7487
+ }, [isOpenState]);
7488
+ const handleOpenChange = React__namespace.useCallback((nextOpen) => {
7489
+ setIsOpenState(nextOpen);
7490
+ if (!nextOpen) {
7491
+ assignedLayerRef.current = null;
7492
+ }
7493
+ onOpenChange?.(nextOpen);
7494
+ if (!nextOpen) {
7495
+ onClose?.();
7496
+ }
7497
+ }, [onOpenChange, onClose]);
7498
+ const hasOpenHandler = Boolean(onOpenChange || onClose);
7499
+ const resolvedWidth = toCssDimension(width) ?? SIZE_WIDTH_MAP[size];
7500
+ const resolvedMinHeight = toCssDimension(minHeight);
7501
+ const overlayStyles = {
7502
+ position: "fixed",
7503
+ inset: 0,
7504
+ zIndex: MODAL_BASE_Z_INDEX + layerIndex * MODAL_LAYER_STEP,
7505
+ backgroundColor: "var(--cz-modal-overlay-bg, var(--color-bg-modal-overlay, rgba(15, 23, 42, 0.55)))",
7506
+ backdropFilter: "blur(2px)",
7507
+ };
7508
+ const contentStyles = {
7509
+ position: "fixed",
7510
+ left: "50%",
7511
+ top: "50%",
7512
+ transform: "translate(-50%, -50%)",
7513
+ zIndex: MODAL_BASE_Z_INDEX + layerIndex * MODAL_LAYER_STEP + 1,
7514
+ backgroundColor: "var(--cz-modal-content-bg, var(--color-bg-primary, hsl(var(--cz-color-bg))))",
7515
+ borderRadius: "var(--cz-modal-content-border-radius, var(--radius-modal, var(--cz-radius-lg)))",
7516
+ border: "1px solid var(--cz-modal-content-border-color, hsl(var(--cz-color-border)))",
7517
+ boxShadow: "var(--cz-modal-content-shadow, var(--shadow-modal, var(--cz-shadow-lg)))",
7518
+ display: "flex",
7519
+ flexDirection: "column",
7520
+ overflow: "hidden",
7521
+ width: resolvedWidth,
7522
+ maxWidth: "calc(100% - 2rem)",
7523
+ maxHeight: "calc(100vh - 2rem)",
7524
+ minHeight: resolvedMinHeight,
7525
+ ...(fullHeight ? { height: "calc(100vh - 2rem)" } : null),
7526
+ ...style,
7527
+ };
7528
+ const headerStyles = {
7529
+ display: "flex",
7530
+ alignItems: "flex-start",
7531
+ justifyContent: "space-between",
7532
+ gap: "var(--cz-spacing-md, 0.75rem)",
7533
+ padding: "var(--cz-modal-header-padding, var(--cz-spacing-lg, 1rem) var(--cz-spacing-lg, 1rem) var(--cz-spacing-md, 0.75rem))",
7534
+ borderBottom: "1px solid hsl(var(--cz-color-border))",
7535
+ flexShrink: 0,
7536
+ };
7537
+ const headerTextStyles = {
7538
+ minWidth: 0,
7539
+ display: "flex",
7540
+ flexDirection: "column",
7541
+ gap: "0.25rem",
7542
+ };
7543
+ const titleStyles = {
7544
+ margin: 0,
7545
+ fontSize: "var(--cz-font-size-xl)",
7546
+ fontWeight: "var(--cz-font-weight-semibold)",
7547
+ color: "var(--color-primary, hsl(var(--cz-color-primary)))",
7548
+ lineHeight: "var(--cz-font-lineHeight-tight)",
7549
+ };
7550
+ const descriptionStyles = {
7551
+ margin: 0,
7552
+ fontSize: "var(--cz-font-size-sm)",
7553
+ color: "hsl(var(--cz-color-mutedFg))",
7554
+ };
7555
+ const bodyStyles = {
7556
+ padding: "var(--cz-modal-body-padding, var(--cz-spacing-md, 0.75rem) var(--cz-spacing-lg, 1rem) var(--cz-spacing-lg, 1rem))",
7557
+ overflowY: "auto",
7558
+ flex: 1,
7559
+ };
7560
+ const footerStyles = {
7561
+ display: "flex",
7562
+ alignItems: "center",
7563
+ justifyContent: "flex-end",
7564
+ gap: "var(--cz-modal-footer-gap, var(--cz-spacing-md, 0.75rem))",
7565
+ padding: "var(--cz-modal-footer-padding, var(--cz-spacing-md, 0.75rem) var(--cz-spacing-lg, 1rem))",
7566
+ borderTop: "1px solid hsl(var(--cz-color-border))",
7567
+ flexShrink: 0,
7568
+ };
7569
+ const hasTabs = Boolean(tabs && tabs.length > 0);
7570
+ const shouldRenderTitle = Boolean(title) && !(hasTabs && hideTitle);
7571
+ const shouldRenderDescription = Boolean(description) && !(hasTabs && hideTitle);
7572
+ const tabsLayoutStyles = {
7573
+ display: "flex",
7574
+ flexDirection: "column",
7575
+ gap: "var(--cz-spacing-sm, 0.5rem)",
7576
+ width: "100%",
7577
+ minWidth: 0,
7578
+ };
7579
+ const tabsTopRowStyles = {
7580
+ display: "flex",
7581
+ alignItems: "center",
7582
+ justifyContent: "space-between",
7583
+ gap: "var(--cz-spacing-md, 0.75rem)",
7584
+ };
7585
+ const tabsRowStyles = {
7586
+ display: "flex",
7587
+ alignItems: "center",
7588
+ gap: "var(--cz-spacing-md, 0.75rem)",
7589
+ minWidth: 0,
7590
+ };
7591
+ const tabsNavStyles = {
7592
+ display: "flex",
7593
+ alignItems: "center",
7594
+ gap: 0,
7595
+ overflowX: "auto",
7596
+ overflowY: "hidden",
7597
+ minWidth: 0,
7598
+ flex: 1,
7599
+ scrollbarWidth: "thin",
7600
+ paddingBottom: "0.25rem",
7601
+ marginBottom: "-0.25rem",
7602
+ };
7603
+ const getTabButtonStyles = (isActive, isDisabled) => ({
7604
+ display: "inline-flex",
7605
+ alignItems: "center",
7606
+ justifyContent: "center",
7607
+ gap: "0.375rem",
7608
+ padding: "0.5rem 0.75rem",
7609
+ fontSize: "var(--cz-modal-tab-font-size, 13px)",
7610
+ fontWeight: isActive
7611
+ ? "var(--cz-font-weight-semibold)"
7612
+ : "var(--cz-modal-tab-font-weight, var(--cz-font-weight-medium))",
7613
+ color: isActive
7614
+ ? "var(--cz-modal-tab-active-color, var(--color-primary, hsl(var(--cz-color-primary))))"
7615
+ : "var(--cz-modal-tab-color, var(--color-text-muted, hsl(var(--cz-color-mutedFg))))",
7616
+ backgroundColor: "transparent",
7617
+ border: 0,
7618
+ borderBottom: isActive
7619
+ ? "2px solid var(--cz-modal-tab-active-border-color, var(--color-primary, hsl(var(--cz-color-primary))))"
7620
+ : "2px solid transparent",
7621
+ marginBottom: "-1px",
7622
+ whiteSpace: "nowrap",
7623
+ outline: "none",
7624
+ boxShadow: "none",
7625
+ cursor: isDisabled ? "not-allowed" : "pointer",
7626
+ opacity: isDisabled ? 0.5 : 1,
7627
+ transition: "all var(--cz-transition-fast)",
7628
+ });
7629
+ const contentAriaDescribedBy = shouldRenderDescription
7630
+ ? props["aria-describedby"]
7631
+ : undefined;
7632
+ const contentAriaLabelledBy = shouldRenderTitle
7633
+ ? props["aria-labelledby"]
7634
+ : undefined;
7635
+ const contentAriaLabel = props["aria-label"] ??
7636
+ (typeof title === "string" && !shouldRenderTitle ? title : undefined);
7637
+ const normalizeFooter = () => {
7638
+ if (footer === undefined || footer === null)
7639
+ return footer;
7640
+ const directChildren = React__namespace.Children.toArray(footer);
7641
+ if (directChildren.length !== 1) {
7642
+ return footer;
7643
+ }
7644
+ const firstChild = directChildren[0];
7645
+ if (!React__namespace.isValidElement(firstChild) || typeof firstChild.type !== "string") {
7646
+ return footer;
7647
+ }
7648
+ const childProps = (firstChild.props ?? {});
7649
+ const nestedChildren = React__namespace.Children.toArray(childProps.children);
7650
+ if (nestedChildren.length <= 1) {
7651
+ return footer;
7652
+ }
7653
+ const existingStyle = childProps.style ?? {};
7654
+ return React__namespace.cloneElement(firstChild, {
7655
+ style: {
7656
+ display: existingStyle.display ?? "flex",
7657
+ alignItems: existingStyle.alignItems ?? "center",
7658
+ justifyContent: existingStyle.justifyContent ?? "flex-end",
7659
+ gap: existingStyle.gap ??
7660
+ "var(--cz-modal-footer-gap, var(--cz-spacing-md, 0.75rem))",
7661
+ ...existingStyle,
7662
+ },
7663
+ });
7664
+ };
7665
+ const normalizedFooter = normalizeFooter();
7666
+ const handleInteractOutside = (event) => {
7667
+ if (!closeOnOverlay) {
7668
+ event.preventDefault();
7669
+ }
7670
+ onInteractOutside?.(event);
7671
+ };
7672
+ const handleEscapeKeyDown = (event) => {
7673
+ if (!closeOnEsc) {
7674
+ event.preventDefault();
7675
+ }
7676
+ onEscapeKeyDown?.(event);
7677
+ };
7678
+ const closeButton = showCloseButton ? (jsxRuntime.jsx(Close, { asChild: true, children: closeButtonVariant === "button" ? (jsxRuntime.jsx("button", { type: "button", className: "cz-modal-close-btn cz-btn cz-btn-primary cz-btn-sm", children: closeButtonText })) : (jsxRuntime.jsx("button", { type: "button", className: "cz-modal-close-icon", "aria-label": "Close", children: jsxRuntime.jsx(CloseIcon, {}) })) })) : null;
7679
+ return (jsxRuntime.jsxs(Root$5, { open: resolvedOpen, defaultOpen: resolvedDefaultOpen, onOpenChange: hasOpenHandler ? handleOpenChange : onOpenChange, modal: modal, children: [trigger ? jsxRuntime.jsx(Trigger$3, { asChild: true, children: trigger }) : null, jsxRuntime.jsxs(Portal$2, { container: portalContainer, children: [jsxRuntime.jsx(Overlay, { className: `cz-modal-overlay ${overlayClassName}`.trim(), style: overlayStyles }), jsxRuntime.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 ||
7680
+ shouldRenderTitle ||
7681
+ shouldRenderDescription ||
7682
+ closeButton) && (jsxRuntime.jsx("div", { className: `cz-modal-header ${headerClassName}`.trim(), style: headerStyles, children: hasTabs ? (jsxRuntime.jsxs("div", { className: "cz-modal-tabs-layout", style: tabsLayoutStyles, children: [!hideTitle &&
7683
+ (shouldRenderTitle ||
7684
+ shouldRenderDescription ||
7685
+ closeButton) && (jsxRuntime.jsxs("div", { className: "cz-modal-tabs-top-row", style: tabsTopRowStyles, children: [(shouldRenderTitle || shouldRenderDescription) && (jsxRuntime.jsxs("div", { className: "cz-modal-header-text", style: headerTextStyles, children: [shouldRenderTitle ? (jsxRuntime.jsx(Title, { className: "cz-modal-title", style: titleStyles, children: title })) : null, shouldRenderDescription ? (jsxRuntime.jsx(Description, { className: "cz-modal-description", style: descriptionStyles, children: description })) : null] })), closeButton] })), jsxRuntime.jsxs("div", { className: "cz-modal-tabs-row", style: tabsRowStyles, children: [jsxRuntime.jsx("div", { className: "cz-modal-tabs-nav", style: tabsNavStyles, role: "tablist", "aria-label": "Modal tabs", children: tabs?.map((tab) => {
7686
+ const tabId = String(tab.id);
7687
+ const isActive = activeTab === tabId;
7688
+ const label = tab.label ?? tab.name ?? tabId;
7689
+ const isDisabled = Boolean(tab.disabled);
7690
+ return (jsxRuntime.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 ? (jsxRuntime.jsx("span", { style: {
7691
+ display: "inline-flex",
7692
+ alignItems: "center",
7693
+ }, children: tab.icon })) : null, jsxRuntime.jsx("span", { children: label })] }, tabId));
7694
+ }) }), hideTitle ? closeButton : null] })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(shouldRenderTitle || shouldRenderDescription) && (jsxRuntime.jsxs("div", { className: "cz-modal-header-text", style: headerTextStyles, children: [shouldRenderTitle ? (jsxRuntime.jsx(Title, { className: "cz-modal-title", style: titleStyles, children: title })) : null, shouldRenderDescription ? (jsxRuntime.jsx(Description, { className: "cz-modal-description", style: descriptionStyles, children: description })) : null] })), closeButton] })) })), jsxRuntime.jsx("div", { className: `cz-modal-body ${bodyClassName}`.trim(), style: bodyStyles, children: children }), footer !== undefined && footer !== null ? (jsxRuntime.jsx("div", { className: `cz-modal-footer ${footerClassName}`.trim(), style: footerStyles, children: normalizedFooter })) : null] })] })] }));
7695
+ });
7696
+ Modal.displayName = "Modal";
7697
+
7254
7698
  // packages/core/number/src/number.ts
7255
7699
  function clamp(value, [min, max]) {
7256
7700
  return Math.min(max, Math.max(min, value));
@@ -8844,6 +9288,242 @@ const Table = Object.assign(TableRoot, {
8844
9288
  Cell: TableCell,
8845
9289
  });
8846
9290
 
9291
+ const SORT_ICON_STYLE = {
9292
+ opacity: "var(--cz-data-table-sort-icon-opacity, 0.3)",
9293
+ };
9294
+ const iconStyles = {
9295
+ display: "inline-flex",
9296
+ width: 14,
9297
+ height: 14,
9298
+ flexShrink: 0,
9299
+ };
9300
+ const SortNeutralIcon = () => (jsxRuntime.jsxs("svg", { viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", style: { ...iconStyles, ...SORT_ICON_STYLE }, children: [jsxRuntime.jsx("path", { d: "M4 5L7 2L10 5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsxRuntime.jsx("path", { d: "M10 9L7 12L4 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
9301
+ const SortAscIcon = () => (jsxRuntime.jsx("svg", { viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", style: iconStyles, children: jsxRuntime.jsx("path", { d: "M4 8L7 5L10 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9302
+ const SortDescIcon = () => (jsxRuntime.jsx("svg", { viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", style: iconStyles, children: jsxRuntime.jsx("path", { d: "M10 6L7 9L4 6", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9303
+ const LeftChevronIcon = () => (jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: { width: 16, height: 16 }, children: jsxRuntime.jsx("path", { d: "M9.5 3.5L5 8L9.5 12.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9304
+ const RightChevronIcon = () => (jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: { width: 16, height: 16 }, children: jsxRuntime.jsx("path", { d: "M6.5 3.5L11 8L6.5 12.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", strokeLinejoin: "round" }) }));
9305
+ const EmptyStateIcon = () => (jsxRuntime.jsxs("svg", { viewBox: "0 0 48 48", fill: "none", "aria-hidden": "true", style: { width: 32, height: 32 }, children: [jsxRuntime.jsx("circle", { cx: "24", cy: "24", r: "16", stroke: "currentColor", strokeWidth: "2", opacity: "0.6" }), jsxRuntime.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" })] }));
9306
+ function resolveValue(row, key) {
9307
+ return row[key];
9308
+ }
9309
+ function compareValues(aVal, bVal) {
9310
+ if (aVal === bVal)
9311
+ return 0;
9312
+ if (aVal === null || aVal === undefined)
9313
+ return 1;
9314
+ if (bVal === null || bVal === undefined)
9315
+ return -1;
9316
+ if (typeof aVal === "number" && typeof bVal === "number") {
9317
+ return aVal < bVal ? -1 : 1;
9318
+ }
9319
+ const aText = String(aVal).toLowerCase();
9320
+ const bText = String(bVal).toLowerCase();
9321
+ if (aText === bText)
9322
+ return 0;
9323
+ return aText < bText ? -1 : 1;
9324
+ }
9325
+ const DataTable = React__namespace.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 ??
9326
+ row._id ??
9327
+ index, variant = "default", className = "", style = {}, ...props }, ref) => {
9328
+ const isBusy = loading || isLoading;
9329
+ const [sortKey, setSortKey] = React__namespace.useState(defaultSortKey);
9330
+ const [sortDir, setSortDir] = React__namespace.useState(defaultSortDir);
9331
+ const [internalPage, setInternalPage] = React__namespace.useState(1);
9332
+ const sortedData = React__namespace.useMemo(() => {
9333
+ if (!sortKey || !sortable)
9334
+ return data;
9335
+ return [...data].sort((a, b) => {
9336
+ const aVal = resolveValue(a, sortKey);
9337
+ const bVal = resolveValue(b, sortKey);
9338
+ const result = compareValues(aVal, bVal);
9339
+ return sortDir === "asc" ? result : -result;
9340
+ });
9341
+ }, [data, sortKey, sortDir, sortable]);
9342
+ const totalPages = Math.max(1, Math.ceil(sortedData.length / pageSize));
9343
+ const page = controlledPage !== undefined ? controlledPage : internalPage;
9344
+ const paginatedData = React__namespace.useMemo(() => {
9345
+ if (!pagination)
9346
+ return sortedData;
9347
+ const start = (page - 1) * pageSize;
9348
+ return sortedData.slice(start, start + pageSize);
9349
+ }, [sortedData, pagination, page, pageSize]);
9350
+ const setPage = (nextPage) => {
9351
+ const clamped = Math.max(1, Math.min(nextPage, totalPages));
9352
+ if (controlledPage !== undefined) {
9353
+ onPageChange?.(clamped);
9354
+ }
9355
+ else {
9356
+ setInternalPage(clamped);
9357
+ }
9358
+ };
9359
+ const getPageRowId = (row, index) => getRowId(row, index);
9360
+ const pageRowIds = paginatedData.map(getPageRowId);
9361
+ const allSelected = pageRowIds.length > 0 && pageRowIds.every((rowId) => selectedRows.includes(rowId));
9362
+ const someSelected = pageRowIds.some((rowId) => selectedRows.includes(rowId));
9363
+ const handleSort = (key) => {
9364
+ if (!sortable)
9365
+ return;
9366
+ if (sortKey === key) {
9367
+ setSortDir(sortDir === "asc" ? "desc" : "asc");
9368
+ return;
9369
+ }
9370
+ setSortKey(key);
9371
+ setSortDir("asc");
9372
+ };
9373
+ const handleSelectAll = (checked) => {
9374
+ if (!onSelectionChange)
9375
+ return;
9376
+ if (checked) {
9377
+ onSelectionChange([...new Set([...selectedRows, ...pageRowIds])]);
9378
+ return;
9379
+ }
9380
+ onSelectionChange(selectedRows.filter((rowId) => !pageRowIds.includes(rowId)));
9381
+ };
9382
+ const handleSelectRow = (rowId, checked) => {
9383
+ if (!onSelectionChange)
9384
+ return;
9385
+ if (checked) {
9386
+ onSelectionChange([...selectedRows, rowId]);
9387
+ return;
9388
+ }
9389
+ onSelectionChange(selectedRows.filter((id) => id !== rowId));
9390
+ };
9391
+ const containerStyles = {
9392
+ display: "flex",
9393
+ flexDirection: "column",
9394
+ background: "var(--cz-data-table-container-bg, var(--color-bg-primary, hsl(var(--cz-color-bg))))",
9395
+ borderRadius: "var(--cz-data-table-container-border-radius, var(--radius-card, var(--cz-radius-lg)))",
9396
+ border: "1px solid var(--cz-data-table-container-border-color, var(--color-border-primary, hsl(var(--cz-color-border))))",
9397
+ boxShadow: "var(--cz-data-table-container-shadow, var(--shadow-card, var(--cz-shadow-sm)))",
9398
+ overflow: "hidden",
9399
+ ["--cz-table-row-hover-bg"]: "var(--cz-data-table-row-hover-bg, var(--color-bg-hover, hsl(var(--cz-color-muted) / 0.5)))",
9400
+ ...style,
9401
+ };
9402
+ const headerCellStyles = (column) => ({
9403
+ padding: "var(--cz-data-table-header-cell-padding, var(--spacing-3, 0.75rem) var(--spacing-4, 1rem))",
9404
+ textAlign: column.align || "left",
9405
+ fontWeight: "var(--cz-data-table-header-font-weight, var(--font-weight-medium, var(--cz-font-weight-medium)))",
9406
+ color: "var(--cz-data-table-header-color, var(--table-header-text, var(--color-text-muted, hsl(var(--cz-color-mutedFg)))))",
9407
+ fontSize: "var(--cz-data-table-header-font-size, var(--font-size-xs, var(--cz-font-size-xs)))",
9408
+ letterSpacing: "var(--cz-data-table-header-letter-spacing, 0.02em)",
9409
+ textTransform: "var(--cz-data-table-header-text-transform, uppercase)",
9410
+ whiteSpace: "nowrap",
9411
+ cursor: sortable && column.sortable !== false ? "pointer" : "default",
9412
+ userSelect: sortable && column.sortable !== false ? "none" : "auto",
9413
+ width: column.width,
9414
+ borderBottom: "1px solid var(--cz-data-table-row-border-color, var(--color-border-primary, var(--cz-table-border-color)))",
9415
+ });
9416
+ const bodyCellStyles = (align = "left") => ({
9417
+ padding: "var(--cz-data-table-body-cell-padding, var(--spacing-3-5, 0.875rem) var(--spacing-4, 1rem))",
9418
+ textAlign: align,
9419
+ color: "var(--cz-data-table-body-color, var(--color-text-body, hsl(var(--cz-color-fg))))",
9420
+ verticalAlign: "middle",
9421
+ lineHeight: "1.5",
9422
+ fontSize: "var(--cz-data-table-body-font-size, var(--font-size-sm, var(--cz-font-size-sm)))",
9423
+ borderBottom: "1px solid var(--cz-data-table-row-border-color, var(--color-border-light, var(--cz-table-border-color)))",
9424
+ });
9425
+ const renderSortIcon = (key) => {
9426
+ if (sortKey !== key)
9427
+ return jsxRuntime.jsx(SortNeutralIcon, {});
9428
+ if (sortDir === "asc") {
9429
+ return jsxRuntime.jsx("span", { style: { color: "var(--cz-data-table-sort-active-color, var(--color-primary, hsl(var(--cz-color-primary))))" }, children: jsxRuntime.jsx(SortAscIcon, {}) });
9430
+ }
9431
+ return jsxRuntime.jsx("span", { style: { color: "var(--cz-data-table-sort-active-color, var(--color-primary, hsl(var(--cz-color-primary))))" }, children: jsxRuntime.jsx(SortDescIcon, {}) });
9432
+ };
9433
+ const tableClassName = variant === "striped" ? "cz-table-striped" : "";
9434
+ const pageButtonStyles = (disabled) => ({
9435
+ display: "inline-flex",
9436
+ alignItems: "center",
9437
+ justifyContent: "center",
9438
+ width: "var(--cz-data-table-pagination-button-size, 32px)",
9439
+ height: "var(--cz-data-table-pagination-button-size, 32px)",
9440
+ borderRadius: "var(--cz-data-table-pagination-button-radius, var(--radius-md, var(--cz-radius-md)))",
9441
+ background: "transparent",
9442
+ border: "1px solid var(--cz-data-table-pagination-button-border-color, transparent)",
9443
+ color: disabled
9444
+ ? "var(--cz-data-table-pagination-button-disabled-color, var(--color-text-disabled, hsl(var(--cz-color-mutedFg))))"
9445
+ : "var(--cz-data-table-pagination-button-color, var(--color-text-body, hsl(var(--cz-color-fg))))",
9446
+ cursor: disabled ? "not-allowed" : "pointer",
9447
+ opacity: disabled ? 0.5 : 1,
9448
+ transition: "all var(--transition-fast, var(--cz-transition-fast))",
9449
+ });
9450
+ if (isBusy) {
9451
+ return (jsxRuntime.jsx("div", { ref: ref, className: className, style: containerStyles, ...props, children: jsxRuntime.jsxs(Table, { className: tableClassName, children: [jsxRuntime.jsx(Table.Header, { children: jsxRuntime.jsxs(Table.Row, { children: [selectable && jsxRuntime.jsx(Table.Head, { style: { width: 48 } }), columns.map((column) => (jsxRuntime.jsx(Table.Head, { style: headerCellStyles(column), children: column.header }, column.key)))] }) }), jsxRuntime.jsx(Table.Body, { children: Array.from({ length: 5 }).map((_, rowIndex) => (jsxRuntime.jsxs(Table.Row, { children: [selectable && (jsxRuntime.jsx(Table.Cell, { style: bodyCellStyles(), children: jsxRuntime.jsx("div", { style: {
9452
+ width: 18,
9453
+ height: 18,
9454
+ borderRadius: 4,
9455
+ 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%)",
9456
+ }, className: "cz-data-table-shimmer" }) })), columns.map((column, columnIndex) => (jsxRuntime.jsx(Table.Cell, { style: bodyCellStyles(column.align), children: jsxRuntime.jsx("div", { style: {
9457
+ width: `${40 + ((rowIndex + columnIndex * 7) % 40)}%`,
9458
+ height: 16,
9459
+ borderRadius: "var(--radius-sm, var(--cz-radius-sm))",
9460
+ 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%)",
9461
+ }, className: "cz-data-table-shimmer" }) }, `${column.key}-${columnIndex}`)))] }, `loading-${rowIndex}`))) })] }) }));
9462
+ }
9463
+ if (data.length === 0) {
9464
+ return (jsxRuntime.jsx("div", { ref: ref, className: className, style: containerStyles, ...props, children: emptyState || (jsxRuntime.jsxs("div", { style: {
9465
+ padding: "var(--spacing-16, 4rem) var(--spacing-6, 1.5rem)",
9466
+ textAlign: "center",
9467
+ color: "var(--cz-data-table-empty-state-color, var(--color-text-muted, hsl(var(--cz-color-mutedFg))))",
9468
+ display: "flex",
9469
+ flexDirection: "column",
9470
+ alignItems: "center",
9471
+ justifyContent: "center",
9472
+ gap: "var(--spacing-4, 1rem)",
9473
+ }, children: [jsxRuntime.jsx("div", { style: {
9474
+ width: 64,
9475
+ height: 64,
9476
+ borderRadius: "50%",
9477
+ background: "var(--cz-data-table-empty-state-icon-bg, var(--color-bg-secondary, hsl(var(--cz-color-muted))))",
9478
+ display: "flex",
9479
+ alignItems: "center",
9480
+ justifyContent: "center",
9481
+ color: "var(--cz-data-table-empty-state-icon-color, var(--color-text-placeholder, hsl(var(--cz-color-mutedFg))))",
9482
+ }, children: jsxRuntime.jsx(EmptyStateIcon, {}) }), jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--spacing-1, 0.25rem)" }, children: [jsxRuntime.jsx("span", { style: {
9483
+ fontSize: "var(--font-size-md, var(--cz-font-size-md))",
9484
+ fontWeight: "var(--font-weight-medium, var(--cz-font-weight-medium))",
9485
+ color: "var(--cz-data-table-empty-state-title-color, var(--color-text-secondary, hsl(var(--cz-color-fg))))",
9486
+ }, children: "No Data Found" }), jsxRuntime.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." })] })] })) }));
9487
+ }
9488
+ return (jsxRuntime.jsxs("div", { ref: ref, className: className, style: containerStyles, ...props, children: [jsxRuntime.jsxs(Table, { className: tableClassName, children: [jsxRuntime.jsx(Table.Header, { children: jsxRuntime.jsxs(Table.Row, { children: [selectable && (jsxRuntime.jsx(Table.Head, { style: { width: 48, ...headerCellStyles({ }) }, children: jsxRuntime.jsx(Checkbox, { checked: someSelected && !allSelected ? "indeterminate" : allSelected, onCheckedChange: (checked) => handleSelectAll(checked === true) }) })), columns.map((column) => (jsxRuntime.jsx(Table.Head, { className: column.className, style: headerCellStyles(column), onClick: () => {
9489
+ if (sortable && column.sortable !== false) {
9490
+ handleSort(column.key);
9491
+ }
9492
+ }, children: jsxRuntime.jsxs("div", { style: {
9493
+ display: "flex",
9494
+ alignItems: "center",
9495
+ gap: "var(--spacing-2, 0.5rem)",
9496
+ justifyContent: column.align === "right"
9497
+ ? "flex-end"
9498
+ : column.align === "center"
9499
+ ? "center"
9500
+ : "flex-start",
9501
+ }, children: [column.customHeaderRender ? column.customHeaderRender() : column.header, sortable && column.sortable !== false && renderSortIcon(column.key)] }) }, column.key)))] }) }), jsxRuntime.jsx(Table.Body, { children: paginatedData.map((row, index) => {
9502
+ const rowId = getPageRowId(row, index);
9503
+ const isSelected = selectedRows.includes(rowId);
9504
+ return (jsxRuntime.jsxs(Table.Row, { onClick: onRowClick ? () => onRowClick(row) : undefined, style: {
9505
+ cursor: onRowClick ? "pointer" : "default",
9506
+ background: isSelected
9507
+ ? "var(--cz-data-table-selected-row-bg, var(--color-primary-bg, hsl(var(--cz-color-primary) / 0.12)))"
9508
+ : variant === "striped" && index % 2 === 1
9509
+ ? "var(--cz-data-table-striped-row-bg, var(--cz-table-striped-bg))"
9510
+ : undefined,
9511
+ }, children: [selectable && (jsxRuntime.jsx(Table.Cell, { style: bodyCellStyles(), onClick: (event) => event.stopPropagation(), children: jsxRuntime.jsx(Checkbox, { checked: isSelected, onCheckedChange: (checked) => handleSelectRow(rowId, checked === true) }) })), columns.map((column) => (jsxRuntime.jsx(Table.Cell, { className: column.className, style: bodyCellStyles(column.align), children: column.render
9512
+ ? column.render(row, resolveValue(row, column.key))
9513
+ : resolveValue(row, column.key) }, `${String(rowId)}-${column.key}`)))] }, String(rowId)));
9514
+ }) })] }), pagination && totalPages > 1 && (jsxRuntime.jsxs("div", { style: {
9515
+ display: "flex",
9516
+ alignItems: "center",
9517
+ justifyContent: "space-between",
9518
+ padding: "var(--cz-data-table-pagination-padding, var(--spacing-3, 0.75rem) var(--spacing-4, 1rem))",
9519
+ background: "var(--cz-data-table-container-bg, var(--color-bg-primary, hsl(var(--cz-color-bg))))",
9520
+ borderTop: "1px solid var(--cz-data-table-pagination-border-color, var(--color-border-light, var(--cz-table-border-color)))",
9521
+ fontSize: "var(--font-size-sm, var(--cz-font-size-sm))",
9522
+ color: "var(--cz-data-table-pagination-text-color, var(--color-text-muted, hsl(var(--cz-color-mutedFg))))",
9523
+ }, children: [jsxRuntime.jsxs("span", { style: { color: "var(--cz-data-table-pagination-text-strong-color, var(--color-text-body, hsl(var(--cz-color-fg))))" }, children: ["Showing ", jsxRuntime.jsx("strong", { children: (page - 1) * pageSize + 1 }), "-", jsxRuntime.jsx("strong", { children: Math.min(page * pageSize, sortedData.length) }), " of", " ", jsxRuntime.jsx("strong", { children: sortedData.length })] }), jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "var(--cz-data-table-pagination-gap, var(--spacing-2, 0.5rem))" }, children: [jsxRuntime.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: jsxRuntime.jsx(LeftChevronIcon, {}) }), jsxRuntime.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: jsxRuntime.jsx(RightChevronIcon, {}) })] })] }))] }));
9524
+ });
9525
+ DataTable.displayName = "DataTable";
9526
+
8847
9527
  var COLLAPSIBLE_NAME = "Collapsible";
8848
9528
  var [createCollapsibleContext, createCollapsibleScope] = createContextScope$2(COLLAPSIBLE_NAME);
8849
9529
  var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
@@ -11619,12 +12299,14 @@ exports.Card = Card;
11619
12299
  exports.Checkbox = Checkbox;
11620
12300
  exports.Code = Code;
11621
12301
  exports.Container = Container;
12302
+ exports.DataTable = DataTable;
11622
12303
  exports.Dialog = Dialog;
11623
12304
  exports.DropdownMenu = DropdownMenu;
11624
12305
  exports.Grid = Grid;
11625
12306
  exports.Input = Input;
11626
12307
  exports.Kbd = Kbd;
11627
12308
  exports.Label = Label$1;
12309
+ exports.Modal = Modal;
11628
12310
  exports.Progress = Progress;
11629
12311
  exports.RadioGroup = RadioGroup$1;
11630
12312
  exports.ScrollArea = ScrollArea;
@@ -11633,6 +12315,7 @@ exports.Separator = Separator$2;
11633
12315
  exports.Skeleton = Skeleton;
11634
12316
  exports.Spinner = Spinner;
11635
12317
  exports.Stack = Stack;
12318
+ exports.StatusBadge = StatusBadge;
11636
12319
  exports.Switch = Switch;
11637
12320
  exports.Table = Table;
11638
12321
  exports.Tabs = Tabs;