@pk-design/react-tailwind 1.4.4 → 1.5.1

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.
@@ -1,15 +1,15 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { forwardRef, useMemo, useId, useRef, useState, useEffect, Fragment as Fragment$1, useCallback, useImperativeHandle, createContext, useContext } from 'react';
3
+ import React__default, { useId, useMemo, useState, forwardRef, Children, isValidElement, cloneElement, useCallback, useRef, useEffect, Fragment as Fragment$1, useImperativeHandle, createContext, useContext } from 'react';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { Dialog, DialogBackdrop, DialogPanel, DialogTitle, Menu, MenuButton, MenuItems, MenuItem, RadioGroup as RadioGroup$1, Radio as Radio$1, Combobox, ComboboxInput, ComboboxButton, ComboboxOptions, ComboboxOption, TabGroup, TabList, Tab, TabPanels, TabPanel, Transition } from '@headlessui/react';
6
6
  import { FixedSizeList } from 'react-window';
7
7
 
8
8
  const buildClassName = (...classes) => twMerge(classes.filter(Boolean));
9
9
 
10
- var _path$i, _path2;
10
+ var _path$i;
11
11
  function _extends$i() { return _extends$i = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$i.apply(null, arguments); }
12
- var SvgBadgeCheck = function SvgBadgeCheck(props) {
12
+ var SvgChevronDown = function SvgChevronDown(props) {
13
13
  return /*#__PURE__*/React.createElement("svg", _extends$i({
14
14
  xmlns: "http://www.w3.org/2000/svg",
15
15
  width: 24,
@@ -19,19 +19,90 @@ var SvgBadgeCheck = function SvgBadgeCheck(props) {
19
19
  strokeLinecap: "round",
20
20
  strokeLinejoin: "round",
21
21
  strokeWidth: 2,
22
- className: "lucide lucide-badge-check-icon lucide-badge-check",
22
+ className: "lucide lucide-chevron-down-icon lucide-chevron-down",
23
23
  viewBox: "0 0 24 24"
24
24
  }, props), _path$i || (_path$i = /*#__PURE__*/React.createElement("path", {
25
+ d: "m6 9 6 6 6-6"
26
+ })));
27
+ };
28
+
29
+ const CONTAINER_CLASS = {
30
+ bordered: 'rounded-lg border border-gray-200 dark:border-white/10 divide-y divide-gray-200 dark:divide-white/10 bg-white dark:bg-gray-800 overflow-hidden',
31
+ separated: 'space-y-2',
32
+ plain: 'divide-y divide-gray-200 dark:divide-white/10',
33
+ };
34
+ const ITEM_CLASS = {
35
+ bordered: '',
36
+ separated: 'rounded-lg border border-gray-200 dark:border-white/10 bg-white dark:bg-gray-800 overflow-hidden',
37
+ plain: '',
38
+ };
39
+ const HEADER_CLASS = 'flex w-full items-center justify-between gap-2 py-3 px-4 text-left text-sm font-medium ' +
40
+ 'text-gray-900 dark:text-white hover:bg-gray-50 dark:hover:bg-gray-700/50 ' +
41
+ 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--ui-focus-ring)] ' +
42
+ 'disabled:opacity-40 disabled:cursor-not-allowed disabled:pointer-events-none ' +
43
+ 'transition-colors duration-150 cursor-pointer';
44
+ const Accordion = ({ items, type = 'single', variant = 'bordered', collapsible = true, defaultOpenIds, openIds: controlledOpenIds, onChange, expandIcon, className = '', titleClass = '', panelClass = '', }) => {
45
+ const baseId = useId();
46
+ const resolvedItems = useMemo(() => items.map((item, index) => { var _a; return ({ ...item, id: (_a = item.id) !== null && _a !== void 0 ? _a : index }); }), [items]);
47
+ const [uncontrolledOpenIds, setUncontrolledOpenIds] = useState(defaultOpenIds !== null && defaultOpenIds !== void 0 ? defaultOpenIds : []);
48
+ const isControlled = controlledOpenIds !== undefined;
49
+ const openIds = isControlled ? controlledOpenIds : uncontrolledOpenIds;
50
+ const toggle = (id) => {
51
+ const isOpen = openIds.includes(id);
52
+ const next = type === 'single'
53
+ ? isOpen
54
+ ? collapsible
55
+ ? []
56
+ : openIds
57
+ : [id]
58
+ : isOpen
59
+ ? openIds.filter((openId) => openId !== id)
60
+ : [...openIds, id];
61
+ if (next === openIds)
62
+ return;
63
+ if (!isControlled)
64
+ setUncontrolledOpenIds(next);
65
+ onChange === null || onChange === void 0 ? void 0 : onChange(next);
66
+ };
67
+ const renderIndicator = (isOpen) => {
68
+ if (typeof expandIcon === 'function')
69
+ return expandIcon(isOpen);
70
+ return (jsx("span", { className: buildClassName('inline-flex shrink-0 transition-transform duration-200', isOpen && 'rotate-180'), children: expandIcon !== null && expandIcon !== void 0 ? expandIcon : jsx(SvgChevronDown, { className: "size-4 stroke-gray-500 dark:stroke-gray-400" }) }));
71
+ };
72
+ return (jsx("div", { className: buildClassName(CONTAINER_CLASS[variant], className), children: resolvedItems.map((item) => {
73
+ const isOpen = openIds.includes(item.id);
74
+ const headerId = `${baseId}-${item.id}-header`;
75
+ const panelId = `${baseId}-${item.id}-panel`;
76
+ return (jsxs("div", { className: ITEM_CLASS[variant], children: [jsx("h3", { className: "m-0", children: jsxs("button", { type: "button", id: headerId, "aria-expanded": isOpen, "aria-controls": panelId, disabled: item.disabled, onClick: () => toggle(item.id), className: buildClassName(HEADER_CLASS, titleClass, item.titleClass), children: [jsxs("span", { className: "flex items-center gap-2", children: [item.icon && jsx("span", { className: "inline-flex shrink-0", children: item.icon }), item.title] }), renderIndicator(isOpen)] }) }), jsx("div", { id: panelId, role: "region", "aria-labelledby": headerId, className: buildClassName('grid transition-[grid-template-rows] duration-200 ease-in-out', isOpen ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'), children: jsx("div", { className: "overflow-hidden", children: jsx("div", { className: buildClassName('px-4 pt-2 pb-4 text-sm text-gray-600 dark:text-gray-300', panelClass, item.panelClass), children: item.content }) }) })] }, item.id));
77
+ }) }));
78
+ };
79
+ Accordion.displayName = 'Accordion';
80
+
81
+ var _path$h, _path2;
82
+ function _extends$h() { return _extends$h = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$h.apply(null, arguments); }
83
+ var SvgBadgeCheck = function SvgBadgeCheck(props) {
84
+ return /*#__PURE__*/React.createElement("svg", _extends$h({
85
+ xmlns: "http://www.w3.org/2000/svg",
86
+ width: 24,
87
+ height: 24,
88
+ fill: "none",
89
+ stroke: "currentColor",
90
+ strokeLinecap: "round",
91
+ strokeLinejoin: "round",
92
+ strokeWidth: 2,
93
+ className: "lucide lucide-badge-check-icon lucide-badge-check",
94
+ viewBox: "0 0 24 24"
95
+ }, props), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
25
96
  d: "M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76"
26
97
  })), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
27
98
  d: "m9 12 2 2 4-4"
28
99
  })));
29
100
  };
30
101
 
31
- var _circle$4, _path$h;
32
- function _extends$h() { return _extends$h = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$h.apply(null, arguments); }
102
+ var _circle$4, _path$g;
103
+ function _extends$g() { return _extends$g = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$g.apply(null, arguments); }
33
104
  var SvgCircleX = function SvgCircleX(props) {
34
- return /*#__PURE__*/React.createElement("svg", _extends$h({
105
+ return /*#__PURE__*/React.createElement("svg", _extends$g({
35
106
  xmlns: "http://www.w3.org/2000/svg",
36
107
  width: 24,
37
108
  height: 24,
@@ -46,15 +117,15 @@ var SvgCircleX = function SvgCircleX(props) {
46
117
  cx: 12,
47
118
  cy: 12,
48
119
  r: 10
49
- })), _path$h || (_path$h = /*#__PURE__*/React.createElement("path", {
120
+ })), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
50
121
  d: "m15 9-6 6M9 9l6 6"
51
122
  })));
52
123
  };
53
124
 
54
- var _circle$3, _path$g;
55
- function _extends$g() { return _extends$g = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$g.apply(null, arguments); }
125
+ var _circle$3, _path$f;
126
+ function _extends$f() { return _extends$f = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$f.apply(null, arguments); }
56
127
  var SvgCircleAlert = function SvgCircleAlert(props) {
57
- return /*#__PURE__*/React.createElement("svg", _extends$g({
128
+ return /*#__PURE__*/React.createElement("svg", _extends$f({
58
129
  xmlns: "http://www.w3.org/2000/svg",
59
130
  width: 24,
60
131
  height: 24,
@@ -69,15 +140,15 @@ var SvgCircleAlert = function SvgCircleAlert(props) {
69
140
  cx: 12,
70
141
  cy: 12,
71
142
  r: 10
72
- })), _path$g || (_path$g = /*#__PURE__*/React.createElement("path", {
143
+ })), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
73
144
  d: "M12 8v4M12 16h.01"
74
145
  })));
75
146
  };
76
147
 
77
- var _circle$2, _path$f;
78
- function _extends$f() { return _extends$f = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$f.apply(null, arguments); }
148
+ var _circle$2, _path$e;
149
+ function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
79
150
  var SvgInfo = function SvgInfo(props) {
80
- return /*#__PURE__*/React.createElement("svg", _extends$f({
151
+ return /*#__PURE__*/React.createElement("svg", _extends$e({
81
152
  xmlns: "http://www.w3.org/2000/svg",
82
153
  width: 24,
83
154
  height: 24,
@@ -92,15 +163,15 @@ var SvgInfo = function SvgInfo(props) {
92
163
  cx: 12,
93
164
  cy: 12,
94
165
  r: 10
95
- })), _path$f || (_path$f = /*#__PURE__*/React.createElement("path", {
166
+ })), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
96
167
  d: "M12 16v-4M12 8h.01"
97
168
  })));
98
169
  };
99
170
 
100
- var _path$e;
101
- function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
171
+ var _path$d;
172
+ function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
102
173
  var SvgX = function SvgX(props) {
103
- return /*#__PURE__*/React.createElement("svg", _extends$e({
174
+ return /*#__PURE__*/React.createElement("svg", _extends$d({
104
175
  xmlns: "http://www.w3.org/2000/svg",
105
176
  width: 24,
106
177
  height: 24,
@@ -111,7 +182,7 @@ var SvgX = function SvgX(props) {
111
182
  strokeWidth: 2,
112
183
  className: "lucide lucide-x-icon lucide-x",
113
184
  viewBox: "0 0 24 24"
114
- }, props), _path$e || (_path$e = /*#__PURE__*/React.createElement("path", {
185
+ }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
115
186
  d: "M18 6 6 18M6 6l12 12"
116
187
  })));
117
188
  };
@@ -131,7 +202,7 @@ const TextContent = forwardRef((props, ref) => {
131
202
  return React__default.createElement('span', {
132
203
  ...rest,
133
204
  ref,
134
- className: buildClassName('text-gray-900 dark:text-gray-100', xsmall && 'text-xs/5', small && 'text-sm/6', strong && 'font-semibold', muted && 'text-gray-500 dark:text-gray-400', error && 'text-red-500 dark:text-red-400', className),
205
+ className: buildClassName('text-[var(--ui-text)]', xsmall && 'text-xs/5', small && 'text-sm/6', strong && 'font-semibold', muted && 'text-[var(--ui-text-muted)]', error && 'text-[var(--ui-text-danger)]', className),
135
206
  });
136
207
  });
137
208
  TextContent.displayName = 'TextContent';
@@ -268,10 +339,10 @@ const Badge = forwardRef((props, ref) => {
268
339
  });
269
340
  Badge.displayName = 'Badge';
270
341
 
271
- var _path$d;
272
- function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
342
+ var _path$c;
343
+ function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
273
344
  var SvgTriangleAlert = function SvgTriangleAlert(props) {
274
- return /*#__PURE__*/React.createElement("svg", _extends$d({
345
+ return /*#__PURE__*/React.createElement("svg", _extends$c({
275
346
  xmlns: "http://www.w3.org/2000/svg",
276
347
  width: 24,
277
348
  height: 24,
@@ -282,15 +353,15 @@ var SvgTriangleAlert = function SvgTriangleAlert(props) {
282
353
  strokeWidth: 2,
283
354
  className: "lucide lucide-triangle-alert-icon lucide-triangle-alert",
284
355
  viewBox: "0 0 24 24"
285
- }, props), _path$d || (_path$d = /*#__PURE__*/React.createElement("path", {
356
+ }, props), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
286
357
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01"
287
358
  })));
288
359
  };
289
360
 
290
- var _circle$1, _path$c;
291
- function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
361
+ var _circle$1, _path$b;
362
+ function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
292
363
  var SvgCircleCheck = function SvgCircleCheck(props) {
293
- return /*#__PURE__*/React.createElement("svg", _extends$c({
364
+ return /*#__PURE__*/React.createElement("svg", _extends$b({
294
365
  xmlns: "http://www.w3.org/2000/svg",
295
366
  width: 24,
296
367
  height: 24,
@@ -305,7 +376,7 @@ var SvgCircleCheck = function SvgCircleCheck(props) {
305
376
  cx: 12,
306
377
  cy: 12,
307
378
  r: 10
308
- })), _path$c || (_path$c = /*#__PURE__*/React.createElement("path", {
379
+ })), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
309
380
  d: "m9 12 2 2 4-4"
310
381
  })));
311
382
  };
@@ -338,19 +409,28 @@ const Banner = forwardRef((props, ref) => {
338
409
  Banner.displayName = 'Banner';
339
410
 
340
411
  const BodyText = forwardRef((props, ref) => {
341
- const { as = 'p', small = false, strong = false, muted = false, error = false, inline = false, className, ...rest } = props;
412
+ const { as = 'p', small = false, strong = false, muted = false, error = false, inline = false, className, invert, ...rest } = props;
413
+ const textColorClass = error
414
+ ? 'text-[var(--ui-text-danger)]'
415
+ : muted
416
+ ? invert
417
+ ? 'text-gray-300 dark:text-gray-600'
418
+ : 'text-[var(--ui-text-muted)]'
419
+ : invert
420
+ ? 'text-white dark:text-black'
421
+ : 'text-[var(--ui-text)]';
342
422
  return React__default.createElement(as, {
343
423
  ref: ref,
344
- className: buildClassName('text-gray-900 dark:text-gray-100', small && 'text-sm/6', strong && 'font-semibold', muted && 'text-gray-500 dark:text-gray-400', error && 'text-red-500 dark:text-red-400', inline && 'inline-flex items-center gap-2', className),
424
+ className: buildClassName(textColorClass, small && 'text-sm/6', strong && 'font-semibold', inline && 'inline-flex items-center gap-2', className),
345
425
  ...rest,
346
426
  });
347
427
  });
348
428
  BodyText.displayName = 'BodyText';
349
429
 
350
- var _path$b;
351
- function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
430
+ var _path$a;
431
+ function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
352
432
  var SvgSlash = function SvgSlash(props) {
353
- return /*#__PURE__*/React.createElement("svg", _extends$b({
433
+ return /*#__PURE__*/React.createElement("svg", _extends$a({
354
434
  xmlns: "http://www.w3.org/2000/svg",
355
435
  width: 24,
356
436
  height: 24,
@@ -361,7 +441,7 @@ var SvgSlash = function SvgSlash(props) {
361
441
  strokeWidth: 2,
362
442
  className: "lucide lucide-slash-icon lucide-slash",
363
443
  viewBox: "0 0 24 24"
364
- }, props), _path$b || (_path$b = /*#__PURE__*/React.createElement("path", {
444
+ }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
365
445
  d: "M22 2 2 22"
366
446
  })));
367
447
  };
@@ -373,6 +453,76 @@ const Breadcrumb = ({ items, render }) => {
373
453
  };
374
454
  Breadcrumb.displayName = 'Breadcrumb';
375
455
 
456
+ /**
457
+ * Corner-rounding classes for the group's first/last button, keyed by
458
+ * orientation + size, matching Button's own size -> radius mapping
459
+ * (xs: rounded-sm, sm: rounded, md: rounded-md, lg: rounded-lg).
460
+ *
461
+ * These must stay fully static string literals (no template-literal
462
+ * interpolation) — Tailwind's JIT scanner only picks up class names that
463
+ * appear verbatim in source, and the docs site scans the library's
464
+ * *compiled* output, where interpolated fragments never appear as a
465
+ * complete class name.
466
+ */
467
+ const EDGE_ROUNDING = {
468
+ horizontal: {
469
+ xs: { first: 'rounded-l-sm rounded-r-none', last: 'rounded-r-sm rounded-l-none' },
470
+ sm: { first: 'rounded-l rounded-r-none', last: 'rounded-r rounded-l-none' },
471
+ md: { first: 'rounded-l-md rounded-r-none', last: 'rounded-r-md rounded-l-none' },
472
+ lg: { first: 'rounded-l-lg rounded-r-none', last: 'rounded-r-lg rounded-l-none' },
473
+ },
474
+ vertical: {
475
+ xs: { first: 'rounded-t-sm rounded-b-none', last: 'rounded-b-sm rounded-t-none' },
476
+ sm: { first: 'rounded-t rounded-b-none', last: 'rounded-b rounded-t-none' },
477
+ md: { first: 'rounded-t-md rounded-b-none', last: 'rounded-b-md rounded-t-none' },
478
+ lg: { first: 'rounded-t-lg rounded-b-none', last: 'rounded-b-lg rounded-t-none' },
479
+ },
480
+ };
481
+ const PILL_EDGE_ROUNDING = {
482
+ horizontal: { first: 'rounded-l-full rounded-r-none', last: 'rounded-r-full rounded-l-none' },
483
+ vertical: { first: 'rounded-t-full rounded-b-none', last: 'rounded-b-full rounded-t-none' },
484
+ };
485
+ /**
486
+ * Resolves the corner-rounding classes for a single button at `index`
487
+ * out of `count` inside the group, so only the group's outer edges stay
488
+ * rounded and interior seams go square.
489
+ */
490
+ const getEdgeRoundingClass = ({ index, count, size, orientation, pill, }) => {
491
+ if (count <= 1)
492
+ return '';
493
+ if (index !== 0 && index !== count - 1)
494
+ return 'rounded-none';
495
+ const position = index === 0 ? 'first' : 'last';
496
+ return pill
497
+ ? PILL_EDGE_ROUNDING[orientation][position]
498
+ : EDGE_ROUNDING[orientation][size][position];
499
+ };
500
+ const ButtonGroup = ({ children, orientation = 'horizontal', theme = 'secondary', variant = 'default', size = 'md', rounded = false, fullWidth = false, label, className = '', }) => {
501
+ const isVertical = orientation === 'vertical';
502
+ const items = useMemo(() => Children.toArray(children).filter(isValidElement), [children]);
503
+ const count = items.length;
504
+ return (jsx("div", { role: "group", "aria-label": label, className: buildClassName('inline-flex', isVertical ? 'flex-col' : 'flex-row', fullWidth && 'flex w-full', className), children: items.map((child, index) => {
505
+ var _a, _b, _c;
506
+ const childSize = (_a = child.props.size) !== null && _a !== void 0 ? _a : size;
507
+ return cloneElement(child, {
508
+ theme: (_b = child.props.theme) !== null && _b !== void 0 ? _b : theme,
509
+ variant: (_c = child.props.variant) !== null && _c !== void 0 ? _c : variant,
510
+ size: childSize,
511
+ className: buildClassName(child.props.className, getEdgeRoundingClass({
512
+ index,
513
+ count,
514
+ size: childSize,
515
+ orientation,
516
+ pill: rounded,
517
+ }), count > 1 && [
518
+ 'relative shadow-none hover:z-10 focus:z-10 focus-visible:z-10',
519
+ index > 0 && (isVertical ? '-mt-px' : '-ml-px'),
520
+ ], fullWidth && 'flex-1'),
521
+ });
522
+ }) }));
523
+ };
524
+ ButtonGroup.displayName = 'ButtonGroup';
525
+
376
526
  const BASE_CARD_CLASS = 'bg-white rounded-md dark:bg-gray-900 block';
377
527
  const Card = forwardRef(({ as, ...props }, ref) => {
378
528
  // Remove Card-only props from rest (avoid leaking to DOM)
@@ -508,10 +658,10 @@ const usePagination = ({ totalPages, currentPage, siblingCount = 1, // number of
508
658
  return [];
509
659
  };
510
660
 
511
- var _path$a;
512
- function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
661
+ var _path$9;
662
+ function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
513
663
  var SvgChevronLeft = function SvgChevronLeft(props) {
514
- return /*#__PURE__*/React.createElement("svg", _extends$a({
664
+ return /*#__PURE__*/React.createElement("svg", _extends$9({
515
665
  xmlns: "http://www.w3.org/2000/svg",
516
666
  width: 24,
517
667
  height: 24,
@@ -522,15 +672,15 @@ var SvgChevronLeft = function SvgChevronLeft(props) {
522
672
  strokeWidth: 2,
523
673
  className: "lucide lucide-chevron-left-icon lucide-chevron-left",
524
674
  viewBox: "0 0 24 24"
525
- }, props), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
675
+ }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
526
676
  d: "m15 18-6-6 6-6"
527
677
  })));
528
678
  };
529
679
 
530
- var _path$9;
531
- function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
680
+ var _path$8;
681
+ function _extends$8() { return _extends$8 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$8.apply(null, arguments); }
532
682
  var SvgChevronRight = function SvgChevronRight(props) {
533
- return /*#__PURE__*/React.createElement("svg", _extends$9({
683
+ return /*#__PURE__*/React.createElement("svg", _extends$8({
534
684
  xmlns: "http://www.w3.org/2000/svg",
535
685
  width: 24,
536
686
  height: 24,
@@ -541,7 +691,7 @@ var SvgChevronRight = function SvgChevronRight(props) {
541
691
  strokeWidth: 2,
542
692
  className: "lucide lucide-chevron-right-icon lucide-chevron-right",
543
693
  viewBox: "0 0 24 24"
544
- }, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
694
+ }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
545
695
  d: "m9 18 6-6-6-6"
546
696
  })));
547
697
  };
@@ -620,11 +770,53 @@ const updateSortQuery = (sortQuery, name, type = 'string') => {
620
770
  }
621
771
  return updated;
622
772
  };
773
+ /**
774
+ * Shared row-selection state/behaviour used by DataTable and VirtualizedDataTable.
775
+ * Supports controlled (`selectedRowKeys`) and uncontrolled (`defaultSelectedRowKeys`) usage.
776
+ */
777
+ const useRowSelection = ({ items, getKey, selectedRowKeys, defaultSelectedRowKeys = [], onSelectionChange, isRowSelectable, }) => {
778
+ const [internalKeys, setInternalKeys] = useState(defaultSelectedRowKeys);
779
+ const isControlled = selectedRowKeys !== undefined;
780
+ const keys = isControlled ? selectedRowKeys : internalKeys;
781
+ const keySet = useMemo(() => new Set(keys), [keys]);
782
+ const selectableEntries = useMemo(() => items
783
+ .map((item, idx) => ({ item, key: getKey(item, idx) }))
784
+ .filter(({ item }) => !isRowSelectable || isRowSelectable(item)), [items, getKey, isRowSelectable]);
785
+ const emit = useCallback((nextKeys) => {
786
+ if (!isControlled)
787
+ setInternalKeys(nextKeys);
788
+ const nextKeySet = new Set(nextKeys);
789
+ const nextItems = items.filter((item, idx) => nextKeySet.has(getKey(item, idx)));
790
+ onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(nextKeys, nextItems);
791
+ }, [isControlled, items, getKey, onSelectionChange]);
792
+ const toggleRow = useCallback((key) => {
793
+ emit(keySet.has(key) ? keys.filter((k) => k !== key) : [...keys, key]);
794
+ }, [keys, keySet, emit]);
795
+ const allSelected = selectableEntries.length > 0 && selectableEntries.every(({ key }) => keySet.has(key));
796
+ const someSelected = !allSelected && selectableEntries.some(({ key }) => keySet.has(key));
797
+ const toggleAll = useCallback(() => {
798
+ const selectableKeySet = new Set(selectableEntries.map(({ key }) => key));
799
+ if (allSelected) {
800
+ emit(keys.filter((k) => !selectableKeySet.has(k)));
801
+ }
802
+ else {
803
+ emit(Array.from(new Set([...keys, ...selectableKeySet])));
804
+ }
805
+ }, [allSelected, selectableEntries, keys, emit]);
806
+ return {
807
+ selectedKeys: keys,
808
+ isSelected: (key) => keySet.has(key),
809
+ toggleRow,
810
+ toggleAll,
811
+ allSelected,
812
+ someSelected,
813
+ };
814
+ };
623
815
 
624
- var _path$8;
625
- function _extends$8() { return _extends$8 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$8.apply(null, arguments); }
816
+ var _path$7;
817
+ function _extends$7() { return _extends$7 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$7.apply(null, arguments); }
626
818
  var SvgArrowDownWideNarrow = function SvgArrowDownWideNarrow(props) {
627
- return /*#__PURE__*/React.createElement("svg", _extends$8({
819
+ return /*#__PURE__*/React.createElement("svg", _extends$7({
628
820
  xmlns: "http://www.w3.org/2000/svg",
629
821
  width: 24,
630
822
  height: 24,
@@ -635,15 +827,15 @@ var SvgArrowDownWideNarrow = function SvgArrowDownWideNarrow(props) {
635
827
  strokeWidth: 2,
636
828
  className: "lucide lucide-arrow-down-wide-narrow-icon lucide-arrow-down-wide-narrow",
637
829
  viewBox: "0 0 24 24"
638
- }, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
830
+ }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
639
831
  d: "m3 16 4 4 4-4M7 20V4M11 4h10M11 8h7M11 12h4"
640
832
  })));
641
833
  };
642
834
 
643
- var _path$7;
644
- function _extends$7() { return _extends$7 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$7.apply(null, arguments); }
835
+ var _path$6;
836
+ function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
645
837
  var SvgArrowDownNarrowWide = function SvgArrowDownNarrowWide(props) {
646
- return /*#__PURE__*/React.createElement("svg", _extends$7({
838
+ return /*#__PURE__*/React.createElement("svg", _extends$6({
647
839
  xmlns: "http://www.w3.org/2000/svg",
648
840
  width: 24,
649
841
  height: 24,
@@ -654,15 +846,15 @@ var SvgArrowDownNarrowWide = function SvgArrowDownNarrowWide(props) {
654
846
  strokeWidth: 2,
655
847
  className: "lucide lucide-arrow-down-narrow-wide-icon lucide-arrow-down-narrow-wide",
656
848
  viewBox: "0 0 24 24"
657
- }, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
849
+ }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
658
850
  d: "m3 16 4 4 4-4M7 20V4M11 4h4M11 8h7M11 12h10"
659
851
  })));
660
852
  };
661
853
 
662
- var _path$6;
663
- function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
854
+ var _path$5;
855
+ function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
664
856
  var SvgArrowDownAz = function SvgArrowDownAz(props) {
665
- return /*#__PURE__*/React.createElement("svg", _extends$6({
857
+ return /*#__PURE__*/React.createElement("svg", _extends$5({
666
858
  xmlns: "http://www.w3.org/2000/svg",
667
859
  width: 24,
668
860
  height: 24,
@@ -673,15 +865,15 @@ var SvgArrowDownAz = function SvgArrowDownAz(props) {
673
865
  strokeWidth: 2,
674
866
  className: "lucide lucide-arrow-down-az-icon lucide-arrow-down-a-z",
675
867
  viewBox: "0 0 24 24"
676
- }, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
868
+ }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
677
869
  d: "m3 16 4 4 4-4M7 20V4M20 8h-5M15 10V6.5a2.5 2.5 0 0 1 5 0V10M15 14h5l-5 6h5"
678
870
  })));
679
871
  };
680
872
 
681
- var _path$5;
682
- function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
873
+ var _path$4;
874
+ function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
683
875
  var SvgArrowDownZa = function SvgArrowDownZa(props) {
684
- return /*#__PURE__*/React.createElement("svg", _extends$5({
876
+ return /*#__PURE__*/React.createElement("svg", _extends$4({
685
877
  xmlns: "http://www.w3.org/2000/svg",
686
878
  width: 24,
687
879
  height: 24,
@@ -692,15 +884,15 @@ var SvgArrowDownZa = function SvgArrowDownZa(props) {
692
884
  strokeWidth: 2,
693
885
  className: "lucide lucide-arrow-down-za-icon lucide-arrow-down-z-a",
694
886
  viewBox: "0 0 24 24"
695
- }, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
887
+ }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
696
888
  d: "m3 16 4 4 4-4M7 4v16M15 4h5l-5 6h5M15 20v-3.5a2.5 2.5 0 0 1 5 0V20M20 18h-5"
697
889
  })));
698
890
  };
699
891
 
700
- var _path$4;
701
- function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
892
+ var _path$3;
893
+ function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
702
894
  var SvgArrowUpDown = function SvgArrowUpDown(props) {
703
- return /*#__PURE__*/React.createElement("svg", _extends$4({
895
+ return /*#__PURE__*/React.createElement("svg", _extends$3({
704
896
  xmlns: "http://www.w3.org/2000/svg",
705
897
  width: 24,
706
898
  height: 24,
@@ -711,7 +903,7 @@ var SvgArrowUpDown = function SvgArrowUpDown(props) {
711
903
  strokeWidth: 2,
712
904
  className: "lucide lucide-arrow-up-down-icon lucide-arrow-up-down",
713
905
  viewBox: "0 0 24 24"
714
- }, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
906
+ }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
715
907
  d: "m21 16-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16"
716
908
  })));
717
909
  };
@@ -753,7 +945,7 @@ const autoSortItems = (items, column, sort) => {
753
945
  return 0;
754
946
  });
755
947
  };
756
- function DataTable({ items, columns, sorting = {}, onSort, loading, pagination, setPagination = () => { }, emptyMessage = 'No data found', containerClass = '', wrapperClass = '', tableClass = '', headClass = '', footerRow, rowKey = 'id', onRowClick, rowClass, density = 'default', striped = false, layout = 'auto', }) {
948
+ function DataTable({ items, columns, sorting = {}, onSort, loading, pagination, setPagination = () => { }, emptyMessage = 'No data found', containerClass = '', wrapperClass = '', tableClass = '', headClass = '', footerRow, rowKey = 'id', onRowClick, rowClass, density = 'default', striped = false, layout = 'auto', selectable = false, selectedRowKeys, defaultSelectedRowKeys, onSelectionChange, isRowSelectable, }) {
757
949
  const internalSorting = useRef({});
758
950
  const [sortedItems, setSortedItems] = useState(items);
759
951
  useEffect(() => {
@@ -788,25 +980,41 @@ function DataTable({ items, columns, sorting = {}, onSort, loading, pagination,
788
980
  return column.cellClass(item);
789
981
  return column.cellClass;
790
982
  };
983
+ const { isSelected, toggleRow, toggleAll, allSelected, someSelected } = useRowSelection({
984
+ items: sortedItems,
985
+ getKey,
986
+ selectedRowKeys,
987
+ defaultSelectedRowKeys,
988
+ onSelectionChange,
989
+ isRowSelectable,
990
+ });
791
991
  const densityCellClass = DENSITY_CELL_CLASS$2[density];
792
- return (jsxs("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: [jsx("div", { className: buildClassName('overflow-x-auto overflow-y-hidden rounded-lg border border-gray-200 dark:border-gray-800', wrapperClass, pagination && 'rounded-b-none border-b-0'), children: jsxs(Table, { className: buildClassName('relative w-full max-w-full h-fit', tableClass), layout: layout, children: [jsx(TableHead, { className: headClass, children: columns.map((column) => (jsx(TableHeaderCell, { align: column.headerAlign, style: { width: column.width || 'auto' }, className: buildClassName('bg-gray-50 dark:bg-gray-800', densityCellClass, column.sticky === 'left' &&
793
- 'sticky left-0 z-10 shadow-[2px_0_6px_rgba(0,0,0,0.06)]', column.sticky === 'right' &&
794
- 'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]', column.headerClass), children: jsxs(TextContent, { role: column.sortable ? 'button' : undefined, className: buildClassName('group', column.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(column), children: [jsx(TextContent, { className: "shrink-0", children: column.label }), column.sortable ? getSortIcon(sorting[column.name]) : null] }) }, column.name))) }), jsx(TableBody, { loading: loading, colSize: columns.length, rowSize: (pagination === null || pagination === void 0 ? void 0 : pagination.limit) || 5, children: !loading && sortedItems.length === 0 ? (jsx(EmptyTableRow, { colSpan: columns.length, children: emptyMessage })) : (sortedItems.map((item, idx) => (jsx(TableRow, { className: buildClassName('group', onRowClick && 'cursor-pointer', striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40', getRowClass(item, idx)), onClick: onRowClick ? () => onRowClick(item, idx) : undefined, children: columns.map((column) => {
795
- var _a;
796
- return (jsx(TableCell, { align: column.align, className: buildClassName(densityCellClass, striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40', column.sticky === 'left' &&
797
- 'sticky left-0 z-10 shadow-[2px_0_6px_rgba(0,0,0,0.06)]', column.sticky === 'right' &&
798
- 'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]', getCellClass(column, item)), children: column.render
799
- ? column.render(item)
800
- : ((_a = get(item, column.name)) !== null && _a !== void 0 ? _a : 'Not set') }, column.name));
801
- }) }, getKey(item, idx))))) }), footerRow && jsx(TableFoot, { children: footerRow })] }) }), pagination && (jsx(Pagination, { ...pagination, className: "rounded-b-lg border border-t-0 border-gray-200 dark:border-gray-800", onChange: setPagination }))] }));
992
+ const colSize = columns.length + (selectable ? 1 : 0);
993
+ return (jsxs("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: [jsx("div", { className: buildClassName('overflow-x-auto overflow-y-hidden rounded-lg border border-gray-200 dark:border-gray-800', wrapperClass, pagination && 'rounded-b-none border-b-0'), children: jsxs(Table, { className: buildClassName('relative w-full max-w-full h-fit', tableClass), layout: layout, children: [jsxs(TableHead, { className: headClass, children: [selectable && (jsx(TableHeaderCell, { className: buildClassName('bg-gray-50 dark:bg-gray-800 w-px', densityCellClass), children: jsx(Checkbox, { "aria-label": "Select all rows", checked: allSelected, ref: (el) => {
994
+ if (el)
995
+ el.indeterminate = someSelected;
996
+ }, onChange: toggleAll }) })), columns.map((column) => (jsx(TableHeaderCell, { align: column.headerAlign, style: { width: column.width || 'auto' }, className: buildClassName('bg-gray-50 dark:bg-gray-800', densityCellClass, column.sticky === 'left' &&
997
+ 'sticky left-0 z-10 shadow-[2px_0_6px_rgba(0,0,0,0.06)]', column.sticky === 'right' &&
998
+ 'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]', column.headerClass), children: jsxs(TextContent, { role: column.sortable ? 'button' : undefined, className: buildClassName('group', column.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(column), children: [jsx(TextContent, { className: "shrink-0", children: column.label }), column.sortable ? getSortIcon(sorting[column.name]) : null] }) }, column.name)))] }), jsx(TableBody, { loading: loading, colSize: colSize, rowSize: (pagination === null || pagination === void 0 ? void 0 : pagination.limit) || 5, children: !loading && sortedItems.length === 0 ? (jsx(EmptyTableRow, { colSpan: colSize, children: emptyMessage })) : (sortedItems.map((item, idx) => {
999
+ const key = getKey(item, idx);
1000
+ const rowSelectable = !isRowSelectable || isRowSelectable(item);
1001
+ return (jsxs(TableRow, { className: buildClassName('group', onRowClick && 'cursor-pointer', striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40', getRowClass(item, idx)), onClick: onRowClick ? () => onRowClick(item, idx) : undefined, children: [selectable && (jsx(TableCell, { className: buildClassName(densityCellClass, striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40'), children: jsx("span", { onClick: (e) => e.stopPropagation(), children: jsx(Checkbox, { "aria-label": "Select row", checked: isSelected(key), disabled: !rowSelectable, onChange: () => toggleRow(key) }) }) })), columns.map((column) => {
1002
+ var _a;
1003
+ return (jsx(TableCell, { align: column.align, className: buildClassName(densityCellClass, striped && idx % 2 === 1 && 'bg-gray-50 dark:bg-gray-800/40', column.sticky === 'left' &&
1004
+ 'sticky left-0 z-10 shadow-[2px_0_6px_rgba(0,0,0,0.06)]', column.sticky === 'right' &&
1005
+ 'sticky right-0 z-10 shadow-[-2px_0_6px_rgba(0,0,0,0.06)]', getCellClass(column, item)), children: column.render
1006
+ ? column.render(item)
1007
+ : ((_a = get(item, column.name)) !== null && _a !== void 0 ? _a : 'Not set') }, column.name));
1008
+ })] }, key));
1009
+ })) }), footerRow && jsx(TableFoot, { children: footerRow })] }) }), pagination && (jsx(Pagination, { ...pagination, className: "rounded-b-lg border border-t-0 border-gray-200 dark:border-gray-800", onChange: setPagination }))] }));
802
1010
  }
