@woobee/ui 0.2.2 → 0.2.4

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