@pk-design/react-tailwind 1.4.4 → 1.5.0
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.
- package/dist/react-tailwind.cjs.js +232 -99
- package/dist/react-tailwind.cjs.js.map +1 -1
- package/dist/react-tailwind.css +1 -1
- package/dist/react-tailwind.css.map +1 -1
- package/dist/react-tailwind.es.js +232 -101
- package/dist/react-tailwind.es.js.map +1 -1
- package/dist/types/components/Accordion/Accordion.d.ts +3 -0
- package/dist/types/components/Accordion/Accordion.test.d.ts +1 -0
- package/dist/types/components/Accordion/Accordion.types.d.ts +85 -0
- package/dist/types/components/Accordion/index.d.ts +2 -0
- package/dist/types/components/BodyText/BodyText.types.d.ts +1 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.d.ts +3 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.test.d.ts +1 -0
- package/dist/types/components/ButtonGroup/ButtonGroup.types.d.ts +70 -0
- package/dist/types/components/ButtonGroup/index.d.ts +2 -0
- package/dist/types/components/DataTable/DataTable.icons.d.ts +1 -1
- package/dist/types/components/SelectBox/SelectBox.d.ts +1 -1
- package/dist/types/components/SelectBox/SelectBox.types.d.ts +7 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -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, {
|
|
3
|
+
import React__default, { useId, useMemo, useState, forwardRef, Children, isValidElement, cloneElement, useRef, useEffect, Fragment as Fragment$1, useCallback, 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
|
|
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
|
|
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-
|
|
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$
|
|
32
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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$
|
|
55
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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$
|
|
78
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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$
|
|
101
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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-
|
|
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$
|
|
272
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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$
|
|
291
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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(
|
|
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$
|
|
351
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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$
|
|
512
|
-
function _extends$
|
|
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$
|
|
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$
|
|
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$
|
|
531
|
-
function _extends$
|
|
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$
|
|
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$
|
|
694
|
+
}, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
|
|
545
695
|
d: "m9 18 6-6-6-6"
|
|
546
696
|
})));
|
|
547
697
|
};
|
|
@@ -621,10 +771,10 @@ const updateSortQuery = (sortQuery, name, type = 'string') => {
|
|
|
621
771
|
return updated;
|
|
622
772
|
};
|
|
623
773
|
|
|
624
|
-
var _path$
|
|
625
|
-
function _extends$
|
|
774
|
+
var _path$7;
|
|
775
|
+
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
776
|
var SvgArrowDownWideNarrow = function SvgArrowDownWideNarrow(props) {
|
|
627
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
777
|
+
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
628
778
|
xmlns: "http://www.w3.org/2000/svg",
|
|
629
779
|
width: 24,
|
|
630
780
|
height: 24,
|
|
@@ -635,15 +785,15 @@ var SvgArrowDownWideNarrow = function SvgArrowDownWideNarrow(props) {
|
|
|
635
785
|
strokeWidth: 2,
|
|
636
786
|
className: "lucide lucide-arrow-down-wide-narrow-icon lucide-arrow-down-wide-narrow",
|
|
637
787
|
viewBox: "0 0 24 24"
|
|
638
|
-
}, props), _path$
|
|
788
|
+
}, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
|
|
639
789
|
d: "m3 16 4 4 4-4M7 20V4M11 4h10M11 8h7M11 12h4"
|
|
640
790
|
})));
|
|
641
791
|
};
|
|
642
792
|
|
|
643
|
-
var _path$
|
|
644
|
-
function _extends$
|
|
793
|
+
var _path$6;
|
|
794
|
+
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
795
|
var SvgArrowDownNarrowWide = function SvgArrowDownNarrowWide(props) {
|
|
646
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
796
|
+
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
647
797
|
xmlns: "http://www.w3.org/2000/svg",
|
|
648
798
|
width: 24,
|
|
649
799
|
height: 24,
|
|
@@ -654,15 +804,15 @@ var SvgArrowDownNarrowWide = function SvgArrowDownNarrowWide(props) {
|
|
|
654
804
|
strokeWidth: 2,
|
|
655
805
|
className: "lucide lucide-arrow-down-narrow-wide-icon lucide-arrow-down-narrow-wide",
|
|
656
806
|
viewBox: "0 0 24 24"
|
|
657
|
-
}, props), _path$
|
|
807
|
+
}, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
|
|
658
808
|
d: "m3 16 4 4 4-4M7 20V4M11 4h4M11 8h7M11 12h10"
|
|
659
809
|
})));
|
|
660
810
|
};
|
|
661
811
|
|
|
662
|
-
var _path$
|
|
663
|
-
function _extends$
|
|
812
|
+
var _path$5;
|
|
813
|
+
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
814
|
var SvgArrowDownAz = function SvgArrowDownAz(props) {
|
|
665
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
815
|
+
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
666
816
|
xmlns: "http://www.w3.org/2000/svg",
|
|
667
817
|
width: 24,
|
|
668
818
|
height: 24,
|
|
@@ -673,15 +823,15 @@ var SvgArrowDownAz = function SvgArrowDownAz(props) {
|
|
|
673
823
|
strokeWidth: 2,
|
|
674
824
|
className: "lucide lucide-arrow-down-az-icon lucide-arrow-down-a-z",
|
|
675
825
|
viewBox: "0 0 24 24"
|
|
676
|
-
}, props), _path$
|
|
826
|
+
}, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
|
|
677
827
|
d: "m3 16 4 4 4-4M7 20V4M20 8h-5M15 10V6.5a2.5 2.5 0 0 1 5 0V10M15 14h5l-5 6h5"
|
|
678
828
|
})));
|
|
679
829
|
};
|
|
680
830
|
|
|
681
|
-
var _path$
|
|
682
|
-
function _extends$
|
|
831
|
+
var _path$4;
|
|
832
|
+
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
833
|
var SvgArrowDownZa = function SvgArrowDownZa(props) {
|
|
684
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
834
|
+
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
685
835
|
xmlns: "http://www.w3.org/2000/svg",
|
|
686
836
|
width: 24,
|
|
687
837
|
height: 24,
|
|
@@ -692,15 +842,15 @@ var SvgArrowDownZa = function SvgArrowDownZa(props) {
|
|
|
692
842
|
strokeWidth: 2,
|
|
693
843
|
className: "lucide lucide-arrow-down-za-icon lucide-arrow-down-z-a",
|
|
694
844
|
viewBox: "0 0 24 24"
|
|
695
|
-
}, props), _path$
|
|
845
|
+
}, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
|
|
696
846
|
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
847
|
})));
|
|
698
848
|
};
|
|
699
849
|
|
|
700
|
-
var _path$
|
|
701
|
-
function _extends$
|
|
850
|
+
var _path$3;
|
|
851
|
+
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
852
|
var SvgArrowUpDown = function SvgArrowUpDown(props) {
|
|
703
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
853
|
+
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
704
854
|
xmlns: "http://www.w3.org/2000/svg",
|
|
705
855
|
width: 24,
|
|
706
856
|
height: 24,
|
|
@@ -711,7 +861,7 @@ var SvgArrowUpDown = function SvgArrowUpDown(props) {
|
|
|
711
861
|
strokeWidth: 2,
|
|
712
862
|
className: "lucide lucide-arrow-up-down-icon lucide-arrow-up-down",
|
|
713
863
|
viewBox: "0 0 24 24"
|
|
714
|
-
}, props), _path$
|
|
864
|
+
}, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
|
|
715
865
|
d: "m21 16-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16"
|
|
716
866
|
})));
|
|
717
867
|
};
|
|
@@ -802,11 +952,11 @@ function DataTable({ items, columns, sorting = {}, onSort, loading, pagination,
|
|
|
802
952
|
}
|
|
803
953
|
DataTable.displayName = 'DataTable';
|
|
804
954
|
|
|
805
|
-
const Title = ({ children, className }) => (jsx("h1", { className: buildClassName('text-3xl font-bold text-
|
|
806
|
-
const SubTitle = ({ children, className }) => (jsx("h2", { className: buildClassName('text-2xl font-semibold text-
|
|
807
|
-
const SubTitle2 = ({ children, className }) => (jsx("h3", { className: buildClassName('text-xl font-semibold text-
|
|
808
|
-
const SubTitle3 = ({ children, className }) => (jsx("h4", { className: buildClassName('text-lg font-medium text-
|
|
809
|
-
const SubTitle4 = ({ children, className }) => (jsx("h5", { className: buildClassName('text-base font-medium text-
|
|
955
|
+
const Title = ({ children, className }) => (jsx("h1", { className: buildClassName('text-3xl font-bold text-[var(--ui-text)]', className), children: children }));
|
|
956
|
+
const SubTitle = ({ children, className }) => (jsx("h2", { className: buildClassName('text-2xl font-semibold text-[var(--ui-text)]', className), children: children }));
|
|
957
|
+
const SubTitle2 = ({ children, className }) => (jsx("h3", { className: buildClassName('text-xl font-semibold text-[var(--ui-text)]', className), children: children }));
|
|
958
|
+
const SubTitle3 = ({ children, className }) => (jsx("h4", { className: buildClassName('text-lg font-medium text-[var(--ui-text)]', className), children: children }));
|
|
959
|
+
const SubTitle4 = ({ children, className }) => (jsx("h5", { className: buildClassName('text-base font-medium text-[var(--ui-text)]', className), children: children }));
|
|
810
960
|
const HeadingText = {
|
|
811
961
|
Title,
|
|
812
962
|
SubTitle,
|
|
@@ -863,10 +1013,10 @@ const Dropdown = ({ triggerButton, renderTriggerButton, items, renderItem, items
|
|
|
863
1013
|
};
|
|
864
1014
|
Dropdown.displayName = 'Dropdown';
|
|
865
1015
|
|
|
866
|
-
var _path$
|
|
867
|
-
function _extends$
|
|
1016
|
+
var _path$2;
|
|
1017
|
+
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
1018
|
var SvgFolderPlus = function SvgFolderPlus(props) {
|
|
869
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
1019
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
870
1020
|
xmlns: "http://www.w3.org/2000/svg",
|
|
871
1021
|
width: 24,
|
|
872
1022
|
height: 24,
|
|
@@ -877,7 +1027,7 @@ var SvgFolderPlus = function SvgFolderPlus(props) {
|
|
|
877
1027
|
strokeWidth: 2,
|
|
878
1028
|
className: "lucide lucide-folder-plus-icon lucide-folder-plus",
|
|
879
1029
|
viewBox: "0 0 24 24"
|
|
880
|
-
}, props), _path$
|
|
1030
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
|
|
881
1031
|
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
1032
|
})));
|
|
883
1033
|
};
|
|
@@ -898,7 +1048,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
898
1048
|
const hasError = Boolean(error);
|
|
899
1049
|
const hasRightGroup = rightGroup !== null && rightGroup !== undefined;
|
|
900
1050
|
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 }) }))] }));
|
|
1051
|
+
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
1052
|
});
|
|
903
1053
|
Input.displayName = 'Input';
|
|
904
1054
|
|
|
@@ -968,7 +1118,7 @@ const RadioSwitch = ({ label, items, selected, onChange, wrapperClass, switchCla
|
|
|
968
1118
|
transform: `translate(${style.left}px, ${style.top}px)`,
|
|
969
1119
|
width: style.width,
|
|
970
1120
|
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:
|
|
1121
|
+
} }), 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
1122
|
};
|
|
973
1123
|
|
|
974
1124
|
/**
|
|
@@ -1139,28 +1289,9 @@ const useDebounceFn = (fn, ms) => {
|
|
|
1139
1289
|
}, [fn, ms]);
|
|
1140
1290
|
};
|
|
1141
1291
|
|
|
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
1292
|
var _path$1;
|
|
1162
1293
|
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
|
|
1294
|
+
var SvgCheck = function SvgCheck(props) {
|
|
1164
1295
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
1165
1296
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1166
1297
|
width: 24,
|
|
@@ -1170,10 +1301,10 @@ var SvgChevronDown = function SvgChevronDown(props) {
|
|
|
1170
1301
|
strokeLinecap: "round",
|
|
1171
1302
|
strokeLinejoin: "round",
|
|
1172
1303
|
strokeWidth: 2,
|
|
1173
|
-
className: "lucide lucide-
|
|
1304
|
+
className: "lucide lucide-check-icon lucide-check",
|
|
1174
1305
|
viewBox: "0 0 24 24"
|
|
1175
1306
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
1176
|
-
d: "
|
|
1307
|
+
d: "M20 6 9 17l-5-5"
|
|
1177
1308
|
})));
|
|
1178
1309
|
};
|
|
1179
1310
|
|
|
@@ -1202,7 +1333,7 @@ var SvgCirclePlus = function SvgCirclePlus(props) {
|
|
|
1202
1333
|
|
|
1203
1334
|
const constructInputClass = (disabled) => buildInputClass('', { disabled });
|
|
1204
1335
|
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;
|
|
1336
|
+
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
1337
|
const hasError = Boolean(error);
|
|
1207
1338
|
const [query, setQuery] = useState('');
|
|
1208
1339
|
const debouncedQuery = useDebounce(query, 500);
|
|
@@ -1321,7 +1452,7 @@ const SelectBox = forwardRef((props, forwardedRef) => {
|
|
|
1321
1452
|
if (async && debouncedQuery)
|
|
1322
1453
|
handleSearch(debouncedQuery);
|
|
1323
1454
|
}, [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) &&
|
|
1455
|
+
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
1456
|
(selected === null || selected === void 0 ? void 0 : selected.length) > 0 &&
|
|
1326
1457
|
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
1458
|
if (multiple && e.key === 'Backspace' && !query) {
|
|
@@ -1329,7 +1460,7 @@ const SelectBox = forwardRef((props, forwardedRef) => {
|
|
|
1329
1460
|
removeSelection(selected.length - 1);
|
|
1330
1461
|
}
|
|
1331
1462
|
}
|
|
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 &&
|
|
1463
|
+
}, "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
1464
|
});
|
|
1334
1465
|
|
|
1335
1466
|
const Tabs = ({ tabs, defaultIndex = 0, selectedIndex, onChange, variant = 'underline', orientation = 'horizontal', stretch = false, className = '', listClass = '', panelsClass = '', }) => {
|
|
@@ -1381,7 +1512,7 @@ const Textarea = forwardRef((props, ref) => {
|
|
|
1381
1512
|
const hasError = !isEmpty(error);
|
|
1382
1513
|
const hasRightGroup = rightGroup != null && rightGroup !== undefined;
|
|
1383
1514
|
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 }) }))] }));
|
|
1515
|
+
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
1516
|
});
|
|
1386
1517
|
|
|
1387
1518
|
/**
|
|
@@ -1610,5 +1741,5 @@ const useIsTabletOrMobile = () => {
|
|
|
1610
1741
|
return isMobile || isTablet;
|
|
1611
1742
|
};
|
|
1612
1743
|
|
|
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 };
|
|
1744
|
+
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, useToast };
|
|
1614
1745
|
//# sourceMappingURL=react-tailwind.es.js.map
|