803
1011
  DataTable.displayName = 'DataTable';
804
1012
 
805
- const Title = ({ children, className }) => (jsx("h1", { className: buildClassName('text-3xl font-bold text-gray-900 dark:text-white', className), children: children }));
806
- const SubTitle = ({ children, className }) => (jsx("h2", { className: buildClassName('text-2xl font-semibold text-gray-900 dark:text-white', className), children: children }));
807
- const SubTitle2 = ({ children, className }) => (jsx("h3", { className: buildClassName('text-xl font-semibold text-gray-900 dark:text-white', className), children: children }));
808
- const SubTitle3 = ({ children, className }) => (jsx("h4", { className: buildClassName('text-lg font-medium text-gray-900 dark:text-white', className), children: children }));
809
- const SubTitle4 = ({ children, className }) => (jsx("h5", { className: buildClassName('text-base font-medium text-gray-900 dark:text-white', className), children: children }));
1013
+ const Title = ({ children, className }) => (jsx("h1", { className: buildClassName('text-3xl font-bold text-[var(--ui-text)]', className), children: children }));
1014
+ const SubTitle = ({ children, className }) => (jsx("h2", { className: buildClassName('text-2xl font-semibold text-[var(--ui-text)]', className), children: children }));
1015
+ const SubTitle2 = ({ children, className }) => (jsx("h3", { className: buildClassName('text-xl font-semibold text-[var(--ui-text)]', className), children: children }));
1016
+ const SubTitle3 = ({ children, className }) => (jsx("h4", { className: buildClassName('text-lg font-medium text-[var(--ui-text)]', className), children: children }));
1017
+ const SubTitle4 = ({ children, className }) => (jsx("h5", { className: buildClassName('text-base font-medium text-[var(--ui-text)]', className), children: children }));
810
1018
  const HeadingText = {
811
1019
  Title,
812
1020
  SubTitle,
@@ -863,10 +1071,10 @@ const Dropdown = ({ triggerButton, renderTriggerButton, items, renderItem, items
863
1071
  };
864
1072
  Dropdown.displayName = 'Dropdown';
865
1073
 
866
- var _path$3;
867
- function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
1074
+ var _path$2;
1075
+ function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
868
1076
  var SvgFolderPlus = function SvgFolderPlus(props) {
869
- return /*#__PURE__*/React.createElement("svg", _extends$3({
1077
+ return /*#__PURE__*/React.createElement("svg", _extends$2({
870
1078
  xmlns: "http://www.w3.org/2000/svg",
871
1079
  width: 24,
872
1080
  height: 24,
@@ -877,7 +1085,7 @@ var SvgFolderPlus = function SvgFolderPlus(props) {
877
1085
  strokeWidth: 2,
878
1086
  className: "lucide lucide-folder-plus-icon lucide-folder-plus",
879
1087
  viewBox: "0 0 24 24"
880
- }, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
1088
+ }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
881
1089
  d: "M12 10v6M9 13h6M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"
882
1090
  })));
883
1091
  };
@@ -898,7 +1106,7 @@ const Input = forwardRef((props, ref) => {
898
1106
  const hasError = Boolean(error);
899
1107
  const hasRightGroup = rightGroup !== null && rightGroup !== undefined;
900
1108
  const hasLeftGroup = leftGroup != null && leftGroup !== undefined;
901
- return (jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, children: label }), labelHint] })), jsxs("div", { className: "relative", children: [hasLeftGroup && (jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsx("input", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, type: type, className: buildClassName(buildInputClass(className, { disabled: inputProps.disabled }), hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '') }), hasRightGroup && (jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center w-10", children: rightGroup }))] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
1109
+ return (jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, children: label }), jsx(TextContent, { xsmall: true, children: labelHint })] })), jsxs("div", { className: "relative", children: [hasLeftGroup && (jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsx("input", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, type: type, className: buildClassName(buildInputClass(className, { disabled: inputProps.disabled }), hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '') }), hasRightGroup && (jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center w-10", children: rightGroup }))] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
902
1110
  });
903
1111
  Input.displayName = 'Input';
904
1112
 
@@ -968,7 +1176,7 @@ const RadioSwitch = ({ label, items, selected, onChange, wrapperClass, switchCla
968
1176
  transform: `translate(${style.left}px, ${style.top}px)`,
969
1177
  width: style.width,
970
1178
  height: style.height,
971
- } }), items.map((item) => (jsx(Radio$1, { value: getValue(item), "data-radio-item": true, "data-value": getValue(item), className: buildClassName('relative z-10 cursor-pointer select-none group', 'px-4 py-2 rounded-md transition-colors', 'text-gray-700 dark:text-gray-300 data-checked:text-white'), children: jsxs("div", { className: buildClassName('flex flex-col items-center justify-center gap-1', contentClass), children: [jsx(BodyText, { className: "font-semibold", children: getLabel(item) }), getDescription(item) && (jsx(BodyText, { className: buildClassName('text-xs opacity-80', descriptionClass), children: getDescription(item) }))] }) }, getValue(item))))] }));
1179
+ } }), items.map((item) => (jsx(Radio$1, { value: getValue(item), "data-radio-item": true, "data-value": getValue(item), className: buildClassName('relative z-10 cursor-pointer select-none group', 'px-4 py-2 rounded-md transition-colors', 'text-gray-700 dark:text-gray-300 data-checked:text-white'), children: jsxs("div", { className: buildClassName('flex flex-col items-center justify-center gap-1', contentClass), children: [jsx(BodyText, { className: buildClassName('font-semibold', selected === getValue(item) && 'text-white'), children: getLabel(item) }), getDescription(item) && (jsx(BodyText, { className: buildClassName('text-xs opacity-80', descriptionClass, selected === getValue(item) && 'text-white'), children: getDescription(item) }))] }) }, getValue(item))))] }));
972
1180
  };
