@woobee/ui 0.2.1 → 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/README.md +99 -0
- package/SKIPPED.md +0 -8
- package/dist/index.d.mts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +501 -160
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +423 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
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
|
|
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 =
|
|
185
|
+
var Toggle = React18.forwardRef(
|
|
186
186
|
({ listening, size, name, value, onChange, className }, ref) => {
|
|
187
|
-
const internalRef =
|
|
187
|
+
const internalRef = React18.useRef(null);
|
|
188
188
|
const spanRef = ref || internalRef;
|
|
189
|
-
|
|
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 =
|
|
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 =
|
|
332
|
+
var ModalContext = React18.createContext({
|
|
333
333
|
modalShowing: false,
|
|
334
334
|
drawerShowing: false,
|
|
335
335
|
setModalShowing: () => {
|
|
@@ -338,11 +338,11 @@ var ModalContext = React16.createContext({
|
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
function useModalContext() {
|
|
341
|
-
return
|
|
341
|
+
return React18.useContext(ModalContext);
|
|
342
342
|
}
|
|
343
343
|
function ModalProvider({ children }) {
|
|
344
|
-
const [currentState, setCurrentState] =
|
|
345
|
-
function
|
|
344
|
+
const [currentState, setCurrentState] = React18.useState(0);
|
|
345
|
+
function reducer2(state, action) {
|
|
346
346
|
const updatedValues = { ...state };
|
|
347
347
|
if ("modalShowing" in action) {
|
|
348
348
|
updatedValues.modalShowing = action.modalShowing;
|
|
@@ -355,12 +355,12 @@ function ModalProvider({ children }) {
|
|
|
355
355
|
}
|
|
356
356
|
return updatedValues;
|
|
357
357
|
}
|
|
358
|
-
const [values, dispatch] =
|
|
358
|
+
const [values, dispatch] = React18.useReducer(reducer2, {
|
|
359
359
|
modalShowing: false,
|
|
360
360
|
drawerShowing: false
|
|
361
361
|
});
|
|
362
362
|
const { modalShowing, drawerShowing } = values;
|
|
363
|
-
|
|
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 =
|
|
386
|
+
var TransitionContext = React18.createContext({
|
|
387
387
|
parent: {}
|
|
388
388
|
});
|
|
389
389
|
function useIsInitialRender() {
|
|
390
|
-
const isInitialRender =
|
|
391
|
-
|
|
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 =
|
|
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:
|
|
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 } =
|
|
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 } =
|
|
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] =
|
|
609
|
-
|
|
608
|
+
const [mounted, setMounted] = React18.useState(false);
|
|
609
|
+
React18.useEffect(() => {
|
|
610
610
|
setMounted(true);
|
|
611
611
|
return () => setMounted(false);
|
|
612
612
|
}, []);
|
|
613
|
-
|
|
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 } =
|
|
839
|
-
|
|
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] =
|
|
961
|
-
const nodeTarget =
|
|
962
|
-
const nodeWindow =
|
|
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
|
-
|
|
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 =
|
|
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] =
|
|
1239
|
-
const inputRef =
|
|
1500
|
+
const [focused, setFocused] = React18.useState(false);
|
|
1501
|
+
const inputRef = React18.useRef(null);
|
|
1240
1502
|
const hasPrefix = !!prefix && prefix.length > 0;
|
|
1241
|
-
|
|
1242
|
-
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1759
|
+
var Textarea = React18.forwardRef((props, ref) => {
|
|
1498
1760
|
const {
|
|
1499
1761
|
id,
|
|
1500
1762
|
className,
|
|
@@ -1559,9 +1821,9 @@ function TagInput({
|
|
|
1559
1821
|
onChange,
|
|
1560
1822
|
placeholder
|
|
1561
1823
|
}) {
|
|
1562
|
-
const [currentState, setCurrentState] =
|
|
1563
|
-
const tagInputRef =
|
|
1564
|
-
function
|
|
1824
|
+
const [currentState, setCurrentState] = React18.useState(0);
|
|
1825
|
+
const tagInputRef = React18.useRef(null);
|
|
1826
|
+
function reducer2(state, action) {
|
|
1565
1827
|
const updatedValues = { ...state };
|
|
1566
1828
|
if ("tags" in action) {
|
|
1567
1829
|
updatedValues.tags = Array.from(new Set(action.tags));
|
|
@@ -1574,11 +1836,11 @@ function TagInput({
|
|
|
1574
1836
|
}
|
|
1575
1837
|
return updatedValues;
|
|
1576
1838
|
}
|
|
1577
|
-
const [values, dispatch] =
|
|
1839
|
+
const [values, dispatch] = React18.useReducer(reducer2, {
|
|
1578
1840
|
tags: []
|
|
1579
1841
|
});
|
|
1580
1842
|
const { tags } = values;
|
|
1581
|
-
|
|
1843
|
+
React18.useEffect(() => {
|
|
1582
1844
|
if (defaultValue) {
|
|
1583
1845
|
dispatch({ tags: defaultValue, render: true });
|
|
1584
1846
|
} else {
|
|
@@ -1665,39 +1927,113 @@ function NoData({ className }) {
|
|
|
1665
1927
|
] })
|
|
1666
1928
|
] });
|
|
1667
1929
|
}
|
|
1668
|
-
var ThemeContext =
|
|
1930
|
+
var ThemeContext = React18.createContext(void 0);
|
|
1931
|
+
var currentIsDark = false;
|
|
1932
|
+
var matchMediaListeners = /* @__PURE__ */ new Set();
|
|
1933
|
+
var originalMatchMedia = null;
|
|
1934
|
+
if (typeof window !== "undefined") {
|
|
1935
|
+
originalMatchMedia = window.matchMedia;
|
|
1936
|
+
try {
|
|
1937
|
+
const saved = localStorage.getItem("theme");
|
|
1938
|
+
const prefersDark = originalMatchMedia.call(window, "(prefers-color-scheme: dark)").matches;
|
|
1939
|
+
const isSystemOrNone = !saved || saved === "system";
|
|
1940
|
+
currentIsDark = saved === "dark" || isSystemOrNone && prefersDark;
|
|
1941
|
+
} catch (e) {
|
|
1942
|
+
}
|
|
1943
|
+
window.matchMedia = function(query) {
|
|
1944
|
+
const normalized = query.replace(/\s+/g, "").toLowerCase();
|
|
1945
|
+
const isDarkQuery = normalized.includes("prefers-color-scheme:dark");
|
|
1946
|
+
const isLightQuery = normalized.includes("prefers-color-scheme:light");
|
|
1947
|
+
if (isDarkQuery || isLightQuery) {
|
|
1948
|
+
const matches = isDarkQuery ? currentIsDark : !currentIsDark;
|
|
1949
|
+
return {
|
|
1950
|
+
matches,
|
|
1951
|
+
media: query,
|
|
1952
|
+
onchange: null,
|
|
1953
|
+
addListener(listener) {
|
|
1954
|
+
matchMediaListeners.add({ listener, query });
|
|
1955
|
+
},
|
|
1956
|
+
removeListener(listener) {
|
|
1957
|
+
for (const item of matchMediaListeners) {
|
|
1958
|
+
if (item.listener === listener) {
|
|
1959
|
+
matchMediaListeners.delete(item);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
},
|
|
1963
|
+
addEventListener(type, listener) {
|
|
1964
|
+
if (type === "change") {
|
|
1965
|
+
matchMediaListeners.add({ listener, query });
|
|
1966
|
+
}
|
|
1967
|
+
},
|
|
1968
|
+
removeEventListener(type, listener) {
|
|
1969
|
+
if (type === "change") {
|
|
1970
|
+
for (const item of matchMediaListeners) {
|
|
1971
|
+
if (item.listener === listener) {
|
|
1972
|
+
matchMediaListeners.delete(item);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
},
|
|
1977
|
+
dispatchEvent(event) {
|
|
1978
|
+
return true;
|
|
1979
|
+
}
|
|
1980
|
+
};
|
|
1981
|
+
}
|
|
1982
|
+
return originalMatchMedia.call(window, query);
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1669
1985
|
function ThemeProvider({ children, defaultTheme = "system" }) {
|
|
1670
|
-
const [mode, setMode] =
|
|
1671
|
-
const [isDark, setIsDark] =
|
|
1672
|
-
const [mounted, setMounted] =
|
|
1673
|
-
|
|
1986
|
+
const [mode, setMode] = React18.useState(defaultTheme);
|
|
1987
|
+
const [isDark, setIsDark] = React18.useState(false);
|
|
1988
|
+
const [mounted, setMounted] = React18.useState(false);
|
|
1989
|
+
React18.useEffect(() => {
|
|
1674
1990
|
const saved = localStorage.getItem("theme") || defaultTheme;
|
|
1675
1991
|
setMode(saved);
|
|
1676
1992
|
setMounted(true);
|
|
1677
1993
|
}, [defaultTheme]);
|
|
1678
|
-
|
|
1994
|
+
React18.useEffect(() => {
|
|
1679
1995
|
if (!mounted) return;
|
|
1680
|
-
const media =
|
|
1996
|
+
const media = originalMatchMedia ? originalMatchMedia.call(window, "(prefers-color-scheme: dark)") : null;
|
|
1681
1997
|
const updateTheme = () => {
|
|
1682
|
-
const prefersDark = media.matches;
|
|
1683
|
-
const
|
|
1684
|
-
if (
|
|
1998
|
+
const prefersDark = media ? media.matches : false;
|
|
1999
|
+
const currentIsDarkVal = mode === "dark" || mode === "system" && prefersDark;
|
|
2000
|
+
if (currentIsDarkVal) {
|
|
1685
2001
|
document.documentElement.classList.add("dark");
|
|
1686
2002
|
document.documentElement.classList.remove("light");
|
|
1687
2003
|
} else {
|
|
1688
2004
|
document.documentElement.classList.remove("dark");
|
|
1689
2005
|
document.documentElement.classList.add("light");
|
|
1690
2006
|
}
|
|
1691
|
-
|
|
2007
|
+
currentIsDark = currentIsDarkVal;
|
|
2008
|
+
setIsDark(currentIsDarkVal);
|
|
2009
|
+
matchMediaListeners.forEach(({ listener, query }) => {
|
|
2010
|
+
try {
|
|
2011
|
+
const normalized = query.replace(/\s+/g, "").toLowerCase();
|
|
2012
|
+
const isDarkQuery = normalized.includes("prefers-color-scheme:dark");
|
|
2013
|
+
const matches = isDarkQuery ? currentIsDarkVal : !currentIsDarkVal;
|
|
2014
|
+
const event = { matches, media: query };
|
|
2015
|
+
if (typeof listener === "function") {
|
|
2016
|
+
listener(event);
|
|
2017
|
+
} else if (listener && typeof listener.handleEvent === "function") {
|
|
2018
|
+
listener.handleEvent(event);
|
|
2019
|
+
}
|
|
2020
|
+
} catch (e) {
|
|
2021
|
+
console.error(e);
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
1692
2024
|
};
|
|
1693
2025
|
const timeoutId = setTimeout(updateTheme, 0);
|
|
1694
2026
|
const handleMediaChange = () => {
|
|
1695
2027
|
updateTheme();
|
|
1696
2028
|
};
|
|
1697
|
-
media
|
|
2029
|
+
if (media) {
|
|
2030
|
+
media.addEventListener("change", handleMediaChange);
|
|
2031
|
+
}
|
|
1698
2032
|
return () => {
|
|
1699
2033
|
clearTimeout(timeoutId);
|
|
1700
|
-
media
|
|
2034
|
+
if (media) {
|
|
2035
|
+
media.removeEventListener("change", handleMediaChange);
|
|
2036
|
+
}
|
|
1701
2037
|
};
|
|
1702
2038
|
}, [mode, mounted]);
|
|
1703
2039
|
function handleToggleTheme(triggerMode) {
|
|
@@ -1722,7 +2058,7 @@ function ThemeProvider({ children, defaultTheme = "system" }) {
|
|
|
1722
2058
|
);
|
|
1723
2059
|
}
|
|
1724
2060
|
function useThemeContext() {
|
|
1725
|
-
const context =
|
|
2061
|
+
const context = React18.useContext(ThemeContext);
|
|
1726
2062
|
if (!context) {
|
|
1727
2063
|
throw new Error("useThemeContext must be used within a ThemeProvider");
|
|
1728
2064
|
}
|
|
@@ -1769,13 +2105,13 @@ function debounce(fn, delay) {
|
|
|
1769
2105
|
|
|
1770
2106
|
// src/hooks/useDebounce.ts
|
|
1771
2107
|
function useDebounce(callback, delay, deps = []) {
|
|
1772
|
-
const callbackFn =
|
|
2108
|
+
const callbackFn = React18.useCallback(debounce(callback, delay), deps);
|
|
1773
2109
|
return [callbackFn];
|
|
1774
2110
|
}
|
|
1775
2111
|
|
|
1776
2112
|
// src/hooks/useResizeListener.ts
|
|
1777
2113
|
function useResizeListener(props = {}) {
|
|
1778
|
-
const [values, setValues] =
|
|
2114
|
+
const [values, setValues] = React18.useState(
|
|
1779
2115
|
[
|
|
1780
2116
|
typeof window === "undefined" ? props.mobileAgent ? 375 : 1080 : window.innerWidth,
|
|
1781
2117
|
typeof window === "undefined" ? props.mobileAgent ? 812 : 750 : window.innerHeight,
|
|
@@ -1797,7 +2133,7 @@ function useResizeListener(props = {}) {
|
|
|
1797
2133
|
]);
|
|
1798
2134
|
}
|
|
1799
2135
|
const [debouncedSetValue] = useDebounce(handleChangeViewport, 300);
|
|
1800
|
-
|
|
2136
|
+
React18.useEffect(() => {
|
|
1801
2137
|
window.addEventListener("resize", debouncedSetValue);
|
|
1802
2138
|
return () => {
|
|
1803
2139
|
window.removeEventListener("resize", debouncedSetValue);
|
|
@@ -1805,7 +2141,7 @@ function useResizeListener(props = {}) {
|
|
|
1805
2141
|
}, [debouncedSetValue]);
|
|
1806
2142
|
return { screenWidth, screenHeight, viewport, viewMode, mobileView, tabletView };
|
|
1807
2143
|
}
|
|
1808
|
-
var PopoverContext =
|
|
2144
|
+
var PopoverContext = React18.createContext(void 0);
|
|
1809
2145
|
function PopoverCard({
|
|
1810
2146
|
show,
|
|
1811
2147
|
style,
|
|
@@ -1953,74 +2289,68 @@ var resetValues = {
|
|
|
1953
2289
|
description: null,
|
|
1954
2290
|
actions: null
|
|
1955
2291
|
};
|
|
1956
|
-
function
|
|
1957
|
-
|
|
1958
|
-
const
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
updatedValues.show = action.show;
|
|
1964
|
-
}
|
|
1965
|
-
if ("style" in action) {
|
|
1966
|
-
updatedValues.style = action.style;
|
|
1967
|
-
}
|
|
1968
|
-
if ("tooltipStyle" in action) {
|
|
1969
|
-
updatedValues.tooltipStyle = action.tooltipStyle;
|
|
1970
|
-
}
|
|
1971
|
-
if ("position" in action) {
|
|
1972
|
-
updatedValues.position = action.position;
|
|
1973
|
-
}
|
|
1974
|
-
if ("description" in action) {
|
|
1975
|
-
updatedValues.description = action.description;
|
|
2292
|
+
function reducer(state, action) {
|
|
2293
|
+
let changed = false;
|
|
2294
|
+
for (const k in action) {
|
|
2295
|
+
const key = k;
|
|
2296
|
+
if (action[key] !== state[key]) {
|
|
2297
|
+
changed = true;
|
|
2298
|
+
break;
|
|
1976
2299
|
}
|
|
1977
|
-
if ("actions" in action) {
|
|
1978
|
-
updatedValues.actions = action.actions;
|
|
1979
|
-
}
|
|
1980
|
-
if ("render" in action && !!action.render) {
|
|
1981
|
-
setCurrentState((prev) => 1 - prev);
|
|
1982
|
-
}
|
|
1983
|
-
return updatedValues;
|
|
1984
2300
|
}
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
});
|
|
2301
|
+
if (!changed) return state;
|
|
2302
|
+
const updatedValues = { ...state };
|
|
2303
|
+
if ("show" in action) {
|
|
2304
|
+
updatedValues.show = action.show;
|
|
1990
2305
|
}
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
...resetValues,
|
|
1994
|
-
render: true
|
|
1995
|
-
});
|
|
2306
|
+
if ("style" in action) {
|
|
2307
|
+
updatedValues.style = action.style;
|
|
1996
2308
|
}
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
)
|
|
2309
|
+
if ("tooltipStyle" in action) {
|
|
2310
|
+
updatedValues.tooltipStyle = action.tooltipStyle;
|
|
2311
|
+
}
|
|
2312
|
+
if ("position" in action) {
|
|
2313
|
+
updatedValues.position = action.position;
|
|
2314
|
+
}
|
|
2315
|
+
if ("description" in action) {
|
|
2316
|
+
updatedValues.description = action.description;
|
|
2317
|
+
}
|
|
2318
|
+
if ("actions" in action) {
|
|
2319
|
+
updatedValues.actions = action.actions;
|
|
2320
|
+
}
|
|
2321
|
+
return updatedValues;
|
|
2322
|
+
}
|
|
2323
|
+
function PopoverProvider({ children }) {
|
|
2324
|
+
const [values, dispatch] = React18.useReducer(reducer, resetValues);
|
|
2325
|
+
const { show, style, tooltipStyle, position, description, actions } = values;
|
|
2326
|
+
const handleShowPopover = React18.useCallback((params) => {
|
|
2327
|
+
dispatch(params);
|
|
2328
|
+
}, []);
|
|
2329
|
+
const handleClosePopover = React18.useCallback(() => {
|
|
2330
|
+
dispatch(resetValues);
|
|
2331
|
+
}, []);
|
|
2332
|
+
const contextValue = React18.useMemo(() => ({
|
|
2333
|
+
showPopover: show,
|
|
2334
|
+
setPopover: handleShowPopover
|
|
2335
|
+
}), [show, handleShowPopover]);
|
|
2336
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(PopoverContext.Provider, { value: contextValue, children: [
|
|
2337
|
+
children,
|
|
2338
|
+
!!show && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2339
|
+
PopoverCard,
|
|
2340
|
+
{
|
|
2341
|
+
show,
|
|
2342
|
+
style,
|
|
2343
|
+
tooltipStyle,
|
|
2344
|
+
position,
|
|
2345
|
+
description,
|
|
2346
|
+
actions,
|
|
2347
|
+
onClose: handleClosePopover
|
|
2348
|
+
}
|
|
2349
|
+
)
|
|
2350
|
+
] });
|
|
2021
2351
|
}
|
|
2022
2352
|
function usePopoverContext() {
|
|
2023
|
-
const context =
|
|
2353
|
+
const context = React18.useContext(PopoverContext);
|
|
2024
2354
|
if (!context) {
|
|
2025
2355
|
throw new Error("usePopoverContext must be used within a PopoverProvider");
|
|
2026
2356
|
}
|
|
@@ -2030,10 +2360,17 @@ function Popover({ className, description, actions, children, opts }) {
|
|
|
2030
2360
|
const { activated } = opts || {};
|
|
2031
2361
|
const { showPopover, setPopover } = usePopoverContext();
|
|
2032
2362
|
const { screenWidth, screenHeight } = useResizeListener();
|
|
2033
|
-
const [menuData, setMenuData] =
|
|
2034
|
-
const parentRef =
|
|
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);
|
|
2035
2367
|
(actions || []).some((action) => (action.items || []).length > 0);
|
|
2036
|
-
|
|
2368
|
+
React18.useEffect(() => {
|
|
2369
|
+
const wasOpen = prevShowMenuRef.current;
|
|
2370
|
+
prevShowMenuRef.current = menuData.showMenu;
|
|
2371
|
+
if (!menuData.showMenu && !wasOpen) {
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2037
2374
|
const stickyTop = menuData.showMenu && screenHeight - (menuData.y + 14) < 300;
|
|
2038
2375
|
setPopover({
|
|
2039
2376
|
show: menuData.showMenu,
|
|
@@ -2056,14 +2393,15 @@ function Popover({ className, description, actions, children, opts }) {
|
|
|
2056
2393
|
actions
|
|
2057
2394
|
});
|
|
2058
2395
|
}, [menuData, screenWidth, screenHeight, description, actions, setPopover]);
|
|
2059
|
-
|
|
2060
|
-
if (
|
|
2396
|
+
React18.useEffect(() => {
|
|
2397
|
+
if (prevShowPopoverRef.current && !showPopover) {
|
|
2061
2398
|
setMenuData((prev) => ({
|
|
2062
2399
|
...prev,
|
|
2063
2400
|
showMenu: false
|
|
2064
2401
|
}));
|
|
2065
2402
|
}
|
|
2066
|
-
|
|
2403
|
+
prevShowPopoverRef.current = showPopover;
|
|
2404
|
+
}, [showPopover]);
|
|
2067
2405
|
function handleToggleMenu(e) {
|
|
2068
2406
|
e.stopPropagation();
|
|
2069
2407
|
if (menuData.showMenu) {
|
|
@@ -2185,8 +2523,8 @@ function Dragger({
|
|
|
2185
2523
|
children,
|
|
2186
2524
|
onChange
|
|
2187
2525
|
}) {
|
|
2188
|
-
const [, setCurrentState] =
|
|
2189
|
-
const [values, dispatch] =
|
|
2526
|
+
const [, setCurrentState] = React18.useState(0);
|
|
2527
|
+
const [values, dispatch] = React18.useReducer(reducer2, {
|
|
2190
2528
|
items: null,
|
|
2191
2529
|
displayItems: null,
|
|
2192
2530
|
dragging: false,
|
|
@@ -2199,14 +2537,14 @@ function Dragger({
|
|
|
2199
2537
|
const { items, displayItems, dragging, dragItem, dragFrom, dragTo, updated } = values || {};
|
|
2200
2538
|
const grandChildren = children && children.props.children;
|
|
2201
2539
|
const isValid = !disabled && !!records && !!children && !!grandChildren && grandChildren.length > 0;
|
|
2202
|
-
|
|
2540
|
+
React18.useEffect(() => {
|
|
2203
2541
|
dispatch({
|
|
2204
2542
|
items: grandChildren,
|
|
2205
2543
|
updated: false,
|
|
2206
2544
|
render: true
|
|
2207
2545
|
});
|
|
2208
2546
|
}, [timestamp, grandChildren]);
|
|
2209
|
-
|
|
2547
|
+
React18.useEffect(() => {
|
|
2210
2548
|
if (!updated) {
|
|
2211
2549
|
if (grandChildren && grandChildren.length > 0) {
|
|
2212
2550
|
dispatch({
|
|
@@ -2225,7 +2563,7 @@ function Dragger({
|
|
|
2225
2563
|
}
|
|
2226
2564
|
}
|
|
2227
2565
|
}, [grandChildren, updated]);
|
|
2228
|
-
function
|
|
2566
|
+
function reducer2(state, action) {
|
|
2229
2567
|
const updatedValues = { ...state };
|
|
2230
2568
|
if ("items" in action) {
|
|
2231
2569
|
updatedValues.items = action.items;
|
|
@@ -2446,9 +2784,9 @@ function Dragger({
|
|
|
2446
2784
|
}
|
|
2447
2785
|
dispatch({ dragging: false });
|
|
2448
2786
|
}
|
|
2449
|
-
const derivedItems = !!items &&
|
|
2787
|
+
const derivedItems = !!items && React18__default.default.cloneElement(children, {
|
|
2450
2788
|
children: items.map((grandChild, index) => {
|
|
2451
|
-
return
|
|
2789
|
+
return React18__default.default.cloneElement(grandChild, {
|
|
2452
2790
|
id: (records[index] || {}).id,
|
|
2453
2791
|
draggable: true,
|
|
2454
2792
|
className: classNames({
|
|
@@ -2465,9 +2803,9 @@ function Dragger({
|
|
|
2465
2803
|
});
|
|
2466
2804
|
})
|
|
2467
2805
|
});
|
|
2468
|
-
const derivedDisplayItems = !!displayItems &&
|
|
2806
|
+
const derivedDisplayItems = !!displayItems && React18__default.default.cloneElement(children, {
|
|
2469
2807
|
children: displayItems.map((grandChild, index) => {
|
|
2470
|
-
return
|
|
2808
|
+
return React18__default.default.cloneElement(grandChild, {
|
|
2471
2809
|
draggable: true,
|
|
2472
2810
|
className: classNames({
|
|
2473
2811
|
...classNameObject(grandChild.props.className),
|
|
@@ -2525,8 +2863,8 @@ function ExcelTable({
|
|
|
2525
2863
|
isAddRowVisible = true,
|
|
2526
2864
|
addRowLabel = "+ Add Option"
|
|
2527
2865
|
}) {
|
|
2528
|
-
const [editingCell, setEditingCell] =
|
|
2529
|
-
|
|
2866
|
+
const [editingCell, setEditingCell] = React18.useState(null);
|
|
2867
|
+
React18.useEffect(() => {
|
|
2530
2868
|
setTimeout(() => {
|
|
2531
2869
|
const textareas = document.querySelectorAll(".excel-table-textarea");
|
|
2532
2870
|
textareas.forEach((ta) => {
|
|
@@ -2750,21 +3088,21 @@ function ExcelTable({
|
|
|
2750
3088
|
] }) });
|
|
2751
3089
|
}
|
|
2752
3090
|
function Coverflow({ images = [], onClose }) {
|
|
2753
|
-
const scrollContainerRef =
|
|
2754
|
-
const thumbnailContainerRef =
|
|
2755
|
-
const [visualIndex, setVisualIndex] =
|
|
2756
|
-
const isJumpingRef =
|
|
2757
|
-
const wheelLockRef =
|
|
2758
|
-
const wheelTimeoutRef =
|
|
2759
|
-
const [isReady, setIsReady] =
|
|
2760
|
-
const [isMounted, setIsMounted] =
|
|
2761
|
-
|
|
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(() => {
|
|
2762
3100
|
setIsMounted(true);
|
|
2763
3101
|
}, []);
|
|
2764
3102
|
const count = images.length;
|
|
2765
3103
|
const hasMultiple = count > 1;
|
|
2766
3104
|
const extendedImages = hasMultiple ? [images[count - 1], ...images, images[0]] : images;
|
|
2767
|
-
|
|
3105
|
+
React18.useEffect(() => {
|
|
2768
3106
|
if (hasMultiple && scrollContainerRef.current) {
|
|
2769
3107
|
const container = scrollContainerRef.current;
|
|
2770
3108
|
const width = container.offsetWidth;
|
|
@@ -2775,7 +3113,7 @@ function Coverflow({ images = [], onClose }) {
|
|
|
2775
3113
|
setIsReady(true);
|
|
2776
3114
|
}
|
|
2777
3115
|
}, [hasMultiple]);
|
|
2778
|
-
|
|
3116
|
+
React18.useEffect(() => {
|
|
2779
3117
|
if (hasMultiple && thumbnailContainerRef.current) {
|
|
2780
3118
|
const thumbContainer = thumbnailContainerRef.current;
|
|
2781
3119
|
const thumbNode = thumbContainer.children[visualIndex];
|
|
@@ -2788,7 +3126,7 @@ function Coverflow({ images = [], onClose }) {
|
|
|
2788
3126
|
}
|
|
2789
3127
|
}
|
|
2790
3128
|
}, [visualIndex, hasMultiple]);
|
|
2791
|
-
|
|
3129
|
+
React18.useEffect(() => {
|
|
2792
3130
|
const container = scrollContainerRef.current;
|
|
2793
3131
|
if (!container || !hasMultiple) return;
|
|
2794
3132
|
const handleWheel = (e) => {
|
|
@@ -2892,7 +3230,7 @@ function Coverflow({ images = [], onClose }) {
|
|
|
2892
3230
|
behavior: "smooth"
|
|
2893
3231
|
});
|
|
2894
3232
|
};
|
|
2895
|
-
|
|
3233
|
+
React18.useEffect(() => {
|
|
2896
3234
|
const handleKeyDown = (e) => {
|
|
2897
3235
|
if (e.key === "Escape") onClose && onClose();
|
|
2898
3236
|
if (e.key === "ArrowLeft") prevSlide();
|
|
@@ -3066,7 +3404,7 @@ function DataTableRow({ index, selected, label, description, additionalDescripti
|
|
|
3066
3404
|
"!text-left": dataItem.align === "left",
|
|
3067
3405
|
"align-middle": vertical === "middle"
|
|
3068
3406
|
}),
|
|
3069
|
-
children: typeof dataItem.data[index] === "string" ||
|
|
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)
|
|
3070
3408
|
},
|
|
3071
3409
|
`${dataIndex}-${index}`
|
|
3072
3410
|
))
|
|
@@ -3087,8 +3425,8 @@ function DataTable({
|
|
|
3087
3425
|
}) {
|
|
3088
3426
|
const { mobileView } = useResizeListener();
|
|
3089
3427
|
const { ignoreTotal, showCurrency, labelTitle, labelCentered, vertical, darkMode } = opts || {};
|
|
3090
|
-
const [displayHeaders, setDisplayHeaders] =
|
|
3091
|
-
|
|
3428
|
+
const [displayHeaders, setDisplayHeaders] = React18.useState([]);
|
|
3429
|
+
React18.useEffect(() => {
|
|
3092
3430
|
setDisplayHeaders(headers);
|
|
3093
3431
|
}, [headers]);
|
|
3094
3432
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -3203,7 +3541,7 @@ function DataTable({
|
|
|
3203
3541
|
backgroundColor: `${colors[dataIndex]}`,
|
|
3204
3542
|
color: bestTextColorForBg(colors[dataIndex])
|
|
3205
3543
|
} : void 0,
|
|
3206
|
-
children: typeof total[dataIndex] === "string" ||
|
|
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)
|
|
3207
3545
|
},
|
|
3208
3546
|
`${dataIndex}-total`
|
|
3209
3547
|
))
|
|
@@ -3385,8 +3723,8 @@ function DataGridHeader({ sort, onClick, opts, children }) {
|
|
|
3385
3723
|
);
|
|
3386
3724
|
}
|
|
3387
3725
|
function DataGridElement({ processing: defaultProcessing, type, value, error, menu, params, opts, onSelect }) {
|
|
3388
|
-
const [processing, setProcessing] =
|
|
3389
|
-
|
|
3726
|
+
const [processing, setProcessing] = React18.useState(defaultProcessing);
|
|
3727
|
+
React18.useEffect(() => {
|
|
3390
3728
|
setProcessing(defaultProcessing);
|
|
3391
3729
|
}, [defaultProcessing]);
|
|
3392
3730
|
const { align } = opts || {};
|
|
@@ -3478,8 +3816,8 @@ function DataGridContent({ loading, error, type, value, opts, onClick }) {
|
|
|
3478
3816
|
);
|
|
3479
3817
|
}
|
|
3480
3818
|
function DataGrid({ headers, data, selectedId, footers, opts, onSelect }) {
|
|
3481
|
-
const [displayedData, setDisplayedData] =
|
|
3482
|
-
const [orderByState, setOrderByState] =
|
|
3819
|
+
const [displayedData, setDisplayedData] = React18.useState([]);
|
|
3820
|
+
const [orderByState, setOrderByState] = React18.useState({
|
|
3483
3821
|
category: headers[0]?.id || "",
|
|
3484
3822
|
direction: "asc"
|
|
3485
3823
|
});
|
|
@@ -3491,7 +3829,7 @@ function DataGrid({ headers, data, selectedId, footers, opts, onSelect }) {
|
|
|
3491
3829
|
setOrderByState({ category, direction: orderByState.direction === "asc" ? "desc" : "asc" });
|
|
3492
3830
|
}
|
|
3493
3831
|
}
|
|
3494
|
-
|
|
3832
|
+
React18.useEffect(() => {
|
|
3495
3833
|
if ((data || []).length > 0) {
|
|
3496
3834
|
const availableKeys = (headers || []).map((header) => header.id);
|
|
3497
3835
|
const { category, direction } = orderByState;
|
|
@@ -3616,7 +3954,9 @@ function DataGrid({ headers, data, selectedId, footers, opts, onSelect }) {
|
|
|
3616
3954
|
}
|
|
3617
3955
|
|
|
3618
3956
|
exports.B = B;
|
|
3957
|
+
exports.Breadcrumb = Breadcrumb;
|
|
3619
3958
|
exports.Button = Button;
|
|
3959
|
+
exports.ButtonGroup = ButtonGroup;
|
|
3620
3960
|
exports.CheckboxList = CheckboxList;
|
|
3621
3961
|
exports.ConfirmationBox = ConfirmationBox;
|
|
3622
3962
|
exports.Coverflow = Coverflow;
|
|
@@ -3642,6 +3982,7 @@ exports.PopoverProvider = PopoverProvider;
|
|
|
3642
3982
|
exports.Select = Select_default;
|
|
3643
3983
|
exports.SelectInput = SelectInput_default;
|
|
3644
3984
|
exports.SortIcon = SortIcon;
|
|
3985
|
+
exports.Tab = Tab;
|
|
3645
3986
|
exports.Table = Table;
|
|
3646
3987
|
exports.Tabs = Tabs;
|
|
3647
3988
|
exports.Tag = Tag;
|