@dragunio/fe-libs 0.1.6 → 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 +11 -1
- package/dist/{chunk-NDMLXSI5.mjs → chunk-GT4546FD.mjs} +16 -0
- package/dist/icons.d.mts +3 -1
- package/dist/icons.d.ts +3 -1
- package/dist/icons.js +18 -0
- package/dist/icons.mjs +5 -1
- package/dist/index.d.mts +52 -3
- package/dist/index.d.ts +52 -3
- package/dist/index.js +967 -300
- package/dist/index.mjs +938 -290
- package/dist/styles.css +123 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
ChevronDownIcon,
|
|
3
3
|
ChevronUpIcon,
|
|
4
4
|
CloseIcon,
|
|
5
|
+
MoreHorizontalIcon,
|
|
6
|
+
MoreVerticalIcon,
|
|
5
7
|
PlusIcon,
|
|
6
8
|
SearchIcon,
|
|
7
9
|
arrow_left,
|
|
@@ -21,7 +23,7 @@ import {
|
|
|
21
23
|
search,
|
|
22
24
|
trash,
|
|
23
25
|
x_close
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GT4546FD.mjs";
|
|
25
27
|
|
|
26
28
|
// packages/button/src/index.tsx
|
|
27
29
|
import { forwardRef } from "react";
|
|
@@ -89,21 +91,121 @@ var Button = forwardRef(
|
|
|
89
91
|
);
|
|
90
92
|
Button.displayName = "Button";
|
|
91
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
|
+
|
|
92
194
|
// packages/table/src/index.tsx
|
|
93
195
|
import {
|
|
94
196
|
createContext,
|
|
95
197
|
isValidElement,
|
|
96
198
|
useCallback,
|
|
97
199
|
useContext,
|
|
98
|
-
useEffect,
|
|
200
|
+
useEffect as useEffect2,
|
|
99
201
|
useMemo as useMemo2,
|
|
100
|
-
useRef,
|
|
101
|
-
useState as
|
|
202
|
+
useRef as useRef2,
|
|
203
|
+
useState as useState3
|
|
102
204
|
} from "react";
|
|
103
205
|
|
|
104
206
|
// packages/pagination/src/index.tsx
|
|
105
|
-
import { useMemo, useState } from "react";
|
|
106
|
-
import { jsx as
|
|
207
|
+
import { useMemo, useState as useState2 } from "react";
|
|
208
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
107
209
|
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
108
210
|
var range = (start, end) => Array.from({ length: Math.max(0, end - start + 1) }, (_, index) => start + index);
|
|
109
211
|
function getItems(totalPages, page, siblingCount, boundaryCount) {
|
|
@@ -135,7 +237,7 @@ function Pagination({
|
|
|
135
237
|
...props
|
|
136
238
|
}) {
|
|
137
239
|
const safeTotalPages = Math.max(1, Math.floor(totalPages));
|
|
138
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
240
|
+
const [uncontrolledPage, setUncontrolledPage] = useState2(() => clamp(defaultPage, 1, safeTotalPages));
|
|
139
241
|
const currentPage = clamp(page ?? uncontrolledPage, 1, safeTotalPages);
|
|
140
242
|
const items = useMemo(
|
|
141
243
|
() => getItems(safeTotalPages, currentPage, Math.max(0, siblingCount), Math.max(0, boundaryCount)),
|
|
@@ -146,9 +248,9 @@ function Pagination({
|
|
|
146
248
|
if (page === void 0) setUncontrolledPage(resolvedPage);
|
|
147
249
|
if (resolvedPage !== currentPage) onPageChange?.(resolvedPage);
|
|
148
250
|
};
|
|
149
|
-
return /* @__PURE__ */
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
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(
|
|
152
254
|
Button,
|
|
153
255
|
{
|
|
154
256
|
className: "fe-pagination__button",
|
|
@@ -162,12 +264,12 @@ function Pagination({
|
|
|
162
264
|
},
|
|
163
265
|
item
|
|
164
266
|
)),
|
|
165
|
-
/* @__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) })
|
|
166
268
|
] });
|
|
167
269
|
}
|
|
168
270
|
|
|
169
271
|
// packages/table/src/index.tsx
|
|
170
|
-
import { jsx as
|
|
272
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
171
273
|
var TableContext = createContext({ striped: false });
|
|
172
274
|
var MIN_COLUMN_WIDTH = 96;
|
|
173
275
|
var MAX_COLUMN_WIDTH = 1200;
|
|
@@ -217,24 +319,24 @@ function DataTable({
|
|
|
217
319
|
() => getInitialColumnSizes(headers, data, defaultColumnSizes, safeMinWidth),
|
|
218
320
|
[headers, data, defaultColumnSizes, safeMinWidth]
|
|
219
321
|
);
|
|
220
|
-
const [uncontrolledSizes, setUncontrolledSizes] =
|
|
322
|
+
const [uncontrolledSizes, setUncontrolledSizes] = useState3(generatedSizes);
|
|
221
323
|
const shouldPaginate = pagination ?? pageSize !== void 0;
|
|
222
324
|
const safePageSize = Math.max(1, Math.floor(pageSize ?? 10));
|
|
223
325
|
const totalPages = Math.max(1, Math.ceil(data.length / safePageSize));
|
|
224
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
326
|
+
const [uncontrolledPage, setUncontrolledPage] = useState3(() => Math.min(Math.max(1, defaultPage), totalPages));
|
|
225
327
|
const currentPage = Math.min(Math.max(1, page ?? uncontrolledPage), totalPages);
|
|
226
328
|
const pagedData = shouldPaginate ? data.slice((currentPage - 1) * safePageSize, currentPage * safePageSize) : data;
|
|
227
|
-
const resizeState =
|
|
228
|
-
const [isResizing, setIsResizing] =
|
|
329
|
+
const resizeState = useRef2();
|
|
330
|
+
const [isResizing, setIsResizing] = useState3(false);
|
|
229
331
|
const sizes2 = columnSizes ? getInitialColumnSizes(headers, data, columnSizes, safeMinWidth).map((size) => Math.max(safeMinWidth, size)) : uncontrolledSizes.map((size) => Math.max(safeMinWidth, size));
|
|
230
|
-
|
|
332
|
+
useEffect2(() => {
|
|
231
333
|
if (columnSizes) return;
|
|
232
334
|
setUncontrolledSizes((currentSizes) => {
|
|
233
335
|
const nextSizes = generatedSizes.map((generatedSize, index) => currentSizes[index] ?? generatedSize);
|
|
234
336
|
return sameSizes(currentSizes, nextSizes) ? currentSizes : nextSizes;
|
|
235
337
|
});
|
|
236
338
|
}, [columnSizes, generatedSizes]);
|
|
237
|
-
|
|
339
|
+
useEffect2(() => {
|
|
238
340
|
if (page === void 0 && uncontrolledPage > totalPages) setUncontrolledPage(totalPages);
|
|
239
341
|
}, [page, totalPages, uncontrolledPage]);
|
|
240
342
|
const updateColumnSize = useCallback((columnIndex, nextSize) => {
|
|
@@ -243,7 +345,7 @@ function DataTable({
|
|
|
243
345
|
if (!columnSizes) setUncontrolledSizes(nextSizes);
|
|
244
346
|
onColumnResize?.(nextSizes, columnIndex);
|
|
245
347
|
}, [columnSizes, onColumnResize, safeMinWidth, sizes2]);
|
|
246
|
-
|
|
348
|
+
useEffect2(() => {
|
|
247
349
|
const onPointerMove = (event) => {
|
|
248
350
|
const activeResize = resizeState.current;
|
|
249
351
|
if (!activeResize) return;
|
|
@@ -267,14 +369,14 @@ function DataTable({
|
|
|
267
369
|
if (nextPage !== currentPage) onPageChange?.(nextPage);
|
|
268
370
|
};
|
|
269
371
|
const resolvedPaginationPosition = paginationPosition === "middle-bottom" ? "bottom-center" : paginationPosition;
|
|
270
|
-
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */
|
|
271
|
-
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: [
|
|
272
374
|
resolvedPaginationPosition === "top-right" && paginationControl,
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
/* @__PURE__ */
|
|
277
|
-
/* @__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(
|
|
278
380
|
"span",
|
|
279
381
|
{
|
|
280
382
|
className: "fe-table__resize-handle",
|
|
@@ -298,7 +400,7 @@ function DataTable({
|
|
|
298
400
|
}
|
|
299
401
|
)
|
|
300
402
|
] }, columnIndex)) }) }),
|
|
301
|
-
/* @__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)) })
|
|
302
404
|
] }),
|
|
303
405
|
resolvedPaginationPosition !== "top-right" && paginationControl
|
|
304
406
|
] });
|
|
@@ -316,34 +418,34 @@ function Table({
|
|
|
316
418
|
paginationPosition,
|
|
317
419
|
...props
|
|
318
420
|
}) {
|
|
319
|
-
if (headers || data) return /* @__PURE__ */
|
|
320
|
-
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 }) });
|
|
321
423
|
}
|
|
322
424
|
function TableHead(props) {
|
|
323
|
-
return /* @__PURE__ */
|
|
425
|
+
return /* @__PURE__ */ jsx4("thead", { ...props });
|
|
324
426
|
}
|
|
325
427
|
function TableBody(props) {
|
|
326
|
-
return /* @__PURE__ */
|
|
428
|
+
return /* @__PURE__ */ jsx4("tbody", { ...props });
|
|
327
429
|
}
|
|
328
430
|
function TableRow({ children, ...props }) {
|
|
329
431
|
const { striped } = useContext(TableContext);
|
|
330
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsx4("tr", { "data-striped": striped || void 0, ...props, children });
|
|
331
433
|
}
|
|
332
434
|
function TableCell({ children, ...props }) {
|
|
333
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ jsx4("td", { ...props, children });
|
|
334
436
|
}
|
|
335
437
|
function TableHeader({ children, ...props }) {
|
|
336
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ jsx4("th", { scope: "col", ...props, children });
|
|
337
439
|
}
|
|
338
440
|
function TableCaption(props) {
|
|
339
|
-
return /* @__PURE__ */
|
|
441
|
+
return /* @__PURE__ */ jsx4("caption", { ...props });
|
|
340
442
|
}
|
|
341
443
|
|
|
342
444
|
// packages/toggle/src/index.tsx
|
|
343
445
|
import {
|
|
344
446
|
forwardRef as forwardRef2
|
|
345
447
|
} from "react";
|
|
346
|
-
import { jsx as
|
|
448
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
347
449
|
var Toggle = forwardRef2(function Toggle2({
|
|
348
450
|
color = "#16a34a",
|
|
349
451
|
label,
|
|
@@ -358,9 +460,9 @@ var Toggle = forwardRef2(function Toggle2({
|
|
|
358
460
|
"--fe-toggle-color": color,
|
|
359
461
|
...style
|
|
360
462
|
};
|
|
361
|
-
return /* @__PURE__ */
|
|
362
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
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(
|
|
364
466
|
"input",
|
|
365
467
|
{
|
|
366
468
|
ref,
|
|
@@ -371,18 +473,18 @@ var Toggle = forwardRef2(function Toggle2({
|
|
|
371
473
|
...props
|
|
372
474
|
}
|
|
373
475
|
),
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
476
|
+
/* @__PURE__ */ jsx5("span", { className: "fe-toggle__control", "aria-hidden": "true" }),
|
|
477
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx5("span", { className: "fe-toggle__label", children: label })
|
|
376
478
|
] });
|
|
377
479
|
});
|
|
378
480
|
Toggle.displayName = "Toggle";
|
|
379
481
|
|
|
380
482
|
// packages/drawer/src/index.tsx
|
|
381
|
-
import { useEffect as
|
|
483
|
+
import { useEffect as useEffect3 } from "react";
|
|
382
484
|
import { createPortal } from "react-dom";
|
|
383
|
-
import { jsx as
|
|
485
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
384
486
|
function Drawer({ open, onClose, title, footer, side = "right", width = 400, fullScreen = false, children, closeOnBackdropClick = true, className, style, ...props }) {
|
|
385
|
-
|
|
487
|
+
useEffect3(() => {
|
|
386
488
|
if (!open) return;
|
|
387
489
|
const onKeyDown = (event) => {
|
|
388
490
|
if (event.key === "Escape") onClose();
|
|
@@ -392,27 +494,27 @@ function Drawer({ open, onClose, title, footer, side = "right", width = 400, ful
|
|
|
392
494
|
}, [onClose, open]);
|
|
393
495
|
if (!open || typeof document === "undefined") return null;
|
|
394
496
|
const panelStyle = !fullScreen && (side === "left" || side === "right") ? { ...style, width: typeof width === "number" ? `${width}px` : width } : style;
|
|
395
|
-
return createPortal(/* @__PURE__ */
|
|
497
|
+
return createPortal(/* @__PURE__ */ jsx6("div", { className: "fe-drawer-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
396
498
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
397
|
-
}, children: /* @__PURE__ */
|
|
398
|
-
/* @__PURE__ */
|
|
399
|
-
title && /* @__PURE__ */
|
|
400
|
-
/* @__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" })
|
|
401
503
|
] }),
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
footer && /* @__PURE__ */
|
|
504
|
+
/* @__PURE__ */ jsx6("div", { className: "fe-drawer__body", children }),
|
|
505
|
+
footer && /* @__PURE__ */ jsx6("footer", { className: "fe-drawer__footer", children: footer })
|
|
404
506
|
] }) }), document.body);
|
|
405
507
|
}
|
|
406
508
|
|
|
407
509
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
408
|
-
import { forwardRef as forwardRef3, useId as
|
|
510
|
+
import { forwardRef as forwardRef3, useId as useId3, useState as useState5 } from "react";
|
|
409
511
|
|
|
410
512
|
// packages/tooltip/src/index.tsx
|
|
411
|
-
import { cloneElement, useId, useState as
|
|
412
|
-
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";
|
|
413
515
|
function Tooltip({ content, children, placement = "top", disabled, className, ...props }) {
|
|
414
|
-
const [visible, setVisible] =
|
|
415
|
-
const id =
|
|
516
|
+
const [visible, setVisible] = useState4(false);
|
|
517
|
+
const id = useId2();
|
|
416
518
|
const trigger = cloneElement(children, { "aria-describedby": visible ? id : void 0, onMouseEnter: (event) => {
|
|
417
519
|
children.props.onMouseEnter?.(event);
|
|
418
520
|
setVisible(true);
|
|
@@ -426,14 +528,14 @@ function Tooltip({ content, children, placement = "top", disabled, className, ..
|
|
|
426
528
|
children.props.onBlur?.(event);
|
|
427
529
|
setVisible(false);
|
|
428
530
|
} });
|
|
429
|
-
return /* @__PURE__ */
|
|
531
|
+
return /* @__PURE__ */ jsxs7("span", { className: ["fe-tooltip", `fe-tooltip--${placement}`, className].filter(Boolean).join(" "), ...props, children: [
|
|
430
532
|
trigger,
|
|
431
|
-
visible && !disabled && /* @__PURE__ */
|
|
533
|
+
visible && !disabled && /* @__PURE__ */ jsx7("span", { id, role: "tooltip", className: "fe-tooltip__content", children: content })
|
|
432
534
|
] });
|
|
433
535
|
}
|
|
434
536
|
|
|
435
537
|
// packages/form-controls/src/controls/Field/field.tsx
|
|
436
|
-
import { jsx as
|
|
538
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
437
539
|
function getFieldError(error, errorMessage) {
|
|
438
540
|
if (errorMessage !== void 0 && errorMessage !== null) return errorMessage;
|
|
439
541
|
if (typeof error !== "boolean") return error;
|
|
@@ -450,10 +552,10 @@ function FieldLabel({
|
|
|
450
552
|
isRequired = false
|
|
451
553
|
}) {
|
|
452
554
|
if (!label) return null;
|
|
453
|
-
return /* @__PURE__ */
|
|
454
|
-
/* @__PURE__ */
|
|
455
|
-
isRequired && /* @__PURE__ */
|
|
456
|
-
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(
|
|
457
559
|
"span",
|
|
458
560
|
{
|
|
459
561
|
className: "fe-field__info",
|
|
@@ -472,7 +574,7 @@ function FieldMessage({
|
|
|
472
574
|
descriptionDisplay
|
|
473
575
|
}) {
|
|
474
576
|
if (error !== void 0 && error !== false && error !== null)
|
|
475
|
-
return /* @__PURE__ */
|
|
577
|
+
return /* @__PURE__ */ jsx8(
|
|
476
578
|
"span",
|
|
477
579
|
{
|
|
478
580
|
id,
|
|
@@ -482,12 +584,12 @@ function FieldMessage({
|
|
|
482
584
|
}
|
|
483
585
|
);
|
|
484
586
|
if (description && descriptionDisplay === "inline")
|
|
485
|
-
return /* @__PURE__ */
|
|
587
|
+
return /* @__PURE__ */ jsx8("span", { id, className: "fe-field__message", children: description });
|
|
486
588
|
return null;
|
|
487
589
|
}
|
|
488
590
|
|
|
489
591
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
490
|
-
import { jsx as
|
|
592
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
491
593
|
var TextInput = forwardRef3(
|
|
492
594
|
function TextInput2({
|
|
493
595
|
value,
|
|
@@ -518,12 +620,12 @@ var TextInput = forwardRef3(
|
|
|
518
620
|
"aria-labelledby": ariaLabelledBy,
|
|
519
621
|
...props
|
|
520
622
|
}, ref) {
|
|
521
|
-
const generatedId =
|
|
623
|
+
const generatedId = useId3();
|
|
522
624
|
const inputId = id ?? generatedId + "-input";
|
|
523
625
|
const labelId = generatedId + "-label";
|
|
524
626
|
const messageId2 = generatedId + "-message";
|
|
525
627
|
const controlled = value !== void 0;
|
|
526
|
-
const [internalValue, setInternalValue] =
|
|
628
|
+
const [internalValue, setInternalValue] = useState5(defaultValue);
|
|
527
629
|
const currentValue = controlled ? value : internalValue;
|
|
528
630
|
const fieldError = getFieldError(error, errorMessage);
|
|
529
631
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -544,7 +646,7 @@ var TextInput = forwardRef3(
|
|
|
544
646
|
onValueChange?.("");
|
|
545
647
|
onClear?.();
|
|
546
648
|
};
|
|
547
|
-
return /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsxs9(
|
|
548
650
|
"div",
|
|
549
651
|
{
|
|
550
652
|
className: [
|
|
@@ -553,7 +655,7 @@ var TextInput = forwardRef3(
|
|
|
553
655
|
className
|
|
554
656
|
].filter(Boolean).join(" "),
|
|
555
657
|
children: [
|
|
556
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ jsx9(
|
|
557
659
|
FieldLabel,
|
|
558
660
|
{
|
|
559
661
|
id: labelId,
|
|
@@ -563,10 +665,10 @@ var TextInput = forwardRef3(
|
|
|
563
665
|
isRequired
|
|
564
666
|
}
|
|
565
667
|
),
|
|
566
|
-
/* @__PURE__ */
|
|
567
|
-
resolvedPrefix && /* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
569
|
-
/* @__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(
|
|
570
672
|
"input",
|
|
571
673
|
{
|
|
572
674
|
ref,
|
|
@@ -588,26 +690,26 @@ var TextInput = forwardRef3(
|
|
|
588
690
|
...props
|
|
589
691
|
}
|
|
590
692
|
),
|
|
591
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */
|
|
592
|
-
/* @__PURE__ */
|
|
593
|
-
/* @__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: "*" })
|
|
594
696
|
] })
|
|
595
697
|
] }),
|
|
596
|
-
resolvedSuffix && /* @__PURE__ */
|
|
597
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
698
|
+
resolvedSuffix && /* @__PURE__ */ jsx9("span", { className: "fe-text-input__suffix", children: resolvedSuffix }),
|
|
699
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx9(
|
|
598
700
|
Button,
|
|
599
701
|
{
|
|
600
702
|
hierarchy: "tertiary-gray",
|
|
601
703
|
size: "24",
|
|
602
704
|
iconOnly: true,
|
|
603
|
-
icon: /* @__PURE__ */
|
|
705
|
+
icon: /* @__PURE__ */ jsx9(CloseIcon, { size: 14 }),
|
|
604
706
|
"aria-label": clearLabel,
|
|
605
707
|
onClick: clear,
|
|
606
708
|
className: "fe-text-input__clear"
|
|
607
709
|
}
|
|
608
710
|
)
|
|
609
711
|
] }),
|
|
610
|
-
/* @__PURE__ */
|
|
712
|
+
/* @__PURE__ */ jsx9(
|
|
611
713
|
FieldMessage,
|
|
612
714
|
{
|
|
613
715
|
id: messageId2,
|
|
@@ -626,13 +728,13 @@ TextInput.displayName = "TextInput";
|
|
|
626
728
|
// packages/form-controls/src/controls/TextArea/text-area.tsx
|
|
627
729
|
import {
|
|
628
730
|
forwardRef as forwardRef4,
|
|
629
|
-
useId as
|
|
731
|
+
useId as useId4,
|
|
630
732
|
useImperativeHandle,
|
|
631
733
|
useLayoutEffect,
|
|
632
|
-
useRef as
|
|
633
|
-
useState as
|
|
734
|
+
useRef as useRef3,
|
|
735
|
+
useState as useState6
|
|
634
736
|
} from "react";
|
|
635
|
-
import { jsx as
|
|
737
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
636
738
|
var TextArea = forwardRef4(
|
|
637
739
|
function TextArea2({
|
|
638
740
|
value,
|
|
@@ -660,13 +762,13 @@ var TextArea = forwardRef4(
|
|
|
660
762
|
"aria-labelledby": ariaLabelledBy,
|
|
661
763
|
...props
|
|
662
764
|
}, ref) {
|
|
663
|
-
const generatedId =
|
|
765
|
+
const generatedId = useId4();
|
|
664
766
|
const inputId = id ?? generatedId + "-input";
|
|
665
767
|
const labelId = generatedId + "-label";
|
|
666
768
|
const messageId2 = generatedId + "-message";
|
|
667
769
|
const controlled = value !== void 0;
|
|
668
|
-
const [internalValue, setInternalValue] =
|
|
669
|
-
const textareaRef =
|
|
770
|
+
const [internalValue, setInternalValue] = useState6(defaultValue);
|
|
771
|
+
const textareaRef = useRef3(null);
|
|
670
772
|
const currentValue = controlled ? value : internalValue;
|
|
671
773
|
const fieldError = getFieldError(error, errorMessage);
|
|
672
774
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -695,7 +797,7 @@ var TextArea = forwardRef4(
|
|
|
695
797
|
onValueChange?.("");
|
|
696
798
|
onClear?.();
|
|
697
799
|
};
|
|
698
|
-
return /* @__PURE__ */
|
|
800
|
+
return /* @__PURE__ */ jsxs10(
|
|
699
801
|
"div",
|
|
700
802
|
{
|
|
701
803
|
className: [
|
|
@@ -705,7 +807,7 @@ var TextArea = forwardRef4(
|
|
|
705
807
|
className
|
|
706
808
|
].filter(Boolean).join(" "),
|
|
707
809
|
children: [
|
|
708
|
-
/* @__PURE__ */
|
|
810
|
+
/* @__PURE__ */ jsx10(
|
|
709
811
|
FieldLabel,
|
|
710
812
|
{
|
|
711
813
|
id: labelId,
|
|
@@ -715,8 +817,8 @@ var TextArea = forwardRef4(
|
|
|
715
817
|
isRequired
|
|
716
818
|
}
|
|
717
819
|
),
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ jsxs10("span", { className: "fe-text-area__control", children: [
|
|
821
|
+
/* @__PURE__ */ jsx10(
|
|
720
822
|
"textarea",
|
|
721
823
|
{
|
|
722
824
|
ref: textareaRef,
|
|
@@ -739,24 +841,24 @@ var TextArea = forwardRef4(
|
|
|
739
841
|
...props
|
|
740
842
|
}
|
|
741
843
|
),
|
|
742
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__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: "*" })
|
|
745
847
|
] }),
|
|
746
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
848
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx10(
|
|
747
849
|
Button,
|
|
748
850
|
{
|
|
749
851
|
hierarchy: "tertiary-gray",
|
|
750
852
|
size: "24",
|
|
751
853
|
iconOnly: true,
|
|
752
|
-
icon: /* @__PURE__ */
|
|
854
|
+
icon: /* @__PURE__ */ jsx10(CloseIcon, { size: 14 }),
|
|
753
855
|
"aria-label": clearLabel,
|
|
754
856
|
onClick: clear,
|
|
755
857
|
className: "fe-text-area__clear"
|
|
756
858
|
}
|
|
757
859
|
)
|
|
758
860
|
] }),
|
|
759
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ jsx10(
|
|
760
862
|
FieldMessage,
|
|
761
863
|
{
|
|
762
864
|
id: messageId2,
|
|
@@ -775,14 +877,14 @@ TextArea.displayName = "TextArea";
|
|
|
775
877
|
// packages/form-controls/src/controls/Selection/selection.tsx
|
|
776
878
|
import {
|
|
777
879
|
forwardRef as forwardRef5,
|
|
778
|
-
useEffect as
|
|
779
|
-
useId as
|
|
880
|
+
useEffect as useEffect4,
|
|
881
|
+
useId as useId5,
|
|
780
882
|
useLayoutEffect as useLayoutEffect2,
|
|
781
|
-
useRef as
|
|
782
|
-
useState as
|
|
883
|
+
useRef as useRef4,
|
|
884
|
+
useState as useState7
|
|
783
885
|
} from "react";
|
|
784
886
|
import { createPortal as createPortal2 } from "react-dom";
|
|
785
|
-
import { Fragment as Fragment2, jsx as
|
|
887
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
786
888
|
var Selection = forwardRef5(
|
|
787
889
|
function Selection2({
|
|
788
890
|
className,
|
|
@@ -812,7 +914,7 @@ var Selection = forwardRef5(
|
|
|
812
914
|
"aria-labelledby": ariaLabelledBy,
|
|
813
915
|
...props
|
|
814
916
|
}, ref) {
|
|
815
|
-
const generatedId =
|
|
917
|
+
const generatedId = useId5();
|
|
816
918
|
const triggerId = id ?? generatedId + "-trigger";
|
|
817
919
|
const listboxId = triggerId + "-listbox";
|
|
818
920
|
const labelId = generatedId + "-label";
|
|
@@ -830,7 +932,7 @@ var Selection = forwardRef5(
|
|
|
830
932
|
label ? labelId : void 0
|
|
831
933
|
);
|
|
832
934
|
const isControlled = value !== void 0;
|
|
833
|
-
const [internalValue, setInternalValue] =
|
|
935
|
+
const [internalValue, setInternalValue] = useState7(
|
|
834
936
|
defaultValue ?? (multiple ? [] : "")
|
|
835
937
|
);
|
|
836
938
|
const selectedValue = isControlled ? value : internalValue;
|
|
@@ -838,13 +940,13 @@ var Selection = forwardRef5(
|
|
|
838
940
|
const selectedOptions = options.filter(
|
|
839
941
|
(option) => selectedValues.some((item) => String(item) === String(option.value))
|
|
840
942
|
);
|
|
841
|
-
const [open, setOpen] =
|
|
842
|
-
const [query, setQuery] =
|
|
843
|
-
const [activeIndex, setActiveIndex] =
|
|
844
|
-
const rootRef =
|
|
845
|
-
const menuRef =
|
|
846
|
-
const [menuPosition, setMenuPosition] =
|
|
847
|
-
|
|
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(() => {
|
|
848
950
|
const close = (event) => {
|
|
849
951
|
const target = event.target;
|
|
850
952
|
if (!rootRef.current?.contains(target) && !menuRef.current?.contains(target))
|
|
@@ -930,7 +1032,7 @@ var Selection = forwardRef5(
|
|
|
930
1032
|
}
|
|
931
1033
|
if (event.key === "Escape") setOpen(false);
|
|
932
1034
|
};
|
|
933
|
-
return /* @__PURE__ */
|
|
1035
|
+
return /* @__PURE__ */ jsxs11(
|
|
934
1036
|
"div",
|
|
935
1037
|
{
|
|
936
1038
|
ref,
|
|
@@ -945,7 +1047,7 @@ var Selection = forwardRef5(
|
|
|
945
1047
|
].filter(Boolean).join(" "),
|
|
946
1048
|
...props,
|
|
947
1049
|
children: [
|
|
948
|
-
/* @__PURE__ */
|
|
1050
|
+
/* @__PURE__ */ jsx11(
|
|
949
1051
|
FieldLabel,
|
|
950
1052
|
{
|
|
951
1053
|
id: labelId,
|
|
@@ -955,8 +1057,8 @@ var Selection = forwardRef5(
|
|
|
955
1057
|
isRequired
|
|
956
1058
|
}
|
|
957
1059
|
),
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
name && selectedValues.map((item) => /* @__PURE__ */
|
|
1060
|
+
/* @__PURE__ */ jsxs11("div", { ref: rootRef, className: "fe-selection__control", children: [
|
|
1061
|
+
name && selectedValues.map((item) => /* @__PURE__ */ jsx11(
|
|
960
1062
|
"input",
|
|
961
1063
|
{
|
|
962
1064
|
type: "hidden",
|
|
@@ -965,7 +1067,7 @@ var Selection = forwardRef5(
|
|
|
965
1067
|
},
|
|
966
1068
|
String(item)
|
|
967
1069
|
)),
|
|
968
|
-
/* @__PURE__ */
|
|
1070
|
+
/* @__PURE__ */ jsxs11(
|
|
969
1071
|
"button",
|
|
970
1072
|
{
|
|
971
1073
|
id: triggerId,
|
|
@@ -983,7 +1085,7 @@ var Selection = forwardRef5(
|
|
|
983
1085
|
onClick: () => setOpen((current) => !current),
|
|
984
1086
|
onKeyDown: onTriggerKeyDown,
|
|
985
1087
|
children: [
|
|
986
|
-
/* @__PURE__ */
|
|
1088
|
+
/* @__PURE__ */ jsx11(
|
|
987
1089
|
"span",
|
|
988
1090
|
{
|
|
989
1091
|
className: [
|
|
@@ -991,30 +1093,30 @@ var Selection = forwardRef5(
|
|
|
991
1093
|
!selectedOptions.length && "is-placeholder",
|
|
992
1094
|
tag && selectedOptions.length > 1 && "is-tags"
|
|
993
1095
|
].filter(Boolean).join(" "),
|
|
994
|
-
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */
|
|
1096
|
+
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsxs11(
|
|
995
1097
|
"span",
|
|
996
1098
|
{
|
|
997
1099
|
className: "fe-selection__tag",
|
|
998
1100
|
children: [
|
|
999
1101
|
option.label,
|
|
1000
|
-
/* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: "\xD7" })
|
|
1001
1103
|
]
|
|
1002
1104
|
},
|
|
1003
1105
|
String(option.value)
|
|
1004
|
-
)) : displayLabel.map((item, index) => /* @__PURE__ */
|
|
1106
|
+
)) : displayLabel.map((item, index) => /* @__PURE__ */ jsxs11("span", { children: [
|
|
1005
1107
|
item,
|
|
1006
1108
|
index < displayLabel.length - 1 ? ", " : ""
|
|
1007
|
-
] }, index)) : /* @__PURE__ */
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
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: "*" })
|
|
1010
1112
|
] })
|
|
1011
1113
|
}
|
|
1012
1114
|
),
|
|
1013
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ jsx11("span", { className: "fe-selection__actions", children: /* @__PURE__ */ jsx11("span", { className: "fe-selection__chevron", "aria-hidden": "true" }) })
|
|
1014
1116
|
]
|
|
1015
1117
|
}
|
|
1016
1118
|
),
|
|
1017
|
-
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */
|
|
1119
|
+
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */ jsx11(
|
|
1018
1120
|
"button",
|
|
1019
1121
|
{
|
|
1020
1122
|
type: "button",
|
|
@@ -1024,7 +1126,7 @@ var Selection = forwardRef5(
|
|
|
1024
1126
|
}
|
|
1025
1127
|
),
|
|
1026
1128
|
open && menuPosition && createPortal2(
|
|
1027
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ jsxs11(
|
|
1028
1130
|
"div",
|
|
1029
1131
|
{
|
|
1030
1132
|
ref: menuRef,
|
|
@@ -1039,9 +1141,9 @@ var Selection = forwardRef5(
|
|
|
1039
1141
|
role: "listbox",
|
|
1040
1142
|
"aria-multiselectable": multiple || void 0,
|
|
1041
1143
|
children: [
|
|
1042
|
-
searchable && /* @__PURE__ */
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1144
|
+
searchable && /* @__PURE__ */ jsxs11("div", { className: "fe-selection__search", children: [
|
|
1145
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: "\u2315" }),
|
|
1146
|
+
/* @__PURE__ */ jsx11(
|
|
1045
1147
|
"input",
|
|
1046
1148
|
{
|
|
1047
1149
|
autoFocus: true,
|
|
@@ -1055,11 +1157,11 @@ var Selection = forwardRef5(
|
|
|
1055
1157
|
}
|
|
1056
1158
|
)
|
|
1057
1159
|
] }),
|
|
1058
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsx11("div", { className: "fe-selection__options", children: filteredOptions.length ? filteredOptions.map((option, index) => {
|
|
1059
1161
|
const isSelected = selectedValues.some(
|
|
1060
1162
|
(item) => String(item) === String(option.value)
|
|
1061
1163
|
);
|
|
1062
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ jsxs11(
|
|
1063
1165
|
"button",
|
|
1064
1166
|
{
|
|
1065
1167
|
type: "button",
|
|
@@ -1073,8 +1175,8 @@ var Selection = forwardRef5(
|
|
|
1073
1175
|
onMouseMove: () => setActiveIndex(index),
|
|
1074
1176
|
onClick: () => choose(option),
|
|
1075
1177
|
children: [
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
isSelected && /* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ jsx11("span", { children: option.label }),
|
|
1179
|
+
isSelected && /* @__PURE__ */ jsx11(
|
|
1078
1180
|
"span",
|
|
1079
1181
|
{
|
|
1080
1182
|
className: "fe-selection__check",
|
|
@@ -1086,14 +1188,14 @@ var Selection = forwardRef5(
|
|
|
1086
1188
|
},
|
|
1087
1189
|
String(option.value)
|
|
1088
1190
|
);
|
|
1089
|
-
}) : /* @__PURE__ */
|
|
1191
|
+
}) : /* @__PURE__ */ jsx11("p", { className: "fe-selection__empty", children: "No matching options" }) })
|
|
1090
1192
|
]
|
|
1091
1193
|
}
|
|
1092
1194
|
),
|
|
1093
1195
|
document.body
|
|
1094
1196
|
)
|
|
1095
1197
|
] }),
|
|
1096
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ jsx11(
|
|
1097
1199
|
FieldMessage,
|
|
1098
1200
|
{
|
|
1099
1201
|
id: messageId2,
|
|
@@ -1112,12 +1214,12 @@ Selection.displayName = "Selection";
|
|
|
1112
1214
|
// packages/form-controls/src/controls/NumberInput/number-input.tsx
|
|
1113
1215
|
import {
|
|
1114
1216
|
forwardRef as forwardRef6,
|
|
1115
|
-
useEffect as
|
|
1116
|
-
useId as
|
|
1117
|
-
useRef as
|
|
1118
|
-
useState as
|
|
1217
|
+
useEffect as useEffect5,
|
|
1218
|
+
useId as useId6,
|
|
1219
|
+
useRef as useRef5,
|
|
1220
|
+
useState as useState8
|
|
1119
1221
|
} from "react";
|
|
1120
|
-
import { jsx as
|
|
1222
|
+
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1121
1223
|
function formatNumber(value, decimals = 2, thousandSeparator = ",", decimalSeparator = ".") {
|
|
1122
1224
|
return new Intl.NumberFormat("en-US", {
|
|
1123
1225
|
minimumFractionDigits: 0,
|
|
@@ -1211,14 +1313,14 @@ var NumberInput = forwardRef6(
|
|
|
1211
1313
|
onKeyDown,
|
|
1212
1314
|
...props
|
|
1213
1315
|
}, ref) {
|
|
1214
|
-
const inputRef =
|
|
1215
|
-
const generatedId =
|
|
1316
|
+
const inputRef = useRef5(null);
|
|
1317
|
+
const generatedId = useId6();
|
|
1216
1318
|
const messageId2 = generatedId + "-message";
|
|
1217
1319
|
const isControlled = value !== void 0;
|
|
1218
|
-
const [internalValue, setInternalValue] =
|
|
1219
|
-
const [focused, setFocused] =
|
|
1320
|
+
const [internalValue, setInternalValue] = useState8(defaultValue);
|
|
1321
|
+
const [focused, setFocused] = useState8(false);
|
|
1220
1322
|
const actualValue = isControlled ? value ?? null : internalValue;
|
|
1221
|
-
const [text, setText] =
|
|
1323
|
+
const [text, setText] = useState8(
|
|
1222
1324
|
actualValue === null ? "" : formatNumber(
|
|
1223
1325
|
actualValue,
|
|
1224
1326
|
decimals,
|
|
@@ -1241,7 +1343,7 @@ var NumberInput = forwardRef6(
|
|
|
1241
1343
|
);
|
|
1242
1344
|
const resolvedPrefix = prefix ?? Prefix;
|
|
1243
1345
|
const resolvedSuffix = suffix ?? Suffix;
|
|
1244
|
-
|
|
1346
|
+
useEffect5(() => {
|
|
1245
1347
|
if (!focused)
|
|
1246
1348
|
setText(
|
|
1247
1349
|
actualValue === null ? "" : formatNumber(
|
|
@@ -1295,7 +1397,7 @@ var NumberInput = forwardRef6(
|
|
|
1295
1397
|
const stepIsUsable = Number.isFinite(step) && step > 0;
|
|
1296
1398
|
const disableIncrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || max !== void 0 && actualValue !== null && actualValue >= max;
|
|
1297
1399
|
const disableDecrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || min !== void 0 && actualValue !== null && actualValue <= min;
|
|
1298
|
-
return /* @__PURE__ */
|
|
1400
|
+
return /* @__PURE__ */ jsxs12(
|
|
1299
1401
|
"div",
|
|
1300
1402
|
{
|
|
1301
1403
|
className: [
|
|
@@ -1304,7 +1406,7 @@ var NumberInput = forwardRef6(
|
|
|
1304
1406
|
className
|
|
1305
1407
|
].filter(Boolean).join(" "),
|
|
1306
1408
|
children: [
|
|
1307
|
-
/* @__PURE__ */
|
|
1409
|
+
/* @__PURE__ */ jsx12(
|
|
1308
1410
|
FieldLabel,
|
|
1309
1411
|
{
|
|
1310
1412
|
id: labelId,
|
|
@@ -1314,10 +1416,10 @@ var NumberInput = forwardRef6(
|
|
|
1314
1416
|
isRequired
|
|
1315
1417
|
}
|
|
1316
1418
|
),
|
|
1317
|
-
/* @__PURE__ */
|
|
1318
|
-
resolvedPrefix && /* @__PURE__ */
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
/* @__PURE__ */
|
|
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(
|
|
1321
1423
|
"input",
|
|
1322
1424
|
{
|
|
1323
1425
|
ref: (node) => {
|
|
@@ -1353,41 +1455,41 @@ var NumberInput = forwardRef6(
|
|
|
1353
1455
|
"aria-describedby": describedBy
|
|
1354
1456
|
}
|
|
1355
1457
|
),
|
|
1356
|
-
isRequired && placeholder && !text && /* @__PURE__ */
|
|
1458
|
+
isRequired && placeholder && !text && /* @__PURE__ */ jsxs12(
|
|
1357
1459
|
"span",
|
|
1358
1460
|
{
|
|
1359
1461
|
className: "fe-number-input__placeholder",
|
|
1360
1462
|
"aria-hidden": "true",
|
|
1361
1463
|
children: [
|
|
1362
|
-
/* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1464
|
+
/* @__PURE__ */ jsx12("span", { children: placeholder }),
|
|
1465
|
+
/* @__PURE__ */ jsx12("span", { className: "fe-field__required", children: "*" })
|
|
1364
1466
|
]
|
|
1365
1467
|
}
|
|
1366
1468
|
)
|
|
1367
1469
|
] }),
|
|
1368
|
-
resolvedSuffix && /* @__PURE__ */
|
|
1470
|
+
resolvedSuffix && /* @__PURE__ */ jsx12("span", { className: "fe-number-input__suffix", children: resolvedSuffix }),
|
|
1369
1471
|
endAdornment,
|
|
1370
|
-
showStepper && /* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1472
|
+
showStepper && /* @__PURE__ */ jsxs12("span", { className: "fe-number-input__stepper", children: [
|
|
1473
|
+
/* @__PURE__ */ jsx12(
|
|
1372
1474
|
Button,
|
|
1373
1475
|
{
|
|
1374
1476
|
hierarchy: "tertiary-gray",
|
|
1375
1477
|
size: "24",
|
|
1376
1478
|
iconOnly: true,
|
|
1377
|
-
icon: /* @__PURE__ */
|
|
1479
|
+
icon: /* @__PURE__ */ jsx12(ChevronUpIcon, { size: 12 }),
|
|
1378
1480
|
"aria-label": incrementLabel,
|
|
1379
1481
|
disabled: disableIncrement,
|
|
1380
1482
|
onMouseDown: (event) => event.preventDefault(),
|
|
1381
1483
|
onClick: () => adjustValue(1)
|
|
1382
1484
|
}
|
|
1383
1485
|
),
|
|
1384
|
-
/* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ jsx12(
|
|
1385
1487
|
Button,
|
|
1386
1488
|
{
|
|
1387
1489
|
hierarchy: "tertiary-gray",
|
|
1388
1490
|
size: "24",
|
|
1389
1491
|
iconOnly: true,
|
|
1390
|
-
icon: /* @__PURE__ */
|
|
1492
|
+
icon: /* @__PURE__ */ jsx12(ChevronDownIcon, { size: 12 }),
|
|
1391
1493
|
"aria-label": decrementLabel,
|
|
1392
1494
|
disabled: disableDecrement,
|
|
1393
1495
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -1396,7 +1498,7 @@ var NumberInput = forwardRef6(
|
|
|
1396
1498
|
)
|
|
1397
1499
|
] })
|
|
1398
1500
|
] }),
|
|
1399
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ jsx12(
|
|
1400
1502
|
FieldMessage,
|
|
1401
1503
|
{
|
|
1402
1504
|
id: messageId2,
|
|
@@ -1413,8 +1515,8 @@ var NumberInput = forwardRef6(
|
|
|
1413
1515
|
NumberInput.displayName = "NumberInput";
|
|
1414
1516
|
|
|
1415
1517
|
// packages/form-controls/src/controls/CurrencyInput/currency-input.tsx
|
|
1416
|
-
import { useState as
|
|
1417
|
-
import { jsx as
|
|
1518
|
+
import { useState as useState9 } from "react";
|
|
1519
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1418
1520
|
function CurrencyInput({
|
|
1419
1521
|
suffix = "VND",
|
|
1420
1522
|
currencies,
|
|
@@ -1425,13 +1527,13 @@ function CurrencyInput({
|
|
|
1425
1527
|
disabled,
|
|
1426
1528
|
...props
|
|
1427
1529
|
}) {
|
|
1428
|
-
const [internalCurrency, setInternalCurrency] =
|
|
1530
|
+
const [internalCurrency, setInternalCurrency] = useState9(
|
|
1429
1531
|
defaultCurrency ?? currencies?.[0]?.code ?? ""
|
|
1430
1532
|
);
|
|
1431
1533
|
const selectedCurrency = currency ?? internalCurrency;
|
|
1432
1534
|
const current = currencies?.find((item) => item.code === selectedCurrency);
|
|
1433
1535
|
const currencySuffix = current?.suffix ?? current?.code ?? suffix;
|
|
1434
|
-
const endAdornment = currencies?.length ? /* @__PURE__ */
|
|
1536
|
+
const endAdornment = currencies?.length ? /* @__PURE__ */ jsx13(
|
|
1435
1537
|
Selection,
|
|
1436
1538
|
{
|
|
1437
1539
|
className: "fe-currency-input__currency",
|
|
@@ -1450,8 +1552,8 @@ function CurrencyInput({
|
|
|
1450
1552
|
onCurrencyChange?.(next);
|
|
1451
1553
|
}
|
|
1452
1554
|
}
|
|
1453
|
-
) : /* @__PURE__ */
|
|
1454
|
-
return /* @__PURE__ */
|
|
1555
|
+
) : /* @__PURE__ */ jsx13("span", { className: "fe-currency-input__suffix", children: currencySuffix });
|
|
1556
|
+
return /* @__PURE__ */ jsx13(
|
|
1455
1557
|
NumberInput,
|
|
1456
1558
|
{
|
|
1457
1559
|
...props,
|
|
@@ -1463,8 +1565,8 @@ function CurrencyInput({
|
|
|
1463
1565
|
}
|
|
1464
1566
|
|
|
1465
1567
|
// packages/form-controls/src/controls/DateTimePicker/date-time-picker.tsx
|
|
1466
|
-
import { useEffect as
|
|
1467
|
-
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";
|
|
1468
1570
|
var pad = (value) => String(value).padStart(2, "0");
|
|
1469
1571
|
function formatDate(date, format) {
|
|
1470
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()));
|
|
@@ -1500,7 +1602,7 @@ function DateTimePicker(props) {
|
|
|
1500
1602
|
"aria-describedby": ariaDescribedBy,
|
|
1501
1603
|
"aria-labelledby": ariaLabelledBy
|
|
1502
1604
|
} = props;
|
|
1503
|
-
const generatedId =
|
|
1605
|
+
const generatedId = useId7();
|
|
1504
1606
|
const triggerId = id ?? generatedId + "-trigger";
|
|
1505
1607
|
const labelId = generatedId + "-label";
|
|
1506
1608
|
const messageId2 = generatedId + "-message";
|
|
@@ -1518,28 +1620,28 @@ function DateTimePicker(props) {
|
|
|
1518
1620
|
);
|
|
1519
1621
|
const isRange = mode === "range";
|
|
1520
1622
|
const controlled = props.value !== void 0;
|
|
1521
|
-
const [singleInternal, setSingleInternal] =
|
|
1623
|
+
const [singleInternal, setSingleInternal] = useState10(
|
|
1522
1624
|
(!isRange ? props.defaultValue : null) ?? null
|
|
1523
1625
|
);
|
|
1524
|
-
const [rangeInternal, setRangeInternal] =
|
|
1626
|
+
const [rangeInternal, setRangeInternal] = useState10(
|
|
1525
1627
|
(isRange ? props.defaultValue : void 0) ?? [null, null]
|
|
1526
1628
|
);
|
|
1527
1629
|
const singleValue = !isRange ? props.value ?? singleInternal : null;
|
|
1528
1630
|
const rangeValue = isRange ? props.value ?? rangeInternal : [null, null];
|
|
1529
|
-
const [open, setOpen] =
|
|
1530
|
-
const [month, setMonth] =
|
|
1631
|
+
const [open, setOpen] = useState10(false);
|
|
1632
|
+
const [month, setMonth] = useState10(
|
|
1531
1633
|
() => new Date((isRange ? rangeValue[0] : singleValue) ?? /* @__PURE__ */ new Date())
|
|
1532
1634
|
);
|
|
1533
|
-
const [editingEnd, setEditingEnd] =
|
|
1534
|
-
const rootRef =
|
|
1535
|
-
|
|
1635
|
+
const [editingEnd, setEditingEnd] = useState10(false);
|
|
1636
|
+
const rootRef = useRef6(null);
|
|
1637
|
+
useEffect6(() => {
|
|
1536
1638
|
const onPointerDown = (event) => {
|
|
1537
1639
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
1538
1640
|
};
|
|
1539
1641
|
document.addEventListener("mousedown", onPointerDown);
|
|
1540
1642
|
return () => document.removeEventListener("mousedown", onPointerDown);
|
|
1541
1643
|
}, []);
|
|
1542
|
-
|
|
1644
|
+
useEffect6(() => {
|
|
1543
1645
|
if (disabled) setOpen(false);
|
|
1544
1646
|
}, [disabled]);
|
|
1545
1647
|
const setSingle = (next) => {
|
|
@@ -1595,7 +1697,7 @@ function DateTimePicker(props) {
|
|
|
1595
1697
|
setRange(editingEnd ? [rangeValue[0], next] : [next, rangeValue[1]]);
|
|
1596
1698
|
else setSingle(next);
|
|
1597
1699
|
};
|
|
1598
|
-
return /* @__PURE__ */
|
|
1700
|
+
return /* @__PURE__ */ jsxs13(
|
|
1599
1701
|
"div",
|
|
1600
1702
|
{
|
|
1601
1703
|
ref: rootRef,
|
|
@@ -1605,7 +1707,7 @@ function DateTimePicker(props) {
|
|
|
1605
1707
|
className
|
|
1606
1708
|
].filter(Boolean).join(" "),
|
|
1607
1709
|
children: [
|
|
1608
|
-
/* @__PURE__ */
|
|
1710
|
+
/* @__PURE__ */ jsx14(
|
|
1609
1711
|
FieldLabel,
|
|
1610
1712
|
{
|
|
1611
1713
|
id: labelId,
|
|
@@ -1615,7 +1717,7 @@ function DateTimePicker(props) {
|
|
|
1615
1717
|
isRequired
|
|
1616
1718
|
}
|
|
1617
1719
|
),
|
|
1618
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__PURE__ */ jsxs13(
|
|
1619
1721
|
"button",
|
|
1620
1722
|
{
|
|
1621
1723
|
id: triggerId,
|
|
@@ -1629,29 +1731,29 @@ function DateTimePicker(props) {
|
|
|
1629
1731
|
"aria-expanded": open,
|
|
1630
1732
|
onClick: () => setOpen((current) => !current),
|
|
1631
1733
|
children: [
|
|
1632
|
-
/* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1734
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: "\u25F7" }),
|
|
1735
|
+
/* @__PURE__ */ jsxs13(
|
|
1634
1736
|
"span",
|
|
1635
1737
|
{
|
|
1636
1738
|
className: !shownValue && placeholder ? "fe-datetime-picker__value is-placeholder" : "fe-datetime-picker__value",
|
|
1637
1739
|
children: [
|
|
1638
1740
|
shownValue || placeholder || (isRange ? "Select date range" : "Select date and time"),
|
|
1639
|
-
isRequired && placeholder && !shownValue && /* @__PURE__ */
|
|
1741
|
+
isRequired && placeholder && !shownValue && /* @__PURE__ */ jsx14("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1640
1742
|
]
|
|
1641
1743
|
}
|
|
1642
1744
|
)
|
|
1643
1745
|
]
|
|
1644
1746
|
}
|
|
1645
1747
|
),
|
|
1646
|
-
open && /* @__PURE__ */
|
|
1748
|
+
open && /* @__PURE__ */ jsxs13(
|
|
1647
1749
|
"div",
|
|
1648
1750
|
{
|
|
1649
1751
|
className: "fe-datetime-picker__popper",
|
|
1650
1752
|
role: "dialog",
|
|
1651
1753
|
"aria-label": "Date and time picker",
|
|
1652
1754
|
children: [
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1755
|
+
/* @__PURE__ */ jsxs13("div", { className: "fe-datetime-picker__month", children: [
|
|
1756
|
+
/* @__PURE__ */ jsx14(
|
|
1655
1757
|
"button",
|
|
1656
1758
|
{
|
|
1657
1759
|
type: "button",
|
|
@@ -1662,11 +1764,11 @@ function DateTimePicker(props) {
|
|
|
1662
1764
|
children: "\u2039"
|
|
1663
1765
|
}
|
|
1664
1766
|
),
|
|
1665
|
-
/* @__PURE__ */
|
|
1767
|
+
/* @__PURE__ */ jsx14("strong", { children: month.toLocaleDateString(locale, {
|
|
1666
1768
|
month: "long",
|
|
1667
1769
|
year: "numeric"
|
|
1668
1770
|
}) }),
|
|
1669
|
-
/* @__PURE__ */
|
|
1771
|
+
/* @__PURE__ */ jsx14(
|
|
1670
1772
|
"button",
|
|
1671
1773
|
{
|
|
1672
1774
|
type: "button",
|
|
@@ -1678,12 +1780,12 @@ function DateTimePicker(props) {
|
|
|
1678
1780
|
}
|
|
1679
1781
|
)
|
|
1680
1782
|
] }),
|
|
1681
|
-
/* @__PURE__ */
|
|
1682
|
-
/* @__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) => {
|
|
1683
1785
|
const inMonth = day.getMonth() === month.getMonth();
|
|
1684
1786
|
const selected = isRange ? sameDay(day, rangeValue[0]) || sameDay(day, rangeValue[1]) : sameDay(day, singleValue);
|
|
1685
1787
|
const inRange = isRange && rangeValue[0] && rangeValue[1] && day > startOfDay(rangeValue[0]) && day < startOfDay(rangeValue[1]);
|
|
1686
|
-
return /* @__PURE__ */
|
|
1788
|
+
return /* @__PURE__ */ jsx14(
|
|
1687
1789
|
"button",
|
|
1688
1790
|
{
|
|
1689
1791
|
type: "button",
|
|
@@ -1698,8 +1800,8 @@ function DateTimePicker(props) {
|
|
|
1698
1800
|
day.toISOString()
|
|
1699
1801
|
);
|
|
1700
1802
|
}) }),
|
|
1701
|
-
isRange && /* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1803
|
+
isRange && /* @__PURE__ */ jsxs13("div", { className: "fe-datetime-picker__range-tabs", children: [
|
|
1804
|
+
/* @__PURE__ */ jsx14(
|
|
1703
1805
|
"button",
|
|
1704
1806
|
{
|
|
1705
1807
|
type: "button",
|
|
@@ -1708,7 +1810,7 @@ function DateTimePicker(props) {
|
|
|
1708
1810
|
children: "Start"
|
|
1709
1811
|
}
|
|
1710
1812
|
),
|
|
1711
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx14(
|
|
1712
1814
|
"button",
|
|
1713
1815
|
{
|
|
1714
1816
|
type: "button",
|
|
@@ -1718,9 +1820,9 @@ function DateTimePicker(props) {
|
|
|
1718
1820
|
}
|
|
1719
1821
|
)
|
|
1720
1822
|
] }),
|
|
1721
|
-
/* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsxs13("label", { className: "fe-datetime-picker__time", children: [
|
|
1722
1824
|
"Time",
|
|
1723
|
-
/* @__PURE__ */
|
|
1825
|
+
/* @__PURE__ */ jsx14(
|
|
1724
1826
|
"input",
|
|
1725
1827
|
{
|
|
1726
1828
|
type: "time",
|
|
@@ -1733,7 +1835,7 @@ function DateTimePicker(props) {
|
|
|
1733
1835
|
]
|
|
1734
1836
|
}
|
|
1735
1837
|
),
|
|
1736
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ jsx14(
|
|
1737
1839
|
FieldMessage,
|
|
1738
1840
|
{
|
|
1739
1841
|
id: messageId2,
|
|
@@ -1749,7 +1851,7 @@ function DateTimePicker(props) {
|
|
|
1749
1851
|
|
|
1750
1852
|
// packages/form-controls/src/controls/Checkbox/checkbox.tsx
|
|
1751
1853
|
import { forwardRef as forwardRef7 } from "react";
|
|
1752
|
-
import { jsx as
|
|
1854
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1753
1855
|
var Checkbox = forwardRef7(
|
|
1754
1856
|
function Checkbox2({
|
|
1755
1857
|
label,
|
|
@@ -1766,10 +1868,10 @@ var Checkbox = forwardRef7(
|
|
|
1766
1868
|
disabled && "fe-checkbox--disabled",
|
|
1767
1869
|
className
|
|
1768
1870
|
].filter(Boolean).join(" ");
|
|
1769
|
-
return /* @__PURE__ */
|
|
1770
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1772
|
-
/* @__PURE__ */
|
|
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(
|
|
1773
1875
|
"input",
|
|
1774
1876
|
{
|
|
1775
1877
|
ref,
|
|
@@ -1780,8 +1882,8 @@ var Checkbox = forwardRef7(
|
|
|
1780
1882
|
...props
|
|
1781
1883
|
}
|
|
1782
1884
|
),
|
|
1783
|
-
/* @__PURE__ */
|
|
1784
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsx15("span", { className: "fe-checkbox__control", "aria-hidden": "true" }),
|
|
1886
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx15("span", { className: "fe-checkbox__label", children: label })
|
|
1785
1887
|
] })
|
|
1786
1888
|
] });
|
|
1787
1889
|
}
|
|
@@ -1790,7 +1892,7 @@ Checkbox.displayName = "Checkbox";
|
|
|
1790
1892
|
|
|
1791
1893
|
// packages/form-controls/src/controls/RadioButton/radio-button.tsx
|
|
1792
1894
|
import { forwardRef as forwardRef8 } from "react";
|
|
1793
|
-
import { jsx as
|
|
1895
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1794
1896
|
var RadioButton = forwardRef8(
|
|
1795
1897
|
function RadioButton2({
|
|
1796
1898
|
label,
|
|
@@ -1807,10 +1909,10 @@ var RadioButton = forwardRef8(
|
|
|
1807
1909
|
disabled && "fe-radio-button--disabled",
|
|
1808
1910
|
className
|
|
1809
1911
|
].filter(Boolean).join(" ");
|
|
1810
|
-
return /* @__PURE__ */
|
|
1811
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
1812
|
-
/* @__PURE__ */
|
|
1813
|
-
/* @__PURE__ */
|
|
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(
|
|
1814
1916
|
"input",
|
|
1815
1917
|
{
|
|
1816
1918
|
ref,
|
|
@@ -1821,8 +1923,8 @@ var RadioButton = forwardRef8(
|
|
|
1821
1923
|
...props
|
|
1822
1924
|
}
|
|
1823
1925
|
),
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
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 })
|
|
1826
1928
|
] })
|
|
1827
1929
|
] });
|
|
1828
1930
|
}
|
|
@@ -1830,8 +1932,8 @@ var RadioButton = forwardRef8(
|
|
|
1830
1932
|
RadioButton.displayName = "RadioButton";
|
|
1831
1933
|
|
|
1832
1934
|
// packages/form-controls/src/controls/RadioGroup/radio-group.tsx
|
|
1833
|
-
import { forwardRef as forwardRef9, useId as
|
|
1834
|
-
import { jsx as
|
|
1935
|
+
import { forwardRef as forwardRef9, useId as useId8 } from "react";
|
|
1936
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1835
1937
|
var RadioGroup = forwardRef9(
|
|
1836
1938
|
function RadioGroup2({
|
|
1837
1939
|
label,
|
|
@@ -1850,7 +1952,7 @@ var RadioGroup = forwardRef9(
|
|
|
1850
1952
|
"aria-labelledby": ariaLabelledBy,
|
|
1851
1953
|
...props
|
|
1852
1954
|
}, ref) {
|
|
1853
|
-
const generatedId =
|
|
1955
|
+
const generatedId = useId8();
|
|
1854
1956
|
const groupName = name ?? `fe-radio-group-${generatedId}`;
|
|
1855
1957
|
const labelId = `${id ?? generatedId}-label`;
|
|
1856
1958
|
const isControlled = value !== void 0;
|
|
@@ -1864,12 +1966,12 @@ var RadioGroup = forwardRef9(
|
|
|
1864
1966
|
const handleChange = (option, event) => {
|
|
1865
1967
|
if (event.target.checked) onChange?.(option.value, option, event);
|
|
1866
1968
|
};
|
|
1867
|
-
return /* @__PURE__ */
|
|
1868
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
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: [
|
|
1869
1971
|
label,
|
|
1870
|
-
isRequired && /* @__PURE__ */
|
|
1972
|
+
isRequired && /* @__PURE__ */ jsx17("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
1871
1973
|
] }),
|
|
1872
|
-
/* @__PURE__ */
|
|
1974
|
+
/* @__PURE__ */ jsx17(
|
|
1873
1975
|
"div",
|
|
1874
1976
|
{
|
|
1875
1977
|
id,
|
|
@@ -1881,7 +1983,7 @@ var RadioGroup = forwardRef9(
|
|
|
1881
1983
|
children: options.map((option) => {
|
|
1882
1984
|
const optionDisabled = disabled || option.disabled;
|
|
1883
1985
|
const optionValue = String(option.value);
|
|
1884
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ jsx17(
|
|
1885
1987
|
RadioButton,
|
|
1886
1988
|
{
|
|
1887
1989
|
name: groupName,
|
|
@@ -1898,9 +2000,9 @@ var RadioGroup = forwardRef9(
|
|
|
1898
2000
|
})
|
|
1899
2001
|
}
|
|
1900
2002
|
),
|
|
1901
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
2003
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsxs16("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
1902
2004
|
label,
|
|
1903
|
-
isRequired && /* @__PURE__ */
|
|
2005
|
+
isRequired && /* @__PURE__ */ jsx17("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
1904
2006
|
] })
|
|
1905
2007
|
] });
|
|
1906
2008
|
}
|
|
@@ -1908,29 +2010,29 @@ var RadioGroup = forwardRef9(
|
|
|
1908
2010
|
RadioGroup.displayName = "RadioGroup";
|
|
1909
2011
|
|
|
1910
2012
|
// packages/expandable-section/src/index.tsx
|
|
1911
|
-
import { useId as
|
|
1912
|
-
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";
|
|
1913
2015
|
function ExpandableSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, disabled, className, ...props }) {
|
|
1914
|
-
const [internalExpanded, setInternalExpanded] =
|
|
2016
|
+
const [internalExpanded, setInternalExpanded] = useState11(defaultExpanded);
|
|
1915
2017
|
const isExpanded = expanded ?? internalExpanded;
|
|
1916
|
-
const id =
|
|
2018
|
+
const id = useId9();
|
|
1917
2019
|
const toggle = () => {
|
|
1918
2020
|
if (disabled) return;
|
|
1919
2021
|
const next = !isExpanded;
|
|
1920
2022
|
if (expanded === void 0) setInternalExpanded(next);
|
|
1921
2023
|
onExpandedChange?.(next);
|
|
1922
2024
|
};
|
|
1923
|
-
return /* @__PURE__ */
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__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" })
|
|
1927
2029
|
] }),
|
|
1928
|
-
/* @__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 }) })
|
|
1929
2031
|
] });
|
|
1930
2032
|
}
|
|
1931
2033
|
|
|
1932
2034
|
// packages/loading/src/index.tsx
|
|
1933
|
-
import { jsx as
|
|
2035
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1934
2036
|
var sizes = {
|
|
1935
2037
|
small: "16px",
|
|
1936
2038
|
medium: "24px",
|
|
@@ -1943,15 +2045,15 @@ function Loading({ size = "medium", color = "#2878f0", label, className, style,
|
|
|
1943
2045
|
"--fe-loading-color": color,
|
|
1944
2046
|
...style
|
|
1945
2047
|
};
|
|
1946
|
-
return /* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
label && /* @__PURE__ */
|
|
1949
|
-
!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" })
|
|
1950
2052
|
] });
|
|
1951
2053
|
}
|
|
1952
2054
|
|
|
1953
2055
|
// packages/skeleton/src/index.tsx
|
|
1954
|
-
import { Fragment as Fragment3, jsx as
|
|
2056
|
+
import { Fragment as Fragment3, jsx as jsx20 } from "react/jsx-runtime";
|
|
1955
2057
|
var pixels = (value) => typeof value === "number" ? `${value}px` : value;
|
|
1956
2058
|
function SkeletonBase({ variant = "box", shape, width, height, count = 1, animated = true, className, style, ...props }) {
|
|
1957
2059
|
const resolvedVariant = shape ?? variant;
|
|
@@ -1962,7 +2064,7 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
1962
2064
|
"--fe-skeleton-height": resolvedHeight,
|
|
1963
2065
|
...style
|
|
1964
2066
|
};
|
|
1965
|
-
return /* @__PURE__ */
|
|
2067
|
+
return /* @__PURE__ */ jsx20(Fragment3, { children: Array.from({ length: Math.max(1, count) }, (_, index) => /* @__PURE__ */ jsx20(
|
|
1966
2068
|
"div",
|
|
1967
2069
|
{
|
|
1968
2070
|
className: ["fe-skeleton", `fe-skeleton--${resolvedVariant}`, animated && "fe-skeleton--animated", className].filter(Boolean).join(" "),
|
|
@@ -1974,16 +2076,16 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
1974
2076
|
)) });
|
|
1975
2077
|
}
|
|
1976
2078
|
function SkeletonCircle({ size = 40, ...props }) {
|
|
1977
|
-
return /* @__PURE__ */
|
|
2079
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "circle", width: size, height: size, ...props });
|
|
1978
2080
|
}
|
|
1979
2081
|
function SkeletonSquare({ size = 80, ...props }) {
|
|
1980
|
-
return /* @__PURE__ */
|
|
2082
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "box", width: size, height: size, ...props });
|
|
1981
2083
|
}
|
|
1982
2084
|
function SkeletonBox({ width = "100%", height = 80, ...props }) {
|
|
1983
|
-
return /* @__PURE__ */
|
|
2085
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "box", width, height, ...props });
|
|
1984
2086
|
}
|
|
1985
2087
|
function SkeletonLine({ width = "100%", height = 12, ...props }) {
|
|
1986
|
-
return /* @__PURE__ */
|
|
2088
|
+
return /* @__PURE__ */ jsx20(SkeletonBase, { variant: "line", width, height, ...props });
|
|
1987
2089
|
}
|
|
1988
2090
|
var Skeleton = Object.assign(SkeletonBase, {
|
|
1989
2091
|
Circle: SkeletonCircle,
|
|
@@ -1993,9 +2095,9 @@ var Skeleton = Object.assign(SkeletonBase, {
|
|
|
1993
2095
|
});
|
|
1994
2096
|
|
|
1995
2097
|
// packages/modal/src/index.tsx
|
|
1996
|
-
import { useEffect as
|
|
2098
|
+
import { useEffect as useEffect7, useId as useId10, useRef as useRef7 } from "react";
|
|
1997
2099
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1998
|
-
import { jsx as
|
|
2100
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1999
2101
|
function Modal({
|
|
2000
2102
|
open,
|
|
2001
2103
|
onClose,
|
|
@@ -2011,9 +2113,9 @@ function Modal({
|
|
|
2011
2113
|
className,
|
|
2012
2114
|
...props
|
|
2013
2115
|
}) {
|
|
2014
|
-
const titleId =
|
|
2015
|
-
const panelRef =
|
|
2016
|
-
|
|
2116
|
+
const titleId = useId10();
|
|
2117
|
+
const panelRef = useRef7(null);
|
|
2118
|
+
useEffect7(() => {
|
|
2017
2119
|
if (!open) return;
|
|
2018
2120
|
const onKeyDown = (event) => {
|
|
2019
2121
|
if (event.key === "Escape") onClose();
|
|
@@ -2025,9 +2127,9 @@ function Modal({
|
|
|
2025
2127
|
if (!open || typeof document === "undefined") return null;
|
|
2026
2128
|
const hasFooter = footer || actions.length > 0;
|
|
2027
2129
|
return createPortal3(
|
|
2028
|
-
/* @__PURE__ */
|
|
2130
|
+
/* @__PURE__ */ jsx21("div", { className: "fe-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
2029
2131
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
2030
|
-
}, children: /* @__PURE__ */
|
|
2132
|
+
}, children: /* @__PURE__ */ jsxs19(
|
|
2031
2133
|
"div",
|
|
2032
2134
|
{
|
|
2033
2135
|
ref: panelRef,
|
|
@@ -2039,17 +2141,17 @@ function Modal({
|
|
|
2039
2141
|
tabIndex: -1,
|
|
2040
2142
|
...props,
|
|
2041
2143
|
children: [
|
|
2042
|
-
(title || description || closeButton) && /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
title && /* @__PURE__ */
|
|
2045
|
-
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 })
|
|
2046
2148
|
] }),
|
|
2047
|
-
closeButton && /* @__PURE__ */
|
|
2149
|
+
closeButton && /* @__PURE__ */ jsx21(Button, { hierarchy: "tertiary-gray", size: "32", iconOnly: true, icon: /* @__PURE__ */ jsx21(CloseIcon, {}), "aria-label": closeLabel, onClick: onClose })
|
|
2048
2150
|
] }),
|
|
2049
|
-
/* @__PURE__ */
|
|
2050
|
-
hasFooter && /* @__PURE__ */
|
|
2051
|
-
footer && /* @__PURE__ */
|
|
2052
|
-
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)) })
|
|
2053
2155
|
] })
|
|
2054
2156
|
]
|
|
2055
2157
|
}
|
|
@@ -2059,7 +2161,7 @@ function Modal({
|
|
|
2059
2161
|
}
|
|
2060
2162
|
|
|
2061
2163
|
// packages/progress/src/index.tsx
|
|
2062
|
-
import { jsx as
|
|
2164
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2063
2165
|
function ProgressBar({ value, max = 100, label, showValue = true, size = "medium", color = "#2878f0", className, style, "aria-label": ariaLabel, ...props }) {
|
|
2064
2166
|
const indeterminate = value === null || value === void 0;
|
|
2065
2167
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, Number(value) / Math.max(1, max) * 100));
|
|
@@ -2069,17 +2171,17 @@ function ProgressBar({ value, max = 100, label, showValue = true, size = "medium
|
|
|
2069
2171
|
...style
|
|
2070
2172
|
};
|
|
2071
2173
|
const visibleValue = `${Math.round(percentage)}%`;
|
|
2072
|
-
return /* @__PURE__ */
|
|
2073
|
-
(label || !indeterminate && showValue) && /* @__PURE__ */
|
|
2074
|
-
label && /* @__PURE__ */
|
|
2075
|
-
!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 })
|
|
2076
2178
|
] }),
|
|
2077
|
-
/* @__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" }) })
|
|
2078
2180
|
] });
|
|
2079
2181
|
}
|
|
2080
2182
|
|
|
2081
2183
|
// packages/chip/src/index.tsx
|
|
2082
|
-
import { jsx as
|
|
2184
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2083
2185
|
var statuses = ["default", "info", "success", "warning", "error", "neutral", "pending", "processing"];
|
|
2084
2186
|
function Chip({ children, status = "default", color, variant = "subtle", dot = false, onRemove, removeLabel = "Remove", className, style, ...props }) {
|
|
2085
2187
|
const usesCustomColor = Boolean(color);
|
|
@@ -2088,16 +2190,16 @@ function Chip({ children, status = "default", color, variant = "subtle", dot = f
|
|
|
2088
2190
|
...style
|
|
2089
2191
|
};
|
|
2090
2192
|
const resolvedStatus = statuses.includes(status) ? status : "default";
|
|
2091
|
-
return /* @__PURE__ */
|
|
2092
|
-
dot && /* @__PURE__ */
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
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" })
|
|
2095
2197
|
] });
|
|
2096
2198
|
}
|
|
2097
2199
|
|
|
2098
2200
|
// packages/message/src/index.tsx
|
|
2099
|
-
import { useEffect as
|
|
2100
|
-
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";
|
|
2101
2203
|
var messageId = 0;
|
|
2102
2204
|
var entries = [];
|
|
2103
2205
|
var listeners = /* @__PURE__ */ new Set();
|
|
@@ -2130,22 +2232,22 @@ var message = {
|
|
|
2130
2232
|
};
|
|
2131
2233
|
var icons = { success: "\u2713", info: "i", warning: "!", error: "\xD7" };
|
|
2132
2234
|
function Message({ maxCount = 4, closeLabel = "Close notification", className, ...props }) {
|
|
2133
|
-
const [visibleEntries, setVisibleEntries] =
|
|
2134
|
-
|
|
2235
|
+
const [visibleEntries, setVisibleEntries] = useState12(entries);
|
|
2236
|
+
useEffect8(() => {
|
|
2135
2237
|
const listener = (nextEntries) => setVisibleEntries(nextEntries);
|
|
2136
2238
|
listeners.add(listener);
|
|
2137
2239
|
return () => {
|
|
2138
2240
|
listeners.delete(listener);
|
|
2139
2241
|
};
|
|
2140
2242
|
}, []);
|
|
2141
|
-
return /* @__PURE__ */
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
entry.title && /* @__PURE__ */
|
|
2145
|
-
/* @__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 })
|
|
2146
2248
|
] }),
|
|
2147
|
-
entry.action && /* @__PURE__ */
|
|
2148
|
-
/* @__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) })
|
|
2149
2251
|
] }, entry.id)) });
|
|
2150
2252
|
}
|
|
2151
2253
|
((Message2) => {
|
|
@@ -2159,8 +2261,8 @@ function Message({ maxCount = 4, closeLabel = "Close notification", className, .
|
|
|
2159
2261
|
})(Message || (Message = {}));
|
|
2160
2262
|
|
|
2161
2263
|
// packages/snackbar/src/index.tsx
|
|
2162
|
-
import { useEffect as
|
|
2163
|
-
import { jsx as
|
|
2264
|
+
import { useEffect as useEffect9 } from "react";
|
|
2265
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2164
2266
|
function Snackbar({
|
|
2165
2267
|
open,
|
|
2166
2268
|
message: message2,
|
|
@@ -2174,12 +2276,12 @@ function Snackbar({
|
|
|
2174
2276
|
}) {
|
|
2175
2277
|
const vertical = anchorOrigin.vertical ?? "bottom";
|
|
2176
2278
|
const horizontal = anchorOrigin.horizontal ?? "center";
|
|
2177
|
-
|
|
2279
|
+
useEffect9(() => {
|
|
2178
2280
|
if (!open || autoHideDuration === null) return void 0;
|
|
2179
2281
|
const timer = window.setTimeout(() => onClose?.("timeout"), autoHideDuration);
|
|
2180
2282
|
return () => window.clearTimeout(timer);
|
|
2181
2283
|
}, [open, autoHideDuration, onClose]);
|
|
2182
|
-
|
|
2284
|
+
useEffect9(() => {
|
|
2183
2285
|
if (!open) return void 0;
|
|
2184
2286
|
const onKeyDown = (event) => {
|
|
2185
2287
|
if (event.key === "Escape") onClose?.("escapeKeyDown");
|
|
@@ -2188,14 +2290,558 @@ function Snackbar({
|
|
|
2188
2290
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2189
2291
|
}, [open, onClose]);
|
|
2190
2292
|
if (!open) return null;
|
|
2191
|
-
return /* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2193
|
-
action && /* @__PURE__ */
|
|
2194
|
-
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") })
|
|
2195
2297
|
] }) });
|
|
2196
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
|
+
}
|
|
2197
2840
|
export {
|
|
2841
|
+
Avatar,
|
|
2842
|
+
AvatarGroup,
|
|
2198
2843
|
Button,
|
|
2844
|
+
ButtonBar,
|
|
2199
2845
|
Checkbox,
|
|
2200
2846
|
ChevronDownIcon,
|
|
2201
2847
|
ChevronUpIcon,
|
|
@@ -2208,6 +2854,8 @@ export {
|
|
|
2208
2854
|
Loading,
|
|
2209
2855
|
Message,
|
|
2210
2856
|
Modal,
|
|
2857
|
+
MoreHorizontalIcon,
|
|
2858
|
+
MoreVerticalIcon,
|
|
2211
2859
|
NumberInput,
|
|
2212
2860
|
Pagination,
|
|
2213
2861
|
PlusIcon,
|