@ostack.tech/ui 0.11.3 → 0.12.1
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 +40 -32
- package/dist/ostack-ui.js +552 -304
- package/dist/ostack-ui.js.map +1 -1
- package/dist/types/components/DataTable/DataTableColumn.d.ts +12 -1
- package/dist/types/components/DataTable/DataTableContext.d.ts +2 -0
- package/dist/types/components/DataTable/DataTableFoot.d.ts +2 -1
- package/dist/types/components/DataTable/columnUtils.d.ts +5 -0
- package/dist/types/components/DataTable/sanitizeProps.d.ts +8 -0
- package/dist/types/components/Layer/Layer.d.ts +32 -0
- package/dist/types/components/Layer/LayerContext.d.ts +6 -0
- package/dist/types/components/Layer/index.d.ts +2 -0
- package/dist/types/components/Overlay/Overlay.d.ts +1 -1
- package/dist/types/components/Root/Root.d.ts +9 -4
- package/dist/types/components/Table/Table.d.ts +4 -4
- package/dist/types/components/Table/TableCell.d.ts +15 -0
- package/dist/types/components/Table/TableColumn.d.ts +1 -1
- package/dist/types/components/Table/TableContext.d.ts +9 -9
- package/dist/types/components/Table/TableHead.d.ts +2 -2
- package/dist/types/components/Table/columnUtils.d.ts +35 -0
- package/dist/types/components/Toast/ToastProvider.d.ts +2 -1
- package/dist/types/components/Toast/ToastViewport.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -5
- package/scss/components/CommandMenu/_CommandMenu-variables.scss +0 -1
- package/scss/components/CommandMenu/_CommandMenu.scss +0 -2
- package/scss/components/DataTable/_DataTable.scss +4 -3
- package/scss/components/Dialog/_Dialog-variables.scss +0 -1
- package/scss/components/Dialog/_Dialog.scss +0 -1
- package/scss/components/DropdownMenu/_DropdownMenu-variables.scss +0 -2
- package/scss/components/DropdownMenu/_DropdownMenu.scss +0 -1
- package/scss/components/Overlay/_Overlay-variables.scss +0 -1
- package/scss/components/Overlay/_Overlay.scss +0 -1
- package/scss/components/Table/_Table-variables.scss +2 -4
- package/scss/components/Table/_Table.scss +10 -8
- package/scss/components/Tabs/_Tabs-variables.scss +3 -3
- package/scss/components/Toast/_Toast.scss +26 -14
- package/scss/components/Tooltip/_Tooltip-variables.scss +0 -1
- package/scss/components/Tooltip/_Tooltip.scss +0 -2
- package/scss/scss/_base-variables.scss +0 -2
- package/scss/scss/placeholders/button/_button-variables.scss +1 -1
- package/scss/scss/placeholders/button/_button.scss +5 -2
- package/scss/scss/placeholders/control/_control-variables.scss +3 -5
- package/scss/scss/placeholders/popover/_popover-variables.scss +0 -1
- package/scss/scss/placeholders/popover/_popover.scss +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
2
|
import { MatchAgainstFilter } from '../../utils/filtering.ts';
|
|
3
|
-
import { TableColumn } from '../Table';
|
|
3
|
+
import { TableCell, TableColumn } from '../Table';
|
|
4
4
|
/** Data table columns. */
|
|
5
5
|
export type DataTableColumns<T = unknown> = Record<string, DataTableColumn<T>>;
|
|
6
6
|
/** Data table column. */
|
|
@@ -42,6 +42,10 @@ export interface DataTableColumn<T = unknown, TValue = any> extends Omit<Compone
|
|
|
42
42
|
* objects, their string representation is used in the comparison.
|
|
43
43
|
*/
|
|
44
44
|
compare?: (value1: TValue, value2: TValue) => number;
|
|
45
|
+
/** Optional footer content to be rendered in the table foot. */
|
|
46
|
+
footer?: ReactNode | ((footerData: DataTableColumnFooterData<T>) => ReactNode);
|
|
47
|
+
/** Properties to pass to the column table foot cell. */
|
|
48
|
+
footerProps?: ComponentPropsWithRef<typeof TableCell>;
|
|
45
49
|
}
|
|
46
50
|
/** Data passed to a data table column's `getValue` function. */
|
|
47
51
|
export interface DataTableColumnGetValueData<T = unknown> {
|
|
@@ -68,3 +72,10 @@ export interface DataTableColumnRenderData<T = unknown, TValue = unknown> extend
|
|
|
68
72
|
*/
|
|
69
73
|
markedValue: ReactNode;
|
|
70
74
|
}
|
|
75
|
+
/** Data passed to a data table column's `footer` function. */
|
|
76
|
+
export interface DataTableColumnFooterData<T> {
|
|
77
|
+
/** Rows. */
|
|
78
|
+
rows?: T[];
|
|
79
|
+
/** Total number of rows. */
|
|
80
|
+
totalCount?: number;
|
|
81
|
+
}
|
|
@@ -27,6 +27,7 @@ export interface DataTableContextValue<T = any> {
|
|
|
27
27
|
export interface DataTableState<T = any> {
|
|
28
28
|
columns: DataTableColumns<T>;
|
|
29
29
|
leafColumns: DataTableColumns<T>;
|
|
30
|
+
hasFooterCells: () => boolean;
|
|
30
31
|
headCount: number;
|
|
31
32
|
_rows?: T[];
|
|
32
33
|
_filteredRows: () => T[] | undefined;
|
|
@@ -45,6 +46,7 @@ export interface DataTableState<T = any> {
|
|
|
45
46
|
_totalCount?: number;
|
|
46
47
|
totalCount: () => number | undefined;
|
|
47
48
|
bodyCount: () => number;
|
|
49
|
+
footCount: () => number;
|
|
48
50
|
_offset: number;
|
|
49
51
|
offset: () => number;
|
|
50
52
|
currentPage: () => number;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
2
|
import { TableFoot } from '../Table';
|
|
3
3
|
/** Properties of the data table foot component. */
|
|
4
4
|
export interface DataTableFootProps extends ComponentPropsWithoutRef<typeof TableFoot> {
|
|
5
|
+
footContent?: ReactNode;
|
|
5
6
|
showWhenEmpty: boolean;
|
|
6
7
|
}
|
|
7
8
|
/** Foot of the data table. */
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DataTableColumns } from './DataTableColumn.tsx';
|
|
2
|
+
/** List of "leaf" columns (columns with no sub columns, i.e. the "bottom" ones). */
|
|
3
|
+
export declare function leafColumns<T>(columns: DataTableColumns<T>): DataTableColumns<T>;
|
|
4
|
+
/** Total number of table rows of the head. */
|
|
5
|
+
export declare function numberOfRows<T>(columns: DataTableColumns<T>): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SortDirection } from '../../utils/sorting.ts';
|
|
2
|
+
import { DataTableColumns } from './DataTableColumn.tsx';
|
|
3
|
+
/** Sanitizes an integer property. */
|
|
4
|
+
export declare function sanitizeInt(value: number | string | undefined): number | undefined;
|
|
5
|
+
/** Sanitizes the `sortBy` property. */
|
|
6
|
+
export declare function sanitizeSortBy<T>(sortBy: string | null | undefined, leaves: DataTableColumns<T>): string | null | undefined;
|
|
7
|
+
/** Sanitizes the `sortDirection` property. */
|
|
8
|
+
export declare function sanitizeSortDirection(sortDirection: string | undefined): SortDirection | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { Slot } from '../Slot';
|
|
3
|
+
/** Available z-index names. */
|
|
4
|
+
export type LayerZIndex = "docked" | "dropdown" | "sticky" | "banner" | "overlay" | "dialog" | "popover" | "skipLink" | "toast" | "tooltip";
|
|
5
|
+
/** Properties of the layer component. */
|
|
6
|
+
export interface LayerProps extends ComponentPropsWithoutRef<typeof Slot> {
|
|
7
|
+
/** Z-index of the layer. */
|
|
8
|
+
zIndex?: LayerZIndex | number | (LayerZIndex | number)[];
|
|
9
|
+
/** Resets the stacking context. */
|
|
10
|
+
reset?: boolean;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The layer component manages hierarchical stacking contexts by tracking and
|
|
15
|
+
* adding up z-index values.
|
|
16
|
+
*
|
|
17
|
+
* All ostack/UI overlays (dialogs, dropdown menus, _etc._) are rendered within
|
|
18
|
+
* a layer, allowing them to be nested.
|
|
19
|
+
*
|
|
20
|
+
* Example usage:
|
|
21
|
+
*
|
|
22
|
+
* ```tsx
|
|
23
|
+
* function NavBar() {
|
|
24
|
+
* return (
|
|
25
|
+
* <Layer zIndex="sticky">
|
|
26
|
+
* <nav style={{ position: "sticky", top: 0 }}>…</nav>
|
|
27
|
+
* </Layer>
|
|
28
|
+
* );
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function Layer({ zIndex, reset, style, ...otherProps }: LayerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Layer context. */
|
|
2
|
+
export declare const LayerContext: import('react').Context<(string | number)[]>;
|
|
3
|
+
/** Hook providing access to the current layer's z-index. */
|
|
4
|
+
export declare function useLayerZIndex(): string | undefined;
|
|
5
|
+
/** Computes the z-index of a layer based on its z-indices. */
|
|
6
|
+
export declare function computeLayerZIndex(zIndices: (number | string)[]): string;
|
|
@@ -2,5 +2,5 @@ import { ComponentPropsWithoutRef } from 'react';
|
|
|
2
2
|
/** Properties of the label component. */
|
|
3
3
|
export interface OverlayProps extends ComponentPropsWithoutRef<"div"> {
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
5
|
+
/** Internal component used by dialogs to overlay content. */
|
|
6
6
|
export declare const Overlay: import('react').ForwardRefExoticComponent<OverlayProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -3,7 +3,7 @@ import { DocumentTitleProvider } from '../../providers/DocumentTitleProvider';
|
|
|
3
3
|
import { ErrorReportingProvider } from '../../providers/ErrorReportingProvider';
|
|
4
4
|
import { LocalizationObject } from '../../providers/LocalizationProvider';
|
|
5
5
|
import { ErrorBoundary } from '../ErrorBoundary';
|
|
6
|
-
import { ToastSwipeDirection } from '../Toast';
|
|
6
|
+
import { ToastSwipeDirection, ToastViewportPosition } from '../Toast';
|
|
7
7
|
/** Properties of the ostack/UI root component. */
|
|
8
8
|
export interface RootProps extends ComponentPropsWithoutRef<"div">, Pick<ComponentPropsWithoutRef<typeof ErrorReportingProvider>, "reportError" | "errorReportingUrl" | "errorReportingMethod" | "encodeErrorReport" | "encodedErrorReportMimeType" | "errorReportingOptions">, Pick<ComponentPropsWithoutRef<typeof DocumentTitleProvider>, "baseDocumentTitle"> {
|
|
9
9
|
/**
|
|
@@ -85,9 +85,8 @@ export interface RootProps extends ComponentPropsWithoutRef<"div">, Pick<Compone
|
|
|
85
85
|
*/
|
|
86
86
|
toastsDuration?: number;
|
|
87
87
|
/**
|
|
88
|
-
* Direction of pointer swipe that should close the toast.
|
|
89
|
-
*
|
|
90
|
-
* @default "right"
|
|
88
|
+
* Direction of pointer swipe that should close the toast. Defaults to
|
|
89
|
+
* `"right"` when `toastViewportPosition` is `"right"` or `"left"` otherwise.
|
|
91
90
|
*/
|
|
92
91
|
toastsSwipeDirection?: ToastSwipeDirection;
|
|
93
92
|
/**
|
|
@@ -96,6 +95,12 @@ export interface RootProps extends ComponentPropsWithoutRef<"div">, Pick<Compone
|
|
|
96
95
|
* @default 50
|
|
97
96
|
*/
|
|
98
97
|
toastsSwipeThreshold?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Position of the toast viewport.
|
|
100
|
+
*
|
|
101
|
+
* @default "right"
|
|
102
|
+
*/
|
|
103
|
+
toastViewportPosition?: ToastViewportPosition;
|
|
99
104
|
/**
|
|
100
105
|
* The keys to use as the keyboard shortcut that will move focus to the toast
|
|
101
106
|
* viewport.
|
|
@@ -141,22 +141,22 @@ export interface TableProps extends ComponentPropsWithoutRef<"table"> {
|
|
|
141
141
|
* return (
|
|
142
142
|
* <Table caption="Price list">
|
|
143
143
|
* <TableHead>
|
|
144
|
-
* <TableColumn label="Item" />
|
|
144
|
+
* <TableColumn header label="Item" />
|
|
145
145
|
* <TableColumn label="Price" />
|
|
146
146
|
* </TableHead>
|
|
147
147
|
* <TableBody>
|
|
148
148
|
* <TableRow>
|
|
149
|
-
* <TableCell
|
|
149
|
+
* <TableCell>Olive oil</TableCell>
|
|
150
150
|
* <TableCell>3,99 €</TableCell>
|
|
151
151
|
* </TableRow>
|
|
152
152
|
* <TableRow>
|
|
153
|
-
* <TableCell
|
|
153
|
+
* <TableCell>Vinegar</TableCell>
|
|
154
154
|
* <TableCell>0,95 €</TableCell>
|
|
155
155
|
* </TableRow>
|
|
156
156
|
* </TableBody>
|
|
157
157
|
* <TableFoot>
|
|
158
158
|
* <TableRow>
|
|
159
|
-
* <TableCell
|
|
159
|
+
* <TableCell>Total</TableCell>
|
|
160
160
|
* <TableCell>4,94 €</TableCell>
|
|
161
161
|
* </TableRow>
|
|
162
162
|
* </TableFoot>
|
|
@@ -6,6 +6,21 @@ export type TableCellVariant = "header" | "data";
|
|
|
6
6
|
export type TableCellSticky = "left" | "right";
|
|
7
7
|
/** Properties of the table row component. */
|
|
8
8
|
export interface TableCellProps extends Omit<ComponentPropsWithoutRef<"td" | "th">, "align"> {
|
|
9
|
+
/**
|
|
10
|
+
* Index of the (leaf) column this cell belongs to. This property is
|
|
11
|
+
* automatically set by the `TableRow` component when the `TableCell` is its
|
|
12
|
+
* direct child.
|
|
13
|
+
*
|
|
14
|
+
* When set, the cell automatically inherits properties defined in the
|
|
15
|
+
* corresponding column, such as `align` or `sticky`.
|
|
16
|
+
*/
|
|
17
|
+
columnIndex?: number | null;
|
|
18
|
+
/**
|
|
19
|
+
* Index of the (leaf) column for stickiness computation purposes.
|
|
20
|
+
*
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
_stickyColumnIndex?: number | null;
|
|
9
24
|
/**
|
|
10
25
|
* Whether this cell should be rendered as a table header cell (`th` element).
|
|
11
26
|
* By default, `true` within a `TableHead` component, and `false` otherwise.
|
|
@@ -7,7 +7,7 @@ import { Popover, PopoverContent } from '../Popover';
|
|
|
7
7
|
import { Stack } from '../Stack';
|
|
8
8
|
import { TableCell } from './TableCell.tsx';
|
|
9
9
|
/** Properties of a table column. */
|
|
10
|
-
export interface TableColumnProps extends Omit<ComponentPropsWithoutRef<typeof TableCell>, "rowSpan" | "scope"> {
|
|
10
|
+
export interface TableColumnProps extends Omit<ComponentPropsWithoutRef<typeof TableCell>, "columnIndex" | "_stickyColumnIndex" | "rowSpan" | "scope"> {
|
|
11
11
|
/** Column's label. */
|
|
12
12
|
label?: ReactNode;
|
|
13
13
|
/** String representation of the label (defaults to `label`). */
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { ControlStatus } from '../../utils/control.ts';
|
|
2
2
|
import { ScrollPosition } from '../../utils/useScrollPosition.ts';
|
|
3
|
+
import { TableColumnObject } from './columnUtils.ts';
|
|
3
4
|
import { TableLayout } from './Table.tsx';
|
|
4
5
|
/** Value of the table context. */
|
|
5
6
|
export interface TableContextValue {
|
|
6
7
|
editable: boolean;
|
|
7
8
|
status?: ControlStatus;
|
|
8
9
|
layout: TableLayout;
|
|
9
|
-
defaultColumnWidth: number;
|
|
10
|
-
onTableMinWidthChange: (minWidth: string | undefined) => void;
|
|
11
|
-
onTableMaxWidthChange: (maxWidth: string | undefined) => void;
|
|
12
10
|
store: TableStore;
|
|
13
11
|
}
|
|
14
12
|
/** State of the table. */
|
|
15
13
|
export interface TableState {
|
|
16
14
|
scrollPosition?: ScrollPosition;
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
leafColumns?: TableColumnObject[];
|
|
16
|
+
defaultColumnWidth: number;
|
|
17
|
+
stickyColumnOffsets: () => (number | undefined)[] | undefined;
|
|
19
18
|
}
|
|
20
19
|
/** Table store. */
|
|
21
20
|
export type TableStore = ReturnType<typeof useCreateTableContext>["store"];
|
|
22
21
|
/** Table context. */
|
|
23
22
|
export declare const TableContext: import('react').Context<TableContextValue | null>;
|
|
23
|
+
/** Options for the `useCreateTableContext` hook. */
|
|
24
|
+
export type UseCreateTableContextOptions = Omit<TableContextValue, "store"> & {
|
|
25
|
+
defaultColumnWidth: number;
|
|
26
|
+
};
|
|
24
27
|
/** Hook which creates the table store. */
|
|
25
|
-
export declare function useCreateTableContext(editable
|
|
28
|
+
export declare function useCreateTableContext({ editable, status, layout, defaultColumnWidth, }: UseCreateTableContextOptions): {
|
|
26
29
|
editable: boolean;
|
|
27
30
|
status: ControlStatus | undefined;
|
|
28
31
|
layout: TableLayout;
|
|
29
|
-
defaultColumnWidth: number;
|
|
30
|
-
onTableMinWidthChange: (minWidth: string | undefined) => void;
|
|
31
|
-
onTableMaxWidthChange: (maxWidth: string | undefined) => void;
|
|
32
32
|
store: Omit<import('zustand').StoreApi<TableState>, "subscribe"> & {
|
|
33
33
|
subscribe: {
|
|
34
34
|
(listener: (selectedState: TableState, previousSelectedState: TableState) => void): () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { SortDirection } from '../../utils/sorting.ts';
|
|
3
3
|
/** Properties of the table head component. */
|
|
4
4
|
export interface TableHeadProps extends ComponentPropsWithoutRef<"thead"> {
|
|
@@ -20,4 +20,4 @@ export interface TableHeadProps extends ComponentPropsWithoutRef<"thead"> {
|
|
|
20
20
|
rowProps?: ComponentPropsWithoutRef<"tr"> | ((index: number) => ComponentPropsWithoutRef<"tr">);
|
|
21
21
|
}
|
|
22
22
|
/** Table head component. */
|
|
23
|
-
export declare const TableHead: import('react').ForwardRefExoticComponent<TableHeadProps & RefAttributes<HTMLTableSectionElement>>;
|
|
23
|
+
export declare const TableHead: import('react').ForwardRefExoticComponent<TableHeadProps & import('react').RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComponentRef, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import { TableCell } from './TableCell.tsx';
|
|
3
|
+
import { TableColumnProps } from './TableColumn.tsx';
|
|
4
|
+
/** Representation of a table column in object notation. */
|
|
5
|
+
export type TableColumnObject = Omit<TableColumnProps & RefAttributes<ComponentRef<typeof TableCell>>, "children"> & {
|
|
6
|
+
subColumns: TableColumnObject[];
|
|
7
|
+
};
|
|
8
|
+
/** Gets the list of columns from the head's `children`. */
|
|
9
|
+
export declare function columnsFromChildren(children: ReactNode): TableColumnObject[];
|
|
10
|
+
/** Total number of table rows of the head. */
|
|
11
|
+
export declare function numberOfRows(columns: TableColumnObject[]): number;
|
|
12
|
+
/** Total number of (leaf) table cells of the head. */
|
|
13
|
+
export declare function numberOfColumns(columns: TableColumnObject[]): number;
|
|
14
|
+
/** List of columns of the row with provided index. */
|
|
15
|
+
export declare function columnsOfRow(columns: TableColumnObject[], index: number): TableColumnObject[];
|
|
16
|
+
/** List of "leaf" columns (columns with no children, i.e. the "bottom" ones). */
|
|
17
|
+
export declare function leafColumns(columns: TableColumnObject[]): TableColumnObject[];
|
|
18
|
+
/** Minimum table width. */
|
|
19
|
+
export declare function tableMinWidth(leaves: TableColumnObject[], defaultColumnWidth: number): string;
|
|
20
|
+
/** Maximum table width. */
|
|
21
|
+
export declare function tableMaxWidth(leaves: TableColumnObject[], defaultColumnWidth: number): string | undefined;
|
|
22
|
+
/** Returns the widths of all columns when in "fixed" layout. */
|
|
23
|
+
export declare function columnWidths(leaves: TableColumnObject[], defaultColumnWidth: number): string[];
|
|
24
|
+
/** Width of a column in "fixed" layout. */
|
|
25
|
+
export declare function columnWidth(column: TableColumnObject, defaultColumnsMinWidth: number): number;
|
|
26
|
+
/** Left-most columns. */
|
|
27
|
+
export declare function leftMostColumns(columns: TableColumnObject[]): TableColumnObject[];
|
|
28
|
+
/** Right-most columns. */
|
|
29
|
+
export declare function rightMostColumns(columns: TableColumnObject[]): TableColumnObject[];
|
|
30
|
+
/** Left-most leaf column. */
|
|
31
|
+
export declare function leftMostLeafColumn(column: TableColumnObject): TableColumnObject;
|
|
32
|
+
/** Right-most leaf column. */
|
|
33
|
+
export declare function rightMostLeafColumn(column: TableColumnObject): TableColumnObject;
|
|
34
|
+
/** Offsets (`left`/`right` CSS properties) to provide to sticky columns. */
|
|
35
|
+
export declare function stickyColumnOffsets(leaves: TableColumnObject[], defaultColumnWidth: number): (number | undefined)[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Toast as ToastPrimitive } from 'radix-ui';
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
3
|
/** Direction of pointer swipe that should close the toast */
|
|
4
|
-
export type ToastSwipeDirection = "
|
|
4
|
+
export type ToastSwipeDirection = "left" | "right";
|
|
5
5
|
/** Properties of the toast provider. */
|
|
6
6
|
export interface ToastProviderProps extends ComponentPropsWithoutRef<typeof ToastPrimitive.Provider> {
|
|
7
|
+
swipeDirection?: ToastSwipeDirection;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* The provider that wraps the toasts and their viewport. It usually wraps the
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { Toast as ToastPrimitive } from 'radix-ui';
|
|
2
2
|
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
/** Position of the viewport. */
|
|
4
|
+
export type ToastViewportPosition = "left" | "right";
|
|
3
5
|
/** Properties of the toast viewport component. */
|
|
4
6
|
export interface ToastViewportProps extends ComponentPropsWithoutRef<typeof ToastPrimitive.Viewport> {
|
|
7
|
+
/**
|
|
8
|
+
* Position of the viewport.
|
|
9
|
+
*
|
|
10
|
+
* @default "right"
|
|
11
|
+
*/
|
|
12
|
+
position?: ToastViewportPosition;
|
|
5
13
|
}
|
|
6
14
|
/**
|
|
7
15
|
* The fixed area where toasts appear. Users can jump to the viewport by
|
package/dist/types/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from './components/Input';
|
|
|
37
37
|
export * from './components/Keybinds';
|
|
38
38
|
export * from './components/Keyboard';
|
|
39
39
|
export * from './components/Label';
|
|
40
|
+
export * from './components/Layer';
|
|
40
41
|
export * from './components/Link';
|
|
41
42
|
export * from './components/Mark';
|
|
42
43
|
export * from './components/MenuList';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ostack.tech/ui",
|
|
3
3
|
"description": "ostack/UI component library.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.1",
|
|
5
5
|
"homepage": "https://ui.ostack.tech/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Opensoft",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@fortawesome/react-fontawesome": "^3.2.0",
|
|
46
|
-
"@tanstack/react-virtual": "^3.13.
|
|
46
|
+
"@tanstack/react-virtual": "^3.13.19",
|
|
47
47
|
"from-exponential": "^1.1.1",
|
|
48
48
|
"radix-ui": "^1.4.3",
|
|
49
|
-
"react-day-picker": "^9.
|
|
50
|
-
"react-error-boundary": "^6.1.
|
|
49
|
+
"react-day-picker": "^9.14.0",
|
|
50
|
+
"react-error-boundary": "^6.1.1",
|
|
51
51
|
"react-number-format": "^5.4.4",
|
|
52
|
-
"react-to-print": "^3.
|
|
52
|
+
"react-to-print": "^3.3.0",
|
|
53
53
|
"tinykeys": "^3.0.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
@@ -17,7 +17,6 @@ $command-menu-dialog-box-shadow: $dialog-box-shadow !default;
|
|
|
17
17
|
$command-menu-dialog-animation-transform: $dialog-animation-transform !default;
|
|
18
18
|
$command-menu-dialog-animation-duration: $dialog-animation-duration !default;
|
|
19
19
|
$command-menu-dialog-animation-timing-function: $dialog-animation-timing-function !default;
|
|
20
|
-
$command-menu-dialog-z-index: $dialog-z-index !default;
|
|
21
20
|
|
|
22
21
|
$command-menu-dialog-sm-width: $dialog-sm-width !default;
|
|
23
22
|
$command-menu-dialog-md-width: $dialog-md-width !default;
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
|
|
43
43
|
// Rows per page, pagination
|
|
44
44
|
&__rows-per-page,
|
|
45
|
-
&__pagination
|
|
45
|
+
&__pagination,
|
|
46
|
+
&__pagination-label {
|
|
46
47
|
display: inline-flex;
|
|
47
48
|
align-items: center;
|
|
48
49
|
}
|
|
@@ -61,9 +62,9 @@
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
&__pagination-label {
|
|
64
|
-
display: flex;
|
|
65
65
|
flex-wrap: wrap;
|
|
66
|
-
|
|
66
|
+
margin-top: 0;
|
|
67
|
+
margin-bottom: 0;
|
|
67
68
|
font-size: $data-table-pagination-font-size;
|
|
68
69
|
line-height: $data-table-pagination-line-height;
|
|
69
70
|
font-weight: $data-table-pagination-font-weight;
|
|
@@ -9,7 +9,6 @@ $dialog-box-shadow: var(--#{$prefix}box-shadow-lg) !default;
|
|
|
9
9
|
$dialog-animation-transform: translateY(-5px) scale(0.97) !default;
|
|
10
10
|
$dialog-animation-duration: 0.15s !default;
|
|
11
11
|
$dialog-animation-timing-function: ease-out !default;
|
|
12
|
-
$dialog-z-index: var(--#{$prefix}z-index-dialog) !default;
|
|
13
12
|
|
|
14
13
|
$dialog-sm-width: 300px !default;
|
|
15
14
|
$dialog-md-width: 500px !default;
|
|
@@ -54,9 +54,7 @@ $table-control-focus-status-border-color: $control-focus-status-border-color !de
|
|
|
54
54
|
$table-control-focus-status-box-shadow: $control-focus-status-box-shadow !default;
|
|
55
55
|
|
|
56
56
|
// Head/Foot - Stuck
|
|
57
|
-
$table-head-foot-stuck-z-index:
|
|
58
|
-
var(--#{$prefix}z-index-docked) + 1
|
|
59
|
-
) !default;
|
|
57
|
+
$table-head-foot-stuck-z-index: var(--#{$prefix}z-index-docked) !default;
|
|
60
58
|
$table-head-foot-stuck-shadow-size: 8px !default;
|
|
61
59
|
$table-head-foot-stuck-shadow-color: var(--#{$prefix}neutral-a3) !default;
|
|
62
60
|
|
|
@@ -240,7 +238,7 @@ $table-cell-empty-background-image: repeating-linear-gradient(
|
|
|
240
238
|
$table-cell-empty-background-size: 10px 10px !default;
|
|
241
239
|
|
|
242
240
|
// Cell - Stuck
|
|
243
|
-
$table-cell-stuck-z-index: var(--#{$prefix}z-index-docked) !default;
|
|
241
|
+
$table-cell-stuck-z-index: calc(var(--#{$prefix}z-index-docked) - 1) !default;
|
|
244
242
|
$table-cell-stuck-shadow-size: $table-head-foot-stuck-shadow-size !default;
|
|
245
243
|
$table-cell-stuck-shadow-color: $table-head-foot-stuck-shadow-color !default;
|
|
246
244
|
|
|
@@ -485,10 +485,11 @@
|
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
&[data-sticky="left"] {
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
488
|
+
left: var(--#{$prefix}table-cell-sticky-offset, 0);
|
|
489
|
+
&[data-stuck]:not([data-framed]) {
|
|
490
|
+
box-shadow: $table-cell-border-width 0 0 0
|
|
491
|
+
var(--#{$prefix}table-cell-border-color);
|
|
492
|
+
}
|
|
492
493
|
|
|
493
494
|
&[data-stuck]::before {
|
|
494
495
|
right: -$table-cell-stuck-shadow-size;
|
|
@@ -501,10 +502,11 @@
|
|
|
501
502
|
}
|
|
502
503
|
|
|
503
504
|
&[data-sticky="right"] {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
right: var(--#{$prefix}table-cell-sticky-offset, 0);
|
|
506
|
+
&[data-stuck] {
|
|
507
|
+
box-shadow: calc($table-cell-border-width * -1) 0 0 0
|
|
508
|
+
var(--#{$prefix}table-cell-border-color);
|
|
509
|
+
}
|
|
508
510
|
|
|
509
511
|
&[data-stuck]::before {
|
|
510
512
|
left: -$table-cell-stuck-shadow-size;
|
|
@@ -17,7 +17,7 @@ $tabs-tab-font-size: var(--#{$prefix}font-size-sm) !default;
|
|
|
17
17
|
$tabs-tab-line-height: var(--#{$prefix}line-height-sm) !default;
|
|
18
18
|
|
|
19
19
|
// Tab - Focus
|
|
20
|
-
$tabs-tab-focus-z-index:
|
|
20
|
+
$tabs-tab-focus-z-index: 1 !default;
|
|
21
21
|
|
|
22
22
|
// Tab - Disabled
|
|
23
23
|
$tabs-tab-disabled-opacity: 0.5 !default;
|
|
@@ -197,8 +197,8 @@ $tabs-scroll-button-overflow-indicator-extra-height: 4px !default;
|
|
|
197
197
|
$tabs-scroll-button-overflow-indicator-color: var(
|
|
198
198
|
--#{$prefix}neutral-a8
|
|
199
199
|
) !default;
|
|
200
|
-
$tabs-scroll-button-overflow-indicator-z-index:
|
|
201
|
-
|
|
200
|
+
$tabs-scroll-button-overflow-indicator-z-index: var(
|
|
201
|
+
--#{$prefix}z-index-docked
|
|
202
202
|
) !default;
|
|
203
203
|
|
|
204
204
|
// Tab content label
|
|
@@ -29,17 +29,27 @@
|
|
|
29
29
|
0 0 0 2px $neutral-12;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
&[data-swipe-direction="left"] {
|
|
33
|
+
@include declare-var(
|
|
34
|
+
--#{$prefix}toast-start-x,
|
|
35
|
+
calc(-100% - var(--#{$prefix}toast-viewport-padding))
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&[data-swipe-direction="right"] {
|
|
40
|
+
@include declare-var(
|
|
41
|
+
--#{$prefix}toast-start-x,
|
|
42
|
+
calc(100% + var(--#{$prefix}toast-viewport-padding))
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
&[data-state="open"] {
|
|
33
47
|
@keyframes #{$prefix}toast-open {
|
|
34
48
|
from {
|
|
35
|
-
transform: translateX(
|
|
36
|
-
calc(100% + var(--#{$prefix}toast-viewport-padding))
|
|
37
|
-
);
|
|
49
|
+
transform: translateX(var(--#{$prefix}toast-start-x));
|
|
38
50
|
}
|
|
39
51
|
#{math.div($toast-animation-duration * 100%, $total-animation-duration)} {
|
|
40
|
-
transform: translateX(
|
|
41
|
-
calc(100% + var(--#{$prefix}toast-viewport-padding))
|
|
42
|
-
);
|
|
52
|
+
transform: translateX(var(--#{$prefix}toast-start-x));
|
|
43
53
|
}
|
|
44
54
|
to {
|
|
45
55
|
transform: translateX(0);
|
|
@@ -78,19 +88,16 @@
|
|
|
78
88
|
|
|
79
89
|
&[data-swipe="end"] {
|
|
80
90
|
animation: #{$prefix}toast-swipe-close $total-animation-duration ease-out;
|
|
91
|
+
|
|
81
92
|
@keyframes #{$prefix}toast-swipe-close {
|
|
82
93
|
from {
|
|
83
94
|
transform: translateX(var(--radix-toast-swipe-end-x));
|
|
84
95
|
}
|
|
85
96
|
#{math.div($toast-animation-duration * 100%, $total-animation-duration)} {
|
|
86
|
-
transform: translateX(
|
|
87
|
-
calc(100% + var(--#{$prefix}toast-viewport-padding))
|
|
88
|
-
);
|
|
97
|
+
transform: translateX(var(--#{$prefix}toast-start-x));
|
|
89
98
|
}
|
|
90
99
|
to {
|
|
91
|
-
transform: translateX(
|
|
92
|
-
calc(100% + var(--#{$prefix}toast-viewport-padding))
|
|
93
|
-
);
|
|
100
|
+
transform: translateX(var(--#{$prefix}toast-start-x));
|
|
94
101
|
}
|
|
95
102
|
}
|
|
96
103
|
}
|
|
@@ -142,7 +149,13 @@
|
|
|
142
149
|
&__viewport {
|
|
143
150
|
position: fixed;
|
|
144
151
|
bottom: 0;
|
|
145
|
-
|
|
152
|
+
|
|
153
|
+
&[data-position="left"] {
|
|
154
|
+
left: 0;
|
|
155
|
+
}
|
|
156
|
+
&[data-position="right"] {
|
|
157
|
+
right: 0;
|
|
158
|
+
}
|
|
146
159
|
|
|
147
160
|
display: flex;
|
|
148
161
|
flex-direction: column;
|
|
@@ -154,7 +167,6 @@
|
|
|
154
167
|
outline: none;
|
|
155
168
|
|
|
156
169
|
list-style: none;
|
|
157
|
-
z-index: $z-index-toast;
|
|
158
170
|
}
|
|
159
171
|
|
|
160
172
|
&__icon {
|
|
@@ -15,7 +15,6 @@ $tooltip-background-color: var(--#{$prefix}neutral-12) !default;
|
|
|
15
15
|
$tooltip-color: var(--#{$prefix}neutral-1) !default;
|
|
16
16
|
$tooltip-box-shadow: var(--#{$prefix}box-shadow-sm) !default;
|
|
17
17
|
|
|
18
|
-
$tooltip-z-index: var(--#{$prefix}z-index-tooltip) !default;
|
|
19
18
|
$tooltip-animation-duration: var(--#{$prefix}animation-fade-duration) !default;
|
|
20
19
|
$tooltip-animation-timing-function: var(
|
|
21
20
|
--#{$prefix}animation-fade-timing-function
|