973
1181
 
974
1182
  /**
@@ -1139,28 +1347,9 @@ const useDebounceFn = (fn, ms) => {
1139
1347
  }, [fn, ms]);
1140
1348
  };
1141
1349
 
1142
- var _path$2;
1143
- function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
1144
- var SvgCheck = function SvgCheck(props) {
1145
- return /*#__PURE__*/React.createElement("svg", _extends$2({
1146
- xmlns: "http://www.w3.org/2000/svg",
1147
- width: 24,
1148
- height: 24,
1149
- fill: "none",
1150
- stroke: "currentColor",
1151
- strokeLinecap: "round",
1152
- strokeLinejoin: "round",
1153
- strokeWidth: 2,
1154
- className: "lucide lucide-check-icon lucide-check",
1155
- viewBox: "0 0 24 24"
1156
- }, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
1157
- d: "M20 6 9 17l-5-5"
1158
- })));
1159
- };
1160
-
1161
1350
  var _path$1;
1162
1351
  function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
1163
- var SvgChevronDown = function SvgChevronDown(props) {
1352
+ var SvgCheck = function SvgCheck(props) {
1164
1353
  return /*#__PURE__*/React.createElement("svg", _extends$1({
1165
1354
  xmlns: "http://www.w3.org/2000/svg",
1166
1355
  width: 24,
@@ -1170,10 +1359,10 @@ var SvgChevronDown = function SvgChevronDown(props) {
1170
1359
  strokeLinecap: "round",
1171
1360
  strokeLinejoin: "round",
1172
1361
  strokeWidth: 2,
1173
- className: "lucide lucide-chevron-down-icon lucide-chevron-down",
1362
+ className: "lucide lucide-check-icon lucide-check",
1174
1363
  viewBox: "0 0 24 24"
1175
1364
  }, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
1176
- d: "m6 9 6 6 6-6"
1365
+ d: "M20 6 9 17l-5-5"
1177
1366
  })));
1178
1367
  };
