@dragunio/fe-libs 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -4
- package/dist/{chunk-3TCR34LS.mjs → chunk-GT4546FD.mjs} +29 -0
- package/dist/icons.d.mts +4 -1
- package/dist/icons.d.ts +4 -1
- package/dist/icons.js +32 -0
- package/dist/icons.mjs +7 -1
- package/dist/index.d.mts +147 -5
- package/dist/index.d.ts +147 -5
- package/dist/index.js +1263 -285
- package/dist/index.mjs +1240 -281
- package/dist/styles.css +361 -30
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ChevronDownIcon,
|
|
3
|
+
ChevronUpIcon,
|
|
3
4
|
CloseIcon,
|
|
5
|
+
MoreHorizontalIcon,
|
|
6
|
+
MoreVerticalIcon,
|
|
4
7
|
PlusIcon,
|
|
5
8
|
SearchIcon,
|
|
6
9
|
arrow_left,
|
|
@@ -20,7 +23,7 @@ import {
|
|
|
20
23
|
search,
|
|
21
24
|
trash,
|
|
22
25
|
x_close
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GT4546FD.mjs";
|
|
24
27
|
|
|
25
28
|
// packages/button/src/index.tsx
|
|
26
29
|
import { forwardRef } from "react";
|
|
@@ -88,21 +91,121 @@ var Button = forwardRef(
|
|
|
88
91
|
);
|
|
89
92
|
Button.displayName = "Button";
|
|
90
93
|
|
|
94
|
+
// packages/button-bar/src/index.tsx
|
|
95
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
96
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
97
|
+
import { createElement } from "react";
|
|
98
|
+
function ButtonBar({
|
|
99
|
+
actions,
|
|
100
|
+
maxVisible = actions.length,
|
|
101
|
+
moreButtonProps,
|
|
102
|
+
moreLabel = "More actions",
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}) {
|
|
106
|
+
const [isMoreOpen, setIsMoreOpen] = useState(false);
|
|
107
|
+
const rootRef = useRef(null);
|
|
108
|
+
const moreMenuId = useId();
|
|
109
|
+
const visibleCount = Math.max(0, Math.floor(maxVisible));
|
|
110
|
+
const visibleActions = actions.slice(0, visibleCount);
|
|
111
|
+
const overflowActions = actions.slice(visibleCount);
|
|
112
|
+
const hasOverflow = overflowActions.length > 0;
|
|
113
|
+
const {
|
|
114
|
+
onClick: onMoreClick,
|
|
115
|
+
disabled: moreDisabled,
|
|
116
|
+
"aria-label": moreAriaLabel,
|
|
117
|
+
...moreButtonRestProps
|
|
118
|
+
} = moreButtonProps ?? {};
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!isMoreOpen) return;
|
|
121
|
+
const onPointerDown = (event) => {
|
|
122
|
+
if (!rootRef.current?.contains(event.target)) {
|
|
123
|
+
setIsMoreOpen(false);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const onKeyDown = (event) => {
|
|
127
|
+
if (event.key === "Escape") setIsMoreOpen(false);
|
|
128
|
+
};
|
|
129
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
130
|
+
document.addEventListener("keydown", onKeyDown);
|
|
131
|
+
return () => {
|
|
132
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
133
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
134
|
+
};
|
|
135
|
+
}, [isMoreOpen]);
|
|
136
|
+
const renderAction = (action, shouldCloseMore = false) => {
|
|
137
|
+
const { id, onClick, disabled, ...buttonProps } = action;
|
|
138
|
+
return /* @__PURE__ */ createElement(
|
|
139
|
+
Button,
|
|
140
|
+
{
|
|
141
|
+
...buttonProps,
|
|
142
|
+
disabled,
|
|
143
|
+
key: id,
|
|
144
|
+
onClick: (event) => {
|
|
145
|
+
onClick?.(event);
|
|
146
|
+
if (shouldCloseMore && !disabled) setIsMoreOpen(false);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
};
|
|
151
|
+
return /* @__PURE__ */ jsxs2(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
...props,
|
|
155
|
+
className: ["fe-button-bar", className].filter(Boolean).join(" "),
|
|
156
|
+
ref: rootRef,
|
|
157
|
+
children: [
|
|
158
|
+
visibleActions.map((action) => renderAction(action)),
|
|
159
|
+
hasOverflow && /* @__PURE__ */ jsxs2("div", { className: "fe-button-bar__more", children: [
|
|
160
|
+
/* @__PURE__ */ jsx2(
|
|
161
|
+
Button,
|
|
162
|
+
{
|
|
163
|
+
hierarchy: "secondary-gray",
|
|
164
|
+
...moreButtonRestProps,
|
|
165
|
+
"aria-controls": moreMenuId,
|
|
166
|
+
"aria-expanded": isMoreOpen,
|
|
167
|
+
"aria-haspopup": "true",
|
|
168
|
+
"aria-label": moreAriaLabel ?? moreLabel,
|
|
169
|
+
disabled: moreDisabled,
|
|
170
|
+
icon: /* @__PURE__ */ jsx2(MoreHorizontalIcon, {}),
|
|
171
|
+
iconOnly: true,
|
|
172
|
+
onClick: (event) => {
|
|
173
|
+
onMoreClick?.(event);
|
|
174
|
+
if (!event.defaultPrevented) setIsMoreOpen((open) => !open);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
),
|
|
178
|
+
isMoreOpen && /* @__PURE__ */ jsx2(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
"aria-label": moreLabel,
|
|
182
|
+
className: "fe-button-bar__menu",
|
|
183
|
+
id: moreMenuId,
|
|
184
|
+
role: "group",
|
|
185
|
+
children: overflowActions.map((action) => renderAction(action, true))
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] })
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
91
194
|
// packages/table/src/index.tsx
|
|
92
195
|
import {
|
|
93
196
|
createContext,
|
|
94
197
|
isValidElement,
|
|
95
198
|
useCallback,
|
|
96
199
|
useContext,
|
|
97
|
-
useEffect,
|
|
200
|
+
useEffect as useEffect2,
|
|
98
201
|
useMemo as useMemo2,
|
|
99
|
-
useRef,
|
|
100
|
-
useState as
|
|
202
|
+
useRef as useRef2,
|
|
203
|
+
useState as useState3
|
|
101
204
|
} from "react";
|
|
102
205
|
|
|
103
206
|
// packages/pagination/src/index.tsx
|
|
104
|
-
import { useMemo, useState } from "react";
|
|
105
|
-
import { jsx as
|
|
207
|
+
import { useMemo, useState as useState2 } from "react";
|
|
208
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
106
209
|
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
107
210
|
var range = (start, end) => Array.from({ length: Math.max(0, end - start + 1) }, (_, index) => start + index);
|
|
108
211
|
function getItems(totalPages, page, siblingCount, boundaryCount) {
|
|
@@ -134,7 +237,7 @@ function Pagination({
|
|
|
134
237
|
...props
|
|
135
238
|
}) {
|
|
136
239
|
const safeTotalPages = Math.max(1, Math.floor(totalPages));
|
|
137
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
240
|
+
const [uncontrolledPage, setUncontrolledPage] = useState2(() => clamp(defaultPage, 1, safeTotalPages));
|
|
138
241
|
const currentPage = clamp(page ?? uncontrolledPage, 1, safeTotalPages);
|
|
139
242
|
const items = useMemo(
|
|
140
243
|
() => getItems(safeTotalPages, currentPage, Math.max(0, siblingCount), Math.max(0, boundaryCount)),
|
|
@@ -145,9 +248,9 @@ function Pagination({
|
|
|
145
248
|
if (page === void 0) setUncontrolledPage(resolvedPage);
|
|
146
249
|
if (resolvedPage !== currentPage) onPageChange?.(resolvedPage);
|
|
147
250
|
};
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
-
items.map((item, index) => item === "start-ellipsis" || item === "end-ellipsis" ? /* @__PURE__ */
|
|
251
|
+
return /* @__PURE__ */ jsxs3("nav", { className: ["fe-pagination", className].filter(Boolean).join(" "), "aria-label": "Pagination", ...props, children: [
|
|
252
|
+
/* @__PURE__ */ jsx3(Button, { className: "fe-pagination__button fe-pagination__button--control", hierarchy: "secondary-gray", size: "40", iconOnly: true, icon: "\u2039", "aria-label": previousLabel, disabled: disabled || currentPage === 1, onClick: () => selectPage(currentPage - 1) }),
|
|
253
|
+
items.map((item, index) => item === "start-ellipsis" || item === "end-ellipsis" ? /* @__PURE__ */ jsx3("span", { className: "fe-pagination__ellipsis", "aria-hidden": "true", children: "\u2026" }, `${item}-${index}`) : /* @__PURE__ */ jsx3(
|
|
151
254
|
Button,
|
|
152
255
|
{
|
|
153
256
|
className: "fe-pagination__button",
|
|
@@ -161,12 +264,12 @@ function Pagination({
|
|
|
161
264
|
},
|
|
162
265
|
item
|
|
163
266
|
)),
|
|
164
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ jsx3(Button, { className: "fe-pagination__button fe-pagination__button--control", hierarchy: "secondary-gray", size: "40", iconOnly: true, icon: "\u203A", "aria-label": nextLabel, disabled: disabled || currentPage === safeTotalPages, onClick: () => selectPage(currentPage + 1) })
|
|
165
268
|
] });
|
|
166
269
|
}
|
|
167
270
|
|
|
168
271
|
// packages/table/src/index.tsx
|
|
169
|
-
import { jsx as
|
|
272
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
170
273
|
var TableContext = createContext({ striped: false });
|
|
171
274
|
var MIN_COLUMN_WIDTH = 96;
|
|
172
275
|
var MAX_COLUMN_WIDTH = 1200;
|
|
@@ -216,24 +319,24 @@ function DataTable({
|
|
|
216
319
|
() => getInitialColumnSizes(headers, data, defaultColumnSizes, safeMinWidth),
|
|
217
320
|
[headers, data, defaultColumnSizes, safeMinWidth]
|
|
218
321
|
);
|
|
219
|
-
const [uncontrolledSizes, setUncontrolledSizes] =
|
|
322
|
+
const [uncontrolledSizes, setUncontrolledSizes] = useState3(generatedSizes);
|
|
220
323
|
const shouldPaginate = pagination ?? pageSize !== void 0;
|
|
221
324
|
const safePageSize = Math.max(1, Math.floor(pageSize ?? 10));
|
|
222
325
|
const totalPages = Math.max(1, Math.ceil(data.length / safePageSize));
|
|
223
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
326
|
+
const [uncontrolledPage, setUncontrolledPage] = useState3(() => Math.min(Math.max(1, defaultPage), totalPages));
|
|
224
327
|
const currentPage = Math.min(Math.max(1, page ?? uncontrolledPage), totalPages);
|
|
225
328
|
const pagedData = shouldPaginate ? data.slice((currentPage - 1) * safePageSize, currentPage * safePageSize) : data;
|
|
226
|
-
const resizeState =
|
|
227
|
-
const [isResizing, setIsResizing] =
|
|
329
|
+
const resizeState = useRef2();
|
|
330
|
+
const [isResizing, setIsResizing] = useState3(false);
|
|
228
331
|
const sizes2 = columnSizes ? getInitialColumnSizes(headers, data, columnSizes, safeMinWidth).map((size) => Math.max(safeMinWidth, size)) : uncontrolledSizes.map((size) => Math.max(safeMinWidth, size));
|
|
229
|
-
|
|
332
|
+
useEffect2(() => {
|
|
230
333
|
if (columnSizes) return;
|
|
231
334
|
setUncontrolledSizes((currentSizes) => {
|
|
232
335
|
const nextSizes = generatedSizes.map((generatedSize, index) => currentSizes[index] ?? generatedSize);
|
|
233
336
|
return sameSizes(currentSizes, nextSizes) ? currentSizes : nextSizes;
|
|
234
337
|
});
|
|
235
338
|
}, [columnSizes, generatedSizes]);
|
|
236
|
-
|
|
339
|
+
useEffect2(() => {
|
|
237
340
|
if (page === void 0 && uncontrolledPage > totalPages) setUncontrolledPage(totalPages);
|
|
238
341
|
}, [page, totalPages, uncontrolledPage]);
|
|
239
342
|
const updateColumnSize = useCallback((columnIndex, nextSize) => {
|
|
@@ -242,7 +345,7 @@ function DataTable({
|
|
|
242
345
|
if (!columnSizes) setUncontrolledSizes(nextSizes);
|
|
243
346
|
onColumnResize?.(nextSizes, columnIndex);
|
|
244
347
|
}, [columnSizes, onColumnResize, safeMinWidth, sizes2]);
|
|
245
|
-
|
|
348
|
+
useEffect2(() => {
|
|
246
349
|
const onPointerMove = (event) => {
|
|
247
350
|
const activeResize = resizeState.current;
|
|
248
351
|
if (!activeResize) return;
|
|
@@ -266,14 +369,14 @@ function DataTable({
|
|
|
266
369
|
if (nextPage !== currentPage) onPageChange?.(nextPage);
|
|
267
370
|
};
|
|
268
371
|
const resolvedPaginationPosition = paginationPosition === "middle-bottom" ? "bottom-center" : paginationPosition;
|
|
269
|
-
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */
|
|
270
|
-
return /* @__PURE__ */
|
|
372
|
+
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */ jsx4("div", { className: `fe-table__pagination fe-table__pagination--${resolvedPaginationPosition}`, children: /* @__PURE__ */ jsx4(Pagination, { page: currentPage, totalPages, onPageChange: changePage }) }) : null;
|
|
373
|
+
return /* @__PURE__ */ jsxs4("div", { className: "fe-table", "data-resizing": isResizing || void 0, children: [
|
|
271
374
|
resolvedPaginationPosition === "top-right" && paginationControl,
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ jsxs4("table", { className: ["fe-table__table", className].filter(Boolean).join(" "), "data-fe-table": true, "data-striped": striped || void 0, ...props, children: [
|
|
376
|
+
/* @__PURE__ */ jsx4("colgroup", { children: sizes2.map((size, index) => /* @__PURE__ */ jsx4("col", { style: { width: `${size}px` } }, index)) }),
|
|
377
|
+
/* @__PURE__ */ jsx4("thead", { children: /* @__PURE__ */ jsx4("tr", { children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ jsxs4("th", { scope: "col", children: [
|
|
378
|
+
/* @__PURE__ */ jsx4("span", { className: "fe-table__header-content", children: headers[columnIndex] ?? `Column ${columnIndex + 1}` }),
|
|
379
|
+
/* @__PURE__ */ jsx4(
|
|
277
380
|
"span",
|
|
278
381
|
{
|
|
279
382
|
className: "fe-table__resize-handle",
|
|
@@ -297,7 +400,7 @@ function DataTable({
|
|
|
297
400
|
}
|
|
298
401
|
)
|
|
299
402
|
] }, columnIndex)) }) }),
|
|
300
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ jsx4("tbody", { children: pagedData.map((row, rowIndex) => /* @__PURE__ */ jsx4("tr", { children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ jsx4("td", { children: row[columnIndex] }, columnIndex)) }, shouldPaginate ? (currentPage - 1) * safePageSize + rowIndex : rowIndex)) })
|
|
301
404
|
] }),
|
|
302
405
|
resolvedPaginationPosition !== "top-right" && paginationControl
|
|
303
406
|
] });
|
|
@@ -315,52 +418,73 @@ function Table({
|
|
|
315
418
|
paginationPosition,
|
|
316
419
|
...props
|
|
317
420
|
}) {
|
|
318
|
-
if (headers || data) return /* @__PURE__ */
|
|
319
|
-
return /* @__PURE__ */
|
|
421
|
+
if (headers || data) return /* @__PURE__ */ jsx4(DataTable, { headers: headers ?? [], data: data ?? [], striped: striped ?? true, pagination, pageSize, page, defaultPage, onPageChange, paginationPosition, ...props });
|
|
422
|
+
return /* @__PURE__ */ jsx4(TableContext.Provider, { value: { striped: striped ?? false }, children: /* @__PURE__ */ jsx4("table", { "data-fe-table": true, "data-striped": striped || void 0, ...props, children }) });
|
|
320
423
|
}
|
|
321
424
|
function TableHead(props) {
|
|
322
|
-
return /* @__PURE__ */
|
|
425
|
+
return /* @__PURE__ */ jsx4("thead", { ...props });
|
|
323
426
|
}
|
|
324
427
|
function TableBody(props) {
|
|
325
|
-
return /* @__PURE__ */
|
|
428
|
+
return /* @__PURE__ */ jsx4("tbody", { ...props });
|
|
326
429
|
}
|
|
327
430
|
function TableRow({ children, ...props }) {
|
|
328
431
|
const { striped } = useContext(TableContext);
|
|
329
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx4("tr", { "data-striped": striped || void 0, ...props, children });
|
|
330
433
|
}
|
|
331
434
|
function TableCell({ children, ...props }) {
|
|
332
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ jsx4("td", { ...props, children });
|
|
333
436
|
}
|
|
334
437
|
function TableHeader({ children, ...props }) {
|
|
335
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ jsx4("th", { scope: "col", ...props, children });
|
|
336
439
|
}
|
|
337
440
|
function TableCaption(props) {
|
|
338
|
-
return /* @__PURE__ */
|
|
441
|
+
return /* @__PURE__ */ jsx4("caption", { ...props });
|
|
339
442
|
}
|
|
340
443
|
|
|
341
444
|
// packages/toggle/src/index.tsx
|
|
342
|
-
import {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
445
|
+
import {
|
|
446
|
+
forwardRef as forwardRef2
|
|
447
|
+
} from "react";
|
|
448
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
449
|
+
var Toggle = forwardRef2(function Toggle2({
|
|
450
|
+
color = "#16a34a",
|
|
451
|
+
label,
|
|
452
|
+
labelPosition = "right",
|
|
453
|
+
className,
|
|
454
|
+
style,
|
|
455
|
+
id,
|
|
456
|
+
...props
|
|
457
|
+
}, ref) {
|
|
458
|
+
const classes = ["fe-toggle", `fe-toggle--label-${labelPosition}`, className].filter(Boolean).join(" ");
|
|
346
459
|
const toggleStyle = {
|
|
347
460
|
"--fe-toggle-color": color,
|
|
348
461
|
...style
|
|
349
462
|
};
|
|
350
|
-
return /* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
353
|
-
|
|
463
|
+
return /* @__PURE__ */ jsxs5("label", { className: classes, style: toggleStyle, children: [
|
|
464
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsx5("span", { className: "fe-toggle__label", children: label }),
|
|
465
|
+
/* @__PURE__ */ jsx5(
|
|
466
|
+
"input",
|
|
467
|
+
{
|
|
468
|
+
ref,
|
|
469
|
+
id,
|
|
470
|
+
className: "fe-toggle__input",
|
|
471
|
+
type: "checkbox",
|
|
472
|
+
role: "switch",
|
|
473
|
+
...props
|
|
474
|
+
}
|
|
475
|
+
),
|
|
476
|
+
/* @__PURE__ */ jsx5("span", { className: "fe-toggle__control", "aria-hidden": "true" }),
|
|
477
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx5("span", { className: "fe-toggle__label", children: label })
|
|
354
478
|
] });
|
|
355
479
|
});
|
|
356
480
|
Toggle.displayName = "Toggle";
|
|
357
481
|
|
|
358
482
|
// packages/drawer/src/index.tsx
|
|
359
|
-
import { useEffect as
|
|
483
|
+
import { useEffect as useEffect3 } from "react";
|
|
360
484
|
import { createPortal } from "react-dom";
|
|
361
|
-
import { jsx as
|
|
485
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
362
486
|
function Drawer({ open, onClose, title, footer, side = "right", width = 400, fullScreen = false, children, closeOnBackdropClick = true, className, style, ...props }) {
|
|
363
|
-
|
|
487
|
+
useEffect3(() => {
|
|
364
488
|
if (!open) return;
|
|
365
489
|
const onKeyDown = (event) => {
|
|
366
490
|
if (event.key === "Escape") onClose();
|
|
@@ -370,27 +494,27 @@ function Drawer({ open, onClose, title, footer, side = "right", width = 400, ful
|
|
|
370
494
|
}, [onClose, open]);
|
|
371
495
|
if (!open || typeof document === "undefined") return null;
|
|
372
496
|
const panelStyle = !fullScreen && (side === "left" || side === "right") ? { ...style, width: typeof width === "number" ? `${width}px` : width } : style;
|
|
373
|
-
return createPortal(/* @__PURE__ */
|
|
497
|
+
return createPortal(/* @__PURE__ */ jsx6("div", { className: "fe-drawer-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
374
498
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
375
|
-
}, children: /* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
title && /* @__PURE__ */
|
|
378
|
-
/* @__PURE__ */
|
|
499
|
+
}, children: /* @__PURE__ */ jsxs6("aside", { className: ["fe-drawer", `fe-drawer--${side}`, fullScreen && "fe-drawer--full-screen", className].filter(Boolean).join(" "), style: panelStyle, role: "dialog", "aria-modal": "true", "aria-label": typeof title === "string" ? title : "Drawer", ...props, children: [
|
|
500
|
+
/* @__PURE__ */ jsxs6("header", { className: "fe-drawer__header", children: [
|
|
501
|
+
title && /* @__PURE__ */ jsx6("h2", { children: title }),
|
|
502
|
+
/* @__PURE__ */ jsx6("button", { type: "button", "aria-label": "Close drawer", onClick: onClose, children: "\xD7" })
|
|
379
503
|
] }),
|
|
380
|
-
/* @__PURE__ */
|
|
381
|
-
footer && /* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ jsx6("div", { className: "fe-drawer__body", children }),
|
|
505
|
+
footer && /* @__PURE__ */ jsx6("footer", { className: "fe-drawer__footer", children: footer })
|
|
382
506
|
] }) }), document.body);
|
|
383
507
|
}
|
|
384
508
|
|
|
385
509
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
386
|
-
import { forwardRef as forwardRef3, useId as
|
|
510
|
+
import { forwardRef as forwardRef3, useId as useId3, useState as useState5 } from "react";
|
|
387
511
|
|
|
388
512
|
// packages/tooltip/src/index.tsx
|
|
389
|
-
import { cloneElement, useId, useState as
|
|
390
|
-
import { jsx as
|
|
513
|
+
import { cloneElement, useId as useId2, useState as useState4 } from "react";
|
|
514
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
391
515
|
function Tooltip({ content, children, placement = "top", disabled, className, ...props }) {
|
|
392
|
-
const [visible, setVisible] =
|
|
393
|
-
const id =
|
|
516
|
+
const [visible, setVisible] = useState4(false);
|
|
517
|
+
const id = useId2();
|
|
394
518
|
const trigger = cloneElement(children, { "aria-describedby": visible ? id : void 0, onMouseEnter: (event) => {
|
|
395
519
|
children.props.onMouseEnter?.(event);
|
|
396
520
|
setVisible(true);
|
|
@@ -404,14 +528,14 @@ function Tooltip({ content, children, placement = "top", disabled, className, ..
|
|
|
404
528
|
children.props.onBlur?.(event);
|
|
405
529
|
setVisible(false);
|
|
406
530
|
} });
|
|
407
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ jsxs7("span", { className: ["fe-tooltip", `fe-tooltip--${placement}`, className].filter(Boolean).join(" "), ...props, children: [
|
|
408
532
|
trigger,
|
|
409
|
-
visible && !disabled && /* @__PURE__ */
|
|
533
|
+
visible && !disabled && /* @__PURE__ */ jsx7("span", { id, role: "tooltip", className: "fe-tooltip__content", children: content })
|
|
410
534
|
] });
|
|
411
535
|
}
|
|
412
536
|
|
|
413
537
|
// packages/form-controls/src/controls/Field/field.tsx
|
|
414
|
-
import { jsx as
|
|
538
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
415
539
|
function getFieldError(error, errorMessage) {
|
|
416
540
|
if (errorMessage !== void 0 && errorMessage !== null) return errorMessage;
|
|
417
541
|
if (typeof error !== "boolean") return error;
|
|
@@ -428,10 +552,10 @@ function FieldLabel({
|
|
|
428
552
|
isRequired = false
|
|
429
553
|
}) {
|
|
430
554
|
if (!label) return null;
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
433
|
-
isRequired && /* @__PURE__ */
|
|
434
|
-
description && descriptionDisplay === "tooltip" && /* @__PURE__ */
|
|
555
|
+
return /* @__PURE__ */ jsxs8("span", { className: "fe-field__label", children: [
|
|
556
|
+
/* @__PURE__ */ jsx8("span", { id, children: label }),
|
|
557
|
+
isRequired && /* @__PURE__ */ jsx8("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" }),
|
|
558
|
+
description && descriptionDisplay === "tooltip" && /* @__PURE__ */ jsx8(Tooltip, { content: description, children: /* @__PURE__ */ jsx8(
|
|
435
559
|
"span",
|
|
436
560
|
{
|
|
437
561
|
className: "fe-field__info",
|
|
@@ -450,7 +574,7 @@ function FieldMessage({
|
|
|
450
574
|
descriptionDisplay
|
|
451
575
|
}) {
|
|
452
576
|
if (error !== void 0 && error !== false && error !== null)
|
|
453
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ jsx8(
|
|
454
578
|
"span",
|
|
455
579
|
{
|
|
456
580
|
id,
|
|
@@ -460,12 +584,12 @@ function FieldMessage({
|
|
|
460
584
|
}
|
|
461
585
|
);
|
|
462
586
|
if (description && descriptionDisplay === "inline")
|
|
463
|
-
return /* @__PURE__ */
|
|
587
|
+
return /* @__PURE__ */ jsx8("span", { id, className: "fe-field__message", children: description });
|
|
464
588
|
return null;
|
|
465
589
|
}
|
|
466
590
|
|
|
467
591
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
468
|
-
import { jsx as
|
|
592
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
469
593
|
var TextInput = forwardRef3(
|
|
470
594
|
function TextInput2({
|
|
471
595
|
value,
|
|
@@ -496,12 +620,12 @@ var TextInput = forwardRef3(
|
|
|
496
620
|
"aria-labelledby": ariaLabelledBy,
|
|
497
621
|
...props
|
|
498
622
|
}, ref) {
|
|
499
|
-
const generatedId =
|
|
623
|
+
const generatedId = useId3();
|
|
500
624
|
const inputId = id ?? generatedId + "-input";
|
|
501
625
|
const labelId = generatedId + "-label";
|
|
502
626
|
const messageId2 = generatedId + "-message";
|
|
503
627
|
const controlled = value !== void 0;
|
|
504
|
-
const [internalValue, setInternalValue] =
|
|
628
|
+
const [internalValue, setInternalValue] = useState5(defaultValue);
|
|
505
629
|
const currentValue = controlled ? value : internalValue;
|
|
506
630
|
const fieldError = getFieldError(error, errorMessage);
|
|
507
631
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -522,7 +646,7 @@ var TextInput = forwardRef3(
|
|
|
522
646
|
onValueChange?.("");
|
|
523
647
|
onClear?.();
|
|
524
648
|
};
|
|
525
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsxs9(
|
|
526
650
|
"div",
|
|
527
651
|
{
|
|
528
652
|
className: [
|
|
@@ -531,7 +655,7 @@ var TextInput = forwardRef3(
|
|
|
531
655
|
className
|
|
532
656
|
].filter(Boolean).join(" "),
|
|
533
657
|
children: [
|
|
534
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ jsx9(
|
|
535
659
|
FieldLabel,
|
|
536
660
|
{
|
|
537
661
|
id: labelId,
|
|
@@ -541,10 +665,10 @@ var TextInput = forwardRef3(
|
|
|
541
665
|
isRequired
|
|
542
666
|
}
|
|
543
667
|
),
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
resolvedPrefix && /* @__PURE__ */
|
|
546
|
-
/* @__PURE__ */
|
|
547
|
-
/* @__PURE__ */
|
|
668
|
+
/* @__PURE__ */ jsxs9("span", { className: "fe-text-input__control", children: [
|
|
669
|
+
resolvedPrefix && /* @__PURE__ */ jsx9("span", { className: "fe-text-input__prefix", children: resolvedPrefix }),
|
|
670
|
+
/* @__PURE__ */ jsxs9("span", { className: "fe-text-input__input-wrap", children: [
|
|
671
|
+
/* @__PURE__ */ jsx9(
|
|
548
672
|
"input",
|
|
549
673
|
{
|
|
550
674
|
ref,
|
|
@@ -566,26 +690,26 @@ var TextInput = forwardRef3(
|
|
|
566
690
|
...props
|
|
567
691
|
}
|
|
568
692
|
),
|
|
569
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */
|
|
570
|
-
/* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */
|
|
693
|
+
isRequired && placeholder && !currentValue && /* @__PURE__ */ jsxs9("span", { className: "fe-text-input__placeholder", "aria-hidden": "true", children: [
|
|
694
|
+
/* @__PURE__ */ jsx9("span", { children: placeholder }),
|
|
695
|
+
/* @__PURE__ */ jsx9("span", { className: "fe-field__required", children: "*" })
|
|
572
696
|
] })
|
|
573
697
|
] }),
|
|
574
|
-
resolvedSuffix && /* @__PURE__ */
|
|
575
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
698
|
+
resolvedSuffix && /* @__PURE__ */ jsx9("span", { className: "fe-text-input__suffix", children: resolvedSuffix }),
|
|
699
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx9(
|
|
576
700
|
Button,
|
|
577
701
|
{
|
|
578
702
|
hierarchy: "tertiary-gray",
|
|
579
703
|
size: "24",
|
|
580
704
|
iconOnly: true,
|
|
581
|
-
icon: /* @__PURE__ */
|
|
705
|
+
icon: /* @__PURE__ */ jsx9(CloseIcon, { size: 14 }),
|
|
582
706
|
"aria-label": clearLabel,
|
|
583
707
|
onClick: clear,
|
|
584
708
|
className: "fe-text-input__clear"
|
|
585
709
|
}
|
|
586
710
|
)
|
|
587
711
|
] }),
|
|
588
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ jsx9(
|
|
589
713
|
FieldMessage,
|
|
590
714
|
{
|
|
591
715
|
id: messageId2,
|
|
@@ -602,8 +726,15 @@ var TextInput = forwardRef3(
|
|
|
602
726
|
TextInput.displayName = "TextInput";
|
|
603
727
|
|
|
604
728
|
// packages/form-controls/src/controls/TextArea/text-area.tsx
|
|
605
|
-
import {
|
|
606
|
-
|
|
729
|
+
import {
|
|
730
|
+
forwardRef as forwardRef4,
|
|
731
|
+
useId as useId4,
|
|
732
|
+
useImperativeHandle,
|
|
733
|
+
useLayoutEffect,
|
|
734
|
+
useRef as useRef3,
|
|
735
|
+
useState as useState6
|
|
736
|
+
} from "react";
|
|
737
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
607
738
|
var TextArea = forwardRef4(
|
|
608
739
|
function TextArea2({
|
|
609
740
|
value,
|
|
@@ -616,6 +747,7 @@ var TextArea = forwardRef4(
|
|
|
616
747
|
helperText,
|
|
617
748
|
error,
|
|
618
749
|
errorMessage,
|
|
750
|
+
autosize = false,
|
|
619
751
|
clearable = false,
|
|
620
752
|
onClear,
|
|
621
753
|
clearLabel = "Clear text area",
|
|
@@ -630,12 +762,13 @@ var TextArea = forwardRef4(
|
|
|
630
762
|
"aria-labelledby": ariaLabelledBy,
|
|
631
763
|
...props
|
|
632
764
|
}, ref) {
|
|
633
|
-
const generatedId =
|
|
765
|
+
const generatedId = useId4();
|
|
634
766
|
const inputId = id ?? generatedId + "-input";
|
|
635
767
|
const labelId = generatedId + "-label";
|
|
636
768
|
const messageId2 = generatedId + "-message";
|
|
637
769
|
const controlled = value !== void 0;
|
|
638
|
-
const [internalValue, setInternalValue] =
|
|
770
|
+
const [internalValue, setInternalValue] = useState6(defaultValue);
|
|
771
|
+
const textareaRef = useRef3(null);
|
|
639
772
|
const currentValue = controlled ? value : internalValue;
|
|
640
773
|
const fieldError = getFieldError(error, errorMessage);
|
|
641
774
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -649,21 +782,32 @@ var TextArea = forwardRef4(
|
|
|
649
782
|
ariaLabelledBy,
|
|
650
783
|
label ? labelId : void 0
|
|
651
784
|
);
|
|
785
|
+
const resizeToContent = (textarea) => {
|
|
786
|
+
textarea.style.height = "auto";
|
|
787
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
788
|
+
};
|
|
789
|
+
useImperativeHandle(ref, () => textareaRef.current, []);
|
|
790
|
+
useLayoutEffect(() => {
|
|
791
|
+
if (autosize && textareaRef.current) {
|
|
792
|
+
resizeToContent(textareaRef.current);
|
|
793
|
+
}
|
|
794
|
+
}, [autosize, currentValue]);
|
|
652
795
|
const clear = () => {
|
|
653
796
|
if (!controlled) setInternalValue("");
|
|
654
797
|
onValueChange?.("");
|
|
655
798
|
onClear?.();
|
|
656
799
|
};
|
|
657
|
-
return /* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ jsxs10(
|
|
658
801
|
"div",
|
|
659
802
|
{
|
|
660
803
|
className: [
|
|
661
804
|
"fe-text-area",
|
|
662
805
|
hasError && "fe-text-area--error",
|
|
806
|
+
autosize && "fe-text-area--autosize",
|
|
663
807
|
className
|
|
664
808
|
].filter(Boolean).join(" "),
|
|
665
809
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ jsx10(
|
|
667
811
|
FieldLabel,
|
|
668
812
|
{
|
|
669
813
|
id: labelId,
|
|
@@ -673,11 +817,11 @@ var TextArea = forwardRef4(
|
|
|
673
817
|
isRequired
|
|
674
818
|
}
|
|
675
819
|
),
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ jsxs10("span", { className: "fe-text-area__control", children: [
|
|
821
|
+
/* @__PURE__ */ jsx10(
|
|
678
822
|
"textarea",
|
|
679
823
|
{
|
|
680
|
-
ref,
|
|
824
|
+
ref: textareaRef,
|
|
681
825
|
id: inputId,
|
|
682
826
|
value: currentValue,
|
|
683
827
|
placeholder,
|
|
@@ -690,30 +834,31 @@ var TextArea = forwardRef4(
|
|
|
690
834
|
"aria-describedby": describedBy,
|
|
691
835
|
onChange: (event) => {
|
|
692
836
|
if (!controlled) setInternalValue(event.target.value);
|
|
837
|
+
if (autosize) resizeToContent(event.currentTarget);
|
|
693
838
|
onValueChange?.(event.target.value);
|
|
694
839
|
onChange?.(event);
|
|
695
840
|
},
|
|
696
841
|
...props
|
|
697
842
|
}
|
|
698
843
|
),
|
|
699
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
844
|
+
isRequired && placeholder && !currentValue && /* @__PURE__ */ jsxs10("span", { className: "fe-text-area__placeholder", "aria-hidden": "true", children: [
|
|
845
|
+
/* @__PURE__ */ jsx10("span", { children: placeholder }),
|
|
846
|
+
/* @__PURE__ */ jsx10("span", { className: "fe-field__required", children: "*" })
|
|
702
847
|
] }),
|
|
703
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
848
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx10(
|
|
704
849
|
Button,
|
|
705
850
|
{
|
|
706
851
|
hierarchy: "tertiary-gray",
|
|
707
852
|
size: "24",
|
|
708
853
|
iconOnly: true,
|
|
709
|
-
icon: /* @__PURE__ */
|
|
854
|
+
icon: /* @__PURE__ */ jsx10(CloseIcon, { size: 14 }),
|
|
710
855
|
"aria-label": clearLabel,
|
|
711
856
|
onClick: clear,
|
|
712
857
|
className: "fe-text-area__clear"
|
|
713
858
|
}
|
|
714
859
|
)
|
|
715
860
|
] }),
|
|
716
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsx10(
|
|
717
862
|
FieldMessage,
|
|
718
863
|
{
|
|
719
864
|
id: messageId2,
|
|
@@ -732,14 +877,14 @@ TextArea.displayName = "TextArea";
|
|
|
732
877
|
// packages/form-controls/src/controls/Selection/selection.tsx
|
|
733
878
|
import {
|
|
734
879
|
forwardRef as forwardRef5,
|
|
735
|
-
useEffect as
|
|
736
|
-
useId as
|
|
737
|
-
useLayoutEffect,
|
|
738
|
-
useRef as
|
|
739
|
-
useState as
|
|
880
|
+
useEffect as useEffect4,
|
|
881
|
+
useId as useId5,
|
|
882
|
+
useLayoutEffect as useLayoutEffect2,
|
|
883
|
+
useRef as useRef4,
|
|
884
|
+
useState as useState7
|
|
740
885
|
} from "react";
|
|
741
886
|
import { createPortal as createPortal2 } from "react-dom";
|
|
742
|
-
import { Fragment as Fragment2, jsx as
|
|
887
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
743
888
|
var Selection = forwardRef5(
|
|
744
889
|
function Selection2({
|
|
745
890
|
className,
|
|
@@ -769,7 +914,7 @@ var Selection = forwardRef5(
|
|
|
769
914
|
"aria-labelledby": ariaLabelledBy,
|
|
770
915
|
...props
|
|
771
916
|
}, ref) {
|
|
772
|
-
const generatedId =
|
|
917
|
+
const generatedId = useId5();
|
|
773
918
|
const triggerId = id ?? generatedId + "-trigger";
|
|
774
919
|
const listboxId = triggerId + "-listbox";
|
|
775
920
|
const labelId = generatedId + "-label";
|
|
@@ -787,7 +932,7 @@ var Selection = forwardRef5(
|
|
|
787
932
|
label ? labelId : void 0
|
|
788
933
|
);
|
|
789
934
|
const isControlled = value !== void 0;
|
|
790
|
-
const [internalValue, setInternalValue] =
|
|
935
|
+
const [internalValue, setInternalValue] = useState7(
|
|
791
936
|
defaultValue ?? (multiple ? [] : "")
|
|
792
937
|
);
|
|
793
938
|
const selectedValue = isControlled ? value : internalValue;
|
|
@@ -795,13 +940,13 @@ var Selection = forwardRef5(
|
|
|
795
940
|
const selectedOptions = options.filter(
|
|
796
941
|
(option) => selectedValues.some((item) => String(item) === String(option.value))
|
|
797
942
|
);
|
|
798
|
-
const [open, setOpen] =
|
|
799
|
-
const [query, setQuery] =
|
|
800
|
-
const [activeIndex, setActiveIndex] =
|
|
801
|
-
const rootRef =
|
|
802
|
-
const menuRef =
|
|
803
|
-
const [menuPosition, setMenuPosition] =
|
|
804
|
-
|
|
943
|
+
const [open, setOpen] = useState7(false);
|
|
944
|
+
const [query, setQuery] = useState7("");
|
|
945
|
+
const [activeIndex, setActiveIndex] = useState7(0);
|
|
946
|
+
const rootRef = useRef4(null);
|
|
947
|
+
const menuRef = useRef4(null);
|
|
948
|
+
const [menuPosition, setMenuPosition] = useState7(null);
|
|
949
|
+
useEffect4(() => {
|
|
805
950
|
const close = (event) => {
|
|
806
951
|
const target = event.target;
|
|
807
952
|
if (!rootRef.current?.contains(target) && !menuRef.current?.contains(target))
|
|
@@ -810,7 +955,7 @@ var Selection = forwardRef5(
|
|
|
810
955
|
document.addEventListener("mousedown", close);
|
|
811
956
|
return () => document.removeEventListener("mousedown", close);
|
|
812
957
|
}, []);
|
|
813
|
-
|
|
958
|
+
useLayoutEffect2(() => {
|
|
814
959
|
if (!open) return;
|
|
815
960
|
const updateMenuPosition = () => {
|
|
816
961
|
const rect = rootRef.current?.getBoundingClientRect();
|
|
@@ -887,7 +1032,7 @@ var Selection = forwardRef5(
|
|
|
887
1032
|
}
|
|
888
1033
|
if (event.key === "Escape") setOpen(false);
|
|
889
1034
|
};
|
|
890
|
-
return /* @__PURE__ */
|
|
1035
|
+
return /* @__PURE__ */ jsxs11(
|
|
891
1036
|
"div",
|
|
892
1037
|
{
|
|
893
1038
|
ref,
|
|
@@ -902,7 +1047,7 @@ var Selection = forwardRef5(
|
|
|
902
1047
|
].filter(Boolean).join(" "),
|
|
903
1048
|
...props,
|
|
904
1049
|
children: [
|
|
905
|
-
/* @__PURE__ */
|
|
1050
|
+
/* @__PURE__ */ jsx11(
|
|
906
1051
|
FieldLabel,
|
|
907
1052
|
{
|
|
908
1053
|
id: labelId,
|
|
@@ -912,8 +1057,8 @@ var Selection = forwardRef5(
|
|
|
912
1057
|
isRequired
|
|
913
1058
|
}
|
|
914
1059
|
),
|
|
915
|
-
/* @__PURE__ */
|
|
916
|
-
name && selectedValues.map((item) => /* @__PURE__ */
|
|
1060
|
+
/* @__PURE__ */ jsxs11("div", { ref: rootRef, className: "fe-selection__control", children: [
|
|
1061
|
+
name && selectedValues.map((item) => /* @__PURE__ */ jsx11(
|
|
917
1062
|
"input",
|
|
918
1063
|
{
|
|
919
1064
|
type: "hidden",
|
|
@@ -922,7 +1067,7 @@ var Selection = forwardRef5(
|
|
|
922
1067
|
},
|
|
923
1068
|
String(item)
|
|
924
1069
|
)),
|
|
925
|
-
/* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ jsxs11(
|
|
926
1071
|
"button",
|
|
927
1072
|
{
|
|
928
1073
|
id: triggerId,
|
|
@@ -940,7 +1085,7 @@ var Selection = forwardRef5(
|
|
|
940
1085
|
onClick: () => setOpen((current) => !current),
|
|
941
1086
|
onKeyDown: onTriggerKeyDown,
|
|
942
1087
|
children: [
|
|
943
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ jsx11(
|
|
944
1089
|
"span",
|
|
945
1090
|
{
|
|
946
1091
|
className: [
|
|
@@ -948,30 +1093,30 @@ var Selection = forwardRef5(
|
|
|
948
1093
|
!selectedOptions.length && "is-placeholder",
|
|
949
1094
|
tag && selectedOptions.length > 1 && "is-tags"
|
|
950
1095
|
].filter(Boolean).join(" "),
|
|
951
|
-
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */
|
|
1096
|
+
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsxs11(
|
|
952
1097
|
"span",
|
|
953
1098
|
{
|
|
954
1099
|
className: "fe-selection__tag",
|
|
955
1100
|
children: [
|
|
956
1101
|
option.label,
|
|
957
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: "\xD7" })
|
|
958
1103
|
]
|
|
959
1104
|
},
|
|
960
1105
|
String(option.value)
|
|
961
|
-
)) : displayLabel.map((item, index) => /* @__PURE__ */
|
|
1106
|
+
)) : displayLabel.map((item, index) => /* @__PURE__ */ jsxs11("span", { children: [
|
|
962
1107
|
item,
|
|
963
1108
|
index < displayLabel.length - 1 ? ", " : ""
|
|
964
|
-
] }, index)) : /* @__PURE__ */
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
isRequired && /* @__PURE__ */
|
|
1109
|
+
] }, index)) : /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1110
|
+
/* @__PURE__ */ jsx11("span", { children: placeholder }),
|
|
1111
|
+
isRequired && /* @__PURE__ */ jsx11("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
967
1112
|
] })
|
|
968
1113
|
}
|
|
969
1114
|
),
|
|
970
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ jsx11("span", { className: "fe-selection__actions", children: /* @__PURE__ */ jsx11("span", { className: "fe-selection__chevron", "aria-hidden": "true" }) })
|
|
971
1116
|
]
|
|
972
1117
|
}
|
|
973
1118
|
),
|
|
974
|
-
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */
|
|
1119
|
+
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */ jsx11(
|
|
975
1120
|
"button",
|
|
976
1121
|
{
|
|
977
1122
|
type: "button",
|
|
@@ -981,7 +1126,7 @@ var Selection = forwardRef5(
|
|
|
981
1126
|
}
|
|
982
1127
|
),
|
|
983
1128
|
open && menuPosition && createPortal2(
|
|
984
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ jsxs11(
|
|
985
1130
|
"div",
|
|
986
1131
|
{
|
|
987
1132
|
ref: menuRef,
|
|
@@ -996,9 +1141,9 @@ var Selection = forwardRef5(
|
|
|
996
1141
|
role: "listbox",
|
|
997
1142
|
"aria-multiselectable": multiple || void 0,
|
|
998
1143
|
children: [
|
|
999
|
-
searchable && /* @__PURE__ */
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1144
|
+
searchable && /* @__PURE__ */ jsxs11("div", { className: "fe-selection__search", children: [
|
|
1145
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: "\u2315" }),
|
|
1146
|
+
/* @__PURE__ */ jsx11(
|
|
1002
1147
|
"input",
|
|
1003
1148
|
{
|
|
1004
1149
|
autoFocus: true,
|
|
@@ -1012,11 +1157,11 @@ var Selection = forwardRef5(
|
|
|
1012
1157
|
}
|
|
1013
1158
|
)
|
|
1014
1159
|
] }),
|
|
1015
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsx11("div", { className: "fe-selection__options", children: filteredOptions.length ? filteredOptions.map((option, index) => {
|
|
1016
1161
|
const isSelected = selectedValues.some(
|
|
1017
1162
|
(item) => String(item) === String(option.value)
|
|
1018
1163
|
);
|
|
1019
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ jsxs11(
|
|
1020
1165
|
"button",
|
|
1021
1166
|
{
|
|
1022
1167
|
type: "button",
|
|
@@ -1030,8 +1175,8 @@ var Selection = forwardRef5(
|
|
|
1030
1175
|
onMouseMove: () => setActiveIndex(index),
|
|
1031
1176
|
onClick: () => choose(option),
|
|
1032
1177
|
children: [
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
isSelected && /* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsx11("span", { children: option.label }),
|
|
1179
|
+
isSelected && /* @__PURE__ */ jsx11(
|
|
1035
1180
|
"span",
|
|
1036
1181
|
{
|
|
1037
1182
|
className: "fe-selection__check",
|
|
@@ -1043,14 +1188,14 @@ var Selection = forwardRef5(
|
|
|
1043
1188
|
},
|
|
1044
1189
|
String(option.value)
|
|
1045
1190
|
);
|
|
1046
|
-
}) : /* @__PURE__ */
|
|
1191
|
+
}) : /* @__PURE__ */ jsx11("p", { className: "fe-selection__empty", children: "No matching options" }) })
|
|
1047
1192
|
]
|
|
1048
1193
|
}
|
|
1049
1194
|
),
|
|
1050
1195
|
document.body
|
|
1051
1196
|
)
|
|
1052
1197
|
] }),
|
|
1053
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ jsx11(
|
|
1054
1199
|
FieldMessage,
|
|
1055
1200
|
{
|
|
1056
1201
|
id: messageId2,
|
|
@@ -1067,8 +1212,14 @@ var Selection = forwardRef5(
|
|
|
1067
1212
|
Selection.displayName = "Selection";
|
|
1068
1213
|
|
|
1069
1214
|
// packages/form-controls/src/controls/NumberInput/number-input.tsx
|
|
1070
|
-
import {
|
|
1071
|
-
|
|
1215
|
+
import {
|
|
1216
|
+
forwardRef as forwardRef6,
|
|
1217
|
+
useEffect as useEffect5,
|
|
1218
|
+
useId as useId6,
|
|
1219
|
+
useRef as useRef5,
|
|
1220
|
+
useState as useState8
|
|
1221
|
+
} from "react";
|
|
1222
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1072
1223
|
function formatNumber(value, decimals = 2, thousandSeparator = ",", decimalSeparator = ".") {
|
|
1073
1224
|
return new Intl.NumberFormat("en-US", {
|
|
1074
1225
|
minimumFractionDigits: 0,
|
|
@@ -1082,6 +1233,11 @@ function escapeRegExp(value) {
|
|
|
1082
1233
|
function groupInteger(value, separator) {
|
|
1083
1234
|
return value.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
1084
1235
|
}
|
|
1236
|
+
function roundToDecimals(value, decimals) {
|
|
1237
|
+
const precision = Math.min(Math.max(0, decimals), 15);
|
|
1238
|
+
const multiplier = 10 ** precision;
|
|
1239
|
+
return Math.round((value + Number.EPSILON) * multiplier) / multiplier;
|
|
1240
|
+
}
|
|
1085
1241
|
function normalizeNumberInput(raw, options) {
|
|
1086
1242
|
const { allowDecimal, decimalSeparator, thousandSeparator, min, max } = options;
|
|
1087
1243
|
const decimals = Math.max(0, options.decimals);
|
|
@@ -1144,17 +1300,27 @@ var NumberInput = forwardRef6(
|
|
|
1144
1300
|
placeholder,
|
|
1145
1301
|
required,
|
|
1146
1302
|
endAdornment,
|
|
1303
|
+
prefix,
|
|
1304
|
+
suffix,
|
|
1305
|
+
Prefix,
|
|
1306
|
+
Suffix,
|
|
1307
|
+
step = 1,
|
|
1308
|
+
showStepper = true,
|
|
1309
|
+
incrementLabel = "Increase value",
|
|
1310
|
+
decrementLabel = "Decrease value",
|
|
1147
1311
|
"aria-describedby": ariaDescribedBy,
|
|
1148
1312
|
"aria-labelledby": ariaLabelledBy,
|
|
1313
|
+
onKeyDown,
|
|
1149
1314
|
...props
|
|
1150
1315
|
}, ref) {
|
|
1151
|
-
const
|
|
1316
|
+
const inputRef = useRef5(null);
|
|
1317
|
+
const generatedId = useId6();
|
|
1152
1318
|
const messageId2 = generatedId + "-message";
|
|
1153
1319
|
const isControlled = value !== void 0;
|
|
1154
|
-
const [internalValue, setInternalValue] =
|
|
1155
|
-
const [focused, setFocused] =
|
|
1320
|
+
const [internalValue, setInternalValue] = useState8(defaultValue);
|
|
1321
|
+
const [focused, setFocused] = useState8(false);
|
|
1156
1322
|
const actualValue = isControlled ? value ?? null : internalValue;
|
|
1157
|
-
const [text, setText] =
|
|
1323
|
+
const [text, setText] = useState8(
|
|
1158
1324
|
actualValue === null ? "" : formatNumber(
|
|
1159
1325
|
actualValue,
|
|
1160
1326
|
decimals,
|
|
@@ -1175,7 +1341,9 @@ var NumberInput = forwardRef6(
|
|
|
1175
1341
|
ariaLabelledBy,
|
|
1176
1342
|
label ? labelId : void 0
|
|
1177
1343
|
);
|
|
1178
|
-
|
|
1344
|
+
const resolvedPrefix = prefix ?? Prefix;
|
|
1345
|
+
const resolvedSuffix = suffix ?? Suffix;
|
|
1346
|
+
useEffect5(() => {
|
|
1179
1347
|
if (!focused)
|
|
1180
1348
|
setText(
|
|
1181
1349
|
actualValue === null ? "" : formatNumber(
|
|
@@ -1199,8 +1367,38 @@ var NumberInput = forwardRef6(
|
|
|
1199
1367
|
if (!isControlled) setInternalValue(next.value);
|
|
1200
1368
|
onValueChange?.(next.value);
|
|
1201
1369
|
};
|
|
1202
|
-
|
|
1203
|
-
|
|
1370
|
+
const setValue = (nextValue) => {
|
|
1371
|
+
const clamped = Math.min(
|
|
1372
|
+
max ?? Number.POSITIVE_INFINITY,
|
|
1373
|
+
Math.max(min ?? Number.NEGATIVE_INFINITY, nextValue)
|
|
1374
|
+
);
|
|
1375
|
+
const normalized = roundToDecimals(
|
|
1376
|
+
clamped,
|
|
1377
|
+
allowDecimal ? decimals : 0
|
|
1378
|
+
);
|
|
1379
|
+
setText(
|
|
1380
|
+
formatNumber(
|
|
1381
|
+
normalized,
|
|
1382
|
+
decimals,
|
|
1383
|
+
thousandSeparator,
|
|
1384
|
+
decimalSeparator
|
|
1385
|
+
)
|
|
1386
|
+
);
|
|
1387
|
+
if (!isControlled) setInternalValue(normalized);
|
|
1388
|
+
onValueChange?.(normalized);
|
|
1389
|
+
};
|
|
1390
|
+
const adjustValue = (direction) => {
|
|
1391
|
+
if (props.disabled || props.readOnly || !Number.isFinite(step) || step <= 0)
|
|
1392
|
+
return;
|
|
1393
|
+
const baseValue = actualValue ?? min ?? 0;
|
|
1394
|
+
setValue(baseValue + direction * step);
|
|
1395
|
+
inputRef.current?.focus();
|
|
1396
|
+
};
|
|
1397
|
+
const stepIsUsable = Number.isFinite(step) && step > 0;
|
|
1398
|
+
const disableIncrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || max !== void 0 && actualValue !== null && actualValue >= max;
|
|
1399
|
+
const disableDecrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || min !== void 0 && actualValue !== null && actualValue <= min;
|
|
1400
|
+
return /* @__PURE__ */ jsxs12(
|
|
1401
|
+
"div",
|
|
1204
1402
|
{
|
|
1205
1403
|
className: [
|
|
1206
1404
|
"fe-number-input",
|
|
@@ -1208,7 +1406,7 @@ var NumberInput = forwardRef6(
|
|
|
1208
1406
|
className
|
|
1209
1407
|
].filter(Boolean).join(" "),
|
|
1210
1408
|
children: [
|
|
1211
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx12(
|
|
1212
1410
|
FieldLabel,
|
|
1213
1411
|
{
|
|
1214
1412
|
id: labelId,
|
|
@@ -1218,38 +1416,89 @@ var NumberInput = forwardRef6(
|
|
|
1218
1416
|
isRequired
|
|
1219
1417
|
}
|
|
1220
1418
|
),
|
|
1221
|
-
/* @__PURE__ */
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1419
|
+
/* @__PURE__ */ jsxs12("span", { className: "fe-number-input__control", children: [
|
|
1420
|
+
resolvedPrefix && /* @__PURE__ */ jsx12("span", { className: "fe-number-input__prefix", children: resolvedPrefix }),
|
|
1421
|
+
/* @__PURE__ */ jsxs12("span", { className: "fe-number-input__input-wrap", children: [
|
|
1422
|
+
/* @__PURE__ */ jsx12(
|
|
1423
|
+
"input",
|
|
1424
|
+
{
|
|
1425
|
+
ref: (node) => {
|
|
1426
|
+
inputRef.current = node;
|
|
1427
|
+
if (typeof ref === "function") ref(node);
|
|
1428
|
+
else if (ref) ref.current = node;
|
|
1429
|
+
},
|
|
1430
|
+
inputMode: allowDecimal ? "decimal" : "numeric",
|
|
1431
|
+
value: text,
|
|
1432
|
+
placeholder,
|
|
1433
|
+
required: isRequired || required,
|
|
1434
|
+
onFocus: (event) => {
|
|
1435
|
+
setFocused(true);
|
|
1436
|
+
onFocus?.(event);
|
|
1437
|
+
},
|
|
1438
|
+
onChange: (event) => updateValue(event.target.value),
|
|
1439
|
+
onBlur: (event) => {
|
|
1440
|
+
setFocused(false);
|
|
1441
|
+
onBlur?.(event);
|
|
1442
|
+
},
|
|
1443
|
+
onKeyDown: (event) => {
|
|
1444
|
+
onKeyDown?.(event);
|
|
1445
|
+
if (event.defaultPrevented) return;
|
|
1446
|
+
if (event.key === "ArrowUp" || event.key === "ArrowDown") {
|
|
1447
|
+
event.preventDefault();
|
|
1448
|
+
adjustValue(event.key === "ArrowUp" ? 1 : -1);
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
...props,
|
|
1452
|
+
"aria-invalid": hasError || void 0,
|
|
1453
|
+
"aria-required": isRequired || void 0,
|
|
1454
|
+
"aria-labelledby": labelledBy,
|
|
1455
|
+
"aria-describedby": describedBy
|
|
1456
|
+
}
|
|
1457
|
+
),
|
|
1458
|
+
isRequired && placeholder && !text && /* @__PURE__ */ jsxs12(
|
|
1459
|
+
"span",
|
|
1460
|
+
{
|
|
1461
|
+
className: "fe-number-input__placeholder",
|
|
1462
|
+
"aria-hidden": "true",
|
|
1463
|
+
children: [
|
|
1464
|
+
/* @__PURE__ */ jsx12("span", { children: placeholder }),
|
|
1465
|
+
/* @__PURE__ */ jsx12("span", { className: "fe-field__required", children: "*" })
|
|
1466
|
+
]
|
|
1467
|
+
}
|
|
1468
|
+
)
|
|
1249
1469
|
] }),
|
|
1250
|
-
|
|
1470
|
+
resolvedSuffix && /* @__PURE__ */ jsx12("span", { className: "fe-number-input__suffix", children: resolvedSuffix }),
|
|
1471
|
+
endAdornment,
|
|
1472
|
+
showStepper && /* @__PURE__ */ jsxs12("span", { className: "fe-number-input__stepper", children: [
|
|
1473
|
+
/* @__PURE__ */ jsx12(
|
|
1474
|
+
Button,
|
|
1475
|
+
{
|
|
1476
|
+
hierarchy: "tertiary-gray",
|
|
1477
|
+
size: "24",
|
|
1478
|
+
iconOnly: true,
|
|
1479
|
+
icon: /* @__PURE__ */ jsx12(ChevronUpIcon, { size: 12 }),
|
|
1480
|
+
"aria-label": incrementLabel,
|
|
1481
|
+
disabled: disableIncrement,
|
|
1482
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1483
|
+
onClick: () => adjustValue(1)
|
|
1484
|
+
}
|
|
1485
|
+
),
|
|
1486
|
+
/* @__PURE__ */ jsx12(
|
|
1487
|
+
Button,
|
|
1488
|
+
{
|
|
1489
|
+
hierarchy: "tertiary-gray",
|
|
1490
|
+
size: "24",
|
|
1491
|
+
iconOnly: true,
|
|
1492
|
+
icon: /* @__PURE__ */ jsx12(ChevronDownIcon, { size: 12 }),
|
|
1493
|
+
"aria-label": decrementLabel,
|
|
1494
|
+
disabled: disableDecrement,
|
|
1495
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
1496
|
+
onClick: () => adjustValue(-1)
|
|
1497
|
+
}
|
|
1498
|
+
)
|
|
1499
|
+
] })
|
|
1251
1500
|
] }),
|
|
1252
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ jsx12(
|
|
1253
1502
|
FieldMessage,
|
|
1254
1503
|
{
|
|
1255
1504
|
id: messageId2,
|
|
@@ -1266,8 +1515,8 @@ var NumberInput = forwardRef6(
|
|
|
1266
1515
|
NumberInput.displayName = "NumberInput";
|
|
1267
1516
|
|
|
1268
1517
|
// packages/form-controls/src/controls/CurrencyInput/currency-input.tsx
|
|
1269
|
-
import { useState as
|
|
1270
|
-
import { jsx as
|
|
1518
|
+
import { useState as useState9 } from "react";
|
|
1519
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1271
1520
|
function CurrencyInput({
|
|
1272
1521
|
suffix = "VND",
|
|
1273
1522
|
currencies,
|
|
@@ -1278,13 +1527,13 @@ function CurrencyInput({
|
|
|
1278
1527
|
disabled,
|
|
1279
1528
|
...props
|
|
1280
1529
|
}) {
|
|
1281
|
-
const [internalCurrency, setInternalCurrency] =
|
|
1530
|
+
const [internalCurrency, setInternalCurrency] = useState9(
|
|
1282
1531
|
defaultCurrency ?? currencies?.[0]?.code ?? ""
|
|
1283
1532
|
);
|
|
1284
1533
|
const selectedCurrency = currency ?? internalCurrency;
|
|
1285
1534
|
const current = currencies?.find((item) => item.code === selectedCurrency);
|
|
1286
1535
|
const currencySuffix = current?.suffix ?? current?.code ?? suffix;
|
|
1287
|
-
const endAdornment = currencies?.length ? /* @__PURE__ */
|
|
1536
|
+
const endAdornment = currencies?.length ? /* @__PURE__ */ jsx13(
|
|
1288
1537
|
Selection,
|
|
1289
1538
|
{
|
|
1290
1539
|
className: "fe-currency-input__currency",
|
|
@@ -1303,8 +1552,8 @@ function CurrencyInput({
|
|
|
1303
1552
|
onCurrencyChange?.(next);
|
|
1304
1553
|
}
|
|
1305
1554
|
}
|
|
1306
|
-
) : /* @__PURE__ */
|
|
1307
|
-
return /* @__PURE__ */
|
|
1555
|
+
) : /* @__PURE__ */ jsx13("span", { className: "fe-currency-input__suffix", children: currencySuffix });
|
|
1556
|
+
return /* @__PURE__ */ jsx13(
|
|
1308
1557
|
NumberInput,
|
|
1309
1558
|
{
|
|
1310
1559
|
...props,
|
|
@@ -1316,8 +1565,8 @@ function CurrencyInput({
|
|
|
1316
1565
|
}
|
|
1317
1566
|
|
|
1318
1567
|
// packages/form-controls/src/controls/DateTimePicker/date-time-picker.tsx
|
|
1319
|
-
import { useEffect as
|
|
1320
|
-
import { jsx as
|
|
1568
|
+
import { useEffect as useEffect6, useId as useId7, useRef as useRef6, useState as useState10 } from "react";
|
|
1569
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1321
1570
|
var pad = (value) => String(value).padStart(2, "0");
|
|
1322
1571
|
function formatDate(date, format) {
|
|
1323
1572
|
return format.replace(/yyyy/g, String(date.getFullYear())).replace(/MM/g, pad(date.getMonth() + 1)).replace(/dd/g, pad(date.getDate())).replace(/HH/g, pad(date.getHours())).replace(/mm/g, pad(date.getMinutes()));
|
|
@@ -1353,7 +1602,7 @@ function DateTimePicker(props) {
|
|
|
1353
1602
|
"aria-describedby": ariaDescribedBy,
|
|
1354
1603
|
"aria-labelledby": ariaLabelledBy
|
|
1355
1604
|
} = props;
|
|
1356
|
-
const generatedId =
|
|
1605
|
+
const generatedId = useId7();
|
|
1357
1606
|
const triggerId = id ?? generatedId + "-trigger";
|
|
1358
1607
|
const labelId = generatedId + "-label";
|
|
1359
1608
|
const messageId2 = generatedId + "-message";
|
|
@@ -1371,28 +1620,28 @@ function DateTimePicker(props) {
|
|
|
1371
1620
|
);
|
|
1372
1621
|
const isRange = mode === "range";
|
|
1373
1622
|
const controlled = props.value !== void 0;
|
|
1374
|
-
const [singleInternal, setSingleInternal] =
|
|
1623
|
+
const [singleInternal, setSingleInternal] = useState10(
|
|
1375
1624
|
(!isRange ? props.defaultValue : null) ?? null
|
|
1376
1625
|
);
|
|
1377
|
-
const [rangeInternal, setRangeInternal] =
|
|
1626
|
+
const [rangeInternal, setRangeInternal] = useState10(
|
|
1378
1627
|
(isRange ? props.defaultValue : void 0) ?? [null, null]
|
|
1379
1628
|
);
|
|
1380
1629
|
const singleValue = !isRange ? props.value ?? singleInternal : null;
|
|
1381
1630
|
const rangeValue = isRange ? props.value ?? rangeInternal : [null, null];
|
|
1382
|
-
const [open, setOpen] =
|
|
1383
|
-
const [month, setMonth] =
|
|
1631
|
+
const [open, setOpen] = useState10(false);
|
|
1632
|
+
const [month, setMonth] = useState10(
|
|
1384
1633
|
() => new Date((isRange ? rangeValue[0] : singleValue) ?? /* @__PURE__ */ new Date())
|
|
1385
1634
|
);
|
|
1386
|
-
const [editingEnd, setEditingEnd] =
|
|
1387
|
-
const rootRef =
|
|
1388
|
-
|
|
1635
|
+
const [editingEnd, setEditingEnd] = useState10(false);
|
|
1636
|
+
const rootRef = useRef6(null);
|
|
1637
|
+
useEffect6(() => {
|
|
1389
1638
|
const onPointerDown = (event) => {
|
|
1390
1639
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
1391
1640
|
};
|
|
1392
1641
|
document.addEventListener("mousedown", onPointerDown);
|
|
1393
1642
|
return () => document.removeEventListener("mousedown", onPointerDown);
|
|
1394
1643
|
}, []);
|
|
1395
|
-
|
|
1644
|
+
useEffect6(() => {
|
|
1396
1645
|
if (disabled) setOpen(false);
|
|
1397
1646
|
}, [disabled]);
|
|
1398
1647
|
const setSingle = (next) => {
|
|
@@ -1448,7 +1697,7 @@ function DateTimePicker(props) {
|
|
|
1448
1697
|
setRange(editingEnd ? [rangeValue[0], next] : [next, rangeValue[1]]);
|
|
1449
1698
|
else setSingle(next);
|
|
1450
1699
|
};
|
|
1451
|
-
return /* @__PURE__ */
|
|
1700
|
+
return /* @__PURE__ */ jsxs13(
|
|
1452
1701
|
"div",
|
|
1453
1702
|
{
|
|
1454
1703
|
ref: rootRef,
|
|
@@ -1458,7 +1707,7 @@ function DateTimePicker(props) {
|
|
|
1458
1707
|
className
|
|
1459
1708
|
].filter(Boolean).join(" "),
|
|
1460
1709
|
children: [
|
|
1461
|
-
/* @__PURE__ */
|
|
1710
|
+
/* @__PURE__ */ jsx14(
|
|
1462
1711
|
FieldLabel,
|
|
1463
1712
|
{
|
|
1464
1713
|
id: labelId,
|
|
@@ -1468,7 +1717,7 @@ function DateTimePicker(props) {
|
|
|
1468
1717
|
isRequired
|
|
1469
1718
|
}
|
|
1470
1719
|
),
|
|
1471
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsxs13(
|
|
1472
1721
|
"button",
|
|
1473
1722
|
{
|
|
1474
1723
|
id: triggerId,
|
|
@@ -1482,29 +1731,29 @@ function DateTimePicker(props) {
|
|
|
1482
1731
|
"aria-expanded": open,
|
|
1483
1732
|
onClick: () => setOpen((current) => !current),
|
|
1484
1733
|
children: [
|
|
1485
|
-
/* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
1734
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: "\u25F7" }),
|
|
1735
|
+
/* @__PURE__ */ jsxs13(
|
|
1487
1736
|
"span",
|
|
1488
1737
|
{
|
|
1489
1738
|
className: !shownValue && placeholder ? "fe-datetime-picker__value is-placeholder" : "fe-datetime-picker__value",
|
|
1490
1739
|
children: [
|
|
1491
1740
|
shownValue || placeholder || (isRange ? "Select date range" : "Select date and time"),
|
|
1492
|
-
isRequired && placeholder && !shownValue && /* @__PURE__ */
|
|
1741
|
+
isRequired && placeholder && !shownValue && /* @__PURE__ */ jsx14("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1493
1742
|
]
|
|
1494
1743
|
}
|
|
1495
1744
|
)
|
|
1496
1745
|
]
|
|
1497
1746
|
}
|
|
1498
1747
|
),
|
|
1499
|
-
open && /* @__PURE__ */
|
|
1748
|
+
open && /* @__PURE__ */ jsxs13(
|
|
1500
1749
|
"div",
|
|
1501
1750
|
{
|
|
1502
1751
|
className: "fe-datetime-picker__popper",
|
|
1503
1752
|
role: "dialog",
|
|
1504
1753
|
"aria-label": "Date and time picker",
|
|
1505
1754
|
children: [
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ jsxs13("div", { className: "fe-datetime-picker__month", children: [
|
|
1756
|
+
/* @__PURE__ */ jsx14(
|
|
1508
1757
|
"button",
|
|
1509
1758
|
{
|
|
1510
1759
|
type: "button",
|
|
@@ -1515,11 +1764,11 @@ function DateTimePicker(props) {
|
|
|
1515
1764
|
children: "\u2039"
|
|
1516
1765
|
}
|
|
1517
1766
|
),
|
|
1518
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ jsx14("strong", { children: month.toLocaleDateString(locale, {
|
|
1519
1768
|
month: "long",
|
|
1520
1769
|
year: "numeric"
|
|
1521
1770
|
}) }),
|
|
1522
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ jsx14(
|
|
1523
1772
|
"button",
|
|
1524
1773
|
{
|
|
1525
1774
|
type: "button",
|
|
@@ -1531,12 +1780,12 @@ function DateTimePicker(props) {
|
|
|
1531
1780
|
}
|
|
1532
1781
|
)
|
|
1533
1782
|
] }),
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ jsx14("div", { className: "fe-datetime-picker__weekdays", children: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((day) => /* @__PURE__ */ jsx14("span", { children: day }, day)) }),
|
|
1784
|
+
/* @__PURE__ */ jsx14("div", { className: "fe-datetime-picker__days", children: days.map((day) => {
|
|
1536
1785
|
const inMonth = day.getMonth() === month.getMonth();
|
|
1537
1786
|
const selected = isRange ? sameDay(day, rangeValue[0]) || sameDay(day, rangeValue[1]) : sameDay(day, singleValue);
|
|
1538
1787
|
const inRange = isRange && rangeValue[0] && rangeValue[1] && day > startOfDay(rangeValue[0]) && day < startOfDay(rangeValue[1]);
|
|
1539
|
-
return /* @__PURE__ */
|
|
1788
|
+
return /* @__PURE__ */ jsx14(
|
|
1540
1789
|
"button",
|
|
1541
1790
|
{
|
|
1542
1791
|
type: "button",
|
|
@@ -1551,8 +1800,8 @@ function DateTimePicker(props) {
|
|
|
1551
1800
|
day.toISOString()
|
|
1552
1801
|
);
|
|
1553
1802
|
}) }),
|
|
1554
|
-
isRange && /* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */
|
|
1803
|
+
isRange && /* @__PURE__ */ jsxs13("div", { className: "fe-datetime-picker__range-tabs", children: [
|
|
1804
|
+
/* @__PURE__ */ jsx14(
|
|
1556
1805
|
"button",
|
|
1557
1806
|
{
|
|
1558
1807
|
type: "button",
|
|
@@ -1561,7 +1810,7 @@ function DateTimePicker(props) {
|
|
|
1561
1810
|
children: "Start"
|
|
1562
1811
|
}
|
|
1563
1812
|
),
|
|
1564
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx14(
|
|
1565
1814
|
"button",
|
|
1566
1815
|
{
|
|
1567
1816
|
type: "button",
|
|
@@ -1571,9 +1820,9 @@ function DateTimePicker(props) {
|
|
|
1571
1820
|
}
|
|
1572
1821
|
)
|
|
1573
1822
|
] }),
|
|
1574
|
-
/* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsxs13("label", { className: "fe-datetime-picker__time", children: [
|
|
1575
1824
|
"Time",
|
|
1576
|
-
/* @__PURE__ */
|
|
1825
|
+
/* @__PURE__ */ jsx14(
|
|
1577
1826
|
"input",
|
|
1578
1827
|
{
|
|
1579
1828
|
type: "time",
|
|
@@ -1586,7 +1835,7 @@ function DateTimePicker(props) {
|
|
|
1586
1835
|
]
|
|
1587
1836
|
}
|
|
1588
1837
|
),
|
|
1589
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx14(
|
|
1590
1839
|
FieldMessage,
|
|
1591
1840
|
{
|
|
1592
1841
|
id: messageId2,
|
|
@@ -1600,30 +1849,190 @@ function DateTimePicker(props) {
|
|
|
1600
1849
|
);
|
|
1601
1850
|
}
|
|
1602
1851
|
|
|
1852
|
+
// packages/form-controls/src/controls/Checkbox/checkbox.tsx
|
|
1853
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
1854
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1855
|
+
var Checkbox = forwardRef7(
|
|
1856
|
+
function Checkbox2({
|
|
1857
|
+
label,
|
|
1858
|
+
labelPosition = "right",
|
|
1859
|
+
className,
|
|
1860
|
+
style,
|
|
1861
|
+
id,
|
|
1862
|
+
disabled,
|
|
1863
|
+
...props
|
|
1864
|
+
}, ref) {
|
|
1865
|
+
const classes = [
|
|
1866
|
+
"fe-checkbox",
|
|
1867
|
+
`fe-checkbox--label-${labelPosition}`,
|
|
1868
|
+
disabled && "fe-checkbox--disabled",
|
|
1869
|
+
className
|
|
1870
|
+
].filter(Boolean).join(" ");
|
|
1871
|
+
return /* @__PURE__ */ jsxs14("label", { className: classes, style, children: [
|
|
1872
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsx15("span", { className: "fe-checkbox__label", children: label }),
|
|
1873
|
+
/* @__PURE__ */ jsxs14("span", { className: "fe-checkbox__content", children: [
|
|
1874
|
+
/* @__PURE__ */ jsx15(
|
|
1875
|
+
"input",
|
|
1876
|
+
{
|
|
1877
|
+
ref,
|
|
1878
|
+
id,
|
|
1879
|
+
className: "fe-checkbox__input",
|
|
1880
|
+
type: "checkbox",
|
|
1881
|
+
disabled,
|
|
1882
|
+
...props
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
/* @__PURE__ */ jsx15("span", { className: "fe-checkbox__control", "aria-hidden": "true" }),
|
|
1886
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx15("span", { className: "fe-checkbox__label", children: label })
|
|
1887
|
+
] })
|
|
1888
|
+
] });
|
|
1889
|
+
}
|
|
1890
|
+
);
|
|
1891
|
+
Checkbox.displayName = "Checkbox";
|
|
1892
|
+
|
|
1893
|
+
// packages/form-controls/src/controls/RadioButton/radio-button.tsx
|
|
1894
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
1895
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1896
|
+
var RadioButton = forwardRef8(
|
|
1897
|
+
function RadioButton2({
|
|
1898
|
+
label,
|
|
1899
|
+
labelPosition = "right",
|
|
1900
|
+
className,
|
|
1901
|
+
style,
|
|
1902
|
+
id,
|
|
1903
|
+
disabled,
|
|
1904
|
+
...props
|
|
1905
|
+
}, ref) {
|
|
1906
|
+
const classes = [
|
|
1907
|
+
"fe-radio-button",
|
|
1908
|
+
`fe-radio-button--label-${labelPosition}`,
|
|
1909
|
+
disabled && "fe-radio-button--disabled",
|
|
1910
|
+
className
|
|
1911
|
+
].filter(Boolean).join(" ");
|
|
1912
|
+
return /* @__PURE__ */ jsxs15("label", { className: classes, style, children: [
|
|
1913
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsx16("span", { className: "fe-radio-button__label", children: label }),
|
|
1914
|
+
/* @__PURE__ */ jsxs15("span", { className: "fe-radio-button__content", children: [
|
|
1915
|
+
/* @__PURE__ */ jsx16(
|
|
1916
|
+
"input",
|
|
1917
|
+
{
|
|
1918
|
+
ref,
|
|
1919
|
+
id,
|
|
1920
|
+
className: "fe-radio-button__input",
|
|
1921
|
+
type: "radio",
|
|
1922
|
+
disabled,
|
|
1923
|
+
...props
|
|
1924
|
+
}
|
|
1925
|
+
),
|
|
1926
|
+
/* @__PURE__ */ jsx16("span", { className: "fe-radio-button__control", "aria-hidden": "true" }),
|
|
1927
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx16("span", { className: "fe-radio-button__label", children: label })
|
|
1928
|
+
] })
|
|
1929
|
+
] });
|
|
1930
|
+
}
|
|
1931
|
+
);
|
|
1932
|
+
RadioButton.displayName = "RadioButton";
|
|
1933
|
+
|
|
1934
|
+
// packages/form-controls/src/controls/RadioGroup/radio-group.tsx
|
|
1935
|
+
import { forwardRef as forwardRef9, useId as useId8 } from "react";
|
|
1936
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1937
|
+
var RadioGroup = forwardRef9(
|
|
1938
|
+
function RadioGroup2({
|
|
1939
|
+
label,
|
|
1940
|
+
labelPosition = "top",
|
|
1941
|
+
options,
|
|
1942
|
+
name,
|
|
1943
|
+
value,
|
|
1944
|
+
defaultValue,
|
|
1945
|
+
onChange,
|
|
1946
|
+
disabled = false,
|
|
1947
|
+
direction = "vertical",
|
|
1948
|
+
isRequired = false,
|
|
1949
|
+
className,
|
|
1950
|
+
id,
|
|
1951
|
+
"aria-label": ariaLabel,
|
|
1952
|
+
"aria-labelledby": ariaLabelledBy,
|
|
1953
|
+
...props
|
|
1954
|
+
}, ref) {
|
|
1955
|
+
const generatedId = useId8();
|
|
1956
|
+
const groupName = name ?? `fe-radio-group-${generatedId}`;
|
|
1957
|
+
const labelId = `${id ?? generatedId}-label`;
|
|
1958
|
+
const isControlled = value !== void 0;
|
|
1959
|
+
const classes = [
|
|
1960
|
+
"fe-radio-group",
|
|
1961
|
+
`fe-radio-group--label-${labelPosition}`,
|
|
1962
|
+
`fe-radio-group--${direction}`,
|
|
1963
|
+
disabled && "fe-radio-group--disabled",
|
|
1964
|
+
className
|
|
1965
|
+
].filter(Boolean).join(" ");
|
|
1966
|
+
const handleChange = (option, event) => {
|
|
1967
|
+
if (event.target.checked) onChange?.(option.value, option, event);
|
|
1968
|
+
};
|
|
1969
|
+
return /* @__PURE__ */ jsxs16("div", { ref, className: classes, ...props, children: [
|
|
1970
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsxs16("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
1971
|
+
label,
|
|
1972
|
+
isRequired && /* @__PURE__ */ jsx17("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
1973
|
+
] }),
|
|
1974
|
+
/* @__PURE__ */ jsx17(
|
|
1975
|
+
"div",
|
|
1976
|
+
{
|
|
1977
|
+
id,
|
|
1978
|
+
className: "fe-radio-group__options",
|
|
1979
|
+
role: "radiogroup",
|
|
1980
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
1981
|
+
"aria-labelledby": label ? labelId : ariaLabelledBy,
|
|
1982
|
+
"aria-required": isRequired || void 0,
|
|
1983
|
+
children: options.map((option) => {
|
|
1984
|
+
const optionDisabled = disabled || option.disabled;
|
|
1985
|
+
const optionValue = String(option.value);
|
|
1986
|
+
return /* @__PURE__ */ jsx17(
|
|
1987
|
+
RadioButton,
|
|
1988
|
+
{
|
|
1989
|
+
name: groupName,
|
|
1990
|
+
value: optionValue,
|
|
1991
|
+
label: option.label,
|
|
1992
|
+
disabled: optionDisabled,
|
|
1993
|
+
required: isRequired,
|
|
1994
|
+
checked: isControlled ? option.value === value : void 0,
|
|
1995
|
+
defaultChecked: !isControlled ? option.value === defaultValue : void 0,
|
|
1996
|
+
onChange: (event) => handleChange(option, event)
|
|
1997
|
+
},
|
|
1998
|
+
optionValue
|
|
1999
|
+
);
|
|
2000
|
+
})
|
|
2001
|
+
}
|
|
2002
|
+
),
|
|
2003
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsxs16("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
2004
|
+
label,
|
|
2005
|
+
isRequired && /* @__PURE__ */ jsx17("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
2006
|
+
] })
|
|
2007
|
+
] });
|
|
2008
|
+
}
|
|
2009
|
+
);
|
|
2010
|
+
RadioGroup.displayName = "RadioGroup";
|
|
2011
|
+
|
|
1603
2012
|
// packages/expandable-section/src/index.tsx
|
|
1604
|
-
import { useId as
|
|
1605
|
-
import { jsx as
|
|
2013
|
+
import { useId as useId9, useState as useState11 } from "react";
|
|
2014
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1606
2015
|
function ExpandableSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, disabled, className, ...props }) {
|
|
1607
|
-
const [internalExpanded, setInternalExpanded] =
|
|
2016
|
+
const [internalExpanded, setInternalExpanded] = useState11(defaultExpanded);
|
|
1608
2017
|
const isExpanded = expanded ?? internalExpanded;
|
|
1609
|
-
const id =
|
|
2018
|
+
const id = useId9();
|
|
1610
2019
|
const toggle = () => {
|
|
1611
2020
|
if (disabled) return;
|
|
1612
2021
|
const next = !isExpanded;
|
|
1613
2022
|
if (expanded === void 0) setInternalExpanded(next);
|
|
1614
2023
|
onExpandedChange?.(next);
|
|
1615
2024
|
};
|
|
1616
|
-
return /* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1619
|
-
/* @__PURE__ */
|
|
2025
|
+
return /* @__PURE__ */ jsxs17("section", { className: ["fe-expandable-section", isExpanded && "fe-expandable-section--expanded", disabled && "fe-expandable-section--disabled", className].filter(Boolean).join(" "), ...props, children: [
|
|
2026
|
+
/* @__PURE__ */ jsxs17("button", { className: "fe-expandable-section__trigger", type: "button", "aria-expanded": isExpanded, "aria-controls": id, disabled, onClick: toggle, children: [
|
|
2027
|
+
/* @__PURE__ */ jsx18("span", { children: title }),
|
|
2028
|
+
/* @__PURE__ */ jsx18("span", { className: "fe-expandable-section__chevron", "aria-hidden": "true" })
|
|
1620
2029
|
] }),
|
|
1621
|
-
/* @__PURE__ */
|
|
2030
|
+
/* @__PURE__ */ jsx18("div", { id, className: "fe-expandable-section__content", "aria-hidden": !isExpanded, children: /* @__PURE__ */ jsx18("div", { className: "fe-expandable-section__content-inner", children }) })
|
|
1622
2031
|
] });
|
|
1623
2032
|
}
|
|
1624
2033
|
|
|
1625
2034
|
// packages/loading/src/index.tsx
|
|
1626
|
-
import { jsx as
|
|
2035
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1627
2036
|
var sizes = {
|
|
1628
2037
|
small: "16px",
|
|
1629
2038
|
medium: "24px",
|
|
@@ -1636,15 +2045,15 @@ function Loading({ size = "medium", color = "#2878f0", label, className, style,
|
|
|
1636
2045
|
"--fe-loading-color": color,
|
|
1637
2046
|
...style
|
|
1638
2047
|
};
|
|
1639
|
-
return /* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
label && /* @__PURE__ */
|
|
1642
|
-
!label && /* @__PURE__ */
|
|
2048
|
+
return /* @__PURE__ */ jsxs18("span", { className: ["fe-loading", className].filter(Boolean).join(" "), style: loadingStyle, role: "status", ...props, children: [
|
|
2049
|
+
/* @__PURE__ */ jsx19("span", { className: "fe-loading__spinner", "aria-hidden": "true" }),
|
|
2050
|
+
label && /* @__PURE__ */ jsx19("span", { className: "fe-loading__label", children: label }),
|
|
2051
|
+
!label && /* @__PURE__ */ jsx19("span", { className: "fe-loading__sr-only", children: "Loading" })
|
|
1643
2052
|
] });
|
|
1644
2053
|
}
|
|
1645
2054
|
|
|
1646
2055
|
// packages/skeleton/src/index.tsx
|
|
1647
|
-
import { Fragment as Fragment3, jsx as
|
|
2056
|
+
import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
|
|
1648
2057
|
var pixels = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1649
2058
|
function SkeletonBase({ variant = "box", shape, width, height, count = 1, animated = true, className, style, ...props }) {
|
|
1650
2059
|
const resolvedVariant = shape ?? variant;
|
|
@@ -1655,7 +2064,7 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
1655
2064
|
"--fe-skeleton-height": resolvedHeight,
|
|
1656
2065
|
...style
|
|
1657
2066
|
};
|
|
1658
|
-
return /* @__PURE__ */
|
|
2067
|
+
return /* @__PURE__ */ jsx20(Fragment3, { children: Array.from({ length: Math.max(1, count) }, (_, index) => /* @__PURE__ */ jsx20(
|
|
1659
2068
|
"div",
|
|
1660
2069
|
{
|
|
1661
2070
|
className: ["fe-skeleton", `fe-skeleton--${resolvedVariant}`, animated && "fe-skeleton--animated", className].filter(Boolean).join(" "),
|
|
@@ -1667,16 +2076,16 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
1667
2076
|
)) });
|
|
1668
2077
|
}
|
|
1669
2078
|
function SkeletonCircle({ size = 40, ...props }) {
|
|
1670
|
-
return /* @__PURE__ */
|
|
2079
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "circle", width: size, height: size, ...props });
|
|
1671
2080
|
}
|
|
1672
2081
|
function SkeletonSquare({ size = 80, ...props }) {
|
|
1673
|
-
return /* @__PURE__ */
|
|
2082
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "box", width: size, height: size, ...props });
|
|
1674
2083
|
}
|
|
1675
2084
|
function SkeletonBox({ width = "100%", height = 80, ...props }) {
|
|
1676
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "box", width, height, ...props });
|
|
1677
2086
|
}
|
|
1678
2087
|
function SkeletonLine({ width = "100%", height = 12, ...props }) {
|
|
1679
|
-
return /* @__PURE__ */
|
|
2088
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "line", width, height, ...props });
|
|
1680
2089
|
}
|
|
1681
2090
|
var Skeleton = Object.assign(SkeletonBase, {
|
|
1682
2091
|
Circle: SkeletonCircle,
|
|
@@ -1686,9 +2095,9 @@ var Skeleton = Object.assign(SkeletonBase, {
|
|
|
1686
2095
|
});
|
|
1687
2096
|
|
|
1688
2097
|
// packages/modal/src/index.tsx
|
|
1689
|
-
import { useEffect as
|
|
2098
|
+
import { useEffect as useEffect7, useId as useId10, useRef as useRef7 } from "react";
|
|
1690
2099
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1691
|
-
import { jsx as
|
|
2100
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1692
2101
|
function Modal({
|
|
1693
2102
|
open,
|
|
1694
2103
|
onClose,
|
|
@@ -1704,9 +2113,9 @@ function Modal({
|
|
|
1704
2113
|
className,
|
|
1705
2114
|
...props
|
|
1706
2115
|
}) {
|
|
1707
|
-
const titleId =
|
|
1708
|
-
const panelRef =
|
|
1709
|
-
|
|
2116
|
+
const titleId = useId10();
|
|
2117
|
+
const panelRef = useRef7(null);
|
|
2118
|
+
useEffect7(() => {
|
|
1710
2119
|
if (!open) return;
|
|
1711
2120
|
const onKeyDown = (event) => {
|
|
1712
2121
|
if (event.key === "Escape") onClose();
|
|
@@ -1718,9 +2127,9 @@ function Modal({
|
|
|
1718
2127
|
if (!open || typeof document === "undefined") return null;
|
|
1719
2128
|
const hasFooter = footer || actions.length > 0;
|
|
1720
2129
|
return createPortal3(
|
|
1721
|
-
/* @__PURE__ */
|
|
2130
|
+
/* @__PURE__ */ jsx21("div", { className: "fe-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
1722
2131
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
1723
|
-
}, children: /* @__PURE__ */
|
|
2132
|
+
}, children: /* @__PURE__ */ jsxs19(
|
|
1724
2133
|
"div",
|
|
1725
2134
|
{
|
|
1726
2135
|
ref: panelRef,
|
|
@@ -1732,17 +2141,17 @@ function Modal({
|
|
|
1732
2141
|
tabIndex: -1,
|
|
1733
2142
|
...props,
|
|
1734
2143
|
children: [
|
|
1735
|
-
(title || description || closeButton) && /* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
1737
|
-
title && /* @__PURE__ */
|
|
1738
|
-
description && /* @__PURE__ */
|
|
2144
|
+
(title || description || closeButton) && /* @__PURE__ */ jsxs19("header", { className: "fe-modal__header", children: [
|
|
2145
|
+
/* @__PURE__ */ jsxs19("div", { className: "fe-modal__heading", children: [
|
|
2146
|
+
title && /* @__PURE__ */ jsx21("h2", { id: titleId, children: title }),
|
|
2147
|
+
description && /* @__PURE__ */ jsx21("p", { children: description })
|
|
1739
2148
|
] }),
|
|
1740
|
-
closeButton && /* @__PURE__ */
|
|
2149
|
+
closeButton && /* @__PURE__ */ jsx21(Button, { hierarchy: "tertiary-gray", size: "32", iconOnly: true, icon: /* @__PURE__ */ jsx21(CloseIcon, {}), "aria-label": closeLabel, onClick: onClose })
|
|
1741
2150
|
] }),
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
hasFooter && /* @__PURE__ */
|
|
1744
|
-
footer && /* @__PURE__ */
|
|
1745
|
-
actions.length > 0 && /* @__PURE__ */
|
|
2151
|
+
/* @__PURE__ */ jsx21("div", { className: "fe-modal__body", children }),
|
|
2152
|
+
hasFooter && /* @__PURE__ */ jsxs19("footer", { className: "fe-modal__footer", children: [
|
|
2153
|
+
footer && /* @__PURE__ */ jsx21("div", { className: "fe-modal__footer-content", children: footer }),
|
|
2154
|
+
actions.length > 0 && /* @__PURE__ */ jsx21("div", { className: "fe-modal__actions", children: actions.map(({ label, ...action }, index) => /* @__PURE__ */ jsx21(Button, { ...action, children: label }, index)) })
|
|
1746
2155
|
] })
|
|
1747
2156
|
]
|
|
1748
2157
|
}
|
|
@@ -1752,7 +2161,7 @@ function Modal({
|
|
|
1752
2161
|
}
|
|
1753
2162
|
|
|
1754
2163
|
// packages/progress/src/index.tsx
|
|
1755
|
-
import { jsx as
|
|
2164
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1756
2165
|
function ProgressBar({ value, max = 100, label, showValue = true, size = "medium", color = "#2878f0", className, style, "aria-label": ariaLabel, ...props }) {
|
|
1757
2166
|
const indeterminate = value === null || value === void 0;
|
|
1758
2167
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, Number(value) / Math.max(1, max) * 100));
|
|
@@ -1762,17 +2171,17 @@ function ProgressBar({ value, max = 100, label, showValue = true, size = "medium
|
|
|
1762
2171
|
...style
|
|
1763
2172
|
};
|
|
1764
2173
|
const visibleValue = `${Math.round(percentage)}%`;
|
|
1765
|
-
return /* @__PURE__ */
|
|
1766
|
-
(label || !indeterminate && showValue) && /* @__PURE__ */
|
|
1767
|
-
label && /* @__PURE__ */
|
|
1768
|
-
!indeterminate && showValue && /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ jsxs20("div", { className: ["fe-progress", `fe-progress--${size}`, indeterminate && "fe-progress--indeterminate", className].filter(Boolean).join(" "), style: progressStyle, ...props, children: [
|
|
2175
|
+
(label || !indeterminate && showValue) && /* @__PURE__ */ jsxs20("div", { className: "fe-progress__meta", children: [
|
|
2176
|
+
label && /* @__PURE__ */ jsx22("span", { className: "fe-progress__label", children: label }),
|
|
2177
|
+
!indeterminate && showValue && /* @__PURE__ */ jsx22("output", { className: "fe-progress__value", children: visibleValue })
|
|
1769
2178
|
] }),
|
|
1770
|
-
/* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ jsx22("div", { className: "fe-progress__track", role: "progressbar", "aria-label": ariaLabel ?? (typeof label === "string" ? label : "Progress"), "aria-valuemin": indeterminate ? void 0 : 0, "aria-valuemax": indeterminate ? void 0 : max, "aria-valuenow": indeterminate ? void 0 : Number(value), "aria-valuetext": indeterminate ? "Loading" : visibleValue, children: /* @__PURE__ */ jsx22("span", { className: "fe-progress__indicator" }) })
|
|
1771
2180
|
] });
|
|
1772
2181
|
}
|
|
1773
2182
|
|
|
1774
2183
|
// packages/chip/src/index.tsx
|
|
1775
|
-
import { jsx as
|
|
2184
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1776
2185
|
var statuses = ["default", "info", "success", "warning", "error", "neutral", "pending", "processing"];
|
|
1777
2186
|
function Chip({ children, status = "default", color, variant = "subtle", dot = false, onRemove, removeLabel = "Remove", className, style, ...props }) {
|
|
1778
2187
|
const usesCustomColor = Boolean(color);
|
|
@@ -1781,16 +2190,16 @@ function Chip({ children, status = "default", color, variant = "subtle", dot = f
|
|
|
1781
2190
|
...style
|
|
1782
2191
|
};
|
|
1783
2192
|
const resolvedStatus = statuses.includes(status) ? status : "default";
|
|
1784
|
-
return /* @__PURE__ */
|
|
1785
|
-
dot && /* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */
|
|
1787
|
-
onRemove && /* @__PURE__ */
|
|
2193
|
+
return /* @__PURE__ */ jsxs21("span", { className: ["fe-chip", `fe-chip--${variant}`, `fe-chip--${usesCustomColor ? "custom" : resolvedStatus}`, className].filter(Boolean).join(" "), style: chipStyle, ...props, children: [
|
|
2194
|
+
dot && /* @__PURE__ */ jsx23("span", { className: "fe-chip__dot", "aria-hidden": "true" }),
|
|
2195
|
+
/* @__PURE__ */ jsx23("span", { className: "fe-chip__content", children }),
|
|
2196
|
+
onRemove && /* @__PURE__ */ jsx23(Button, { hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: /* @__PURE__ */ jsx23(CloseIcon, { size: 14 }), "aria-label": removeLabel, onClick: onRemove, className: "fe-chip__remove" })
|
|
1788
2197
|
] });
|
|
1789
2198
|
}
|
|
1790
2199
|
|
|
1791
2200
|
// packages/message/src/index.tsx
|
|
1792
|
-
import { useEffect as
|
|
1793
|
-
import { jsx as
|
|
2201
|
+
import { useEffect as useEffect8, useState as useState12 } from "react";
|
|
2202
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1794
2203
|
var messageId = 0;
|
|
1795
2204
|
var entries = [];
|
|
1796
2205
|
var listeners = /* @__PURE__ */ new Set();
|
|
@@ -1823,22 +2232,22 @@ var message = {
|
|
|
1823
2232
|
};
|
|
1824
2233
|
var icons = { success: "\u2713", info: "i", warning: "!", error: "\xD7" };
|
|
1825
2234
|
function Message({ maxCount = 4, closeLabel = "Close notification", className, ...props }) {
|
|
1826
|
-
const [visibleEntries, setVisibleEntries] =
|
|
1827
|
-
|
|
2235
|
+
const [visibleEntries, setVisibleEntries] = useState12(entries);
|
|
2236
|
+
useEffect8(() => {
|
|
1828
2237
|
const listener = (nextEntries) => setVisibleEntries(nextEntries);
|
|
1829
2238
|
listeners.add(listener);
|
|
1830
2239
|
return () => {
|
|
1831
2240
|
listeners.delete(listener);
|
|
1832
2241
|
};
|
|
1833
2242
|
}, []);
|
|
1834
|
-
return /* @__PURE__ */
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
/* @__PURE__ */
|
|
1837
|
-
entry.title && /* @__PURE__ */
|
|
1838
|
-
/* @__PURE__ */
|
|
2243
|
+
return /* @__PURE__ */ jsx24("div", { className: ["fe-message-viewport", className].filter(Boolean).join(" "), "aria-live": "polite", ...props, children: visibleEntries.slice(-Math.max(1, maxCount)).map((entry) => /* @__PURE__ */ jsxs22("div", { className: `fe-message fe-message--${entry.severity ?? "info"}`, role: entry.severity === "error" ? "alert" : "status", children: [
|
|
2244
|
+
/* @__PURE__ */ jsx24("span", { className: "fe-message__icon", "aria-hidden": "true", children: icons[entry.severity ?? "info"] }),
|
|
2245
|
+
/* @__PURE__ */ jsxs22("div", { className: "fe-message__body", children: [
|
|
2246
|
+
entry.title && /* @__PURE__ */ jsx24("strong", { className: "fe-message__title", children: entry.title }),
|
|
2247
|
+
/* @__PURE__ */ jsx24("div", { className: "fe-message__content", children: entry.content })
|
|
1839
2248
|
] }),
|
|
1840
|
-
entry.action && /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
2249
|
+
entry.action && /* @__PURE__ */ jsx24("span", { className: "fe-message__action", children: entry.action }),
|
|
2250
|
+
/* @__PURE__ */ jsx24(Button, { className: "fe-message__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => dismiss(entry.id) })
|
|
1842
2251
|
] }, entry.id)) });
|
|
1843
2252
|
}
|
|
1844
2253
|
((Message2) => {
|
|
@@ -1852,8 +2261,8 @@ function Message({ maxCount = 4, closeLabel = "Close notification", className, .
|
|
|
1852
2261
|
})(Message || (Message = {}));
|
|
1853
2262
|
|
|
1854
2263
|
// packages/snackbar/src/index.tsx
|
|
1855
|
-
import { useEffect as
|
|
1856
|
-
import { jsx as
|
|
2264
|
+
import { useEffect as useEffect9 } from "react";
|
|
2265
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1857
2266
|
function Snackbar({
|
|
1858
2267
|
open,
|
|
1859
2268
|
message: message2,
|
|
@@ -1867,12 +2276,12 @@ function Snackbar({
|
|
|
1867
2276
|
}) {
|
|
1868
2277
|
const vertical = anchorOrigin.vertical ?? "bottom";
|
|
1869
2278
|
const horizontal = anchorOrigin.horizontal ?? "center";
|
|
1870
|
-
|
|
2279
|
+
useEffect9(() => {
|
|
1871
2280
|
if (!open || autoHideDuration === null) return void 0;
|
|
1872
2281
|
const timer = window.setTimeout(() => onClose?.("timeout"), autoHideDuration);
|
|
1873
2282
|
return () => window.clearTimeout(timer);
|
|
1874
2283
|
}, [open, autoHideDuration, onClose]);
|
|
1875
|
-
|
|
2284
|
+
useEffect9(() => {
|
|
1876
2285
|
if (!open) return void 0;
|
|
1877
2286
|
const onKeyDown = (event) => {
|
|
1878
2287
|
if (event.key === "Escape") onClose?.("escapeKeyDown");
|
|
@@ -1881,15 +2290,561 @@ function Snackbar({
|
|
|
1881
2290
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1882
2291
|
}, [open, onClose]);
|
|
1883
2292
|
if (!open) return null;
|
|
1884
|
-
return /* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
action && /* @__PURE__ */
|
|
1887
|
-
onClose && /* @__PURE__ */
|
|
2293
|
+
return /* @__PURE__ */ jsx25("div", { className: ["fe-snackbar", `fe-snackbar--${vertical}`, `fe-snackbar--${horizontal}`, className].filter(Boolean).join(" "), ...props, children: /* @__PURE__ */ jsxs23("div", { className: "fe-snackbar__content", role: "status", "aria-live": "polite", children: [
|
|
2294
|
+
/* @__PURE__ */ jsx25("span", { className: "fe-snackbar__message", children: message2 }),
|
|
2295
|
+
action && /* @__PURE__ */ jsx25("span", { className: "fe-snackbar__action", children: action }),
|
|
2296
|
+
onClose && /* @__PURE__ */ jsx25(Button, { className: "fe-snackbar__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => onClose("closeButton") })
|
|
1888
2297
|
] }) });
|
|
1889
2298
|
}
|
|
2299
|
+
|
|
2300
|
+
// packages/avatar/src/index.tsx
|
|
2301
|
+
import { Children, isValidElement as isValidElement2, useState as useState13 } from "react";
|
|
2302
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2303
|
+
var FALLBACK_AVATARS = [
|
|
2304
|
+
{
|
|
2305
|
+
background: "#E0E7FF",
|
|
2306
|
+
skin: "#F6C6A6",
|
|
2307
|
+
hair: "#432818",
|
|
2308
|
+
shirt: "#5B5BD6",
|
|
2309
|
+
accent: "#A5B4FC",
|
|
2310
|
+
hairStyle: 0,
|
|
2311
|
+
expression: 0
|
|
2312
|
+
},
|
|
2313
|
+
{
|
|
2314
|
+
background: "#FDE68A",
|
|
2315
|
+
skin: "#E7AF87",
|
|
2316
|
+
hair: "#5A3424",
|
|
2317
|
+
shirt: "#D97706",
|
|
2318
|
+
accent: "#FCD34D",
|
|
2319
|
+
hairStyle: 1,
|
|
2320
|
+
expression: 1
|
|
2321
|
+
},
|
|
2322
|
+
{
|
|
2323
|
+
background: "#CCFBF1",
|
|
2324
|
+
skin: "#F4C7A1",
|
|
2325
|
+
hair: "#1F2937",
|
|
2326
|
+
shirt: "#0F766E",
|
|
2327
|
+
accent: "#5EEAD4",
|
|
2328
|
+
hairStyle: 2,
|
|
2329
|
+
expression: 2
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
background: "#FCE7F3",
|
|
2333
|
+
skin: "#E5A47F",
|
|
2334
|
+
hair: "#6B2D2D",
|
|
2335
|
+
shirt: "#BE185D",
|
|
2336
|
+
accent: "#F9A8D4",
|
|
2337
|
+
hairStyle: 3,
|
|
2338
|
+
expression: 3,
|
|
2339
|
+
glasses: true
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
background: "#DBEAFE",
|
|
2343
|
+
skin: "#8B5E3C",
|
|
2344
|
+
hair: "#24130B",
|
|
2345
|
+
shirt: "#2563EB",
|
|
2346
|
+
accent: "#93C5FD",
|
|
2347
|
+
hairStyle: 0,
|
|
2348
|
+
expression: 1
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
background: "#DCFCE7",
|
|
2352
|
+
skin: "#D99B72",
|
|
2353
|
+
hair: "#3F2A20",
|
|
2354
|
+
shirt: "#15803D",
|
|
2355
|
+
accent: "#86EFAC",
|
|
2356
|
+
hairStyle: 1,
|
|
2357
|
+
expression: 2,
|
|
2358
|
+
glasses: true
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
background: "#EDE9FE",
|
|
2362
|
+
skin: "#F3C9AD",
|
|
2363
|
+
hair: "#33221A",
|
|
2364
|
+
shirt: "#7C3AED",
|
|
2365
|
+
accent: "#C4B5FD",
|
|
2366
|
+
hairStyle: 2,
|
|
2367
|
+
expression: 3
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
background: "#FFE4E6",
|
|
2371
|
+
skin: "#9B6547",
|
|
2372
|
+
hair: "#27150D",
|
|
2373
|
+
shirt: "#E11D48",
|
|
2374
|
+
accent: "#FDA4AF",
|
|
2375
|
+
hairStyle: 3,
|
|
2376
|
+
expression: 0
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
background: "#FEF3C7",
|
|
2380
|
+
skin: "#F0B88B",
|
|
2381
|
+
hair: "#855F3B",
|
|
2382
|
+
shirt: "#B45309",
|
|
2383
|
+
accent: "#FBBF24",
|
|
2384
|
+
hairStyle: 0,
|
|
2385
|
+
expression: 2,
|
|
2386
|
+
glasses: true
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
background: "#D1FAE5",
|
|
2390
|
+
skin: "#F8D0B0",
|
|
2391
|
+
hair: "#593A28",
|
|
2392
|
+
shirt: "#047857",
|
|
2393
|
+
accent: "#6EE7B7",
|
|
2394
|
+
hairStyle: 1,
|
|
2395
|
+
expression: 3
|
|
2396
|
+
},
|
|
2397
|
+
{
|
|
2398
|
+
background: "#E0F2FE",
|
|
2399
|
+
skin: "#CE8D65",
|
|
2400
|
+
hair: "#372015",
|
|
2401
|
+
shirt: "#0369A1",
|
|
2402
|
+
accent: "#7DD3FC",
|
|
2403
|
+
hairStyle: 2,
|
|
2404
|
+
expression: 0
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
background: "#F3E8FF",
|
|
2408
|
+
skin: "#F4C6A3",
|
|
2409
|
+
hair: "#2B1B15",
|
|
2410
|
+
shirt: "#9333EA",
|
|
2411
|
+
accent: "#D8B4FE",
|
|
2412
|
+
hairStyle: 3,
|
|
2413
|
+
expression: 1,
|
|
2414
|
+
glasses: true
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
background: "#FFE4C7",
|
|
2418
|
+
skin: "#A96D4C",
|
|
2419
|
+
hair: "#3A2116",
|
|
2420
|
+
shirt: "#C2410C",
|
|
2421
|
+
accent: "#FDBA74",
|
|
2422
|
+
hairStyle: 0,
|
|
2423
|
+
expression: 3
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
background: "#ECFCCB",
|
|
2427
|
+
skin: "#F6CCA9",
|
|
2428
|
+
hair: "#7C5135",
|
|
2429
|
+
shirt: "#4D7C0F",
|
|
2430
|
+
accent: "#BEF264",
|
|
2431
|
+
hairStyle: 1,
|
|
2432
|
+
expression: 0
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
background: "#CFFAFE",
|
|
2436
|
+
skin: "#E7A27A",
|
|
2437
|
+
hair: "#1F1814",
|
|
2438
|
+
shirt: "#0E7490",
|
|
2439
|
+
accent: "#67E8F9",
|
|
2440
|
+
hairStyle: 2,
|
|
2441
|
+
expression: 1,
|
|
2442
|
+
glasses: true
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
background: "#FAE8FF",
|
|
2446
|
+
skin: "#F5C9AA",
|
|
2447
|
+
hair: "#5F3344",
|
|
2448
|
+
shirt: "#A21CAF",
|
|
2449
|
+
accent: "#F0ABFC",
|
|
2450
|
+
hairStyle: 3,
|
|
2451
|
+
expression: 2
|
|
2452
|
+
},
|
|
2453
|
+
{
|
|
2454
|
+
background: "#E0E7FF",
|
|
2455
|
+
skin: "#CF8F67",
|
|
2456
|
+
hair: "#1E1B18",
|
|
2457
|
+
shirt: "#4338CA",
|
|
2458
|
+
accent: "#A5B4FC",
|
|
2459
|
+
hairStyle: 0,
|
|
2460
|
+
expression: 3,
|
|
2461
|
+
glasses: true
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
background: "#FFEDD5",
|
|
2465
|
+
skin: "#F7C9A6",
|
|
2466
|
+
hair: "#4E3326",
|
|
2467
|
+
shirt: "#EA580C",
|
|
2468
|
+
accent: "#FDBA74",
|
|
2469
|
+
hairStyle: 1,
|
|
2470
|
+
expression: 0
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
background: "#D9F99D",
|
|
2474
|
+
skin: "#A66A49",
|
|
2475
|
+
hair: "#2B1911",
|
|
2476
|
+
shirt: "#65A30D",
|
|
2477
|
+
accent: "#BEF264",
|
|
2478
|
+
hairStyle: 2,
|
|
2479
|
+
expression: 1
|
|
2480
|
+
},
|
|
2481
|
+
{
|
|
2482
|
+
background: "#FCE7F3",
|
|
2483
|
+
skin: "#E9B08A",
|
|
2484
|
+
hair: "#4A2F24",
|
|
2485
|
+
shirt: "#DB2777",
|
|
2486
|
+
accent: "#F9A8D4",
|
|
2487
|
+
hairStyle: 3,
|
|
2488
|
+
expression: 2,
|
|
2489
|
+
glasses: true
|
|
2490
|
+
},
|
|
2491
|
+
{
|
|
2492
|
+
background: "#DBEAFE",
|
|
2493
|
+
skin: "#F2C3A1",
|
|
2494
|
+
hair: "#312018",
|
|
2495
|
+
shirt: "#1D4ED8",
|
|
2496
|
+
accent: "#93C5FD",
|
|
2497
|
+
hairStyle: 0,
|
|
2498
|
+
expression: 0
|
|
2499
|
+
},
|
|
2500
|
+
{
|
|
2501
|
+
background: "#CCFBF1",
|
|
2502
|
+
skin: "#9D6244",
|
|
2503
|
+
hair: "#1F130E",
|
|
2504
|
+
shirt: "#0D9488",
|
|
2505
|
+
accent: "#5EEAD4",
|
|
2506
|
+
hairStyle: 1,
|
|
2507
|
+
expression: 1,
|
|
2508
|
+
glasses: true
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
background: "#FEE2E2",
|
|
2512
|
+
skin: "#F6CBAA",
|
|
2513
|
+
hair: "#75452A",
|
|
2514
|
+
shirt: "#DC2626",
|
|
2515
|
+
accent: "#FCA5A5",
|
|
2516
|
+
hairStyle: 2,
|
|
2517
|
+
expression: 2
|
|
2518
|
+
},
|
|
2519
|
+
{
|
|
2520
|
+
background: "#EDE9FE",
|
|
2521
|
+
skin: "#D98E65",
|
|
2522
|
+
hair: "#412720",
|
|
2523
|
+
shirt: "#6D28D9",
|
|
2524
|
+
accent: "#C4B5FD",
|
|
2525
|
+
hairStyle: 3,
|
|
2526
|
+
expression: 3
|
|
2527
|
+
},
|
|
2528
|
+
{
|
|
2529
|
+
background: "#FEF9C3",
|
|
2530
|
+
skin: "#F5C7A4",
|
|
2531
|
+
hair: "#2B1A12",
|
|
2532
|
+
shirt: "#A16207",
|
|
2533
|
+
accent: "#FDE047",
|
|
2534
|
+
hairStyle: 0,
|
|
2535
|
+
expression: 1,
|
|
2536
|
+
glasses: true
|
|
2537
|
+
},
|
|
2538
|
+
{
|
|
2539
|
+
background: "#DCFCE7",
|
|
2540
|
+
skin: "#B97855",
|
|
2541
|
+
hair: "#291A13",
|
|
2542
|
+
shirt: "#16A34A",
|
|
2543
|
+
accent: "#86EFAC",
|
|
2544
|
+
hairStyle: 1,
|
|
2545
|
+
expression: 2
|
|
2546
|
+
},
|
|
2547
|
+
{
|
|
2548
|
+
background: "#E0F2FE",
|
|
2549
|
+
skin: "#F6C5A2",
|
|
2550
|
+
hair: "#6A4031",
|
|
2551
|
+
shirt: "#0284C7",
|
|
2552
|
+
accent: "#7DD3FC",
|
|
2553
|
+
hairStyle: 2,
|
|
2554
|
+
expression: 3,
|
|
2555
|
+
glasses: true
|
|
2556
|
+
},
|
|
2557
|
+
{
|
|
2558
|
+
background: "#FAE8FF",
|
|
2559
|
+
skin: "#DE9B72",
|
|
2560
|
+
hair: "#211714",
|
|
2561
|
+
shirt: "#C026D3",
|
|
2562
|
+
accent: "#F0ABFC",
|
|
2563
|
+
hairStyle: 3,
|
|
2564
|
+
expression: 0
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
background: "#FFE4E6",
|
|
2568
|
+
skin: "#F7CEAF",
|
|
2569
|
+
hair: "#42291E",
|
|
2570
|
+
shirt: "#E11D48",
|
|
2571
|
+
accent: "#FDA4AF",
|
|
2572
|
+
hairStyle: 0,
|
|
2573
|
+
expression: 2
|
|
2574
|
+
},
|
|
2575
|
+
{
|
|
2576
|
+
background: "#ECFCCB",
|
|
2577
|
+
skin: "#CE8C65",
|
|
2578
|
+
hair: "#3C2419",
|
|
2579
|
+
shirt: "#3F6212",
|
|
2580
|
+
accent: "#BEF264",
|
|
2581
|
+
hairStyle: 1,
|
|
2582
|
+
expression: 3,
|
|
2583
|
+
glasses: true
|
|
2584
|
+
},
|
|
2585
|
+
{
|
|
2586
|
+
background: "#CFFAFE",
|
|
2587
|
+
skin: "#F0BE99",
|
|
2588
|
+
hair: "#29201B",
|
|
2589
|
+
shirt: "#0891B2",
|
|
2590
|
+
accent: "#67E8F9",
|
|
2591
|
+
hairStyle: 2,
|
|
2592
|
+
expression: 0
|
|
2593
|
+
},
|
|
2594
|
+
{
|
|
2595
|
+
background: "#F3E8FF",
|
|
2596
|
+
skin: "#A76B4B",
|
|
2597
|
+
hair: "#241710",
|
|
2598
|
+
shirt: "#7E22CE",
|
|
2599
|
+
accent: "#D8B4FE",
|
|
2600
|
+
hairStyle: 3,
|
|
2601
|
+
expression: 1,
|
|
2602
|
+
glasses: true
|
|
2603
|
+
}
|
|
2604
|
+
];
|
|
2605
|
+
function getInitials(content) {
|
|
2606
|
+
const words = content.trim().split(/\s+/).filter(Boolean);
|
|
2607
|
+
return words.slice(-2).map((word) => Array.from(word)[0] ?? "").join("").toLocaleUpperCase();
|
|
2608
|
+
}
|
|
2609
|
+
function resolveSize(size) {
|
|
2610
|
+
if (typeof size === "number") return `${size}px`;
|
|
2611
|
+
return /^\d+(?:\.\d+)?$/.test(size) ? `${size}px` : size;
|
|
2612
|
+
}
|
|
2613
|
+
function resolveFontSize(size) {
|
|
2614
|
+
const numericSize = typeof size === "number" ? size : Number(size);
|
|
2615
|
+
if (Number.isFinite(numericSize)) {
|
|
2616
|
+
return `${Math.min(28, Math.max(10, numericSize * 0.38))}px`;
|
|
2617
|
+
}
|
|
2618
|
+
return "1em";
|
|
2619
|
+
}
|
|
2620
|
+
function getFallbackIndex(index) {
|
|
2621
|
+
if (!Number.isFinite(index)) return 0;
|
|
2622
|
+
return Math.abs(Math.trunc(index)) % FALLBACK_AVATARS.length;
|
|
2623
|
+
}
|
|
2624
|
+
function AvatarFallbackIcon({ avatar }) {
|
|
2625
|
+
const {
|
|
2626
|
+
accent,
|
|
2627
|
+
background,
|
|
2628
|
+
expression,
|
|
2629
|
+
glasses,
|
|
2630
|
+
hair,
|
|
2631
|
+
hairStyle,
|
|
2632
|
+
shirt,
|
|
2633
|
+
skin
|
|
2634
|
+
} = avatar;
|
|
2635
|
+
return /* @__PURE__ */ jsxs24(
|
|
2636
|
+
"svg",
|
|
2637
|
+
{
|
|
2638
|
+
className: "fe-avatar__fallback-icon",
|
|
2639
|
+
viewBox: "0 0 24 24",
|
|
2640
|
+
focusable: "false",
|
|
2641
|
+
"aria-hidden": "true",
|
|
2642
|
+
children: [
|
|
2643
|
+
/* @__PURE__ */ jsx26("rect", { width: "24", height: "24", fill: background }),
|
|
2644
|
+
/* @__PURE__ */ jsx26(
|
|
2645
|
+
"path",
|
|
2646
|
+
{
|
|
2647
|
+
d: "M3 24c.52-3.79 3.58-6.25 9-6.25S20.48 20.21 21 24",
|
|
2648
|
+
fill: shirt
|
|
2649
|
+
}
|
|
2650
|
+
),
|
|
2651
|
+
/* @__PURE__ */ jsx26(
|
|
2652
|
+
"path",
|
|
2653
|
+
{
|
|
2654
|
+
d: "M8.1 17.65h7.8l1.05 2.05H7.05l1.05-2.05Z",
|
|
2655
|
+
fill: accent,
|
|
2656
|
+
opacity: ".72"
|
|
2657
|
+
}
|
|
2658
|
+
),
|
|
2659
|
+
/* @__PURE__ */ jsx26("circle", { cx: "12", cy: "10.25", r: "5.25", fill: skin }),
|
|
2660
|
+
hairStyle === 0 && /* @__PURE__ */ jsx26(
|
|
2661
|
+
"path",
|
|
2662
|
+
{
|
|
2663
|
+
d: "M6.75 10.25C6.75 6.34 9.02 4 12.15 4c3.22 0 5.1 2.33 5.1 5.54-1.6-1.41-3.46-2.1-5.59-2.1-1.63 0-3.27.56-4.91 1.68Z",
|
|
2664
|
+
fill: hair
|
|
2665
|
+
}
|
|
2666
|
+
),
|
|
2667
|
+
hairStyle === 1 && /* @__PURE__ */ jsx26(
|
|
2668
|
+
"path",
|
|
2669
|
+
{
|
|
2670
|
+
d: "M6.6 10.1c.16-3.93 2.57-6.2 5.62-6.2 3.57 0 5.3 2.75 5.08 6.32-1.42-1.23-2.91-1.82-4.48-1.82-2.4 0-3.9.65-6.22 1.7Z",
|
|
2671
|
+
fill: hair
|
|
2672
|
+
}
|
|
2673
|
+
),
|
|
2674
|
+
hairStyle === 2 && /* @__PURE__ */ jsx26(
|
|
2675
|
+
"path",
|
|
2676
|
+
{
|
|
2677
|
+
d: "M6.8 10.55C6.8 6.28 9.43 4 12.2 4c3.46 0 5.13 2.83 4.93 6.38-1.38-1.58-3.03-2.38-4.92-2.38-1.81 0-3.61.85-5.41 2.55Z",
|
|
2678
|
+
fill: hair
|
|
2679
|
+
}
|
|
2680
|
+
),
|
|
2681
|
+
hairStyle === 3 && /* @__PURE__ */ jsx26(
|
|
2682
|
+
"path",
|
|
2683
|
+
{
|
|
2684
|
+
d: "M6.66 10.1C6.94 6.12 9.18 4 12.1 4c3.77 0 5.2 2.95 5.18 6.21-1.5-1.07-3.1-1.6-4.8-1.6-2.18 0-3.98.5-5.82 1.49Z",
|
|
2685
|
+
fill: hair
|
|
2686
|
+
}
|
|
2687
|
+
),
|
|
2688
|
+
/* @__PURE__ */ jsx26("circle", { cx: "10.05", cy: "10.65", r: ".48", fill: "#3B2924" }),
|
|
2689
|
+
/* @__PURE__ */ jsx26("circle", { cx: "13.95", cy: "10.65", r: ".48", fill: "#3B2924" }),
|
|
2690
|
+
expression === 0 && /* @__PURE__ */ jsx26(
|
|
2691
|
+
"path",
|
|
2692
|
+
{
|
|
2693
|
+
d: "M10.25 13.2c1.08.66 2.42.66 3.5 0",
|
|
2694
|
+
fill: "none",
|
|
2695
|
+
stroke: "#A94F4F",
|
|
2696
|
+
strokeWidth: ".7",
|
|
2697
|
+
strokeLinecap: "round"
|
|
2698
|
+
}
|
|
2699
|
+
),
|
|
2700
|
+
expression === 1 && /* @__PURE__ */ jsx26(
|
|
2701
|
+
"path",
|
|
2702
|
+
{
|
|
2703
|
+
d: "M10.5 13.2h3",
|
|
2704
|
+
fill: "none",
|
|
2705
|
+
stroke: "#A94F4F",
|
|
2706
|
+
strokeWidth: ".7",
|
|
2707
|
+
strokeLinecap: "round"
|
|
2708
|
+
}
|
|
2709
|
+
),
|
|
2710
|
+
expression === 2 && /* @__PURE__ */ jsx26(
|
|
2711
|
+
"path",
|
|
2712
|
+
{
|
|
2713
|
+
d: "M10.6 13.38c.84-.44 1.96-.44 2.8 0",
|
|
2714
|
+
fill: "none",
|
|
2715
|
+
stroke: "#A94F4F",
|
|
2716
|
+
strokeWidth: ".7",
|
|
2717
|
+
strokeLinecap: "round"
|
|
2718
|
+
}
|
|
2719
|
+
),
|
|
2720
|
+
expression === 3 && /* @__PURE__ */ jsx26("circle", { cx: "12", cy: "13.2", r: ".82", fill: "#B95A5A" }),
|
|
2721
|
+
glasses && /* @__PURE__ */ jsxs24("g", { fill: "none", stroke: "#3C4355", strokeWidth: ".65", children: [
|
|
2722
|
+
/* @__PURE__ */ jsx26("circle", { cx: "10", cy: "10.55", r: "1.45" }),
|
|
2723
|
+
/* @__PURE__ */ jsx26("circle", { cx: "14", cy: "10.55", r: "1.45" }),
|
|
2724
|
+
/* @__PURE__ */ jsx26("path", { d: "M11.45 10.55h1.1M8.55 10.55H7.5m9 0h-1.05" })
|
|
2725
|
+
] })
|
|
2726
|
+
]
|
|
2727
|
+
}
|
|
2728
|
+
);
|
|
2729
|
+
}
|
|
2730
|
+
function Avatar({
|
|
2731
|
+
src,
|
|
2732
|
+
content,
|
|
2733
|
+
alt,
|
|
2734
|
+
size = 40,
|
|
2735
|
+
shape = "circle",
|
|
2736
|
+
fallbackIndex,
|
|
2737
|
+
className,
|
|
2738
|
+
style,
|
|
2739
|
+
role,
|
|
2740
|
+
"aria-label": ariaLabel,
|
|
2741
|
+
...props
|
|
2742
|
+
}) {
|
|
2743
|
+
const [generatedFallbackIndex] = useState13(
|
|
2744
|
+
() => Math.floor(Math.random() * FALLBACK_AVATARS.length)
|
|
2745
|
+
);
|
|
2746
|
+
const [failedImageSrc, setFailedImageSrc] = useState13();
|
|
2747
|
+
const imageSrc = src?.trim();
|
|
2748
|
+
const trimmedContent = content?.trim() ?? "";
|
|
2749
|
+
const showImage = Boolean(imageSrc && failedImageSrc !== imageSrc);
|
|
2750
|
+
const initials = trimmedContent ? getInitials(trimmedContent) : "";
|
|
2751
|
+
const selectedFallback = FALLBACK_AVATARS[getFallbackIndex(fallbackIndex ?? generatedFallbackIndex)];
|
|
2752
|
+
const avatarStyle = {
|
|
2753
|
+
"--fe-avatar-size": resolveSize(size),
|
|
2754
|
+
"--fe-avatar-font-size": resolveFontSize(size),
|
|
2755
|
+
...style
|
|
2756
|
+
};
|
|
2757
|
+
const fallbackLabel = (alt ?? trimmedContent) || "Avatar";
|
|
2758
|
+
return /* @__PURE__ */ jsxs24(
|
|
2759
|
+
"span",
|
|
2760
|
+
{
|
|
2761
|
+
className: ["fe-avatar", `fe-avatar--${shape}`, className].filter(Boolean).join(" "),
|
|
2762
|
+
style: avatarStyle,
|
|
2763
|
+
role: showImage ? role : role ?? "img",
|
|
2764
|
+
"aria-label": showImage ? ariaLabel : ariaLabel ?? fallbackLabel,
|
|
2765
|
+
...props,
|
|
2766
|
+
children: [
|
|
2767
|
+
showImage && /* @__PURE__ */ jsx26(
|
|
2768
|
+
"img",
|
|
2769
|
+
{
|
|
2770
|
+
className: "fe-avatar__image",
|
|
2771
|
+
src: imageSrc,
|
|
2772
|
+
alt: alt ?? trimmedContent,
|
|
2773
|
+
onError: () => setFailedImageSrc(imageSrc)
|
|
2774
|
+
}
|
|
2775
|
+
),
|
|
2776
|
+
!showImage && initials && /* @__PURE__ */ jsx26("span", { className: "fe-avatar__initials", "aria-hidden": "true", children: initials }),
|
|
2777
|
+
!showImage && !initials && /* @__PURE__ */ jsx26(AvatarFallbackIcon, { avatar: selectedFallback })
|
|
2778
|
+
]
|
|
2779
|
+
}
|
|
2780
|
+
);
|
|
2781
|
+
}
|
|
2782
|
+
function AvatarGroup({
|
|
2783
|
+
children,
|
|
2784
|
+
maxCount,
|
|
2785
|
+
className,
|
|
2786
|
+
style,
|
|
2787
|
+
role,
|
|
2788
|
+
...props
|
|
2789
|
+
}) {
|
|
2790
|
+
const avatars = Children.toArray(children).filter(isValidElement2);
|
|
2791
|
+
const hasMaxCount = typeof maxCount === "number" && Number.isFinite(maxCount) && maxCount > 0;
|
|
2792
|
+
const itemLimit = hasMaxCount ? Math.floor(maxCount) : avatars.length;
|
|
2793
|
+
const hasOverflow = avatars.length > itemLimit;
|
|
2794
|
+
const visibleCount = hasOverflow ? Math.max(0, itemLimit - 1) : itemLimit;
|
|
2795
|
+
const visibleAvatars = avatars.slice(0, visibleCount);
|
|
2796
|
+
const overflowCount = avatars.length - visibleAvatars.length;
|
|
2797
|
+
const firstAvatarSize = avatars[0]?.props.size ?? 40;
|
|
2798
|
+
const overflowStyle = {
|
|
2799
|
+
"--fe-avatar-size": resolveSize(firstAvatarSize),
|
|
2800
|
+
"--fe-avatar-font-size": resolveFontSize(firstAvatarSize)
|
|
2801
|
+
};
|
|
2802
|
+
const singleContent = avatars.length === 1 ? avatars[0]?.props.content?.trim() ?? "" : "";
|
|
2803
|
+
return /* @__PURE__ */ jsxs24(
|
|
2804
|
+
"div",
|
|
2805
|
+
{
|
|
2806
|
+
className: ["fe-avatar-group", className].filter(Boolean).join(" "),
|
|
2807
|
+
style,
|
|
2808
|
+
role: role ?? "group",
|
|
2809
|
+
...props,
|
|
2810
|
+
children: [
|
|
2811
|
+
/* @__PURE__ */ jsxs24("div", { className: "fe-avatar-group__items", children: [
|
|
2812
|
+
visibleAvatars.map((avatar, index) => /* @__PURE__ */ jsx26(
|
|
2813
|
+
"span",
|
|
2814
|
+
{
|
|
2815
|
+
className: "fe-avatar-group__item",
|
|
2816
|
+
style: { zIndex: visibleAvatars.length - index },
|
|
2817
|
+
children: avatar
|
|
2818
|
+
},
|
|
2819
|
+
avatar.key ?? index
|
|
2820
|
+
)),
|
|
2821
|
+
hasOverflow && /* @__PURE__ */ jsxs24(
|
|
2822
|
+
"span",
|
|
2823
|
+
{
|
|
2824
|
+
className: "fe-avatar-group__more",
|
|
2825
|
+
style: overflowStyle,
|
|
2826
|
+
role: "img",
|
|
2827
|
+
"aria-label": `${overflowCount} more avatars`,
|
|
2828
|
+
children: [
|
|
2829
|
+
"+",
|
|
2830
|
+
overflowCount
|
|
2831
|
+
]
|
|
2832
|
+
}
|
|
2833
|
+
)
|
|
2834
|
+
] }),
|
|
2835
|
+
singleContent && /* @__PURE__ */ jsx26("span", { className: "fe-avatar-group__content", children: singleContent })
|
|
2836
|
+
]
|
|
2837
|
+
}
|
|
2838
|
+
);
|
|
2839
|
+
}
|
|
1890
2840
|
export {
|
|
2841
|
+
Avatar,
|
|
2842
|
+
AvatarGroup,
|
|
1891
2843
|
Button,
|
|
2844
|
+
ButtonBar,
|
|
2845
|
+
Checkbox,
|
|
1892
2846
|
ChevronDownIcon,
|
|
2847
|
+
ChevronUpIcon,
|
|
1893
2848
|
Chip,
|
|
1894
2849
|
CloseIcon,
|
|
1895
2850
|
CurrencyInput,
|
|
@@ -1899,10 +2854,14 @@ export {
|
|
|
1899
2854
|
Loading,
|
|
1900
2855
|
Message,
|
|
1901
2856
|
Modal,
|
|
2857
|
+
MoreHorizontalIcon,
|
|
2858
|
+
MoreVerticalIcon,
|
|
1902
2859
|
NumberInput,
|
|
1903
2860
|
Pagination,
|
|
1904
2861
|
PlusIcon,
|
|
1905
2862
|
ProgressBar,
|
|
2863
|
+
RadioButton,
|
|
2864
|
+
RadioGroup,
|
|
1906
2865
|
SearchIcon,
|
|
1907
2866
|
Selection,
|
|
1908
2867
|
Skeleton,
|