@woobee/ui 0.2.2 → 0.2.3

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/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var React16 = require('react');
4
+ var React18 = require('react');
5
5
  var reactDom = require('react-dom');
6
6
  var reactTransitionGroup = require('react-transition-group');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
- var React16__default = /*#__PURE__*/_interopDefault(React16);
10
+ var React18__default = /*#__PURE__*/_interopDefault(React18);
11
11
 
12
12
  // src/utils/classNames.ts
13
13
  function classNames(classNameHash) {
@@ -182,11 +182,11 @@ function Tabs({
182
182
  }
183
183
  );
184
184
  }
185
- var Toggle = React16.forwardRef(
185
+ var Toggle = React18.forwardRef(
186
186
  ({ listening, size, name, value, onChange, className }, ref) => {
187
- const internalRef = React16.useRef(null);
187
+ const internalRef = React18.useRef(null);
188
188
  const spanRef = ref || internalRef;
189
- React16.useEffect(() => {
189
+ React18.useEffect(() => {
190
190
  if (listening && spanRef && "current" in spanRef && spanRef.current && value !== null) {
191
191
  spanRef.current.value = value;
192
192
  }
@@ -271,7 +271,7 @@ function CheckboxList({
271
271
  loading = false,
272
272
  placeholder = "No items found."
273
273
  }) {
274
- const hasLoadedRef = React16.useRef(false);
274
+ const hasLoadedRef = React18.useRef(false);
275
275
  if (!loading) {
276
276
  hasLoadedRef.current = true;
277
277
  }
@@ -329,7 +329,7 @@ function CheckboxList({
329
329
  );
330
330
  }) : renderPlaceholder() }) }) });
331
331
  }