1179
1368
 
@@ -1202,7 +1391,7 @@ var SvgCirclePlus = function SvgCirclePlus(props) {
1202
1391
 
1203
1392
  const constructInputClass = (disabled) => buildInputClass('', { disabled });
1204
1393
  const SelectBox = forwardRef((props, forwardedRef) => {
1205
- const { labelKey = 'label', valueKey = 'value', name, id = name, options, selected, label = null, labelWrapperClass = '', labelClass = '', labelHint = null, disabled = false, containerClass = '', onChange = () => { }, placeholder, dropdownContainerClass = 'z-20', multiple = false, maxSelection, immediate = true, showErrorMessage = true, error = null, async = false, searchable = true, required = false, allowAdd = false, addNewText = 'Create', onAdd = () => { }, allowClear = false, modalDropdown = false, } = props;
1394
+ const { labelKey = 'label', valueKey = 'value', name, id = name, options, selected, label = null, labelWrapperClass = '', labelClass = '', labelHint = null, disabled = false, containerClass = '', onChange = () => { }, placeholder, dropdownContainerClass = 'z-20', multiple = false, maxSelection, immediate = true, showErrorMessage = true, error = null, async = false, searchable = true, required = false, allowAdd = false, addNewText = 'Create', onAdd = () => { }, allowClear = false, modalDropdown = false, noOptionsText = 'No options available', } = props;
1206
1395
  const hasError = Boolean(error);
1207
1396
  const [query, setQuery] = useState('');
1208
1397
  const debouncedQuery = useDebounce(query, 500);
@@ -1321,7 +1510,7 @@ const SelectBox = forwardRef((props, forwardedRef) => {
1321
1510
  if (async && debouncedQuery)
1322
1511
  handleSearch(debouncedQuery);
1323
1512
  }, [debouncedQuery, async, handleSearch]);
1324
- return (jsxs("div", { className: buildClassName('group space-y-2', hasError && 'has-error', containerClass), ref: containerRef, children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, "aria-required": required, children: label }), labelHint] })), jsxs(Combobox, { multiple: multiple, immediate: immediate, name: name, value: selected, onChange: comboboxOnChangeWrapper, onClose: () => setQuery(''), disabled: disabled, children: [multiple ? (jsxs("div", { className: buildClassName(inputClass, 'flex flex-wrap gap-2 peer relative'), ref: forwardedRef, children: [isArray(selected) &&
1513
+ return (jsxs("div", { className: buildClassName('group space-y-2', hasError && 'has-error', containerClass), ref: containerRef, children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, "aria-required": required, children: label }), jsx(TextContent, { xsmall: true, children: labelHint })] })), jsxs(Combobox, { multiple: multiple, immediate: immediate, name: name, value: selected, onChange: comboboxOnChangeWrapper, onClose: () => setQuery(''), disabled: disabled, children: [multiple ? (jsxs("div", { className: buildClassName(inputClass, 'flex flex-wrap gap-2 peer relative'), ref: forwardedRef, children: [isArray(selected) &&
1325
1514
  (selected === null || selected === void 0 ? void 0 : selected.length) > 0 &&
1326
1515
  selected.map((option, idx) => (jsx(Badge, { theme: "secondary", removable: !disabled, onRemove: () => removeSelection(idx), children: getDisplayValue(option) }, `${getValue(option)}-${idx}`))), jsx(ComboboxInput, { className: "outline-none flex-1 dark:placeholder-gray-400 placeholder-gray-400", "aria-label": name, value: query, autoComplete: "off", placeholder: (selected === null || selected === void 0 ? void 0 : selected.length) ? '' : placeholder, onChange: (e) => setQuery(e.target.value), id: id, ref: inputRef, onKeyDown: (e) => {
1327
1516
  if (multiple && e.key === 'Backspace' && !query) {
@@ -1329,7 +1518,7 @@ const SelectBox = forwardRef((props, forwardedRef) => {
1329
1518
  removeSelection(selected.length - 1);
1330
1519
  }
1331
1520
  }
1332
- }, "data-testid": "combobox-input" }), jsx(ComboboxButton, { className: "group absolute inset-y-0 right-0 px-2.5", "data-testid": "combobox-button", children: jsx(SvgChevronDown, { className: chevronIconClass }) })] })) : (jsxs("div", { className: "relative", ref: forwardedRef, children: [jsx(ComboboxInput, { "aria-label": name, displayValue: (option) => (option ? getDisplayValue(option) : null), autoComplete: "off", placeholder: placeholder, onChange: (event) => setQuery(event.target.value), className: inputClass, disabled: disabled, id: id, readOnly: !searchable, ref: inputRef, "data-testid": "combobox-input" }), allowClear && !isEmpty(selected) && (jsx(Button, { size: "xs", iconOnly: true, "aria-label": "Clear selection", theme: "secondary", variant: "plain", className: "group absolute inset-y-0 right-8 h-6 top-2", onClick: () => handleOnChangeInternal(multiple ? [] : null), disabled: disabled, "data-testid": "combobox-clear-button", noOutlineOnFocus: true, children: jsx(SvgX, { className: "size-4 stroke-gray-500 dark:stroke-gray-300" }) })), jsx(ComboboxButton, { className: "group absolute inset-y-0 right-0 px-2.5", "data-testid": "combobox-button", children: jsx(SvgChevronDown, { className: chevronIconClass }) })] })), jsx(ComboboxOptions, { anchor: { to: 'bottom', gap: 5 }, as: "div", modal: modalDropdown, className: buildClassName('w-[var(--input-width)] rounded-lg border border-gray-200 dark:border-white/5 bg-white dark:bg-gray-800 p-1 [--anchor-gap:var(--spacing-1)]', '[--anchor-max-height:20rem]', 'origin-top border transition duration-200 ease-[cubic-bezier(0.4, 0.0, 0.2, 1)] data-[closed]:translate-y-[-15%] data-[closed]:opacity-0', dropdownContainerClass), transition: true, "data-testid": "combobox-options", children: optionsLoading ? (jsx(BodyText, { "data-testid": "options-loading", className: "flex items-center justify-center py-2 px-3 select-none", children: jsx(Loader, { size: "sm" }) })) : shouldShowTypeToSearch ? (jsx(BodyText, { className: "flex items-center justify-between py-2 px-3 select-none", children: "Type to search..." })) : (jsxs("div", { children: [filteredOptions.map((option) => (jsx(ComboboxOption, { disabled: option.disabled, value: option, className: "group rounded-lg py-1.5 px-3 select-none data-[focus]:bg-black/3 dark:data-[focus]:bg-white/10 data-disabled:opacity-50 cursor-pointer data-disabled:pointer-events-none", children: jsxs("div", { className: "flex items-center justify-between gap-2 dark:text-white group-data-[selected]:text-blue-600", children: [jsx("span", { className: "text-sm/6", children: getDisplayValue(option) }), jsx(SvgCheck, { className: "invisible size-5 dark:stroke-gray-300 group-data-[selected]:visible" })] }) }, getValue(option)))), filteredOptions.length === 0 && query && !optionsLoading && (jsxs("div", { "data-testid": "no-result-found", className: "flex items-center gap-2 py-1.5 px-3 select-none text-gray-500 dark:text-gray-400", children: ["No results found for ", jsx("span", { className: "font-semibold", children: query })] })), allowAdd && (jsx(ComboboxOption, { value: query, className: "group rounded-lg py-1.5 px-3 cursor-pointer text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700", onClick: () => void handleAddAndSelect(query), children: jsxs("div", { className: "flex items-center gap-2", children: [jsx(SvgCirclePlus, { className: "size-4.5" }), jsxs(TextContent, { children: [addNewText, " \"", query, "\""] })] }) }))] })) })] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
1521
+ }, "data-testid": "combobox-input" }), jsx(ComboboxButton, { className: "group absolute inset-y-0 right-0 px-2.5", "data-testid": "combobox-button", children: jsx(SvgChevronDown, { className: chevronIconClass }) })] })) : (jsxs("div", { className: "relative", ref: forwardedRef, children: [jsx(ComboboxInput, { "aria-label": name, displayValue: (option) => (option ? getDisplayValue(option) : null), autoComplete: "off", placeholder: placeholder, onChange: (event) => setQuery(event.target.value), className: inputClass, disabled: disabled, id: id, readOnly: !searchable, ref: inputRef, "data-testid": "combobox-input" }), allowClear && !isEmpty(selected) && (jsx(Button, { size: "xs", iconOnly: true, "aria-label": "Clear selection", theme: "secondary", variant: "plain", className: "group absolute inset-y-0 right-8 h-6 top-2", onClick: () => handleOnChangeInternal(multiple ? [] : null), disabled: disabled, "data-testid": "combobox-clear-button", noOutlineOnFocus: true, children: jsx(SvgX, { className: "size-4 stroke-gray-500 dark:stroke-gray-300" }) })), jsx(ComboboxButton, { className: "group absolute inset-y-0 right-0 px-2.5", "data-testid": "combobox-button", children: jsx(SvgChevronDown, { className: chevronIconClass }) })] })), jsx(ComboboxOptions, { anchor: { to: 'bottom', gap: 5 }, as: "div", modal: modalDropdown, className: buildClassName('w-[var(--input-width)] rounded-lg border border-gray-200 dark:border-white/5 bg-white dark:bg-gray-800 p-1 [--anchor-gap:var(--spacing-1)]', '[--anchor-max-height:20rem]', 'origin-top border transition duration-200 ease-[cubic-bezier(0.4, 0.0, 0.2, 1)] data-[closed]:translate-y-[-15%] data-[closed]:opacity-0', dropdownContainerClass), transition: true, "data-testid": "combobox-options", children: optionsLoading ? (jsx(BodyText, { "data-testid": "options-loading", className: "flex items-center justify-center py-2 px-3 select-none", children: jsx(Loader, { size: "sm" }) })) : shouldShowTypeToSearch ? (jsx(BodyText, { className: "flex items-center justify-between py-2 px-3 select-none", children: "Type to search..." })) : (jsxs("div", { children: [filteredOptions.map((option) => (jsx(ComboboxOption, { disabled: option.disabled, value: option, className: "group rounded-lg py-1.5 px-3 select-none data-[focus]:bg-black/3 dark:data-[focus]:bg-white/10 data-disabled:opacity-50 cursor-pointer data-disabled:pointer-events-none", children: jsxs("div", { className: "flex items-center justify-between gap-2 dark:text-white group-data-[selected]:text-blue-600", children: [jsx("span", { className: "text-sm/6", children: getDisplayValue(option) }), jsx(SvgCheck, { className: "invisible size-5 dark:stroke-gray-300 group-data-[selected]:visible" })] }) }, getValue(option)))), filteredOptions.length === 0 && (jsx("div", { "data-testid": "no-result-found", className: "flex items-center gap-2 py-1.5 px-3 select-none text-gray-500 dark:text-gray-400", children: query ? (jsxs(Fragment, { children: ["No results found for ", jsx("span", { className: "font-semibold", children: query })] })) : (noOptionsText) })), allowAdd && (jsx(ComboboxOption, { value: query, className: "group rounded-lg py-1.5 px-3 cursor-pointer text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700", onClick: () => void handleAddAndSelect(query), children: jsxs("div", { className: "flex items-center gap-2", children: [jsx(SvgCirclePlus, { className: "size-4.5" }), jsxs(TextContent, { children: [addNewText, " \"", query, "\""] })] }) }))] })) })] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
1333
1522
  });
