@ostack.tech/ui 1.3.1 → 1.3.3
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/ostack-ui.css +20 -20
- package/dist/ostack-ui.js +82 -100
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +1 -1
- package/scss/scss/helpers/_margin-utils.scss +1 -1
- package/scss/scss/helpers/_padding-utils.scss +1 -1
- package/scss/scss/helpers/_print-utils.scss +3 -1
- package/scss/scss/helpers/_sizing-utils.scss +1 -1
- package/scss/scss/helpers/_text-utils.scss +1 -1
- package/types/components/Printer/Printer.d.ts +1 -1
package/dist/ostack-ui.css
CHANGED
|
@@ -193,16 +193,16 @@
|
|
|
193
193
|
--o-ui-ml: var(--o-ui-ml-xxl);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
:
|
|
196
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-mt] {
|
|
197
197
|
margin-top: var(--o-ui-mt);
|
|
198
198
|
}
|
|
199
|
-
:
|
|
199
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-mr] {
|
|
200
200
|
margin-right: var(--o-ui-mr);
|
|
201
201
|
}
|
|
202
|
-
:
|
|
202
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-mb] {
|
|
203
203
|
margin-bottom: var(--o-ui-mb);
|
|
204
204
|
}
|
|
205
|
-
:
|
|
205
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-ml] {
|
|
206
206
|
margin-left: var(--o-ui-ml);
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -308,16 +308,16 @@
|
|
|
308
308
|
--o-ui-pl: var(--o-ui-pl-xxl);
|
|
309
309
|
}
|
|
310
310
|
}
|
|
311
|
-
:
|
|
311
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-pt] {
|
|
312
312
|
padding-top: var(--o-ui-pt);
|
|
313
313
|
}
|
|
314
|
-
:
|
|
314
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-pr] {
|
|
315
315
|
padding-right: var(--o-ui-pr);
|
|
316
316
|
}
|
|
317
|
-
:
|
|
317
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-pb] {
|
|
318
318
|
padding-bottom: var(--o-ui-pb);
|
|
319
319
|
}
|
|
320
|
-
:
|
|
320
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-pl] {
|
|
321
321
|
padding-left: var(--o-ui-pl);
|
|
322
322
|
}
|
|
323
323
|
|
|
@@ -327,7 +327,7 @@
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
@media not print {
|
|
330
|
-
.o-ui-print-only {
|
|
330
|
+
body:not(.o-ui-printer__iframe) .o-ui-print-only {
|
|
331
331
|
display: none !important;
|
|
332
332
|
}
|
|
333
333
|
}
|
|
@@ -479,22 +479,22 @@
|
|
|
479
479
|
--o-ui-max-h: var(--o-ui-max-h-xxl);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
:
|
|
482
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-w] {
|
|
483
483
|
width: var(--o-ui-w);
|
|
484
484
|
}
|
|
485
|
-
:
|
|
485
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-min-w] {
|
|
486
486
|
min-width: var(--o-ui-min-w);
|
|
487
487
|
}
|
|
488
|
-
:
|
|
488
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-max-w] {
|
|
489
489
|
max-width: var(--o-ui-max-w);
|
|
490
490
|
}
|
|
491
|
-
:
|
|
491
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-h] {
|
|
492
492
|
height: var(--o-ui-h);
|
|
493
493
|
}
|
|
494
|
-
:
|
|
494
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-min-h] {
|
|
495
495
|
min-height: var(--o-ui-min-h);
|
|
496
496
|
}
|
|
497
|
-
:
|
|
497
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-max-h] {
|
|
498
498
|
max-height: var(--o-ui-max-h);
|
|
499
499
|
}
|
|
500
500
|
|
|
@@ -623,22 +623,22 @@
|
|
|
623
623
|
--o-ui-text-wrap: var(--o-ui-text-wrap-xxl);
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
:
|
|
626
|
+
:where(.o-ui-root, .o-ui-root *)[data-text-truncate] {
|
|
627
627
|
text-overflow: ellipsis;
|
|
628
628
|
white-space: nowrap;
|
|
629
629
|
overflow: hidden;
|
|
630
630
|
}
|
|
631
|
-
:
|
|
631
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-text-size] {
|
|
632
632
|
font-size: var(--o-ui-font-size);
|
|
633
633
|
line-height: var(--o-ui-line-height);
|
|
634
634
|
}
|
|
635
|
-
:
|
|
635
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-text-align] {
|
|
636
636
|
text-align: var(--o-ui-text-align);
|
|
637
637
|
}
|
|
638
|
-
:
|
|
638
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-font-weight] {
|
|
639
639
|
font-weight: var(--o-ui-font-weight);
|
|
640
640
|
}
|
|
641
|
-
:
|
|
641
|
+
:where(.o-ui-root, .o-ui-root *)[data-has-text-wrap] {
|
|
642
642
|
text-wrap: var(--o-ui-text-wrap);
|
|
643
643
|
}
|
|
644
644
|
|
package/dist/ostack-ui.js
CHANGED
|
@@ -12288,35 +12288,6 @@ function usePrintInProgress() {
|
|
|
12288
12288
|
function usePrint() {
|
|
12289
12289
|
return usePrinterContext().print;
|
|
12290
12290
|
}
|
|
12291
|
-
// src/components/Printer/usePrintClassNames.ts
|
|
12292
|
-
/** Hook which exposes print-related class names. */
|
|
12293
|
-
function usePrintClassNames() {
|
|
12294
|
-
const $ = c(7);
|
|
12295
|
-
const prefix = usePrefix();
|
|
12296
|
-
let t0;
|
|
12297
|
-
if ($[0] !== prefix) {
|
|
12298
|
-
t0 = prefix("print-only");
|
|
12299
|
-
$[0] = prefix;
|
|
12300
|
-
$[1] = t0;
|
|
12301
|
-
} else t0 = $[1];
|
|
12302
|
-
let t1;
|
|
12303
|
-
if ($[2] !== prefix) {
|
|
12304
|
-
t1 = prefix("print-hidden");
|
|
12305
|
-
$[2] = prefix;
|
|
12306
|
-
$[3] = t1;
|
|
12307
|
-
} else t1 = $[3];
|
|
12308
|
-
let t2;
|
|
12309
|
-
if ($[4] !== t0 || $[5] !== t1) {
|
|
12310
|
-
t2 = {
|
|
12311
|
-
printOnly: t0,
|
|
12312
|
-
printHidden: t1
|
|
12313
|
-
};
|
|
12314
|
-
$[4] = t0;
|
|
12315
|
-
$[5] = t1;
|
|
12316
|
-
$[6] = t2;
|
|
12317
|
-
} else t2 = $[6];
|
|
12318
|
-
return t2;
|
|
12319
|
-
}
|
|
12320
12291
|
// src/components/Printer/Printer.tsx
|
|
12321
12292
|
/**
|
|
12322
12293
|
* Component used to print content using the browser's printing functionality. The content is copied
|
|
@@ -12356,11 +12327,10 @@ function usePrintClassNames() {
|
|
|
12356
12327
|
* ```
|
|
12357
12328
|
*/
|
|
12358
12329
|
function Printer(t0) {
|
|
12359
|
-
const $ = c(
|
|
12360
|
-
const { preview, printInForeground, documentTitle, pageSize, pageMargin, printColorAdjust: t1, fonts, copyShadowRoots, nonce, printFn, onBeforePrint, onAfterPrint, iframeProps, children } = t0;
|
|
12330
|
+
const $ = c(42);
|
|
12331
|
+
const { preview, printInForeground, documentTitle: documentTitleProp, pageSize, pageMargin, printColorAdjust: t1, fonts, copyShadowRoots, nonce, printFn, onBeforePrint, onAfterPrint, iframeProps, children } = t0;
|
|
12361
12332
|
const printColorAdjust = t1 === void 0 ? "exact" : t1;
|
|
12362
12333
|
const prefix = usePrefix();
|
|
12363
|
-
const { printOnly } = usePrintClassNames();
|
|
12364
12334
|
const triggerRef = useRef(null);
|
|
12365
12335
|
const contentRef = useRef(null);
|
|
12366
12336
|
const [printInProgress, setPrintInProgress] = useState(false);
|
|
@@ -12421,19 +12391,19 @@ function Printer(t0) {
|
|
|
12421
12391
|
$[3] = t5;
|
|
12422
12392
|
} else t5 = $[3];
|
|
12423
12393
|
const waitForPrintingTasks = t5;
|
|
12424
|
-
const
|
|
12394
|
+
const documentTitle = printOptions?.documentTitle ?? documentTitleProp;
|
|
12425
12395
|
let t6;
|
|
12426
12396
|
if ($[4] !== prefix || $[5] !== preview || $[6] !== printInForeground) {
|
|
12427
|
-
t6 = preview || printInForeground
|
|
12397
|
+
t6 = cx(prefix("printer__iframe"), (preview || printInForeground) && prefix("root"));
|
|
12428
12398
|
$[4] = prefix;
|
|
12429
12399
|
$[5] = preview;
|
|
12430
12400
|
$[6] = printInForeground;
|
|
12431
12401
|
$[7] = t6;
|
|
12432
12402
|
} else t6 = $[7];
|
|
12433
12403
|
let t7;
|
|
12434
|
-
if ($[8] !==
|
|
12435
|
-
t7 = typeof
|
|
12436
|
-
$[8] =
|
|
12404
|
+
if ($[8] !== documentTitle) {
|
|
12405
|
+
t7 = typeof documentTitle === "function" ? () => documentTitle() ?? getDocumentTitle() : documentTitle ?? getDocumentTitle();
|
|
12406
|
+
$[8] = documentTitle;
|
|
12437
12407
|
$[9] = t7;
|
|
12438
12408
|
} else t7 = $[9];
|
|
12439
12409
|
const t8 = printOptions?.pageSize ?? pageSize;
|
|
@@ -12455,26 +12425,9 @@ function Printer(t0) {
|
|
|
12455
12425
|
const t13 = printOptions?.copyShadowRoots ?? copyShadowRoots;
|
|
12456
12426
|
const t14 = printOptions?.nonce ?? nonce;
|
|
12457
12427
|
const t15 = printOptions?.iframeProps ?? iframeProps;
|
|
12458
|
-
|
|
12459
|
-
if ($[14] !== printFn || $[15] !== printOnly || $[16] !== printOptions?.printFn) {
|
|
12460
|
-
t16 = async (iframe) => {
|
|
12461
|
-
const doc = iframe.contentDocument;
|
|
12462
|
-
const win = iframe.contentWindow;
|
|
12463
|
-
if (doc && win) {
|
|
12464
|
-
for (const el of doc.querySelectorAll(`.${printOnly}`)) el.classList.remove(printOnly);
|
|
12465
|
-
await new Promise((res) => win.requestAnimationFrame(res));
|
|
12466
|
-
}
|
|
12467
|
-
const customPrintFn = printOptions?.printFn ?? printFn;
|
|
12468
|
-
if (customPrintFn) return customPrintFn(iframe);
|
|
12469
|
-
win?.print();
|
|
12470
|
-
};
|
|
12471
|
-
$[14] = printFn;
|
|
12472
|
-
$[15] = printOnly;
|
|
12473
|
-
$[16] = printOptions?.printFn;
|
|
12474
|
-
$[17] = t16;
|
|
12475
|
-
} else t16 = $[17];
|
|
12428
|
+
const t16 = printOptions?.printFn ?? printFn;
|
|
12476
12429
|
let t17;
|
|
12477
|
-
if ($[
|
|
12430
|
+
if ($[14] !== onAfterPrint) {
|
|
12478
12431
|
t17 = () => {
|
|
12479
12432
|
let event;
|
|
12480
12433
|
withCleanup(() => onAfterPrint?.(event = new Event("ostack-ui.afterPrint")), () => {
|
|
@@ -12482,19 +12435,19 @@ function Printer(t0) {
|
|
|
12482
12435
|
finishPrint(!event?.defaultPrevented);
|
|
12483
12436
|
});
|
|
12484
12437
|
};
|
|
12485
|
-
$[
|
|
12486
|
-
$[
|
|
12487
|
-
} else t17 = $[
|
|
12438
|
+
$[14] = onAfterPrint;
|
|
12439
|
+
$[15] = t17;
|
|
12440
|
+
} else t17 = $[15];
|
|
12488
12441
|
let t18;
|
|
12489
|
-
if ($[
|
|
12442
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
12490
12443
|
t18 = (_errorLocation, error) => {
|
|
12491
12444
|
rejectPrintRef.current?.(error);
|
|
12492
12445
|
finishPrint();
|
|
12493
12446
|
};
|
|
12494
|
-
$[
|
|
12495
|
-
} else t18 = $[
|
|
12447
|
+
$[16] = t18;
|
|
12448
|
+
} else t18 = $[16];
|
|
12496
12449
|
let t19;
|
|
12497
|
-
if ($[
|
|
12450
|
+
if ($[17] !== t11 || $[18] !== t12 || $[19] !== t13 || $[20] !== t14 || $[21] !== t15 || $[22] !== t16 || $[23] !== t17 || $[24] !== t6 || $[25] !== t7) {
|
|
12498
12451
|
t19 = {
|
|
12499
12452
|
bodyClass: t6,
|
|
12500
12453
|
documentTitle: t7,
|
|
@@ -12508,33 +12461,33 @@ function Printer(t0) {
|
|
|
12508
12461
|
onAfterPrint: t17,
|
|
12509
12462
|
onPrintError: t18
|
|
12510
12463
|
};
|
|
12511
|
-
$[
|
|
12512
|
-
$[
|
|
12513
|
-
$[
|
|
12514
|
-
$[
|
|
12515
|
-
$[
|
|
12516
|
-
$[
|
|
12517
|
-
$[
|
|
12518
|
-
$[
|
|
12519
|
-
$[
|
|
12520
|
-
$[
|
|
12521
|
-
} else t19 = $[
|
|
12464
|
+
$[17] = t11;
|
|
12465
|
+
$[18] = t12;
|
|
12466
|
+
$[19] = t13;
|
|
12467
|
+
$[20] = t14;
|
|
12468
|
+
$[21] = t15;
|
|
12469
|
+
$[22] = t16;
|
|
12470
|
+
$[23] = t17;
|
|
12471
|
+
$[24] = t6;
|
|
12472
|
+
$[25] = t7;
|
|
12473
|
+
$[26] = t19;
|
|
12474
|
+
} else t19 = $[26];
|
|
12522
12475
|
const reactToPrintFn = useReactToPrint(t19);
|
|
12523
12476
|
let t20;
|
|
12524
|
-
if ($[
|
|
12477
|
+
if ($[27] !== onBeforePrint || $[28] !== printInProgress || $[29] !== reactToPrintFn) {
|
|
12525
12478
|
t20 = {
|
|
12526
12479
|
printInProgress,
|
|
12527
12480
|
reactToPrintFn,
|
|
12528
12481
|
onBeforePrint
|
|
12529
12482
|
};
|
|
12530
|
-
$[
|
|
12531
|
-
$[
|
|
12532
|
-
$[
|
|
12533
|
-
$[
|
|
12534
|
-
} else t20 = $[
|
|
12483
|
+
$[27] = onBeforePrint;
|
|
12484
|
+
$[28] = printInProgress;
|
|
12485
|
+
$[29] = reactToPrintFn;
|
|
12486
|
+
$[30] = t20;
|
|
12487
|
+
} else t20 = $[30];
|
|
12535
12488
|
const latestRef = useLatestRef(t20);
|
|
12536
12489
|
let t21;
|
|
12537
|
-
if ($[
|
|
12490
|
+
if ($[31] !== latestRef) {
|
|
12538
12491
|
t21 = async (options) => {
|
|
12539
12492
|
const { printInProgress: printInProgress_0, onBeforePrint: onBeforePrint_0 } = latestRef.current;
|
|
12540
12493
|
if (printInProgress_0) throw new Error("Printing is already in progress.");
|
|
@@ -12554,45 +12507,45 @@ function Printer(t0) {
|
|
|
12554
12507
|
finishPrint();
|
|
12555
12508
|
throw error_0;
|
|
12556
12509
|
}
|
|
12557
|
-
return new Promise((
|
|
12558
|
-
resolvePrintRef.current =
|
|
12510
|
+
return new Promise((res, rej) => {
|
|
12511
|
+
resolvePrintRef.current = res;
|
|
12559
12512
|
rejectPrintRef.current = rej;
|
|
12560
12513
|
latestRef.current.reactToPrintFn(() => contentRef.current);
|
|
12561
12514
|
});
|
|
12562
12515
|
};
|
|
12563
|
-
$[
|
|
12564
|
-
$[
|
|
12565
|
-
} else t21 = $[
|
|
12516
|
+
$[31] = latestRef;
|
|
12517
|
+
$[32] = t21;
|
|
12518
|
+
} else t21 = $[32];
|
|
12566
12519
|
const handlePrint = t21;
|
|
12567
12520
|
let t22;
|
|
12568
|
-
if ($[
|
|
12521
|
+
if ($[33] !== documentTitleProp || $[34] !== handlePrint || $[35] !== preview || $[36] !== printInForeground || $[37] !== printInProgress) {
|
|
12569
12522
|
t22 = {
|
|
12570
12523
|
preview,
|
|
12571
12524
|
printInForeground,
|
|
12572
|
-
documentTitle,
|
|
12525
|
+
documentTitle: documentTitleProp,
|
|
12573
12526
|
printInProgress,
|
|
12574
12527
|
triggerRef,
|
|
12575
12528
|
contentRef,
|
|
12576
12529
|
print: handlePrint,
|
|
12577
12530
|
startPrintingTask
|
|
12578
12531
|
};
|
|
12579
|
-
$[
|
|
12580
|
-
$[
|
|
12581
|
-
$[
|
|
12582
|
-
$[
|
|
12583
|
-
$[
|
|
12584
|
-
$[
|
|
12585
|
-
} else t22 = $[
|
|
12532
|
+
$[33] = documentTitleProp;
|
|
12533
|
+
$[34] = handlePrint;
|
|
12534
|
+
$[35] = preview;
|
|
12535
|
+
$[36] = printInForeground;
|
|
12536
|
+
$[37] = printInProgress;
|
|
12537
|
+
$[38] = t22;
|
|
12538
|
+
} else t22 = $[38];
|
|
12586
12539
|
let t23;
|
|
12587
|
-
if ($[
|
|
12540
|
+
if ($[39] !== children || $[40] !== t22) {
|
|
12588
12541
|
t23 = /* @__PURE__ */ jsx(PrinterContext, {
|
|
12589
12542
|
value: t22,
|
|
12590
12543
|
children
|
|
12591
12544
|
});
|
|
12592
|
-
$[
|
|
12593
|
-
$[
|
|
12594
|
-
$[
|
|
12595
|
-
} else t23 = $[
|
|
12545
|
+
$[39] = children;
|
|
12546
|
+
$[40] = t22;
|
|
12547
|
+
$[41] = t23;
|
|
12548
|
+
} else t23 = $[41];
|
|
12596
12549
|
return t23;
|
|
12597
12550
|
}
|
|
12598
12551
|
function _temp$41(resolve) {
|
|
@@ -12612,6 +12565,35 @@ function printPageStyle({ pageSize, pageMargin, printColorAdjust }) {
|
|
|
12612
12565
|
if (pageMargin != null) pageStyle += `@page { margin: ${pageMargin} }`;
|
|
12613
12566
|
return pageStyle;
|
|
12614
12567
|
}
|
|
12568
|
+
// src/components/Printer/usePrintClassNames.ts
|
|
12569
|
+
/** Hook which exposes print-related class names. */
|
|
12570
|
+
function usePrintClassNames() {
|
|
12571
|
+
const $ = c(7);
|
|
12572
|
+
const prefix = usePrefix();
|
|
12573
|
+
let t0;
|
|
12574
|
+
if ($[0] !== prefix) {
|
|
12575
|
+
t0 = prefix("print-only");
|
|
12576
|
+
$[0] = prefix;
|
|
12577
|
+
$[1] = t0;
|
|
12578
|
+
} else t0 = $[1];
|
|
12579
|
+
let t1;
|
|
12580
|
+
if ($[2] !== prefix) {
|
|
12581
|
+
t1 = prefix("print-hidden");
|
|
12582
|
+
$[2] = prefix;
|
|
12583
|
+
$[3] = t1;
|
|
12584
|
+
} else t1 = $[3];
|
|
12585
|
+
let t2;
|
|
12586
|
+
if ($[4] !== t0 || $[5] !== t1) {
|
|
12587
|
+
t2 = {
|
|
12588
|
+
printOnly: t0,
|
|
12589
|
+
printHidden: t1
|
|
12590
|
+
};
|
|
12591
|
+
$[4] = t0;
|
|
12592
|
+
$[5] = t1;
|
|
12593
|
+
$[6] = t2;
|
|
12594
|
+
} else t2 = $[6];
|
|
12595
|
+
return t2;
|
|
12596
|
+
}
|
|
12615
12597
|
// src/components/Printer/PrinterContent.tsx
|
|
12616
12598
|
/**
|
|
12617
12599
|
* Content to be printed.
|