@unifiedsoftware/react-ui 1.0.8-beta → 1.0.9
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.d.mts +333 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +291 -225
- package/dist/index.mjs +1132 -0
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -111,103 +111,91 @@ var Badge_default = Badge;
|
|
|
111
111
|
|
|
112
112
|
// src/components/Button/Button.tsx
|
|
113
113
|
var import_clsx3 = __toESM(require("clsx"));
|
|
114
|
-
var
|
|
115
|
-
|
|
116
|
-
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
117
|
-
var import_react2 = __toESM(require("react"));
|
|
114
|
+
var import_react5 = require("react");
|
|
118
115
|
|
|
119
|
-
//
|
|
120
|
-
var import_react =
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
// src/icons/ChevronDownIcon.tsx
|
|
117
|
+
var import_react = require("react");
|
|
118
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
119
|
+
var ChevronDownIcon = (0, import_react.forwardRef)((props, ref) => {
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
121
|
+
"svg",
|
|
122
|
+
__spreadProps(__spreadValues({
|
|
123
|
+
ref,
|
|
124
|
+
stroke: "currentColor",
|
|
125
|
+
fill: "currentColor",
|
|
126
|
+
"stroke-width": "0",
|
|
127
|
+
viewBox: "0 0 24 24",
|
|
128
|
+
height: "1em",
|
|
129
|
+
width: "1em",
|
|
130
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
131
|
+
}, props), {
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { fill: "none", d: "M0 0h24v24H0V0z" }),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" })
|
|
135
|
+
]
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
});
|
|
139
|
+
var ChevronDownIcon_default = ChevronDownIcon;
|
|
129
140
|
|
|
130
|
-
//
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
return t;
|
|
140
|
-
};
|
|
141
|
-
return __assign.apply(this, arguments);
|
|
142
|
-
};
|
|
143
|
-
var __rest = function(s, e) {
|
|
144
|
-
var t = {};
|
|
145
|
-
for (var p in s)
|
|
146
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
147
|
-
t[p] = s[p];
|
|
148
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
149
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
150
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
151
|
-
t[p[i]] = s[p[i]];
|
|
152
|
-
}
|
|
153
|
-
return t;
|
|
154
|
-
};
|
|
155
|
-
function Tree2Element(tree) {
|
|
156
|
-
return tree && tree.map(function(node, i) {
|
|
157
|
-
return import_react2.default.createElement(node.tag, __assign({
|
|
158
|
-
key: i
|
|
159
|
-
}, node.attr), Tree2Element(node.child));
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function GenIcon(data) {
|
|
163
|
-
return function(props) {
|
|
164
|
-
return import_react2.default.createElement(IconBase, __assign({
|
|
165
|
-
attr: __assign({}, data.attr)
|
|
166
|
-
}, props), Tree2Element(data.child));
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
function IconBase(props) {
|
|
170
|
-
var elem = function(conf) {
|
|
171
|
-
var attr = props.attr, size = props.size, title = props.title, svgProps = __rest(props, ["attr", "size", "title"]);
|
|
172
|
-
var computedSize = size || conf.size || "1em";
|
|
173
|
-
var className;
|
|
174
|
-
if (conf.className)
|
|
175
|
-
className = conf.className;
|
|
176
|
-
if (props.className)
|
|
177
|
-
className = (className ? className + " " : "") + props.className;
|
|
178
|
-
return import_react2.default.createElement("svg", __assign({
|
|
141
|
+
// src/icons/ChevronUpIcon.tsx
|
|
142
|
+
var import_react2 = require("react");
|
|
143
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
144
|
+
var ChevronUpIcon = (0, import_react2.forwardRef)((props, ref) => {
|
|
145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
146
|
+
"svg",
|
|
147
|
+
__spreadProps(__spreadValues({
|
|
148
|
+
ref,
|
|
179
149
|
stroke: "currentColor",
|
|
180
150
|
fill: "currentColor",
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
color: props.color || conf.color
|
|
186
|
-
}, conf.style), props.style),
|
|
187
|
-
height: computedSize,
|
|
188
|
-
width: computedSize,
|
|
151
|
+
"stroke-width": "0",
|
|
152
|
+
viewBox: "0 0 24 24",
|
|
153
|
+
height: "1em",
|
|
154
|
+
width: "1em",
|
|
189
155
|
xmlns: "http://www.w3.org/2000/svg"
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
156
|
+
}, props), {
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { fill: "none", d: "M0 0h24v24H0z" }),
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" })
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
var ChevronUpIcon_default = ChevronUpIcon;
|
|
196
165
|
|
|
197
|
-
//
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
166
|
+
// src/icons/LoaderIcon.tsx
|
|
167
|
+
var import_react3 = require("react");
|
|
168
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
169
|
+
var LoaderIcon = (0, import_react3.forwardRef)((props, ref) => {
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
171
|
+
"svg",
|
|
172
|
+
__spreadProps(__spreadValues({
|
|
173
|
+
ref,
|
|
174
|
+
stroke: "currentColor",
|
|
175
|
+
fill: "none",
|
|
176
|
+
"stroke-width": "2",
|
|
177
|
+
viewBox: "0 0 24 24",
|
|
178
|
+
"stroke-linecap": "round",
|
|
179
|
+
"stroke-linejoin": "round",
|
|
180
|
+
height: "1em",
|
|
181
|
+
width: "1em",
|
|
182
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
183
|
+
}, props), {
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 3a9 9 0 1 0 9 9" })
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
var LoaderIcon_default = LoaderIcon;
|
|
204
192
|
|
|
205
193
|
// src/components/Icon/Icon.tsx
|
|
206
194
|
var import_clsx2 = __toESM(require("clsx"));
|
|
207
|
-
var
|
|
208
|
-
var Icon = (0,
|
|
209
|
-
const child =
|
|
210
|
-
return (0,
|
|
195
|
+
var import_react4 = require("react");
|
|
196
|
+
var Icon = (0, import_react4.forwardRef)(({ children, size }, ref) => {
|
|
197
|
+
const child = import_react4.Children.only(children);
|
|
198
|
+
return (0, import_react4.cloneElement)(child, __spreadProps(__spreadValues({
|
|
211
199
|
ref
|
|
212
200
|
}, child.props), {
|
|
213
201
|
className: (0, import_clsx2.default)(`${PREFIX_CLS}icon`, { [`${PREFIX_CLS}font-size-${size}`]: size }, child.props.className)
|
|
@@ -216,8 +204,8 @@ var Icon = (0, import_react3.forwardRef)(({ children, size }, ref) => {
|
|
|
216
204
|
var Icon_default = Icon;
|
|
217
205
|
|
|
218
206
|
// src/components/Button/Button.tsx
|
|
219
|
-
var
|
|
220
|
-
var Button = (0,
|
|
207
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
208
|
+
var Button = (0, import_react5.forwardRef)(
|
|
221
209
|
(_a, ref) => {
|
|
222
210
|
var _b = _a, {
|
|
223
211
|
as: Component = "button",
|
|
@@ -246,7 +234,7 @@ var Button = (0, import_react4.forwardRef)(
|
|
|
246
234
|
"loading",
|
|
247
235
|
"disabled"
|
|
248
236
|
]);
|
|
249
|
-
return /* @__PURE__ */ (0,
|
|
237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
250
238
|
Component,
|
|
251
239
|
__spreadProps(__spreadValues({
|
|
252
240
|
ref,
|
|
@@ -265,10 +253,10 @@ var Button = (0, import_react4.forwardRef)(
|
|
|
265
253
|
disabled
|
|
266
254
|
}, rest), {
|
|
267
255
|
children: [
|
|
268
|
-
/* @__PURE__ */ (0,
|
|
269
|
-
/* @__PURE__ */ (0,
|
|
270
|
-
loading ? /* @__PURE__ */ (0,
|
|
271
|
-
/* @__PURE__ */ (0,
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `${PREFIX_CLS}overlay` }),
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `${PREFIX_CLS}outline` }),
|
|
258
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoaderIcon_default, { className: `${PREFIX_CLS}animation-spin` }) }) : startContent,
|
|
259
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `${PREFIX_CLS}button__content`, children }),
|
|
272
260
|
endContent
|
|
273
261
|
]
|
|
274
262
|
})
|
|
@@ -278,12 +266,12 @@ var Button = (0, import_react4.forwardRef)(
|
|
|
278
266
|
|
|
279
267
|
// src/components/Chip/Chip.tsx
|
|
280
268
|
var import_clsx4 = __toESM(require("clsx"));
|
|
281
|
-
var
|
|
282
|
-
var
|
|
283
|
-
var Chip = (0,
|
|
269
|
+
var import_react6 = require("react");
|
|
270
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
271
|
+
var Chip = (0, import_react6.forwardRef)(
|
|
284
272
|
(_a, ref) => {
|
|
285
273
|
var _b = _a, { as: Component = "div", children, className, variant, color, size } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
286
|
-
return /* @__PURE__ */ (0,
|
|
274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
287
275
|
Component,
|
|
288
276
|
__spreadProps(__spreadValues({
|
|
289
277
|
ref,
|
|
@@ -298,8 +286,8 @@ var Chip = (0, import_react5.forwardRef)(
|
|
|
298
286
|
)
|
|
299
287
|
}, rest), {
|
|
300
288
|
children: [
|
|
301
|
-
/* @__PURE__ */ (0,
|
|
302
|
-
/* @__PURE__ */ (0,
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: (0, import_clsx4.default)(`${PREFIX_CLS}overlay`) }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `${PREFIX_CLS}outline` }),
|
|
303
291
|
children
|
|
304
292
|
]
|
|
305
293
|
})
|
|
@@ -309,13 +297,13 @@ var Chip = (0, import_react5.forwardRef)(
|
|
|
309
297
|
var Chip_default = Chip;
|
|
310
298
|
|
|
311
299
|
// src/components/Collapse/Collapse.tsx
|
|
312
|
-
var
|
|
300
|
+
var import_react8 = require("react");
|
|
313
301
|
|
|
314
302
|
// src/components/Collapse/CollapseContext.tsx
|
|
315
|
-
var
|
|
316
|
-
var CollapseContext = (0,
|
|
303
|
+
var import_react7 = require("react");
|
|
304
|
+
var CollapseContext = (0, import_react7.createContext)(null);
|
|
317
305
|
var useCollapse = () => {
|
|
318
|
-
const context = (0,
|
|
306
|
+
const context = (0, import_react7.useContext)(CollapseContext);
|
|
319
307
|
if (!context) {
|
|
320
308
|
throw new Error("`useCollapse` must be used within a `<Collapse />`");
|
|
321
309
|
}
|
|
@@ -324,12 +312,12 @@ var useCollapse = () => {
|
|
|
324
312
|
var CollapseContext_default = CollapseContext;
|
|
325
313
|
|
|
326
314
|
// src/components/Collapse/Collapse.tsx
|
|
327
|
-
var
|
|
315
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
328
316
|
var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
329
|
-
const collapseRef = (0,
|
|
330
|
-
const [selfIsOpen, setSelfIsOpen] = (0,
|
|
331
|
-
const [heightAuto, setHeightAuto] = (0,
|
|
332
|
-
const [trigger, content] =
|
|
317
|
+
const collapseRef = (0, import_react8.useRef)(null);
|
|
318
|
+
const [selfIsOpen, setSelfIsOpen] = (0, import_react8.useState)(isOpen != null ? isOpen : false);
|
|
319
|
+
const [heightAuto, setHeightAuto] = (0, import_react8.useState)(false);
|
|
320
|
+
const [trigger, content] = import_react8.Children.toArray(children);
|
|
333
321
|
const handleOpen = () => {
|
|
334
322
|
setSelfIsOpen(true);
|
|
335
323
|
onOpen == null ? void 0 : onOpen();
|
|
@@ -342,7 +330,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
342
330
|
setSelfIsOpen((prevState) => !prevState);
|
|
343
331
|
onToggle == null ? void 0 : onToggle();
|
|
344
332
|
};
|
|
345
|
-
(0,
|
|
333
|
+
(0, import_react8.useEffect)(() => {
|
|
346
334
|
if (isOpen !== void 0) {
|
|
347
335
|
setSelfIsOpen(isOpen);
|
|
348
336
|
}
|
|
@@ -354,7 +342,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
354
342
|
}
|
|
355
343
|
}, 100);
|
|
356
344
|
}, [isOpen]);
|
|
357
|
-
return /* @__PURE__ */ (0,
|
|
345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
358
346
|
CollapseContext_default.Provider,
|
|
359
347
|
{
|
|
360
348
|
value: {
|
|
@@ -376,12 +364,12 @@ var Collapse_default = Collapse;
|
|
|
376
364
|
|
|
377
365
|
// src/components/Collapse/CollapseContent.tsx
|
|
378
366
|
var import_clsx5 = __toESM(require("clsx"));
|
|
379
|
-
var
|
|
380
|
-
var CollapseContent = (0,
|
|
367
|
+
var import_react9 = require("react");
|
|
368
|
+
var CollapseContent = (0, import_react9.forwardRef)(({ children }, ref) => {
|
|
381
369
|
var _a, _b;
|
|
382
370
|
const { collapseRef, isOpen, heightAuto } = useCollapse();
|
|
383
|
-
const child =
|
|
384
|
-
return (0,
|
|
371
|
+
const child = import_react9.Children.only(children);
|
|
372
|
+
return (0, import_react9.cloneElement)(child, __spreadProps(__spreadValues({}, child.props), {
|
|
385
373
|
ref: (node) => {
|
|
386
374
|
collapseRef.current = node;
|
|
387
375
|
if (ref !== null) {
|
|
@@ -397,11 +385,11 @@ var CollapseContent = (0, import_react8.forwardRef)(({ children }, ref) => {
|
|
|
397
385
|
var CollapseContent_default = CollapseContent;
|
|
398
386
|
|
|
399
387
|
// src/components/Collapse/CollapseTrigger.tsx
|
|
400
|
-
var
|
|
401
|
-
var CollapseTrigger = (0,
|
|
388
|
+
var import_react10 = require("react");
|
|
389
|
+
var CollapseTrigger = (0, import_react10.forwardRef)(({ children }, ref) => {
|
|
402
390
|
const { collapseRef, onToggle } = useCollapse();
|
|
403
|
-
const child =
|
|
404
|
-
return (0,
|
|
391
|
+
const child = import_react10.Children.only(children);
|
|
392
|
+
return (0, import_react10.cloneElement)(child, __spreadValues({
|
|
405
393
|
ref,
|
|
406
394
|
onClick: (event) => {
|
|
407
395
|
var _a, _b;
|
|
@@ -417,13 +405,13 @@ var CollapseTrigger_default = CollapseTrigger;
|
|
|
417
405
|
|
|
418
406
|
// src/components/Menu/Menu.tsx
|
|
419
407
|
var import_clsx9 = __toESM(require("clsx"));
|
|
420
|
-
var
|
|
408
|
+
var import_react16 = require("react");
|
|
421
409
|
|
|
422
410
|
// src/components/Menu/MenuContext.tsx
|
|
423
|
-
var
|
|
424
|
-
var MenuContext = (0,
|
|
411
|
+
var import_react11 = require("react");
|
|
412
|
+
var MenuContext = (0, import_react11.createContext)(null);
|
|
425
413
|
var useMenu = () => {
|
|
426
|
-
const context = (0,
|
|
414
|
+
const context = (0, import_react11.useContext)(MenuContext);
|
|
427
415
|
if (!context) {
|
|
428
416
|
throw new Error("`useMenu` must be used within a `<Menu />`");
|
|
429
417
|
}
|
|
@@ -433,17 +421,17 @@ var MenuContext_default = MenuContext;
|
|
|
433
421
|
|
|
434
422
|
// src/components/Menu/MenuGroup.tsx
|
|
435
423
|
var import_clsx8 = __toESM(require("clsx"));
|
|
436
|
-
var
|
|
424
|
+
var import_react15 = require("react");
|
|
437
425
|
|
|
438
426
|
// src/components/Menu/MenuItem.tsx
|
|
439
427
|
var import_clsx6 = __toESM(require("clsx"));
|
|
440
|
-
var
|
|
428
|
+
var import_react13 = require("react");
|
|
441
429
|
|
|
442
430
|
// src/components/Menu/MenuValueContext.tsx
|
|
443
|
-
var
|
|
444
|
-
var MenuValueContext = (0,
|
|
431
|
+
var import_react12 = require("react");
|
|
432
|
+
var MenuValueContext = (0, import_react12.createContext)([]);
|
|
445
433
|
var useMenuItemValue = () => {
|
|
446
|
-
const context = (0,
|
|
434
|
+
const context = (0, import_react12.useContext)(MenuValueContext);
|
|
447
435
|
if (!context) {
|
|
448
436
|
throw new Error("`useMenuValue` must be used within a `<MenuValueContext.Provider />`");
|
|
449
437
|
}
|
|
@@ -452,11 +440,11 @@ var useMenuItemValue = () => {
|
|
|
452
440
|
var MenuValueContext_default = MenuValueContext;
|
|
453
441
|
|
|
454
442
|
// src/components/Menu/MenuItem.tsx
|
|
455
|
-
var
|
|
456
|
-
var MenuItem = (0,
|
|
443
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
444
|
+
var MenuItem = (0, import_react13.forwardRef)((props, ref) => {
|
|
457
445
|
const _a = props, { as: Component = "div", className, style, value, title, icon, level = 1, disabled, onClick } = _a, rest = __objRest(_a, ["as", "className", "style", "value", "title", "icon", "level", "disabled", "onClick"]);
|
|
458
446
|
const { value: menuValue, originalValue, openMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
459
|
-
const values = (0,
|
|
447
|
+
const values = (0, import_react13.useContext)(MenuValueContext_default);
|
|
460
448
|
const mergedValues = [...values, value];
|
|
461
449
|
const handleClick = (event) => {
|
|
462
450
|
if (value !== void 0) {
|
|
@@ -465,13 +453,13 @@ var MenuItem = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
465
453
|
onClick == null ? void 0 : onClick(event);
|
|
466
454
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
467
455
|
};
|
|
468
|
-
(0,
|
|
456
|
+
(0, import_react13.useEffect)(() => {
|
|
469
457
|
if (openMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
470
458
|
onOpen(values);
|
|
471
459
|
onChange(mergedValues);
|
|
472
460
|
}
|
|
473
461
|
}, [value, originalValue, openMode]);
|
|
474
|
-
return /* @__PURE__ */ (0,
|
|
462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
475
463
|
Component,
|
|
476
464
|
__spreadProps(__spreadValues({
|
|
477
465
|
ref,
|
|
@@ -489,9 +477,9 @@ var MenuItem = (0, import_react12.forwardRef)((props, ref) => {
|
|
|
489
477
|
onClick: handleClick
|
|
490
478
|
}, rest), {
|
|
491
479
|
children: [
|
|
492
|
-
/* @__PURE__ */ (0,
|
|
493
|
-
icon && /* @__PURE__ */ (0,
|
|
494
|
-
/* @__PURE__ */ (0,
|
|
480
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
481
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
482
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
|
|
495
483
|
]
|
|
496
484
|
})
|
|
497
485
|
);
|
|
@@ -501,15 +489,7 @@ var MenuItem_default = MenuItem;
|
|
|
501
489
|
|
|
502
490
|
// src/components/Menu/MenuSubmenu.tsx
|
|
503
491
|
var import_clsx7 = __toESM(require("clsx"));
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
// ../../../node_modules/react-icons/md/index.esm.js
|
|
507
|
-
function MdKeyboardArrowDown(props) {
|
|
508
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0V0z" } }, { "tag": "path", "attr": { "d": "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" } }] })(props);
|
|
509
|
-
}
|
|
510
|
-
function MdKeyboardArrowUp(props) {
|
|
511
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "fill": "none", "d": "M0 0h24v24H0z" } }, { "tag": "path", "attr": { "d": "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" } }] })(props);
|
|
512
|
-
}
|
|
492
|
+
var import_react14 = require("react");
|
|
513
493
|
|
|
514
494
|
// src/components/Menu/utils.ts
|
|
515
495
|
var getOpenValuesByPathname = (pathname) => {
|
|
@@ -535,7 +515,7 @@ var addOrRemoveValueInArray = (array, value) => {
|
|
|
535
515
|
};
|
|
536
516
|
|
|
537
517
|
// src/components/Menu/MenuSubmenu.tsx
|
|
538
|
-
var
|
|
518
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
539
519
|
var MenuSubmenu = (_a) => {
|
|
540
520
|
var _b = _a, {
|
|
541
521
|
children,
|
|
@@ -558,18 +538,18 @@ var MenuSubmenu = (_a) => {
|
|
|
558
538
|
"items",
|
|
559
539
|
"onClick"
|
|
560
540
|
]);
|
|
561
|
-
const { value: menuValue, openValues,
|
|
562
|
-
const values = (0,
|
|
541
|
+
const { value: menuValue, openValues, expandMode, onOpen } = useMenu();
|
|
542
|
+
const values = (0, import_react14.useContext)(MenuValueContext_default);
|
|
563
543
|
const isOpen = openValues.includes(value);
|
|
564
544
|
const mergedValues = [...values, value];
|
|
565
|
-
const content = (0,
|
|
545
|
+
const content = (0, import_react14.useMemo)(() => {
|
|
566
546
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
567
547
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
568
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
548
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
|
|
569
549
|
});
|
|
570
550
|
}, [items]);
|
|
571
551
|
const handleClick = (event) => {
|
|
572
|
-
if (
|
|
552
|
+
if (expandMode === "multiple") {
|
|
573
553
|
const updatedOpenValues = addOrRemoveValueInArray(openValues, value);
|
|
574
554
|
onOpen(updatedOpenValues);
|
|
575
555
|
} else {
|
|
@@ -583,8 +563,8 @@ var MenuSubmenu = (_a) => {
|
|
|
583
563
|
}
|
|
584
564
|
onClick == null ? void 0 : onClick(event);
|
|
585
565
|
};
|
|
586
|
-
return /* @__PURE__ */ (0,
|
|
587
|
-
/* @__PURE__ */ (0,
|
|
566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx7.default)(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Collapse_default, { isOpen, children: [
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CollapseTrigger_default, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
588
568
|
"div",
|
|
589
569
|
__spreadProps(__spreadValues({
|
|
590
570
|
className: (0, import_clsx7.default)(
|
|
@@ -600,14 +580,14 @@ var MenuSubmenu = (_a) => {
|
|
|
600
580
|
onClick: handleClick
|
|
601
581
|
}, rest), {
|
|
602
582
|
children: [
|
|
603
|
-
/* @__PURE__ */ (0,
|
|
604
|
-
icon && /* @__PURE__ */ (0,
|
|
605
|
-
/* @__PURE__ */ (0,
|
|
606
|
-
/* @__PURE__ */ (0,
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
584
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
585
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronUpIcon_default, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChevronDownIcon_default, { className: `${PREFIX_CLS}icon` }) })
|
|
607
587
|
]
|
|
608
588
|
})
|
|
609
589
|
) }),
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CollapseContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
611
591
|
"ul",
|
|
612
592
|
{
|
|
613
593
|
className: (0, import_clsx7.default)(`${PREFIX_CLS}menu`, {
|
|
@@ -621,7 +601,7 @@ var MenuSubmenu = (_a) => {
|
|
|
621
601
|
var MenuSubmenu_default = MenuSubmenu;
|
|
622
602
|
|
|
623
603
|
// src/components/Menu/MenuGroup.tsx
|
|
624
|
-
var
|
|
604
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
625
605
|
var MenuGroup = (_a) => {
|
|
626
606
|
var _b = _a, {
|
|
627
607
|
children,
|
|
@@ -640,14 +620,14 @@ var MenuGroup = (_a) => {
|
|
|
640
620
|
"level",
|
|
641
621
|
"items"
|
|
642
622
|
]);
|
|
643
|
-
const content = (0,
|
|
623
|
+
const content = (0, import_react15.useMemo)(() => {
|
|
644
624
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
645
625
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
646
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
626
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MenuItem_default, __spreadValues({}, item), index);
|
|
647
627
|
});
|
|
648
628
|
}, [items]);
|
|
649
|
-
return /* @__PURE__ */ (0,
|
|
650
|
-
/* @__PURE__ */ (0,
|
|
629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
651
631
|
"div",
|
|
652
632
|
__spreadProps(__spreadValues({
|
|
653
633
|
className: (0, import_clsx8.default)(`${PREFIX_CLS}menu-group`, className),
|
|
@@ -656,8 +636,8 @@ var MenuGroup = (_a) => {
|
|
|
656
636
|
}, style)
|
|
657
637
|
}, rest), {
|
|
658
638
|
children: [
|
|
659
|
-
icon && /* @__PURE__ */ (0,
|
|
660
|
-
/* @__PURE__ */ (0,
|
|
639
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
|
|
640
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
|
|
661
641
|
]
|
|
662
642
|
})
|
|
663
643
|
),
|
|
@@ -667,14 +647,14 @@ var MenuGroup = (_a) => {
|
|
|
667
647
|
var MenuGroup_default = MenuGroup;
|
|
668
648
|
|
|
669
649
|
// src/components/Menu/Menu.tsx
|
|
670
|
-
var
|
|
650
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
671
651
|
var Menu = (_a) => {
|
|
672
652
|
var _b = _a, {
|
|
673
653
|
children,
|
|
674
654
|
value: valueProp = [],
|
|
675
655
|
defaultValue,
|
|
676
656
|
openValues: openValuesProp,
|
|
677
|
-
|
|
657
|
+
expandMode = "multiple",
|
|
678
658
|
openMode = "manual",
|
|
679
659
|
items,
|
|
680
660
|
onChange,
|
|
@@ -685,7 +665,7 @@ var Menu = (_a) => {
|
|
|
685
665
|
"value",
|
|
686
666
|
"defaultValue",
|
|
687
667
|
"openValues",
|
|
688
|
-
"
|
|
668
|
+
"expandMode",
|
|
689
669
|
"openMode",
|
|
690
670
|
"items",
|
|
691
671
|
"onChange",
|
|
@@ -693,12 +673,12 @@ var Menu = (_a) => {
|
|
|
693
673
|
"onItemSelect"
|
|
694
674
|
]);
|
|
695
675
|
var _a2;
|
|
696
|
-
const [selfValue, setSelfValue] = (0,
|
|
697
|
-
const [selfOpenValues, setSelfOpenValues] = (0,
|
|
698
|
-
const content = (0,
|
|
676
|
+
const [selfValue, setSelfValue] = (0, import_react16.useState)((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : []);
|
|
677
|
+
const [selfOpenValues, setSelfOpenValues] = (0, import_react16.useState)(openValuesProp != null ? openValuesProp : []);
|
|
678
|
+
const content = (0, import_react16.useMemo)(() => {
|
|
699
679
|
return items == null ? void 0 : items.map((_a3, index) => {
|
|
700
680
|
var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
701
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
681
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(MenuItem_default, __spreadValues({}, item), index);
|
|
702
682
|
});
|
|
703
683
|
}, [items]);
|
|
704
684
|
const handleChange = (value) => {
|
|
@@ -718,30 +698,30 @@ var Menu = (_a) => {
|
|
|
718
698
|
const handleItemSelect = (props) => {
|
|
719
699
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
720
700
|
};
|
|
721
|
-
(0,
|
|
701
|
+
(0, import_react16.useEffect)(() => {
|
|
722
702
|
if (valueProp !== void 0 && openMode !== "automatic") {
|
|
723
703
|
setSelfValue(valueProp);
|
|
724
704
|
}
|
|
725
705
|
}, [valueProp]);
|
|
726
|
-
(0,
|
|
706
|
+
(0, import_react16.useEffect)(() => {
|
|
727
707
|
if (openValuesProp !== void 0) {
|
|
728
708
|
setSelfOpenValues(openValuesProp);
|
|
729
709
|
}
|
|
730
710
|
}, [openValuesProp]);
|
|
731
|
-
return /* @__PURE__ */ (0,
|
|
711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
732
712
|
MenuContext_default.Provider,
|
|
733
713
|
{
|
|
734
714
|
value: {
|
|
735
715
|
value: selfValue,
|
|
736
716
|
originalValue: valueProp,
|
|
737
717
|
openValues: selfOpenValues,
|
|
738
|
-
|
|
718
|
+
expandMode,
|
|
739
719
|
openMode,
|
|
740
720
|
onOpen: handleOpen,
|
|
741
721
|
onChange: handleChange,
|
|
742
722
|
onItemSelect: handleItemSelect
|
|
743
723
|
},
|
|
744
|
-
children: /* @__PURE__ */ (0,
|
|
724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", __spreadProps(__spreadValues({ className: (0, import_clsx9.default)(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
|
|
745
725
|
}
|
|
746
726
|
);
|
|
747
727
|
};
|
|
@@ -751,13 +731,99 @@ var Menu_default = Menu;
|
|
|
751
731
|
// src/components/Tabs/Tab.tsx
|
|
752
732
|
var import_clsx10 = __toESM(require("clsx"));
|
|
753
733
|
var import_merge_refs = __toESM(require("merge-refs"));
|
|
754
|
-
var
|
|
734
|
+
var import_react20 = require("react");
|
|
735
|
+
|
|
736
|
+
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
737
|
+
var import_react18 = __toESM(require("react"));
|
|
738
|
+
|
|
739
|
+
// ../../../node_modules/react-icons/lib/esm/iconContext.js
|
|
740
|
+
var import_react17 = __toESM(require("react"));
|
|
741
|
+
var DefaultContext = {
|
|
742
|
+
color: void 0,
|
|
743
|
+
size: void 0,
|
|
744
|
+
className: void 0,
|
|
745
|
+
style: void 0,
|
|
746
|
+
attr: void 0
|
|
747
|
+
};
|
|
748
|
+
var IconContext = import_react17.default.createContext && import_react17.default.createContext(DefaultContext);
|
|
749
|
+
|
|
750
|
+
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
751
|
+
var __assign = function() {
|
|
752
|
+
__assign = Object.assign || function(t) {
|
|
753
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
754
|
+
s = arguments[i];
|
|
755
|
+
for (var p in s)
|
|
756
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
757
|
+
t[p] = s[p];
|
|
758
|
+
}
|
|
759
|
+
return t;
|
|
760
|
+
};
|
|
761
|
+
return __assign.apply(this, arguments);
|
|
762
|
+
};
|
|
763
|
+
var __rest = function(s, e) {
|
|
764
|
+
var t = {};
|
|
765
|
+
for (var p in s)
|
|
766
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
767
|
+
t[p] = s[p];
|
|
768
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
769
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
770
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
771
|
+
t[p[i]] = s[p[i]];
|
|
772
|
+
}
|
|
773
|
+
return t;
|
|
774
|
+
};
|
|
775
|
+
function Tree2Element(tree) {
|
|
776
|
+
return tree && tree.map(function(node, i) {
|
|
777
|
+
return import_react18.default.createElement(node.tag, __assign({
|
|
778
|
+
key: i
|
|
779
|
+
}, node.attr), Tree2Element(node.child));
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
function GenIcon(data) {
|
|
783
|
+
return function(props) {
|
|
784
|
+
return import_react18.default.createElement(IconBase, __assign({
|
|
785
|
+
attr: __assign({}, data.attr)
|
|
786
|
+
}, props), Tree2Element(data.child));
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function IconBase(props) {
|
|
790
|
+
var elem = function(conf) {
|
|
791
|
+
var attr = props.attr, size = props.size, title = props.title, svgProps = __rest(props, ["attr", "size", "title"]);
|
|
792
|
+
var computedSize = size || conf.size || "1em";
|
|
793
|
+
var className;
|
|
794
|
+
if (conf.className)
|
|
795
|
+
className = conf.className;
|
|
796
|
+
if (props.className)
|
|
797
|
+
className = (className ? className + " " : "") + props.className;
|
|
798
|
+
return import_react18.default.createElement("svg", __assign({
|
|
799
|
+
stroke: "currentColor",
|
|
800
|
+
fill: "currentColor",
|
|
801
|
+
strokeWidth: "0"
|
|
802
|
+
}, conf.attr, attr, svgProps, {
|
|
803
|
+
className,
|
|
804
|
+
style: __assign(__assign({
|
|
805
|
+
color: props.color || conf.color
|
|
806
|
+
}, conf.style), props.style),
|
|
807
|
+
height: computedSize,
|
|
808
|
+
width: computedSize,
|
|
809
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
810
|
+
}), title && import_react18.default.createElement("title", null, title), props.children);
|
|
811
|
+
};
|
|
812
|
+
return IconContext !== void 0 ? import_react18.default.createElement(IconContext.Consumer, null, function(conf) {
|
|
813
|
+
return elem(conf);
|
|
814
|
+
}) : elem(DefaultContext);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// ../../../node_modules/react-icons/tb/index.esm.js
|
|
818
|
+
function TbX(props) {
|
|
819
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M18 6l-12 12" } }, { "tag": "path", "attr": { "d": "M6 6l12 12" } }] })(props);
|
|
820
|
+
}
|
|
755
821
|
|
|
756
822
|
// src/components/Tabs/TabsContext.ts
|
|
757
|
-
var
|
|
758
|
-
var TabsContext = (0,
|
|
823
|
+
var import_react19 = require("react");
|
|
824
|
+
var TabsContext = (0, import_react19.createContext)(null);
|
|
759
825
|
var useTabs = () => {
|
|
760
|
-
const context = (0,
|
|
826
|
+
const context = (0, import_react19.useContext)(TabsContext);
|
|
761
827
|
if (!context) {
|
|
762
828
|
throw new Error("`useTabs` must be used within a `<Tabs />`");
|
|
763
829
|
}
|
|
@@ -765,8 +831,8 @@ var useTabs = () => {
|
|
|
765
831
|
};
|
|
766
832
|
|
|
767
833
|
// src/components/Tabs/Tab.tsx
|
|
768
|
-
var
|
|
769
|
-
var Tab = (0,
|
|
834
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
835
|
+
var Tab = (0, import_react20.forwardRef)(
|
|
770
836
|
(_a, ref) => {
|
|
771
837
|
var _b = _a, {
|
|
772
838
|
as: Component = "div",
|
|
@@ -787,8 +853,8 @@ var Tab = (0, import_react17.forwardRef)(
|
|
|
787
853
|
"disabled",
|
|
788
854
|
"onClick"
|
|
789
855
|
]);
|
|
790
|
-
const tabRef = (0,
|
|
791
|
-
const id = (0,
|
|
856
|
+
const tabRef = (0, import_react20.useRef)(null);
|
|
857
|
+
const id = (0, import_react20.useId)();
|
|
792
858
|
const value = valueProp != null ? valueProp : id;
|
|
793
859
|
const _a2 = useTabs(), { onClose, registerItem } = _a2, tabs = __objRest(_a2, ["onClose", "registerItem"]);
|
|
794
860
|
const handleClick = (event) => {
|
|
@@ -829,13 +895,13 @@ var Tab = (0, import_react17.forwardRef)(
|
|
|
829
895
|
event.stopPropagation();
|
|
830
896
|
onClose(value);
|
|
831
897
|
};
|
|
832
|
-
(0,
|
|
898
|
+
(0, import_react20.useEffect)(() => {
|
|
833
899
|
registerItem({ value, disabled });
|
|
834
900
|
if (value === tabs.value) {
|
|
835
901
|
tabs.previousTabRef.current = tabRef.current;
|
|
836
902
|
}
|
|
837
903
|
}, [value, tabs.value]);
|
|
838
|
-
return /* @__PURE__ */ (0,
|
|
904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
839
905
|
Component,
|
|
840
906
|
__spreadProps(__spreadValues({
|
|
841
907
|
ref: (0, import_merge_refs.default)(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
|
|
@@ -848,12 +914,12 @@ var Tab = (0, import_react17.forwardRef)(
|
|
|
848
914
|
onClick: handleClick
|
|
849
915
|
}, rest), {
|
|
850
916
|
children: [
|
|
851
|
-
/* @__PURE__ */ (0,
|
|
852
|
-
/* @__PURE__ */ (0,
|
|
917
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
918
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${PREFIX_CLS}tab__content`, children: [
|
|
853
919
|
children,
|
|
854
|
-
closable && /* @__PURE__ */ (0,
|
|
920
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TbX, {}) }) })
|
|
855
921
|
] }),
|
|
856
|
-
/* @__PURE__ */ (0,
|
|
922
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}tab__indicator` })
|
|
857
923
|
]
|
|
858
924
|
})
|
|
859
925
|
);
|
|
@@ -862,7 +928,7 @@ var Tab = (0, import_react17.forwardRef)(
|
|
|
862
928
|
|
|
863
929
|
// src/components/Tabs/Tabs.tsx
|
|
864
930
|
var import_clsx11 = __toESM(require("clsx"));
|
|
865
|
-
var
|
|
931
|
+
var import_react21 = require("react");
|
|
866
932
|
|
|
867
933
|
// src/utils/scroll.ts
|
|
868
934
|
var scrollToItem = (parentElement, currentElement) => {
|
|
@@ -890,7 +956,7 @@ var scrollToItem = (parentElement, currentElement) => {
|
|
|
890
956
|
};
|
|
891
957
|
|
|
892
958
|
// src/components/Tabs/Tabs.tsx
|
|
893
|
-
var
|
|
959
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
894
960
|
var Tabs = (_a) => {
|
|
895
961
|
var _b = _a, {
|
|
896
962
|
children,
|
|
@@ -909,11 +975,11 @@ var Tabs = (_a) => {
|
|
|
909
975
|
"onChange",
|
|
910
976
|
"onClose"
|
|
911
977
|
]);
|
|
912
|
-
const tabsRef = (0,
|
|
913
|
-
const tabRefs = (0,
|
|
914
|
-
const previousTabRef = (0,
|
|
915
|
-
const [selfValue, setSelfValue] = (0,
|
|
916
|
-
const [items, setItems] = (0,
|
|
978
|
+
const tabsRef = (0, import_react21.useRef)(null);
|
|
979
|
+
const tabRefs = (0, import_react21.useRef)({});
|
|
980
|
+
const previousTabRef = (0, import_react21.useRef)(null);
|
|
981
|
+
const [selfValue, setSelfValue] = (0, import_react21.useState)(value != null ? value : defaultValue);
|
|
982
|
+
const [items, setItems] = (0, import_react21.useState)([]);
|
|
917
983
|
const registerItem = (item) => {
|
|
918
984
|
setItems((prevItems) => {
|
|
919
985
|
const index = prevItems.findIndex((item2) => item2.value);
|
|
@@ -940,24 +1006,24 @@ var Tabs = (_a) => {
|
|
|
940
1006
|
const handleClose = (value2) => {
|
|
941
1007
|
onClose == null ? void 0 : onClose(value2);
|
|
942
1008
|
};
|
|
943
|
-
(0,
|
|
1009
|
+
(0, import_react21.useEffect)(() => {
|
|
944
1010
|
if (value !== void 0) {
|
|
945
1011
|
setSelfValue(value);
|
|
946
1012
|
scrollToTab(value);
|
|
947
1013
|
}
|
|
948
1014
|
}, [value]);
|
|
949
|
-
(0,
|
|
1015
|
+
(0, import_react21.useEffect)(() => {
|
|
950
1016
|
if (value === void 0) {
|
|
951
1017
|
const item = items.find((tab) => !tab.disabled);
|
|
952
1018
|
setSelfValue(item == null ? void 0 : item.value);
|
|
953
1019
|
}
|
|
954
1020
|
}, [value, items]);
|
|
955
|
-
return /* @__PURE__ */ (0,
|
|
1021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
956
1022
|
TabsContext.Provider,
|
|
957
1023
|
{
|
|
958
1024
|
value: { previousTabRef, tabRefs, value: selfValue, onChange: handleChange, onClose: handleClose, registerItem },
|
|
959
1025
|
children: [
|
|
960
|
-
/* @__PURE__ */ (0,
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
961
1027
|
"div",
|
|
962
1028
|
__spreadProps(__spreadValues({
|
|
963
1029
|
ref: tabsRef,
|
|
@@ -966,26 +1032,26 @@ var Tabs = (_a) => {
|
|
|
966
1032
|
children
|
|
967
1033
|
})
|
|
968
1034
|
),
|
|
969
|
-
/* @__PURE__ */ (0,
|
|
1035
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${PREFIX_CLS}divider` })
|
|
970
1036
|
]
|
|
971
1037
|
}
|
|
972
1038
|
);
|
|
973
1039
|
};
|
|
974
1040
|
|
|
975
1041
|
// src/hooks/useLocalStorage.tsx
|
|
976
|
-
var
|
|
1042
|
+
var import_react24 = require("react");
|
|
977
1043
|
|
|
978
1044
|
// src/hooks/useEventListener.tsx
|
|
979
|
-
var
|
|
1045
|
+
var import_react23 = require("react");
|
|
980
1046
|
|
|
981
1047
|
// src/hooks/useIsomorphicLayoutEffect.tsx
|
|
982
|
-
var
|
|
983
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1048
|
+
var import_react22 = require("react");
|
|
1049
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react22.useLayoutEffect : import_react22.useEffect;
|
|
984
1050
|
var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
|
|
985
1051
|
|
|
986
1052
|
// src/hooks/useEventListener.tsx
|
|
987
1053
|
function useEventListener(handler) {
|
|
988
|
-
const savedHandler = (0,
|
|
1054
|
+
const savedHandler = (0, import_react23.useRef)(handler);
|
|
989
1055
|
useIsomorphicLayoutEffect_default(() => {
|
|
990
1056
|
savedHandler.current = handler;
|
|
991
1057
|
}, [handler]);
|
|
@@ -994,7 +1060,7 @@ var useEventListener_default = useEventListener;
|
|
|
994
1060
|
|
|
995
1061
|
// src/hooks/useLocalStorage.tsx
|
|
996
1062
|
function useLocalStorage(key, initialValue) {
|
|
997
|
-
const readValue = (0,
|
|
1063
|
+
const readValue = (0, import_react24.useCallback)(() => {
|
|
998
1064
|
if (typeof window === "undefined") {
|
|
999
1065
|
return initialValue;
|
|
1000
1066
|
}
|
|
@@ -1006,8 +1072,8 @@ function useLocalStorage(key, initialValue) {
|
|
|
1006
1072
|
return initialValue;
|
|
1007
1073
|
}
|
|
1008
1074
|
}, [initialValue, key]);
|
|
1009
|
-
const [storedValue, setStoredValue] = (0,
|
|
1010
|
-
const setValue = (0,
|
|
1075
|
+
const [storedValue, setStoredValue] = (0, import_react24.useState)(readValue);
|
|
1076
|
+
const setValue = (0, import_react24.useCallback)(
|
|
1011
1077
|
(value) => {
|
|
1012
1078
|
if (typeof window == "undefined") {
|
|
1013
1079
|
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
@@ -1023,10 +1089,10 @@ function useLocalStorage(key, initialValue) {
|
|
|
1023
1089
|
},
|
|
1024
1090
|
[key, storedValue]
|
|
1025
1091
|
);
|
|
1026
|
-
(0,
|
|
1092
|
+
(0, import_react24.useEffect)(() => {
|
|
1027
1093
|
setStoredValue(readValue());
|
|
1028
1094
|
}, []);
|
|
1029
|
-
const handleStorageChange = (0,
|
|
1095
|
+
const handleStorageChange = (0, import_react24.useCallback)(() => {
|
|
1030
1096
|
setStoredValue(readValue());
|
|
1031
1097
|
}, [readValue]);
|
|
1032
1098
|
useEventListener_default("storage", handleStorageChange);
|
|
@@ -1043,22 +1109,22 @@ function parseJSON(value) {
|
|
|
1043
1109
|
}
|
|
1044
1110
|
|
|
1045
1111
|
// src/hooks/usePrevious.tsx
|
|
1046
|
-
var
|
|
1112
|
+
var import_react25 = require("react");
|
|
1047
1113
|
var usePrevious = (value) => {
|
|
1048
|
-
const ref = (0,
|
|
1049
|
-
(0,
|
|
1114
|
+
const ref = (0, import_react25.useRef)();
|
|
1115
|
+
(0, import_react25.useEffect)(() => {
|
|
1050
1116
|
ref.current = value;
|
|
1051
1117
|
});
|
|
1052
1118
|
return ref.current;
|
|
1053
1119
|
};
|
|
1054
1120
|
|
|
1055
1121
|
// src/hooks/useStep.tsx
|
|
1056
|
-
var
|
|
1122
|
+
var import_react26 = require("react");
|
|
1057
1123
|
var useStep = (maxStep) => {
|
|
1058
|
-
const [currentStep, setCurrentStep] = (0,
|
|
1059
|
-
const canGoToNextStep = (0,
|
|
1060
|
-
const canGoToPrevStep = (0,
|
|
1061
|
-
const setStep = (0,
|
|
1124
|
+
const [currentStep, setCurrentStep] = (0, import_react26.useState)(1);
|
|
1125
|
+
const canGoToNextStep = (0, import_react26.useMemo)(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
|
|
1126
|
+
const canGoToPrevStep = (0, import_react26.useMemo)(() => currentStep - 1 >= 1, [currentStep]);
|
|
1127
|
+
const setStep = (0, import_react26.useCallback)(
|
|
1062
1128
|
(step) => {
|
|
1063
1129
|
const newStep = step instanceof Function ? step(currentStep) : step;
|
|
1064
1130
|
if (newStep >= 1 && newStep <= maxStep) {
|
|
@@ -1069,17 +1135,17 @@ var useStep = (maxStep) => {
|
|
|
1069
1135
|
},
|
|
1070
1136
|
[maxStep, currentStep]
|
|
1071
1137
|
);
|
|
1072
|
-
const goToNextStep = (0,
|
|
1138
|
+
const goToNextStep = (0, import_react26.useCallback)(() => {
|
|
1073
1139
|
if (canGoToNextStep) {
|
|
1074
1140
|
setCurrentStep((step) => step + 1);
|
|
1075
1141
|
}
|
|
1076
1142
|
}, [canGoToNextStep]);
|
|
1077
|
-
const goToPrevStep = (0,
|
|
1143
|
+
const goToPrevStep = (0, import_react26.useCallback)(() => {
|
|
1078
1144
|
if (canGoToPrevStep) {
|
|
1079
1145
|
setCurrentStep((step) => step - 1);
|
|
1080
1146
|
}
|
|
1081
1147
|
}, [canGoToPrevStep]);
|
|
1082
|
-
const reset = (0,
|
|
1148
|
+
const reset = (0, import_react26.useCallback)(() => {
|
|
1083
1149
|
setCurrentStep(1);
|
|
1084
1150
|
}, []);
|
|
1085
1151
|
return [
|