@ostack.tech/ui 0.4.1 → 0.5.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/pt.js +1 -1
- package/dist/locales/pt.js.map +1 -1
- package/dist/ostack-ui.css +40 -10
- package/dist/ostack-ui.css.map +1 -1
- package/dist/ostack-ui.js +418 -49
- 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/Portal/Portal.d.ts +1 -1
- package/dist/types/components/Printer/Printer.d.ts +147 -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 +30 -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/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/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/ostack-ui.js
CHANGED
|
@@ -21,6 +21,8 @@ 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;
|
|
@@ -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
|
}
|
|
@@ -1676,16 +1713,17 @@ const Button = forwardRef(
|
|
|
1676
1713
|
[iconPlacement, prefix, spinnerProps]
|
|
1677
1714
|
);
|
|
1678
1715
|
const content = loading && loadingContent ? asChild ? cloneElement(children, void 0, loadingContent) : loadingContent : children;
|
|
1716
|
+
const loadingDisabled = loading && !enabledWhenLoading;
|
|
1717
|
+
const visiblyDisabled = disabled || loadingDisabled;
|
|
1679
1718
|
const handleClick = useCallback(
|
|
1680
1719
|
(evt) => {
|
|
1681
|
-
if (
|
|
1720
|
+
if (visiblyDisabled) {
|
|
1682
1721
|
return evt.preventDefault();
|
|
1683
1722
|
}
|
|
1684
1723
|
return onClick?.(evt);
|
|
1685
1724
|
},
|
|
1686
|
-
[
|
|
1725
|
+
[visiblyDisabled, onClick]
|
|
1687
1726
|
);
|
|
1688
|
-
const shouldDisable = disabled || loading && !enabledWhenLoading;
|
|
1689
1727
|
const As = asChild ? Slot : "button";
|
|
1690
1728
|
return /* @__PURE__ */ jsxs(
|
|
1691
1729
|
As,
|
|
@@ -1700,11 +1738,11 @@ const Button = forwardRef(
|
|
|
1700
1738
|
),
|
|
1701
1739
|
onClick: handleClick,
|
|
1702
1740
|
"data-accent": color,
|
|
1703
|
-
disabled
|
|
1704
|
-
"data-disabled": boolDataAttr(asChild &&
|
|
1705
|
-
"aria-disabled": asChild &&
|
|
1741
|
+
disabled,
|
|
1742
|
+
"data-disabled": boolDataAttr(loadingDisabled || asChild && disabled),
|
|
1743
|
+
"aria-disabled": loadingDisabled || asChild && disabled ? "true" : void 0,
|
|
1706
1744
|
"data-active": boolDataAttr(active),
|
|
1707
|
-
tabIndex: asChild &&
|
|
1745
|
+
tabIndex: asChild && disabled ? -1 : void 0,
|
|
1708
1746
|
ref: forwardedRef,
|
|
1709
1747
|
...otherProps,
|
|
1710
1748
|
children: [
|
|
@@ -2979,6 +3017,235 @@ const ControlCode = forwardRef(
|
|
|
2979
3017
|
) });
|
|
2980
3018
|
}
|
|
2981
3019
|
);
|
|
3020
|
+
const PrinterContext = createContext(null);
|
|
3021
|
+
function usePrinterContext() {
|
|
3022
|
+
const printerContext = useContext(PrinterContext);
|
|
3023
|
+
if (!printerContext) {
|
|
3024
|
+
throw new Error("Printer context not in scope.");
|
|
3025
|
+
}
|
|
3026
|
+
return printerContext;
|
|
3027
|
+
}
|
|
3028
|
+
function usePrintInProgress() {
|
|
3029
|
+
return useContext(PrinterContext)?.printInProgress ?? false;
|
|
3030
|
+
}
|
|
3031
|
+
function usePrint() {
|
|
3032
|
+
return usePrinterContext().print;
|
|
3033
|
+
}
|
|
3034
|
+
function Printer({
|
|
3035
|
+
preview,
|
|
3036
|
+
printInForeground,
|
|
3037
|
+
documentTitle,
|
|
3038
|
+
pageSize,
|
|
3039
|
+
pageMargin,
|
|
3040
|
+
printColorAdjust = "exact",
|
|
3041
|
+
fonts,
|
|
3042
|
+
copyShadowRoots,
|
|
3043
|
+
nonce,
|
|
3044
|
+
printFn,
|
|
3045
|
+
onBeforePrint,
|
|
3046
|
+
onAfterPrint,
|
|
3047
|
+
iframeProps,
|
|
3048
|
+
children
|
|
3049
|
+
}) {
|
|
3050
|
+
const prefix = usePrefix();
|
|
3051
|
+
const triggerRef = useRef(null);
|
|
3052
|
+
const contentRef = useRef(null);
|
|
3053
|
+
const [printInProgress, setPrintInProgress] = useState(false);
|
|
3054
|
+
const [printOptions, setPrintOptions] = useState(
|
|
3055
|
+
void 0
|
|
3056
|
+
);
|
|
3057
|
+
const resolvePrintRef = useRef(null);
|
|
3058
|
+
const rejectPrintRef = useRef(null);
|
|
3059
|
+
const pendingPromiseRef = useRef(null);
|
|
3060
|
+
const resolvePendingRef = useRef(null);
|
|
3061
|
+
const pendingTasksRef = useRef(0);
|
|
3062
|
+
const finishedTasksRef = useRef(0);
|
|
3063
|
+
const finishPrint = (focusTrigger = false) => {
|
|
3064
|
+
setPrintInProgress(false);
|
|
3065
|
+
setPrintOptions(void 0);
|
|
3066
|
+
resolvePrintRef.current = null;
|
|
3067
|
+
rejectPrintRef.current = null;
|
|
3068
|
+
pendingPromiseRef.current = null;
|
|
3069
|
+
resolvePendingRef.current = null;
|
|
3070
|
+
pendingTasksRef.current = 0;
|
|
3071
|
+
finishedTasksRef.current = 0;
|
|
3072
|
+
if (focusTrigger) {
|
|
3073
|
+
setTimeout(() => triggerRef.current?.focus(), 100);
|
|
3074
|
+
}
|
|
3075
|
+
};
|
|
3076
|
+
const reactToPrintFn = useReactToPrint({
|
|
3077
|
+
bodyClass: preview || printInForeground ? prefix("root") : void 0,
|
|
3078
|
+
documentTitle: printOptions?.documentTitle ?? documentTitle ?? document.title,
|
|
3079
|
+
pageStyle: printPageStyle({
|
|
3080
|
+
pageSize: printOptions?.pageSize ?? pageSize,
|
|
3081
|
+
pageMargin: printOptions?.pageMargin ?? pageMargin,
|
|
3082
|
+
printColorAdjust: printOptions?.printColorAdjust ?? printColorAdjust
|
|
3083
|
+
}),
|
|
3084
|
+
fonts: printOptions?.fonts ?? fonts,
|
|
3085
|
+
copyShadowRoots: printOptions?.copyShadowRoots ?? copyShadowRoots,
|
|
3086
|
+
nonce: printOptions?.nonce ?? nonce,
|
|
3087
|
+
printIframeProps: printOptions?.iframeProps ?? iframeProps,
|
|
3088
|
+
suppressErrors: process.env.NODE_ENV !== "production",
|
|
3089
|
+
print: printOptions?.printFn ?? printFn,
|
|
3090
|
+
onAfterPrint: () => {
|
|
3091
|
+
let event;
|
|
3092
|
+
try {
|
|
3093
|
+
onAfterPrint?.(event = new Event("ostack-ui.afterPrint"));
|
|
3094
|
+
} finally {
|
|
3095
|
+
resolvePrintRef.current();
|
|
3096
|
+
finishPrint(!event?.defaultPrevented);
|
|
3097
|
+
}
|
|
3098
|
+
},
|
|
3099
|
+
onPrintError: (_errorLocation, error) => {
|
|
3100
|
+
rejectPrintRef.current(error);
|
|
3101
|
+
finishPrint();
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
const latest = useLatestValues({
|
|
3105
|
+
printInProgress,
|
|
3106
|
+
reactToPrintFn,
|
|
3107
|
+
onBeforePrint
|
|
3108
|
+
});
|
|
3109
|
+
const handlePrint = useCallback(
|
|
3110
|
+
async (options) => {
|
|
3111
|
+
if (latest.printInProgress) {
|
|
3112
|
+
throw new Error("Printing is already in progress.");
|
|
3113
|
+
}
|
|
3114
|
+
const onBeforePrint2 = latest.onBeforePrint;
|
|
3115
|
+
flushSync(() => {
|
|
3116
|
+
setPrintInProgress(true);
|
|
3117
|
+
setPrintOptions(options);
|
|
3118
|
+
});
|
|
3119
|
+
await pendingPromiseRef.current;
|
|
3120
|
+
if (onBeforePrint2) {
|
|
3121
|
+
const event = new Event("ostack-ui.print");
|
|
3122
|
+
await latest.onBeforePrint?.(event);
|
|
3123
|
+
if (event.defaultPrevented) {
|
|
3124
|
+
return finishPrint();
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
return new Promise((res, rej) => {
|
|
3128
|
+
latest.reactToPrintFn(() => contentRef.current);
|
|
3129
|
+
resolvePrintRef.current = res;
|
|
3130
|
+
rejectPrintRef.current = rej;
|
|
3131
|
+
});
|
|
3132
|
+
},
|
|
3133
|
+
[latest]
|
|
3134
|
+
);
|
|
3135
|
+
const startPrintingTask = useCallback(() => {
|
|
3136
|
+
if (pendingTasksRef.current++ === 0) {
|
|
3137
|
+
pendingPromiseRef.current = new Promise(
|
|
3138
|
+
(res) => resolvePendingRef.current = res
|
|
3139
|
+
);
|
|
3140
|
+
}
|
|
3141
|
+
}, [pendingPromiseRef, resolvePendingRef]);
|
|
3142
|
+
const finishPrintingTask = useCallback(() => {
|
|
3143
|
+
if (++finishedTasksRef.current >= pendingTasksRef.current) {
|
|
3144
|
+
void Promise.resolve().then(() => {
|
|
3145
|
+
if (finishedTasksRef.current >= pendingTasksRef.current) {
|
|
3146
|
+
resolvePendingRef.current();
|
|
3147
|
+
}
|
|
3148
|
+
});
|
|
3149
|
+
}
|
|
3150
|
+
}, [resolvePendingRef]);
|
|
3151
|
+
return /* @__PURE__ */ jsx(
|
|
3152
|
+
PrinterContext.Provider,
|
|
3153
|
+
{
|
|
3154
|
+
value: {
|
|
3155
|
+
preview,
|
|
3156
|
+
printInForeground,
|
|
3157
|
+
printInProgress,
|
|
3158
|
+
triggerRef,
|
|
3159
|
+
contentRef,
|
|
3160
|
+
print: handlePrint,
|
|
3161
|
+
startPrintingTask,
|
|
3162
|
+
finishPrintingTask
|
|
3163
|
+
},
|
|
3164
|
+
children
|
|
3165
|
+
}
|
|
3166
|
+
);
|
|
3167
|
+
}
|
|
3168
|
+
function printPageStyle({
|
|
3169
|
+
pageSize,
|
|
3170
|
+
pageMargin,
|
|
3171
|
+
printColorAdjust
|
|
3172
|
+
}) {
|
|
3173
|
+
let pageStyle = `@media print {
|
|
3174
|
+
html, body { margin: 0 }
|
|
3175
|
+
body {
|
|
3176
|
+
color-adjust: ${printColorAdjust};
|
|
3177
|
+
print-color-adjust: ${printColorAdjust};
|
|
3178
|
+
-webkit-print-color-adjust: ${printColorAdjust};
|
|
3179
|
+
}
|
|
3180
|
+
}`;
|
|
3181
|
+
if (pageSize != null) {
|
|
3182
|
+
pageStyle += `@page { size: ${pageSize} }`;
|
|
3183
|
+
}
|
|
3184
|
+
if (pageMargin != null) {
|
|
3185
|
+
pageStyle += `@page { margin: ${pageMargin} }`;
|
|
3186
|
+
}
|
|
3187
|
+
return pageStyle;
|
|
3188
|
+
}
|
|
3189
|
+
function usePrintClassNames() {
|
|
3190
|
+
const prefix = usePrefix();
|
|
3191
|
+
return {
|
|
3192
|
+
printOnly: prefix("print-only"),
|
|
3193
|
+
printHidden: prefix("print-hidden")
|
|
3194
|
+
};
|
|
3195
|
+
}
|
|
3196
|
+
const PrinterContent = forwardRef(function PrinterContent2({ asChild, printOnly, portalContainer, className, children, ...otherProps }, forwardedRef) {
|
|
3197
|
+
const { printOnly: printOnlyClassName } = usePrintClassNames();
|
|
3198
|
+
const {
|
|
3199
|
+
preview,
|
|
3200
|
+
printInForeground,
|
|
3201
|
+
printInProgress,
|
|
3202
|
+
contentRef,
|
|
3203
|
+
startPrintingTask,
|
|
3204
|
+
finishPrintingTask
|
|
3205
|
+
} = usePrinterContext();
|
|
3206
|
+
const printing = preview || printInProgress;
|
|
3207
|
+
const contentContext = useMemo(
|
|
3208
|
+
() => ({
|
|
3209
|
+
printing,
|
|
3210
|
+
startPrintingTask: printing ? startPrintingTask : void 0,
|
|
3211
|
+
finishPrintingTask: printing ? finishPrintingTask : void 0
|
|
3212
|
+
}),
|
|
3213
|
+
[finishPrintingTask, printing, startPrintingTask]
|
|
3214
|
+
);
|
|
3215
|
+
const As = asChild ? Slot : "div";
|
|
3216
|
+
const combinedRef = useCombinedRef(contentRef, forwardedRef);
|
|
3217
|
+
const content = /* @__PURE__ */ jsx(
|
|
3218
|
+
As,
|
|
3219
|
+
{
|
|
3220
|
+
className: cx(!preview && printOnlyClassName, className),
|
|
3221
|
+
...otherProps,
|
|
3222
|
+
ref: combinedRef,
|
|
3223
|
+
children
|
|
3224
|
+
}
|
|
3225
|
+
);
|
|
3226
|
+
return preview || printInForeground ? /* @__PURE__ */ jsx(PrinterContentContext.Provider, { value: contentContext, children: content }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3227
|
+
!printOnly && /* @__PURE__ */ jsx(PrinterContentContext.Provider, { value: { printing: false }, children }),
|
|
3228
|
+
printInProgress && /* @__PURE__ */ jsx(PrinterContentContext.Provider, { value: contentContext, children: /* @__PURE__ */ jsx(Portal, { container: portalContainer, asChild: true, children: content }) })
|
|
3229
|
+
] });
|
|
3230
|
+
});
|
|
3231
|
+
const PrinterTrigger = forwardRef(function PrinterTrigger2({ showWhenPrinting, className, onClick, ...otherProps }, forwardedRef) {
|
|
3232
|
+
const { printHidden } = usePrintClassNames();
|
|
3233
|
+
const { printInProgress, triggerRef, print } = usePrinterContext();
|
|
3234
|
+
const printing = usePrinting();
|
|
3235
|
+
const combinedRef = useCombinedRef(triggerRef, forwardedRef);
|
|
3236
|
+
return /* @__PURE__ */ jsx(
|
|
3237
|
+
Slot,
|
|
3238
|
+
{
|
|
3239
|
+
className: cx(!showWhenPrinting && printHidden, className),
|
|
3240
|
+
onClick: combineEventHandlers(onClick, () => print(), {
|
|
3241
|
+
checkDefaultPrevented: true
|
|
3242
|
+
}),
|
|
3243
|
+
disabled: printInProgress && !printing,
|
|
3244
|
+
...otherProps,
|
|
3245
|
+
ref: combinedRef
|
|
3246
|
+
}
|
|
3247
|
+
);
|
|
3248
|
+
});
|
|
2982
3249
|
function useScrollPosition(element, setScrollPosition) {
|
|
2983
3250
|
useEffect(() => {
|
|
2984
3251
|
if (!element) {
|
|
@@ -3416,6 +3683,7 @@ const TableHead = forwardRef(
|
|
|
3416
3683
|
() => Array.from({ length: nRows }, (_, i) => columnsOfRow(columns, i)),
|
|
3417
3684
|
[columns, nRows]
|
|
3418
3685
|
);
|
|
3686
|
+
const { printHidden } = usePrintClassNames();
|
|
3419
3687
|
const generatedId = useId();
|
|
3420
3688
|
const tableHeadRef = useRef(null);
|
|
3421
3689
|
useEffect(
|
|
@@ -3494,6 +3762,7 @@ const TableHead = forwardRef(
|
|
|
3494
3762
|
...helperButtonProps,
|
|
3495
3763
|
className: cx(
|
|
3496
3764
|
prefix("table__column-helper-button"),
|
|
3765
|
+
printHidden,
|
|
3497
3766
|
helperButtonProps?.className
|
|
3498
3767
|
)
|
|
3499
3768
|
}
|
|
@@ -3762,15 +4031,17 @@ const DataTable = forwardRef(
|
|
|
3762
4031
|
dynamicRowHeight = false,
|
|
3763
4032
|
estimatedRowHeight = DEFAULT_TABLE_ROW_HEIGHT,
|
|
3764
4033
|
overscan = 5,
|
|
4034
|
+
showAllRowsWhilePrinting,
|
|
3765
4035
|
apiRef,
|
|
3766
4036
|
className,
|
|
3767
4037
|
...otherProps
|
|
3768
4038
|
}, forwardedRef) {
|
|
3769
4039
|
const prefix = usePrefix();
|
|
4040
|
+
const printing = usePrinting();
|
|
3770
4041
|
const leaves = useMemo(() => leafColumns(columns), [columns]);
|
|
3771
4042
|
const headCount = useMemo(() => numberOfRows(columns), [columns]);
|
|
3772
4043
|
const dataTableContextValue = useCreateDataTableContext({
|
|
3773
|
-
displayMode,
|
|
4044
|
+
displayMode: printing ? "paged" : displayMode,
|
|
3774
4045
|
columns,
|
|
3775
4046
|
rows,
|
|
3776
4047
|
getRows,
|
|
@@ -3783,6 +4054,7 @@ const DataTable = forwardRef(
|
|
|
3783
4054
|
dynamicRowHeight,
|
|
3784
4055
|
estimatedRowHeight,
|
|
3785
4056
|
overscan,
|
|
4057
|
+
showAllRowsWhilePrinting,
|
|
3786
4058
|
apiRef,
|
|
3787
4059
|
leafColumns: leaves,
|
|
3788
4060
|
headCount,
|
|
@@ -3950,6 +4222,7 @@ const Label = forwardRef(function Label2({
|
|
|
3950
4222
|
const [locale] = useLocale();
|
|
3951
4223
|
requiredIconLabel ??= locale.Label.requiredIconLabel;
|
|
3952
4224
|
helperButtonLabel ??= locale.Label.helperButtonLabel;
|
|
4225
|
+
const { printHidden } = usePrintClassNames();
|
|
3953
4226
|
const labelId = useSetFieldLabel(children, id);
|
|
3954
4227
|
const controlId = useFieldControlId();
|
|
3955
4228
|
const controlTagName = useFieldControlTagName();
|
|
@@ -4027,6 +4300,7 @@ const Label = forwardRef(function Label2({
|
|
|
4027
4300
|
...helperButtonProps,
|
|
4028
4301
|
className: cx(
|
|
4029
4302
|
prefix("label__helper-button"),
|
|
4303
|
+
printHidden,
|
|
4030
4304
|
helperButtonProps?.className
|
|
4031
4305
|
)
|
|
4032
4306
|
}
|
|
@@ -4521,7 +4795,9 @@ function DataTableEmptyOrLoadingRows({
|
|
|
4521
4795
|
) }) });
|
|
4522
4796
|
}
|
|
4523
4797
|
function PagedDataTableRows() {
|
|
4524
|
-
const { rowKey, renderRow, apiRef, store } = useDataTableContext();
|
|
4798
|
+
const { rowKey, renderRow, showAllRowsWhilePrinting, apiRef, store } = useDataTableContext();
|
|
4799
|
+
const printing = usePrinting();
|
|
4800
|
+
const showAllRows = showAllRowsWhilePrinting && printing;
|
|
4525
4801
|
const splice = useCallback(
|
|
4526
4802
|
(startIndex, deleted = 0, added = 0) => {
|
|
4527
4803
|
const { pageOffset: pageOffset2, limit, actions } = store.getState();
|
|
@@ -4553,13 +4829,16 @@ function PagedDataTableRows() {
|
|
|
4553
4829
|
),
|
|
4554
4830
|
[goTo, store]
|
|
4555
4831
|
);
|
|
4556
|
-
const pageOffset = useStore(
|
|
4832
|
+
const pageOffset = useStore(
|
|
4833
|
+
store,
|
|
4834
|
+
(state) => showAllRows ? 0 : state.pageOffset()
|
|
4835
|
+
);
|
|
4557
4836
|
const rowsWindow = useStore(
|
|
4558
4837
|
store,
|
|
4559
4838
|
useShallow(
|
|
4560
4839
|
(state) => state.rowsWindow(
|
|
4561
|
-
state.pageOffset(),
|
|
4562
|
-
state.pageLimit() ?? state.loadingCount
|
|
4840
|
+
showAllRows ? 0 : state.pageOffset(),
|
|
4841
|
+
(showAllRows ? state.totalCount() : state.pageLimit()) ?? state.loadingCount
|
|
4563
4842
|
)
|
|
4564
4843
|
)
|
|
4565
4844
|
);
|
|
@@ -5115,8 +5394,9 @@ const DataTablePagination = forwardRef(function DataTablePagination2({
|
|
|
5115
5394
|
rowsRange ??= locale.DataTablePagination.rowsRange;
|
|
5116
5395
|
previousPageButtonLabel ??= locale.DataTablePagination.previousPageButtonLabel;
|
|
5117
5396
|
nextPageButtonLabel ??= locale.DataTablePagination.nextPageButtonLabel;
|
|
5118
|
-
const { displayMode } = useDataTableContext();
|
|
5119
|
-
|
|
5397
|
+
const { displayMode, showAllRowsWhilePrinting } = useDataTableContext();
|
|
5398
|
+
const printing = usePrinting();
|
|
5399
|
+
return printing && showAllRowsWhilePrinting ? null : displayMode === "paged" ? /* @__PURE__ */ jsx(
|
|
5120
5400
|
PagedDataTablePagination,
|
|
5121
5401
|
{
|
|
5122
5402
|
...otherProps,
|
|
@@ -5255,6 +5535,7 @@ const Input = forwardRef(
|
|
|
5255
5535
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
5256
5536
|
const descriptionIds = useFieldDescriptionIds();
|
|
5257
5537
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
5538
|
+
const { printHidden } = usePrintClassNames();
|
|
5258
5539
|
const [inputEl, setInputEl] = useState(null);
|
|
5259
5540
|
const { controlId, codeId } = useSetFieldControl(
|
|
5260
5541
|
id,
|
|
@@ -5456,6 +5737,7 @@ const Input = forwardRef(
|
|
|
5456
5737
|
...clearButtonProps,
|
|
5457
5738
|
className: cx(
|
|
5458
5739
|
prefix("input__clear-button"),
|
|
5740
|
+
printHidden,
|
|
5459
5741
|
clearButtonProps?.className
|
|
5460
5742
|
),
|
|
5461
5743
|
onClick: combineEventHandlers(
|
|
@@ -6008,7 +6290,6 @@ const SelectContext = createContext(null);
|
|
|
6008
6290
|
function useCreateSelectContext({
|
|
6009
6291
|
multiple,
|
|
6010
6292
|
value,
|
|
6011
|
-
setValue,
|
|
6012
6293
|
onOptionSelect,
|
|
6013
6294
|
status,
|
|
6014
6295
|
disabled,
|
|
@@ -6039,7 +6320,6 @@ function useCreateSelectContext({
|
|
|
6039
6320
|
() => ({
|
|
6040
6321
|
multiple,
|
|
6041
6322
|
value,
|
|
6042
|
-
setValue,
|
|
6043
6323
|
onOptionSelect,
|
|
6044
6324
|
status,
|
|
6045
6325
|
disabled,
|
|
@@ -6052,7 +6332,6 @@ function useCreateSelectContext({
|
|
|
6052
6332
|
multiple,
|
|
6053
6333
|
onOptionSelect,
|
|
6054
6334
|
readOnly,
|
|
6055
|
-
setValue,
|
|
6056
6335
|
status,
|
|
6057
6336
|
store,
|
|
6058
6337
|
value,
|
|
@@ -6166,6 +6445,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
6166
6445
|
...otherProps
|
|
6167
6446
|
}, forwardedRef) {
|
|
6168
6447
|
const prefix = usePrefix();
|
|
6448
|
+
const { printHidden } = usePrintClassNames();
|
|
6169
6449
|
const iconEl = useMemo(
|
|
6170
6450
|
() => icon && /* @__PURE__ */ jsx(
|
|
6171
6451
|
Icon,
|
|
@@ -6225,6 +6505,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
6225
6505
|
...closeButtonProps,
|
|
6226
6506
|
className: cx(
|
|
6227
6507
|
prefix("tag__close-button"),
|
|
6508
|
+
printHidden,
|
|
6228
6509
|
closeButtonProps?.className
|
|
6229
6510
|
)
|
|
6230
6511
|
}
|
|
@@ -6240,14 +6521,22 @@ const Tag = forwardRef(function Tag2({
|
|
|
6240
6521
|
const Badge = Tag;
|
|
6241
6522
|
function SelectMultipleValue() {
|
|
6242
6523
|
const prefix = usePrefix();
|
|
6243
|
-
const {
|
|
6524
|
+
const {
|
|
6525
|
+
value,
|
|
6526
|
+
onOptionSelect,
|
|
6527
|
+
status,
|
|
6528
|
+
disabled,
|
|
6529
|
+
readOnly,
|
|
6530
|
+
valueTagProps,
|
|
6531
|
+
store
|
|
6532
|
+
} = useSelectContext();
|
|
6244
6533
|
useStore(store, (state) => state.actions.getOptionState(value));
|
|
6245
6534
|
const handleCloseValueTag = useCallback(
|
|
6246
6535
|
(tagValue, evt) => {
|
|
6247
6536
|
evt.preventDefault();
|
|
6248
|
-
|
|
6537
|
+
onOptionSelect(tagValue);
|
|
6249
6538
|
},
|
|
6250
|
-
[
|
|
6539
|
+
[onOptionSelect]
|
|
6251
6540
|
);
|
|
6252
6541
|
const valuesToRender = useMemo(
|
|
6253
6542
|
() => Array.from(new Set(value)),
|
|
@@ -6392,6 +6681,7 @@ const Select = forwardRef(function Select2({
|
|
|
6392
6681
|
loadingOptionsLabel ??= locale.Select.loadingOptionsLabel;
|
|
6393
6682
|
const { cssVarStyle } = useCssVars();
|
|
6394
6683
|
const labelId = useFieldLabelId();
|
|
6684
|
+
const { printHidden } = usePrintClassNames();
|
|
6395
6685
|
const [open, setOpen] = useControllableState(
|
|
6396
6686
|
defaultOpen ?? false,
|
|
6397
6687
|
controlledOpen
|
|
@@ -6483,7 +6773,6 @@ const Select = forwardRef(function Select2({
|
|
|
6483
6773
|
const selectContext = useCreateSelectContext({
|
|
6484
6774
|
multiple,
|
|
6485
6775
|
value: actualValue,
|
|
6486
|
-
setValue,
|
|
6487
6776
|
onOptionSelect: handleOptionSelect,
|
|
6488
6777
|
status,
|
|
6489
6778
|
disabled,
|
|
@@ -6546,6 +6835,7 @@ const Select = forwardRef(function Select2({
|
|
|
6546
6835
|
icon: showOpen ? faChevronUp : faChevronDown,
|
|
6547
6836
|
className: cx(
|
|
6548
6837
|
prefix("select__arrow"),
|
|
6838
|
+
printHidden,
|
|
6549
6839
|
arrowProps?.className
|
|
6550
6840
|
),
|
|
6551
6841
|
"data-status": status,
|
|
@@ -7390,6 +7680,7 @@ const DateInput = forwardRef(
|
|
|
7390
7680
|
placeholder ??= locale.DateInput.placeholder;
|
|
7391
7681
|
formatDescription ??= locale.DateInput.formatDescription;
|
|
7392
7682
|
calendarButtonLabel ??= locale.DateInput.calendarButtonLabel;
|
|
7683
|
+
const { printHidden } = usePrintClassNames();
|
|
7393
7684
|
const { format: formatDate, parse: parseDate } = useDateTransformer({
|
|
7394
7685
|
locale: dateFnsLocale,
|
|
7395
7686
|
shortFormat,
|
|
@@ -7571,6 +7862,7 @@ const DateInput = forwardRef(
|
|
|
7571
7862
|
/* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(
|
|
7572
7863
|
"button",
|
|
7573
7864
|
{
|
|
7865
|
+
className: printHidden,
|
|
7574
7866
|
"aria-label": calendarButtonLabel?.(
|
|
7575
7867
|
fullFormattedValue,
|
|
7576
7868
|
!disabled && !readOnly
|
|
@@ -7834,6 +8126,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
7834
8126
|
const labelId = useFieldLabelId();
|
|
7835
8127
|
const descriptionIds = useFieldDescriptionIds();
|
|
7836
8128
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
8129
|
+
const { printHidden } = usePrintClassNames();
|
|
7837
8130
|
const { controlId, codeId } = useSetFieldControl(
|
|
7838
8131
|
startInputProps?.id,
|
|
7839
8132
|
"INPUT",
|
|
@@ -8300,6 +8593,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8300
8593
|
className: cx(
|
|
8301
8594
|
prefix("date-range-input__clear-button"),
|
|
8302
8595
|
prefix("date-range-input__clear-button--start"),
|
|
8596
|
+
printHidden,
|
|
8303
8597
|
startClearButtonProps?.className
|
|
8304
8598
|
),
|
|
8305
8599
|
onClick: combineEventHandlers(
|
|
@@ -8413,6 +8707,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8413
8707
|
className: cx(
|
|
8414
8708
|
prefix("date-range-input__clear-button"),
|
|
8415
8709
|
prefix("date-range-input__clear-button--end"),
|
|
8710
|
+
printHidden,
|
|
8416
8711
|
endClearButtonProps?.className
|
|
8417
8712
|
),
|
|
8418
8713
|
onClick: combineEventHandlers(
|
|
@@ -8452,7 +8747,10 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8452
8747
|
onClick: handleAddonButtonClick,
|
|
8453
8748
|
onBlur: handleControlBlur,
|
|
8454
8749
|
"data-state": void 0,
|
|
8455
|
-
className: cx(
|
|
8750
|
+
className: cx(
|
|
8751
|
+
prefix("date-range-input__calendar-button"),
|
|
8752
|
+
printHidden
|
|
8753
|
+
),
|
|
8456
8754
|
ref: addonButtonRef,
|
|
8457
8755
|
children: /* @__PURE__ */ jsx(Icon, { icon: faCalendar })
|
|
8458
8756
|
}
|
|
@@ -10254,14 +10552,30 @@ const Stepper = forwardRef(function Stepper2({
|
|
|
10254
10552
|
) });
|
|
10255
10553
|
});
|
|
10256
10554
|
const TabsContext = createContext(null);
|
|
10257
|
-
function useCreateTabsContext(variant, defaultValue, value) {
|
|
10555
|
+
function useCreateTabsContext(variant, defaultValue, value, showAllTabsWhilePrinting) {
|
|
10258
10556
|
const store = useConstant(
|
|
10259
10557
|
() => createStore()(
|
|
10260
|
-
subscribeWithSelector((
|
|
10558
|
+
subscribeWithSelector((set, get) => ({
|
|
10261
10559
|
activeTab: value?.toString() ?? defaultValue?.toString(),
|
|
10262
10560
|
showScrollButtons: false,
|
|
10263
10561
|
width: 0,
|
|
10264
|
-
scrollPosition: void 0
|
|
10562
|
+
scrollPosition: void 0,
|
|
10563
|
+
tabsLabels: {},
|
|
10564
|
+
actions: {
|
|
10565
|
+
registerTabLabel: (value2, label) => {
|
|
10566
|
+
set(({ tabsLabels }) => ({
|
|
10567
|
+
tabsLabels: { ...tabsLabels, [value2]: label }
|
|
10568
|
+
}));
|
|
10569
|
+
return () => {
|
|
10570
|
+
set(({ tabsLabels: { [value2]: _, ...otherLabels } }) => ({
|
|
10571
|
+
tabsLabels: otherLabels
|
|
10572
|
+
}));
|
|
10573
|
+
};
|
|
10574
|
+
},
|
|
10575
|
+
getTabLabel: (value2) => {
|
|
10576
|
+
return get().tabsLabels[value2];
|
|
10577
|
+
}
|
|
10578
|
+
}
|
|
10265
10579
|
}))
|
|
10266
10580
|
)
|
|
10267
10581
|
);
|
|
@@ -10270,7 +10584,10 @@ function useCreateTabsContext(variant, defaultValue, value) {
|
|
|
10270
10584
|
store.setState({ activeTab: value.toString() });
|
|
10271
10585
|
}
|
|
10272
10586
|
}, [store, value]);
|
|
10273
|
-
return useMemo(
|
|
10587
|
+
return useMemo(
|
|
10588
|
+
() => ({ variant, showAllTabsWhilePrinting, store }),
|
|
10589
|
+
[showAllTabsWhilePrinting, store, variant]
|
|
10590
|
+
);
|
|
10274
10591
|
}
|
|
10275
10592
|
function useTabsContext() {
|
|
10276
10593
|
const tabsContext = useContext(TabsContext);
|
|
@@ -10279,11 +10596,26 @@ function useTabsContext() {
|
|
|
10279
10596
|
}
|
|
10280
10597
|
return tabsContext;
|
|
10281
10598
|
}
|
|
10599
|
+
function useRegisterTabLabel(value, label) {
|
|
10600
|
+
const { showAllTabsWhilePrinting, store } = useTabsContext();
|
|
10601
|
+
const needsRegisteredTabLabels = usePrinting() && showAllTabsWhilePrinting;
|
|
10602
|
+
const { registerTabLabel } = useStore(store, (state) => state.actions);
|
|
10603
|
+
useEffect(() => {
|
|
10604
|
+
if (needsRegisteredTabLabels) {
|
|
10605
|
+
return registerTabLabel(value, label);
|
|
10606
|
+
}
|
|
10607
|
+
}, [label, needsRegisteredTabLabels, registerTabLabel, value]);
|
|
10608
|
+
}
|
|
10609
|
+
function useTabLabel(value) {
|
|
10610
|
+
const { store } = useTabsContext();
|
|
10611
|
+
return useStore(store, (state) => state.actions.getTabLabel(value));
|
|
10612
|
+
}
|
|
10282
10613
|
const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className, children, ...otherProps }, forwardedRef) {
|
|
10283
10614
|
const prefix = usePrefix();
|
|
10284
10615
|
const { variant, store } = useTabsContext();
|
|
10285
10616
|
const stringValue = value.toString();
|
|
10286
10617
|
const isActive = useStore(store, (state) => state.activeTab === stringValue);
|
|
10618
|
+
useRegisterTabLabel(stringValue, children);
|
|
10287
10619
|
const tabRef = useRef(null);
|
|
10288
10620
|
useEffect(() => {
|
|
10289
10621
|
if (isActive) {
|
|
@@ -10329,21 +10661,41 @@ const Tab = forwardRef(function Tab2({ value, status, tabInnerProps, className,
|
|
|
10329
10661
|
}
|
|
10330
10662
|
);
|
|
10331
10663
|
});
|
|
10332
|
-
const TabContent = forwardRef(function TabContent2({ value, className, ...otherProps }, forwardedRef) {
|
|
10664
|
+
const TabContent = forwardRef(function TabContent2({ asChild, value, className, tabContentLabelProps, ...otherProps }, forwardedRef) {
|
|
10333
10665
|
const prefix = usePrefix();
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10666
|
+
const printing = usePrinting();
|
|
10667
|
+
const stringValue = value.toString();
|
|
10668
|
+
const { showAllTabsWhilePrinting } = useTabsContext();
|
|
10669
|
+
const tabLabel = useTabLabel(stringValue);
|
|
10670
|
+
const As = printing && showAllTabsWhilePrinting ? asChild ? Slot : "div" : Tabs$1.TabsContent;
|
|
10671
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10672
|
+
printing && showAllTabsWhilePrinting && /* @__PURE__ */ jsx(
|
|
10673
|
+
"span",
|
|
10674
|
+
{
|
|
10675
|
+
...tabContentLabelProps,
|
|
10676
|
+
className: cx(
|
|
10677
|
+
prefix("tabs__tab-content-label"),
|
|
10678
|
+
tabContentLabelProps?.className
|
|
10679
|
+
),
|
|
10680
|
+
children: tabLabel
|
|
10681
|
+
}
|
|
10682
|
+
),
|
|
10683
|
+
/* @__PURE__ */ jsx(
|
|
10684
|
+
As,
|
|
10685
|
+
{
|
|
10686
|
+
...!printing || !showAllTabsWhilePrinting ? { asChild } : {},
|
|
10687
|
+
value: stringValue,
|
|
10688
|
+
className: cx(prefix("tabs__tab-content"), className),
|
|
10689
|
+
...otherProps,
|
|
10690
|
+
ref: forwardedRef
|
|
10691
|
+
}
|
|
10692
|
+
)
|
|
10693
|
+
] });
|
|
10343
10694
|
});
|
|
10344
10695
|
const TabList = forwardRef(function TabList2({ rootProps, containerProps, className, children, ...otherProps }, forwardedRef) {
|
|
10345
10696
|
const prefix = usePrefix();
|
|
10346
|
-
const { variant, store } = useTabsContext();
|
|
10697
|
+
const { variant, showAllTabsWhilePrinting, store } = useTabsContext();
|
|
10698
|
+
const { printHidden } = usePrintClassNames();
|
|
10347
10699
|
const [rootEl, setRootEl] = useState(null);
|
|
10348
10700
|
const [containerEl, setContainerEl] = useState(null);
|
|
10349
10701
|
useMeasure(
|
|
@@ -10421,6 +10773,7 @@ const TabList = forwardRef(function TabList2({ rootProps, containerProps, classN
|
|
|
10421
10773
|
className: cx(
|
|
10422
10774
|
prefix("tabs__tab-list-root"),
|
|
10423
10775
|
prefix(`tabs__tab-list-root--${variant}`),
|
|
10776
|
+
showAllTabsWhilePrinting && printHidden,
|
|
10424
10777
|
rootProps?.className
|
|
10425
10778
|
),
|
|
10426
10779
|
ref: combinedRootRef,
|
|
@@ -10486,11 +10839,17 @@ const Tabs = forwardRef(function Tabs2({
|
|
|
10486
10839
|
defaultValue,
|
|
10487
10840
|
value,
|
|
10488
10841
|
onValueChange,
|
|
10842
|
+
showAllTabsWhilePrinting,
|
|
10489
10843
|
className,
|
|
10490
10844
|
...otherProps
|
|
10491
10845
|
}, forwardedRef) {
|
|
10492
10846
|
const prefix = usePrefix();
|
|
10493
|
-
const tabsContextValue = useCreateTabsContext(
|
|
10847
|
+
const tabsContextValue = useCreateTabsContext(
|
|
10848
|
+
variant,
|
|
10849
|
+
defaultValue,
|
|
10850
|
+
value,
|
|
10851
|
+
showAllTabsWhilePrinting
|
|
10852
|
+
);
|
|
10494
10853
|
const handleValueChange = useCallback(
|
|
10495
10854
|
(value2) => tabsContextValue.store.setState({ activeTab: value2 }),
|
|
10496
10855
|
[tabsContextValue.store]
|
|
@@ -10602,6 +10961,7 @@ function registerKeyboardShortcut(keybinds, action, {
|
|
|
10602
10961
|
});
|
|
10603
10962
|
}
|
|
10604
10963
|
function useKeyboardShortcut(keybinds, action, {
|
|
10964
|
+
enabled = true,
|
|
10605
10965
|
target = window,
|
|
10606
10966
|
eventType = "keydown",
|
|
10607
10967
|
sequenceTimeout = 1e3,
|
|
@@ -10612,7 +10972,7 @@ function useKeyboardShortcut(keybinds, action, {
|
|
|
10612
10972
|
const shortcutsString = Array.isArray(keybinds) ? keybinds.join("__") : keybinds;
|
|
10613
10973
|
const latestCallbacks = useLatestValues({ action, ignore });
|
|
10614
10974
|
useEffect(() => {
|
|
10615
|
-
if (shortcutsString && target !== null) {
|
|
10975
|
+
if (enabled && shortcutsString && target !== null) {
|
|
10616
10976
|
return registerKeyboardShortcut(
|
|
10617
10977
|
shortcutsString.split("__"),
|
|
10618
10978
|
(evt) => latestCallbacks.action(evt),
|
|
@@ -10628,6 +10988,7 @@ function useKeyboardShortcut(keybinds, action, {
|
|
|
10628
10988
|
}
|
|
10629
10989
|
}, [
|
|
10630
10990
|
capture,
|
|
10991
|
+
enabled,
|
|
10631
10992
|
eventType,
|
|
10632
10993
|
latestCallbacks,
|
|
10633
10994
|
preventDefault,
|
|
@@ -10904,6 +11265,9 @@ export {
|
|
|
10904
11265
|
PortalContext,
|
|
10905
11266
|
PrefixContext,
|
|
10906
11267
|
PrefixProvider,
|
|
11268
|
+
Printer,
|
|
11269
|
+
PrinterContent,
|
|
11270
|
+
PrinterTrigger,
|
|
10907
11271
|
Radio,
|
|
10908
11272
|
RadioGroup,
|
|
10909
11273
|
Root,
|
|
@@ -11007,6 +11371,10 @@ export {
|
|
|
11007
11371
|
useOnFieldLabelChange,
|
|
11008
11372
|
usePortalContext,
|
|
11009
11373
|
usePrefix,
|
|
11374
|
+
usePrint,
|
|
11375
|
+
usePrintClassNames,
|
|
11376
|
+
usePrintInProgress,
|
|
11377
|
+
usePrinting,
|
|
11010
11378
|
useResponsiveValues,
|
|
11011
11379
|
useScrollPosition,
|
|
11012
11380
|
useScrollbarSize,
|
|
@@ -11018,6 +11386,7 @@ export {
|
|
|
11018
11386
|
useSetFieldHelperText,
|
|
11019
11387
|
useSetFieldLabel,
|
|
11020
11388
|
useSpacing,
|
|
11389
|
+
useStartPrintingTask,
|
|
11021
11390
|
useTableNumberOfColumns,
|
|
11022
11391
|
useToastManager,
|
|
11023
11392
|
validateNumericTransformerOptions,
|