@unifiedsoftware/react-ui 1.0.11 → 1.0.12
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 +35 -1
- package/dist/index.d.ts +35 -1
- package/dist/index.js +289 -181
- package/dist/index.mjs +221 -117
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -59,6 +59,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
59
59
|
// src/index.ts
|
|
60
60
|
var src_exports = {};
|
|
61
61
|
__export(src_exports, {
|
|
62
|
+
Backdrop: () => Backdrop_default,
|
|
62
63
|
Badge: () => Badge_default,
|
|
63
64
|
Button: () => Button,
|
|
64
65
|
Chip: () => Chip_default,
|
|
@@ -73,8 +74,11 @@ __export(src_exports, {
|
|
|
73
74
|
MenuItem: () => MenuItem_default,
|
|
74
75
|
MenuSubmenu: () => MenuSubmenu_default,
|
|
75
76
|
MenuValueContext: () => MenuValueContext_default,
|
|
77
|
+
Portal: () => Portal_default,
|
|
76
78
|
Tab: () => Tab,
|
|
77
79
|
Tabs: () => Tabs,
|
|
80
|
+
Toolbar: () => Toolbar_default,
|
|
81
|
+
Transition: () => Transition_default,
|
|
78
82
|
getOpenValuesByPathname: () => getOpenValuesByPathname,
|
|
79
83
|
useCollapse: () => useCollapse,
|
|
80
84
|
useLocalStorage: () => useLocalStorage,
|
|
@@ -85,21 +89,102 @@ __export(src_exports, {
|
|
|
85
89
|
});
|
|
86
90
|
module.exports = __toCommonJS(src_exports);
|
|
87
91
|
|
|
88
|
-
// src/components/
|
|
89
|
-
var
|
|
92
|
+
// src/components/Backdrop/Backdrop.tsx
|
|
93
|
+
var import_clsx2 = __toESM(require("clsx"));
|
|
94
|
+
var import_react3 = require("react");
|
|
95
|
+
var import_react_merge_refs = require("react-merge-refs");
|
|
90
96
|
|
|
91
97
|
// src/constants/index.ts
|
|
92
98
|
var PREFIX_CLS = "us-";
|
|
93
99
|
|
|
94
|
-
// src/components/
|
|
100
|
+
// src/components/Portal/Portal.tsx
|
|
101
|
+
var import_react = require("react");
|
|
102
|
+
var import_react_portal = require("react-portal");
|
|
95
103
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
104
|
+
var Portal = (0, import_react.forwardRef)(({ children }, ref) => {
|
|
105
|
+
const portalRef = (0, import_react.useRef)(null);
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_portal.Portal, { ref: portalRef, node: document.body, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `${PREFIX_CLS}potal`, children }) });
|
|
107
|
+
});
|
|
108
|
+
var Portal_default = Portal;
|
|
109
|
+
|
|
110
|
+
// src/components/Transition/Transition.tsx
|
|
111
|
+
var import_clsx = __toESM(require("clsx"));
|
|
112
|
+
var import_react2 = require("react");
|
|
113
|
+
var import_react_transition_group = require("react-transition-group");
|
|
114
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
115
|
+
var Transition = (0, import_react2.forwardRef)((props, ref) => {
|
|
116
|
+
const {
|
|
117
|
+
children,
|
|
118
|
+
className,
|
|
119
|
+
nodeRef,
|
|
120
|
+
name,
|
|
121
|
+
isOpen,
|
|
122
|
+
enter = 0,
|
|
123
|
+
leave = 0,
|
|
124
|
+
mountOnEnter,
|
|
125
|
+
unmountOnExit,
|
|
126
|
+
onExited
|
|
127
|
+
} = props;
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
129
|
+
import_react_transition_group.CSSTransition,
|
|
130
|
+
{
|
|
131
|
+
nodeRef,
|
|
132
|
+
in: isOpen,
|
|
133
|
+
appear: true,
|
|
134
|
+
timeout: { enter, exit: leave },
|
|
135
|
+
mountOnEnter,
|
|
136
|
+
unmountOnExit,
|
|
137
|
+
classNames: (0, import_clsx.default)(name, className),
|
|
138
|
+
onExited,
|
|
139
|
+
children
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
var Transition_default = Transition;
|
|
144
|
+
|
|
145
|
+
// src/components/Backdrop/Backdrop.tsx
|
|
146
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
147
|
+
var Backdrop = (0, import_react3.forwardRef)((props, ref) => {
|
|
148
|
+
const _a = props, { children, className, isOpen, onClose } = _a, rest = __objRest(_a, ["children", "className", "isOpen", "onClose"]);
|
|
149
|
+
const nodeRef = (0, import_react3.useRef)(null);
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
151
|
+
Transition_default,
|
|
152
|
+
{
|
|
153
|
+
nodeRef,
|
|
154
|
+
isOpen,
|
|
155
|
+
name: `${PREFIX_CLS}backdrop`,
|
|
156
|
+
enter: 300,
|
|
157
|
+
leave: 300,
|
|
158
|
+
mountOnEnter: true,
|
|
159
|
+
unmountOnExit: true,
|
|
160
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Portal_default, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
161
|
+
"div",
|
|
162
|
+
__spreadProps(__spreadValues({
|
|
163
|
+
ref: (0, import_react_merge_refs.mergeRefs)([ref, nodeRef]),
|
|
164
|
+
className: (0, import_clsx2.default)(`${PREFIX_CLS}backdrop`, className),
|
|
165
|
+
tabIndex: -1
|
|
166
|
+
}, rest), {
|
|
167
|
+
children: [
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: `${PREFIX_CLS}backdrop__overlay`, onClick: onClose }),
|
|
169
|
+
children
|
|
170
|
+
]
|
|
171
|
+
})
|
|
172
|
+
) })
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
var Backdrop_default = Backdrop;
|
|
177
|
+
|
|
178
|
+
// src/components/Badge/Badge.tsx
|
|
179
|
+
var import_clsx3 = __toESM(require("clsx"));
|
|
180
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
96
181
|
var Badge = ({ children, placement, content }) => {
|
|
97
|
-
return /* @__PURE__ */ (0,
|
|
182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_clsx3.default)(`${PREFIX_CLS}badge-wrapper`), children: [
|
|
98
183
|
children,
|
|
99
|
-
/* @__PURE__ */ (0,
|
|
184
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
100
185
|
"div",
|
|
101
186
|
{
|
|
102
|
-
className: (0,
|
|
187
|
+
className: (0, import_clsx3.default)(`${PREFIX_CLS}badge`, {
|
|
103
188
|
[`${PREFIX_CLS}badge--${placement}`]: placement
|
|
104
189
|
}),
|
|
105
190
|
children: content
|
|
@@ -110,14 +195,14 @@ var Badge = ({ children, placement, content }) => {
|
|
|
110
195
|
var Badge_default = Badge;
|
|
111
196
|
|
|
112
197
|
// src/components/Button/Button.tsx
|
|
113
|
-
var
|
|
114
|
-
var
|
|
198
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
199
|
+
var import_react8 = require("react");
|
|
115
200
|
|
|
116
201
|
// src/icons/ChevronDownIcon.tsx
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
var ChevronDownIcon = (0,
|
|
120
|
-
return /* @__PURE__ */ (0,
|
|
202
|
+
var import_react4 = require("react");
|
|
203
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
204
|
+
var ChevronDownIcon = (0, import_react4.forwardRef)((props, ref) => {
|
|
205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
121
206
|
"svg",
|
|
122
207
|
__spreadProps(__spreadValues({
|
|
123
208
|
ref,
|
|
@@ -130,8 +215,8 @@ var ChevronDownIcon = (0, import_react.forwardRef)((props, ref) => {
|
|
|
130
215
|
xmlns: "http://www.w3.org/2000/svg"
|
|
131
216
|
}, props), {
|
|
132
217
|
children: [
|
|
133
|
-
/* @__PURE__ */ (0,
|
|
134
|
-
/* @__PURE__ */ (0,
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { fill: "none", d: "M0 0h24v24H0V0z" }),
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" })
|
|
135
220
|
]
|
|
136
221
|
})
|
|
137
222
|
);
|
|
@@ -139,10 +224,10 @@ var ChevronDownIcon = (0, import_react.forwardRef)((props, ref) => {
|
|
|
139
224
|
var ChevronDownIcon_default = ChevronDownIcon;
|
|
140
225
|
|
|
141
226
|
// src/icons/ChevronUpIcon.tsx
|
|
142
|
-
var
|
|
143
|
-
var
|
|
144
|
-
var ChevronUpIcon = (0,
|
|
145
|
-
return /* @__PURE__ */ (0,
|
|
227
|
+
var import_react5 = require("react");
|
|
228
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
229
|
+
var ChevronUpIcon = (0, import_react5.forwardRef)((props, ref) => {
|
|
230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
146
231
|
"svg",
|
|
147
232
|
__spreadProps(__spreadValues({
|
|
148
233
|
ref,
|
|
@@ -155,8 +240,8 @@ var ChevronUpIcon = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
155
240
|
xmlns: "http://www.w3.org/2000/svg"
|
|
156
241
|
}, props), {
|
|
157
242
|
children: [
|
|
158
|
-
/* @__PURE__ */ (0,
|
|
159
|
-
/* @__PURE__ */ (0,
|
|
243
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { fill: "none", d: "M0 0h24v24H0z" }),
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" })
|
|
160
245
|
]
|
|
161
246
|
})
|
|
162
247
|
);
|
|
@@ -164,10 +249,10 @@ var ChevronUpIcon = (0, import_react2.forwardRef)((props, ref) => {
|
|
|
164
249
|
var ChevronUpIcon_default = ChevronUpIcon;
|
|
165
250
|
|
|
166
251
|
// src/icons/LoaderIcon.tsx
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
var LoaderIcon = (0,
|
|
170
|
-
return /* @__PURE__ */ (0,
|
|
252
|
+
var import_react6 = require("react");
|
|
253
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
254
|
+
var LoaderIcon = (0, import_react6.forwardRef)((props, ref) => {
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
171
256
|
"svg",
|
|
172
257
|
__spreadProps(__spreadValues({
|
|
173
258
|
ref,
|
|
@@ -182,8 +267,8 @@ var LoaderIcon = (0, import_react3.forwardRef)((props, ref) => {
|
|
|
182
267
|
xmlns: "http://www.w3.org/2000/svg"
|
|
183
268
|
}, props), {
|
|
184
269
|
children: [
|
|
185
|
-
/* @__PURE__ */ (0,
|
|
186
|
-
/* @__PURE__ */ (0,
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M12 3a9 9 0 1 0 9 9" })
|
|
187
272
|
]
|
|
188
273
|
})
|
|
189
274
|
);
|
|
@@ -191,21 +276,21 @@ var LoaderIcon = (0, import_react3.forwardRef)((props, ref) => {
|
|
|
191
276
|
var LoaderIcon_default = LoaderIcon;
|
|
192
277
|
|
|
193
278
|
// src/components/Icon/Icon.tsx
|
|
194
|
-
var
|
|
195
|
-
var
|
|
196
|
-
var Icon = (0,
|
|
197
|
-
const child =
|
|
198
|
-
return (0,
|
|
279
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
280
|
+
var import_react7 = require("react");
|
|
281
|
+
var Icon = (0, import_react7.forwardRef)(({ children, size }, ref) => {
|
|
282
|
+
const child = import_react7.Children.only(children);
|
|
283
|
+
return (0, import_react7.cloneElement)(child, __spreadProps(__spreadValues({
|
|
199
284
|
ref
|
|
200
285
|
}, child.props), {
|
|
201
|
-
className: (0,
|
|
286
|
+
className: (0, import_clsx4.default)(`${PREFIX_CLS}icon`, { [`${PREFIX_CLS}font-size-${size}`]: size }, child.props.className)
|
|
202
287
|
}));
|
|
203
288
|
});
|
|
204
289
|
var Icon_default = Icon;
|
|
205
290
|
|
|
206
291
|
// src/components/Button/Button.tsx
|
|
207
|
-
var
|
|
208
|
-
var Button = (0,
|
|
292
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
293
|
+
var Button = (0, import_react8.forwardRef)(
|
|
209
294
|
(_a, ref) => {
|
|
210
295
|
var _b = _a, {
|
|
211
296
|
as: Component = "button",
|
|
@@ -234,11 +319,11 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
234
319
|
"loading",
|
|
235
320
|
"disabled"
|
|
236
321
|
]);
|
|
237
|
-
return /* @__PURE__ */ (0,
|
|
322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
238
323
|
Component,
|
|
239
324
|
__spreadProps(__spreadValues({
|
|
240
325
|
ref,
|
|
241
|
-
className: (0,
|
|
326
|
+
className: (0, import_clsx5.default)(
|
|
242
327
|
`${PREFIX_CLS}button`,
|
|
243
328
|
{
|
|
244
329
|
[`${PREFIX_CLS}button--${variant}`]: variant,
|
|
@@ -253,10 +338,10 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
253
338
|
disabled
|
|
254
339
|
}, rest), {
|
|
255
340
|
children: [
|
|
256
|
-
/* @__PURE__ */ (0,
|
|
257
|
-
/* @__PURE__ */ (0,
|
|
258
|
-
loading ? /* @__PURE__ */ (0,
|
|
259
|
-
/* @__PURE__ */ (0,
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}overlay` }),
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}outline` }),
|
|
343
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LoaderIcon_default, { className: `${PREFIX_CLS}animation-spin` }) }) : startContent,
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${PREFIX_CLS}button__content`, children }),
|
|
260
345
|
endContent
|
|
261
346
|
]
|
|
262
347
|
})
|
|
@@ -265,17 +350,17 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
265
350
|
);
|
|
266
351
|
|
|
267
352
|
// src/components/Chip/Chip.tsx
|
|
268
|
-
var
|
|
269
|
-
var
|
|
270
|
-
var
|
|
271
|
-
var Chip = (0,
|
|
353
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
354
|
+
var import_react9 = require("react");
|
|
355
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
356
|
+
var Chip = (0, import_react9.forwardRef)(
|
|
272
357
|
(_a, ref) => {
|
|
273
358
|
var _b = _a, { as: Component = "div", children, className, variant, color, size } = _b, rest = __objRest(_b, ["as", "children", "className", "variant", "color", "size"]);
|
|
274
|
-
return /* @__PURE__ */ (0,
|
|
359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
275
360
|
Component,
|
|
276
361
|
__spreadProps(__spreadValues({
|
|
277
362
|
ref,
|
|
278
|
-
className: (0,
|
|
363
|
+
className: (0, import_clsx6.default)(
|
|
279
364
|
`${PREFIX_CLS}chip`,
|
|
280
365
|
{
|
|
281
366
|
[`${PREFIX_CLS}chip--${variant}`]: variant,
|
|
@@ -286,8 +371,8 @@ var Chip = (0, import_react6.forwardRef)(
|
|
|
286
371
|
)
|
|
287
372
|
}, rest), {
|
|
288
373
|
children: [
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
290
|
-
/* @__PURE__ */ (0,
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: (0, import_clsx6.default)(`${PREFIX_CLS}overlay`) }),
|
|
375
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `${PREFIX_CLS}outline` }),
|
|
291
376
|
children
|
|
292
377
|
]
|
|
293
378
|
})
|
|
@@ -297,13 +382,13 @@ var Chip = (0, import_react6.forwardRef)(
|
|
|
297
382
|
var Chip_default = Chip;
|
|
298
383
|
|
|
299
384
|
// src/components/Collapse/Collapse.tsx
|
|
300
|
-
var
|
|
385
|
+
var import_react11 = require("react");
|
|
301
386
|
|
|
302
387
|
// src/components/Collapse/CollapseContext.tsx
|
|
303
|
-
var
|
|
304
|
-
var CollapseContext = (0,
|
|
388
|
+
var import_react10 = require("react");
|
|
389
|
+
var CollapseContext = (0, import_react10.createContext)(null);
|
|
305
390
|
var useCollapse = () => {
|
|
306
|
-
const context = (0,
|
|
391
|
+
const context = (0, import_react10.useContext)(CollapseContext);
|
|
307
392
|
if (!context) {
|
|
308
393
|
throw new Error("`useCollapse` must be used within a `<Collapse />`");
|
|
309
394
|
}
|
|
@@ -312,12 +397,12 @@ var useCollapse = () => {
|
|
|
312
397
|
var CollapseContext_default = CollapseContext;
|
|
313
398
|
|
|
314
399
|
// src/components/Collapse/Collapse.tsx
|
|
315
|
-
var
|
|
400
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
316
401
|
var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
317
|
-
const collapseRef = (0,
|
|
318
|
-
const [selfIsOpen, setSelfIsOpen] = (0,
|
|
319
|
-
const [heightAuto, setHeightAuto] = (0,
|
|
320
|
-
const [trigger, content] =
|
|
402
|
+
const collapseRef = (0, import_react11.useRef)(null);
|
|
403
|
+
const [selfIsOpen, setSelfIsOpen] = (0, import_react11.useState)(isOpen != null ? isOpen : false);
|
|
404
|
+
const [heightAuto, setHeightAuto] = (0, import_react11.useState)(false);
|
|
405
|
+
const [trigger, content] = import_react11.Children.toArray(children);
|
|
321
406
|
const handleOpen = () => {
|
|
322
407
|
setSelfIsOpen(true);
|
|
323
408
|
onOpen == null ? void 0 : onOpen();
|
|
@@ -330,7 +415,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
330
415
|
setSelfIsOpen((prevState) => !prevState);
|
|
331
416
|
onToggle == null ? void 0 : onToggle();
|
|
332
417
|
};
|
|
333
|
-
(0,
|
|
418
|
+
(0, import_react11.useEffect)(() => {
|
|
334
419
|
if (isOpen !== void 0) {
|
|
335
420
|
setSelfIsOpen(isOpen);
|
|
336
421
|
}
|
|
@@ -342,7 +427,7 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
342
427
|
}
|
|
343
428
|
}, 100);
|
|
344
429
|
}, [isOpen]);
|
|
345
|
-
return /* @__PURE__ */ (0,
|
|
430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
346
431
|
CollapseContext_default.Provider,
|
|
347
432
|
{
|
|
348
433
|
value: {
|
|
@@ -363,13 +448,13 @@ var Collapse = ({ children, isOpen, onOpen, onClose, onToggle }) => {
|
|
|
363
448
|
var Collapse_default = Collapse;
|
|
364
449
|
|
|
365
450
|
// src/components/Collapse/CollapseContent.tsx
|
|
366
|
-
var
|
|
367
|
-
var
|
|
368
|
-
var CollapseContent = (0,
|
|
451
|
+
var import_clsx7 = __toESM(require("clsx"));
|
|
452
|
+
var import_react12 = require("react");
|
|
453
|
+
var CollapseContent = (0, import_react12.forwardRef)(({ children }, ref) => {
|
|
369
454
|
var _a, _b;
|
|
370
455
|
const { collapseRef, isOpen, heightAuto } = useCollapse();
|
|
371
|
-
const child =
|
|
372
|
-
return (0,
|
|
456
|
+
const child = import_react12.Children.only(children);
|
|
457
|
+
return (0, import_react12.cloneElement)(child, __spreadProps(__spreadValues({}, child.props), {
|
|
373
458
|
ref: (node) => {
|
|
374
459
|
collapseRef.current = node;
|
|
375
460
|
if (ref !== null) {
|
|
@@ -379,17 +464,17 @@ var CollapseContent = (0, import_react9.forwardRef)(({ children }, ref) => {
|
|
|
379
464
|
style: __spreadProps(__spreadValues({}, child.props.style), {
|
|
380
465
|
height: isOpen && heightAuto ? "auto" : isOpen ? (_a = collapseRef.current) == null ? void 0 : _a.scrollHeight : !isOpen && heightAuto ? (_b = collapseRef.current) == null ? void 0 : _b.scrollHeight : 0
|
|
381
466
|
}),
|
|
382
|
-
className: (0,
|
|
467
|
+
className: (0, import_clsx7.default)(`${PREFIX_CLS}collapse`, child.props.className)
|
|
383
468
|
}));
|
|
384
469
|
});
|
|
385
470
|
var CollapseContent_default = CollapseContent;
|
|
386
471
|
|
|
387
472
|
// src/components/Collapse/CollapseTrigger.tsx
|
|
388
|
-
var
|
|
389
|
-
var CollapseTrigger = (0,
|
|
473
|
+
var import_react13 = require("react");
|
|
474
|
+
var CollapseTrigger = (0, import_react13.forwardRef)(({ children }, ref) => {
|
|
390
475
|
const { collapseRef, onToggle } = useCollapse();
|
|
391
|
-
const child =
|
|
392
|
-
return (0,
|
|
476
|
+
const child = import_react13.Children.only(children);
|
|
477
|
+
return (0, import_react13.cloneElement)(child, __spreadValues({
|
|
393
478
|
ref,
|
|
394
479
|
onClick: (event) => {
|
|
395
480
|
var _a, _b;
|
|
@@ -404,14 +489,14 @@ var CollapseTrigger = (0, import_react10.forwardRef)(({ children }, ref) => {
|
|
|
404
489
|
var CollapseTrigger_default = CollapseTrigger;
|
|
405
490
|
|
|
406
491
|
// src/components/Menu/Menu.tsx
|
|
407
|
-
var
|
|
408
|
-
var
|
|
492
|
+
var import_clsx11 = __toESM(require("clsx"));
|
|
493
|
+
var import_react19 = require("react");
|
|
409
494
|
|
|
410
495
|
// src/components/Menu/MenuContext.tsx
|
|
411
|
-
var
|
|
412
|
-
var MenuContext = (0,
|
|
496
|
+
var import_react14 = require("react");
|
|
497
|
+
var MenuContext = (0, import_react14.createContext)(null);
|
|
413
498
|
var useMenu = () => {
|
|
414
|
-
const context = (0,
|
|
499
|
+
const context = (0, import_react14.useContext)(MenuContext);
|
|
415
500
|
if (!context) {
|
|
416
501
|
throw new Error("`useMenu` must be used within a `<Menu />`");
|
|
417
502
|
}
|
|
@@ -420,18 +505,18 @@ var useMenu = () => {
|
|
|
420
505
|
var MenuContext_default = MenuContext;
|
|
421
506
|
|
|
422
507
|
// src/components/Menu/MenuGroup.tsx
|
|
423
|
-
var
|
|
424
|
-
var
|
|
508
|
+
var import_clsx10 = __toESM(require("clsx"));
|
|
509
|
+
var import_react18 = require("react");
|
|
425
510
|
|
|
426
511
|
// src/components/Menu/MenuItem.tsx
|
|
427
|
-
var
|
|
428
|
-
var
|
|
512
|
+
var import_clsx8 = __toESM(require("clsx"));
|
|
513
|
+
var import_react16 = require("react");
|
|
429
514
|
|
|
430
515
|
// src/components/Menu/MenuValueContext.tsx
|
|
431
|
-
var
|
|
432
|
-
var MenuValueContext = (0,
|
|
516
|
+
var import_react15 = require("react");
|
|
517
|
+
var MenuValueContext = (0, import_react15.createContext)([]);
|
|
433
518
|
var useMenuItemValue = () => {
|
|
434
|
-
const context = (0,
|
|
519
|
+
const context = (0, import_react15.useContext)(MenuValueContext);
|
|
435
520
|
if (!context) {
|
|
436
521
|
throw new Error("`useMenuValue` must be used within a `<MenuValueContext.Provider />`");
|
|
437
522
|
}
|
|
@@ -440,11 +525,11 @@ var useMenuItemValue = () => {
|
|
|
440
525
|
var MenuValueContext_default = MenuValueContext;
|
|
441
526
|
|
|
442
527
|
// src/components/Menu/MenuItem.tsx
|
|
443
|
-
var
|
|
444
|
-
var MenuItem = (0,
|
|
528
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
529
|
+
var MenuItem = (0, import_react16.forwardRef)((props, ref) => {
|
|
445
530
|
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"]);
|
|
446
531
|
const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
447
|
-
const values = (0,
|
|
532
|
+
const values = (0, import_react16.useContext)(MenuValueContext_default);
|
|
448
533
|
const mergedValues = [...values, value];
|
|
449
534
|
const handleClick = (event) => {
|
|
450
535
|
if (value !== void 0) {
|
|
@@ -453,17 +538,17 @@ var MenuItem = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
453
538
|
onClick == null ? void 0 : onClick(event);
|
|
454
539
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
455
540
|
};
|
|
456
|
-
(0,
|
|
541
|
+
(0, import_react16.useEffect)(() => {
|
|
457
542
|
if (navMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
458
543
|
onOpen(values);
|
|
459
544
|
onChange(mergedValues);
|
|
460
545
|
}
|
|
461
546
|
}, [value, originalValue, navMode]);
|
|
462
|
-
return /* @__PURE__ */ (0,
|
|
547
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
463
548
|
Component,
|
|
464
549
|
__spreadProps(__spreadValues({
|
|
465
550
|
ref,
|
|
466
|
-
className: (0,
|
|
551
|
+
className: (0, import_clsx8.default)(
|
|
467
552
|
`${PREFIX_CLS}menu-item`,
|
|
468
553
|
{
|
|
469
554
|
[`${PREFIX_CLS}menu-item--selected`]: menuValue.includes(value),
|
|
@@ -477,9 +562,9 @@ var MenuItem = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
477
562
|
onClick: handleClick
|
|
478
563
|
}, rest), {
|
|
479
564
|
children: [
|
|
480
|
-
/* @__PURE__ */ (0,
|
|
481
|
-
icon && /* @__PURE__ */ (0,
|
|
482
|
-
/* @__PURE__ */ (0,
|
|
565
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
566
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
567
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) })
|
|
483
568
|
]
|
|
484
569
|
})
|
|
485
570
|
);
|
|
@@ -488,8 +573,8 @@ MenuItem.displayName = "MenuItem";
|
|
|
488
573
|
var MenuItem_default = MenuItem;
|
|
489
574
|
|
|
490
575
|
// src/components/Menu/MenuSubmenu.tsx
|
|
491
|
-
var
|
|
492
|
-
var
|
|
576
|
+
var import_clsx9 = __toESM(require("clsx"));
|
|
577
|
+
var import_react17 = require("react");
|
|
493
578
|
|
|
494
579
|
// src/components/Menu/utils.ts
|
|
495
580
|
var getOpenValuesByPathname = (pathname) => {
|
|
@@ -515,7 +600,7 @@ var addOrRemoveValueInArray = (array, value) => {
|
|
|
515
600
|
};
|
|
516
601
|
|
|
517
602
|
// src/components/Menu/MenuSubmenu.tsx
|
|
518
|
-
var
|
|
603
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
519
604
|
var MenuSubmenu = (_a) => {
|
|
520
605
|
var _b = _a, {
|
|
521
606
|
children,
|
|
@@ -539,13 +624,13 @@ var MenuSubmenu = (_a) => {
|
|
|
539
624
|
"onClick"
|
|
540
625
|
]);
|
|
541
626
|
const { value: menuValue, openValues, expandMode, onOpen } = useMenu();
|
|
542
|
-
const values = (0,
|
|
627
|
+
const values = (0, import_react17.useContext)(MenuValueContext_default);
|
|
543
628
|
const isOpen = openValues.includes(value);
|
|
544
629
|
const mergedValues = [...values, value];
|
|
545
|
-
const content = (0,
|
|
630
|
+
const content = (0, import_react17.useMemo)(() => {
|
|
546
631
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
547
632
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
548
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
633
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MenuSubmenu, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : type === "group" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MenuGroup_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MenuItem_default, __spreadValues({ level: level !== void 0 ? level + 1 : void 0 }, item), index);
|
|
549
634
|
});
|
|
550
635
|
}, [items]);
|
|
551
636
|
const handleClick = (event) => {
|
|
@@ -563,11 +648,11 @@ var MenuSubmenu = (_a) => {
|
|
|
563
648
|
}
|
|
564
649
|
onClick == null ? void 0 : onClick(event);
|
|
565
650
|
};
|
|
566
|
-
return /* @__PURE__ */ (0,
|
|
567
|
-
/* @__PURE__ */ (0,
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MenuValueContext_default.Provider, { value: mergedValues, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_clsx9.default)(`${PREFIX_CLS}menu-submenu`), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Collapse_default, { isOpen, children: [
|
|
652
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollapseTrigger_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
568
653
|
"div",
|
|
569
654
|
__spreadProps(__spreadValues({
|
|
570
|
-
className: (0,
|
|
655
|
+
className: (0, import_clsx9.default)(
|
|
571
656
|
`${PREFIX_CLS}menu-item`,
|
|
572
657
|
{
|
|
573
658
|
[`${PREFIX_CLS}menu-item--selected`]: menuValue.includes(value) || items && mergedValues.includes(menuValue)
|
|
@@ -580,17 +665,17 @@ var MenuSubmenu = (_a) => {
|
|
|
580
665
|
onClick: handleClick
|
|
581
666
|
}, rest), {
|
|
582
667
|
children: [
|
|
583
|
-
/* @__PURE__ */ (0,
|
|
584
|
-
icon && /* @__PURE__ */ (0,
|
|
585
|
-
/* @__PURE__ */ (0,
|
|
586
|
-
/* @__PURE__ */ (0,
|
|
668
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
669
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: icon }),
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}menu-item__content`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: `${PREFIX_CLS}menu-item__title`, children: title }) }),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${PREFIX_CLS}menu-item__icon`, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronUpIcon_default, { className: `${PREFIX_CLS}icon` }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronDownIcon_default, { className: `${PREFIX_CLS}icon` }) })
|
|
587
672
|
]
|
|
588
673
|
})
|
|
589
674
|
) }),
|
|
590
|
-
/* @__PURE__ */ (0,
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollapseContent_default, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
591
676
|
"ul",
|
|
592
677
|
{
|
|
593
|
-
className: (0,
|
|
678
|
+
className: (0, import_clsx9.default)(`${PREFIX_CLS}menu`, {
|
|
594
679
|
[`${PREFIX_CLS}menu-open`]: !isOpen
|
|
595
680
|
}),
|
|
596
681
|
children: content || children
|
|
@@ -601,7 +686,7 @@ var MenuSubmenu = (_a) => {
|
|
|
601
686
|
var MenuSubmenu_default = MenuSubmenu;
|
|
602
687
|
|
|
603
688
|
// src/components/Menu/MenuGroup.tsx
|
|
604
|
-
var
|
|
689
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
605
690
|
var MenuGroup = (_a) => {
|
|
606
691
|
var _b = _a, {
|
|
607
692
|
children,
|
|
@@ -620,24 +705,24 @@ var MenuGroup = (_a) => {
|
|
|
620
705
|
"level",
|
|
621
706
|
"items"
|
|
622
707
|
]);
|
|
623
|
-
const content = (0,
|
|
708
|
+
const content = (0, import_react18.useMemo)(() => {
|
|
624
709
|
return items == null ? void 0 : items.map((_a2, index) => {
|
|
625
710
|
var _b2 = _a2, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
626
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
711
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuSubmenu_default, __spreadValues({}, item), index) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuItem_default, __spreadValues({}, item), index);
|
|
627
712
|
});
|
|
628
713
|
}, [items]);
|
|
629
|
-
return /* @__PURE__ */ (0,
|
|
630
|
-
/* @__PURE__ */ (0,
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
715
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
631
716
|
"div",
|
|
632
717
|
__spreadProps(__spreadValues({
|
|
633
|
-
className: (0,
|
|
718
|
+
className: (0, import_clsx10.default)(`${PREFIX_CLS}menu-group`, className),
|
|
634
719
|
style: __spreadValues({
|
|
635
720
|
paddingLeft: level <= 1 ? `var(--${PREFIX_CLS}menu-group-padding-x)` : `calc(${level} * var(--${PREFIX_CLS}menu-group-padding-level))`
|
|
636
721
|
}, style)
|
|
637
722
|
}, rest), {
|
|
638
723
|
children: [
|
|
639
|
-
icon && /* @__PURE__ */ (0,
|
|
640
|
-
/* @__PURE__ */ (0,
|
|
724
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${PREFIX_CLS}menu-group__icon`, children: icon }),
|
|
725
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${PREFIX_CLS}menu-group__content`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `${PREFIX_CLS}menu-group__title`, children: title }) })
|
|
641
726
|
]
|
|
642
727
|
})
|
|
643
728
|
),
|
|
@@ -647,7 +732,7 @@ var MenuGroup = (_a) => {
|
|
|
647
732
|
var MenuGroup_default = MenuGroup;
|
|
648
733
|
|
|
649
734
|
// src/components/Menu/Menu.tsx
|
|
650
|
-
var
|
|
735
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
651
736
|
var Menu = (_a) => {
|
|
652
737
|
var _b = _a, {
|
|
653
738
|
children,
|
|
@@ -673,12 +758,12 @@ var Menu = (_a) => {
|
|
|
673
758
|
"onItemSelect"
|
|
674
759
|
]);
|
|
675
760
|
var _a2;
|
|
676
|
-
const [selfValue, setSelfValue] = (0,
|
|
677
|
-
const [selfOpenValues, setSelfOpenValues] = (0,
|
|
678
|
-
const content = (0,
|
|
761
|
+
const [selfValue, setSelfValue] = (0, import_react19.useState)((_a2 = valueProp != null ? valueProp : defaultValue) != null ? _a2 : []);
|
|
762
|
+
const [selfOpenValues, setSelfOpenValues] = (0, import_react19.useState)(openValuesProp != null ? openValuesProp : []);
|
|
763
|
+
const content = (0, import_react19.useMemo)(() => {
|
|
679
764
|
return items == null ? void 0 : items.map((_a3, index) => {
|
|
680
765
|
var _b2 = _a3, { type } = _b2, item = __objRest(_b2, ["type"]);
|
|
681
|
-
return type === "item" ? /* @__PURE__ */ (0,
|
|
766
|
+
return type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuItem_default, __spreadValues({}, item), index) : type === "submenu" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuSubmenu_default, __spreadValues({}, item), index) : type === "group" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuGroup_default, __spreadValues({}, item), index) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuItem_default, __spreadValues({}, item), index);
|
|
682
767
|
});
|
|
683
768
|
}, [items]);
|
|
684
769
|
const handleChange = (value) => {
|
|
@@ -698,17 +783,17 @@ var Menu = (_a) => {
|
|
|
698
783
|
const handleItemSelect = (props) => {
|
|
699
784
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
700
785
|
};
|
|
701
|
-
(0,
|
|
786
|
+
(0, import_react19.useEffect)(() => {
|
|
702
787
|
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
703
788
|
setSelfValue(valueProp);
|
|
704
789
|
}
|
|
705
790
|
}, [valueProp]);
|
|
706
|
-
(0,
|
|
791
|
+
(0, import_react19.useEffect)(() => {
|
|
707
792
|
if (openValuesProp !== void 0) {
|
|
708
793
|
setSelfOpenValues(openValuesProp);
|
|
709
794
|
}
|
|
710
795
|
}, [openValuesProp]);
|
|
711
|
-
return /* @__PURE__ */ (0,
|
|
796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
712
797
|
MenuContext_default.Provider,
|
|
713
798
|
{
|
|
714
799
|
value: {
|
|
@@ -721,7 +806,7 @@ var Menu = (_a) => {
|
|
|
721
806
|
onChange: handleChange,
|
|
722
807
|
onItemSelect: handleItemSelect
|
|
723
808
|
},
|
|
724
|
-
children: /* @__PURE__ */ (0,
|
|
809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", __spreadProps(__spreadValues({ className: (0, import_clsx11.default)(`${PREFIX_CLS}menu`) }, rest), { children: content || children }))
|
|
725
810
|
}
|
|
726
811
|
);
|
|
727
812
|
};
|
|
@@ -729,15 +814,15 @@ Menu.displayName = "Menu";
|
|
|
729
814
|
var Menu_default = Menu;
|
|
730
815
|
|
|
731
816
|
// src/components/Tabs/Tab.tsx
|
|
732
|
-
var
|
|
817
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
733
818
|
var import_merge_refs = __toESM(require("merge-refs"));
|
|
734
|
-
var
|
|
819
|
+
var import_react23 = require("react");
|
|
735
820
|
|
|
736
821
|
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
737
|
-
var
|
|
822
|
+
var import_react21 = __toESM(require("react"));
|
|
738
823
|
|
|
739
824
|
// ../../../node_modules/react-icons/lib/esm/iconContext.js
|
|
740
|
-
var
|
|
825
|
+
var import_react20 = __toESM(require("react"));
|
|
741
826
|
var DefaultContext = {
|
|
742
827
|
color: void 0,
|
|
743
828
|
size: void 0,
|
|
@@ -745,7 +830,7 @@ var DefaultContext = {
|
|
|
745
830
|
style: void 0,
|
|
746
831
|
attr: void 0
|
|
747
832
|
};
|
|
748
|
-
var IconContext =
|
|
833
|
+
var IconContext = import_react20.default.createContext && import_react20.default.createContext(DefaultContext);
|
|
749
834
|
|
|
750
835
|
// ../../../node_modules/react-icons/lib/esm/iconBase.js
|
|
751
836
|
var __assign = function() {
|
|
@@ -774,14 +859,14 @@ var __rest = function(s, e) {
|
|
|
774
859
|
};
|
|
775
860
|
function Tree2Element(tree) {
|
|
776
861
|
return tree && tree.map(function(node, i) {
|
|
777
|
-
return
|
|
862
|
+
return import_react21.default.createElement(node.tag, __assign({
|
|
778
863
|
key: i
|
|
779
864
|
}, node.attr), Tree2Element(node.child));
|
|
780
865
|
});
|
|
781
866
|
}
|
|
782
867
|
function GenIcon(data) {
|
|
783
868
|
return function(props) {
|
|
784
|
-
return
|
|
869
|
+
return import_react21.default.createElement(IconBase, __assign({
|
|
785
870
|
attr: __assign({}, data.attr)
|
|
786
871
|
}, props), Tree2Element(data.child));
|
|
787
872
|
};
|
|
@@ -795,7 +880,7 @@ function IconBase(props) {
|
|
|
795
880
|
className = conf.className;
|
|
796
881
|
if (props.className)
|
|
797
882
|
className = (className ? className + " " : "") + props.className;
|
|
798
|
-
return
|
|
883
|
+
return import_react21.default.createElement("svg", __assign({
|
|
799
884
|
stroke: "currentColor",
|
|
800
885
|
fill: "currentColor",
|
|
801
886
|
strokeWidth: "0"
|
|
@@ -807,9 +892,9 @@ function IconBase(props) {
|
|
|
807
892
|
height: computedSize,
|
|
808
893
|
width: computedSize,
|
|
809
894
|
xmlns: "http://www.w3.org/2000/svg"
|
|
810
|
-
}), title &&
|
|
895
|
+
}), title && import_react21.default.createElement("title", null, title), props.children);
|
|
811
896
|
};
|
|
812
|
-
return IconContext !== void 0 ?
|
|
897
|
+
return IconContext !== void 0 ? import_react21.default.createElement(IconContext.Consumer, null, function(conf) {
|
|
813
898
|
return elem(conf);
|
|
814
899
|
}) : elem(DefaultContext);
|
|
815
900
|
}
|
|
@@ -820,10 +905,10 @@ function TbX(props) {
|
|
|
820
905
|
}
|
|
821
906
|
|
|
822
907
|
// src/components/Tabs/TabsContext.ts
|
|
823
|
-
var
|
|
824
|
-
var TabsContext = (0,
|
|
908
|
+
var import_react22 = require("react");
|
|
909
|
+
var TabsContext = (0, import_react22.createContext)(null);
|
|
825
910
|
var useTabs = () => {
|
|
826
|
-
const context = (0,
|
|
911
|
+
const context = (0, import_react22.useContext)(TabsContext);
|
|
827
912
|
if (!context) {
|
|
828
913
|
throw new Error("`useTabs` must be used within a `<Tabs />`");
|
|
829
914
|
}
|
|
@@ -831,8 +916,8 @@ var useTabs = () => {
|
|
|
831
916
|
};
|
|
832
917
|
|
|
833
918
|
// src/components/Tabs/Tab.tsx
|
|
834
|
-
var
|
|
835
|
-
var Tab = (0,
|
|
919
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
920
|
+
var Tab = (0, import_react23.forwardRef)(
|
|
836
921
|
(_a, ref) => {
|
|
837
922
|
var _b = _a, {
|
|
838
923
|
as: Component = "div",
|
|
@@ -853,8 +938,8 @@ var Tab = (0, import_react20.forwardRef)(
|
|
|
853
938
|
"disabled",
|
|
854
939
|
"onClick"
|
|
855
940
|
]);
|
|
856
|
-
const tabRef = (0,
|
|
857
|
-
const id = (0,
|
|
941
|
+
const tabRef = (0, import_react23.useRef)(null);
|
|
942
|
+
const id = (0, import_react23.useId)();
|
|
858
943
|
const value = valueProp != null ? valueProp : id;
|
|
859
944
|
const _a2 = useTabs(), { onClose, registerItem } = _a2, tabs = __objRest(_a2, ["onClose", "registerItem"]);
|
|
860
945
|
const handleClick = (event) => {
|
|
@@ -895,17 +980,17 @@ var Tab = (0, import_react20.forwardRef)(
|
|
|
895
980
|
event.stopPropagation();
|
|
896
981
|
onClose(value);
|
|
897
982
|
};
|
|
898
|
-
(0,
|
|
983
|
+
(0, import_react23.useEffect)(() => {
|
|
899
984
|
registerItem({ value, disabled });
|
|
900
985
|
if (value === tabs.value) {
|
|
901
986
|
tabs.previousTabRef.current = tabRef.current;
|
|
902
987
|
}
|
|
903
988
|
}, [value, tabs.value]);
|
|
904
|
-
return /* @__PURE__ */ (0,
|
|
989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
905
990
|
Component,
|
|
906
991
|
__spreadProps(__spreadValues({
|
|
907
992
|
ref: (0, import_merge_refs.default)(tabRef, ref, (el) => tabs.tabRefs.current[value] = el),
|
|
908
|
-
className: (0,
|
|
993
|
+
className: (0, import_clsx12.default)(
|
|
909
994
|
`${PREFIX_CLS}tab`,
|
|
910
995
|
{ [`${PREFIX_CLS}tab--selected`]: value === tabs.value, [`${PREFIX_CLS}tab--disabled`]: disabled },
|
|
911
996
|
className
|
|
@@ -914,12 +999,12 @@ var Tab = (0, import_react20.forwardRef)(
|
|
|
914
999
|
onClick: handleClick
|
|
915
1000
|
}, rest), {
|
|
916
1001
|
children: [
|
|
917
|
-
/* @__PURE__ */ (0,
|
|
918
|
-
/* @__PURE__ */ (0,
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}overlay`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}overlay__surface` }) }),
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${PREFIX_CLS}tab__content`, children: [
|
|
919
1004
|
children,
|
|
920
|
-
closable && /* @__PURE__ */ (0,
|
|
1005
|
+
closable && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Button, { variant: "text", color: "secondary", iconOnly: true, size: "xs", onClick: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon_default, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TbX, {}) }) })
|
|
921
1006
|
] }),
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `${PREFIX_CLS}tab__indicator` })
|
|
923
1008
|
]
|
|
924
1009
|
})
|
|
925
1010
|
);
|
|
@@ -927,8 +1012,8 @@ var Tab = (0, import_react20.forwardRef)(
|
|
|
927
1012
|
);
|
|
928
1013
|
|
|
929
1014
|
// src/components/Tabs/Tabs.tsx
|
|
930
|
-
var
|
|
931
|
-
var
|
|
1015
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
1016
|
+
var import_react24 = require("react");
|
|
932
1017
|
|
|
933
1018
|
// src/utils/scroll.ts
|
|
934
1019
|
var scrollToItem = (parentElement, currentElement) => {
|
|
@@ -956,7 +1041,7 @@ var scrollToItem = (parentElement, currentElement) => {
|
|
|
956
1041
|
};
|
|
957
1042
|
|
|
958
1043
|
// src/components/Tabs/Tabs.tsx
|
|
959
|
-
var
|
|
1044
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
960
1045
|
var Tabs = (_a) => {
|
|
961
1046
|
var _b = _a, {
|
|
962
1047
|
children,
|
|
@@ -975,11 +1060,11 @@ var Tabs = (_a) => {
|
|
|
975
1060
|
"onChange",
|
|
976
1061
|
"onClose"
|
|
977
1062
|
]);
|
|
978
|
-
const tabsRef = (0,
|
|
979
|
-
const tabRefs = (0,
|
|
980
|
-
const previousTabRef = (0,
|
|
981
|
-
const [selfValue, setSelfValue] = (0,
|
|
982
|
-
const [items, setItems] = (0,
|
|
1063
|
+
const tabsRef = (0, import_react24.useRef)(null);
|
|
1064
|
+
const tabRefs = (0, import_react24.useRef)({});
|
|
1065
|
+
const previousTabRef = (0, import_react24.useRef)(null);
|
|
1066
|
+
const [selfValue, setSelfValue] = (0, import_react24.useState)(value != null ? value : defaultValue);
|
|
1067
|
+
const [items, setItems] = (0, import_react24.useState)([]);
|
|
983
1068
|
const registerItem = (item) => {
|
|
984
1069
|
setItems((prevItems) => {
|
|
985
1070
|
const index = prevItems.findIndex((item2) => item2.value);
|
|
@@ -1006,52 +1091,71 @@ var Tabs = (_a) => {
|
|
|
1006
1091
|
const handleClose = (value2) => {
|
|
1007
1092
|
onClose == null ? void 0 : onClose(value2);
|
|
1008
1093
|
};
|
|
1009
|
-
(0,
|
|
1094
|
+
(0, import_react24.useEffect)(() => {
|
|
1010
1095
|
if (value !== void 0) {
|
|
1011
1096
|
setSelfValue(value);
|
|
1012
1097
|
scrollToTab(value);
|
|
1013
1098
|
}
|
|
1014
1099
|
}, [value]);
|
|
1015
|
-
(0,
|
|
1100
|
+
(0, import_react24.useEffect)(() => {
|
|
1016
1101
|
if (value === void 0) {
|
|
1017
1102
|
const item = items.find((tab) => !tab.disabled);
|
|
1018
1103
|
setSelfValue(item == null ? void 0 : item.value);
|
|
1019
1104
|
}
|
|
1020
1105
|
}, [value, items]);
|
|
1021
|
-
return /* @__PURE__ */ (0,
|
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1022
1107
|
TabsContext.Provider,
|
|
1023
1108
|
{
|
|
1024
1109
|
value: { previousTabRef, tabRefs, value: selfValue, onChange: handleChange, onClose: handleClose, registerItem },
|
|
1025
1110
|
children: [
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1111
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1027
1112
|
"div",
|
|
1028
1113
|
__spreadProps(__spreadValues({
|
|
1029
1114
|
ref: tabsRef,
|
|
1030
|
-
className: (0,
|
|
1115
|
+
className: (0, import_clsx13.default)(`${PREFIX_CLS}tabs`, { [`${PREFIX_CLS}tabs--${alignment}`]: alignment }, className)
|
|
1031
1116
|
}, rest), {
|
|
1032
1117
|
children
|
|
1033
1118
|
})
|
|
1034
1119
|
),
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: `${PREFIX_CLS}divider` })
|
|
1036
1121
|
]
|
|
1037
1122
|
}
|
|
1038
1123
|
);
|
|
1039
1124
|
};
|
|
1040
1125
|
|
|
1126
|
+
// src/components/Toolbar/Toolbar.tsx
|
|
1127
|
+
var import_clsx14 = __toESM(require("clsx"));
|
|
1128
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1129
|
+
var Toolbar = (props) => {
|
|
1130
|
+
const _a = props, { children, className, size = "md", startAction, endAction, title, subtitle } = _a, rest = __objRest(_a, ["children", "className", "size", "startAction", "endAction", "title", "subtitle"]);
|
|
1131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", __spreadProps(__spreadValues({ className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar`, { [`${PREFIX_CLS}toolbar--${size}`]: size }, className) }, rest), { children: [
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: `${PREFIX_CLS}outline-b` }),
|
|
1133
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar__container`), children: [
|
|
1134
|
+
startAction && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar__start-action`), children: startAction }),
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar__content`), children: title || subtitle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
1136
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar__title`), children: title }),
|
|
1137
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar__subtitle`), children: subtitle })
|
|
1138
|
+
] }) : children }),
|
|
1139
|
+
endAction && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_clsx14.default)(`${PREFIX_CLS}toolbar__trailing`), children: endAction })
|
|
1140
|
+
] })
|
|
1141
|
+
] }));
|
|
1142
|
+
};
|
|
1143
|
+
var Toolbar_default = Toolbar;
|
|
1144
|
+
|
|
1041
1145
|
// src/hooks/useLocalStorage.tsx
|
|
1042
|
-
var
|
|
1146
|
+
var import_react27 = require("react");
|
|
1043
1147
|
|
|
1044
1148
|
// src/hooks/useEventListener.tsx
|
|
1045
|
-
var
|
|
1149
|
+
var import_react26 = require("react");
|
|
1046
1150
|
|
|
1047
1151
|
// src/hooks/useIsomorphicLayoutEffect.tsx
|
|
1048
|
-
var
|
|
1049
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
1152
|
+
var import_react25 = require("react");
|
|
1153
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react25.useLayoutEffect : import_react25.useEffect;
|
|
1050
1154
|
var useIsomorphicLayoutEffect_default = useIsomorphicLayoutEffect;
|
|
1051
1155
|
|
|
1052
1156
|
// src/hooks/useEventListener.tsx
|
|
1053
1157
|
function useEventListener(handler) {
|
|
1054
|
-
const savedHandler = (0,
|
|
1158
|
+
const savedHandler = (0, import_react26.useRef)(handler);
|
|
1055
1159
|
useIsomorphicLayoutEffect_default(() => {
|
|
1056
1160
|
savedHandler.current = handler;
|
|
1057
1161
|
}, [handler]);
|
|
@@ -1060,7 +1164,7 @@ var useEventListener_default = useEventListener;
|
|
|
1060
1164
|
|
|
1061
1165
|
// src/hooks/useLocalStorage.tsx
|
|
1062
1166
|
function useLocalStorage(key, initialValue) {
|
|
1063
|
-
const readValue = (0,
|
|
1167
|
+
const readValue = (0, import_react27.useCallback)(() => {
|
|
1064
1168
|
if (typeof window === "undefined") {
|
|
1065
1169
|
return initialValue;
|
|
1066
1170
|
}
|
|
@@ -1072,8 +1176,8 @@ function useLocalStorage(key, initialValue) {
|
|
|
1072
1176
|
return initialValue;
|
|
1073
1177
|
}
|
|
1074
1178
|
}, [initialValue, key]);
|
|
1075
|
-
const [storedValue, setStoredValue] = (0,
|
|
1076
|
-
const setValue = (0,
|
|
1179
|
+
const [storedValue, setStoredValue] = (0, import_react27.useState)(readValue);
|
|
1180
|
+
const setValue = (0, import_react27.useCallback)(
|
|
1077
1181
|
(value) => {
|
|
1078
1182
|
if (typeof window == "undefined") {
|
|
1079
1183
|
console.warn(`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`);
|
|
@@ -1089,10 +1193,10 @@ function useLocalStorage(key, initialValue) {
|
|
|
1089
1193
|
},
|
|
1090
1194
|
[key, storedValue]
|
|
1091
1195
|
);
|
|
1092
|
-
(0,
|
|
1196
|
+
(0, import_react27.useEffect)(() => {
|
|
1093
1197
|
setStoredValue(readValue());
|
|
1094
1198
|
}, []);
|
|
1095
|
-
const handleStorageChange = (0,
|
|
1199
|
+
const handleStorageChange = (0, import_react27.useCallback)(() => {
|
|
1096
1200
|
setStoredValue(readValue());
|
|
1097
1201
|
}, [readValue]);
|
|
1098
1202
|
useEventListener_default("storage", handleStorageChange);
|
|
@@ -1109,22 +1213,22 @@ function parseJSON(value) {
|
|
|
1109
1213
|
}
|
|
1110
1214
|
|
|
1111
1215
|
// src/hooks/usePrevious.tsx
|
|
1112
|
-
var
|
|
1216
|
+
var import_react28 = require("react");
|
|
1113
1217
|
var usePrevious = (value) => {
|
|
1114
|
-
const ref = (0,
|
|
1115
|
-
(0,
|
|
1218
|
+
const ref = (0, import_react28.useRef)();
|
|
1219
|
+
(0, import_react28.useEffect)(() => {
|
|
1116
1220
|
ref.current = value;
|
|
1117
1221
|
});
|
|
1118
1222
|
return ref.current;
|
|
1119
1223
|
};
|
|
1120
1224
|
|
|
1121
1225
|
// src/hooks/useStep.tsx
|
|
1122
|
-
var
|
|
1226
|
+
var import_react29 = require("react");
|
|
1123
1227
|
var useStep = (maxStep) => {
|
|
1124
|
-
const [currentStep, setCurrentStep] = (0,
|
|
1125
|
-
const canGoToNextStep = (0,
|
|
1126
|
-
const canGoToPrevStep = (0,
|
|
1127
|
-
const setStep = (0,
|
|
1228
|
+
const [currentStep, setCurrentStep] = (0, import_react29.useState)(1);
|
|
1229
|
+
const canGoToNextStep = (0, import_react29.useMemo)(() => currentStep + 1 <= maxStep, [currentStep, maxStep]);
|
|
1230
|
+
const canGoToPrevStep = (0, import_react29.useMemo)(() => currentStep - 1 >= 1, [currentStep]);
|
|
1231
|
+
const setStep = (0, import_react29.useCallback)(
|
|
1128
1232
|
(step) => {
|
|
1129
1233
|
const newStep = step instanceof Function ? step(currentStep) : step;
|
|
1130
1234
|
if (newStep >= 1 && newStep <= maxStep) {
|
|
@@ -1135,17 +1239,17 @@ var useStep = (maxStep) => {
|
|
|
1135
1239
|
},
|
|
1136
1240
|
[maxStep, currentStep]
|
|
1137
1241
|
);
|
|
1138
|
-
const goToNextStep = (0,
|
|
1242
|
+
const goToNextStep = (0, import_react29.useCallback)(() => {
|
|
1139
1243
|
if (canGoToNextStep) {
|
|
1140
1244
|
setCurrentStep((step) => step + 1);
|
|
1141
1245
|
}
|
|
1142
1246
|
}, [canGoToNextStep]);
|
|
1143
|
-
const goToPrevStep = (0,
|
|
1247
|
+
const goToPrevStep = (0, import_react29.useCallback)(() => {
|
|
1144
1248
|
if (canGoToPrevStep) {
|
|
1145
1249
|
setCurrentStep((step) => step - 1);
|
|
1146
1250
|
}
|
|
1147
1251
|
}, [canGoToPrevStep]);
|
|
1148
|
-
const reset = (0,
|
|
1252
|
+
const reset = (0, import_react29.useCallback)(() => {
|
|
1149
1253
|
setCurrentStep(1);
|
|
1150
1254
|
}, []);
|
|
1151
1255
|
return [
|
|
@@ -1162,6 +1266,7 @@ var useStep = (maxStep) => {
|
|
|
1162
1266
|
};
|
|
1163
1267
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1164
1268
|
0 && (module.exports = {
|
|
1269
|
+
Backdrop,
|
|
1165
1270
|
Badge,
|
|
1166
1271
|
Button,
|
|
1167
1272
|
Chip,
|
|
@@ -1176,8 +1281,11 @@ var useStep = (maxStep) => {
|
|
|
1176
1281
|
MenuItem,
|
|
1177
1282
|
MenuSubmenu,
|
|
1178
1283
|
MenuValueContext,
|
|
1284
|
+
Portal,
|
|
1179
1285
|
Tab,
|
|
1180
1286
|
Tabs,
|
|
1287
|
+
Toolbar,
|
|
1288
|
+
Transition,
|
|
1181
1289
|
getOpenValuesByPathname,
|
|
1182
1290
|
useCollapse,
|
|
1183
1291
|
useLocalStorage,
|