@dragunio/fe-libs 0.1.7 → 0.1.8
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 +29 -0
- package/dist/{chunk-GT4546FD.mjs → chunk-HM3V3DVO.mjs} +4 -4
- package/dist/icons.js +4 -4
- package/dist/icons.mjs +1 -1
- package/dist/index.d.mts +67 -4
- package/dist/index.d.ts +67 -4
- package/dist/index.js +568 -345
- package/dist/index.mjs +575 -346
- package/dist/styles.css +156 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
search,
|
|
24
24
|
trash,
|
|
25
25
|
x_close
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-HM3V3DVO.mjs";
|
|
27
27
|
|
|
28
28
|
// packages/button/src/index.tsx
|
|
29
29
|
import { forwardRef } from "react";
|
|
@@ -107,9 +107,23 @@ function ButtonBar({
|
|
|
107
107
|
const rootRef = useRef(null);
|
|
108
108
|
const moreMenuId = useId();
|
|
109
109
|
const visibleCount = Math.max(0, Math.floor(maxVisible));
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
const actionCount = actions.filter(
|
|
111
|
+
(item) => item !== "|"
|
|
112
|
+
).length;
|
|
113
|
+
const hasOverflow = actionCount > visibleCount;
|
|
114
|
+
let visibleActionEndIndex = actions.length;
|
|
115
|
+
if (hasOverflow) {
|
|
116
|
+
visibleActionEndIndex = 0;
|
|
117
|
+
let renderedActionCount = 0;
|
|
118
|
+
while (visibleActionEndIndex < actions.length && renderedActionCount < visibleCount) {
|
|
119
|
+
if (actions[visibleActionEndIndex] !== "|") renderedActionCount += 1;
|
|
120
|
+
visibleActionEndIndex += 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const visibleActions = actions.slice(0, visibleActionEndIndex).filter((item) => item !== "|");
|
|
124
|
+
const overflowItems = actions.slice(visibleActionEndIndex).filter(
|
|
125
|
+
(item, index, items) => item !== "|" || items.slice(0, index).some((candidate) => candidate !== "|") && items.slice(index + 1).some((candidate) => candidate !== "|") && items[index - 1] !== "|"
|
|
126
|
+
);
|
|
113
127
|
const {
|
|
114
128
|
onClick: onMoreClick,
|
|
115
129
|
disabled: moreDisabled,
|
|
@@ -133,18 +147,20 @@ function ButtonBar({
|
|
|
133
147
|
document.removeEventListener("keydown", onKeyDown);
|
|
134
148
|
};
|
|
135
149
|
}, [isMoreOpen]);
|
|
136
|
-
const renderAction = (action,
|
|
137
|
-
const { id, onClick, disabled, ...buttonProps } = action;
|
|
150
|
+
const renderAction = (action, isOverflowAction = false) => {
|
|
151
|
+
const { id, className: className2, onClick, disabled, prefix, ...buttonProps } = action;
|
|
138
152
|
return /* @__PURE__ */ createElement(
|
|
139
153
|
Button,
|
|
140
154
|
{
|
|
141
155
|
...buttonProps,
|
|
156
|
+
className: [className2, isOverflowAction && "fe-button-bar__menu-action"].filter(Boolean).join(" ") || void 0,
|
|
142
157
|
disabled,
|
|
143
158
|
key: id,
|
|
144
159
|
onClick: (event) => {
|
|
145
160
|
onClick?.(event);
|
|
146
|
-
if (
|
|
147
|
-
}
|
|
161
|
+
if (isOverflowAction && !disabled) setIsMoreOpen(false);
|
|
162
|
+
},
|
|
163
|
+
prefix: isOverflowAction ? /* @__PURE__ */ jsx2("span", { className: "fe-button-bar__menu-icon", children: prefix }) : prefix
|
|
148
164
|
}
|
|
149
165
|
);
|
|
150
166
|
};
|
|
@@ -182,7 +198,17 @@ function ButtonBar({
|
|
|
182
198
|
className: "fe-button-bar__menu",
|
|
183
199
|
id: moreMenuId,
|
|
184
200
|
role: "group",
|
|
185
|
-
children:
|
|
201
|
+
children: overflowItems.map(
|
|
202
|
+
(item, index) => item === "|" ? /* @__PURE__ */ jsx2(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
"aria-orientation": "horizontal",
|
|
206
|
+
className: "fe-button-bar__menu-divider",
|
|
207
|
+
role: "separator"
|
|
208
|
+
},
|
|
209
|
+
`divider-${index}`
|
|
210
|
+
) : renderAction(item, true)
|
|
211
|
+
)
|
|
186
212
|
}
|
|
187
213
|
)
|
|
188
214
|
] })
|
|
@@ -191,21 +217,223 @@ function ButtonBar({
|
|
|
191
217
|
);
|
|
192
218
|
}
|
|
193
219
|
|
|
220
|
+
// packages/tabs/src/index.tsx
|
|
221
|
+
import {
|
|
222
|
+
forwardRef as forwardRef2,
|
|
223
|
+
useCallback,
|
|
224
|
+
useEffect as useEffect2,
|
|
225
|
+
useId as useId2,
|
|
226
|
+
useRef as useRef2,
|
|
227
|
+
useState as useState2
|
|
228
|
+
} from "react";
|
|
229
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
230
|
+
var hasPanel = (item) => Object.prototype.hasOwnProperty.call(item, "content");
|
|
231
|
+
function findSelectableTab(items, value) {
|
|
232
|
+
return items.find((item) => item.id === value && !item.disabled) ?? items.find((item) => !item.disabled);
|
|
233
|
+
}
|
|
234
|
+
function scrollBehavior() {
|
|
235
|
+
return typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
236
|
+
}
|
|
237
|
+
var Tabs = forwardRef2(function Tabs2({
|
|
238
|
+
items,
|
|
239
|
+
value,
|
|
240
|
+
defaultValue,
|
|
241
|
+
onChange,
|
|
242
|
+
variant = "tab",
|
|
243
|
+
scrollButtons = "auto",
|
|
244
|
+
previousScrollLabel = "Scroll tabs backward",
|
|
245
|
+
nextScrollLabel = "Scroll tabs forward",
|
|
246
|
+
className,
|
|
247
|
+
"aria-label": ariaLabel = "Tabs",
|
|
248
|
+
"aria-labelledby": ariaLabelledBy,
|
|
249
|
+
...props
|
|
250
|
+
}, ref) {
|
|
251
|
+
const generatedId = useId2();
|
|
252
|
+
const listRef = useRef2(null);
|
|
253
|
+
const tabRefs = useRef2(/* @__PURE__ */ new Map());
|
|
254
|
+
const [uncontrolledValue, setUncontrolledValue] = useState2(
|
|
255
|
+
() => findSelectableTab(items, defaultValue)?.id
|
|
256
|
+
);
|
|
257
|
+
const [scrollState, setScrollState] = useState2({
|
|
258
|
+
hasOverflow: false,
|
|
259
|
+
canScrollBackward: false,
|
|
260
|
+
canScrollForward: false
|
|
261
|
+
});
|
|
262
|
+
const activeTab = findSelectableTab(items, value ?? uncontrolledValue);
|
|
263
|
+
const activeIndex = activeTab ? items.findIndex((item) => item.id === activeTab.id) : -1;
|
|
264
|
+
useEffect2(() => {
|
|
265
|
+
if (value === void 0 && activeTab?.id !== uncontrolledValue) {
|
|
266
|
+
setUncontrolledValue(activeTab?.id);
|
|
267
|
+
}
|
|
268
|
+
}, [activeTab?.id, uncontrolledValue, value]);
|
|
269
|
+
const updateScrollState = useCallback(() => {
|
|
270
|
+
const list = listRef.current;
|
|
271
|
+
if (!list) return;
|
|
272
|
+
const maxScroll = Math.max(0, list.scrollWidth - list.clientWidth);
|
|
273
|
+
setScrollState({
|
|
274
|
+
hasOverflow: maxScroll > 1,
|
|
275
|
+
canScrollBackward: list.scrollLeft > 1,
|
|
276
|
+
canScrollForward: list.scrollLeft < maxScroll - 1
|
|
277
|
+
});
|
|
278
|
+
}, []);
|
|
279
|
+
useEffect2(() => {
|
|
280
|
+
const list = listRef.current;
|
|
281
|
+
if (!list) return;
|
|
282
|
+
updateScrollState();
|
|
283
|
+
list.addEventListener("scroll", updateScrollState, { passive: true });
|
|
284
|
+
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(updateScrollState);
|
|
285
|
+
observer?.observe(list);
|
|
286
|
+
window.addEventListener("resize", updateScrollState);
|
|
287
|
+
return () => {
|
|
288
|
+
list.removeEventListener("scroll", updateScrollState);
|
|
289
|
+
observer?.disconnect();
|
|
290
|
+
window.removeEventListener("resize", updateScrollState);
|
|
291
|
+
};
|
|
292
|
+
}, [items, updateScrollState]);
|
|
293
|
+
useEffect2(() => {
|
|
294
|
+
const tab = activeTab ? tabRefs.current.get(activeTab.id) : void 0;
|
|
295
|
+
tab?.scrollIntoView?.({
|
|
296
|
+
behavior: scrollBehavior(),
|
|
297
|
+
block: "nearest",
|
|
298
|
+
inline: "nearest"
|
|
299
|
+
});
|
|
300
|
+
}, [activeTab?.id]);
|
|
301
|
+
const selectTab = (item, event) => {
|
|
302
|
+
if (item.disabled || item.id === activeTab?.id) return;
|
|
303
|
+
if (value === void 0) setUncontrolledValue(item.id);
|
|
304
|
+
onChange?.(item.id, item, event);
|
|
305
|
+
};
|
|
306
|
+
const selectFromKeyboard = (item, event) => {
|
|
307
|
+
const enabledItems = items.filter((candidate) => !candidate.disabled);
|
|
308
|
+
const currentIndex = enabledItems.findIndex(
|
|
309
|
+
(candidate) => candidate.id === item.id
|
|
310
|
+
);
|
|
311
|
+
if (currentIndex === -1) return;
|
|
312
|
+
let nextIndex;
|
|
313
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
314
|
+
nextIndex = (currentIndex + 1) % enabledItems.length;
|
|
315
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
316
|
+
nextIndex = (currentIndex - 1 + enabledItems.length) % enabledItems.length;
|
|
317
|
+
} else if (event.key === "Home") {
|
|
318
|
+
nextIndex = 0;
|
|
319
|
+
} else if (event.key === "End") {
|
|
320
|
+
nextIndex = enabledItems.length - 1;
|
|
321
|
+
}
|
|
322
|
+
if (nextIndex === void 0) return;
|
|
323
|
+
event.preventDefault();
|
|
324
|
+
const nextItem = enabledItems[nextIndex];
|
|
325
|
+
if (!nextItem) return;
|
|
326
|
+
tabRefs.current.get(nextItem.id)?.focus();
|
|
327
|
+
selectTab(nextItem, event);
|
|
328
|
+
};
|
|
329
|
+
const scrollTabs = (direction) => {
|
|
330
|
+
const list = listRef.current;
|
|
331
|
+
if (!list) return;
|
|
332
|
+
list.scrollBy({
|
|
333
|
+
left: direction * Math.max(160, Math.round(list.clientWidth * 0.75)),
|
|
334
|
+
behavior: scrollBehavior()
|
|
335
|
+
});
|
|
336
|
+
};
|
|
337
|
+
const showScrollButtons = scrollButtons === "always" || scrollButtons === "auto" && scrollState.hasOverflow;
|
|
338
|
+
const classes = ["fe-tabs", `fe-tabs--${variant}`, className].filter(Boolean).join(" ");
|
|
339
|
+
return /* @__PURE__ */ jsxs3("div", { ...props, className: classes, ref, children: [
|
|
340
|
+
/* @__PURE__ */ jsxs3("div", { className: "fe-tabs__navigation", children: [
|
|
341
|
+
showScrollButtons && /* @__PURE__ */ jsx3(
|
|
342
|
+
Button,
|
|
343
|
+
{
|
|
344
|
+
"aria-label": previousScrollLabel,
|
|
345
|
+
className: "fe-tabs__scroll-button",
|
|
346
|
+
disabled: !scrollState.canScrollBackward,
|
|
347
|
+
hierarchy: "tertiary-gray",
|
|
348
|
+
icon: /* @__PURE__ */ jsx3(chevron_left, { size: 18 }),
|
|
349
|
+
iconOnly: true,
|
|
350
|
+
onClick: () => scrollTabs(-1),
|
|
351
|
+
size: "32"
|
|
352
|
+
}
|
|
353
|
+
),
|
|
354
|
+
/* @__PURE__ */ jsx3("div", { className: "fe-tabs__scroller", ref: listRef, children: /* @__PURE__ */ jsx3(
|
|
355
|
+
"div",
|
|
356
|
+
{
|
|
357
|
+
"aria-label": ariaLabelledBy ? void 0 : ariaLabel,
|
|
358
|
+
"aria-labelledby": ariaLabelledBy,
|
|
359
|
+
"aria-orientation": "horizontal",
|
|
360
|
+
className: "fe-tabs__list",
|
|
361
|
+
role: "tablist",
|
|
362
|
+
children: items.map((item, index) => {
|
|
363
|
+
const selected = item.id === activeTab?.id;
|
|
364
|
+
const panelId = `${generatedId}-panel-${index}`;
|
|
365
|
+
return /* @__PURE__ */ jsx3(
|
|
366
|
+
"button",
|
|
367
|
+
{
|
|
368
|
+
"aria-controls": hasPanel(item) ? panelId : void 0,
|
|
369
|
+
"aria-selected": selected,
|
|
370
|
+
className: "fe-tabs__tab",
|
|
371
|
+
disabled: item.disabled,
|
|
372
|
+
id: `${generatedId}-tab-${index}`,
|
|
373
|
+
onClick: (event) => selectTab(item, event),
|
|
374
|
+
onKeyDown: (event) => selectFromKeyboard(item, event),
|
|
375
|
+
ref: (node) => {
|
|
376
|
+
if (node) tabRefs.current.set(item.id, node);
|
|
377
|
+
else tabRefs.current.delete(item.id);
|
|
378
|
+
},
|
|
379
|
+
role: "tab",
|
|
380
|
+
tabIndex: selected ? 0 : -1,
|
|
381
|
+
type: "button",
|
|
382
|
+
children: item.label
|
|
383
|
+
},
|
|
384
|
+
item.id
|
|
385
|
+
);
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
) }),
|
|
389
|
+
showScrollButtons && /* @__PURE__ */ jsx3(
|
|
390
|
+
Button,
|
|
391
|
+
{
|
|
392
|
+
"aria-label": nextScrollLabel,
|
|
393
|
+
className: "fe-tabs__scroll-button",
|
|
394
|
+
disabled: !scrollState.canScrollForward,
|
|
395
|
+
hierarchy: "tertiary-gray",
|
|
396
|
+
icon: /* @__PURE__ */ jsx3(chevron_right, { size: 18 }),
|
|
397
|
+
iconOnly: true,
|
|
398
|
+
onClick: () => scrollTabs(1),
|
|
399
|
+
size: "32"
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
] }),
|
|
403
|
+
items.map(
|
|
404
|
+
(item, index) => hasPanel(item) ? /* @__PURE__ */ jsx3(
|
|
405
|
+
"div",
|
|
406
|
+
{
|
|
407
|
+
"aria-labelledby": `${generatedId}-tab-${index}`,
|
|
408
|
+
className: "fe-tabs__panel",
|
|
409
|
+
hidden: item.id !== activeTab?.id,
|
|
410
|
+
id: `${generatedId}-panel-${index}`,
|
|
411
|
+
role: "tabpanel",
|
|
412
|
+
tabIndex: 0,
|
|
413
|
+
children: item.content
|
|
414
|
+
},
|
|
415
|
+
item.id
|
|
416
|
+
) : null
|
|
417
|
+
)
|
|
418
|
+
] });
|
|
419
|
+
});
|
|
420
|
+
Tabs.displayName = "Tabs";
|
|
421
|
+
|
|
194
422
|
// packages/table/src/index.tsx
|
|
195
423
|
import {
|
|
196
424
|
createContext,
|
|
197
425
|
isValidElement,
|
|
198
|
-
useCallback,
|
|
426
|
+
useCallback as useCallback2,
|
|
199
427
|
useContext,
|
|
200
|
-
useEffect as
|
|
428
|
+
useEffect as useEffect3,
|
|
201
429
|
useMemo as useMemo2,
|
|
202
|
-
useRef as
|
|
203
|
-
useState as
|
|
430
|
+
useRef as useRef3,
|
|
431
|
+
useState as useState4
|
|
204
432
|
} from "react";
|
|
205
433
|
|
|
206
434
|
// packages/pagination/src/index.tsx
|
|
207
|
-
import { useMemo, useState as
|
|
208
|
-
import { jsx as
|
|
435
|
+
import { useMemo, useState as useState3 } from "react";
|
|
436
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
209
437
|
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
210
438
|
var range = (start, end) => Array.from({ length: Math.max(0, end - start + 1) }, (_, index) => start + index);
|
|
211
439
|
function getItems(totalPages, page, siblingCount, boundaryCount) {
|
|
@@ -237,7 +465,7 @@ function Pagination({
|
|
|
237
465
|
...props
|
|
238
466
|
}) {
|
|
239
467
|
const safeTotalPages = Math.max(1, Math.floor(totalPages));
|
|
240
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
468
|
+
const [uncontrolledPage, setUncontrolledPage] = useState3(() => clamp(defaultPage, 1, safeTotalPages));
|
|
241
469
|
const currentPage = clamp(page ?? uncontrolledPage, 1, safeTotalPages);
|
|
242
470
|
const items = useMemo(
|
|
243
471
|
() => getItems(safeTotalPages, currentPage, Math.max(0, siblingCount), Math.max(0, boundaryCount)),
|
|
@@ -248,9 +476,9 @@ function Pagination({
|
|
|
248
476
|
if (page === void 0) setUncontrolledPage(resolvedPage);
|
|
249
477
|
if (resolvedPage !== currentPage) onPageChange?.(resolvedPage);
|
|
250
478
|
};
|
|
251
|
-
return /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
items.map((item, index) => item === "start-ellipsis" || item === "end-ellipsis" ? /* @__PURE__ */
|
|
479
|
+
return /* @__PURE__ */ jsxs4("nav", { className: ["fe-pagination", className].filter(Boolean).join(" "), "aria-label": "Pagination", ...props, children: [
|
|
480
|
+
/* @__PURE__ */ jsx4(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) }),
|
|
481
|
+
items.map((item, index) => item === "start-ellipsis" || item === "end-ellipsis" ? /* @__PURE__ */ jsx4("span", { className: "fe-pagination__ellipsis", "aria-hidden": "true", children: "\u2026" }, `${item}-${index}`) : /* @__PURE__ */ jsx4(
|
|
254
482
|
Button,
|
|
255
483
|
{
|
|
256
484
|
className: "fe-pagination__button",
|
|
@@ -264,12 +492,12 @@ function Pagination({
|
|
|
264
492
|
},
|
|
265
493
|
item
|
|
266
494
|
)),
|
|
267
|
-
/* @__PURE__ */
|
|
495
|
+
/* @__PURE__ */ jsx4(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) })
|
|
268
496
|
] });
|
|
269
497
|
}
|
|
270
498
|
|
|
271
499
|
// packages/table/src/index.tsx
|
|
272
|
-
import { jsx as
|
|
500
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
273
501
|
var TableContext = createContext({ striped: false });
|
|
274
502
|
var MIN_COLUMN_WIDTH = 96;
|
|
275
503
|
var MAX_COLUMN_WIDTH = 1200;
|
|
@@ -319,33 +547,33 @@ function DataTable({
|
|
|
319
547
|
() => getInitialColumnSizes(headers, data, defaultColumnSizes, safeMinWidth),
|
|
320
548
|
[headers, data, defaultColumnSizes, safeMinWidth]
|
|
321
549
|
);
|
|
322
|
-
const [uncontrolledSizes, setUncontrolledSizes] =
|
|
550
|
+
const [uncontrolledSizes, setUncontrolledSizes] = useState4(generatedSizes);
|
|
323
551
|
const shouldPaginate = pagination ?? pageSize !== void 0;
|
|
324
552
|
const safePageSize = Math.max(1, Math.floor(pageSize ?? 10));
|
|
325
553
|
const totalPages = Math.max(1, Math.ceil(data.length / safePageSize));
|
|
326
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
554
|
+
const [uncontrolledPage, setUncontrolledPage] = useState4(() => Math.min(Math.max(1, defaultPage), totalPages));
|
|
327
555
|
const currentPage = Math.min(Math.max(1, page ?? uncontrolledPage), totalPages);
|
|
328
556
|
const pagedData = shouldPaginate ? data.slice((currentPage - 1) * safePageSize, currentPage * safePageSize) : data;
|
|
329
|
-
const resizeState =
|
|
330
|
-
const [isResizing, setIsResizing] =
|
|
557
|
+
const resizeState = useRef3();
|
|
558
|
+
const [isResizing, setIsResizing] = useState4(false);
|
|
331
559
|
const sizes2 = columnSizes ? getInitialColumnSizes(headers, data, columnSizes, safeMinWidth).map((size) => Math.max(safeMinWidth, size)) : uncontrolledSizes.map((size) => Math.max(safeMinWidth, size));
|
|
332
|
-
|
|
560
|
+
useEffect3(() => {
|
|
333
561
|
if (columnSizes) return;
|
|
334
562
|
setUncontrolledSizes((currentSizes) => {
|
|
335
563
|
const nextSizes = generatedSizes.map((generatedSize, index) => currentSizes[index] ?? generatedSize);
|
|
336
564
|
return sameSizes(currentSizes, nextSizes) ? currentSizes : nextSizes;
|
|
337
565
|
});
|
|
338
566
|
}, [columnSizes, generatedSizes]);
|
|
339
|
-
|
|
567
|
+
useEffect3(() => {
|
|
340
568
|
if (page === void 0 && uncontrolledPage > totalPages) setUncontrolledPage(totalPages);
|
|
341
569
|
}, [page, totalPages, uncontrolledPage]);
|
|
342
|
-
const updateColumnSize =
|
|
570
|
+
const updateColumnSize = useCallback2((columnIndex, nextSize) => {
|
|
343
571
|
const clampedSize = Math.min(MAX_COLUMN_WIDTH, Math.max(safeMinWidth, Math.round(nextSize)));
|
|
344
572
|
const nextSizes = sizes2.map((size, index) => index === columnIndex ? clampedSize : size);
|
|
345
573
|
if (!columnSizes) setUncontrolledSizes(nextSizes);
|
|
346
574
|
onColumnResize?.(nextSizes, columnIndex);
|
|
347
575
|
}, [columnSizes, onColumnResize, safeMinWidth, sizes2]);
|
|
348
|
-
|
|
576
|
+
useEffect3(() => {
|
|
349
577
|
const onPointerMove = (event) => {
|
|
350
578
|
const activeResize = resizeState.current;
|
|
351
579
|
if (!activeResize) return;
|
|
@@ -369,14 +597,14 @@ function DataTable({
|
|
|
369
597
|
if (nextPage !== currentPage) onPageChange?.(nextPage);
|
|
370
598
|
};
|
|
371
599
|
const resolvedPaginationPosition = paginationPosition === "middle-bottom" ? "bottom-center" : paginationPosition;
|
|
372
|
-
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */
|
|
373
|
-
return /* @__PURE__ */
|
|
600
|
+
const paginationControl = shouldPaginate && totalPages > 1 ? /* @__PURE__ */ jsx5("div", { className: `fe-table__pagination fe-table__pagination--${resolvedPaginationPosition}`, children: /* @__PURE__ */ jsx5(Pagination, { page: currentPage, totalPages, onPageChange: changePage }) }) : null;
|
|
601
|
+
return /* @__PURE__ */ jsxs5("div", { className: "fe-table", "data-resizing": isResizing || void 0, children: [
|
|
374
602
|
resolvedPaginationPosition === "top-right" && paginationControl,
|
|
375
|
-
/* @__PURE__ */
|
|
376
|
-
/* @__PURE__ */
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
/* @__PURE__ */
|
|
379
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ jsxs5("table", { className: ["fe-table__table", className].filter(Boolean).join(" "), "data-fe-table": true, "data-striped": striped || void 0, ...props, children: [
|
|
604
|
+
/* @__PURE__ */ jsx5("colgroup", { children: sizes2.map((size, index) => /* @__PURE__ */ jsx5("col", { style: { width: `${size}px` } }, index)) }),
|
|
605
|
+
/* @__PURE__ */ jsx5("thead", { children: /* @__PURE__ */ jsx5("tr", { children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ jsxs5("th", { scope: "col", children: [
|
|
606
|
+
/* @__PURE__ */ jsx5("span", { className: "fe-table__header-content", children: headers[columnIndex] ?? `Column ${columnIndex + 1}` }),
|
|
607
|
+
/* @__PURE__ */ jsx5(
|
|
380
608
|
"span",
|
|
381
609
|
{
|
|
382
610
|
className: "fe-table__resize-handle",
|
|
@@ -400,7 +628,7 @@ function DataTable({
|
|
|
400
628
|
}
|
|
401
629
|
)
|
|
402
630
|
] }, columnIndex)) }) }),
|
|
403
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ jsx5("tbody", { children: pagedData.map((row, rowIndex) => /* @__PURE__ */ jsx5("tr", { children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ jsx5("td", { children: row[columnIndex] }, columnIndex)) }, shouldPaginate ? (currentPage - 1) * safePageSize + rowIndex : rowIndex)) })
|
|
404
632
|
] }),
|
|
405
633
|
resolvedPaginationPosition !== "top-right" && paginationControl
|
|
406
634
|
] });
|
|
@@ -418,35 +646,35 @@ function Table({
|
|
|
418
646
|
paginationPosition,
|
|
419
647
|
...props
|
|
420
648
|
}) {
|
|
421
|
-
if (headers || data) return /* @__PURE__ */
|
|
422
|
-
return /* @__PURE__ */
|
|
649
|
+
if (headers || data) return /* @__PURE__ */ jsx5(DataTable, { headers: headers ?? [], data: data ?? [], striped: striped ?? true, pagination, pageSize, page, defaultPage, onPageChange, paginationPosition, ...props });
|
|
650
|
+
return /* @__PURE__ */ jsx5(TableContext.Provider, { value: { striped: striped ?? false }, children: /* @__PURE__ */ jsx5("table", { "data-fe-table": true, "data-striped": striped || void 0, ...props, children }) });
|
|
423
651
|
}
|
|
424
652
|
function TableHead(props) {
|
|
425
|
-
return /* @__PURE__ */
|
|
653
|
+
return /* @__PURE__ */ jsx5("thead", { ...props });
|
|
426
654
|
}
|
|
427
655
|
function TableBody(props) {
|
|
428
|
-
return /* @__PURE__ */
|
|
656
|
+
return /* @__PURE__ */ jsx5("tbody", { ...props });
|
|
429
657
|
}
|
|
430
658
|
function TableRow({ children, ...props }) {
|
|
431
659
|
const { striped } = useContext(TableContext);
|
|
432
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ jsx5("tr", { "data-striped": striped || void 0, ...props, children });
|
|
433
661
|
}
|
|
434
662
|
function TableCell({ children, ...props }) {
|
|
435
|
-
return /* @__PURE__ */
|
|
663
|
+
return /* @__PURE__ */ jsx5("td", { ...props, children });
|
|
436
664
|
}
|
|
437
665
|
function TableHeader({ children, ...props }) {
|
|
438
|
-
return /* @__PURE__ */
|
|
666
|
+
return /* @__PURE__ */ jsx5("th", { scope: "col", ...props, children });
|
|
439
667
|
}
|
|
440
668
|
function TableCaption(props) {
|
|
441
|
-
return /* @__PURE__ */
|
|
669
|
+
return /* @__PURE__ */ jsx5("caption", { ...props });
|
|
442
670
|
}
|
|
443
671
|
|
|
444
672
|
// packages/toggle/src/index.tsx
|
|
445
673
|
import {
|
|
446
|
-
forwardRef as
|
|
674
|
+
forwardRef as forwardRef3
|
|
447
675
|
} from "react";
|
|
448
|
-
import { jsx as
|
|
449
|
-
var Toggle =
|
|
676
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
677
|
+
var Toggle = forwardRef3(function Toggle2({
|
|
450
678
|
color = "#16a34a",
|
|
451
679
|
label,
|
|
452
680
|
labelPosition = "right",
|
|
@@ -460,9 +688,9 @@ var Toggle = forwardRef2(function Toggle2({
|
|
|
460
688
|
"--fe-toggle-color": color,
|
|
461
689
|
...style
|
|
462
690
|
};
|
|
463
|
-
return /* @__PURE__ */
|
|
464
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ jsxs6("label", { className: classes, style: toggleStyle, children: [
|
|
692
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsx6("span", { className: "fe-toggle__label", children: label }),
|
|
693
|
+
/* @__PURE__ */ jsx6(
|
|
466
694
|
"input",
|
|
467
695
|
{
|
|
468
696
|
ref,
|
|
@@ -473,18 +701,18 @@ var Toggle = forwardRef2(function Toggle2({
|
|
|
473
701
|
...props
|
|
474
702
|
}
|
|
475
703
|
),
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ jsx6("span", { className: "fe-toggle__control", "aria-hidden": "true" }),
|
|
705
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx6("span", { className: "fe-toggle__label", children: label })
|
|
478
706
|
] });
|
|
479
707
|
});
|
|
480
708
|
Toggle.displayName = "Toggle";
|
|
481
709
|
|
|
482
710
|
// packages/drawer/src/index.tsx
|
|
483
|
-
import { useEffect as
|
|
711
|
+
import { useEffect as useEffect4 } from "react";
|
|
484
712
|
import { createPortal } from "react-dom";
|
|
485
|
-
import { jsx as
|
|
713
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
486
714
|
function Drawer({ open, onClose, title, footer, side = "right", width = 400, fullScreen = false, children, closeOnBackdropClick = true, className, style, ...props }) {
|
|
487
|
-
|
|
715
|
+
useEffect4(() => {
|
|
488
716
|
if (!open) return;
|
|
489
717
|
const onKeyDown = (event) => {
|
|
490
718
|
if (event.key === "Escape") onClose();
|
|
@@ -494,27 +722,27 @@ function Drawer({ open, onClose, title, footer, side = "right", width = 400, ful
|
|
|
494
722
|
}, [onClose, open]);
|
|
495
723
|
if (!open || typeof document === "undefined") return null;
|
|
496
724
|
const panelStyle = !fullScreen && (side === "left" || side === "right") ? { ...style, width: typeof width === "number" ? `${width}px` : width } : style;
|
|
497
|
-
return createPortal(/* @__PURE__ */
|
|
725
|
+
return createPortal(/* @__PURE__ */ jsx7("div", { className: "fe-drawer-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
498
726
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
499
|
-
}, children: /* @__PURE__ */
|
|
500
|
-
/* @__PURE__ */
|
|
501
|
-
title && /* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
727
|
+
}, children: /* @__PURE__ */ jsxs7("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: [
|
|
728
|
+
/* @__PURE__ */ jsxs7("header", { className: "fe-drawer__header", children: [
|
|
729
|
+
title && /* @__PURE__ */ jsx7("h2", { children: title }),
|
|
730
|
+
/* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "Close drawer", onClick: onClose, children: "\xD7" })
|
|
503
731
|
] }),
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
footer && /* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ jsx7("div", { className: "fe-drawer__body", children }),
|
|
733
|
+
footer && /* @__PURE__ */ jsx7("footer", { className: "fe-drawer__footer", children: footer })
|
|
506
734
|
] }) }), document.body);
|
|
507
735
|
}
|
|
508
736
|
|
|
509
737
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
510
|
-
import { forwardRef as
|
|
738
|
+
import { forwardRef as forwardRef4, useId as useId4, useState as useState6 } from "react";
|
|
511
739
|
|
|
512
740
|
// packages/tooltip/src/index.tsx
|
|
513
|
-
import { cloneElement, useId as
|
|
514
|
-
import { jsx as
|
|
741
|
+
import { cloneElement, useId as useId3, useState as useState5 } from "react";
|
|
742
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
515
743
|
function Tooltip({ content, children, placement = "top", disabled, className, ...props }) {
|
|
516
|
-
const [visible, setVisible] =
|
|
517
|
-
const id =
|
|
744
|
+
const [visible, setVisible] = useState5(false);
|
|
745
|
+
const id = useId3();
|
|
518
746
|
const trigger = cloneElement(children, { "aria-describedby": visible ? id : void 0, onMouseEnter: (event) => {
|
|
519
747
|
children.props.onMouseEnter?.(event);
|
|
520
748
|
setVisible(true);
|
|
@@ -528,14 +756,14 @@ function Tooltip({ content, children, placement = "top", disabled, className, ..
|
|
|
528
756
|
children.props.onBlur?.(event);
|
|
529
757
|
setVisible(false);
|
|
530
758
|
} });
|
|
531
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ jsxs8("span", { className: ["fe-tooltip", `fe-tooltip--${placement}`, className].filter(Boolean).join(" "), ...props, children: [
|
|
532
760
|
trigger,
|
|
533
|
-
visible && !disabled && /* @__PURE__ */
|
|
761
|
+
visible && !disabled && /* @__PURE__ */ jsx8("span", { id, role: "tooltip", className: "fe-tooltip__content", children: content })
|
|
534
762
|
] });
|
|
535
763
|
}
|
|
536
764
|
|
|
537
765
|
// packages/form-controls/src/controls/Field/field.tsx
|
|
538
|
-
import { jsx as
|
|
766
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
539
767
|
function getFieldError(error, errorMessage) {
|
|
540
768
|
if (errorMessage !== void 0 && errorMessage !== null) return errorMessage;
|
|
541
769
|
if (typeof error !== "boolean") return error;
|
|
@@ -552,10 +780,10 @@ function FieldLabel({
|
|
|
552
780
|
isRequired = false
|
|
553
781
|
}) {
|
|
554
782
|
if (!label) return null;
|
|
555
|
-
return /* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
isRequired && /* @__PURE__ */
|
|
558
|
-
description && descriptionDisplay === "tooltip" && /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ jsxs9("span", { className: "fe-field__label", children: [
|
|
784
|
+
/* @__PURE__ */ jsx9("span", { id, children: label }),
|
|
785
|
+
isRequired && /* @__PURE__ */ jsx9("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" }),
|
|
786
|
+
description && descriptionDisplay === "tooltip" && /* @__PURE__ */ jsx9(Tooltip, { content: description, children: /* @__PURE__ */ jsx9(
|
|
559
787
|
"span",
|
|
560
788
|
{
|
|
561
789
|
className: "fe-field__info",
|
|
@@ -574,7 +802,7 @@ function FieldMessage({
|
|
|
574
802
|
descriptionDisplay
|
|
575
803
|
}) {
|
|
576
804
|
if (error !== void 0 && error !== false && error !== null)
|
|
577
|
-
return /* @__PURE__ */
|
|
805
|
+
return /* @__PURE__ */ jsx9(
|
|
578
806
|
"span",
|
|
579
807
|
{
|
|
580
808
|
id,
|
|
@@ -584,13 +812,13 @@ function FieldMessage({
|
|
|
584
812
|
}
|
|
585
813
|
);
|
|
586
814
|
if (description && descriptionDisplay === "inline")
|
|
587
|
-
return /* @__PURE__ */
|
|
815
|
+
return /* @__PURE__ */ jsx9("span", { id, className: "fe-field__message", children: description });
|
|
588
816
|
return null;
|
|
589
817
|
}
|
|
590
818
|
|
|
591
819
|
// packages/form-controls/src/controls/TextInput/text-input.tsx
|
|
592
|
-
import { jsx as
|
|
593
|
-
var TextInput =
|
|
820
|
+
import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
821
|
+
var TextInput = forwardRef4(
|
|
594
822
|
function TextInput2({
|
|
595
823
|
value,
|
|
596
824
|
defaultValue = "",
|
|
@@ -620,12 +848,12 @@ var TextInput = forwardRef3(
|
|
|
620
848
|
"aria-labelledby": ariaLabelledBy,
|
|
621
849
|
...props
|
|
622
850
|
}, ref) {
|
|
623
|
-
const generatedId =
|
|
851
|
+
const generatedId = useId4();
|
|
624
852
|
const inputId = id ?? generatedId + "-input";
|
|
625
853
|
const labelId = generatedId + "-label";
|
|
626
854
|
const messageId2 = generatedId + "-message";
|
|
627
855
|
const controlled = value !== void 0;
|
|
628
|
-
const [internalValue, setInternalValue] =
|
|
856
|
+
const [internalValue, setInternalValue] = useState6(defaultValue);
|
|
629
857
|
const currentValue = controlled ? value : internalValue;
|
|
630
858
|
const fieldError = getFieldError(error, errorMessage);
|
|
631
859
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -646,7 +874,7 @@ var TextInput = forwardRef3(
|
|
|
646
874
|
onValueChange?.("");
|
|
647
875
|
onClear?.();
|
|
648
876
|
};
|
|
649
|
-
return /* @__PURE__ */
|
|
877
|
+
return /* @__PURE__ */ jsxs10(
|
|
650
878
|
"div",
|
|
651
879
|
{
|
|
652
880
|
className: [
|
|
@@ -655,7 +883,7 @@ var TextInput = forwardRef3(
|
|
|
655
883
|
className
|
|
656
884
|
].filter(Boolean).join(" "),
|
|
657
885
|
children: [
|
|
658
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ jsx10(
|
|
659
887
|
FieldLabel,
|
|
660
888
|
{
|
|
661
889
|
id: labelId,
|
|
@@ -665,10 +893,10 @@ var TextInput = forwardRef3(
|
|
|
665
893
|
isRequired
|
|
666
894
|
}
|
|
667
895
|
),
|
|
668
|
-
/* @__PURE__ */
|
|
669
|
-
resolvedPrefix && /* @__PURE__ */
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
896
|
+
/* @__PURE__ */ jsxs10("span", { className: "fe-text-input__control", children: [
|
|
897
|
+
resolvedPrefix && /* @__PURE__ */ jsx10("span", { className: "fe-text-input__prefix", children: resolvedPrefix }),
|
|
898
|
+
/* @__PURE__ */ jsxs10("span", { className: "fe-text-input__input-wrap", children: [
|
|
899
|
+
/* @__PURE__ */ jsx10(
|
|
672
900
|
"input",
|
|
673
901
|
{
|
|
674
902
|
ref,
|
|
@@ -690,26 +918,26 @@ var TextInput = forwardRef3(
|
|
|
690
918
|
...props
|
|
691
919
|
}
|
|
692
920
|
),
|
|
693
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */
|
|
694
|
-
/* @__PURE__ */
|
|
695
|
-
/* @__PURE__ */
|
|
921
|
+
isRequired && placeholder && !currentValue && /* @__PURE__ */ jsxs10("span", { className: "fe-text-input__placeholder", "aria-hidden": "true", children: [
|
|
922
|
+
/* @__PURE__ */ jsx10("span", { children: placeholder }),
|
|
923
|
+
/* @__PURE__ */ jsx10("span", { className: "fe-field__required", children: "*" })
|
|
696
924
|
] })
|
|
697
925
|
] }),
|
|
698
|
-
resolvedSuffix && /* @__PURE__ */
|
|
699
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
926
|
+
resolvedSuffix && /* @__PURE__ */ jsx10("span", { className: "fe-text-input__suffix", children: resolvedSuffix }),
|
|
927
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx10(
|
|
700
928
|
Button,
|
|
701
929
|
{
|
|
702
930
|
hierarchy: "tertiary-gray",
|
|
703
931
|
size: "24",
|
|
704
932
|
iconOnly: true,
|
|
705
|
-
icon: /* @__PURE__ */
|
|
933
|
+
icon: /* @__PURE__ */ jsx10(CloseIcon, { size: 14 }),
|
|
706
934
|
"aria-label": clearLabel,
|
|
707
935
|
onClick: clear,
|
|
708
936
|
className: "fe-text-input__clear"
|
|
709
937
|
}
|
|
710
938
|
)
|
|
711
939
|
] }),
|
|
712
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ jsx10(
|
|
713
941
|
FieldMessage,
|
|
714
942
|
{
|
|
715
943
|
id: messageId2,
|
|
@@ -727,15 +955,15 @@ TextInput.displayName = "TextInput";
|
|
|
727
955
|
|
|
728
956
|
// packages/form-controls/src/controls/TextArea/text-area.tsx
|
|
729
957
|
import {
|
|
730
|
-
forwardRef as
|
|
731
|
-
useId as
|
|
958
|
+
forwardRef as forwardRef5,
|
|
959
|
+
useId as useId5,
|
|
732
960
|
useImperativeHandle,
|
|
733
961
|
useLayoutEffect,
|
|
734
|
-
useRef as
|
|
735
|
-
useState as
|
|
962
|
+
useRef as useRef4,
|
|
963
|
+
useState as useState7
|
|
736
964
|
} from "react";
|
|
737
|
-
import { jsx as
|
|
738
|
-
var TextArea =
|
|
965
|
+
import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
966
|
+
var TextArea = forwardRef5(
|
|
739
967
|
function TextArea2({
|
|
740
968
|
value,
|
|
741
969
|
defaultValue = "",
|
|
@@ -762,13 +990,13 @@ var TextArea = forwardRef4(
|
|
|
762
990
|
"aria-labelledby": ariaLabelledBy,
|
|
763
991
|
...props
|
|
764
992
|
}, ref) {
|
|
765
|
-
const generatedId =
|
|
993
|
+
const generatedId = useId5();
|
|
766
994
|
const inputId = id ?? generatedId + "-input";
|
|
767
995
|
const labelId = generatedId + "-label";
|
|
768
996
|
const messageId2 = generatedId + "-message";
|
|
769
997
|
const controlled = value !== void 0;
|
|
770
|
-
const [internalValue, setInternalValue] =
|
|
771
|
-
const textareaRef =
|
|
998
|
+
const [internalValue, setInternalValue] = useState7(defaultValue);
|
|
999
|
+
const textareaRef = useRef4(null);
|
|
772
1000
|
const currentValue = controlled ? value : internalValue;
|
|
773
1001
|
const fieldError = getFieldError(error, errorMessage);
|
|
774
1002
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
@@ -797,7 +1025,7 @@ var TextArea = forwardRef4(
|
|
|
797
1025
|
onValueChange?.("");
|
|
798
1026
|
onClear?.();
|
|
799
1027
|
};
|
|
800
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ jsxs11(
|
|
801
1029
|
"div",
|
|
802
1030
|
{
|
|
803
1031
|
className: [
|
|
@@ -807,7 +1035,7 @@ var TextArea = forwardRef4(
|
|
|
807
1035
|
className
|
|
808
1036
|
].filter(Boolean).join(" "),
|
|
809
1037
|
children: [
|
|
810
|
-
/* @__PURE__ */
|
|
1038
|
+
/* @__PURE__ */ jsx11(
|
|
811
1039
|
FieldLabel,
|
|
812
1040
|
{
|
|
813
1041
|
id: labelId,
|
|
@@ -817,8 +1045,8 @@ var TextArea = forwardRef4(
|
|
|
817
1045
|
isRequired
|
|
818
1046
|
}
|
|
819
1047
|
),
|
|
820
|
-
/* @__PURE__ */
|
|
821
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ jsxs11("span", { className: "fe-text-area__control", children: [
|
|
1049
|
+
/* @__PURE__ */ jsx11(
|
|
822
1050
|
"textarea",
|
|
823
1051
|
{
|
|
824
1052
|
ref: textareaRef,
|
|
@@ -841,24 +1069,24 @@ var TextArea = forwardRef4(
|
|
|
841
1069
|
...props
|
|
842
1070
|
}
|
|
843
1071
|
),
|
|
844
|
-
isRequired && placeholder && !currentValue && /* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
846
|
-
/* @__PURE__ */
|
|
1072
|
+
isRequired && placeholder && !currentValue && /* @__PURE__ */ jsxs11("span", { className: "fe-text-area__placeholder", "aria-hidden": "true", children: [
|
|
1073
|
+
/* @__PURE__ */ jsx11("span", { children: placeholder }),
|
|
1074
|
+
/* @__PURE__ */ jsx11("span", { className: "fe-field__required", children: "*" })
|
|
847
1075
|
] }),
|
|
848
|
-
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */
|
|
1076
|
+
clearable && currentValue && !disabled && !readOnly && /* @__PURE__ */ jsx11(
|
|
849
1077
|
Button,
|
|
850
1078
|
{
|
|
851
1079
|
hierarchy: "tertiary-gray",
|
|
852
1080
|
size: "24",
|
|
853
1081
|
iconOnly: true,
|
|
854
|
-
icon: /* @__PURE__ */
|
|
1082
|
+
icon: /* @__PURE__ */ jsx11(CloseIcon, { size: 14 }),
|
|
855
1083
|
"aria-label": clearLabel,
|
|
856
1084
|
onClick: clear,
|
|
857
1085
|
className: "fe-text-area__clear"
|
|
858
1086
|
}
|
|
859
1087
|
)
|
|
860
1088
|
] }),
|
|
861
|
-
/* @__PURE__ */
|
|
1089
|
+
/* @__PURE__ */ jsx11(
|
|
862
1090
|
FieldMessage,
|
|
863
1091
|
{
|
|
864
1092
|
id: messageId2,
|
|
@@ -876,16 +1104,16 @@ TextArea.displayName = "TextArea";
|
|
|
876
1104
|
|
|
877
1105
|
// packages/form-controls/src/controls/Selection/selection.tsx
|
|
878
1106
|
import {
|
|
879
|
-
forwardRef as
|
|
880
|
-
useEffect as
|
|
881
|
-
useId as
|
|
1107
|
+
forwardRef as forwardRef6,
|
|
1108
|
+
useEffect as useEffect5,
|
|
1109
|
+
useId as useId6,
|
|
882
1110
|
useLayoutEffect as useLayoutEffect2,
|
|
883
|
-
useRef as
|
|
884
|
-
useState as
|
|
1111
|
+
useRef as useRef5,
|
|
1112
|
+
useState as useState8
|
|
885
1113
|
} from "react";
|
|
886
1114
|
import { createPortal as createPortal2 } from "react-dom";
|
|
887
|
-
import { Fragment as Fragment2, jsx as
|
|
888
|
-
var Selection =
|
|
1115
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1116
|
+
var Selection = forwardRef6(
|
|
889
1117
|
function Selection2({
|
|
890
1118
|
className,
|
|
891
1119
|
label,
|
|
@@ -914,7 +1142,7 @@ var Selection = forwardRef5(
|
|
|
914
1142
|
"aria-labelledby": ariaLabelledBy,
|
|
915
1143
|
...props
|
|
916
1144
|
}, ref) {
|
|
917
|
-
const generatedId =
|
|
1145
|
+
const generatedId = useId6();
|
|
918
1146
|
const triggerId = id ?? generatedId + "-trigger";
|
|
919
1147
|
const listboxId = triggerId + "-listbox";
|
|
920
1148
|
const labelId = generatedId + "-label";
|
|
@@ -932,7 +1160,7 @@ var Selection = forwardRef5(
|
|
|
932
1160
|
label ? labelId : void 0
|
|
933
1161
|
);
|
|
934
1162
|
const isControlled = value !== void 0;
|
|
935
|
-
const [internalValue, setInternalValue] =
|
|
1163
|
+
const [internalValue, setInternalValue] = useState8(
|
|
936
1164
|
defaultValue ?? (multiple ? [] : "")
|
|
937
1165
|
);
|
|
938
1166
|
const selectedValue = isControlled ? value : internalValue;
|
|
@@ -940,13 +1168,13 @@ var Selection = forwardRef5(
|
|
|
940
1168
|
const selectedOptions = options.filter(
|
|
941
1169
|
(option) => selectedValues.some((item) => String(item) === String(option.value))
|
|
942
1170
|
);
|
|
943
|
-
const [open, setOpen] =
|
|
944
|
-
const [query, setQuery] =
|
|
945
|
-
const [activeIndex, setActiveIndex] =
|
|
946
|
-
const rootRef =
|
|
947
|
-
const menuRef =
|
|
948
|
-
const [menuPosition, setMenuPosition] =
|
|
949
|
-
|
|
1171
|
+
const [open, setOpen] = useState8(false);
|
|
1172
|
+
const [query, setQuery] = useState8("");
|
|
1173
|
+
const [activeIndex, setActiveIndex] = useState8(0);
|
|
1174
|
+
const rootRef = useRef5(null);
|
|
1175
|
+
const menuRef = useRef5(null);
|
|
1176
|
+
const [menuPosition, setMenuPosition] = useState8(null);
|
|
1177
|
+
useEffect5(() => {
|
|
950
1178
|
const close = (event) => {
|
|
951
1179
|
const target = event.target;
|
|
952
1180
|
if (!rootRef.current?.contains(target) && !menuRef.current?.contains(target))
|
|
@@ -1032,7 +1260,7 @@ var Selection = forwardRef5(
|
|
|
1032
1260
|
}
|
|
1033
1261
|
if (event.key === "Escape") setOpen(false);
|
|
1034
1262
|
};
|
|
1035
|
-
return /* @__PURE__ */
|
|
1263
|
+
return /* @__PURE__ */ jsxs12(
|
|
1036
1264
|
"div",
|
|
1037
1265
|
{
|
|
1038
1266
|
ref,
|
|
@@ -1047,7 +1275,7 @@ var Selection = forwardRef5(
|
|
|
1047
1275
|
].filter(Boolean).join(" "),
|
|
1048
1276
|
...props,
|
|
1049
1277
|
children: [
|
|
1050
|
-
/* @__PURE__ */
|
|
1278
|
+
/* @__PURE__ */ jsx12(
|
|
1051
1279
|
FieldLabel,
|
|
1052
1280
|
{
|
|
1053
1281
|
id: labelId,
|
|
@@ -1057,8 +1285,8 @@ var Selection = forwardRef5(
|
|
|
1057
1285
|
isRequired
|
|
1058
1286
|
}
|
|
1059
1287
|
),
|
|
1060
|
-
/* @__PURE__ */
|
|
1061
|
-
name && selectedValues.map((item) => /* @__PURE__ */
|
|
1288
|
+
/* @__PURE__ */ jsxs12("div", { ref: rootRef, className: "fe-selection__control", children: [
|
|
1289
|
+
name && selectedValues.map((item) => /* @__PURE__ */ jsx12(
|
|
1062
1290
|
"input",
|
|
1063
1291
|
{
|
|
1064
1292
|
type: "hidden",
|
|
@@ -1067,7 +1295,7 @@ var Selection = forwardRef5(
|
|
|
1067
1295
|
},
|
|
1068
1296
|
String(item)
|
|
1069
1297
|
)),
|
|
1070
|
-
/* @__PURE__ */
|
|
1298
|
+
/* @__PURE__ */ jsxs12(
|
|
1071
1299
|
"button",
|
|
1072
1300
|
{
|
|
1073
1301
|
id: triggerId,
|
|
@@ -1085,7 +1313,7 @@ var Selection = forwardRef5(
|
|
|
1085
1313
|
onClick: () => setOpen((current) => !current),
|
|
1086
1314
|
onKeyDown: onTriggerKeyDown,
|
|
1087
1315
|
children: [
|
|
1088
|
-
/* @__PURE__ */
|
|
1316
|
+
/* @__PURE__ */ jsx12(
|
|
1089
1317
|
"span",
|
|
1090
1318
|
{
|
|
1091
1319
|
className: [
|
|
@@ -1093,30 +1321,30 @@ var Selection = forwardRef5(
|
|
|
1093
1321
|
!selectedOptions.length && "is-placeholder",
|
|
1094
1322
|
tag && selectedOptions.length > 1 && "is-tags"
|
|
1095
1323
|
].filter(Boolean).join(" "),
|
|
1096
|
-
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */
|
|
1324
|
+
children: displayLabel ? tag && multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsxs12(
|
|
1097
1325
|
"span",
|
|
1098
1326
|
{
|
|
1099
1327
|
className: "fe-selection__tag",
|
|
1100
1328
|
children: [
|
|
1101
1329
|
option.label,
|
|
1102
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": "true", children: "\xD7" })
|
|
1103
1331
|
]
|
|
1104
1332
|
},
|
|
1105
1333
|
String(option.value)
|
|
1106
|
-
)) : displayLabel.map((item, index) => /* @__PURE__ */
|
|
1334
|
+
)) : displayLabel.map((item, index) => /* @__PURE__ */ jsxs12("span", { children: [
|
|
1107
1335
|
item,
|
|
1108
1336
|
index < displayLabel.length - 1 ? ", " : ""
|
|
1109
|
-
] }, index)) : /* @__PURE__ */
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
isRequired && /* @__PURE__ */
|
|
1337
|
+
] }, index)) : /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
1338
|
+
/* @__PURE__ */ jsx12("span", { children: placeholder }),
|
|
1339
|
+
isRequired && /* @__PURE__ */ jsx12("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1112
1340
|
] })
|
|
1113
1341
|
}
|
|
1114
1342
|
),
|
|
1115
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx12("span", { className: "fe-selection__actions", children: /* @__PURE__ */ jsx12("span", { className: "fe-selection__chevron", "aria-hidden": "true" }) })
|
|
1116
1344
|
]
|
|
1117
1345
|
}
|
|
1118
1346
|
),
|
|
1119
|
-
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */
|
|
1347
|
+
clearable && selectedOptions.length > 0 && !disabled && /* @__PURE__ */ jsx12(
|
|
1120
1348
|
"button",
|
|
1121
1349
|
{
|
|
1122
1350
|
type: "button",
|
|
@@ -1126,7 +1354,7 @@ var Selection = forwardRef5(
|
|
|
1126
1354
|
}
|
|
1127
1355
|
),
|
|
1128
1356
|
open && menuPosition && createPortal2(
|
|
1129
|
-
/* @__PURE__ */
|
|
1357
|
+
/* @__PURE__ */ jsxs12(
|
|
1130
1358
|
"div",
|
|
1131
1359
|
{
|
|
1132
1360
|
ref: menuRef,
|
|
@@ -1141,9 +1369,9 @@ var Selection = forwardRef5(
|
|
|
1141
1369
|
role: "listbox",
|
|
1142
1370
|
"aria-multiselectable": multiple || void 0,
|
|
1143
1371
|
children: [
|
|
1144
|
-
searchable && /* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
/* @__PURE__ */
|
|
1372
|
+
searchable && /* @__PURE__ */ jsxs12("div", { className: "fe-selection__search", children: [
|
|
1373
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": "true", children: "\u2315" }),
|
|
1374
|
+
/* @__PURE__ */ jsx12(
|
|
1147
1375
|
"input",
|
|
1148
1376
|
{
|
|
1149
1377
|
autoFocus: true,
|
|
@@ -1157,11 +1385,11 @@ var Selection = forwardRef5(
|
|
|
1157
1385
|
}
|
|
1158
1386
|
)
|
|
1159
1387
|
] }),
|
|
1160
|
-
/* @__PURE__ */
|
|
1388
|
+
/* @__PURE__ */ jsx12("div", { className: "fe-selection__options", children: filteredOptions.length ? filteredOptions.map((option, index) => {
|
|
1161
1389
|
const isSelected = selectedValues.some(
|
|
1162
1390
|
(item) => String(item) === String(option.value)
|
|
1163
1391
|
);
|
|
1164
|
-
return /* @__PURE__ */
|
|
1392
|
+
return /* @__PURE__ */ jsxs12(
|
|
1165
1393
|
"button",
|
|
1166
1394
|
{
|
|
1167
1395
|
type: "button",
|
|
@@ -1175,8 +1403,8 @@ var Selection = forwardRef5(
|
|
|
1175
1403
|
onMouseMove: () => setActiveIndex(index),
|
|
1176
1404
|
onClick: () => choose(option),
|
|
1177
1405
|
children: [
|
|
1178
|
-
/* @__PURE__ */
|
|
1179
|
-
isSelected && /* @__PURE__ */
|
|
1406
|
+
/* @__PURE__ */ jsx12("span", { children: option.label }),
|
|
1407
|
+
isSelected && /* @__PURE__ */ jsx12(
|
|
1180
1408
|
"span",
|
|
1181
1409
|
{
|
|
1182
1410
|
className: "fe-selection__check",
|
|
@@ -1188,14 +1416,14 @@ var Selection = forwardRef5(
|
|
|
1188
1416
|
},
|
|
1189
1417
|
String(option.value)
|
|
1190
1418
|
);
|
|
1191
|
-
}) : /* @__PURE__ */
|
|
1419
|
+
}) : /* @__PURE__ */ jsx12("p", { className: "fe-selection__empty", children: "No matching options" }) })
|
|
1192
1420
|
]
|
|
1193
1421
|
}
|
|
1194
1422
|
),
|
|
1195
1423
|
document.body
|
|
1196
1424
|
)
|
|
1197
1425
|
] }),
|
|
1198
|
-
/* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ jsx12(
|
|
1199
1427
|
FieldMessage,
|
|
1200
1428
|
{
|
|
1201
1429
|
id: messageId2,
|
|
@@ -1213,13 +1441,13 @@ Selection.displayName = "Selection";
|
|
|
1213
1441
|
|
|
1214
1442
|
// packages/form-controls/src/controls/NumberInput/number-input.tsx
|
|
1215
1443
|
import {
|
|
1216
|
-
forwardRef as
|
|
1217
|
-
useEffect as
|
|
1218
|
-
useId as
|
|
1219
|
-
useRef as
|
|
1220
|
-
useState as
|
|
1444
|
+
forwardRef as forwardRef7,
|
|
1445
|
+
useEffect as useEffect6,
|
|
1446
|
+
useId as useId7,
|
|
1447
|
+
useRef as useRef6,
|
|
1448
|
+
useState as useState9
|
|
1221
1449
|
} from "react";
|
|
1222
|
-
import { jsx as
|
|
1450
|
+
import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1223
1451
|
function formatNumber(value, decimals = 2, thousandSeparator = ",", decimalSeparator = ".") {
|
|
1224
1452
|
return new Intl.NumberFormat("en-US", {
|
|
1225
1453
|
minimumFractionDigits: 0,
|
|
@@ -1276,7 +1504,7 @@ function normalizeNumberInput(raw, options) {
|
|
|
1276
1504
|
value
|
|
1277
1505
|
};
|
|
1278
1506
|
}
|
|
1279
|
-
var NumberInput =
|
|
1507
|
+
var NumberInput = forwardRef7(
|
|
1280
1508
|
function NumberInput2({
|
|
1281
1509
|
value,
|
|
1282
1510
|
defaultValue = null,
|
|
@@ -1313,14 +1541,14 @@ var NumberInput = forwardRef6(
|
|
|
1313
1541
|
onKeyDown,
|
|
1314
1542
|
...props
|
|
1315
1543
|
}, ref) {
|
|
1316
|
-
const inputRef =
|
|
1317
|
-
const generatedId =
|
|
1544
|
+
const inputRef = useRef6(null);
|
|
1545
|
+
const generatedId = useId7();
|
|
1318
1546
|
const messageId2 = generatedId + "-message";
|
|
1319
1547
|
const isControlled = value !== void 0;
|
|
1320
|
-
const [internalValue, setInternalValue] =
|
|
1321
|
-
const [focused, setFocused] =
|
|
1548
|
+
const [internalValue, setInternalValue] = useState9(defaultValue);
|
|
1549
|
+
const [focused, setFocused] = useState9(false);
|
|
1322
1550
|
const actualValue = isControlled ? value ?? null : internalValue;
|
|
1323
|
-
const [text, setText] =
|
|
1551
|
+
const [text, setText] = useState9(
|
|
1324
1552
|
actualValue === null ? "" : formatNumber(
|
|
1325
1553
|
actualValue,
|
|
1326
1554
|
decimals,
|
|
@@ -1343,7 +1571,7 @@ var NumberInput = forwardRef6(
|
|
|
1343
1571
|
);
|
|
1344
1572
|
const resolvedPrefix = prefix ?? Prefix;
|
|
1345
1573
|
const resolvedSuffix = suffix ?? Suffix;
|
|
1346
|
-
|
|
1574
|
+
useEffect6(() => {
|
|
1347
1575
|
if (!focused)
|
|
1348
1576
|
setText(
|
|
1349
1577
|
actualValue === null ? "" : formatNumber(
|
|
@@ -1397,7 +1625,7 @@ var NumberInput = forwardRef6(
|
|
|
1397
1625
|
const stepIsUsable = Number.isFinite(step) && step > 0;
|
|
1398
1626
|
const disableIncrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || max !== void 0 && actualValue !== null && actualValue >= max;
|
|
1399
1627
|
const disableDecrement = Boolean(props.disabled || props.readOnly) || !stepIsUsable || min !== void 0 && actualValue !== null && actualValue <= min;
|
|
1400
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ jsxs13(
|
|
1401
1629
|
"div",
|
|
1402
1630
|
{
|
|
1403
1631
|
className: [
|
|
@@ -1406,7 +1634,7 @@ var NumberInput = forwardRef6(
|
|
|
1406
1634
|
className
|
|
1407
1635
|
].filter(Boolean).join(" "),
|
|
1408
1636
|
children: [
|
|
1409
|
-
/* @__PURE__ */
|
|
1637
|
+
/* @__PURE__ */ jsx13(
|
|
1410
1638
|
FieldLabel,
|
|
1411
1639
|
{
|
|
1412
1640
|
id: labelId,
|
|
@@ -1416,10 +1644,10 @@ var NumberInput = forwardRef6(
|
|
|
1416
1644
|
isRequired
|
|
1417
1645
|
}
|
|
1418
1646
|
),
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
resolvedPrefix && /* @__PURE__ */
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1647
|
+
/* @__PURE__ */ jsxs13("span", { className: "fe-number-input__control", children: [
|
|
1648
|
+
resolvedPrefix && /* @__PURE__ */ jsx13("span", { className: "fe-number-input__prefix", children: resolvedPrefix }),
|
|
1649
|
+
/* @__PURE__ */ jsxs13("span", { className: "fe-number-input__input-wrap", children: [
|
|
1650
|
+
/* @__PURE__ */ jsx13(
|
|
1423
1651
|
"input",
|
|
1424
1652
|
{
|
|
1425
1653
|
ref: (node) => {
|
|
@@ -1455,41 +1683,41 @@ var NumberInput = forwardRef6(
|
|
|
1455
1683
|
"aria-describedby": describedBy
|
|
1456
1684
|
}
|
|
1457
1685
|
),
|
|
1458
|
-
isRequired && placeholder && !text && /* @__PURE__ */
|
|
1686
|
+
isRequired && placeholder && !text && /* @__PURE__ */ jsxs13(
|
|
1459
1687
|
"span",
|
|
1460
1688
|
{
|
|
1461
1689
|
className: "fe-number-input__placeholder",
|
|
1462
1690
|
"aria-hidden": "true",
|
|
1463
1691
|
children: [
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1692
|
+
/* @__PURE__ */ jsx13("span", { children: placeholder }),
|
|
1693
|
+
/* @__PURE__ */ jsx13("span", { className: "fe-field__required", children: "*" })
|
|
1466
1694
|
]
|
|
1467
1695
|
}
|
|
1468
1696
|
)
|
|
1469
1697
|
] }),
|
|
1470
|
-
resolvedSuffix && /* @__PURE__ */
|
|
1698
|
+
resolvedSuffix && /* @__PURE__ */ jsx13("span", { className: "fe-number-input__suffix", children: resolvedSuffix }),
|
|
1471
1699
|
endAdornment,
|
|
1472
|
-
showStepper && /* @__PURE__ */
|
|
1473
|
-
/* @__PURE__ */
|
|
1700
|
+
showStepper && /* @__PURE__ */ jsxs13("span", { className: "fe-number-input__stepper", children: [
|
|
1701
|
+
/* @__PURE__ */ jsx13(
|
|
1474
1702
|
Button,
|
|
1475
1703
|
{
|
|
1476
1704
|
hierarchy: "tertiary-gray",
|
|
1477
1705
|
size: "24",
|
|
1478
1706
|
iconOnly: true,
|
|
1479
|
-
icon: /* @__PURE__ */
|
|
1707
|
+
icon: /* @__PURE__ */ jsx13(ChevronUpIcon, { size: 12 }),
|
|
1480
1708
|
"aria-label": incrementLabel,
|
|
1481
1709
|
disabled: disableIncrement,
|
|
1482
1710
|
onMouseDown: (event) => event.preventDefault(),
|
|
1483
1711
|
onClick: () => adjustValue(1)
|
|
1484
1712
|
}
|
|
1485
1713
|
),
|
|
1486
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx13(
|
|
1487
1715
|
Button,
|
|
1488
1716
|
{
|
|
1489
1717
|
hierarchy: "tertiary-gray",
|
|
1490
1718
|
size: "24",
|
|
1491
1719
|
iconOnly: true,
|
|
1492
|
-
icon: /* @__PURE__ */
|
|
1720
|
+
icon: /* @__PURE__ */ jsx13(ChevronDownIcon, { size: 12 }),
|
|
1493
1721
|
"aria-label": decrementLabel,
|
|
1494
1722
|
disabled: disableDecrement,
|
|
1495
1723
|
onMouseDown: (event) => event.preventDefault(),
|
|
@@ -1498,7 +1726,7 @@ var NumberInput = forwardRef6(
|
|
|
1498
1726
|
)
|
|
1499
1727
|
] })
|
|
1500
1728
|
] }),
|
|
1501
|
-
/* @__PURE__ */
|
|
1729
|
+
/* @__PURE__ */ jsx13(
|
|
1502
1730
|
FieldMessage,
|
|
1503
1731
|
{
|
|
1504
1732
|
id: messageId2,
|
|
@@ -1515,8 +1743,8 @@ var NumberInput = forwardRef6(
|
|
|
1515
1743
|
NumberInput.displayName = "NumberInput";
|
|
1516
1744
|
|
|
1517
1745
|
// packages/form-controls/src/controls/CurrencyInput/currency-input.tsx
|
|
1518
|
-
import { useState as
|
|
1519
|
-
import { jsx as
|
|
1746
|
+
import { useState as useState10 } from "react";
|
|
1747
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1520
1748
|
function CurrencyInput({
|
|
1521
1749
|
suffix = "VND",
|
|
1522
1750
|
currencies,
|
|
@@ -1527,13 +1755,13 @@ function CurrencyInput({
|
|
|
1527
1755
|
disabled,
|
|
1528
1756
|
...props
|
|
1529
1757
|
}) {
|
|
1530
|
-
const [internalCurrency, setInternalCurrency] =
|
|
1758
|
+
const [internalCurrency, setInternalCurrency] = useState10(
|
|
1531
1759
|
defaultCurrency ?? currencies?.[0]?.code ?? ""
|
|
1532
1760
|
);
|
|
1533
1761
|
const selectedCurrency = currency ?? internalCurrency;
|
|
1534
1762
|
const current = currencies?.find((item) => item.code === selectedCurrency);
|
|
1535
1763
|
const currencySuffix = current?.suffix ?? current?.code ?? suffix;
|
|
1536
|
-
const endAdornment = currencies?.length ? /* @__PURE__ */
|
|
1764
|
+
const endAdornment = currencies?.length ? /* @__PURE__ */ jsx14(
|
|
1537
1765
|
Selection,
|
|
1538
1766
|
{
|
|
1539
1767
|
className: "fe-currency-input__currency",
|
|
@@ -1552,8 +1780,8 @@ function CurrencyInput({
|
|
|
1552
1780
|
onCurrencyChange?.(next);
|
|
1553
1781
|
}
|
|
1554
1782
|
}
|
|
1555
|
-
) : /* @__PURE__ */
|
|
1556
|
-
return /* @__PURE__ */
|
|
1783
|
+
) : /* @__PURE__ */ jsx14("span", { className: "fe-currency-input__suffix", children: currencySuffix });
|
|
1784
|
+
return /* @__PURE__ */ jsx14(
|
|
1557
1785
|
NumberInput,
|
|
1558
1786
|
{
|
|
1559
1787
|
...props,
|
|
@@ -1565,8 +1793,8 @@ function CurrencyInput({
|
|
|
1565
1793
|
}
|
|
1566
1794
|
|
|
1567
1795
|
// packages/form-controls/src/controls/DateTimePicker/date-time-picker.tsx
|
|
1568
|
-
import { useEffect as
|
|
1569
|
-
import { jsx as
|
|
1796
|
+
import { useEffect as useEffect7, useId as useId8, useRef as useRef7, useState as useState11 } from "react";
|
|
1797
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1570
1798
|
var pad = (value) => String(value).padStart(2, "0");
|
|
1571
1799
|
function formatDate(date, format) {
|
|
1572
1800
|
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()));
|
|
@@ -1602,7 +1830,7 @@ function DateTimePicker(props) {
|
|
|
1602
1830
|
"aria-describedby": ariaDescribedBy,
|
|
1603
1831
|
"aria-labelledby": ariaLabelledBy
|
|
1604
1832
|
} = props;
|
|
1605
|
-
const generatedId =
|
|
1833
|
+
const generatedId = useId8();
|
|
1606
1834
|
const triggerId = id ?? generatedId + "-trigger";
|
|
1607
1835
|
const labelId = generatedId + "-label";
|
|
1608
1836
|
const messageId2 = generatedId + "-message";
|
|
@@ -1620,28 +1848,28 @@ function DateTimePicker(props) {
|
|
|
1620
1848
|
);
|
|
1621
1849
|
const isRange = mode === "range";
|
|
1622
1850
|
const controlled = props.value !== void 0;
|
|
1623
|
-
const [singleInternal, setSingleInternal] =
|
|
1851
|
+
const [singleInternal, setSingleInternal] = useState11(
|
|
1624
1852
|
(!isRange ? props.defaultValue : null) ?? null
|
|
1625
1853
|
);
|
|
1626
|
-
const [rangeInternal, setRangeInternal] =
|
|
1854
|
+
const [rangeInternal, setRangeInternal] = useState11(
|
|
1627
1855
|
(isRange ? props.defaultValue : void 0) ?? [null, null]
|
|
1628
1856
|
);
|
|
1629
1857
|
const singleValue = !isRange ? props.value ?? singleInternal : null;
|
|
1630
1858
|
const rangeValue = isRange ? props.value ?? rangeInternal : [null, null];
|
|
1631
|
-
const [open, setOpen] =
|
|
1632
|
-
const [month, setMonth] =
|
|
1859
|
+
const [open, setOpen] = useState11(false);
|
|
1860
|
+
const [month, setMonth] = useState11(
|
|
1633
1861
|
() => new Date((isRange ? rangeValue[0] : singleValue) ?? /* @__PURE__ */ new Date())
|
|
1634
1862
|
);
|
|
1635
|
-
const [editingEnd, setEditingEnd] =
|
|
1636
|
-
const rootRef =
|
|
1637
|
-
|
|
1863
|
+
const [editingEnd, setEditingEnd] = useState11(false);
|
|
1864
|
+
const rootRef = useRef7(null);
|
|
1865
|
+
useEffect7(() => {
|
|
1638
1866
|
const onPointerDown = (event) => {
|
|
1639
1867
|
if (!rootRef.current?.contains(event.target)) setOpen(false);
|
|
1640
1868
|
};
|
|
1641
1869
|
document.addEventListener("mousedown", onPointerDown);
|
|
1642
1870
|
return () => document.removeEventListener("mousedown", onPointerDown);
|
|
1643
1871
|
}, []);
|
|
1644
|
-
|
|
1872
|
+
useEffect7(() => {
|
|
1645
1873
|
if (disabled) setOpen(false);
|
|
1646
1874
|
}, [disabled]);
|
|
1647
1875
|
const setSingle = (next) => {
|
|
@@ -1697,7 +1925,7 @@ function DateTimePicker(props) {
|
|
|
1697
1925
|
setRange(editingEnd ? [rangeValue[0], next] : [next, rangeValue[1]]);
|
|
1698
1926
|
else setSingle(next);
|
|
1699
1927
|
};
|
|
1700
|
-
return /* @__PURE__ */
|
|
1928
|
+
return /* @__PURE__ */ jsxs14(
|
|
1701
1929
|
"div",
|
|
1702
1930
|
{
|
|
1703
1931
|
ref: rootRef,
|
|
@@ -1707,7 +1935,7 @@ function DateTimePicker(props) {
|
|
|
1707
1935
|
className
|
|
1708
1936
|
].filter(Boolean).join(" "),
|
|
1709
1937
|
children: [
|
|
1710
|
-
/* @__PURE__ */
|
|
1938
|
+
/* @__PURE__ */ jsx15(
|
|
1711
1939
|
FieldLabel,
|
|
1712
1940
|
{
|
|
1713
1941
|
id: labelId,
|
|
@@ -1717,7 +1945,7 @@ function DateTimePicker(props) {
|
|
|
1717
1945
|
isRequired
|
|
1718
1946
|
}
|
|
1719
1947
|
),
|
|
1720
|
-
/* @__PURE__ */
|
|
1948
|
+
/* @__PURE__ */ jsxs14(
|
|
1721
1949
|
"button",
|
|
1722
1950
|
{
|
|
1723
1951
|
id: triggerId,
|
|
@@ -1731,29 +1959,29 @@ function DateTimePicker(props) {
|
|
|
1731
1959
|
"aria-expanded": open,
|
|
1732
1960
|
onClick: () => setOpen((current) => !current),
|
|
1733
1961
|
children: [
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: "\u25F7" }),
|
|
1963
|
+
/* @__PURE__ */ jsxs14(
|
|
1736
1964
|
"span",
|
|
1737
1965
|
{
|
|
1738
1966
|
className: !shownValue && placeholder ? "fe-datetime-picker__value is-placeholder" : "fe-datetime-picker__value",
|
|
1739
1967
|
children: [
|
|
1740
1968
|
shownValue || placeholder || (isRange ? "Select date range" : "Select date and time"),
|
|
1741
|
-
isRequired && placeholder && !shownValue && /* @__PURE__ */
|
|
1969
|
+
isRequired && placeholder && !shownValue && /* @__PURE__ */ jsx15("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1742
1970
|
]
|
|
1743
1971
|
}
|
|
1744
1972
|
)
|
|
1745
1973
|
]
|
|
1746
1974
|
}
|
|
1747
1975
|
),
|
|
1748
|
-
open && /* @__PURE__ */
|
|
1976
|
+
open && /* @__PURE__ */ jsxs14(
|
|
1749
1977
|
"div",
|
|
1750
1978
|
{
|
|
1751
1979
|
className: "fe-datetime-picker__popper",
|
|
1752
1980
|
role: "dialog",
|
|
1753
1981
|
"aria-label": "Date and time picker",
|
|
1754
1982
|
children: [
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsxs14("div", { className: "fe-datetime-picker__month", children: [
|
|
1984
|
+
/* @__PURE__ */ jsx15(
|
|
1757
1985
|
"button",
|
|
1758
1986
|
{
|
|
1759
1987
|
type: "button",
|
|
@@ -1764,11 +1992,11 @@ function DateTimePicker(props) {
|
|
|
1764
1992
|
children: "\u2039"
|
|
1765
1993
|
}
|
|
1766
1994
|
),
|
|
1767
|
-
/* @__PURE__ */
|
|
1995
|
+
/* @__PURE__ */ jsx15("strong", { children: month.toLocaleDateString(locale, {
|
|
1768
1996
|
month: "long",
|
|
1769
1997
|
year: "numeric"
|
|
1770
1998
|
}) }),
|
|
1771
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ jsx15(
|
|
1772
2000
|
"button",
|
|
1773
2001
|
{
|
|
1774
2002
|
type: "button",
|
|
@@ -1780,12 +2008,12 @@ function DateTimePicker(props) {
|
|
|
1780
2008
|
}
|
|
1781
2009
|
)
|
|
1782
2010
|
] }),
|
|
1783
|
-
/* @__PURE__ */
|
|
1784
|
-
/* @__PURE__ */
|
|
2011
|
+
/* @__PURE__ */ jsx15("div", { className: "fe-datetime-picker__weekdays", children: ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((day) => /* @__PURE__ */ jsx15("span", { children: day }, day)) }),
|
|
2012
|
+
/* @__PURE__ */ jsx15("div", { className: "fe-datetime-picker__days", children: days.map((day) => {
|
|
1785
2013
|
const inMonth = day.getMonth() === month.getMonth();
|
|
1786
2014
|
const selected = isRange ? sameDay(day, rangeValue[0]) || sameDay(day, rangeValue[1]) : sameDay(day, singleValue);
|
|
1787
2015
|
const inRange = isRange && rangeValue[0] && rangeValue[1] && day > startOfDay(rangeValue[0]) && day < startOfDay(rangeValue[1]);
|
|
1788
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ jsx15(
|
|
1789
2017
|
"button",
|
|
1790
2018
|
{
|
|
1791
2019
|
type: "button",
|
|
@@ -1800,8 +2028,8 @@ function DateTimePicker(props) {
|
|
|
1800
2028
|
day.toISOString()
|
|
1801
2029
|
);
|
|
1802
2030
|
}) }),
|
|
1803
|
-
isRange && /* @__PURE__ */
|
|
1804
|
-
/* @__PURE__ */
|
|
2031
|
+
isRange && /* @__PURE__ */ jsxs14("div", { className: "fe-datetime-picker__range-tabs", children: [
|
|
2032
|
+
/* @__PURE__ */ jsx15(
|
|
1805
2033
|
"button",
|
|
1806
2034
|
{
|
|
1807
2035
|
type: "button",
|
|
@@ -1810,7 +2038,7 @@ function DateTimePicker(props) {
|
|
|
1810
2038
|
children: "Start"
|
|
1811
2039
|
}
|
|
1812
2040
|
),
|
|
1813
|
-
/* @__PURE__ */
|
|
2041
|
+
/* @__PURE__ */ jsx15(
|
|
1814
2042
|
"button",
|
|
1815
2043
|
{
|
|
1816
2044
|
type: "button",
|
|
@@ -1820,9 +2048,9 @@ function DateTimePicker(props) {
|
|
|
1820
2048
|
}
|
|
1821
2049
|
)
|
|
1822
2050
|
] }),
|
|
1823
|
-
/* @__PURE__ */
|
|
2051
|
+
/* @__PURE__ */ jsxs14("label", { className: "fe-datetime-picker__time", children: [
|
|
1824
2052
|
"Time",
|
|
1825
|
-
/* @__PURE__ */
|
|
2053
|
+
/* @__PURE__ */ jsx15(
|
|
1826
2054
|
"input",
|
|
1827
2055
|
{
|
|
1828
2056
|
type: "time",
|
|
@@ -1835,7 +2063,7 @@ function DateTimePicker(props) {
|
|
|
1835
2063
|
]
|
|
1836
2064
|
}
|
|
1837
2065
|
),
|
|
1838
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ jsx15(
|
|
1839
2067
|
FieldMessage,
|
|
1840
2068
|
{
|
|
1841
2069
|
id: messageId2,
|
|
@@ -1850,9 +2078,9 @@ function DateTimePicker(props) {
|
|
|
1850
2078
|
}
|
|
1851
2079
|
|
|
1852
2080
|
// packages/form-controls/src/controls/Checkbox/checkbox.tsx
|
|
1853
|
-
import { forwardRef as
|
|
1854
|
-
import { jsx as
|
|
1855
|
-
var Checkbox =
|
|
2081
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
2082
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2083
|
+
var Checkbox = forwardRef8(
|
|
1856
2084
|
function Checkbox2({
|
|
1857
2085
|
label,
|
|
1858
2086
|
labelPosition = "right",
|
|
@@ -1868,10 +2096,10 @@ var Checkbox = forwardRef7(
|
|
|
1868
2096
|
disabled && "fe-checkbox--disabled",
|
|
1869
2097
|
className
|
|
1870
2098
|
].filter(Boolean).join(" ");
|
|
1871
|
-
return /* @__PURE__ */
|
|
1872
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
1873
|
-
/* @__PURE__ */
|
|
1874
|
-
/* @__PURE__ */
|
|
2099
|
+
return /* @__PURE__ */ jsxs15("label", { className: classes, style, children: [
|
|
2100
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsx16("span", { className: "fe-checkbox__label", children: label }),
|
|
2101
|
+
/* @__PURE__ */ jsxs15("span", { className: "fe-checkbox__content", children: [
|
|
2102
|
+
/* @__PURE__ */ jsx16(
|
|
1875
2103
|
"input",
|
|
1876
2104
|
{
|
|
1877
2105
|
ref,
|
|
@@ -1882,8 +2110,8 @@ var Checkbox = forwardRef7(
|
|
|
1882
2110
|
...props
|
|
1883
2111
|
}
|
|
1884
2112
|
),
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
2113
|
+
/* @__PURE__ */ jsx16("span", { className: "fe-checkbox__control", "aria-hidden": "true" }),
|
|
2114
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx16("span", { className: "fe-checkbox__label", children: label })
|
|
1887
2115
|
] })
|
|
1888
2116
|
] });
|
|
1889
2117
|
}
|
|
@@ -1891,9 +2119,9 @@ var Checkbox = forwardRef7(
|
|
|
1891
2119
|
Checkbox.displayName = "Checkbox";
|
|
1892
2120
|
|
|
1893
2121
|
// packages/form-controls/src/controls/RadioButton/radio-button.tsx
|
|
1894
|
-
import { forwardRef as
|
|
1895
|
-
import { jsx as
|
|
1896
|
-
var RadioButton =
|
|
2122
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
2123
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2124
|
+
var RadioButton = forwardRef9(
|
|
1897
2125
|
function RadioButton2({
|
|
1898
2126
|
label,
|
|
1899
2127
|
labelPosition = "right",
|
|
@@ -1909,10 +2137,10 @@ var RadioButton = forwardRef8(
|
|
|
1909
2137
|
disabled && "fe-radio-button--disabled",
|
|
1910
2138
|
className
|
|
1911
2139
|
].filter(Boolean).join(" ");
|
|
1912
|
-
return /* @__PURE__ */
|
|
1913
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */
|
|
1915
|
-
/* @__PURE__ */
|
|
2140
|
+
return /* @__PURE__ */ jsxs16("label", { className: classes, style, children: [
|
|
2141
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsx17("span", { className: "fe-radio-button__label", children: label }),
|
|
2142
|
+
/* @__PURE__ */ jsxs16("span", { className: "fe-radio-button__content", children: [
|
|
2143
|
+
/* @__PURE__ */ jsx17(
|
|
1916
2144
|
"input",
|
|
1917
2145
|
{
|
|
1918
2146
|
ref,
|
|
@@ -1923,8 +2151,8 @@ var RadioButton = forwardRef8(
|
|
|
1923
2151
|
...props
|
|
1924
2152
|
}
|
|
1925
2153
|
),
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsx17("span", { className: "fe-radio-button__control", "aria-hidden": "true" }),
|
|
2155
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsx17("span", { className: "fe-radio-button__label", children: label })
|
|
1928
2156
|
] })
|
|
1929
2157
|
] });
|
|
1930
2158
|
}
|
|
@@ -1932,9 +2160,9 @@ var RadioButton = forwardRef8(
|
|
|
1932
2160
|
RadioButton.displayName = "RadioButton";
|
|
1933
2161
|
|
|
1934
2162
|
// packages/form-controls/src/controls/RadioGroup/radio-group.tsx
|
|
1935
|
-
import { forwardRef as
|
|
1936
|
-
import { jsx as
|
|
1937
|
-
var RadioGroup =
|
|
2163
|
+
import { forwardRef as forwardRef10, useId as useId9 } from "react";
|
|
2164
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2165
|
+
var RadioGroup = forwardRef10(
|
|
1938
2166
|
function RadioGroup2({
|
|
1939
2167
|
label,
|
|
1940
2168
|
labelPosition = "top",
|
|
@@ -1952,7 +2180,7 @@ var RadioGroup = forwardRef9(
|
|
|
1952
2180
|
"aria-labelledby": ariaLabelledBy,
|
|
1953
2181
|
...props
|
|
1954
2182
|
}, ref) {
|
|
1955
|
-
const generatedId =
|
|
2183
|
+
const generatedId = useId9();
|
|
1956
2184
|
const groupName = name ?? `fe-radio-group-${generatedId}`;
|
|
1957
2185
|
const labelId = `${id ?? generatedId}-label`;
|
|
1958
2186
|
const isControlled = value !== void 0;
|
|
@@ -1966,12 +2194,12 @@ var RadioGroup = forwardRef9(
|
|
|
1966
2194
|
const handleChange = (option, event) => {
|
|
1967
2195
|
if (event.target.checked) onChange?.(option.value, option, event);
|
|
1968
2196
|
};
|
|
1969
|
-
return /* @__PURE__ */
|
|
1970
|
-
label && labelPosition === "top" && /* @__PURE__ */
|
|
2197
|
+
return /* @__PURE__ */ jsxs17("div", { ref, className: classes, ...props, children: [
|
|
2198
|
+
label && labelPosition === "top" && /* @__PURE__ */ jsxs17("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
1971
2199
|
label,
|
|
1972
|
-
isRequired && /* @__PURE__ */
|
|
2200
|
+
isRequired && /* @__PURE__ */ jsx18("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
1973
2201
|
] }),
|
|
1974
|
-
/* @__PURE__ */
|
|
2202
|
+
/* @__PURE__ */ jsx18(
|
|
1975
2203
|
"div",
|
|
1976
2204
|
{
|
|
1977
2205
|
id,
|
|
@@ -1983,7 +2211,7 @@ var RadioGroup = forwardRef9(
|
|
|
1983
2211
|
children: options.map((option) => {
|
|
1984
2212
|
const optionDisabled = disabled || option.disabled;
|
|
1985
2213
|
const optionValue = String(option.value);
|
|
1986
|
-
return /* @__PURE__ */
|
|
2214
|
+
return /* @__PURE__ */ jsx18(
|
|
1987
2215
|
RadioButton,
|
|
1988
2216
|
{
|
|
1989
2217
|
name: groupName,
|
|
@@ -2000,9 +2228,9 @@ var RadioGroup = forwardRef9(
|
|
|
2000
2228
|
})
|
|
2001
2229
|
}
|
|
2002
2230
|
),
|
|
2003
|
-
label && labelPosition === "right" && /* @__PURE__ */
|
|
2231
|
+
label && labelPosition === "right" && /* @__PURE__ */ jsxs17("span", { id: labelId, className: "fe-radio-group__label", children: [
|
|
2004
2232
|
label,
|
|
2005
|
-
isRequired && /* @__PURE__ */
|
|
2233
|
+
isRequired && /* @__PURE__ */ jsx18("span", { className: "fe-radio-group__required", "aria-hidden": "true", children: "*" })
|
|
2006
2234
|
] })
|
|
2007
2235
|
] });
|
|
2008
2236
|
}
|
|
@@ -2010,29 +2238,29 @@ var RadioGroup = forwardRef9(
|
|
|
2010
2238
|
RadioGroup.displayName = "RadioGroup";
|
|
2011
2239
|
|
|
2012
2240
|
// packages/expandable-section/src/index.tsx
|
|
2013
|
-
import { useId as
|
|
2014
|
-
import { jsx as
|
|
2241
|
+
import { useId as useId10, useState as useState12 } from "react";
|
|
2242
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2015
2243
|
function ExpandableSection({ title, children, expanded, defaultExpanded = false, onExpandedChange, disabled, className, ...props }) {
|
|
2016
|
-
const [internalExpanded, setInternalExpanded] =
|
|
2244
|
+
const [internalExpanded, setInternalExpanded] = useState12(defaultExpanded);
|
|
2017
2245
|
const isExpanded = expanded ?? internalExpanded;
|
|
2018
|
-
const id =
|
|
2246
|
+
const id = useId10();
|
|
2019
2247
|
const toggle = () => {
|
|
2020
2248
|
if (disabled) return;
|
|
2021
2249
|
const next = !isExpanded;
|
|
2022
2250
|
if (expanded === void 0) setInternalExpanded(next);
|
|
2023
2251
|
onExpandedChange?.(next);
|
|
2024
2252
|
};
|
|
2025
|
-
return /* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2253
|
+
return /* @__PURE__ */ jsxs18("section", { className: ["fe-expandable-section", isExpanded && "fe-expandable-section--expanded", disabled && "fe-expandable-section--disabled", className].filter(Boolean).join(" "), ...props, children: [
|
|
2254
|
+
/* @__PURE__ */ jsxs18("button", { className: "fe-expandable-section__trigger", type: "button", "aria-expanded": isExpanded, "aria-controls": id, disabled, onClick: toggle, children: [
|
|
2255
|
+
/* @__PURE__ */ jsx19("span", { children: title }),
|
|
2256
|
+
/* @__PURE__ */ jsx19("span", { className: "fe-expandable-section__chevron", "aria-hidden": "true" })
|
|
2029
2257
|
] }),
|
|
2030
|
-
/* @__PURE__ */
|
|
2258
|
+
/* @__PURE__ */ jsx19("div", { id, className: "fe-expandable-section__content", "aria-hidden": !isExpanded, children: /* @__PURE__ */ jsx19("div", { className: "fe-expandable-section__content-inner", children }) })
|
|
2031
2259
|
] });
|
|
2032
2260
|
}
|
|
2033
2261
|
|
|
2034
2262
|
// packages/loading/src/index.tsx
|
|
2035
|
-
import { jsx as
|
|
2263
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2036
2264
|
var sizes = {
|
|
2037
2265
|
small: "16px",
|
|
2038
2266
|
medium: "24px",
|
|
@@ -2045,15 +2273,15 @@ function Loading({ size = "medium", color = "#2878f0", label, className, style,
|
|
|
2045
2273
|
"--fe-loading-color": color,
|
|
2046
2274
|
...style
|
|
2047
2275
|
};
|
|
2048
|
-
return /* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2050
|
-
label && /* @__PURE__ */
|
|
2051
|
-
!label && /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ jsxs19("span", { className: ["fe-loading", className].filter(Boolean).join(" "), style: loadingStyle, role: "status", ...props, children: [
|
|
2277
|
+
/* @__PURE__ */ jsx20("span", { className: "fe-loading__spinner", "aria-hidden": "true" }),
|
|
2278
|
+
label && /* @__PURE__ */ jsx20("span", { className: "fe-loading__label", children: label }),
|
|
2279
|
+
!label && /* @__PURE__ */ jsx20("span", { className: "fe-loading__sr-only", children: "Loading" })
|
|
2052
2280
|
] });
|
|
2053
2281
|
}
|
|
2054
2282
|
|
|
2055
2283
|
// packages/skeleton/src/index.tsx
|
|
2056
|
-
import { Fragment as Fragment3, jsx as
|
|
2284
|
+
import { Fragment as Fragment3, jsx as jsx21 } from "react/jsx-runtime";
|
|
2057
2285
|
var pixels = (value) => typeof value === "number" ? `${value}px` : value;
|
|
2058
2286
|
function SkeletonBase({ variant = "box", shape, width, height, count = 1, animated = true, className, style, ...props }) {
|
|
2059
2287
|
const resolvedVariant = shape ?? variant;
|
|
@@ -2064,7 +2292,7 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
2064
2292
|
"--fe-skeleton-height": resolvedHeight,
|
|
2065
2293
|
...style
|
|
2066
2294
|
};
|
|
2067
|
-
return /* @__PURE__ */
|
|
2295
|
+
return /* @__PURE__ */ jsx21(Fragment3, { children: Array.from({ length: Math.max(1, count) }, (_, index) => /* @__PURE__ */ jsx21(
|
|
2068
2296
|
"div",
|
|
2069
2297
|
{
|
|
2070
2298
|
className: ["fe-skeleton", `fe-skeleton--${resolvedVariant}`, animated && "fe-skeleton--animated", className].filter(Boolean).join(" "),
|
|
@@ -2076,16 +2304,16 @@ function SkeletonBase({ variant = "box", shape, width, height, count = 1, animat
|
|
|
2076
2304
|
)) });
|
|
2077
2305
|
}
|
|
2078
2306
|
function SkeletonCircle({ size = 40, ...props }) {
|
|
2079
|
-
return /* @__PURE__ */
|
|
2307
|
+
return /* @__PURE__ */ jsx21(SkeletonBase, { variant: "circle", width: size, height: size, ...props });
|
|
2080
2308
|
}
|
|
2081
2309
|
function SkeletonSquare({ size = 80, ...props }) {
|
|
2082
|
-
return /* @__PURE__ */
|
|
2310
|
+
return /* @__PURE__ */ jsx21(SkeletonBase, { variant: "box", width: size, height: size, ...props });
|
|
2083
2311
|
}
|
|
2084
2312
|
function SkeletonBox({ width = "100%", height = 80, ...props }) {
|
|
2085
|
-
return /* @__PURE__ */
|
|
2313
|
+
return /* @__PURE__ */ jsx21(SkeletonBase, { variant: "box", width, height, ...props });
|
|
2086
2314
|
}
|
|
2087
2315
|
function SkeletonLine({ width = "100%", height = 12, ...props }) {
|
|
2088
|
-
return /* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ jsx21(SkeletonBase, { variant: "line", width, height, ...props });
|
|
2089
2317
|
}
|
|
2090
2318
|
var Skeleton = Object.assign(SkeletonBase, {
|
|
2091
2319
|
Circle: SkeletonCircle,
|
|
@@ -2095,9 +2323,9 @@ var Skeleton = Object.assign(SkeletonBase, {
|
|
|
2095
2323
|
});
|
|
2096
2324
|
|
|
2097
2325
|
// packages/modal/src/index.tsx
|
|
2098
|
-
import { useEffect as
|
|
2326
|
+
import { useEffect as useEffect8, useId as useId11, useRef as useRef8 } from "react";
|
|
2099
2327
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2100
|
-
import { jsx as
|
|
2328
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2101
2329
|
function Modal({
|
|
2102
2330
|
open,
|
|
2103
2331
|
onClose,
|
|
@@ -2113,9 +2341,9 @@ function Modal({
|
|
|
2113
2341
|
className,
|
|
2114
2342
|
...props
|
|
2115
2343
|
}) {
|
|
2116
|
-
const titleId =
|
|
2117
|
-
const panelRef =
|
|
2118
|
-
|
|
2344
|
+
const titleId = useId11();
|
|
2345
|
+
const panelRef = useRef8(null);
|
|
2346
|
+
useEffect8(() => {
|
|
2119
2347
|
if (!open) return;
|
|
2120
2348
|
const onKeyDown = (event) => {
|
|
2121
2349
|
if (event.key === "Escape") onClose();
|
|
@@ -2127,9 +2355,9 @@ function Modal({
|
|
|
2127
2355
|
if (!open || typeof document === "undefined") return null;
|
|
2128
2356
|
const hasFooter = footer || actions.length > 0;
|
|
2129
2357
|
return createPortal3(
|
|
2130
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ jsx22("div", { className: "fe-modal-backdrop", role: "presentation", onMouseDown: (event) => {
|
|
2131
2359
|
if (event.target === event.currentTarget && closeOnBackdropClick) onClose();
|
|
2132
|
-
}, children: /* @__PURE__ */
|
|
2360
|
+
}, children: /* @__PURE__ */ jsxs20(
|
|
2133
2361
|
"div",
|
|
2134
2362
|
{
|
|
2135
2363
|
ref: panelRef,
|
|
@@ -2141,17 +2369,17 @@ function Modal({
|
|
|
2141
2369
|
tabIndex: -1,
|
|
2142
2370
|
...props,
|
|
2143
2371
|
children: [
|
|
2144
|
-
(title || description || closeButton) && /* @__PURE__ */
|
|
2145
|
-
/* @__PURE__ */
|
|
2146
|
-
title && /* @__PURE__ */
|
|
2147
|
-
description && /* @__PURE__ */
|
|
2372
|
+
(title || description || closeButton) && /* @__PURE__ */ jsxs20("header", { className: "fe-modal__header", children: [
|
|
2373
|
+
/* @__PURE__ */ jsxs20("div", { className: "fe-modal__heading", children: [
|
|
2374
|
+
title && /* @__PURE__ */ jsx22("h2", { id: titleId, children: title }),
|
|
2375
|
+
description && /* @__PURE__ */ jsx22("p", { children: description })
|
|
2148
2376
|
] }),
|
|
2149
|
-
closeButton && /* @__PURE__ */
|
|
2377
|
+
closeButton && /* @__PURE__ */ jsx22(Button, { hierarchy: "tertiary-gray", size: "32", iconOnly: true, icon: /* @__PURE__ */ jsx22(CloseIcon, {}), "aria-label": closeLabel, onClick: onClose })
|
|
2150
2378
|
] }),
|
|
2151
|
-
/* @__PURE__ */
|
|
2152
|
-
hasFooter && /* @__PURE__ */
|
|
2153
|
-
footer && /* @__PURE__ */
|
|
2154
|
-
actions.length > 0 && /* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsx22("div", { className: "fe-modal__body", children }),
|
|
2380
|
+
hasFooter && /* @__PURE__ */ jsxs20("footer", { className: "fe-modal__footer", children: [
|
|
2381
|
+
footer && /* @__PURE__ */ jsx22("div", { className: "fe-modal__footer-content", children: footer }),
|
|
2382
|
+
actions.length > 0 && /* @__PURE__ */ jsx22("div", { className: "fe-modal__actions", children: actions.map(({ label, ...action }, index) => /* @__PURE__ */ jsx22(Button, { ...action, children: label }, index)) })
|
|
2155
2383
|
] })
|
|
2156
2384
|
]
|
|
2157
2385
|
}
|
|
@@ -2161,7 +2389,7 @@ function Modal({
|
|
|
2161
2389
|
}
|
|
2162
2390
|
|
|
2163
2391
|
// packages/progress/src/index.tsx
|
|
2164
|
-
import { jsx as
|
|
2392
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2165
2393
|
function ProgressBar({ value, max = 100, label, showValue = true, size = "medium", color = "#2878f0", className, style, "aria-label": ariaLabel, ...props }) {
|
|
2166
2394
|
const indeterminate = value === null || value === void 0;
|
|
2167
2395
|
const percentage = indeterminate ? 0 : Math.min(100, Math.max(0, Number(value) / Math.max(1, max) * 100));
|
|
@@ -2171,17 +2399,17 @@ function ProgressBar({ value, max = 100, label, showValue = true, size = "medium
|
|
|
2171
2399
|
...style
|
|
2172
2400
|
};
|
|
2173
2401
|
const visibleValue = `${Math.round(percentage)}%`;
|
|
2174
|
-
return /* @__PURE__ */
|
|
2175
|
-
(label || !indeterminate && showValue) && /* @__PURE__ */
|
|
2176
|
-
label && /* @__PURE__ */
|
|
2177
|
-
!indeterminate && showValue && /* @__PURE__ */
|
|
2402
|
+
return /* @__PURE__ */ jsxs21("div", { className: ["fe-progress", `fe-progress--${size}`, indeterminate && "fe-progress--indeterminate", className].filter(Boolean).join(" "), style: progressStyle, ...props, children: [
|
|
2403
|
+
(label || !indeterminate && showValue) && /* @__PURE__ */ jsxs21("div", { className: "fe-progress__meta", children: [
|
|
2404
|
+
label && /* @__PURE__ */ jsx23("span", { className: "fe-progress__label", children: label }),
|
|
2405
|
+
!indeterminate && showValue && /* @__PURE__ */ jsx23("output", { className: "fe-progress__value", children: visibleValue })
|
|
2178
2406
|
] }),
|
|
2179
|
-
/* @__PURE__ */
|
|
2407
|
+
/* @__PURE__ */ jsx23("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__ */ jsx23("span", { className: "fe-progress__indicator" }) })
|
|
2180
2408
|
] });
|
|
2181
2409
|
}
|
|
2182
2410
|
|
|
2183
2411
|
// packages/chip/src/index.tsx
|
|
2184
|
-
import { jsx as
|
|
2412
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2185
2413
|
var statuses = ["default", "info", "success", "warning", "error", "neutral", "pending", "processing"];
|
|
2186
2414
|
function Chip({ children, status = "default", color, variant = "subtle", dot = false, onRemove, removeLabel = "Remove", className, style, ...props }) {
|
|
2187
2415
|
const usesCustomColor = Boolean(color);
|
|
@@ -2190,16 +2418,16 @@ function Chip({ children, status = "default", color, variant = "subtle", dot = f
|
|
|
2190
2418
|
...style
|
|
2191
2419
|
};
|
|
2192
2420
|
const resolvedStatus = statuses.includes(status) ? status : "default";
|
|
2193
|
-
return /* @__PURE__ */
|
|
2194
|
-
dot && /* @__PURE__ */
|
|
2195
|
-
/* @__PURE__ */
|
|
2196
|
-
onRemove && /* @__PURE__ */
|
|
2421
|
+
return /* @__PURE__ */ jsxs22("span", { className: ["fe-chip", `fe-chip--${variant}`, `fe-chip--${usesCustomColor ? "custom" : resolvedStatus}`, className].filter(Boolean).join(" "), style: chipStyle, ...props, children: [
|
|
2422
|
+
dot && /* @__PURE__ */ jsx24("span", { className: "fe-chip__dot", "aria-hidden": "true" }),
|
|
2423
|
+
/* @__PURE__ */ jsx24("span", { className: "fe-chip__content", children }),
|
|
2424
|
+
onRemove && /* @__PURE__ */ jsx24(Button, { hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: /* @__PURE__ */ jsx24(CloseIcon, { size: 14 }), "aria-label": removeLabel, onClick: onRemove, className: "fe-chip__remove" })
|
|
2197
2425
|
] });
|
|
2198
2426
|
}
|
|
2199
2427
|
|
|
2200
2428
|
// packages/message/src/index.tsx
|
|
2201
|
-
import { useEffect as
|
|
2202
|
-
import { jsx as
|
|
2429
|
+
import { useEffect as useEffect9, useState as useState13 } from "react";
|
|
2430
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2203
2431
|
var messageId = 0;
|
|
2204
2432
|
var entries = [];
|
|
2205
2433
|
var listeners = /* @__PURE__ */ new Set();
|
|
@@ -2232,22 +2460,22 @@ var message = {
|
|
|
2232
2460
|
};
|
|
2233
2461
|
var icons = { success: "\u2713", info: "i", warning: "!", error: "\xD7" };
|
|
2234
2462
|
function Message({ maxCount = 4, closeLabel = "Close notification", className, ...props }) {
|
|
2235
|
-
const [visibleEntries, setVisibleEntries] =
|
|
2236
|
-
|
|
2463
|
+
const [visibleEntries, setVisibleEntries] = useState13(entries);
|
|
2464
|
+
useEffect9(() => {
|
|
2237
2465
|
const listener = (nextEntries) => setVisibleEntries(nextEntries);
|
|
2238
2466
|
listeners.add(listener);
|
|
2239
2467
|
return () => {
|
|
2240
2468
|
listeners.delete(listener);
|
|
2241
2469
|
};
|
|
2242
2470
|
}, []);
|
|
2243
|
-
return /* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2245
|
-
/* @__PURE__ */
|
|
2246
|
-
entry.title && /* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
2471
|
+
return /* @__PURE__ */ jsx25("div", { className: ["fe-message-viewport", className].filter(Boolean).join(" "), "aria-live": "polite", ...props, children: visibleEntries.slice(-Math.max(1, maxCount)).map((entry) => /* @__PURE__ */ jsxs23("div", { className: `fe-message fe-message--${entry.severity ?? "info"}`, role: entry.severity === "error" ? "alert" : "status", children: [
|
|
2472
|
+
/* @__PURE__ */ jsx25("span", { className: "fe-message__icon", "aria-hidden": "true", children: icons[entry.severity ?? "info"] }),
|
|
2473
|
+
/* @__PURE__ */ jsxs23("div", { className: "fe-message__body", children: [
|
|
2474
|
+
entry.title && /* @__PURE__ */ jsx25("strong", { className: "fe-message__title", children: entry.title }),
|
|
2475
|
+
/* @__PURE__ */ jsx25("div", { className: "fe-message__content", children: entry.content })
|
|
2248
2476
|
] }),
|
|
2249
|
-
entry.action && /* @__PURE__ */
|
|
2250
|
-
/* @__PURE__ */
|
|
2477
|
+
entry.action && /* @__PURE__ */ jsx25("span", { className: "fe-message__action", children: entry.action }),
|
|
2478
|
+
/* @__PURE__ */ jsx25(Button, { className: "fe-message__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => dismiss(entry.id) })
|
|
2251
2479
|
] }, entry.id)) });
|
|
2252
2480
|
}
|
|
2253
2481
|
((Message2) => {
|
|
@@ -2261,8 +2489,8 @@ function Message({ maxCount = 4, closeLabel = "Close notification", className, .
|
|
|
2261
2489
|
})(Message || (Message = {}));
|
|
2262
2490
|
|
|
2263
2491
|
// packages/snackbar/src/index.tsx
|
|
2264
|
-
import { useEffect as
|
|
2265
|
-
import { jsx as
|
|
2492
|
+
import { useEffect as useEffect10 } from "react";
|
|
2493
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2266
2494
|
function Snackbar({
|
|
2267
2495
|
open,
|
|
2268
2496
|
message: message2,
|
|
@@ -2276,12 +2504,12 @@ function Snackbar({
|
|
|
2276
2504
|
}) {
|
|
2277
2505
|
const vertical = anchorOrigin.vertical ?? "bottom";
|
|
2278
2506
|
const horizontal = anchorOrigin.horizontal ?? "center";
|
|
2279
|
-
|
|
2507
|
+
useEffect10(() => {
|
|
2280
2508
|
if (!open || autoHideDuration === null) return void 0;
|
|
2281
2509
|
const timer = window.setTimeout(() => onClose?.("timeout"), autoHideDuration);
|
|
2282
2510
|
return () => window.clearTimeout(timer);
|
|
2283
2511
|
}, [open, autoHideDuration, onClose]);
|
|
2284
|
-
|
|
2512
|
+
useEffect10(() => {
|
|
2285
2513
|
if (!open) return void 0;
|
|
2286
2514
|
const onKeyDown = (event) => {
|
|
2287
2515
|
if (event.key === "Escape") onClose?.("escapeKeyDown");
|
|
@@ -2290,16 +2518,16 @@ function Snackbar({
|
|
|
2290
2518
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2291
2519
|
}, [open, onClose]);
|
|
2292
2520
|
if (!open) return null;
|
|
2293
|
-
return /* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
action && /* @__PURE__ */
|
|
2296
|
-
onClose && /* @__PURE__ */
|
|
2521
|
+
return /* @__PURE__ */ jsx26("div", { className: ["fe-snackbar", `fe-snackbar--${vertical}`, `fe-snackbar--${horizontal}`, className].filter(Boolean).join(" "), ...props, children: /* @__PURE__ */ jsxs24("div", { className: "fe-snackbar__content", role: "status", "aria-live": "polite", children: [
|
|
2522
|
+
/* @__PURE__ */ jsx26("span", { className: "fe-snackbar__message", children: message2 }),
|
|
2523
|
+
action && /* @__PURE__ */ jsx26("span", { className: "fe-snackbar__action", children: action }),
|
|
2524
|
+
onClose && /* @__PURE__ */ jsx26(Button, { className: "fe-snackbar__close", hierarchy: "tertiary-gray", size: "24", iconOnly: true, icon: "\xD7", "aria-label": closeLabel, onClick: () => onClose("closeButton") })
|
|
2297
2525
|
] }) });
|
|
2298
2526
|
}
|
|
2299
2527
|
|
|
2300
2528
|
// packages/avatar/src/index.tsx
|
|
2301
|
-
import { Children, isValidElement as isValidElement2, useState as
|
|
2302
|
-
import { jsx as
|
|
2529
|
+
import { Children, isValidElement as isValidElement2, useState as useState14 } from "react";
|
|
2530
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2303
2531
|
var FALLBACK_AVATARS = [
|
|
2304
2532
|
{
|
|
2305
2533
|
background: "#E0E7FF",
|
|
@@ -2632,7 +2860,7 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2632
2860
|
shirt,
|
|
2633
2861
|
skin
|
|
2634
2862
|
} = avatar;
|
|
2635
|
-
return /* @__PURE__ */
|
|
2863
|
+
return /* @__PURE__ */ jsxs25(
|
|
2636
2864
|
"svg",
|
|
2637
2865
|
{
|
|
2638
2866
|
className: "fe-avatar__fallback-icon",
|
|
@@ -2640,15 +2868,15 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2640
2868
|
focusable: "false",
|
|
2641
2869
|
"aria-hidden": "true",
|
|
2642
2870
|
children: [
|
|
2643
|
-
/* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2871
|
+
/* @__PURE__ */ jsx27("rect", { width: "24", height: "24", fill: background }),
|
|
2872
|
+
/* @__PURE__ */ jsx27(
|
|
2645
2873
|
"path",
|
|
2646
2874
|
{
|
|
2647
2875
|
d: "M3 24c.52-3.79 3.58-6.25 9-6.25S20.48 20.21 21 24",
|
|
2648
2876
|
fill: shirt
|
|
2649
2877
|
}
|
|
2650
2878
|
),
|
|
2651
|
-
/* @__PURE__ */
|
|
2879
|
+
/* @__PURE__ */ jsx27(
|
|
2652
2880
|
"path",
|
|
2653
2881
|
{
|
|
2654
2882
|
d: "M8.1 17.65h7.8l1.05 2.05H7.05l1.05-2.05Z",
|
|
@@ -2656,38 +2884,38 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2656
2884
|
opacity: ".72"
|
|
2657
2885
|
}
|
|
2658
2886
|
),
|
|
2659
|
-
/* @__PURE__ */
|
|
2660
|
-
hairStyle === 0 && /* @__PURE__ */
|
|
2887
|
+
/* @__PURE__ */ jsx27("circle", { cx: "12", cy: "10.25", r: "5.25", fill: skin }),
|
|
2888
|
+
hairStyle === 0 && /* @__PURE__ */ jsx27(
|
|
2661
2889
|
"path",
|
|
2662
2890
|
{
|
|
2663
2891
|
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
2892
|
fill: hair
|
|
2665
2893
|
}
|
|
2666
2894
|
),
|
|
2667
|
-
hairStyle === 1 && /* @__PURE__ */
|
|
2895
|
+
hairStyle === 1 && /* @__PURE__ */ jsx27(
|
|
2668
2896
|
"path",
|
|
2669
2897
|
{
|
|
2670
2898
|
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
2899
|
fill: hair
|
|
2672
2900
|
}
|
|
2673
2901
|
),
|
|
2674
|
-
hairStyle === 2 && /* @__PURE__ */
|
|
2902
|
+
hairStyle === 2 && /* @__PURE__ */ jsx27(
|
|
2675
2903
|
"path",
|
|
2676
2904
|
{
|
|
2677
2905
|
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
2906
|
fill: hair
|
|
2679
2907
|
}
|
|
2680
2908
|
),
|
|
2681
|
-
hairStyle === 3 && /* @__PURE__ */
|
|
2909
|
+
hairStyle === 3 && /* @__PURE__ */ jsx27(
|
|
2682
2910
|
"path",
|
|
2683
2911
|
{
|
|
2684
2912
|
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
2913
|
fill: hair
|
|
2686
2914
|
}
|
|
2687
2915
|
),
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2690
|
-
expression === 0 && /* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsx27("circle", { cx: "10.05", cy: "10.65", r: ".48", fill: "#3B2924" }),
|
|
2917
|
+
/* @__PURE__ */ jsx27("circle", { cx: "13.95", cy: "10.65", r: ".48", fill: "#3B2924" }),
|
|
2918
|
+
expression === 0 && /* @__PURE__ */ jsx27(
|
|
2691
2919
|
"path",
|
|
2692
2920
|
{
|
|
2693
2921
|
d: "M10.25 13.2c1.08.66 2.42.66 3.5 0",
|
|
@@ -2697,7 +2925,7 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2697
2925
|
strokeLinecap: "round"
|
|
2698
2926
|
}
|
|
2699
2927
|
),
|
|
2700
|
-
expression === 1 && /* @__PURE__ */
|
|
2928
|
+
expression === 1 && /* @__PURE__ */ jsx27(
|
|
2701
2929
|
"path",
|
|
2702
2930
|
{
|
|
2703
2931
|
d: "M10.5 13.2h3",
|
|
@@ -2707,7 +2935,7 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2707
2935
|
strokeLinecap: "round"
|
|
2708
2936
|
}
|
|
2709
2937
|
),
|
|
2710
|
-
expression === 2 && /* @__PURE__ */
|
|
2938
|
+
expression === 2 && /* @__PURE__ */ jsx27(
|
|
2711
2939
|
"path",
|
|
2712
2940
|
{
|
|
2713
2941
|
d: "M10.6 13.38c.84-.44 1.96-.44 2.8 0",
|
|
@@ -2717,11 +2945,11 @@ function AvatarFallbackIcon({ avatar }) {
|
|
|
2717
2945
|
strokeLinecap: "round"
|
|
2718
2946
|
}
|
|
2719
2947
|
),
|
|
2720
|
-
expression === 3 && /* @__PURE__ */
|
|
2721
|
-
glasses && /* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
/* @__PURE__ */
|
|
2724
|
-
/* @__PURE__ */
|
|
2948
|
+
expression === 3 && /* @__PURE__ */ jsx27("circle", { cx: "12", cy: "13.2", r: ".82", fill: "#B95A5A" }),
|
|
2949
|
+
glasses && /* @__PURE__ */ jsxs25("g", { fill: "none", stroke: "#3C4355", strokeWidth: ".65", children: [
|
|
2950
|
+
/* @__PURE__ */ jsx27("circle", { cx: "10", cy: "10.55", r: "1.45" }),
|
|
2951
|
+
/* @__PURE__ */ jsx27("circle", { cx: "14", cy: "10.55", r: "1.45" }),
|
|
2952
|
+
/* @__PURE__ */ jsx27("path", { d: "M11.45 10.55h1.1M8.55 10.55H7.5m9 0h-1.05" })
|
|
2725
2953
|
] })
|
|
2726
2954
|
]
|
|
2727
2955
|
}
|
|
@@ -2740,10 +2968,10 @@ function Avatar({
|
|
|
2740
2968
|
"aria-label": ariaLabel,
|
|
2741
2969
|
...props
|
|
2742
2970
|
}) {
|
|
2743
|
-
const [generatedFallbackIndex] =
|
|
2971
|
+
const [generatedFallbackIndex] = useState14(
|
|
2744
2972
|
() => Math.floor(Math.random() * FALLBACK_AVATARS.length)
|
|
2745
2973
|
);
|
|
2746
|
-
const [failedImageSrc, setFailedImageSrc] =
|
|
2974
|
+
const [failedImageSrc, setFailedImageSrc] = useState14();
|
|
2747
2975
|
const imageSrc = src?.trim();
|
|
2748
2976
|
const trimmedContent = content?.trim() ?? "";
|
|
2749
2977
|
const showImage = Boolean(imageSrc && failedImageSrc !== imageSrc);
|
|
@@ -2755,7 +2983,7 @@ function Avatar({
|
|
|
2755
2983
|
...style
|
|
2756
2984
|
};
|
|
2757
2985
|
const fallbackLabel = (alt ?? trimmedContent) || "Avatar";
|
|
2758
|
-
return /* @__PURE__ */
|
|
2986
|
+
return /* @__PURE__ */ jsxs25(
|
|
2759
2987
|
"span",
|
|
2760
2988
|
{
|
|
2761
2989
|
className: ["fe-avatar", `fe-avatar--${shape}`, className].filter(Boolean).join(" "),
|
|
@@ -2764,7 +2992,7 @@ function Avatar({
|
|
|
2764
2992
|
"aria-label": showImage ? ariaLabel : ariaLabel ?? fallbackLabel,
|
|
2765
2993
|
...props,
|
|
2766
2994
|
children: [
|
|
2767
|
-
showImage && /* @__PURE__ */
|
|
2995
|
+
showImage && /* @__PURE__ */ jsx27(
|
|
2768
2996
|
"img",
|
|
2769
2997
|
{
|
|
2770
2998
|
className: "fe-avatar__image",
|
|
@@ -2773,8 +3001,8 @@ function Avatar({
|
|
|
2773
3001
|
onError: () => setFailedImageSrc(imageSrc)
|
|
2774
3002
|
}
|
|
2775
3003
|
),
|
|
2776
|
-
!showImage && initials && /* @__PURE__ */
|
|
2777
|
-
!showImage && !initials && /* @__PURE__ */
|
|
3004
|
+
!showImage && initials && /* @__PURE__ */ jsx27("span", { className: "fe-avatar__initials", "aria-hidden": "true", children: initials }),
|
|
3005
|
+
!showImage && !initials && /* @__PURE__ */ jsx27(AvatarFallbackIcon, { avatar: selectedFallback })
|
|
2778
3006
|
]
|
|
2779
3007
|
}
|
|
2780
3008
|
);
|
|
@@ -2800,7 +3028,7 @@ function AvatarGroup({
|
|
|
2800
3028
|
"--fe-avatar-font-size": resolveFontSize(firstAvatarSize)
|
|
2801
3029
|
};
|
|
2802
3030
|
const singleContent = avatars.length === 1 ? avatars[0]?.props.content?.trim() ?? "" : "";
|
|
2803
|
-
return /* @__PURE__ */
|
|
3031
|
+
return /* @__PURE__ */ jsxs25(
|
|
2804
3032
|
"div",
|
|
2805
3033
|
{
|
|
2806
3034
|
className: ["fe-avatar-group", className].filter(Boolean).join(" "),
|
|
@@ -2808,8 +3036,8 @@ function AvatarGroup({
|
|
|
2808
3036
|
role: role ?? "group",
|
|
2809
3037
|
...props,
|
|
2810
3038
|
children: [
|
|
2811
|
-
/* @__PURE__ */
|
|
2812
|
-
visibleAvatars.map((avatar, index) => /* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ jsxs25("div", { className: "fe-avatar-group__items", children: [
|
|
3040
|
+
visibleAvatars.map((avatar, index) => /* @__PURE__ */ jsx27(
|
|
2813
3041
|
"span",
|
|
2814
3042
|
{
|
|
2815
3043
|
className: "fe-avatar-group__item",
|
|
@@ -2818,7 +3046,7 @@ function AvatarGroup({
|
|
|
2818
3046
|
},
|
|
2819
3047
|
avatar.key ?? index
|
|
2820
3048
|
)),
|
|
2821
|
-
hasOverflow && /* @__PURE__ */
|
|
3049
|
+
hasOverflow && /* @__PURE__ */ jsxs25(
|
|
2822
3050
|
"span",
|
|
2823
3051
|
{
|
|
2824
3052
|
className: "fe-avatar-group__more",
|
|
@@ -2832,7 +3060,7 @@ function AvatarGroup({
|
|
|
2832
3060
|
}
|
|
2833
3061
|
)
|
|
2834
3062
|
] }),
|
|
2835
|
-
singleContent && /* @__PURE__ */
|
|
3063
|
+
singleContent && /* @__PURE__ */ jsx27("span", { className: "fe-avatar-group__content", children: singleContent })
|
|
2836
3064
|
]
|
|
2837
3065
|
}
|
|
2838
3066
|
);
|
|
@@ -2877,6 +3105,7 @@ export {
|
|
|
2877
3105
|
TableHead,
|
|
2878
3106
|
TableHeader,
|
|
2879
3107
|
TableRow,
|
|
3108
|
+
Tabs,
|
|
2880
3109
|
TextArea,
|
|
2881
3110
|
TextInput,
|
|
2882
3111
|
Toggle,
|