332
- var ModalContext = React16.createContext({
332
+ var ModalContext = React18.createContext({
333
333
  modalShowing: false,
334
334
  drawerShowing: false,
335
335
  setModalShowing: () => {
@@ -338,10 +338,10 @@ var ModalContext = React16.createContext({
338
338
  }
339
339
  });
340
340
  function useModalContext() {
341
- return React16.useContext(ModalContext);
341
+ return React18.useContext(ModalContext);
342
342
  }
343
343
  function ModalProvider({ children }) {
344
- const [currentState, setCurrentState] = React16.useState(0);
344
+ const [currentState, setCurrentState] = React18.useState(0);
345
345
  function reducer2(state, action) {
346
346
  const updatedValues = { ...state };
347
347
  if ("modalShowing" in action) {
@@ -355,12 +355,12 @@ function ModalProvider({ children }) {
355
355
  }
356
356
  return updatedValues;
357
357
  }
358
- const [values, dispatch] = React16.useReducer(reducer2, {
358
+ const [values, dispatch] = React18.useReducer(reducer2, {
359
359
  modalShowing: false,
360
360
  drawerShowing: false
361
361
  });
362
362
  const { modalShowing, drawerShowing } = values;
363
- React16.useEffect(() => {
363
+ React18.useEffect(() => {
364
364
  if (typeof document === "undefined") return;
365
365
  const bodyEl = document.getElementsByTagName("BODY")[0];
366
366
  if (!bodyEl) return;
@@ -383,12 +383,12 @@ function ModalProvider({ children }) {
383
383
  }
384
384
  );
385
385
  }
386
- var TransitionContext = React16.createContext({
386
+ var TransitionContext = React18.createContext({
387
387
  parent: {}
388
388
  });
389
389
  function useIsInitialRender() {
390
- const isInitialRender = React16.useRef(true);
391
- React16.useEffect(() => {
390
+ const isInitialRender = React18.useRef(true);
391
+ React18.useEffect(() => {
392
392
  isInitialRender.current = false;
393
393
  }, []);
394
394
  return isInitialRender.current;
@@ -422,7 +422,7 @@ function CSSTransitionComponent({
422
422
  const leaveClasses = leave.split(" ").filter((s) => s.length);
423
423
  const leaveFromClasses = leaveFrom.split(" ").filter((s) => s.length);
424
424
  const leaveToClasses = leaveTo.split(" ").filter((s) => s.length);
425
- const nodeRef = React16.useRef(null);
425
+ const nodeRef = React18.useRef(null);
426
426
  function addClasses(node, classes) {
427
427
  classes.length && node.classList.add(...classes);
428
428
  }
@@ -472,7 +472,7 @@ function CSSTransitionComponent({
472
472
  removeClasses(nodeRef.current, [...leaveToClasses, ...leaveClasses]);
473
473
  onExited(nodeRef.current);
474
474
  },
475
- children: React16__default.default.cloneElement(children, {
475
+ children: React18__default.default.cloneElement(children, {
476
476
  ref: (node) => {
477
477
  nodeRef.current = node;
478
478
  const childRef = children.ref;
@@ -487,7 +487,7 @@ function CSSTransitionComponent({
487
487
  );
488
488
  }
489
489
  function Transition({ show, appear, ...rest }) {
490
- const { parent } = React16.useContext(TransitionContext);
490
+ const { parent } = React18.useContext(TransitionContext);
491
491
  const isInitialRender = useIsInitialRender();
492
492
  const isChild = show === void 0;
493
493
  if (isChild) {
@@ -602,15 +602,15 @@ function Modal({
602
602
  fullscreen,
603
603
  opts
604
604
  }) {
605
- const { setModalShowing } = React16.useContext(ModalContext);
605
+ const { setModalShowing } = React18.useContext(ModalContext);
606
606
  const { darkMode, sidebarPosition = "right", mobileSidebarPosition = "bottom" } = opts || {};
607
607
  const isMobileSidebarTop = mobileSidebarPosition === "top" || mobileSidebarPosition === "above";
608
- const [mounted, setMounted] = React16.useState(false);
609
- React16.useEffect(() => {
608
+ const [mounted, setMounted] = React18.useState(false);
609
+ React18.useEffect(() => {
610
610
  setMounted(true);
611
611
  return () => setMounted(false);
612
612
  }, []);
613
- React16.useEffect(() => {
613
+ React18.useEffect(() => {
614
614
  if (typeof document === "undefined") return;
615
615
  const bodyEl = document.getElementsByTagName("BODY")[0];
616
616
  if (open) {
@@ -835,8 +835,8 @@ function Drawer({
835
835
  wrapperClassName,
836
836
  sectionClassName = ""
837
837
  }) {
838
- const { setDrawerShowing } = React16.useContext(ModalContext);
839
- React16.useEffect(() => {
838
+ const { setDrawerShowing } = React18.useContext(ModalContext);
839
+ React18.useEffect(() => {
840
840
  setDrawerShowing(open);
841
841
  }, [open]);
842
842
  function handleClose() {
@@ -957,9 +957,9 @@ function InlinePrompt({
957
957
  cancelText,
958
958
  opts
959
959
  }) {
960
- const [isOpen, setIsOpen] = React16.useState(false);
961
- const nodeTarget = React16.useRef(null);
962
- const nodeWindow = React16.useRef(null);
960
+ const [isOpen, setIsOpen] = React18.useState(false);
961
+ const nodeTarget = React18.useRef(null);
962
+ const nodeWindow = React18.useRef(null);
963
963
  const { condensed, blocked } = opts || {};
964
964
  function handleClickOutside(e) {
965
965
  if (nodeTarget.current?.contains(e.target) || nodeWindow.current?.contains(e.target)) {
@@ -979,7 +979,7 @@ function InlinePrompt({
979
979
  onConfirm();
980
980
  setIsOpen(false);
981
981
  }
982
- React16.useEffect(() => {
982
+ React18.useEffect(() => {
983
983
  if (isOpen) {
984
984
  document.addEventListener("mousedown", handleClickOutside);
985
985
  } else {
@@ -1058,6 +1058,268 @@ function InlinePrompt({
1058
1058
  )
1059
1059
  ] }) });
1060
1060
  }
1061
+ function DefaultLink({ href, className, children }) {
1062
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className, children });
1063
+ }
1064
+ function Breadcrumb({
1065
+ links,
1066
+ onBack,
1067
+ linkComponent: LinkComponent = DefaultLink
1068
+ }) {
1069
+ function clickBack(e) {
1070
+ e.preventDefault();
1071
+ if (onBack) {
1072
+ onBack();
1073
+ }
1074
+ }
1075
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pb-5 px-4 sm:px-6 lg:px-8", children: [
1076
+ onBack && /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsxs(
1077
+ "a",
1078
+ {
1079
+ onClick: clickBack,
1080
+ className: "flex items-center text-sm leading-5 font-medium text-gray-500 hover:text-gray-700 transition duration-150 ease-in-out cursor-pointer",
1081
+ children: [
1082
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "flex-shrink-0 -ml-1 mr-1 h-5 w-5 text-gray-400", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx(
1083
+ "path",
1084
+ {
1085
+ fillRule: "evenodd",
1086
+ d: "M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",
1087
+ clipRule: "evenodd"
1088
+ }
1089
+ ) }),
1090
+ "Back"
1091
+ ]
1092
+ }
1093
+ ) }),
1094
+ /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "hidden sm:flex items-center text-sm leading-5 font-medium", children: links && links.length > 0 && links.map((link, index) => /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex", children: [
1095
+ /* @__PURE__ */ jsxRuntime.jsx(LinkComponent, { href: link.href, className: "text-gray-500 hover:text-gray-700 transition duration-150 ease-in-out", children: link.name }),
1096
+ index !== links.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "flex-shrink-0 mx-2 h-5 w-5 text-gray-400", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx(
1097
+ "path",
1098
+ {
1099
+ fillRule: "evenodd",
1100
+ d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",
1101
+ clipRule: "evenodd"
1102
+ }
1103
+ ) })
1104
+ ] }, `breadcrumb-link-${index}-${link.name}`)) })
1105
+ ] }) });
1106
+ }
1107
+ function DefaultLink2({ href, className, children, onClick }) {
1108
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className, onClick, children });
1109
+ }
1110
+ function TabItemComponent({
1111
+ allowRedirect,
1112
+ item,
1113
+ label,
1114
+ isActive,
1115
+ onSelect,
1116
+ linkComponent: LinkComponent = DefaultLink2
1117
+ }) {
1118
+ function handleTabSelect() {
1119
+ onSelect(item);
1120
+ }
1121
+ if (!!allowRedirect && !!item.link) {
1122
+ return /* @__PURE__ */ jsxRuntime.jsx(
1123
+ LinkComponent,
1124
+ {
1125
+ href: item.link,
1126
+ className: classNames({
1127
+ "whitespace-no-wrap -mb-px cursor-pointer border-b-2 py-2 px-3 text-center text-sm font-medium leading-5 tracking-tight focus:outline-none sm:px-5 sm:text-base sm:tracking-normal": true,
1128
+ "border-primary-500 text-primary-500 focus:border-primary-500 focus:text-primary-500": isActive,
1129
+ "text-cool-gray-500 hover:text-cool-gray-700 focus:text-cool-gray-700 border-transparent hover:border-transparent focus:border-transparent": !isActive
1130
+ }),
1131
+ onClick: handleTabSelect,
1132
+ children: item[label]
1133
+ }
1134
+ );
1135
+ }
1136
+ return null;
1137
+ }
1138
+ function Tab({
1139
+ items,
1140
+ label,
1141
+ value,
1142
+ defaultValue,
1143
+ allowRedirect,
1144
+ onChange,
1145
+ rightContent,
1146
+ linkComponent
1147
+ }) {
1148
+ const [selected, setSelected] = React18.useState(defaultValue);
1149
+ React18.useEffect(() => {
1150
+ setSelected(value);
1151
+ }, [value]);
1152
+ function handleSelect(item) {
1153
+ if (typeof onChange === "function") {
1154
+ onChange(item);
1155
+ }
1156
+ setSelected(item && item.id || null);
1157
+ }
1158
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "no-scrollbar flex w-full items-stretch pb-1 sm:pb-2", children: [
1159
+ /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "border-cool-gray-200 -mb-px flex w-full items-end border-b", children: items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
1160
+ TabItemComponent,
1161
+ {
1162
+ item,
1163
+ label,
1164
+ isActive: selected === item.id,
1165
+ allowRedirect,
1166
+ onSelect: handleSelect,
1167
+ linkComponent
1168
+ },
1169
+ item.id
1170
+ )) }),
1171
+ rightContent && /* @__PURE__ */ jsxRuntime.jsx("nav", { className: "border-cool-gray-200 -mb-px flex flex flex-shrink-0 items-center border-b px-4", children: rightContent })
1172
+ ] });
1173
+ }
1174
+ function DefaultLink3({ href, children }) {
1175
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, children });
1176
+ }
1177
+ function ButtonItem({
1178
+ className,
1179
+ active,
1180
+ direction,
1181
+ iconPosition,
1182
+ button,
1183
+ onChange,
1184
+ onChangeGroup,
1185
+ currentPath,
1186
+ navLinks,
1187
+ linkComponent: LinkComponent = DefaultLink3
1188
+ }) {
1189
+ let currentButton = { ...button };
1190
+ if (active && navLinks && currentPath) {
1191
+ const navItem = navLinks.find((navLink) => navLink.url === currentPath);
1192
+ if (navItem) {
1193
+ currentButton.label = navItem.label;
1194
+ currentButton.image = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-5 h-5", children: navItem.icon });
1195
+ currentButton.icon = void 0;
1196
+ }
1197
+ }
1198
+ const buttonContent = /* @__PURE__ */ jsxRuntime.jsx(
1199
+ "div",
1200
+ {
1201
+ className: classNames({
1202
+ "p-3 rounded-xl mx-auto text-charcoal-700/70 dark:text-charcoal-50/50 flex justify-center cursor-pointer": true,
1203
+ "w-full": direction === "vertical",
1204
+ "w-full overflow-hidden": direction === "horizontal",
1205
+ "!text-charcoal-700 dark:!text-primary-500 bg-white/50 dark:bg-charcoal-800/90 dark:backdrop-filter dark:backdrop-blur-sm border border-white lg:border-transparent dark:border-charcoal-700 shadow-xs dark:shadow-none": active,
1206
+ ...classNameObject(className)
1207
+ }),
1208
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
1209
+ "div",
1210
+ {
1211
+ className: classNames({
1212
+ "flex items-center justify-center": true,
1213
+ "flex-col md:flex-row md:space-x-1.5": !!currentButton.image,
1214
+ "gap-2": !currentButton.image && !!currentButton.icon,
1215
+ "flex-row-reverse": !currentButton.image && iconPosition === "back",
1216
+ "flex-row": !currentButton.image && iconPosition !== "back"
1217
+ }),
1218
+ children: [
1219
+ currentButton.image && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative mb-0.5 md:mb-0", children: [
1220
+ typeof currentButton.image === "string" && /* @__PURE__ */ jsxRuntime.jsx(
1221
+ "img",
1222
+ {
1223
+ src: currentButton.image,
1224
+ alt: currentButton.label,
1225
+ className: "w-6 h-6 object-cover rounded-full pointer-events-none"
1226
+ }
1227
+ ),
1228
+ typeof currentButton.image === "object" && currentButton.image
1229
+ ] }),
1230
+ !currentButton.image && currentButton.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: currentButton.icon }),
1231
+ /* @__PURE__ */ jsxRuntime.jsx(
1232
+ "div",
1233
+ {
1234
+ className: classNames({
1235
+ "text-xs font-thin tracking-tight": true,
1236
+ "!font-normal": active
1237
+ }),
1238
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "line-clamp-1", children: currentButton.label })
1239
+ }
1240
+ )
1241
+ ]
1242
+ }
1243
+ )
1244
+ }
1245
+ );
1246
+ if (currentButton.subgroups) {
1247
+ return /* @__PURE__ */ jsxRuntime.jsx(
1248
+ "div",
1249
+ {
1250
+ onClick: () => onChangeGroup(button),
1251
+ children: buttonContent
1252
+ }
1253
+ );
1254
+ }
1255
+ if (currentButton.url) {
1256
+ return /* @__PURE__ */ jsxRuntime.jsx(LinkComponent, { href: currentButton.url, children: buttonContent });
1257
+ }
1258
+ return /* @__PURE__ */ jsxRuntime.jsx(
1259
+ "div",
1260
+ {
1261
+ onClick: () => onChange && onChange(button.id),
1262
+ children: buttonContent
1263
+ }
1264
+ );
1265
+ }
1266
+ function ButtonGroup({
1267
+ buttons = [],
1268
+ direction = "horizontal",
1269
+ iconPosition = "front",
1270
+ activeId,
1271
+ onChange,
1272
+ className,
1273
+ itemClassName,
1274
+ currentPath,
1275
+ navLinks,
1276
+ linkComponent,
1277
+ subgroupModal
1278
+ }) {
1279
+ const [selectedGroup, setSelectedGroup] = React18.useState(null);
1280
+ function handleCloseModal() {
1281
+ setSelectedGroup(null);
1282
+ }
1283
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1284
+ "div",
1285
+ {
1286
+ className: classNames({
1287
+ "gap-2 scrollbar-hide": true,
1288
+ "w-full": direction === "vertical",
1289
+ "grid grid-cols-5 w-full items-center": direction === "horizontal",
1290
+ ...classNameObject(className)
1291
+ }),
1292
+ children: [
1293
+ buttons.map((button) => {
1294
+ const isActive = activeId === button.id;
1295
+ return /* @__PURE__ */ jsxRuntime.jsx(
1296
+ ButtonItem,
1297
+ {
1298
+ className: itemClassName,
1299
+ button,
1300
+ direction,
1301
+ iconPosition,
1302
+ onChange,
1303
+ onChangeGroup: (group) => setSelectedGroup(group),
1304
+ active: isActive,
1305
+ currentPath,
1306
+ navLinks,
1307
+ linkComponent
1308
+ },
1309
+ button.id
1310
+ );
1311
+ }),
1312
+ subgroupModal && subgroupModal({
1313
+ open: !!selectedGroup,
1314
+ label: selectedGroup?.label,
1315
+ items: selectedGroup?.subgroups,
1316
+ onClose: handleCloseModal,
1317
+ onChange
1318
+ })
1319
+ ]
1320
+ }
1321
+ );
1322
+ }
1061
1323
  function H1({ className, children }) {
1062
1324
  return /* @__PURE__ */ jsxRuntime.jsx(
1063
1325
  "h1",
@@ -1199,7 +1461,7 @@ function Td({ className, align, colSpan, condensed, narrow, children }) {
1199
1461
  }
1200
1462
  );
1201
1463
  }
1202
- var Input = React16.forwardRef((props, ref) => {
1464
+ var Input = React18.forwardRef((props, ref) => {
1203
1465
  const {
1204
1466
  id,
1205
1467
  theme,
@@ -1235,11 +1497,11 @@ var Input = React16.forwardRef((props, ref) => {
1235
1497
  hideIndicator,
1236
1498
  darkMode
1237
1499
  } = props;
1238
- const [focused, setFocused] = React16.useState(false);
1239
- const inputRef = React16.useRef(null);
1500
+ const [focused, setFocused] = React18.useState(false);
1501
+ const inputRef = React18.useRef(null);
1240
1502
  const hasPrefix = !!prefix && prefix.length > 0;
1241
- React16.useImperativeHandle(ref, () => inputRef.current);
1242
- React16.useEffect(() => {
1503
+ React18.useImperativeHandle(ref, () => inputRef.current);
1504
+ React18.useEffect(() => {
1243
1505
  if (listening && inputRef.current && defaultValue !== null && defaultValue !== void 0) {
1244
1506
  if (hasPrefix) {
1245
1507
  inputRef.current.value = prefix + String(defaultValue);
@@ -1417,7 +1679,7 @@ function Label({
1417
1679
  )
1418
1680
  ] });
1419
1681
  }
1420
- var Select = React16.forwardRef((props, ref) => {
1682
+ var Select = React18.forwardRef((props, ref) => {
1421
1683
  const {
1422
1684
  id,
1423
1685
  loading = false,
@@ -1457,7 +1719,7 @@ var Select = React16.forwardRef((props, ref) => {
1457
1719
  });
1458
1720
  Select.displayName = "Select";
1459
1721
  var Select_default = Select;
1460
- var SelectInput = React16.forwardRef((props, ref) => {
1722
+ var SelectInput = React18.forwardRef((props, ref) => {
1461
1723
  const {
1462
1724
  className,
1463
1725
  placeholder = "Select an option",
@@ -1494,7 +1756,7 @@ var SelectInput = React16.forwardRef((props, ref) => {
1494
1756
  });
1495
1757
  SelectInput.displayName = "SelectInput";
1496
1758
  var SelectInput_default = SelectInput;
1497
- var Textarea = React16.forwardRef((props, ref) => {
1759
+ var Textarea = React18.forwardRef((props, ref) => {
1498
1760
  const {
1499
1761
  id,
1500
1762
  className,
@@ -1559,8 +1821,8 @@ function TagInput({
1559
1821
  onChange,
1560
1822
  placeholder
1561
1823
  }) {
1562
- const [currentState, setCurrentState] = React16.useState(0);
1563
- const tagInputRef = React16.useRef(null);
1824
+ const [currentState, setCurrentState] = React18.useState(0);
1825
+ const tagInputRef = React18.useRef(null);
1564
1826
  function reducer2(state, action) {
1565
1827
  const updatedValues = { ...state };
1566
1828
  if ("tags" in action) {
@@ -1574,11 +1836,11 @@ function TagInput({
1574
1836
  }
1575
1837
  return updatedValues;
1576
1838
  }
1577
- const [values, dispatch] = React16.useReducer(reducer2, {
1839
+ const [values, dispatch] = React18.useReducer(reducer2, {
1578
1840
  tags: []
1579
1841
  });
1580
1842
  const { tags } = values;
1581
- React16.useEffect(() => {
1843
+ React18.useEffect(() => {
1582
1844
  if (defaultValue) {
1583
1845
  dispatch({ tags: defaultValue, render: true });
1584
1846
  } else {
@@ -1665,7 +1927,7 @@ function NoData({ className }) {
1665
1927
  ] })
1666
1928
  ] });
1667
1929
  }
1668
- var ThemeContext = React16.createContext(void 0);
1930
+ var ThemeContext = React18.createContext(void 0);
1669
1931
  var currentIsDark = false;
1670
1932
  var matchMediaListeners = /* @__PURE__ */ new Set();
1671
1933
  var originalMatchMedia = null;
@@ -1721,15 +1983,15 @@ if (typeof window !== "undefined") {
1721
1983
  };
1722
1984
  }
1723
1985
  function ThemeProvider({ children, defaultTheme = "system" }) {
1724
- const [mode, setMode] = React16.useState(defaultTheme);
1725
- const [isDark, setIsDark] = React16.useState(false);
1726
- const [mounted, setMounted] = React16.useState(false);
1727
- React16.useEffect(() => {
1986
+ const [mode, setMode] = React18.useState(defaultTheme);
1987
+ const [isDark, setIsDark] = React18.useState(false);
1988
+ const [mounted, setMounted] = React18.useState(false);
1989
+ React18.useEffect(() => {
1728
1990
  const saved = localStorage.getItem("theme") || defaultTheme;
1729
1991
  setMode(saved);
1730
1992
  setMounted(true);
1731
1993
  }, [defaultTheme]);
1732
- React16.useEffect(() => {
1994
+ React18.useEffect(() => {
1733
1995
  if (!mounted) return;
1734
1996
  const media = originalMatchMedia ? originalMatchMedia.call(window, "(prefers-color-scheme: dark)") : null;
1735
1997
  const updateTheme = () => {
@@ -1796,7 +2058,7 @@ function ThemeProvider({ children, defaultTheme = "system" }) {
1796
2058
  );
1797
2059
  }
1798
2060
  function useThemeContext() {
1799
- const context = React16.useContext(ThemeContext);
2061
+ const context = React18.useContext(ThemeContext);
1800
2062
  if (!context) {
1801
2063
  throw new Error("useThemeContext must be used within a ThemeProvider");
1802
2064
  }
@@ -1843,13 +2105,13 @@ function debounce(fn, delay) {
1843
2105
 
1844
2106
  // src/hooks/useDebounce.ts
1845
2107
  function useDebounce(callback, delay, deps = []) {
1846
- const callbackFn = React16.useCallback(debounce(callback, delay), deps);
2108
+ const callbackFn = React18.useCallback(debounce(callback, delay), deps);
1847
2109
  return [callbackFn];
1848
2110
  }
1849
2111
 
1850
2112
  // src/hooks/useResizeListener.ts
1851
2113
  function useResizeListener(props = {}) {
1852
- const [values, setValues] = React16.useState(
2114
+ const [values, setValues] = React18.useState(
1853
2115
  [
1854
2116
  typeof window === "undefined" ? props.mobileAgent ? 375 : 1080 : window.innerWidth,
1855
2117
  typeof window === "undefined" ? props.mobileAgent ? 812 : 750 : window.innerHeight,
@@ -1871,7 +2133,7 @@ function useResizeListener(props = {}) {
1871
2133
  ]);
1872
2134
  }
1873
2135
  const [debouncedSetValue] = useDebounce(handleChangeViewport, 300);
1874
- React16.useEffect(() => {
2136
+ React18.useEffect(() => {
1875
2137
  window.addEventListener("resize", debouncedSetValue);
1876
2138
  return () => {
1877
2139
  window.removeEventListener("resize", debouncedSetValue);
@@ -1879,7 +2141,7 @@ function useResizeListener(props = {}) {
1879
2141
  }, [debouncedSetValue]);
1880
2142
  return { screenWidth, screenHeight, viewport, viewMode, mobileView, tabletView };
1881
2143
  }
1882
- var PopoverContext = React16.createContext(void 0);
2144
+ var PopoverContext = React18.createContext(void 0);
1883
2145
  function PopoverCard({
1884
2146
  show,
1885
2147
  style,
@@ -2059,15 +2321,15 @@ function reducer(state, action) {
2059
2321
  return updatedValues;
2060
2322
  }
2061
2323
  function PopoverProvider({ children }) {
2062
- const [values, dispatch] = React16.useReducer(reducer, resetValues);
2324
+ const [values, dispatch] = React18.useReducer(reducer, resetValues);
2063
2325
  const { show, style, tooltipStyle, position, description, actions } = values;
2064
- const handleShowPopover = React16.useCallback((params) => {
2326
+ const handleShowPopover = React18.useCallback((params) => {
2065
2327
  dispatch(params);
2066
2328
  }, []);
2067
- const handleClosePopover = React16.useCallback(() => {
2329
+ const handleClosePopover = React18.useCallback(() => {
2068
2330
  dispatch(resetValues);
2069
2331
  }, []);
2070
- const contextValue = React16.useMemo(() => ({
2332
+ const contextValue = React18.useMemo(() => ({
2071
2333
  showPopover: show,
2072
2334
  setPopover: handleShowPopover
2073
2335
  }), [show, handleShowPopover]);
@@ -2088,7 +2350,7 @@ function PopoverProvider({ children }) {
2088
2350
  ] });
2089
2351
  }
2090
2352
  function usePopoverContext() {
2091
- const context = React16.useContext(PopoverContext);
2353
+ const context = React18.useContext(PopoverContext);
2092
2354
  if (!context) {
2093
2355
  throw new Error("usePopoverContext must be used within a PopoverProvider");
2094
2356
  }
@@ -2098,12 +2360,12 @@ function Popover({ className, description, actions, children, opts }) {
2098
2360
  const { activated } = opts || {};
2099
2361
  const { showPopover, setPopover } = usePopoverContext();
2100
2362
  const { screenWidth, screenHeight } = useResizeListener();
2101
- const [menuData, setMenuData] = React16.useState({ showMenu: false, x: 0, y: 0, left: 0, right: 0, top: 0, bottom: 0 });
2102
- const parentRef = React16.useRef(null);
2103
- const prevShowMenuRef = React16.useRef(false);
2104
- const prevShowPopoverRef = React16.useRef(false);
2363
+ const [menuData, setMenuData] = React18.useState({ showMenu: false, x: 0, y: 0, left: 0, right: 0, top: 0, bottom: 0 });
2364
+ const parentRef = React18.useRef(null);
2365
+ const prevShowMenuRef = React18.useRef(false);
2366
+ const prevShowPopoverRef = React18.useRef(false);
2105
2367
  (actions || []).some((action) => (action.items || []).length > 0);
2106
- React16.useEffect(() => {
2368
+ React18.useEffect(() => {
2107
2369
  const wasOpen = prevShowMenuRef.current;
2108
2370
  prevShowMenuRef.current = menuData.showMenu;
2109
2371
  if (!menuData.showMenu && !wasOpen) {
@@ -2131,7 +2393,7 @@ function Popover({ className, description, actions, children, opts }) {
2131
2393
  actions
2132
2394
  });
2133
2395
  }, [menuData, screenWidth, screenHeight, description, actions, setPopover]);
2134
- React16.useEffect(() => {
2396
+ React18.useEffect(() => {
2135
2397
  if (prevShowPopoverRef.current && !showPopover) {
2136
2398
  setMenuData((prev) => ({
2137
2399
  ...prev,
@@ -2261,8 +2523,8 @@ function Dragger({
2261
2523
  children,
2262
2524
  onChange
2263
2525
  }) {
2264
- const [, setCurrentState] = React16.useState(0);
2265
- const [values, dispatch] = React16.useReducer(reducer2, {
2526
+ const [, setCurrentState] = React18.useState(0);
2527
+ const [values, dispatch] = React18.useReducer(reducer2, {
2266
2528
  items: null,
2267
2529
  displayItems: null,
2268
2530
  dragging: false,
@@ -2275,14 +2537,14 @@ function Dragger({
2275
2537
  const { items, displayItems, dragging, dragItem, dragFrom, dragTo, updated } = values || {};
2276
2538
  const grandChildren = children && children.props.children;
2277
2539
  const isValid = !disabled && !!records && !!children && !!grandChildren && grandChildren.length > 0;
2278
- React16.useEffect(() => {
2540
+ React18.useEffect(() => {
2279
2541
  dispatch({
2280
2542
  items: grandChildren,
2281
2543
  updated: false,
2282
2544
  render: true
2283
2545
  });
2284
2546
  }, [timestamp, grandChildren]);
2285
- React16.useEffect(() => {
2547
+ React18.useEffect(() => {
2286
2548
  if (!updated) {
2287
2549
  if (grandChildren && grandChildren.length > 0) {
2288
2550
  dispatch({
@@ -2522,9 +2784,9 @@ function Dragger({
2522
2784
  }
2523
2785
  dispatch({ dragging: false });
2524
2786
  }
2525
- const derivedItems = !!items && React16__default.default.cloneElement(children, {
2787
+ const derivedItems = !!items && React18__default.default.cloneElement(children, {
2526
2788
  children: items.map((grandChild, index) => {
2527
- return React16__default.default.cloneElement(grandChild, {
2789
+ return React18__default.default.cloneElement(grandChild, {
2528
2790
  id: (records[index] || {}).id,
2529
2791
  draggable: true,
2530
2792
  className: classNames({
@@ -2541,9 +2803,9 @@ function Dragger({
2541
2803
  });
2542
2804
  })
2543
2805
  });
2544
- const derivedDisplayItems = !!displayItems && React16__default.default.cloneElement(children, {
2806
+ const derivedDisplayItems = !!displayItems && React18__default.default.cloneElement(children, {
2545
2807
  children: displayItems.map((grandChild, index) => {
2546
- return React16__default.default.cloneElement(grandChild, {
2808
+ return React18__default.default.cloneElement(grandChild, {
2547
2809
  draggable: true,
2548
2810
  className: classNames({
2549
2811
  ...classNameObject(grandChild.props.className),
@@ -2601,8 +2863,8 @@ function ExcelTable({
2601
2863
  isAddRowVisible = true,
2602
2864
  addRowLabel = "+ Add Option"
2603
2865
  }) {
2604
- const [editingCell, setEditingCell] = React16.useState(null);
2605
- React16.useEffect(() => {
2866
+ const [editingCell, setEditingCell] = React18.useState(null);
2867
+ React18.useEffect(() => {
2606
2868
  setTimeout(() => {
2607
2869
  const textareas = document.querySelectorAll(".excel-table-textarea");
2608
2870
  textareas.forEach((ta) => {
@@ -2826,21 +3088,21 @@ function ExcelTable({
2826
3088
  ] }) });
2827
3089
  }
2828
3090
  function Coverflow({ images = [], onClose }) {
2829
- const scrollContainerRef = React16.useRef(null);
2830
- const thumbnailContainerRef = React16.useRef(null);
2831
- const [visualIndex, setVisualIndex] = React16.useState(0);
2832
- const isJumpingRef = React16.useRef(false);
2833
- const wheelLockRef = React16.useRef(false);
2834
- const wheelTimeoutRef = React16.useRef(null);
2835
- const [isReady, setIsReady] = React16.useState(false);
2836
- const [isMounted, setIsMounted] = React16.useState(false);
2837
- React16.useEffect(() => {
3091
+ const scrollContainerRef = React18.useRef(null);
3092
+ const thumbnailContainerRef = React18.useRef(null);
3093
+ const [visualIndex, setVisualIndex] = React18.useState(0);
3094
+ const isJumpingRef = React18.useRef(false);
3095
+ const wheelLockRef = React18.useRef(false);
3096
+ const wheelTimeoutRef = React18.useRef(null);
3097
+ const [isReady, setIsReady] = React18.useState(false);
3098
+ const [isMounted, setIsMounted] = React18.useState(false);
3099
+ React18.useEffect(() => {
2838
3100
  setIsMounted(true);
2839
3101
  }, []);
2840
3102
  const count = images.length;
2841
3103
  const hasMultiple = count > 1;
2842
3104
  const extendedImages = hasMultiple ? [images[count - 1], ...images, images[0]] : images;
2843
- React16.useEffect(() => {
3105
+ React18.useEffect(() => {
2844
3106
  if (hasMultiple && scrollContainerRef.current) {
2845
3107
  const container = scrollContainerRef.current;
2846
3108
  const width = container.offsetWidth;
@@ -2851,7 +3113,7 @@ function Coverflow({ images = [], onClose }) {
2851
3113
  setIsReady(true);
2852
3114
  }
2853
3115
  }, [hasMultiple]);
2854
- React16.useEffect(() => {
3116
+ React18.useEffect(() => {
2855
3117
  if (hasMultiple && thumbnailContainerRef.current) {
2856
3118
  const thumbContainer = thumbnailContainerRef.current;
2857
3119
  const thumbNode = thumbContainer.children[visualIndex];
@@ -2864,7 +3126,7 @@ function Coverflow({ images = [], onClose }) {
2864
3126
  }
2865
3127
  }
2866
3128
  }, [visualIndex, hasMultiple]);
2867
- React16.useEffect(() => {
3129
+ React18.useEffect(() => {
2868
3130
  const container = scrollContainerRef.current;
2869
3131
  if (!container || !hasMultiple) return;
2870
3132
  const handleWheel = (e) => {
@@ -2968,7 +3230,7 @@ function Coverflow({ images = [], onClose }) {
2968
3230
  behavior: "smooth"
2969
3231
  });
2970
3232
  };
2971
- React16.useEffect(() => {
3233
+ React18.useEffect(() => {
2972
3234
  const handleKeyDown = (e) => {
2973
3235
  if (e.key === "Escape") onClose && onClose();
2974
3236
  if (e.key === "ArrowLeft") prevSlide();
@@ -3142,7 +3404,7 @@ function DataTableRow({ index, selected, label, description, additionalDescripti
3142
3404
  "!text-left": dataItem.align === "left",
3143
3405
  "align-middle": vertical === "middle"
3144
3406
  }),
3145
- children: typeof dataItem.data[index] === "string" || React16__default.default.isValidElement(dataItem.data[index]) ? dataItem.data[index] : numberFormatter(dataItem.data[index], dataItem.decimal != null ? dataItem.decimal : 1)
3407
+ children: typeof dataItem.data[index] === "string" || React18__default.default.isValidElement(dataItem.data[index]) ? dataItem.data[index] : numberFormatter(dataItem.data[index], dataItem.decimal != null ? dataItem.decimal : 1)
3146
3408
  },
3147
3409
  `${dataIndex}-${index}`
3148
3410
  ))
@@ -3163,8 +3425,8 @@ function DataTable({
3163
3425
  }) {
3164
3426
  const { mobileView } = useResizeListener();
3165
3427
  const { ignoreTotal, showCurrency, labelTitle, labelCentered, vertical, darkMode } = opts || {};
3166
- const [displayHeaders, setDisplayHeaders] = React16.useState([]);
3167
- React16.useEffect(() => {
3428
+ const [displayHeaders, setDisplayHeaders] = React18.useState([]);
3429
+ React18.useEffect(() => {
3168
3430
  setDisplayHeaders(headers);
3169
3431
  }, [headers]);
3170
3432
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3279,7 +3541,7 @@ function DataTable({
3279
3541
  backgroundColor: `${colors[dataIndex]}`,
3280
3542
  color: bestTextColorForBg(colors[dataIndex])
3281
3543
  } : void 0,
3282
- children: typeof total[dataIndex] === "string" || React16__default.default.isValidElement(total[dataIndex]) ? total[dataIndex] : showCurrency ? /* @__PURE__ */ jsxRuntime.jsx(CurrencyDisplay, { amount: total[dataIndex] }) : numberFormatter(total[dataIndex], 1)
3544
+ children: typeof total[dataIndex] === "string" || React18__default.default.isValidElement(total[dataIndex]) ? total[dataIndex] : showCurrency ? /* @__PURE__ */ jsxRuntime.jsx(CurrencyDisplay, { amount: total[dataIndex] }) : numberFormatter(total[dataIndex], 1)
3283
3545
  },
3284
3546
  `${dataIndex}-total`
3285
3547
  ))
@@ -3461,8 +3723,8 @@ function DataGridHeader({ sort, onClick, opts, children }) {
3461
3723
  );
3462
3724
  }
3463
3725
  function DataGridElement({ processing: defaultProcessing, type, value, error, menu, params, opts, onSelect }) {
3464
- const [processing, setProcessing] = React16.useState(defaultProcessing);
3465
- React16.useEffect(() => {
3726
+ const [processing, setProcessing] = React18.useState(defaultProcessing);
3727
+ React18.useEffect(() => {
3466
3728
  setProcessing(defaultProcessing);
3467
3729
  }, [defaultProcessing]);
3468
3730
  const { align } = opts || {};
@@ -3554,8 +3816,8 @@ function DataGridContent({ loading, error, type, value, opts, onClick }) {
3554
3816
  );
3555
3817
  }
3556
3818
  function DataGrid({ headers, data, selectedId, footers, opts, onSelect }) {
3557
- const [displayedData, setDisplayedData] = React16.useState([]);
3558
- const [orderByState, setOrderByState] = React16.useState({
3819
+ const [displayedData, setDisplayedData] = React18.useState([]);
3820
+ const [orderByState, setOrderByState] = React18.useState({
3559
3821
  category: headers[0]?.id || "",
3560
3822
  direction: "asc"
3561
3823
  });
@@ -3567,7 +3829,7 @@ function DataGrid({ headers, data, selectedId, footers, opts, onSelect }) {
3567
3829
  setOrderByState({ category, direction: orderByState.direction === "asc" ? "desc" : "asc" });
3568
3830
  }
3569
3831
  }
3570
- React16.useEffect(() => {
3832
+ React18.useEffect(() => {
3571
3833
  if ((data || []).length > 0) {
3572
3834
  const availableKeys = (headers || []).map((header) => header.id);
3573
3835
  const { category, direction } = orderByState;
@@ -3692,7 +3954,9 @@ function DataGrid({ headers, data, selectedId, footers, opts, onSelect }) {
3692
3954
  }
3693
3955
 
3694
3956
  exports.B = B;
3957
+ exports.Breadcrumb = Breadcrumb;
3695
3958
  exports.Button = Button;
3959
+ exports.ButtonGroup = ButtonGroup;
3696
3960
  exports.CheckboxList = CheckboxList;
3697
3961
  exports.ConfirmationBox = ConfirmationBox;
3698
3962
  exports.Coverflow = Coverflow;
@@ -3718,6 +3982,7 @@ exports.PopoverProvider = PopoverProvider;
3718
3982
  exports.Select = Select_default;
3719
3983
  exports.SelectInput = SelectInput_default;
3720
3984
  exports.SortIcon = SortIcon;
3985
+ exports.Tab = Tab;
3721
3986
  exports.Table = Table;
3722
3987
  exports.Tabs = Tabs;
3723
3988
  exports.Tag = Tag;