@ostack.tech/ui 0.6.0 → 0.6.2
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/chunks/{en-lyNzumTm.js → en-C2peM913.js} +2 -2
- package/dist/chunks/en-C2peM913.js.map +1 -0
- package/dist/locales/en-GB.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/fr-FR.js +1 -1
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +1 -1
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +79 -43
- package/dist/ostack-ui.css.map +1 -1
- package/dist/ostack-ui.js +135 -78
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/Field/FieldContext.d.ts +2 -0
- package/dist/types/components/Field/index.d.ts +1 -1
- package/dist/types/components/Table/Table.d.ts +49 -3
- package/dist/types/components/Table/TableContext.d.ts +4 -6
- package/dist/types/providers/LocalizationProvider/LocalizationObject.d.ts +1 -1
- package/package.json +3 -3
- package/scss/components/CloseButton/_CloseButton-variables.scss +35 -1
- package/scss/components/CloseButton/_CloseButton.scss +19 -2
- package/scss/components/DataTable/_DataTable.scss +34 -38
- package/scss/components/Field/_Field.scss +11 -8
- package/scss/components/Table/_Table-variables.scss +10 -0
- package/scss/components/Table/_Table.scss +21 -1
- package/scss/components/Tag/_Tag-variables.scss +4 -1
- package/scss/components/Tag/_Tag.scss +4 -3
- package/dist/chunks/en-lyNzumTm.js.map +0 -1
package/dist/ostack-ui.js
CHANGED
|
@@ -866,6 +866,9 @@ function useFieldControlFocused() {
|
|
|
866
866
|
function useFieldControlRequired() {
|
|
867
867
|
return useFieldStore((state) => state.controlRequired);
|
|
868
868
|
}
|
|
869
|
+
function useFieldLabel() {
|
|
870
|
+
return useFieldStore((state) => state.label);
|
|
871
|
+
}
|
|
869
872
|
function useFieldLabelId() {
|
|
870
873
|
return useFieldStore((state) => state.labelId);
|
|
871
874
|
}
|
|
@@ -984,11 +987,7 @@ function useCreateTableContext(editable, status, layout, defaultColumnWidth, onT
|
|
|
984
987
|
subscribeWithSelector((_set) => ({
|
|
985
988
|
scrollPosition: void 0,
|
|
986
989
|
numberOfColumns: void 0,
|
|
987
|
-
columnWidths: void 0
|
|
988
|
-
actions: {
|
|
989
|
-
setTableMinWidth: onTableMinWidthChange,
|
|
990
|
-
setTableMaxWidth: onTableMaxWidthChange
|
|
991
|
-
}
|
|
990
|
+
columnWidths: void 0
|
|
992
991
|
}))
|
|
993
992
|
)
|
|
994
993
|
);
|
|
@@ -998,9 +997,19 @@ function useCreateTableContext(editable, status, layout, defaultColumnWidth, onT
|
|
|
998
997
|
status,
|
|
999
998
|
layout,
|
|
1000
999
|
defaultColumnWidth,
|
|
1000
|
+
onTableMinWidthChange,
|
|
1001
|
+
onTableMaxWidthChange,
|
|
1001
1002
|
store
|
|
1002
1003
|
}),
|
|
1003
|
-
[
|
|
1004
|
+
[
|
|
1005
|
+
defaultColumnWidth,
|
|
1006
|
+
editable,
|
|
1007
|
+
layout,
|
|
1008
|
+
onTableMaxWidthChange,
|
|
1009
|
+
onTableMinWidthChange,
|
|
1010
|
+
status,
|
|
1011
|
+
store
|
|
1012
|
+
]
|
|
1004
1013
|
);
|
|
1005
1014
|
}
|
|
1006
1015
|
function useTableContext() {
|
|
@@ -1480,9 +1489,10 @@ const IconButton = forwardRef(
|
|
|
1480
1489
|
}
|
|
1481
1490
|
);
|
|
1482
1491
|
const CloseButton = forwardRef(
|
|
1483
|
-
function CloseIconButton({ icon, label =
|
|
1492
|
+
function CloseIconButton({ icon, label, disableTooltip = true, className, ...otherProps }, forwardedRef) {
|
|
1484
1493
|
const prefix = usePrefix();
|
|
1485
1494
|
const [locale7] = useLocale();
|
|
1495
|
+
label ??= locale7.CloseButton.label;
|
|
1486
1496
|
return /* @__PURE__ */ jsx(
|
|
1487
1497
|
IconButton,
|
|
1488
1498
|
{
|
|
@@ -1491,7 +1501,7 @@ const CloseButton = forwardRef(
|
|
|
1491
1501
|
circle: true,
|
|
1492
1502
|
icon: icon ?? faClose,
|
|
1493
1503
|
label,
|
|
1494
|
-
|
|
1504
|
+
disableTooltip,
|
|
1495
1505
|
...otherProps,
|
|
1496
1506
|
ref: forwardedRef
|
|
1497
1507
|
}
|
|
@@ -3098,28 +3108,27 @@ function Printer({
|
|
|
3098
3108
|
});
|
|
3099
3109
|
const handlePrint = useCallback(
|
|
3100
3110
|
async (options) => {
|
|
3101
|
-
|
|
3102
|
-
if (printInProgress2) {
|
|
3111
|
+
if (latest.printInProgress) {
|
|
3103
3112
|
throw new Error("Printing is already in progress.");
|
|
3104
3113
|
}
|
|
3105
3114
|
flushSync(() => {
|
|
3106
3115
|
setPrintInProgress(true);
|
|
3107
|
-
const documentTitleToUse = options?.documentTitle ??
|
|
3116
|
+
const documentTitleToUse = options?.documentTitle ?? latest.documentTitle;
|
|
3108
3117
|
setPrintOptions({
|
|
3109
3118
|
...options,
|
|
3110
3119
|
documentTitle: typeof documentTitleToUse === "function" ? documentTitleToUse() : documentTitleToUse
|
|
3111
3120
|
});
|
|
3112
3121
|
});
|
|
3113
3122
|
await pendingPromiseRef.current;
|
|
3114
|
-
if (
|
|
3123
|
+
if (latest.onBeforePrint) {
|
|
3115
3124
|
const event = new Event("ostack-ui.print");
|
|
3116
|
-
await
|
|
3125
|
+
await latest.onBeforePrint?.(event);
|
|
3117
3126
|
if (event.defaultPrevented) {
|
|
3118
3127
|
return finishPrint();
|
|
3119
3128
|
}
|
|
3120
3129
|
}
|
|
3121
3130
|
return new Promise((res, rej) => {
|
|
3122
|
-
|
|
3131
|
+
latest.reactToPrintFn(() => contentRef.current);
|
|
3123
3132
|
resolvePrintRef.current = res;
|
|
3124
3133
|
rejectPrintRef.current = rej;
|
|
3125
3134
|
});
|
|
@@ -3296,6 +3305,9 @@ const Field = forwardRef(function Field2({ asChild, className, ...otherProps },
|
|
|
3296
3305
|
const DEFAULT_TABLE_COLUMN_WIDTH = 150;
|
|
3297
3306
|
const Table = forwardRef(
|
|
3298
3307
|
function Table2({
|
|
3308
|
+
caption,
|
|
3309
|
+
captionSide = "bottom",
|
|
3310
|
+
visuallyHiddenCaption = caption,
|
|
3299
3311
|
editable = false,
|
|
3300
3312
|
variant = editable ? "control" : "default",
|
|
3301
3313
|
status,
|
|
@@ -3304,14 +3316,17 @@ const Table = forwardRef(
|
|
|
3304
3316
|
defaultColumnWidth = DEFAULT_TABLE_COLUMN_WIDTH,
|
|
3305
3317
|
maxHeight,
|
|
3306
3318
|
containerProps,
|
|
3319
|
+
scrollableProps,
|
|
3320
|
+
captionProps,
|
|
3321
|
+
visuallyHiddenCaptionProps,
|
|
3307
3322
|
className,
|
|
3308
3323
|
children,
|
|
3309
|
-
"aria-labelledby": ariaLabelledBy,
|
|
3310
3324
|
"aria-describedby": ariaDescribedBy,
|
|
3311
3325
|
...otherProps
|
|
3312
3326
|
}, forwardedRef) {
|
|
3313
3327
|
const prefix = usePrefix();
|
|
3314
|
-
const
|
|
3328
|
+
const label = useFieldLabel();
|
|
3329
|
+
visuallyHiddenCaption ??= label;
|
|
3315
3330
|
const descriptionIds = useFieldDescriptionIds();
|
|
3316
3331
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
3317
3332
|
const { controlId, codeId } = useSetFieldControl(
|
|
@@ -3322,20 +3337,25 @@ const Table = forwardRef(
|
|
|
3322
3337
|
required
|
|
3323
3338
|
);
|
|
3324
3339
|
const tableRef = useRef(null);
|
|
3325
|
-
const [
|
|
3326
|
-
|
|
3340
|
+
const [scrollableEl, setScrollableEl] = useState(
|
|
3341
|
+
null
|
|
3342
|
+
);
|
|
3343
|
+
const handleMinWidthChange = useCallback((minWidth) => {
|
|
3327
3344
|
if (tableRef.current) {
|
|
3328
3345
|
tableRef.current.style.minWidth = minWidth ?? "";
|
|
3329
3346
|
}
|
|
3330
|
-
};
|
|
3331
|
-
const handleMaxWidthChange = (
|
|
3332
|
-
|
|
3333
|
-
tableRef.current
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3347
|
+
}, []);
|
|
3348
|
+
const handleMaxWidthChange = useCallback(
|
|
3349
|
+
(maxWidth) => {
|
|
3350
|
+
if (tableRef.current) {
|
|
3351
|
+
tableRef.current.style.maxWidth = maxWidth ?? "";
|
|
3352
|
+
}
|
|
3353
|
+
if (scrollableEl) {
|
|
3354
|
+
scrollableEl.style.maxWidth = maxWidth ? `min(100%, ${maxWidth})` : "";
|
|
3355
|
+
}
|
|
3356
|
+
},
|
|
3357
|
+
[scrollableEl]
|
|
3358
|
+
);
|
|
3339
3359
|
const tableContextValue = useCreateTableContext(
|
|
3340
3360
|
editable,
|
|
3341
3361
|
status,
|
|
@@ -3345,63 +3365,89 @@ const Table = forwardRef(
|
|
|
3345
3365
|
handleMaxWidthChange
|
|
3346
3366
|
);
|
|
3347
3367
|
useScrollPosition(
|
|
3348
|
-
|
|
3368
|
+
scrollableEl,
|
|
3349
3369
|
useCallback(
|
|
3350
3370
|
(scrollPosition) => tableContextValue.store.setState({ scrollPosition }),
|
|
3351
3371
|
[tableContextValue.store]
|
|
3352
3372
|
)
|
|
3353
3373
|
);
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3356
|
-
|
|
3374
|
+
const captionEl = caption && /* @__PURE__ */ jsx(
|
|
3375
|
+
"div",
|
|
3376
|
+
{
|
|
3377
|
+
...captionProps,
|
|
3378
|
+
className: cx(
|
|
3379
|
+
prefix("table__caption"),
|
|
3380
|
+
prefix(`table__caption--${captionSide}`),
|
|
3381
|
+
captionProps?.className
|
|
3382
|
+
),
|
|
3383
|
+
children: caption
|
|
3384
|
+
}
|
|
3385
|
+
);
|
|
3386
|
+
const combinedScrollableRef = useCombinedRef(
|
|
3387
|
+
setScrollableEl,
|
|
3388
|
+
scrollableProps?.ref
|
|
3357
3389
|
);
|
|
3358
3390
|
const combinedTableRef = useCombinedRef(tableRef, forwardedRef);
|
|
3359
|
-
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContextValue, children: /* @__PURE__ */
|
|
3391
|
+
return /* @__PURE__ */ jsx(ClearContexts, { children: /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContextValue, children: /* @__PURE__ */ jsxs(
|
|
3360
3392
|
"div",
|
|
3361
3393
|
{
|
|
3362
|
-
"data-status": status,
|
|
3363
|
-
"data-accent": controlStatusToAccent(status),
|
|
3364
|
-
tabIndex: 0,
|
|
3365
3394
|
...containerProps,
|
|
3366
|
-
id: controlId,
|
|
3367
3395
|
className: cx(
|
|
3368
3396
|
prefix("table__container"),
|
|
3369
|
-
prefix(`table__container--${variant}`),
|
|
3370
3397
|
containerProps?.className
|
|
3371
3398
|
),
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3399
|
+
children: [
|
|
3400
|
+
captionSide === "top" && captionEl,
|
|
3401
|
+
/* @__PURE__ */ jsx(
|
|
3402
|
+
"div",
|
|
3403
|
+
{
|
|
3404
|
+
"data-status": status,
|
|
3405
|
+
"data-accent": controlStatusToAccent(status),
|
|
3406
|
+
tabIndex: 0,
|
|
3407
|
+
...scrollableProps,
|
|
3408
|
+
id: controlId,
|
|
3409
|
+
className: cx(
|
|
3410
|
+
prefix("table__scrollable"),
|
|
3411
|
+
prefix(`table__scrollable--${variant}`),
|
|
3412
|
+
scrollableProps?.className
|
|
3413
|
+
),
|
|
3414
|
+
style: {
|
|
3415
|
+
maxHeight,
|
|
3416
|
+
// XXX: Disable Y overflow when a `max-height` isn't specified.
|
|
3417
|
+
// TODO: Investigate why we get a 1px Y overflow sometimes.
|
|
3418
|
+
overflowY: maxHeight != null || scrollableProps?.style?.maxHeight != null ? void 0 : "hidden",
|
|
3419
|
+
...scrollableProps?.style
|
|
3420
|
+
},
|
|
3421
|
+
ref: combinedScrollableRef,
|
|
3422
|
+
children: /* @__PURE__ */ jsxs(
|
|
3423
|
+
"table",
|
|
3424
|
+
{
|
|
3425
|
+
className: cx(
|
|
3426
|
+
prefix("table"),
|
|
3427
|
+
prefix(`table--${variant}`),
|
|
3428
|
+
layout === "fixed" && prefix("table--fixed"),
|
|
3429
|
+
className
|
|
3430
|
+
),
|
|
3431
|
+
"data-status": status,
|
|
3432
|
+
"aria-describedby": mergeAriaIds(
|
|
3433
|
+
codeId,
|
|
3434
|
+
descriptionIds,
|
|
3435
|
+
errorMessageIds,
|
|
3436
|
+
ariaDescribedBy
|
|
3437
|
+
),
|
|
3438
|
+
...otherProps,
|
|
3439
|
+
ref: combinedTableRef,
|
|
3440
|
+
children: [
|
|
3441
|
+
visuallyHiddenCaption && /* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx("caption", { ...visuallyHiddenCaptionProps, children: visuallyHiddenCaption }) }),
|
|
3442
|
+
/* @__PURE__ */ jsx(ColumnWidths, {}),
|
|
3443
|
+
children
|
|
3444
|
+
]
|
|
3445
|
+
}
|
|
3446
|
+
)
|
|
3447
|
+
}
|
|
3448
|
+
),
|
|
3449
|
+
captionSide === "bottom" && captionEl
|
|
3450
|
+
]
|
|
3405
3451
|
}
|
|
3406
3452
|
) }) });
|
|
3407
3453
|
}
|
|
@@ -3670,6 +3716,8 @@ const TableHead = forwardRef(
|
|
|
3670
3716
|
status: tableStatus,
|
|
3671
3717
|
layout,
|
|
3672
3718
|
defaultColumnWidth,
|
|
3719
|
+
onTableMinWidthChange,
|
|
3720
|
+
onTableMaxWidthChange,
|
|
3673
3721
|
store
|
|
3674
3722
|
} = useTableContext();
|
|
3675
3723
|
const columns = useMemo(() => columnsFromChildren(children), [children]);
|
|
@@ -3696,12 +3744,18 @@ const TableHead = forwardRef(
|
|
|
3696
3744
|
store.setState({
|
|
3697
3745
|
columnWidths: columnWidths(leaves, defaultColumnWidth)
|
|
3698
3746
|
});
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
setTableMaxWidth(tableMaxWidth(leaves, defaultColumnWidth));
|
|
3747
|
+
onTableMinWidthChange(tableMinWidth(leaves, defaultColumnWidth));
|
|
3748
|
+
onTableMaxWidthChange(tableMaxWidth(leaves, defaultColumnWidth));
|
|
3702
3749
|
return () => store.setState({ columnWidths: void 0 });
|
|
3703
3750
|
}
|
|
3704
|
-
}, [
|
|
3751
|
+
}, [
|
|
3752
|
+
columns,
|
|
3753
|
+
defaultColumnWidth,
|
|
3754
|
+
layout,
|
|
3755
|
+
onTableMaxWidthChange,
|
|
3756
|
+
onTableMinWidthChange,
|
|
3757
|
+
store
|
|
3758
|
+
]);
|
|
3705
3759
|
const leftMost = useMemo(() => leftMostColumns(columns), [columns]);
|
|
3706
3760
|
const rightMost = useMemo(() => rightMostColumns(columns), [columns]);
|
|
3707
3761
|
const combinedTableHeadRef = useCombinedRef(tableHeadRef, forwardedRef);
|
|
@@ -5727,7 +5781,7 @@ const Input = forwardRef(
|
|
|
5727
5781
|
CloseButton,
|
|
5728
5782
|
{
|
|
5729
5783
|
size: "sm",
|
|
5730
|
-
|
|
5784
|
+
label: clearButtonLabel,
|
|
5731
5785
|
tabIndex: -1,
|
|
5732
5786
|
...clearButtonProps,
|
|
5733
5787
|
className: cx(
|
|
@@ -6496,6 +6550,7 @@ const Tag = forwardRef(function Tag2({
|
|
|
6496
6550
|
showCloseButton && /* @__PURE__ */ jsx(CollapsibleTrigger, { children: /* @__PURE__ */ jsx(
|
|
6497
6551
|
CloseButton,
|
|
6498
6552
|
{
|
|
6553
|
+
size: "sm",
|
|
6499
6554
|
color: variant === "solid" ? "neutral" : color,
|
|
6500
6555
|
...closeButtonProps,
|
|
6501
6556
|
className: cx(
|
|
@@ -8582,7 +8637,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8582
8637
|
CloseButton,
|
|
8583
8638
|
{
|
|
8584
8639
|
size: "sm",
|
|
8585
|
-
|
|
8640
|
+
label: clearButtonsLabel,
|
|
8586
8641
|
tabIndex: -1,
|
|
8587
8642
|
...startClearButtonProps,
|
|
8588
8643
|
className: cx(
|
|
@@ -8696,7 +8751,7 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
8696
8751
|
CloseButton,
|
|
8697
8752
|
{
|
|
8698
8753
|
size: "sm",
|
|
8699
|
-
|
|
8754
|
+
label: clearButtonsLabel,
|
|
8700
8755
|
tabIndex: -1,
|
|
8701
8756
|
...endClearButtonProps,
|
|
8702
8757
|
className: cx(
|
|
@@ -10325,7 +10380,8 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
10325
10380
|
hasClearButton && /* @__PURE__ */ jsx(
|
|
10326
10381
|
CloseButton,
|
|
10327
10382
|
{
|
|
10328
|
-
"
|
|
10383
|
+
size: "sm",
|
|
10384
|
+
label: clearButtonLabel,
|
|
10329
10385
|
tabIndex: -1,
|
|
10330
10386
|
circle: true,
|
|
10331
10387
|
...clearButtonProps,
|
|
@@ -11350,6 +11406,7 @@ export {
|
|
|
11350
11406
|
useFieldControlTagName,
|
|
11351
11407
|
useFieldDescriptionIds,
|
|
11352
11408
|
useFieldErrorMessageIds,
|
|
11409
|
+
useFieldLabel,
|
|
11353
11410
|
useFieldLabelId,
|
|
11354
11411
|
useIntersectionObserver,
|
|
11355
11412
|
useIsInFeedbackList,
|