1334
1523
 
1335
1524
  const Tabs = ({ tabs, defaultIndex = 0, selectedIndex, onChange, variant = 'underline', orientation = 'horizontal', stretch = false, className = '', listClass = '', panelsClass = '', }) => {
@@ -1381,7 +1570,7 @@ const Textarea = forwardRef((props, ref) => {
1381
1570
  const hasError = !isEmpty(error);
1382
1571
  const hasRightGroup = rightGroup != null && rightGroup !== undefined;
1383
1572
  const hasLeftGroup = leftGroup != null && leftGroup !== undefined;
1384
- return (jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, children: label }), labelHint] })), jsxs("div", { className: "relative", children: [hasLeftGroup && (jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsx("textarea", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, className: buildClassName('transition-all', 'block w-full rounded-lg bg-white px-3.5 py-2 text-base sm:text-sm/6', 'text-gray-900 outline dark:outline outline-1 -outline-offset-1', 'outline-gray-300 dark:outline-gray-600', 'focus:outline-blue-600 dark:focus:outline-blue-600 focus:outline-2 focus:-outline-offset-2', 'dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-500 placeholder:text-gray-400 dark:text-white', 'invalid:group-[.has-error]:outline-red-500', 'disabled:pointer-events-none disabled:bg-gray-100', 'dark:disabled:bg-gray-500', hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '', className) }), hasRightGroup && (jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center", children: rightGroup }))] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
1573
+ return (jsxs("div", { className: buildClassName('group', hasError && 'has-error', containerClass), children: [label && (jsxs("div", { className: buildClassName('flex items-center justify-between mb-2', labelWrapperClass), children: [jsx(Label, { className: labelClass, htmlFor: id, children: label }), jsx(TextContent, { xsmall: true, children: labelHint })] })), jsxs("div", { className: "relative", children: [hasLeftGroup && (jsx("span", { className: "absolute top-0 h-full flex items-center justify-center w-10", children: leftGroup })), jsx("textarea", { ref: ref, autoComplete: "off", ...inputProps, name: name, id: id, className: buildClassName('transition-all', 'block w-full rounded-lg bg-white px-3.5 py-2 text-base sm:text-sm/6', 'text-gray-900 outline dark:outline outline-1 -outline-offset-1', 'outline-gray-300 dark:outline-gray-600', 'focus:outline-blue-600 dark:focus:outline-blue-600 focus:outline-2 focus:-outline-offset-2', 'dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-500 placeholder:text-gray-400 dark:text-white', 'invalid:group-[.has-error]:outline-red-500', 'disabled:pointer-events-none disabled:bg-gray-100', 'dark:disabled:bg-gray-500', hasRightGroup ? 'pe-10' : '', hasLeftGroup ? 'ps-10' : '', className) }), hasRightGroup && (jsx("span", { className: "absolute end-0.75 top-0 h-full flex items-center justify-center", children: rightGroup }))] }), showErrorMessage && error && (jsx("div", { className: "mt-1", children: jsx(TextContent, { error: true, small: true, children: error }) }))] }));
1385
1574
  });
1386
1575
 
1387
1576
  /**
@@ -1484,9 +1673,12 @@ const DENSITY_CELL_CLASS$1 = {
1484
1673
  spacious: 'px-4 py-4',
1485
1674
  };
1486
1675
  const VirtualizedRow = ({ index, style, data, }) => {
1487
- const { items, columns, gridTemplate, onRowClick, rowClass, density = 'default', striped } = data;
1676
+ var _a, _b;
1677
+ const { items, columns, gridTemplate, onRowClick, rowClass, density = 'default', striped, selectable, getKey, isSelected, toggleRow, isRowSelectable, } = data;
1488
1678
  const item = items[index];
1489
1679
  const isStriped = striped && index % 2 === 1;
1680
+ const key = (_a = getKey === null || getKey === void 0 ? void 0 : getKey(item, index)) !== null && _a !== void 0 ? _a : index;
1681
+ const rowSelectable = !isRowSelectable || isRowSelectable(item);
1490
1682
  const resolvedRowClass = !rowClass
1491
1683
  ? ''
1492
1684
  : typeof rowClass === 'function'
@@ -1500,20 +1692,21 @@ const VirtualizedRow = ({ index, style, data, }) => {
1500
1692
  return col.cellClass;
1501
1693
  };
1502
1694
  const densityCellClass = DENSITY_CELL_CLASS$1[density];
1503
- return (jsx("div", { role: "row", className: buildClassName('grid border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 group', onRowClick && 'cursor-pointer', isStriped && 'bg-gray-50 dark:bg-gray-800/40', resolvedRowClass), style: {
1695
+ return (jsxs("div", { role: "row", className: buildClassName('grid border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 group', onRowClick && 'cursor-pointer', isStriped && 'bg-gray-50 dark:bg-gray-800/40', resolvedRowClass), style: {
1504
1696
  ...style,
1505
1697
  display: 'grid',
1506
1698
  gridTemplateColumns: gridTemplate,
1507
1699
  minWidth: 'fit-content',
1508
- }, onClick: onRowClick ? () => onRowClick(item, index) : undefined, children: columns.map((col) => {
1509
- var _a;
1510
- const content = col.render ? col.render(item) : ((_a = get(item, col.name)) !== null && _a !== void 0 ? _a : 'Not set');
1511
- return (jsx("div", { role: "cell", className: buildClassName('whitespace-nowrap border-r last:border-r-0 border-gray-200 dark:border-gray-700', densityCellClass, col.align === 'center' && 'text-center', col.align === 'right' && 'text-right', col.sticky === 'left' &&
1512
- 'sticky left-0 z-10 bg-white dark:bg-gray-900 shadow-[2px_0_4px_rgba(0,0,0,0.05)]', col.sticky === 'right' &&
1513
- 'sticky right-0 z-10 bg-white dark:bg-gray-900 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]', isStriped && 'bg-gray-50 dark:bg-gray-800/40', getCellClass(col)), children: content }, col.name));
1514
- }) }));
1700
+ }, onClick: onRowClick ? () => onRowClick(item, index) : undefined, children: [selectable && (jsx("div", { role: "cell", className: buildClassName('flex items-center whitespace-nowrap border-r last:border-r-0 border-gray-200 dark:border-gray-700', densityCellClass, isStriped && 'bg-gray-50 dark:bg-gray-800/40'), onClick: (e) => e.stopPropagation(), children: jsx(Checkbox, { "aria-label": "Select row", checked: (_b = isSelected === null || isSelected === void 0 ? void 0 : isSelected(key)) !== null && _b !== void 0 ? _b : false, disabled: !rowSelectable, onChange: () => toggleRow === null || toggleRow === void 0 ? void 0 : toggleRow(key) }) })), columns.map((col) => {
1701
+ var _a;
1702
+ const content = col.render ? col.render(item) : ((_a = get(item, col.name)) !== null && _a !== void 0 ? _a : 'Not set');
1703
+ return (jsx("div", { role: "cell", className: buildClassName('whitespace-nowrap border-r last:border-r-0 border-gray-200 dark:border-gray-700', densityCellClass, col.align === 'center' && 'text-center', col.align === 'right' && 'text-right', col.sticky === 'left' &&
1704
+ 'sticky left-0 z-10 bg-white dark:bg-gray-900 shadow-[2px_0_4px_rgba(0,0,0,0.05)]', col.sticky === 'right' &&
1705
+ 'sticky right-0 z-10 bg-white dark:bg-gray-900 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]', isStriped && 'bg-gray-50 dark:bg-gray-800/40', getCellClass(col)), children: content }, col.name));
1706
+ })] }));
1515
1707
  };
1516
1708
 
1709
+ const SELECTION_COLUMN_WIDTH = '44px';
1517
1710
  const DENSITY_CELL_CLASS = {
1518
1711
  compact: 'px-2 py-1.5',
1519
1712
  default: 'px-3 py-3',
@@ -1526,11 +1719,28 @@ const columnWidth = (col) => {
1526
1719
  return `${col.width}px`;
1527
1720
  return col.width;
1528
1721
  };
1529
- function VirtualizedDataTable({ items, columns, sorting = {}, onSort, loading = false, emptyMessage = 'No data available', containerClass = '', wrapperClass = '', onRowClick, rowClass, density = 'default', striped = false, rowHeight = 48, maxHeight = 400, overscanCount = 3, }) {
1722
+ function VirtualizedDataTable({ items, columns, sorting = {}, onSort, loading = false, emptyMessage = 'No data available', containerClass = '', wrapperClass = '', onRowClick, rowClass, density = 'default', striped = false, rowHeight = 48, maxHeight = 400, overscanCount = 3, rowKey = 'id', selectable = false, selectedRowKeys, defaultSelectedRowKeys, onSelectionChange, isRowSelectable, }) {
1530
1723
  const scrollRef = useRef(null);
1531
1724
  const outerRef = useRef(null);
1532
1725
  const headerRef = useRef(null);
1533
- const gridTemplate = useMemo(() => columns.map((col) => columnWidth(col)).join(' '), [columns]);
1726
+ const getKey = useCallback((item, idx) => {
1727
+ var _a;
1728
+ if (typeof rowKey === 'function')
1729
+ return rowKey(item);
1730
+ return (_a = item[rowKey]) !== null && _a !== void 0 ? _a : idx;
1731
+ }, [rowKey]);
1732
+ const { isSelected, toggleRow, toggleAll, allSelected, someSelected } = useRowSelection({
1733
+ items,
1734
+ getKey,
1735
+ selectedRowKeys,
1736
+ defaultSelectedRowKeys,
1737
+ onSelectionChange,
1738
+ isRowSelectable,
1739
+ });
1740
+ const gridTemplate = useMemo(() => {
1741
+ const widths = columns.map((col) => columnWidth(col));
1742
+ return selectable ? [SELECTION_COLUMN_WIDTH, ...widths].join(' ') : widths.join(' ');
1743
+ }, [columns, selectable]);
1534
1744
  const densityCellClass = DENSITY_CELL_CLASS[density];
1535
1745
  const skeletonRows = Math.max(1, Math.floor(maxHeight / rowHeight));
1536
1746
  useEffect(() => {
@@ -1548,19 +1758,48 @@ function VirtualizedDataTable({ items, columns, sorting = {}, onSort, loading =
1548
1758
  if (column.sortable)
1549
1759
  onSort === null || onSort === void 0 ? void 0 : onSort(column);
1550
1760
  }, [onSort]);
1551
- const itemData = useMemo(() => ({ items, columns, gridTemplate, onRowClick, rowClass, density, striped }), [items, columns, gridTemplate, onRowClick, rowClass, density, striped]);
1761
+ const itemData = useMemo(() => ({
1762
+ items,
1763
+ columns,
1764
+ gridTemplate,
1765
+ onRowClick,
1766
+ rowClass,
1767
+ density,
1768
+ striped,
1769
+ selectable,
1770
+ getKey,
1771
+ isSelected,
1772
+ toggleRow,
1773
+ isRowSelectable,
1774
+ }), [
1775
+ items,
1776
+ columns,
1777
+ gridTemplate,
1778
+ onRowClick,
1779
+ rowClass,
1780
+ density,
1781
+ striped,
1782
+ selectable,
1783
+ getKey,
1784
+ isSelected,
1785
+ toggleRow,
1786
+ isRowSelectable,
1787
+ ]);
1552
1788
  /* -------------------------------------------------------
1553
1789
  * Header
1554
1790
  * ------------------------------------------------------- */
1555
- const Header = (jsx("div", { ref: headerRef, className: "overflow-hidden w-full", children: jsx("div", { className: "grid bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", style: { gridTemplateColumns: gridTemplate, minWidth: 'fit-content' }, children: columns.map((col) => (jsx("div", { role: "columnheader", className: buildClassName('font-semibold text-sm whitespace-nowrap flex items-center', densityCellClass, 'border-r last:border-r-0 border-gray-200 dark:border-gray-700', col.sticky === 'left' &&
1556
- 'sticky left-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[2px_0_4px_rgba(0,0,0,0.05)]', col.sticky === 'right' &&
1557
- 'sticky right-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]', col.headerClass), children: jsxs(TextContent, { role: col.sortable ? 'button' : undefined, className: buildClassName(col.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(col), children: [col.label, col.sortable ? getSortIcon(sorting[col.name]) : null] }) }, col.name))) }) }));
1791
+ const Header = (jsx("div", { ref: headerRef, className: "overflow-hidden w-full", children: jsxs("div", { className: "grid bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700", style: { gridTemplateColumns: gridTemplate, minWidth: 'fit-content' }, children: [selectable && (jsx("div", { role: "columnheader", className: buildClassName('flex items-center border-r last:border-r-0 border-gray-200 dark:border-gray-700', densityCellClass), children: jsx(Checkbox, { "aria-label": "Select all rows", checked: allSelected, ref: (el) => {
1792
+ if (el)
1793
+ el.indeterminate = someSelected;
1794
+ }, onChange: toggleAll }) })), columns.map((col) => (jsx("div", { role: "columnheader", className: buildClassName('font-semibold text-sm whitespace-nowrap flex items-center', densityCellClass, 'border-r last:border-r-0 border-gray-200 dark:border-gray-700', col.sticky === 'left' &&
1795
+ 'sticky left-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[2px_0_4px_rgba(0,0,0,0.05)]', col.sticky === 'right' &&
1796
+ 'sticky right-0 z-20 bg-gray-50 dark:bg-gray-800 shadow-[-2px_0_4px_rgba(0,0,0,0.05)]', col.headerClass), children: jsxs(TextContent, { role: col.sortable ? 'button' : undefined, className: buildClassName(col.sortable && 'inline-flex items-center gap-2 cursor-pointer select-none'), onClick: () => handleSort(col), children: [col.label, col.sortable ? getSortIcon(sorting[col.name]) : null] }) }, col.name)))] }) }));
1558
1797
  const wrapperCls = buildClassName('rounded-lg border border-gray-200 dark:border-gray-800 overflow-hidden', wrapperClass);
1559
1798
  /* -------------------------------------------------------
1560
1799
  * Loading state
1561
1800
  * ------------------------------------------------------- */
1562
1801
  if (loading) {
1563
- return (jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxs("div", { className: wrapperCls, children: [Header, jsx("div", { style: { height: maxHeight }, className: "flex flex-col", children: Array.from({ length: skeletonRows }).map((_, idx) => (jsx("div", { "data-testid": "skeleton-row", className: "grid animate-pulse bg-white dark:bg-gray-900 border-b border-gray-100 dark:border-gray-800", style: { gridTemplateColumns: gridTemplate, height: rowHeight }, children: columns.map((col) => (jsx("div", { className: densityCellClass, children: jsx("div", { className: "h-4 w-3/4 bg-gray-300 dark:bg-gray-700 rounded" }) }, col.name))) }, idx))) })] }) }));
1802
+ return (jsx("div", { className: buildClassName('w-full rounded-lg relative', containerClass), children: jsxs("div", { className: wrapperCls, children: [Header, jsx("div", { style: { height: maxHeight }, className: "flex flex-col", children: Array.from({ length: skeletonRows }).map((_, idx) => (jsxs("div", { "data-testid": "skeleton-row", className: "grid animate-pulse bg-white dark:bg-gray-900 border-b border-gray-100 dark:border-gray-800", style: { gridTemplateColumns: gridTemplate, height: rowHeight }, children: [selectable && jsx("div", { className: densityCellClass }), columns.map((col) => (jsx("div", { className: densityCellClass, children: jsx("div", { className: "h-4 w-3/4 bg-gray-300 dark:bg-gray-700 rounded" }) }, col.name)))] }, idx))) })] }) }));
1564
1803
  }
1565
1804
  /* -------------------------------------------------------
1566
1805
  * Empty state
@@ -1610,5 +1849,5 @@ const useIsTabletOrMobile = () => {
1610
1849
  return isMobile || isTablet;
1611
1850
  };
1612
1851
 
1613
- export { Alert, Badge, Banner, BodyText, Breadcrumb, Button, Card, Checkbox, CheckboxGroup, DOTS, DataTable, DetailedInformation, Dot, Drawer, Dropdown, EmptyState, EmptyTableRow, HeadingText, Input, Label, Loader, PASSWORD_PLACEHOLDER, PASSWORD_TYPE, Pagination, PasswordInput, Radio, RadioGroup, RadioSwitch, RangeInput, RangeSlider, SelectBox, SortIconMap, Table, TableBody, TableCell, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, TextContent, Textarea, Toast, ToastProvider, VirtualizedDataTable, buildClassName, buildInputClass, get, getSortIcon, isArray, isEmpty, nextSortDirection, updateSortQuery, useDebounce, useDebounceFn, useIsMobile, useIsTablet, useIsTabletOrMobile, usePagination, useToast };
1852
+ export { Accordion, Alert, Badge, Banner, BodyText, Breadcrumb, Button, ButtonGroup, Card, Checkbox, CheckboxGroup, DOTS, DataTable, DetailedInformation, Dot, Drawer, Dropdown, EmptyState, EmptyTableRow, HeadingText, Input, Label, Loader, PASSWORD_PLACEHOLDER, PASSWORD_TYPE, Pagination, PasswordInput, Radio, RadioGroup, RadioSwitch, RangeInput, RangeSlider, SelectBox, SortIconMap, Table, TableBody, TableCell, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, TextContent, Textarea, Toast, ToastProvider, VirtualizedDataTable, buildClassName, buildInputClass, get, getSortIcon, isArray, isEmpty, nextSortDirection, updateSortQuery, useDebounce, useDebounceFn, useIsMobile, useIsTablet, useIsTabletOrMobile, usePagination, useRowSelection, useToast };
1614
1853
  //# sourceMappingURL=react-tailwind.es.js.map