@ostack.tech/ui 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/locales/en-GB.js +4 -4
- package/dist/locales/en-GB.js.map +1 -1
- package/dist/locales/en-US.js +4 -4
- package/dist/locales/en-US.js.map +1 -1
- package/dist/locales/{fr.js → fr-FR.js} +6 -6
- package/dist/locales/fr-FR.js.map +1 -0
- package/dist/locales/{pt.js → pt-PT.js} +6 -6
- package/dist/locales/pt-PT.js.map +1 -0
- package/dist/ostack-ui.css +45 -10
- package/dist/ostack-ui.css.map +1 -1
- package/dist/ostack-ui.js +613 -246
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/DataTable/DataTable.d.ts +6 -0
- package/dist/types/components/DataTable/DataTableContext.d.ts +3 -1
- package/dist/types/components/IconButton/IconButton.d.ts +25 -6
- package/dist/types/components/Portal/Portal.d.ts +1 -1
- package/dist/types/components/Printer/Printer.d.ts +149 -0
- package/dist/types/components/Printer/PrinterContent.d.ts +22 -0
- package/dist/types/components/Printer/PrinterContentContext.d.ts +38 -0
- package/dist/types/components/Printer/PrinterContext.d.ts +33 -0
- package/dist/types/components/Printer/PrinterTrigger.d.ts +20 -0
- package/dist/types/components/Printer/index.d.ts +6 -0
- package/dist/types/components/Printer/usePrintClassNames.d.ts +5 -0
- package/dist/types/components/Select/SelectContext.d.ts +2 -4
- package/dist/types/components/Tabs/TabContent.d.ts +6 -1
- package/dist/types/components/Tabs/Tabs.d.ts +2 -0
- package/dist/types/components/Tabs/TabsContext.d.ts +15 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locales/en-GB.d.ts +1 -1
- package/dist/types/locales/en-US.d.ts +1 -1
- package/dist/types/locales/{fr.d.ts → fr-FR.d.ts} +2 -2
- package/dist/types/locales/index.d.ts +4 -4
- package/dist/types/locales/{pt.d.ts → pt-PT.d.ts} +2 -2
- package/dist/types/providers/AlertDialogProvider/useAlertDialog.d.ts +2 -2
- package/dist/types/providers/ToastManagerProvider/useToastManager.d.ts +1 -1
- package/dist/types/utils/cx.d.ts +1 -1
- package/dist/types/utils/keyboardShortcut.d.ts +7 -1
- package/dist/types/utils/useCssVars.d.ts +3 -3
- package/package.json +3 -2
- package/scss/components/Card/_Card.scss +5 -6
- package/scss/components/Field/_Field.scss +1 -0
- package/scss/components/Input/_Input.scss +4 -0
- package/scss/components/Spinner/_Spinner-variables.scss +3 -1
- package/scss/components/Spinner/_Spinner.scss +10 -1
- package/scss/components/Table/_Table.scss +6 -0
- package/scss/components/Tabs/_Tabs-variables.scss +16 -0
- package/scss/components/Tabs/_Tabs.scss +22 -5
- package/scss/index.scss +1 -0
- package/scss/scss/helpers/_print-utils.scss +13 -0
- package/scss/scss/utils/_spinner.scss +11 -5
- package/dist/locales/fr.js.map +0 -1
- package/dist/locales/pt.js.map +0 -1
package/dist/ostack-ui.js
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, useState, memo, isValidElement, cloneElement, Fragment, Children, useImperativeHandle, startTransition, useLayoutEffect as useLayoutEffect$1, createElement, useDeferredValue, useSyncExternalStore } from "react";
|
|
1
|
+
import { forwardRef, createContext, useContext, useCallback, useRef, useEffect, useId, useMemo, useState, memo, isValidElement, cloneElement, Fragment as Fragment$1, Children, useImperativeHandle, startTransition, useLayoutEffect as useLayoutEffect$1, createElement, useDeferredValue, useSyncExternalStore } from "react";
|
|
2
2
|
import { tinykeys } from "tinykeys";
|
|
3
3
|
import fromExponential from "from-exponential";
|
|
4
4
|
import { isValid, isDate, addMonths, isAfter, isBefore, startOfMonth, setMonth, getYear, setYear, startOfYear, format, isSameYear, getMonth, max, min, lastDayOfMonth, parseISO, parse, isWithinInterval, isEqual } from "date-fns";
|
|
5
5
|
import { createStore, useStore, create } from "zustand";
|
|
6
6
|
import { shallow } from "zustand/shallow";
|
|
7
7
|
import { removeNumericFormat, numericFormatter, NumericFormat } from "react-number-format";
|
|
8
|
-
import { jsx, jsxs, Fragment
|
|
8
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
9
9
|
import { faClose, faTriangleExclamation, faCircleExclamation, faCircleCheck, faCircleInfo, faChevronUp, faChevronDown, faRedo, faCircleQuestion, faSortDown, faSortUp, faAsterisk, faMinus, faCheck, faFilter, faArrowLeft, faArrowRight, faSearch, faChevronLeft, faChevronRight, faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons";
|
|
10
10
|
import { ErrorBoundary as ErrorBoundary$1 } from "react-error-boundary";
|
|
11
11
|
import { useErrorBoundary } from "react-error-boundary";
|
|
12
|
-
import { AlertDialog as AlertDialog$1, Dialog as Dialog$1, Slot as Slot$1, Portal as Portal$1, AccessibleIcon, Tooltip as Tooltip$1,
|
|
12
|
+
import { AlertDialog as AlertDialog$1, Dialog as Dialog$1, Slot as Slot$1, Portal as Portal$1, AccessibleIcon, Tooltip as Tooltip$1, VisuallyHidden as VisuallyHidden$1, Toast as Toast$1, Collapsible as Collapsible$1, Popover as Popover$1, Label as Label$1, Checkbox as Checkbox$1, DropdownMenu as DropdownMenu$1, RadioGroup as RadioGroup$1, Separator as Separator$1, Tabs as Tabs$1 } from "radix-ui";
|
|
13
13
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
14
14
|
import { subscribeWithSelector } from "zustand/middleware";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
15
|
+
import { locale } from "./locales/en-GB.js";
|
|
16
|
+
import { locale as locale2 } from "./locales/en-US.js";
|
|
17
|
+
import { locale as locale3, locale as locale4 } from "./locales/fr-FR.js";
|
|
18
|
+
import { locale as locale5, locale as locale6 } from "./locales/pt-PT.js";
|
|
19
19
|
import { useDayPicker, DayPicker } from "react-day-picker";
|
|
20
20
|
import { Command } from "cmdk";
|
|
21
21
|
import { useShallow } from "zustand/react/shallow";
|
|
22
22
|
import { useVirtualizer, observeElementRect } from "@tanstack/react-virtual";
|
|
23
23
|
import { faCalendar } from "@fortawesome/free-regular-svg-icons";
|
|
24
|
+
import { flushSync } from "react-dom";
|
|
25
|
+
import { useReactToPrint } from "react-to-print";
|
|
24
26
|
const AlertDialog = AlertDialog$1.Root;
|
|
25
27
|
const AlertDialogAction = forwardRef(function AlertDialogAction2(props, forwardedRef) {
|
|
26
28
|
return /* @__PURE__ */ jsx(AlertDialog$1.Action, { ...props, asChild: true, ref: forwardedRef });
|
|
@@ -216,6 +218,29 @@ function computed(depsFn, computeFn) {
|
|
|
216
218
|
return cachedResult;
|
|
217
219
|
};
|
|
218
220
|
}
|
|
221
|
+
const PrinterContentContext = createContext({
|
|
222
|
+
printing: false
|
|
223
|
+
});
|
|
224
|
+
function usePrinterContentContext() {
|
|
225
|
+
return useContext(PrinterContentContext);
|
|
226
|
+
}
|
|
227
|
+
function usePrinting() {
|
|
228
|
+
return usePrinterContentContext().printing;
|
|
229
|
+
}
|
|
230
|
+
function useStartPrintingTask({
|
|
231
|
+
enabled = true
|
|
232
|
+
} = {}) {
|
|
233
|
+
const { startPrintingTask, finishPrintingTask } = usePrinterContentContext();
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
if (enabled) {
|
|
236
|
+
startPrintingTask?.();
|
|
237
|
+
}
|
|
238
|
+
}, [enabled, startPrintingTask]);
|
|
239
|
+
return useCallback(
|
|
240
|
+
() => enabled && finishPrintingTask?.(),
|
|
241
|
+
[enabled, finishPrintingTask]
|
|
242
|
+
);
|
|
243
|
+
}
|
|
219
244
|
function spliceWindow(totalCount, offset, limit, window2, startIndex, deleted = 0, added = 0) {
|
|
220
245
|
const deletedCount = Math.min(deleted, totalCount - startIndex);
|
|
221
246
|
const addedCount = typeof added === "number" ? added : added.length;
|
|
@@ -257,12 +282,12 @@ function spliceWindow(totalCount, offset, limit, window2, startIndex, deleted =
|
|
|
257
282
|
}
|
|
258
283
|
return { totalCount: newTotalCount, window: newWindow };
|
|
259
284
|
}
|
|
260
|
-
function matchAgainstFilter(value, filter,
|
|
285
|
+
function matchAgainstFilter(value, filter, locale7) {
|
|
261
286
|
if (value === "" || filter === "") {
|
|
262
287
|
return null;
|
|
263
288
|
}
|
|
264
|
-
const normalizedField = value.toLocaleLowerCase(
|
|
265
|
-
const normalizedFilter = filter.toLocaleLowerCase(
|
|
289
|
+
const normalizedField = value.toLocaleLowerCase(locale7);
|
|
290
|
+
const normalizedFilter = filter.toLocaleLowerCase(locale7);
|
|
266
291
|
const index = normalizedField.indexOf(normalizedFilter);
|
|
267
292
|
return index === -1 ? null : {
|
|
268
293
|
before: value.slice(0, index),
|
|
@@ -387,6 +412,7 @@ function useCreateDataTableContext({
|
|
|
387
412
|
dynamicRowHeight,
|
|
388
413
|
estimatedRowHeight,
|
|
389
414
|
overscan,
|
|
415
|
+
showAllRowsWhilePrinting,
|
|
390
416
|
apiRef,
|
|
391
417
|
leafColumns: leafColumns2,
|
|
392
418
|
headCount,
|
|
@@ -410,7 +436,10 @@ function useCreateDataTableContext({
|
|
|
410
436
|
onSelectedRowsChange,
|
|
411
437
|
disabledSelections
|
|
412
438
|
}) {
|
|
413
|
-
const
|
|
439
|
+
const { startPrintingTask, finishPrintingTask } = usePrinterContentContext();
|
|
440
|
+
const latest = useLatestValues({
|
|
441
|
+
startPrintingTask,
|
|
442
|
+
finishPrintingTask,
|
|
414
443
|
onOffsetChange,
|
|
415
444
|
onLimitChange,
|
|
416
445
|
onSort,
|
|
@@ -499,11 +528,11 @@ function useCreateDataTableContext({
|
|
|
499
528
|
},
|
|
500
529
|
setOffset: (offset2) => {
|
|
501
530
|
set({ updateCounter: get().updateCounter + 1, _offset: offset2 });
|
|
502
|
-
|
|
531
|
+
latest.onOffsetChange?.(offset2);
|
|
503
532
|
},
|
|
504
533
|
setLimit: (limit2) => {
|
|
505
534
|
set({ updateCounter: get().updateCounter + 1, limit: limit2 });
|
|
506
|
-
|
|
535
|
+
latest.onLimitChange?.(limit2);
|
|
507
536
|
},
|
|
508
537
|
setFilter: (filter2) => {
|
|
509
538
|
if (get().offset() > 0) {
|
|
@@ -511,7 +540,7 @@ function useCreateDataTableContext({
|
|
|
511
540
|
}
|
|
512
541
|
set({ filter: filter2 });
|
|
513
542
|
get().actions.refresh(null);
|
|
514
|
-
|
|
543
|
+
latest.onFilterChange?.(filter2);
|
|
515
544
|
},
|
|
516
545
|
setSort: (sortBy2, sortDirection2) => {
|
|
517
546
|
if (get().offset() > 0) {
|
|
@@ -519,7 +548,7 @@ function useCreateDataTableContext({
|
|
|
519
548
|
}
|
|
520
549
|
set({ sortBy: sortBy2, sortDirection: sortDirection2 });
|
|
521
550
|
get().actions.refresh();
|
|
522
|
-
|
|
551
|
+
latest.onSort?.(sortBy2, sortDirection2);
|
|
523
552
|
},
|
|
524
553
|
selectRows: (keys) => {
|
|
525
554
|
const {
|
|
@@ -535,7 +564,7 @@ function useCreateDataTableContext({
|
|
|
535
564
|
}
|
|
536
565
|
if (selected) {
|
|
537
566
|
set({ selectedRows: [selectedRows2] });
|
|
538
|
-
|
|
567
|
+
latest.onSelectedRowsChange?.(Array.from(selectedRows2).sort());
|
|
539
568
|
}
|
|
540
569
|
},
|
|
541
570
|
unselectRows: (keys) => {
|
|
@@ -551,7 +580,7 @@ function useCreateDataTableContext({
|
|
|
551
580
|
}
|
|
552
581
|
if (unselected) {
|
|
553
582
|
set({ selectedRows: [selectedRows2] });
|
|
554
|
-
|
|
583
|
+
latest.onSelectedRowsChange?.(Array.from(selectedRows2).sort());
|
|
555
584
|
}
|
|
556
585
|
},
|
|
557
586
|
updateWindow: (offset2, limit2) => {
|
|
@@ -610,13 +639,17 @@ function useCreateDataTableContext({
|
|
|
610
639
|
});
|
|
611
640
|
};
|
|
612
641
|
if (isPromiseLike(result)) {
|
|
642
|
+
const { startPrintingTask: startPrintingTask2, finishPrintingTask: finishPrintingTask2 } = latest;
|
|
643
|
+
startPrintingTask2?.();
|
|
613
644
|
void result.then(
|
|
614
645
|
(result2) => {
|
|
646
|
+
finishPrintingTask2?.();
|
|
615
647
|
if (!abortController.signal.aborted) {
|
|
616
648
|
cacheRows(result2);
|
|
617
649
|
}
|
|
618
650
|
},
|
|
619
651
|
(err) => {
|
|
652
|
+
finishPrintingTask2?.();
|
|
620
653
|
if (!(err instanceof DOMException) || err.name !== "AbortError") {
|
|
621
654
|
throw err;
|
|
622
655
|
}
|
|
@@ -744,6 +777,7 @@ function useCreateDataTableContext({
|
|
|
744
777
|
estimatedRowHeight,
|
|
745
778
|
overscan,
|
|
746
779
|
generatedId,
|
|
780
|
+
showAllRowsWhilePrinting,
|
|
747
781
|
apiRef,
|
|
748
782
|
store
|
|
749
783
|
}),
|
|
@@ -758,6 +792,7 @@ function useCreateDataTableContext({
|
|
|
758
792
|
estimatedRowHeight,
|
|
759
793
|
overscan,
|
|
760
794
|
generatedId,
|
|
795
|
+
showAllRowsWhilePrinting,
|
|
761
796
|
apiRef,
|
|
762
797
|
store
|
|
763
798
|
]
|
|
@@ -889,17 +924,19 @@ function useOnFieldLabelChange(cb, { fireImmediately = true } = {}) {
|
|
|
889
924
|
if (!store) {
|
|
890
925
|
return;
|
|
891
926
|
}
|
|
892
|
-
let
|
|
927
|
+
let prevCleanup;
|
|
893
928
|
const unsubscribe = store.subscribe(
|
|
894
929
|
(state) => state.label,
|
|
895
930
|
(label) => {
|
|
896
|
-
|
|
931
|
+
prevCleanup = cb(label);
|
|
897
932
|
},
|
|
898
933
|
{ fireImmediately }
|
|
899
934
|
);
|
|
900
935
|
return () => {
|
|
936
|
+
if (typeof prevCleanup === "function") {
|
|
937
|
+
prevCleanup();
|
|
938
|
+
}
|
|
901
939
|
unsubscribe();
|
|
902
|
-
cleanup?.();
|
|
903
940
|
};
|
|
904
941
|
}, [cb, fireImmediately, store]);
|
|
905
942
|
}
|
|
@@ -1212,15 +1249,15 @@ function LocalizationProvider({
|
|
|
1212
1249
|
onLocaleChange,
|
|
1213
1250
|
children
|
|
1214
1251
|
}) {
|
|
1215
|
-
const [
|
|
1252
|
+
const [locale7, setLocale] = useControllableState(
|
|
1216
1253
|
defaultLocale,
|
|
1217
1254
|
controlledLocale
|
|
1218
1255
|
);
|
|
1219
|
-
return
|
|
1256
|
+
return locale7 === void 0 ? children : /* @__PURE__ */ jsx(
|
|
1220
1257
|
LocalizationContext.Provider,
|
|
1221
1258
|
{
|
|
1222
1259
|
value: {
|
|
1223
|
-
locale,
|
|
1260
|
+
locale: locale7,
|
|
1224
1261
|
setLocale: combineEventHandlers(setLocale, onLocaleChange)
|
|
1225
1262
|
},
|
|
1226
1263
|
children
|
|
@@ -1360,6 +1397,7 @@ const Tooltip = forwardRef(function Tooltip2({
|
|
|
1360
1397
|
);
|
|
1361
1398
|
});
|
|
1362
1399
|
const TooltipProvider = Tooltip$1.Provider;
|
|
1400
|
+
const VisuallyHidden = VisuallyHidden$1.Root;
|
|
1363
1401
|
const IconButton = forwardRef(
|
|
1364
1402
|
function IconButton2({
|
|
1365
1403
|
asChild,
|
|
@@ -1373,6 +1411,8 @@ const IconButton = forwardRef(
|
|
|
1373
1411
|
disabled,
|
|
1374
1412
|
loading,
|
|
1375
1413
|
enabledWhenLoading,
|
|
1414
|
+
loadingLabel,
|
|
1415
|
+
disableTooltip,
|
|
1376
1416
|
iconProps,
|
|
1377
1417
|
spinnerProps,
|
|
1378
1418
|
tooltipProps,
|
|
@@ -1383,43 +1423,35 @@ const IconButton = forwardRef(
|
|
|
1383
1423
|
...otherProps
|
|
1384
1424
|
}, forwardedRef) {
|
|
1385
1425
|
const prefix = usePrefix();
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
);
|
|
1396
|
-
const spinnerEl = useMemo(
|
|
1397
|
-
() => /* @__PURE__ */ jsx(
|
|
1398
|
-
Spinner,
|
|
1399
|
-
{
|
|
1400
|
-
...spinnerProps,
|
|
1401
|
-
className: cx(
|
|
1402
|
-
prefix("icon-button__spinner"),
|
|
1403
|
-
spinnerProps?.className
|
|
1404
|
-
)
|
|
1405
|
-
}
|
|
1406
|
-
),
|
|
1407
|
-
[prefix, spinnerProps]
|
|
1426
|
+
const relevantLabel = loading ? loadingLabel ?? label : label;
|
|
1427
|
+
const labelEl = relevantLabel && /* @__PURE__ */ jsx(VisuallyHidden, { children: relevantLabel });
|
|
1428
|
+
const iconEl = icon && !loading && /* @__PURE__ */ jsx(Slot, { className: cx(prefix("icon-button__icon"), iconProps?.className), children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(Icon, { icon, fixedWidth: true, ...iconProps }) });
|
|
1429
|
+
const spinnerEl = loading && /* @__PURE__ */ jsx(
|
|
1430
|
+
Spinner,
|
|
1431
|
+
{
|
|
1432
|
+
...spinnerProps,
|
|
1433
|
+
className: cx(prefix("icon-button__spinner"), spinnerProps?.className)
|
|
1434
|
+
}
|
|
1408
1435
|
);
|
|
1409
|
-
let content =
|
|
1410
|
-
|
|
1436
|
+
let content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1437
|
+
spinnerEl,
|
|
1438
|
+
iconEl,
|
|
1439
|
+
labelEl
|
|
1440
|
+
] });
|
|
1441
|
+
if (asChild) {
|
|
1411
1442
|
content = cloneElement(children, void 0, content);
|
|
1412
1443
|
}
|
|
1444
|
+
const loadingDisabled = loading && !enabledWhenLoading;
|
|
1445
|
+
const visiblyDisabled = disabled || loadingDisabled;
|
|
1413
1446
|
const handleClick = useCallback(
|
|
1414
1447
|
(evt) => {
|
|
1415
|
-
if (
|
|
1448
|
+
if (visiblyDisabled) {
|
|
1416
1449
|
return evt.preventDefault();
|
|
1417
1450
|
}
|
|
1418
1451
|
return onClick?.(evt);
|
|
1419
1452
|
},
|
|
1420
|
-
[
|
|
1453
|
+
[onClick, visiblyDisabled]
|
|
1421
1454
|
);
|
|
1422
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading;
|
|
1423
1455
|
const As = asChild ? Slot : "button";
|
|
1424
1456
|
const button = /* @__PURE__ */ jsx(
|
|
1425
1457
|
As,
|
|
@@ -1434,23 +1466,23 @@ const IconButton = forwardRef(
|
|
|
1434
1466
|
),
|
|
1435
1467
|
onClick: handleClick,
|
|
1436
1468
|
"data-accent": color,
|
|
1437
|
-
disabled
|
|
1438
|
-
"data-disabled": boolDataAttr(asChild &&
|
|
1439
|
-
"aria-disabled": asChild &&
|
|
1469
|
+
disabled,
|
|
1470
|
+
"data-disabled": boolDataAttr(loadingDisabled || asChild && disabled),
|
|
1471
|
+
"aria-disabled": loadingDisabled || asChild && disabled ? "true" : void 0,
|
|
1440
1472
|
"data-active": boolDataAttr(active),
|
|
1441
|
-
tabIndex: asChild &&
|
|
1473
|
+
tabIndex: asChild && disabled ? -1 : void 0,
|
|
1442
1474
|
ref: forwardedRef,
|
|
1443
1475
|
...otherProps,
|
|
1444
1476
|
children: content
|
|
1445
1477
|
}
|
|
1446
1478
|
);
|
|
1447
|
-
return
|
|
1479
|
+
return relevantLabel && !disableTooltip ? /* @__PURE__ */ jsx(Tooltip, { ...tooltipProps, content: relevantLabel, children: button }) : button;
|
|
1448
1480
|
}
|
|
1449
1481
|
);
|
|
1450
1482
|
const CloseButton = forwardRef(
|
|
1451
1483
|
function CloseIconButton({ icon, label = null, className, ...otherProps }, forwardedRef) {
|
|
1452
1484
|
const prefix = usePrefix();
|
|
1453
|
-
const [
|
|
1485
|
+
const [locale7] = useLocale();
|
|
1454
1486
|
return /* @__PURE__ */ jsx(
|
|
1455
1487
|
IconButton,
|
|
1456
1488
|
{
|
|
@@ -1459,7 +1491,7 @@ const CloseButton = forwardRef(
|
|
|
1459
1491
|
circle: true,
|
|
1460
1492
|
icon: icon ?? faClose,
|
|
1461
1493
|
label,
|
|
1462
|
-
"aria-label":
|
|
1494
|
+
"aria-label": locale7.CloseButton["aria-label"],
|
|
1463
1495
|
...otherProps,
|
|
1464
1496
|
ref: forwardedRef
|
|
1465
1497
|
}
|
|
@@ -1647,45 +1679,40 @@ const Button = forwardRef(
|
|
|
1647
1679
|
...otherProps
|
|
1648
1680
|
}, forwardedRef) {
|
|
1649
1681
|
const prefix = usePrefix();
|
|
1650
|
-
const iconEl =
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
}
|
|
1661
|
-
),
|
|
1662
|
-
[icon, iconPlacement, iconProps, prefix]
|
|
1682
|
+
const iconEl = icon && !loading && /* @__PURE__ */ jsx(
|
|
1683
|
+
Slot,
|
|
1684
|
+
{
|
|
1685
|
+
className: cx(
|
|
1686
|
+
prefix("button__icon"),
|
|
1687
|
+
prefix(`button__icon--${iconPlacement}`),
|
|
1688
|
+
iconProps?.className
|
|
1689
|
+
),
|
|
1690
|
+
children: isValidElement(icon) ? icon : /* @__PURE__ */ jsx(Icon, { icon, ...iconProps })
|
|
1691
|
+
}
|
|
1663
1692
|
);
|
|
1664
|
-
const spinnerEl =
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
}
|
|
1675
|
-
),
|
|
1676
|
-
[iconPlacement, prefix, spinnerProps]
|
|
1693
|
+
const spinnerEl = loading && /* @__PURE__ */ jsx(
|
|
1694
|
+
Spinner,
|
|
1695
|
+
{
|
|
1696
|
+
...spinnerProps,
|
|
1697
|
+
className: cx(
|
|
1698
|
+
prefix("button__spinner"),
|
|
1699
|
+
prefix(`button__spinner--${iconPlacement}`),
|
|
1700
|
+
spinnerProps?.className
|
|
1701
|
+
)
|
|
1702
|
+
}
|
|
1677
1703
|
);
|
|
1678
1704
|
const content = loading && loadingContent ? asChild ? cloneElement(children, void 0, loadingContent) : loadingContent : children;
|
|
1705
|
+
const loadingDisabled = loading && !enabledWhenLoading;
|
|
1706
|
+
const visiblyDisabled = disabled || loadingDisabled;
|
|
1679
1707
|
const handleClick = useCallback(
|
|
1680
1708
|
(evt) => {
|
|
1681
|
-
if (
|
|
1709
|
+
if (visiblyDisabled) {
|
|
1682
1710
|
return evt.preventDefault();
|
|
1683
1711
|
}
|
|
1684
1712
|
return onClick?.(evt);
|
|
1685
1713
|
},
|
|
1686
|
-
[
|
|
1714
|
+
[onClick, visiblyDisabled]
|
|
1687
1715
|
);
|
|
1688
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading;
|
|
1689
1716
|
const As = asChild ? Slot : "button";
|
|
1690
1717
|
return /* @__PURE__ */ jsxs(
|
|
1691
1718
|
As,
|
|
@@ -1700,19 +1727,19 @@ const Button = forwardRef(
|
|
|
1700
1727
|
),
|
|
1701
1728
|
onClick: handleClick,
|
|
1702
1729
|
"data-accent": color,
|
|
1703
|
-
disabled
|
|
1704
|
-
"data-disabled": boolDataAttr(asChild &&
|
|
1705
|
-
"aria-disabled": asChild &&
|
|
1730
|
+
disabled,
|
|
1731
|
+
"data-disabled": boolDataAttr(loadingDisabled || asChild && disabled),
|
|
1732
|
+
"aria-disabled": loadingDisabled || asChild && disabled ? "true" : void 0,
|
|
1706
1733
|
"data-active": boolDataAttr(active),
|
|
1707
|
-
tabIndex: asChild &&
|
|
1734
|
+
tabIndex: asChild && disabled ? -1 : void 0,
|
|
1708
1735
|
ref: forwardedRef,
|
|
1709
1736
|
...otherProps,
|
|
1710
1737
|
children: [
|
|
1711
|
-
|
|
1712
|
-
|
|
1738
|
+
iconPlacement === "start" && spinnerEl,
|
|
1739
|
+
iconPlacement === "start" && iconEl,
|
|
1713
1740
|
/* @__PURE__ */ jsx(Slottable, { children: content }),
|
|
1714
|
-
|
|
1715
|
-
|
|
1741
|
+
iconPlacement === "end" && iconEl,
|
|
1742
|
+
iconPlacement === "end" && spinnerEl
|
|
1716
1743
|
]
|
|
1717
1744
|
}
|
|
1718
1745
|
);
|
|
@@ -1720,7 +1747,7 @@ const Button = forwardRef(
|
|
|
1720
1747
|
);
|
|
1721
1748
|
const AlertDialogProviderContext = createContext(void 0);
|
|
1722
1749
|
function AlertDialogProvider({ children }) {
|
|
1723
|
-
const [
|
|
1750
|
+
const [locale7] = useLocale();
|
|
1724
1751
|
const [open, setOpen] = useState(false);
|
|
1725
1752
|
const [content, setContent] = useState(null);
|
|
1726
1753
|
const resolveRef = useRef(null);
|
|
@@ -1734,7 +1761,7 @@ function AlertDialogProvider({ children }) {
|
|
|
1734
1761
|
setContent(
|
|
1735
1762
|
// XXX: This is a slight hack, but it makes sure that component
|
|
1736
1763
|
// state is not kept between new dialogs
|
|
1737
|
-
/* @__PURE__ */ jsx(Fragment, { children: renderContent(resolve) }, Math.random())
|
|
1764
|
+
/* @__PURE__ */ jsx(Fragment$1, { children: renderContent(resolve) }, Math.random())
|
|
1738
1765
|
);
|
|
1739
1766
|
setOpen(true);
|
|
1740
1767
|
}),
|
|
@@ -1748,7 +1775,7 @@ function AlertDialogProvider({ children }) {
|
|
|
1748
1775
|
size,
|
|
1749
1776
|
title,
|
|
1750
1777
|
extraBodyContent,
|
|
1751
|
-
okText =
|
|
1778
|
+
okText = locale7.AlertDialog.okText,
|
|
1752
1779
|
triggerElement,
|
|
1753
1780
|
contentProps,
|
|
1754
1781
|
headerProps,
|
|
@@ -1788,7 +1815,7 @@ function AlertDialogProvider({ children }) {
|
|
|
1788
1815
|
]
|
|
1789
1816
|
}
|
|
1790
1817
|
)),
|
|
1791
|
-
[
|
|
1818
|
+
[locale7.AlertDialog.okText, prompt]
|
|
1792
1819
|
);
|
|
1793
1820
|
const confirm = useCallback(
|
|
1794
1821
|
(description, {
|
|
@@ -1798,8 +1825,8 @@ function AlertDialogProvider({ children }) {
|
|
|
1798
1825
|
size,
|
|
1799
1826
|
title,
|
|
1800
1827
|
extraBodyContent,
|
|
1801
|
-
okText =
|
|
1802
|
-
cancelText =
|
|
1828
|
+
okText = locale7.ConfirmDialog.okText ?? locale7.AlertDialog.okText,
|
|
1829
|
+
cancelText = locale7.ConfirmDialog.cancelText,
|
|
1803
1830
|
triggerElement,
|
|
1804
1831
|
contentProps,
|
|
1805
1832
|
headerProps,
|
|
@@ -1857,9 +1884,9 @@ function AlertDialogProvider({ children }) {
|
|
|
1857
1884
|
}
|
|
1858
1885
|
)),
|
|
1859
1886
|
[
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1887
|
+
locale7.AlertDialog.okText,
|
|
1888
|
+
locale7.ConfirmDialog.cancelText,
|
|
1889
|
+
locale7.ConfirmDialog.okText,
|
|
1863
1890
|
prompt
|
|
1864
1891
|
]
|
|
1865
1892
|
);
|
|
@@ -2202,8 +2229,8 @@ const Toast = forwardRef(function Toast2({
|
|
|
2202
2229
|
});
|
|
2203
2230
|
const ToastDescription = Toast$1.Description;
|
|
2204
2231
|
function ToastProvider({ label, ...otherProps }) {
|
|
2205
|
-
const [
|
|
2206
|
-
label ??=
|
|
2232
|
+
const [locale7] = useLocale();
|
|
2233
|
+
label ??= locale7.ToastProvider.label;
|
|
2207
2234
|
return /* @__PURE__ */ jsx(Toast$1.Provider, { label, ...otherProps });
|
|
2208
2235
|
}
|
|
2209
2236
|
const ToastTitle = forwardRef(function ToastTitle2({ className, ...otherProps }, forwardedRef) {
|
|
@@ -2219,8 +2246,8 @@ const ToastTitle = forwardRef(function ToastTitle2({ className, ...otherProps },
|
|
|
2219
2246
|
});
|
|
2220
2247
|
const ToastViewport = forwardRef(function ToastViewport2({ label, className, ...otherProps }, forwardedRef) {
|
|
2221
2248
|
const prefix = usePrefix();
|
|
2222
|
-
const [
|
|
2223
|
-
label ??=
|
|
2249
|
+
const [locale7] = useLocale();
|
|
2250
|
+
label ??= locale7.ToastViewport.label;
|
|
2224
2251
|
return /* @__PURE__ */ jsx(
|
|
2225
2252
|
Toast$1.Viewport,
|
|
2226
2253
|
{
|
|
@@ -2533,11 +2560,11 @@ const ErrorBoundary = forwardRef(function ErrorBoundary2({
|
|
|
2533
2560
|
resetButtonProps,
|
|
2534
2561
|
...otherProps
|
|
2535
2562
|
}, forwardedRef) {
|
|
2536
|
-
const [
|
|
2563
|
+
const [locale7] = useLocale();
|
|
2537
2564
|
const reportError = useErrorReporter();
|
|
2538
|
-
fallbackTitle ??=
|
|
2539
|
-
fallbackMessage ??=
|
|
2540
|
-
resetButtonLabel ??=
|
|
2565
|
+
fallbackTitle ??= locale7.ErrorBoundary.fallbackTitle;
|
|
2566
|
+
fallbackMessage ??= locale7.ErrorBoundary.fallbackMessage;
|
|
2567
|
+
resetButtonLabel ??= locale7.ErrorBoundary.resetButtonLabel;
|
|
2541
2568
|
fallback ??= ({ error, resetErrorBoundary }) => /* @__PURE__ */ jsxs(
|
|
2542
2569
|
Alert,
|
|
2543
2570
|
{
|
|
@@ -2559,11 +2586,11 @@ const ErrorBoundary = forwardRef(function ErrorBoundary2({
|
|
|
2559
2586
|
}
|
|
2560
2587
|
),
|
|
2561
2588
|
children: [
|
|
2562
|
-
(!showError || !(error instanceof Error)) && /* @__PURE__ */ jsxs(Fragment
|
|
2589
|
+
(!showError || !(error instanceof Error)) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2563
2590
|
fallbackTitle && /* @__PURE__ */ jsx(AlertTitle, { children: typeof fallbackTitle === "function" ? fallbackTitle(error) : fallbackTitle }),
|
|
2564
2591
|
typeof fallbackMessage === "function" ? fallbackMessage(error) : fallbackMessage
|
|
2565
2592
|
] }),
|
|
2566
|
-
showError && error instanceof Error && /* @__PURE__ */ jsxs(Fragment
|
|
2593
|
+
showError && error instanceof Error && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2567
2594
|
/* @__PURE__ */ jsx(AlertTitle, { children: error.name }),
|
|
2568
2595
|
error.message,
|
|
2569
2596
|
/* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx(Code, { color: "danger", children: error.stack }) })
|
|
@@ -2592,13 +2619,13 @@ const RootElement = forwardRef(
|
|
|
2592
2619
|
...otherProps
|
|
2593
2620
|
}, forwardedRef) {
|
|
2594
2621
|
const prefix = usePrefix();
|
|
2595
|
-
const [
|
|
2622
|
+
const [locale7] = useLocale();
|
|
2596
2623
|
const errorBoundChildren = (children2) => /* @__PURE__ */ jsx(ErrorBoundary, { ...errorBoundaryProps, children: children2 });
|
|
2597
2624
|
const As = asChild ? Slot : "div";
|
|
2598
2625
|
return /* @__PURE__ */ jsx(
|
|
2599
2626
|
As,
|
|
2600
2627
|
{
|
|
2601
|
-
lang:
|
|
2628
|
+
lang: locale7.languageTag,
|
|
2602
2629
|
className: cx(prefix("root"), className),
|
|
2603
2630
|
...otherProps,
|
|
2604
2631
|
ref: forwardedRef,
|
|
@@ -2944,7 +2971,6 @@ function useResponsiveValues(options) {
|
|
|
2944
2971
|
]
|
|
2945
2972
|
);
|
|
2946
2973
|
}
|
|
2947
|
-
const VisuallyHidden = VisuallyHidden$1.Root;
|
|
2948
2974
|
const ControlCode = forwardRef(
|
|
2949
2975
|
function ControlCode2({
|
|
2950
2976
|
asChild,
|
|
@@ -2956,8 +2982,8 @@ const ControlCode = forwardRef(
|
|
|
2956
2982
|
...otherProps
|
|
2957
2983
|
}, forwardedRef) {
|
|
2958
2984
|
const prefix = usePrefix();
|
|
2959
|
-
const [
|
|
2960
|
-
visuallyHiddenPrefix ??=
|
|
2985
|
+
const [locale7] = useLocale();
|
|
2986
|
+
visuallyHiddenPrefix ??= locale7.ControlCode.visuallyHiddenPrefix;
|
|
2961
2987
|
const controlContext = useControlContext();
|
|
2962
2988
|
const As = asChild ? Slot : "div";
|
|
2963
2989
|
return /* @__PURE__ */ jsx(ControlContext.Provider, { value: null, children: /* @__PURE__ */ jsxs(
|
|
@@ -2979,6 +3005,242 @@ const ControlCode = forwardRef(
|
|
|
2979
3005
|
) });
|
|
2980
3006
|
}
|
|
2981
3007
|
);
|
|
3008
|
+
const PrinterContext = createContext(null);
|
|
3009
|
+
function usePrinterContext() {
|
|
3010
|
+
const printerContext = useContext(PrinterContext);
|
|
3011
|
+
if (!printerContext) {
|
|
3012
|
+
throw new Error("Printer context not in scope.");
|
|
3013
|
+
}
|
|
3014
|
+
return printerContext;
|
|
3015
|
+
}
|
|
3016
|
+
function usePrinterDocumentTitle() {
|
|
3017
|
+
return usePrinterContext().documentTitle;
|
|
3018
|
+
}
|
|
3019
|
+
function usePrintInProgress() {
|
|
3020
|
+
return useContext(PrinterContext)?.printInProgress ?? false;
|
|
3021
|
+
}
|
|
3022
|
+
function usePrint() {
|
|
3023
|
+
return usePrinterContext().print;
|
|
3024
|
+
}
|
|
3025
|
+
function Printer({
|
|
3026
|
+
preview,
|
|
3027
|
+
printInForeground,
|
|
3028
|
+
documentTitle,
|
|
3029
|
+
pageSize,
|
|
3030
|
+
pageMargin,
|
|
3031
|
+
printColorAdjust = "exact",
|
|
3032
|
+
fonts,
|
|
3033
|
+
copyShadowRoots,
|
|
3034
|
+
nonce,
|
|
3035
|
+
printFn,
|
|
3036
|
+
onBeforePrint,
|
|
3037
|
+
onAfterPrint,
|
|
3038
|
+
iframeProps,
|
|
3039
|
+
children
|
|
3040
|
+
}) {
|
|
3041
|
+
const prefix = usePrefix();
|
|
3042
|
+
const triggerRef = useRef(null);
|
|
3043
|
+
const contentRef = useRef(null);
|
|
3044
|
+
const [printInProgress, setPrintInProgress] = useState(false);
|
|
3045
|
+
const [printOptions, setPrintOptions] = useState(void 0);
|
|
3046
|
+
const resolvePrintRef = useRef(null);
|
|
3047
|
+
const rejectPrintRef = useRef(null);
|
|
3048
|
+
const pendingPromiseRef = useRef(null);
|
|
3049
|
+
const resolvePendingRef = useRef(null);
|
|
3050
|
+
const pendingTasksRef = useRef(0);
|
|
3051
|
+
const finishedTasksRef = useRef(0);
|
|
3052
|
+
const finishPrint = (focusTrigger = false) => {
|
|
3053
|
+
setPrintInProgress(false);
|
|
3054
|
+
setPrintOptions(void 0);
|
|
3055
|
+
resolvePrintRef.current = null;
|
|
3056
|
+
rejectPrintRef.current = null;
|
|
3057
|
+
pendingPromiseRef.current = null;
|
|
3058
|
+
resolvePendingRef.current = null;
|
|
3059
|
+
pendingTasksRef.current = 0;
|
|
3060
|
+
finishedTasksRef.current = 0;
|
|
3061
|
+
if (focusTrigger) {
|
|
3062
|
+
setTimeout(() => triggerRef.current?.focus(), 100);
|
|
3063
|
+
}
|
|
3064
|
+
};
|
|
3065
|
+
const reactToPrintFn = useReactToPrint({
|
|
3066
|
+
bodyClass: preview || printInForeground ? prefix("root") : void 0,
|
|
3067
|
+
documentTitle: printOptions?.documentTitle ?? document.title,
|
|
3068
|
+
pageStyle: printPageStyle({
|
|
3069
|
+
pageSize: printOptions?.pageSize ?? pageSize,
|
|
3070
|
+
pageMargin: printOptions?.pageMargin ?? pageMargin,
|
|
3071
|
+
printColorAdjust: printOptions?.printColorAdjust ?? printColorAdjust
|
|
3072
|
+
}),
|
|
3073
|
+
fonts: printOptions?.fonts ?? fonts,
|
|
3074
|
+
copyShadowRoots: printOptions?.copyShadowRoots ?? copyShadowRoots,
|
|
3075
|
+
nonce: printOptions?.nonce ?? nonce,
|
|
3076
|
+
printIframeProps: printOptions?.iframeProps ?? iframeProps,
|
|
3077
|
+
suppressErrors: process.env.NODE_ENV !== "production",
|
|
3078
|
+
print: printOptions?.printFn ?? printFn,
|
|
3079
|
+
onAfterPrint: () => {
|
|
3080
|
+
let event;
|
|
3081
|
+
try {
|
|
3082
|
+
onAfterPrint?.(event = new Event("ostack-ui.afterPrint"));
|
|
3083
|
+
} finally {
|
|
3084
|
+
resolvePrintRef.current();
|
|
3085
|
+
finishPrint(!event?.defaultPrevented);
|
|
3086
|
+
}
|
|
3087
|
+
},
|
|
3088
|
+
onPrintError: (_errorLocation, error) => {
|
|
3089
|
+
rejectPrintRef.current(error);
|
|
3090
|
+
finishPrint();
|
|
3091
|
+
}
|
|
3092
|
+
});
|
|
3093
|
+
const latest = useLatestValues({
|
|
3094
|
+
printInProgress,
|
|
3095
|
+
reactToPrintFn,
|
|
3096
|
+
documentTitle,
|
|
3097
|
+
onBeforePrint
|
|
3098
|
+
});
|
|
3099
|
+
const handlePrint = useCallback(
|
|
3100
|
+
async (options) => {
|
|
3101
|
+
const { printInProgress: printInProgress2, reactToPrintFn: reactToPrintFn2, documentTitle: documentTitle2, onBeforePrint: onBeforePrint2 } = latest;
|
|
3102
|
+
if (printInProgress2) {
|
|
3103
|
+
throw new Error("Printing is already in progress.");
|
|
3104
|
+
}
|
|
3105
|
+
flushSync(() => {
|
|
3106
|
+
setPrintInProgress(true);
|
|
3107
|
+
const documentTitleToUse = options?.documentTitle ?? documentTitle2;
|
|
3108
|
+
setPrintOptions({
|
|
3109
|
+
...options,
|
|
3110
|
+
documentTitle: typeof documentTitleToUse === "function" ? documentTitleToUse() : documentTitleToUse
|
|
3111
|
+
});
|
|
3112
|
+
});
|
|
3113
|
+
await pendingPromiseRef.current;
|
|
3114
|
+
if (onBeforePrint2) {
|
|
3115
|
+
const event = new Event("ostack-ui.print");
|
|
3116
|
+
await onBeforePrint2?.(event);
|
|
3117
|
+
if (event.defaultPrevented) {
|
|
3118
|
+
return finishPrint();
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
return new Promise((res, rej) => {
|
|
3122
|
+
reactToPrintFn2(() => contentRef.current);
|
|
3123
|
+
resolvePrintRef.current = res;
|
|
3124
|
+
rejectPrintRef.current = rej;
|
|
3125
|
+
});
|
|
3126
|
+
},
|
|
3127
|
+
[latest]
|
|
3128
|
+
);
|
|
3129
|
+
const startPrintingTask = useCallback(() => {
|
|
3130
|
+
if (pendingTasksRef.current++ === 0) {
|
|
3131
|
+
pendingPromiseRef.current = new Promise(
|
|
3132
|
+
(res) => resolvePendingRef.current = res
|
|
3133
|
+
);
|
|
3134
|
+
}
|
|
3135
|
+
}, [pendingPromiseRef, resolvePendingRef]);
|
|
3136
|
+
const finishPrintingTask = useCallback(() => {
|
|
3137
|
+
if (++finishedTasksRef.current >= pendingTasksRef.current) {
|
|
3138
|
+
void Promise.resolve().then(() => {
|
|
3139
|
+
if (finishedTasksRef.current >= pendingTasksRef.current) {
|
|
3140
|
+
resolvePendingRef.current();
|
|
3141
|
+
}
|
|
3142
|
+
});
|
|
3143
|
+
}
|
|
3144
|
+
}, [resolvePendingRef]);
|
|
3145
|
+
return /* @__PURE__ */ jsx(
|
|
3146
|
+
PrinterContext.Provider,
|
|
3147
|
+
{
|
|
3148
|
+
value: {
|
|
3149
|
+
preview,
|
|
3150
|
+
printInForeground,
|
|
3151
|
+
documentTitle,
|
|
3152
|
+
printInProgress,
|
|
3153
|
+
triggerRef,
|
|
3154
|
+
contentRef,
|
|
3155
|
+
print: handlePrint,
|
|
3156
|
+
startPrintingTask,
|
|
3157
|
+
finishPrintingTask
|
|
3158
|
+
},
|
|
3159
|
+
children
|
|
3160
|
+
}
|
|
3161
|
+
);
|
|
3162
|
+
}
|
|
3163
|
+
function printPageStyle({
|
|
3164
|
+
pageSize,
|
|
3165
|
+
pageMargin,
|
|
3166
|
+
printColorAdjust
|
|
3167
|
+
}) {
|
|
3168
|
+
let pageStyle = `@media print {
|
|
3169
|
+
html, body { margin: 0 }
|
|
3170
|
+
body {
|
|
3171
|
+
color-adjust: ${printColorAdjust};
|
|
3172
|
+
print-color-adjust: ${printColorAdjust};
|
|
3173
|
+
-webkit-print-color-adjust: ${printColorAdjust};
|
|
3174
|
+
}
|
|
3175
|
+
}`;
|
|
3176
|
+
if (pageSize != null) {
|
|
3177
|
+
pageStyle += `@page { size: ${pageSize} }`;
|
|
3178
|
+
}
|
|
3179
|
+
if (pageMargin != null) {
|
|
3180
|
+
pageStyle += `@page { margin: ${pageMargin} }`;
|
|
3181
|
+
}
|
|
3182
|
+
return pageStyle;
|
|
3183
|
+
}
|
|
3184
|
+
function usePrintClassNames() {
|
|
3185
|
+
const prefix = usePrefix();
|
|
3186
|
+
return {
|
|
3187
|
+
printOnly: prefix("print-only"),
|
|
3188
|
+
printHidden: prefix("print-hidden")
|
|
3189
|
+
};
|
|
3190
|
+
}
|
|
3191
|
+
const PrinterContent = forwardRef(function PrinterContent2({ asChild, printOnly, portalContainer, className, children, ...otherProps }, forwardedRef) {
|
|
3192
|
+
const { printOnly: printOnlyClassName } = usePrintClassNames();
|
|
3193
|
+
const {
|
|
3194
|
+
preview,
|
|
3195
|
+
printInForeground,
|
|
3196
|
+
printInProgress,
|
|
3197
|
+
contentRef,
|
|
3198
|
+
startPrintingTask,
|
|
3199
|
+
finishPrintingTask
|
|
3200
|
+
} = usePrinterContext();
|
|
3201
|
+
const printing = preview || printInProgress;
|
|
3202
|
+
const contentContext = useMemo(
|
|
3203
|
+
() => ({
|
|
3204
|
+
printing,
|
|
3205
|
+
startPrintingTask: printing ? startPrintingTask : void 0,
|
|
3206
|
+
finishPrintingTask: printing ? finishPrintingTask : void 0
|
|
3207
|
+
}),
|
|
3208
|
+
[finishPrintingTask, printing, startPrintingTask]
|
|
3209
|
+
);
|
|
3210
|
+
const As = asChild ? Slot : "div";
|
|
3211
|
+
const combinedRef = useCombinedRef(contentRef, forwardedRef);
|
|
3212
|
+
const content = /* @__PURE__ */ jsx(
|
|
3213
|
+
As,
|
|
3214
|
+
{
|
|
3215
|
+
className: cx(!preview && printOnlyClassName, className),
|
|
3216
|
+
...otherProps,
|
|
3217
|
+
ref: combinedRef,
|
|
3218
|
+
children
|
|
3219
|
+
}
|
|
3220
|
+
);
|
|
3221
|
+
return preview || printInForeground ? /* @__PURE__ */ jsx(PrinterContentContext.Provider, { value: contentContext, children: content }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3222
|
+
!printOnly && /* @__PURE__ */ jsx(PrinterContentContext.Provider, { value: { printing: false }, children }),
|
|
3223
|
+
printInProgress && /* @__PURE__ */ jsx(PrinterContentContext.Provider, { value: contentContext, children: /* @__PURE__ */ jsx(Portal, { container: portalContainer, asChild: true, children: content }) })
|
|
3224
|
+
] });
|
|
3225
|
+
});
|
|
3226
|
+
const PrinterTrigger = forwardRef(function PrinterTrigger2({ showWhenPrinting, className, onClick, ...otherProps }, forwardedRef) {
|
|
3227
|
+
const { printHidden } = usePrintClassNames();
|
|
3228
|
+
const { printInProgress, triggerRef, print } = usePrinterContext();
|
|
3229
|
+
const printing = usePrinting();
|
|
3230
|
+
const combinedRef = useCombinedRef(triggerRef, forwardedRef);
|
|
3231
|
+
return /* @__PURE__ */ jsx(
|
|
3232
|
+
Slot,
|
|
3233
|
+
{
|
|
3234
|
+
className: cx(!showWhenPrinting && printHidden, className),
|
|
3235
|
+
onClick: combineEventHandlers(onClick, () => print(), {
|
|
3236
|
+
checkDefaultPrevented: true
|
|
3237
|
+
}),
|
|
3238
|
+
disabled: printInProgress && !printing,
|
|
3239
|
+
...otherProps,
|
|
3240
|
+
ref: combinedRef
|
|
3241
|
+
}
|
|
3242
|
+
);
|
|
3243
|
+
});
|
|
2982
3244
|
function useScrollPosition(element, setScrollPosition) {
|
|
2983
3245
|
useEffect(() => {
|
|
2984
3246
|
if (!element) {
|
|
@@ -3402,8 +3664,8 @@ const TableHead = forwardRef(
|
|
|
3402
3664
|
...otherProps
|
|
3403
3665
|
}, forwardedRef) {
|
|
3404
3666
|
const prefix = usePrefix();
|
|
3405
|
-
const [
|
|
3406
|
-
sortByColumnDescription ??=
|
|
3667
|
+
const [locale7] = useLocale();
|
|
3668
|
+
sortByColumnDescription ??= locale7.TableHead.sortByColumnDescription;
|
|
3407
3669
|
const {
|
|
3408
3670
|
status: tableStatus,
|
|
3409
3671
|
layout,
|
|
@@ -3416,6 +3678,7 @@ const TableHead = forwardRef(
|
|
|
3416
3678
|
() => Array.from({ length: nRows }, (_, i) => columnsOfRow(columns, i)),
|
|
3417
3679
|
[columns, nRows]
|
|
3418
3680
|
);
|
|
3681
|
+
const { printHidden } = usePrintClassNames();
|
|
3419
3682
|
const generatedId = useId();
|
|
3420
3683
|
const tableHeadRef = useRef(null);
|
|
3421
3684
|
useEffect(
|
|
@@ -3459,7 +3722,7 @@ const TableHead = forwardRef(
|
|
|
3459
3722
|
label,
|
|
3460
3723
|
labelText = typeof label === "string" ? label : "",
|
|
3461
3724
|
helperText,
|
|
3462
|
-
helperButtonLabel =
|
|
3725
|
+
helperButtonLabel = locale7.TableColumn.helperButtonLabel,
|
|
3463
3726
|
width,
|
|
3464
3727
|
fixed: _fixed,
|
|
3465
3728
|
header = true,
|
|
@@ -3494,6 +3757,7 @@ const TableHead = forwardRef(
|
|
|
3494
3757
|
...helperButtonProps,
|
|
3495
3758
|
className: cx(
|
|
3496
3759
|
prefix("table__column-helper-button"),
|
|
3760
|
+
printHidden,
|
|
3497
3761
|
helperButtonProps?.className
|
|
3498
3762
|
)
|
|
3499
3763
|
}
|
|
@@ -3762,15 +4026,17 @@ const DataTable = forwardRef(
|
|
|
3762
4026
|
dynamicRowHeight = false,
|
|
3763
4027
|
estimatedRowHeight = DEFAULT_TABLE_ROW_HEIGHT,
|
|
3764
4028
|
overscan = 5,
|
|
4029
|
+
showAllRowsWhilePrinting,
|
|
3765
4030
|
apiRef,
|
|
3766
4031
|
className,
|
|
3767
4032
|
...otherProps
|
|
3768
4033
|
}, forwardedRef) {
|
|
3769
4034
|
const prefix = usePrefix();
|
|
4035
|
+
const printing = usePrinting();
|
|
3770
4036
|
const leaves = useMemo(() => leafColumns(columns), [columns]);
|
|
3771
4037
|
const headCount = useMemo(() => numberOfRows(columns), [columns]);
|
|
3772
4038
|
const dataTableContextValue = useCreateDataTableContext({
|
|
3773
|
-
displayMode,
|
|
4039
|
+
displayMode: printing ? "paged" : displayMode,
|
|
3774
4040
|
columns,
|
|
3775
4041
|
rows,
|
|
3776
4042
|
getRows,
|
|
@@ -3783,6 +4049,7 @@ const DataTable = forwardRef(
|
|
|
3783
4049
|
dynamicRowHeight,
|
|
3784
4050
|
estimatedRowHeight,
|
|
3785
4051
|
overscan,
|
|
4052
|
+
showAllRowsWhilePrinting,
|
|
3786
4053
|
apiRef,
|
|
3787
4054
|
leafColumns: leaves,
|
|
3788
4055
|
headCount,
|
|
@@ -3947,9 +4214,10 @@ const Label = forwardRef(function Label2({
|
|
|
3947
4214
|
...otherProps
|
|
3948
4215
|
}, forwardedRef) {
|
|
3949
4216
|
const prefix = usePrefix();
|
|
3950
|
-
const [
|
|
3951
|
-
requiredIconLabel ??=
|
|
3952
|
-
helperButtonLabel ??=
|
|
4217
|
+
const [locale7] = useLocale();
|
|
4218
|
+
requiredIconLabel ??= locale7.Label.requiredIconLabel;
|
|
4219
|
+
helperButtonLabel ??= locale7.Label.helperButtonLabel;
|
|
4220
|
+
const { printHidden } = usePrintClassNames();
|
|
3953
4221
|
const labelId = useSetFieldLabel(children, id);
|
|
3954
4222
|
const controlId = useFieldControlId();
|
|
3955
4223
|
const controlTagName = useFieldControlTagName();
|
|
@@ -4027,6 +4295,7 @@ const Label = forwardRef(function Label2({
|
|
|
4027
4295
|
...helperButtonProps,
|
|
4028
4296
|
className: cx(
|
|
4029
4297
|
prefix("label__helper-button"),
|
|
4298
|
+
printHidden,
|
|
4030
4299
|
helperButtonProps?.className
|
|
4031
4300
|
)
|
|
4032
4301
|
}
|
|
@@ -4419,7 +4688,7 @@ const DataTableRow = memo(
|
|
|
4419
4688
|
columnName,
|
|
4420
4689
|
{
|
|
4421
4690
|
filterable,
|
|
4422
|
-
locale,
|
|
4691
|
+
locale: locale7,
|
|
4423
4692
|
subColumns: _subColumns,
|
|
4424
4693
|
getValue,
|
|
4425
4694
|
format: format2,
|
|
@@ -4451,9 +4720,9 @@ const DataTableRow = memo(
|
|
|
4451
4720
|
const match = !loadingRow && filterable ? matchAgainstFilter(
|
|
4452
4721
|
formattedValue,
|
|
4453
4722
|
filter,
|
|
4454
|
-
|
|
4723
|
+
locale7 ?? "pt-PT"
|
|
4455
4724
|
) : null;
|
|
4456
|
-
const markedValue = match == null ? formattedValue : /* @__PURE__ */ jsxs(Fragment
|
|
4725
|
+
const markedValue = match == null ? formattedValue : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4457
4726
|
match.before,
|
|
4458
4727
|
/* @__PURE__ */ jsx(Mark, { children: match.matched }),
|
|
4459
4728
|
match.after
|
|
@@ -4476,7 +4745,7 @@ const DataTableRow = memo(
|
|
|
4476
4745
|
index
|
|
4477
4746
|
}) : markedValue
|
|
4478
4747
|
};
|
|
4479
|
-
return renderCell ? /* @__PURE__ */ jsx(Fragment, { children: renderCell(props) }, columnName) : /* @__PURE__ */ jsx(DataTableCell, { ...props }, columnName);
|
|
4748
|
+
return renderCell ? /* @__PURE__ */ jsx(Fragment$1, { children: renderCell(props) }, columnName) : /* @__PURE__ */ jsx(DataTableCell, { ...props }, columnName);
|
|
4480
4749
|
}
|
|
4481
4750
|
)
|
|
4482
4751
|
}
|
|
@@ -4508,7 +4777,7 @@ function DataTableEmptyOrLoadingRows({
|
|
|
4508
4777
|
return loading ? Array.from({ length: loadingCount }, (_, i) => {
|
|
4509
4778
|
const props = { row: void 0, index: i };
|
|
4510
4779
|
const key = `loading-${i}`;
|
|
4511
|
-
return renderRow ? /* @__PURE__ */ jsx(Fragment, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
4780
|
+
return renderRow ? /* @__PURE__ */ jsx(Fragment$1, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
4512
4781
|
}) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { paddingless: false, colSpan: numberOfColumns2, children: !loading && /* @__PURE__ */ jsx(
|
|
4513
4782
|
"div",
|
|
4514
4783
|
{
|
|
@@ -4521,7 +4790,9 @@ function DataTableEmptyOrLoadingRows({
|
|
|
4521
4790
|
) }) });
|
|
4522
4791
|
}
|
|
4523
4792
|
function PagedDataTableRows() {
|
|
4524
|
-
const { rowKey, renderRow, apiRef, store } = useDataTableContext();
|
|
4793
|
+
const { rowKey, renderRow, showAllRowsWhilePrinting, apiRef, store } = useDataTableContext();
|
|
4794
|
+
const printing = usePrinting();
|
|
4795
|
+
const showAllRows = showAllRowsWhilePrinting && printing;
|
|
4525
4796
|
const splice = useCallback(
|
|
4526
4797
|
(startIndex, deleted = 0, added = 0) => {
|
|
4527
4798
|
const { pageOffset: pageOffset2, limit, actions } = store.getState();
|
|
@@ -4553,20 +4824,23 @@ function PagedDataTableRows() {
|
|
|
4553
4824
|
),
|
|
4554
4825
|
[goTo, store]
|
|
4555
4826
|
);
|
|
4556
|
-
const pageOffset = useStore(
|
|
4827
|
+
const pageOffset = useStore(
|
|
4828
|
+
store,
|
|
4829
|
+
(state) => showAllRows ? 0 : state.pageOffset()
|
|
4830
|
+
);
|
|
4557
4831
|
const rowsWindow = useStore(
|
|
4558
4832
|
store,
|
|
4559
4833
|
useShallow(
|
|
4560
4834
|
(state) => state.rowsWindow(
|
|
4561
|
-
state.pageOffset(),
|
|
4562
|
-
state.pageLimit() ?? state.loadingCount
|
|
4835
|
+
showAllRows ? 0 : state.pageOffset(),
|
|
4836
|
+
(showAllRows ? state.totalCount() : state.pageLimit()) ?? state.loadingCount
|
|
4563
4837
|
)
|
|
4564
4838
|
)
|
|
4565
4839
|
);
|
|
4566
4840
|
return rowsWindow.map((row, i) => {
|
|
4567
4841
|
const props = { row, index: pageOffset + i };
|
|
4568
4842
|
const key = row ? `row-${getRowKey(row, rowKey)}` : `loading-${i}`;
|
|
4569
|
-
return renderRow ? /* @__PURE__ */ jsx(Fragment, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
4843
|
+
return renderRow ? /* @__PURE__ */ jsx(Fragment$1, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
4570
4844
|
});
|
|
4571
4845
|
}
|
|
4572
4846
|
function ScrolledDataTableRows({
|
|
@@ -4696,7 +4970,7 @@ function ScrolledDataTableRows({
|
|
|
4696
4970
|
});
|
|
4697
4971
|
});
|
|
4698
4972
|
}, [endIndex, startIndex, store]);
|
|
4699
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
4973
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4700
4974
|
/* @__PURE__ */ jsx("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
4701
4975
|
"td",
|
|
4702
4976
|
{
|
|
@@ -4719,7 +4993,7 @@ function ScrolledDataTableRows({
|
|
|
4719
4993
|
ref: dynamicRowHeight ? virtualizer.measureElement : void 0
|
|
4720
4994
|
};
|
|
4721
4995
|
const key = rowsWindow[i] ? `row-${getRowKey(rowsWindow[i], rowKey)}` : `loading-${i}`;
|
|
4722
|
-
return renderRow ? /* @__PURE__ */ jsx(Fragment, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
4996
|
+
return renderRow ? /* @__PURE__ */ jsx(Fragment$1, { children: renderRow(props) }, key) : /* @__PURE__ */ jsx(DataTableRow, { ...props }, key);
|
|
4723
4997
|
}),
|
|
4724
4998
|
/* @__PURE__ */ jsx("tr", { "aria-hidden": "true", children: /* @__PURE__ */ jsx(
|
|
4725
4999
|
"td",
|
|
@@ -4881,8 +5155,8 @@ const DataTableContent = forwardRef(function DataTable2({
|
|
|
4881
5155
|
...otherProps
|
|
4882
5156
|
}, forwardedRef) {
|
|
4883
5157
|
const prefix = usePrefix();
|
|
4884
|
-
const [
|
|
4885
|
-
emptyMessage ??=
|
|
5158
|
+
const [locale7] = useLocale();
|
|
5159
|
+
emptyMessage ??= locale7.DataTable.emptyMessage;
|
|
4886
5160
|
const { displayMode, required, estimatedRowHeight, store } = useDataTableContext();
|
|
4887
5161
|
const tableRef = useRef(null);
|
|
4888
5162
|
const containerRef = useRef(null);
|
|
@@ -4960,9 +5234,9 @@ const DataTableFilter = forwardRef(function DataTableFilter2({
|
|
|
4960
5234
|
...otherProps
|
|
4961
5235
|
}, forwardedRef) {
|
|
4962
5236
|
const prefix = usePrefix();
|
|
4963
|
-
const [
|
|
4964
|
-
ariaLabel ??=
|
|
4965
|
-
placeholder ??=
|
|
5237
|
+
const [locale7] = useLocale();
|
|
5238
|
+
ariaLabel ??= locale7.DataTableFilter["aria-label"];
|
|
5239
|
+
placeholder ??= locale7.DataTableFilter.placeholder;
|
|
4966
5240
|
const { store } = useDataTableContext();
|
|
4967
5241
|
const filter = useStore(store, (state) => state.filter);
|
|
4968
5242
|
const handleFilterChange = (value) => {
|
|
@@ -5111,12 +5385,13 @@ const DataTablePagination = forwardRef(function DataTablePagination2({
|
|
|
5111
5385
|
nextPageButtonProps,
|
|
5112
5386
|
...otherProps
|
|
5113
5387
|
}, forwardedRef) {
|
|
5114
|
-
const [
|
|
5115
|
-
rowsRange ??=
|
|
5116
|
-
previousPageButtonLabel ??=
|
|
5117
|
-
nextPageButtonLabel ??=
|
|
5118
|
-
const { displayMode } = useDataTableContext();
|
|
5119
|
-
|
|
5388
|
+
const [locale7] = useLocale();
|
|
5389
|
+
rowsRange ??= locale7.DataTablePagination.rowsRange;
|
|
5390
|
+
previousPageButtonLabel ??= locale7.DataTablePagination.previousPageButtonLabel;
|
|
5391
|
+
nextPageButtonLabel ??= locale7.DataTablePagination.nextPageButtonLabel;
|
|
5392
|
+
const { displayMode, showAllRowsWhilePrinting } = useDataTableContext();
|
|
5393
|
+
const printing = usePrinting();
|
|
5394
|
+
return printing && showAllRowsWhilePrinting ? null : displayMode === "paged" ? /* @__PURE__ */ jsx(
|
|
5120
5395
|
PagedDataTablePagination,
|
|
5121
5396
|
{
|
|
5122
5397
|
...otherProps,
|
|
@@ -5144,8 +5419,8 @@ const DataTableRowsPerPage = forwardRef(function DataTableRowsPerPage2({
|
|
|
5144
5419
|
...otherProps
|
|
5145
5420
|
}, forwardedRef) {
|
|
5146
5421
|
const prefix = usePrefix();
|
|
5147
|
-
const [
|
|
5148
|
-
label ??=
|
|
5422
|
+
const [locale7] = useLocale();
|
|
5423
|
+
label ??= locale7.DataTableRowsPerPage.label;
|
|
5149
5424
|
const { store } = useDataTableContext();
|
|
5150
5425
|
const limit = useStore(store, (state) => state.limit);
|
|
5151
5426
|
const { setLimit } = useStore(store, (state) => state.actions);
|
|
@@ -5249,12 +5524,13 @@ const Input = forwardRef(
|
|
|
5249
5524
|
...otherProps
|
|
5250
5525
|
}, forwardedRef) {
|
|
5251
5526
|
const prefix = usePrefix();
|
|
5252
|
-
const [
|
|
5253
|
-
clearButtonLabel ??=
|
|
5527
|
+
const [locale7] = useLocale();
|
|
5528
|
+
clearButtonLabel ??= locale7.Input.clearButtonLabel;
|
|
5254
5529
|
const { responsiveValuesToCssVarsAndDataAttrs } = useResponsiveValues();
|
|
5255
5530
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
5256
5531
|
const descriptionIds = useFieldDescriptionIds();
|
|
5257
5532
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
5533
|
+
const { printHidden } = usePrintClassNames();
|
|
5258
5534
|
const [inputEl, setInputEl] = useState(null);
|
|
5259
5535
|
const { controlId, codeId } = useSetFieldControl(
|
|
5260
5536
|
id,
|
|
@@ -5456,6 +5732,7 @@ const Input = forwardRef(
|
|
|
5456
5732
|
...clearButtonProps,
|
|
5457
5733
|
className: cx(
|
|
5458
5734
|
prefix("input__clear-button"),
|
|
5735
|
+
printHidden,
|
|
5459
5736
|
clearButtonProps?.className
|
|
5460
5737
|
),
|
|
5461
5738
|
onClick: combineEventHandlers(
|
|
@@ -5735,12 +6012,12 @@ const CommandMenu = forwardRef(
|
|
|
5735
6012
|
...otherProps
|
|
5736
6013
|
}, forwardedRef) {
|
|
5737
6014
|
const prefix = usePrefix();
|
|
5738
|
-
const [
|
|
5739
|
-
label ??=
|
|
5740
|
-
searchPlaceholder ??=
|
|
5741
|
-
emptyMessage ??=
|
|
5742
|
-
listLabel ??=
|
|
5743
|
-
loadingLabel ??=
|
|
6015
|
+
const [locale7] = useLocale();
|
|
6016
|
+
label ??= locale7.CommandMenu.label;
|
|
6017
|
+
searchPlaceholder ??= locale7.CommandMenu.searchPlaceholder;
|
|
6018
|
+
emptyMessage ??= locale7.CommandMenu.emptyMessage;
|
|
6019
|
+
listLabel ??= locale7.CommandMenu.listLabel;
|
|
6020
|
+
loadingLabel ??= locale7.CommandMenu.loadingLabel;
|
|
5744
6021
|
const searchAdornmentEl = /* @__PURE__ */ jsx(
|
|
5745
6022
|
ControlAddon,
|
|
5746
6023
|
{
|
|
@@ -5870,9 +6147,9 @@ const CommandMenuDialog = forwardRef(function CommandMenuDialog2({
|
|
|
5870
6147
|
...otherProps
|
|
5871
6148
|
}, forwardedRef) {
|
|
5872
6149
|
const prefix = usePrefix();
|
|
5873
|
-
const [
|
|
5874
|
-
title ??=
|
|
5875
|
-
description ??=
|
|
6150
|
+
const [locale7] = useLocale();
|
|
6151
|
+
title ??= locale7.CommandMenuDialog.title;
|
|
6152
|
+
description ??= locale7.CommandMenuDialog.description;
|
|
5876
6153
|
const portalContext = usePortalContext();
|
|
5877
6154
|
return /* @__PURE__ */ jsx(
|
|
5878
6155
|
Dialog$1.Root,
|
|
@@ -6008,7 +6285,6 @@ const SelectContext = createContext(null);
|
|
|
6008
6285
|
function useCreateSelectContext({
|
|
6009
6286
|
multiple,
|
|
6010
6287
|
value,
|
|
6011
|
-
setValue,
|
|
6012
6288
|
onOptionSelect,
|
|
6013
6289
|
status,
|
|
6014
6290
|
disabled,
|
|
@@ -6039,7 +6315,6 @@ function useCreateSelectContext({
|
|
|
6039
6315
|
() => ({
|
|
6040
6316
|
multiple,
|
|
6041
6317
|
value,
|
|
6042
|
-
setValue,
|
|
6043
6318
|
onOptionSelect,
|
|
6044
6319
|
status,
|
|
6045
6320
|
disabled,
|
|
@@ -6052,7 +6327,6 @@ function useCreateSelectContext({
|
|
|
6052
6327
|
multiple,
|
|
6053
6328
|
onOptionSelect,
|
|
6054
6329
|
readOnly,
|
|
6055
|
-
setValue,
|
|
6056
6330
|
status,
|
|
6057
6331
|
store,
|
|
6058
6332
|
value,
|
|
@@ -6166,6 +6440,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
6166
6440
|
...otherProps
|
|
6167
6441
|
}, forwardedRef) {
|
|
6168
6442
|
const prefix = usePrefix();
|
|
6443
|
+
const { printHidden } = usePrintClassNames();
|
|
6169
6444
|
const iconEl = useMemo(
|
|
6170
6445
|
() => icon && /* @__PURE__ */ jsx(
|
|
6171
6446
|
Icon,
|
|
@@ -6225,6 +6500,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
6225
6500
|
...closeButtonProps,
|
|
6226
6501
|
className: cx(
|
|
6227
6502
|
prefix("tag__close-button"),
|
|
6503
|
+
printHidden,
|
|
6228
6504
|
closeButtonProps?.className
|
|
6229
6505
|
)
|
|
6230
6506
|
}
|
|
@@ -6240,14 +6516,22 @@ const Tag = forwardRef(function Tag2({
|
|
|
6240
6516
|
const Badge = Tag;
|
|
6241
6517
|
function SelectMultipleValue() {
|
|
6242
6518
|
const prefix = usePrefix();
|
|
6243
|
-
const {
|
|
6519
|
+
const {
|
|
6520
|
+
value,
|
|
6521
|
+
onOptionSelect,
|
|
6522
|
+
status,
|
|
6523
|
+
disabled,
|
|
6524
|
+
readOnly,
|
|
6525
|
+
valueTagProps,
|
|
6526
|
+
store
|
|
6527
|
+
} = useSelectContext();
|
|
6244
6528
|
useStore(store, (state) => state.actions.getOptionState(value));
|
|
6245
6529
|
const handleCloseValueTag = useCallback(
|
|
6246
6530
|
(tagValue, evt) => {
|
|
6247
6531
|
evt.preventDefault();
|
|
6248
|
-
|
|
6532
|
+
onOptionSelect(tagValue);
|
|
6249
6533
|
},
|
|
6250
|
-
[
|
|
6534
|
+
[onOptionSelect]
|
|
6251
6535
|
);
|
|
6252
6536
|
const valuesToRender = useMemo(
|
|
6253
6537
|
() => Array.from(new Set(value)),
|
|
@@ -6260,7 +6544,7 @@ function SelectMultipleValue() {
|
|
|
6260
6544
|
)
|
|
6261
6545
|
);
|
|
6262
6546
|
const valuesList = useMemo(
|
|
6263
|
-
() => valuesOptionStates.map((optionState, i) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6547
|
+
() => valuesOptionStates.map((optionState, i) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
6264
6548
|
i === 0 ? "" : ", ",
|
|
6265
6549
|
optionState?.content
|
|
6266
6550
|
] }, i)),
|
|
@@ -6323,9 +6607,9 @@ function SelectMultipleValue() {
|
|
|
6323
6607
|
valuesToRender
|
|
6324
6608
|
]
|
|
6325
6609
|
);
|
|
6326
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
6610
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6327
6611
|
valuesToRender.length > 0 && readOnly && valuesList,
|
|
6328
|
-
valuesToRender.length > 0 && !readOnly && /* @__PURE__ */ jsxs(Fragment
|
|
6612
|
+
valuesToRender.length > 0 && !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6329
6613
|
/* @__PURE__ */ jsx(VisuallyHidden, { children: valuesList }),
|
|
6330
6614
|
valuesTags
|
|
6331
6615
|
] })
|
|
@@ -6385,13 +6669,14 @@ const Select = forwardRef(function Select2({
|
|
|
6385
6669
|
...otherProps
|
|
6386
6670
|
}, forwardedRef) {
|
|
6387
6671
|
const prefix = usePrefix();
|
|
6388
|
-
const [
|
|
6389
|
-
searchPlaceholder ??=
|
|
6390
|
-
emptyMessage ??=
|
|
6391
|
-
optionsLabel ??=
|
|
6392
|
-
loadingOptionsLabel ??=
|
|
6672
|
+
const [locale7] = useLocale();
|
|
6673
|
+
searchPlaceholder ??= locale7.Select.searchPlaceholder;
|
|
6674
|
+
emptyMessage ??= locale7.Select.emptyMessage;
|
|
6675
|
+
optionsLabel ??= locale7.Select.optionsLabel;
|
|
6676
|
+
loadingOptionsLabel ??= locale7.Select.loadingOptionsLabel;
|
|
6393
6677
|
const { cssVarStyle } = useCssVars();
|
|
6394
6678
|
const labelId = useFieldLabelId();
|
|
6679
|
+
const { printHidden } = usePrintClassNames();
|
|
6395
6680
|
const [open, setOpen] = useControllableState(
|
|
6396
6681
|
defaultOpen ?? false,
|
|
6397
6682
|
controlledOpen
|
|
@@ -6483,7 +6768,6 @@ const Select = forwardRef(function Select2({
|
|
|
6483
6768
|
const selectContext = useCreateSelectContext({
|
|
6484
6769
|
multiple,
|
|
6485
6770
|
value: actualValue,
|
|
6486
|
-
setValue,
|
|
6487
6771
|
onOptionSelect: handleOptionSelect,
|
|
6488
6772
|
status,
|
|
6489
6773
|
disabled,
|
|
@@ -6539,13 +6823,14 @@ const Select = forwardRef(function Select2({
|
|
|
6539
6823
|
required,
|
|
6540
6824
|
loading: loading || loadingOptions,
|
|
6541
6825
|
startAdornment,
|
|
6542
|
-
endAdornment: /* @__PURE__ */ jsxs(Fragment
|
|
6826
|
+
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6543
6827
|
!readOnly && /* @__PURE__ */ jsx(
|
|
6544
6828
|
Icon,
|
|
6545
6829
|
{
|
|
6546
6830
|
icon: showOpen ? faChevronUp : faChevronDown,
|
|
6547
6831
|
className: cx(
|
|
6548
6832
|
prefix("select__arrow"),
|
|
6833
|
+
printHidden,
|
|
6549
6834
|
arrowProps?.className
|
|
6550
6835
|
),
|
|
6551
6836
|
"data-status": status,
|
|
@@ -6681,7 +6966,7 @@ const CalendarMonthCaption = memo(function CalendarMonthCaption2({
|
|
|
6681
6966
|
onNextClick,
|
|
6682
6967
|
disableNavigation,
|
|
6683
6968
|
pagedNavigation,
|
|
6684
|
-
locale
|
|
6969
|
+
locale: locale7
|
|
6685
6970
|
}
|
|
6686
6971
|
} = useDayPicker();
|
|
6687
6972
|
const displayDate = calendarMonth.date;
|
|
@@ -6753,7 +7038,7 @@ const CalendarMonthCaption = memo(function CalendarMonthCaption2({
|
|
|
6753
7038
|
className: prefix("calendar__caption-label"),
|
|
6754
7039
|
role: "status",
|
|
6755
7040
|
"aria-live": "polite",
|
|
6756
|
-
children: format(displayDate, CAPTION_FORMAT, { locale })
|
|
7041
|
+
children: format(displayDate, CAPTION_FORMAT, { locale: locale7 })
|
|
6757
7042
|
}
|
|
6758
7043
|
);
|
|
6759
7044
|
const prevButton = /* @__PURE__ */ jsx(
|
|
@@ -6800,15 +7085,15 @@ const CalendarMonthCaption = memo(function CalendarMonthCaption2({
|
|
|
6800
7085
|
{
|
|
6801
7086
|
value: getMonth(monthDate),
|
|
6802
7087
|
disabled: minAllowedDate && maxAllowedDate && isSameYear(minAllowedDate, maxAllowedDate) && (getMonth(monthDate) < getMonth(minAllowedDate) || getMonth(monthDate) > getMonth(maxAllowedDate)),
|
|
6803
|
-
children: format(monthDate, MONTH_FORMAT, { locale })
|
|
7088
|
+
children: format(monthDate, MONTH_FORMAT, { locale: locale7 })
|
|
6804
7089
|
},
|
|
6805
7090
|
getMonth(monthDate)
|
|
6806
7091
|
)),
|
|
6807
|
-
[
|
|
7092
|
+
[locale7, maxAllowedDate, minAllowedDate, monthDates]
|
|
6808
7093
|
);
|
|
6809
7094
|
const yearOptions = useMemo(
|
|
6810
|
-
() => yearDates.map((yearDate) => /* @__PURE__ */ jsx(Option, { value: getYear(yearDate), children: format(yearDate, YEAR_FORMAT, { locale }) }, getYear(yearDate))),
|
|
6811
|
-
[
|
|
7095
|
+
() => yearDates.map((yearDate) => /* @__PURE__ */ jsx(Option, { value: getYear(yearDate), children: format(yearDate, YEAR_FORMAT, { locale: locale7 }) }, getYear(yearDate))),
|
|
7096
|
+
[locale7, yearDates]
|
|
6812
7097
|
);
|
|
6813
7098
|
return /* @__PURE__ */ jsxs(
|
|
6814
7099
|
"div",
|
|
@@ -6818,7 +7103,7 @@ const CalendarMonthCaption = memo(function CalendarMonthCaption2({
|
|
|
6818
7103
|
className: cx(prefix("calendar__caption"), captionProps?.className),
|
|
6819
7104
|
children: [
|
|
6820
7105
|
disableNavigation ? captionLabel : /* @__PURE__ */ jsx(VisuallyHidden, { children: captionLabel }),
|
|
6821
|
-
!disableNavigation && /* @__PURE__ */ jsxs(Fragment
|
|
7106
|
+
!disableNavigation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6822
7107
|
months.length > 1 && /* @__PURE__ */ jsx("div", { className: cx(prefix("calendar__navigation")), children: isFirst && prevButton }),
|
|
6823
7108
|
/* @__PURE__ */ jsx("div", { className: prefix("calendar__selects"), children: /* @__PURE__ */ jsxs(ClearContexts, { children: [
|
|
6824
7109
|
/* @__PURE__ */ jsx(
|
|
@@ -6898,10 +7183,10 @@ function Calendar({
|
|
|
6898
7183
|
...otherProps
|
|
6899
7184
|
}) {
|
|
6900
7185
|
const prefix = usePrefix();
|
|
6901
|
-
const [
|
|
6902
|
-
dateFnsLocale ??=
|
|
6903
|
-
previousMonthLabel ??=
|
|
6904
|
-
nextMonthLabel ??=
|
|
7186
|
+
const [locale7] = useLocale();
|
|
7187
|
+
dateFnsLocale ??= locale7.dateFnsLocale;
|
|
7188
|
+
previousMonthLabel ??= locale7.Calendar.previousMonthLabel;
|
|
7189
|
+
nextMonthLabel ??= locale7.Calendar.nextMonthLabel;
|
|
6905
7190
|
const minAllowedDate = useMemo(() => {
|
|
6906
7191
|
const minDates = [
|
|
6907
7192
|
toValidDate(minDate),
|
|
@@ -7303,10 +7588,10 @@ function useDateTransformer({
|
|
|
7303
7588
|
shortFormat,
|
|
7304
7589
|
fullFormat
|
|
7305
7590
|
} = {}) {
|
|
7306
|
-
const [
|
|
7307
|
-
dateFnsLocale ??=
|
|
7308
|
-
shortFormat ??=
|
|
7309
|
-
fullFormat ??=
|
|
7591
|
+
const [locale7] = useLocale();
|
|
7592
|
+
dateFnsLocale ??= locale7.dateFnsLocale;
|
|
7593
|
+
shortFormat ??= locale7.DateInput.shortFormat ?? dateFnsLocale.formatLong?.date({ width: "short" }) ?? DEFAULT_SHORT_DATE_FORMAT;
|
|
7594
|
+
fullFormat ??= locale7.DateInput.fullFormat ?? dateFnsLocale.formatLong?.date({ width: "full" }) ?? DEFAULT_FULL_DATE_FORMAT;
|
|
7310
7595
|
return useMemo(
|
|
7311
7596
|
() => ({
|
|
7312
7597
|
parse: (formattedDate, { width = "short" } = {}) => parseDateStrict(
|
|
@@ -7385,11 +7670,12 @@ const DateInput = forwardRef(
|
|
|
7385
7670
|
...otherProps
|
|
7386
7671
|
}, forwardedRef) {
|
|
7387
7672
|
const prefix = usePrefix();
|
|
7388
|
-
const [
|
|
7389
|
-
dateFnsLocale ??=
|
|
7390
|
-
placeholder ??=
|
|
7391
|
-
formatDescription ??=
|
|
7392
|
-
calendarButtonLabel ??=
|
|
7673
|
+
const [locale7] = useLocale();
|
|
7674
|
+
dateFnsLocale ??= locale7.dateFnsLocale;
|
|
7675
|
+
placeholder ??= locale7.DateInput.placeholder;
|
|
7676
|
+
formatDescription ??= locale7.DateInput.formatDescription;
|
|
7677
|
+
calendarButtonLabel ??= locale7.DateInput.calendarButtonLabel;
|
|
7678
|
+
const { printHidden } = usePrintClassNames();
|
|
7393
7679
|
const { format: formatDate, parse: parseDate } = useDateTransformer({
|
|
7394
7680
|
locale: dateFnsLocale,
|
|
7395
7681
|
shortFormat,
|
|
@@ -7552,7 +7838,7 @@ const DateInput = forwardRef(
|
|
|
7552
7838
|
popoverContentProps?.ref,
|
|
7553
7839
|
popoverRef
|
|
7554
7840
|
);
|
|
7555
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
7841
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7556
7842
|
/* @__PURE__ */ jsxs(Popover, { open: popoverState.open, modal: popoverState.modal, children: [
|
|
7557
7843
|
/* @__PURE__ */ jsx(PopoverAnchor, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
7558
7844
|
InputWithContainerRef,
|
|
@@ -7566,11 +7852,12 @@ const DateInput = forwardRef(
|
|
|
7566
7852
|
onFocus: combineEventHandlers(onFocus, handleInputFocus),
|
|
7567
7853
|
onBlurToOutside: handleControlBlur,
|
|
7568
7854
|
showClearButton,
|
|
7569
|
-
endAdornment: /* @__PURE__ */ jsxs(Fragment
|
|
7855
|
+
endAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7570
7856
|
endAdornment,
|
|
7571
7857
|
/* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
|
|
7572
7858
|
"button",
|
|
7573
7859
|
{
|
|
7860
|
+
className: printHidden,
|
|
7574
7861
|
"aria-label": calendarButtonLabel?.(
|
|
7575
7862
|
fullFormattedValue,
|
|
7576
7863
|
!disabled && !readOnly
|
|
@@ -7817,14 +8104,14 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
7817
8104
|
...otherProps
|
|
7818
8105
|
}, forwardedRef) {
|
|
7819
8106
|
const prefix = usePrefix();
|
|
7820
|
-
const [
|
|
7821
|
-
clearButtonsLabel ??=
|
|
7822
|
-
dateFnsLocale ??=
|
|
7823
|
-
placeholder ??=
|
|
7824
|
-
formatDescription ??=
|
|
7825
|
-
startInputLabel ??=
|
|
7826
|
-
endInputLabel ??=
|
|
7827
|
-
calendarButtonLabel ??=
|
|
8107
|
+
const [locale7] = useLocale();
|
|
8108
|
+
clearButtonsLabel ??= locale7.Input.clearButtonLabel;
|
|
8109
|
+
dateFnsLocale ??= locale7.dateFnsLocale;
|
|
8110
|
+
placeholder ??= locale7.DateInput.placeholder;
|
|
8111
|
+
formatDescription ??= locale7.DateInput.formatDescription;
|
|
8112
|
+
startInputLabel ??= locale7.DateRangeInput.startInputLabel;
|
|
8113
|
+
endInputLabel ??= locale7.DateRangeInput.endInputLabel;
|
|
8114
|
+
calendarButtonLabel ??= locale7.DateRangeInput.calendarButtonLabel;
|
|
7828
8115
|
const { format: formatDate, parse: parseDate } = useDateTransformer({
|
|
7829
8116
|
locale: dateFnsLocale,
|
|
7830
8117
|
shortFormat,
|
|
@@ -7834,6 +8121,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
7834
8121
|
const labelId = useFieldLabelId();
|
|
7835
8122
|
const descriptionIds = useFieldDescriptionIds();
|
|
7836
8123
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
8124
|
+
const { printHidden } = usePrintClassNames();
|
|
7837
8125
|
const { controlId, codeId } = useSetFieldControl(
|
|
7838
8126
|
startInputProps?.id,
|
|
7839
8127
|
"INPUT",
|
|
@@ -8300,6 +8588,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8300
8588
|
className: cx(
|
|
8301
8589
|
prefix("date-range-input__clear-button"),
|
|
8302
8590
|
prefix("date-range-input__clear-button--start"),
|
|
8591
|
+
printHidden,
|
|
8303
8592
|
startClearButtonProps?.className
|
|
8304
8593
|
),
|
|
8305
8594
|
onClick: combineEventHandlers(
|
|
@@ -8413,6 +8702,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8413
8702
|
className: cx(
|
|
8414
8703
|
prefix("date-range-input__clear-button"),
|
|
8415
8704
|
prefix("date-range-input__clear-button--end"),
|
|
8705
|
+
printHidden,
|
|
8416
8706
|
endClearButtonProps?.className
|
|
8417
8707
|
),
|
|
8418
8708
|
onClick: combineEventHandlers(
|
|
@@ -8452,7 +8742,10 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8452
8742
|
onClick: handleAddonButtonClick,
|
|
8453
8743
|
onBlur: handleControlBlur,
|
|
8454
8744
|
"data-state": void 0,
|
|
8455
|
-
className: cx(
|
|
8745
|
+
className: cx(
|
|
8746
|
+
prefix("date-range-input__calendar-button"),
|
|
8747
|
+
printHidden
|
|
8748
|
+
),
|
|
8456
8749
|
ref: addonButtonRef,
|
|
8457
8750
|
children: /* @__PURE__ */ jsx(Icon, { icon: faCalendar })
|
|
8458
8751
|
}
|
|
@@ -8948,8 +9241,8 @@ const FeedbackPopover = forwardRef(function FeedbackPopover2({
|
|
|
8948
9241
|
...otherProps
|
|
8949
9242
|
}, forwardedRef) {
|
|
8950
9243
|
const prefix = usePrefix();
|
|
8951
|
-
const [
|
|
8952
|
-
label ??=
|
|
9244
|
+
const [locale7] = useLocale();
|
|
9245
|
+
label ??= locale7.FeedbackPopover.label;
|
|
8953
9246
|
const variant = useIsInTableCell() ? "cell" : "default";
|
|
8954
9247
|
const [feedbacksCount, setFeedbacksCount] = useState({
|
|
8955
9248
|
success: 0,
|
|
@@ -8986,7 +9279,7 @@ const FeedbackPopover = forwardRef(function FeedbackPopover2({
|
|
|
8986
9279
|
);
|
|
8987
9280
|
const inField = controlFocused !== void 0;
|
|
8988
9281
|
const accent = dominantFeedbackType === "error" ? "danger" : dominantFeedbackType;
|
|
8989
|
-
return /* @__PURE__ */ jsxs(Fragment
|
|
9282
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8990
9283
|
/* @__PURE__ */ jsx(
|
|
8991
9284
|
FeedbackPopoverContext.Provider,
|
|
8992
9285
|
{
|
|
@@ -9076,8 +9369,8 @@ const Feedback = forwardRef(
|
|
|
9076
9369
|
return () => onRemoveFeedback?.(type);
|
|
9077
9370
|
}, [onAddFeedback, onRemoveFeedback, type]);
|
|
9078
9371
|
const isInFeedbackList = useIsInFeedbackList();
|
|
9079
|
-
const [
|
|
9080
|
-
visuallyHiddenPrefix ??=
|
|
9372
|
+
const [locale7] = useLocale();
|
|
9373
|
+
visuallyHiddenPrefix ??= locale7.Feedback.visuallyHiddenPrefix;
|
|
9081
9374
|
const visuallyHiddenPrefixText = typeof visuallyHiddenPrefix === "function" ? visuallyHiddenPrefix(type) : visuallyHiddenPrefix;
|
|
9082
9375
|
const feedbackId = useSetFieldFeedback(id, type === "error");
|
|
9083
9376
|
const As = asChild ? Slot : isInFeedbackList ? "li" : "div";
|
|
@@ -9158,8 +9451,8 @@ const FieldGroupHeader = forwardRef(function FieldGroupHeader2({
|
|
|
9158
9451
|
...otherProps
|
|
9159
9452
|
}, forwardedRef) {
|
|
9160
9453
|
const prefix = usePrefix();
|
|
9161
|
-
const [
|
|
9162
|
-
visuallyHiddenCodePrefix ??=
|
|
9454
|
+
const [locale7] = useLocale();
|
|
9455
|
+
visuallyHiddenCodePrefix ??= locale7.FieldGroupHeader.visuallyHiddenCodePrefix;
|
|
9163
9456
|
const generatedId = useId();
|
|
9164
9457
|
const codeId = code ? codeProps?.id ?? prefix(`field-group-code-${generatedId}`) : void 0;
|
|
9165
9458
|
const { setCodeId } = useFieldGroupContext();
|
|
@@ -9466,10 +9759,10 @@ function useNumericTransformer({
|
|
|
9466
9759
|
prefix,
|
|
9467
9760
|
suffix
|
|
9468
9761
|
} = {}) {
|
|
9469
|
-
const [
|
|
9470
|
-
decimalSeparator ??=
|
|
9471
|
-
groupingStyle ??=
|
|
9472
|
-
groupSeparator ??=
|
|
9762
|
+
const [locale7] = useLocale();
|
|
9763
|
+
decimalSeparator ??= locale7.NumericInput.decimalSeparator ?? ".";
|
|
9764
|
+
groupingStyle ??= locale7.NumericInput.groupingStyle ?? "thousand";
|
|
9765
|
+
groupSeparator ??= locale7.NumericInput.groupSeparator ?? ",";
|
|
9473
9766
|
const options = useMemo(
|
|
9474
9767
|
() => ({
|
|
9475
9768
|
valueIsInteger,
|
|
@@ -9595,10 +9888,10 @@ const NumericInput = forwardRef(function DateInput3({
|
|
|
9595
9888
|
const maxString = numericToString(max2);
|
|
9596
9889
|
const exclusiveMinString = numericToString(exclusiveMin);
|
|
9597
9890
|
const exclusiveMaxString = numericToString(exclusiveMax);
|
|
9598
|
-
const [
|
|
9599
|
-
decimalSeparator ??=
|
|
9600
|
-
groupingStyle ??=
|
|
9601
|
-
groupSeparator ??=
|
|
9891
|
+
const [locale7] = useLocale();
|
|
9892
|
+
decimalSeparator ??= locale7.NumericInput.decimalSeparator ?? ".";
|
|
9893
|
+
groupingStyle ??= locale7.NumericInput.groupingStyle ?? "thousand";
|
|
9894
|
+
groupSeparator ??= locale7.NumericInput.groupSeparator ?? ",";
|
|
9602
9895
|
if (process.env.NODE_ENV !== "production") {
|
|
9603
9896
|
validateNumericProps({
|
|
9604
9897
|
valueIsInteger,
|
|
@@ -9900,8 +10193,8 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
9900
10193
|
...otherProps
|
|
9901
10194
|
}, forwardedRef) {
|
|
9902
10195
|
const prefix = usePrefix();
|
|
9903
|
-
const [
|
|
9904
|
-
clearButtonLabel ??=
|
|
10196
|
+
const [locale7] = useLocale();
|
|
10197
|
+
clearButtonLabel ??= locale7.Input.clearButtonLabel;
|
|
9905
10198
|
const labelId = useFieldLabelId();
|
|
9906
10199
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
9907
10200
|
const descriptionIds = useFieldDescriptionIds();
|
|
@@ -10254,14 +10547,30 @@ const Stepper = forwardRef(function Stepper2({
|
|
|
10254
10547
|
) });
|
|
10255
10548
|
});
|
|
10256
10549
|
const TabsContext = createContext(null);
|
|
10257
|
-
function useCreateTabsContext(variant, defaultValue, value) {
|
|
10550
|
+
function useCreateTabsContext(variant, defaultValue, value, showAllTabsWhilePrinting) {
|
|
10258
10551
|
const store = useConstant(
|
|
10259
10552
|
() => createStore()(
|
|
10260
|
-
subscribeWithSelector((
|
|
10553
|
+
subscribeWithSelector((set, get) => ({
|
|
10261
10554
|
activeTab: value?.toString() ?? defaultValue?.toString(),
|
|
10262
10555
|
showScrollButtons: false,
|
|
10263
10556
|
width: 0,
|
|
10264
|
-
scrollPosition: void 0
|
|
10557
|
+
scrollPosition: void 0,
|
|
10558
|
+
tabsLabels: {},
|
|
10559
|
+
actions: {
|
|
10560
|
+
registerTabLabel: (value2, label) => {
|
|
10561
|
+
set(({ tabsLabels }) => ({
|
|
10562
|
+
tabsLabels: { ...tabsLabels, [value2]: label }
|
|
10563
|
+
}));
|
|
10564
|
+
return () => {
|
|
10565
|
+
set(({ tabsLabels: { [value2]: _, ...otherLabels } }) => ({
|
|
10566
|
+
tabsLabels: otherLabels
|
|
10567
|
+
}));
|
|
10568
|
+
};
|
|
10569
|
+
},
|
|
10570
|
+
getTabLabel: (value2) => {
|
|
10571
|
+
return get().tabsLabels[value2];
|
|
10572
|
+
}
|
|
10573
|
+
}
|
|
10265
10574
|
}))
|
|
10266
10575
|
)
|
|
10267
10576
|
);
|
|
@@ -10270,7 +10579,10 @@ function useCreateTabsContext(variant, defaultValue, value) {
|
|
|
10270
10579
|
store.setState({ activeTab: value.toString() });
|
|
10271
10580
|
}
|
|
10272
10581
|
}, [store, value]);
|
|
10273
|
-
return useMemo(
|
|
10582
|
+
return useMemo(
|
|
10583
|
+
() => ({ variant, showAllTabsWhilePrinting, store }),
|
|
10584
|
+
[showAllTabsWhilePrinting, store, variant]
|
|
10585
|
+
);
|
|
10274
10586
|
}
|
|
10275
10587
|
function useTabsContext() {
|
|
10276
10588
|
const tabsContext = useContext(TabsContext);
|
|
@@ -10279,11 +10591,26 @@ function useTabsContext() {
|
|
|
10279
10591
|
}
|
|
10280
10592
|
return tabsContext;
|
|
10281
10593
|
}
|
|
10594
|
+
function useRegisterTabLabel(value, label) {
|
|
10595
|
+
const { showAllTabsWhilePrinting, store } = useTabsContext();
|
|
10596
|
+
const needsRegisteredTabLabels = usePrinting() && showAllTabsWhilePrinting;
|
|
10597
|
+
const { registerTabLabel } = useStore(store, (state) => state.actions);
|
|
10598
|
+
useEffect(() => {
|
|
10599
|
+
if (needsRegisteredTabLabels) {
|
|
10600
|
+
return registerTabLabel(value, label);
|
|
10601
|
+
}
|
|
10602
|
+
}, [label, needsRegisteredTabLabels, registerTabLabel, value]);
|
|
10603
|
+
}
|
|
10604
|
+
function useTabLabel(value) {
|
|
10605
|
+
const { store } = useTabsContext();
|
|
10606
|
+
return useStore(store, (state) => state.actions.getTabLabel(value));
|
|
10607
|
+
}
|
|
10282
10608
|
const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className, children, ...otherProps }, forwardedRef) {
|
|
10283
10609
|
const prefix = usePrefix();
|
|
10284
10610
|
const { variant, store } = useTabsContext();
|
|
10285
10611
|
const stringValue = value.toString();
|
|
10286
10612
|
const isActive = useStore(store, (state) => state.activeTab === stringValue);
|
|
10613
|
+
useRegisterTabLabel(stringValue, children);
|
|
10287
10614
|
const tabRef = useRef(null);
|
|
10288
10615
|
useEffect(() => {
|
|
10289
10616
|
if (isActive) {
|
|
@@ -10329,21 +10656,41 @@ const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className,
|
|
|
10329
10656
|
}
|
|
10330
10657
|
);
|
|
10331
10658
|
});
|
|
10332
|
-
const TabContent = forwardRef(function TabContent2({ value, className, ...otherProps }, forwardedRef) {
|
|
10659
|
+
const TabContent = forwardRef(function TabContent2({ asChild, value, className, tabContentLabelProps, ...otherProps }, forwardedRef) {
|
|
10333
10660
|
const prefix = usePrefix();
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10661
|
+
const printing = usePrinting();
|
|
10662
|
+
const stringValue = value.toString();
|
|
10663
|
+
const { showAllTabsWhilePrinting } = useTabsContext();
|
|
10664
|
+
const tabLabel = useTabLabel(stringValue);
|
|
10665
|
+
const As = printing && showAllTabsWhilePrinting ? asChild ? Slot : "div" : Tabs$1.TabsContent;
|
|
10666
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10667
|
+
printing && showAllTabsWhilePrinting && /* @__PURE__ */ jsx(
|
|
10668
|
+
"span",
|
|
10669
|
+
{
|
|
10670
|
+
...tabContentLabelProps,
|
|
10671
|
+
className: cx(
|
|
10672
|
+
prefix("tabs__tab-content-label"),
|
|
10673
|
+
tabContentLabelProps?.className
|
|
10674
|
+
),
|
|
10675
|
+
children: tabLabel
|
|
10676
|
+
}
|
|
10677
|
+
),
|
|
10678
|
+
/* @__PURE__ */ jsx(
|
|
10679
|
+
As,
|
|
10680
|
+
{
|
|
10681
|
+
...!printing || !showAllTabsWhilePrinting ? { asChild } : {},
|
|
10682
|
+
value: stringValue,
|
|
10683
|
+
className: cx(prefix("tabs__tab-content"), className),
|
|
10684
|
+
...otherProps,
|
|
10685
|
+
ref: forwardedRef
|
|
10686
|
+
}
|
|
10687
|
+
)
|
|
10688
|
+
] });
|
|
10343
10689
|
});
|
|
10344
10690
|
const TabList = forwardRef(function TabList2({ rootProps, containerProps, className, children, ...otherProps }, forwardedRef) {
|
|
10345
10691
|
const prefix = usePrefix();
|
|
10346
|
-
const { variant, store } = useTabsContext();
|
|
10692
|
+
const { variant, showAllTabsWhilePrinting, store } = useTabsContext();
|
|
10693
|
+
const { printHidden } = usePrintClassNames();
|
|
10347
10694
|
const [rootEl, setRootEl] = useState(null);
|
|
10348
10695
|
const [containerEl, setContainerEl] = useState(null);
|
|
10349
10696
|
useMeasure(
|
|
@@ -10421,6 +10768,7 @@ const TabList = forwardRef(function TabList2({ rootProps, containerProps, classN
|
|
|
10421
10768
|
className: cx(
|
|
10422
10769
|
prefix("tabs__tab-list-root"),
|
|
10423
10770
|
prefix(`tabs__tab-list-root--${variant}`),
|
|
10771
|
+
showAllTabsWhilePrinting && printHidden,
|
|
10424
10772
|
rootProps?.className
|
|
10425
10773
|
),
|
|
10426
10774
|
ref: combinedRootRef,
|
|
@@ -10486,11 +10834,17 @@ const Tabs = forwardRef(function Tabs2({
|
|
|
10486
10834
|
defaultValue,
|
|
10487
10835
|
value,
|
|
10488
10836
|
onValueChange,
|
|
10837
|
+
showAllTabsWhilePrinting,
|
|
10489
10838
|
className,
|
|
10490
10839
|
...otherProps
|
|
10491
10840
|
}, forwardedRef) {
|
|
10492
10841
|
const prefix = usePrefix();
|
|
10493
|
-
const tabsContextValue = useCreateTabsContext(
|
|
10842
|
+
const tabsContextValue = useCreateTabsContext(
|
|
10843
|
+
variant,
|
|
10844
|
+
defaultValue,
|
|
10845
|
+
value,
|
|
10846
|
+
showAllTabsWhilePrinting
|
|
10847
|
+
);
|
|
10494
10848
|
const handleValueChange = useCallback(
|
|
10495
10849
|
(value2) => tabsContextValue.store.setState({ activeTab: value2 }),
|
|
10496
10850
|
[tabsContextValue.store]
|
|
@@ -10602,6 +10956,7 @@ function registerKeyboardShortcut(keybinds, action, {
|
|
|
10602
10956
|
});
|
|
10603
10957
|
}
|
|
10604
10958
|
function useKeyboardShortcut(keybinds, action, {
|
|
10959
|
+
enabled = true,
|
|
10605
10960
|
target = window,
|
|
10606
10961
|
eventType = "keydown",
|
|
10607
10962
|
sequenceTimeout = 1e3,
|
|
@@ -10612,7 +10967,7 @@ function useKeyboardShortcut(keybinds, action, {
|
|
|
10612
10967
|
const shortcutsString = Array.isArray(keybinds) ? keybinds.join("__") : keybinds;
|
|
10613
10968
|
const latestCallbacks = useLatestValues({ action, ignore });
|
|
10614
10969
|
useEffect(() => {
|
|
10615
|
-
if (shortcutsString && target !== null) {
|
|
10970
|
+
if (enabled && shortcutsString && target !== null) {
|
|
10616
10971
|
return registerKeyboardShortcut(
|
|
10617
10972
|
shortcutsString.split("__"),
|
|
10618
10973
|
(evt) => latestCallbacks.action(evt),
|
|
@@ -10628,6 +10983,7 @@ function useKeyboardShortcut(keybinds, action, {
|
|
|
10628
10983
|
}
|
|
10629
10984
|
}, [
|
|
10630
10985
|
capture,
|
|
10986
|
+
enabled,
|
|
10631
10987
|
eventType,
|
|
10632
10988
|
latestCallbacks,
|
|
10633
10989
|
preventDefault,
|
|
@@ -10904,6 +11260,9 @@ export {
|
|
|
10904
11260
|
PortalContext,
|
|
10905
11261
|
PrefixContext,
|
|
10906
11262
|
PrefixProvider,
|
|
11263
|
+
Printer,
|
|
11264
|
+
PrinterContent,
|
|
11265
|
+
PrinterTrigger,
|
|
10907
11266
|
Radio,
|
|
10908
11267
|
RadioGroup,
|
|
10909
11268
|
Root,
|
|
@@ -10948,10 +11307,11 @@ export {
|
|
|
10948
11307
|
computed,
|
|
10949
11308
|
controlStatusToAccent,
|
|
10950
11309
|
cx,
|
|
10951
|
-
enGB,
|
|
10952
|
-
enUS,
|
|
11310
|
+
locale as enGB,
|
|
11311
|
+
locale2 as enUS,
|
|
10953
11312
|
formatNumericValue,
|
|
10954
|
-
fr,
|
|
11313
|
+
locale3 as fr,
|
|
11314
|
+
locale4 as frFR,
|
|
10955
11315
|
ignoreFormControlsKeyboardShortcut,
|
|
10956
11316
|
isNumericStringNegative,
|
|
10957
11317
|
matchAgainstFilter,
|
|
@@ -10964,7 +11324,8 @@ export {
|
|
|
10964
11324
|
numericToString,
|
|
10965
11325
|
parseDateStrict,
|
|
10966
11326
|
parseNumericValue,
|
|
10967
|
-
pt,
|
|
11327
|
+
locale5 as pt,
|
|
11328
|
+
locale6 as ptPT,
|
|
10968
11329
|
registerKeyboardShortcut,
|
|
10969
11330
|
setBoolDataAttr,
|
|
10970
11331
|
setDefaultPrefix,
|
|
@@ -11007,6 +11368,11 @@ export {
|
|
|
11007
11368
|
useOnFieldLabelChange,
|
|
11008
11369
|
usePortalContext,
|
|
11009
11370
|
usePrefix,
|
|
11371
|
+
usePrint,
|
|
11372
|
+
usePrintClassNames,
|
|
11373
|
+
usePrintInProgress,
|
|
11374
|
+
usePrinterDocumentTitle,
|
|
11375
|
+
usePrinting,
|
|
11010
11376
|
useResponsiveValues,
|
|
11011
11377
|
useScrollPosition,
|
|
11012
11378
|
useScrollbarSize,
|
|
@@ -11018,6 +11384,7 @@ export {
|
|
|
11018
11384
|
useSetFieldHelperText,
|
|
11019
11385
|
useSetFieldLabel,
|
|
11020
11386
|
useSpacing,
|
|
11387
|
+
useStartPrintingTask,
|
|
11021
11388
|
useTableNumberOfColumns,
|
|
11022
11389
|
useToastManager,
|
|
11023
11390
|
validateNumericTransformerOptions,
|