@ostack.tech/ui 1.3.0-beta.2 → 1.3.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/LICENSE +202 -0
- package/README.md +13 -1
- package/dist/chunks/{en-W4OWqPrv.js → en-MXAz48KY.js} +10 -11
- package/dist/chunks/en-MXAz48KY.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 +9 -10
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/pt-PT.js +9 -10
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +157 -89
- package/dist/ostack-ui.js +1972 -1560
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +3 -1
- package/scss/_utils.scss +1 -0
- package/scss/components/ButtonGroup/_ButtonGroup.scss +2 -5
- package/scss/components/Calendar/_Calendar-variables.scss +1 -1
- package/scss/components/Calendar/_Calendar.scss +15 -16
- package/scss/components/ControlAddon/_ControlAddon.scss +3 -5
- package/scss/components/DataTable/_DataTable.scss +7 -2
- package/scss/components/DropdownMenu/_DropdownMenu.scss +1 -1
- package/scss/components/Feedback/_Feedback.scss +2 -0
- package/scss/components/Field/_Field.scss +0 -1
- package/scss/components/HelperText/_HelperText.scss +2 -1
- package/scss/components/Input/_Input.scss +1 -1
- package/scss/components/Label/_Label.scss +1 -0
- package/scss/components/Link/_Link.scss +1 -1
- package/scss/components/Pagination/_Pagination-variables.scss +89 -0
- package/scss/components/Pagination/_Pagination.scss +135 -0
- package/scss/components/Root/_Root.scss +1 -1
- package/scss/components/Select/_Select-variables.scss +1 -1
- package/scss/components/Stack/_Stack.scss +1 -1
- package/scss/components/Table/_Table.scss +23 -9
- package/scss/components/Tabs/_Tabs-variables.scss +1 -1
- package/scss/components/Tabs/_Tabs.scss +5 -4
- package/scss/index.scss +1 -0
- package/scss/scss/helpers/_margin-utils.scss +13 -11
- package/scss/scss/helpers/_padding-utils.scss +13 -11
- package/scss/scss/helpers/_sizing-utils.scss +19 -17
- package/scss/scss/helpers/_text-utils.scss +19 -17
- package/scss/scss/helpers/_visually-hidden.scss +1 -1
- package/scss/scss/placeholders/button/_button-variables.scss +3 -0
- package/scss/scss/placeholders/button/_button.scss +4 -3
- package/scss/scss/placeholders/menu/_menu-variables.scss +4 -1
- package/scss/scss/placeholders/menu/_menu.scss +4 -0
- package/scss/scss/utils/_button-reset.scss +1 -1
- package/types/components/DataTable/DataTablePagination.d.ts +7 -16
- package/types/components/DataTable/PagedDataTablePagination.d.ts +5 -5
- package/types/components/DataTable/sanitizeProps.d.ts +0 -2
- package/types/components/Form/FormError.d.ts +1 -1
- package/types/components/Keybinds/KeyPress.d.ts +3 -3
- package/types/components/Keybinds/Keybind.d.ts +2 -2
- package/types/components/Keybinds/Keybinds.d.ts +1 -1
- package/types/components/Pagination/Pagination.d.ts +93 -0
- package/types/components/Pagination/index.d.ts +1 -0
- package/types/components/Pagination/paginationItems.d.ts +7 -0
- package/types/components/Printer/Printer.d.ts +1 -1
- package/types/components/Printer/PrinterContentContext.d.ts +4 -16
- package/types/components/Printer/PrinterContext.d.ts +1 -2
- package/types/components/Printer/index.d.ts +1 -1
- package/types/components/Printer/usePrintClassNames.d.ts +6 -2
- package/types/components/Table/TableContext.d.ts +2 -0
- package/types/components/Table/columnUtils.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/types/providers/LocalizationProvider/LocalizationObject.d.ts +3 -1
- package/types/utils/sanitizeProps.d.ts +2 -0
- package/types/utils/useIntersectionObserver.d.ts +6 -2
- package/types/utils/useResizeObserver.d.ts +6 -0
- package/dist/chunks/en-W4OWqPrv.js.map +0 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "../../scss/utils/animation" as *;
|
|
6
6
|
@use "../../scss/utils/button-reset" as *;
|
|
7
7
|
@use "../../scss/utils/declare-var" as *;
|
|
8
|
+
@use "../../scss/utils/maybe-important" as *;
|
|
8
9
|
@use "../../scss/utils/transition" as *;
|
|
9
10
|
|
|
10
11
|
.#{$prefix}tabs {
|
|
@@ -208,7 +209,7 @@
|
|
|
208
209
|
}
|
|
209
210
|
|
|
210
211
|
// Tab inner - Hover
|
|
211
|
-
&:hover:not(:disabled
|
|
212
|
+
&:hover:not(:disabled, :active, [data-state="active"]) {
|
|
212
213
|
@include declare-var(
|
|
213
214
|
--#{$prefix}tabs-tab-inner-background-color,
|
|
214
215
|
map.get($tabs-tab-inner-hover-background-color-by-variant, $variant)
|
|
@@ -280,7 +281,7 @@
|
|
|
280
281
|
}
|
|
281
282
|
|
|
282
283
|
// Tab inner - Open + Hover
|
|
283
|
-
&:hover:not(:disabled
|
|
284
|
+
&:hover:not(:disabled, :active) {
|
|
284
285
|
@include declare-var(
|
|
285
286
|
--#{$prefix}tabs-tab-inner-background-color,
|
|
286
287
|
map.get($tabs-tab-inner-open-hover-background-color-by-variant, $variant)
|
|
@@ -364,8 +365,8 @@
|
|
|
364
365
|
min-width: auto;
|
|
365
366
|
min-height: auto;
|
|
366
367
|
padding: 0 $tabs-scroll-button-padding-x;
|
|
367
|
-
font-size: $tabs-scroll-button-font-size
|
|
368
|
-
color: $tabs-scroll-button-color
|
|
368
|
+
font-size: maybe-important($tabs-scroll-button-font-size);
|
|
369
|
+
color: maybe-important($tabs-scroll-button-color);
|
|
369
370
|
|
|
370
371
|
border-bottom-left-radius: 0;
|
|
371
372
|
border-bottom-right-radius: 0;
|
package/scss/index.scss
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
@forward "components/MenuList/MenuList";
|
|
49
49
|
@forward "components/Output/Output";
|
|
50
50
|
@forward "components/Overlay/Overlay";
|
|
51
|
+
@forward "components/Pagination/Pagination";
|
|
51
52
|
@forward "components/Popover/Popover";
|
|
52
53
|
@forward "components/RadioGroup/Radio";
|
|
53
54
|
@forward "components/RadioGroup/RadioGroup";
|
|
@@ -18,18 +18,20 @@
|
|
|
18
18
|
)
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
21
|
+
:is(.#{$prefix}root, .#{$prefix}root *) {
|
|
22
|
+
&[data-has-mt] {
|
|
23
|
+
margin-top: var(--#{$prefix}mt);
|
|
24
|
+
}
|
|
24
25
|
|
|
25
|
-
[data-has-mr] {
|
|
26
|
-
|
|
27
|
-
}
|
|
26
|
+
&[data-has-mr] {
|
|
27
|
+
margin-right: var(--#{$prefix}mr);
|
|
28
|
+
}
|
|
28
29
|
|
|
29
|
-
[data-has-mb] {
|
|
30
|
-
|
|
31
|
-
}
|
|
30
|
+
&[data-has-mb] {
|
|
31
|
+
margin-bottom: var(--#{$prefix}mb);
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
[data-has-ml] {
|
|
34
|
-
|
|
34
|
+
&[data-has-ml] {
|
|
35
|
+
margin-left: var(--#{$prefix}ml);
|
|
36
|
+
}
|
|
35
37
|
}
|
|
@@ -18,18 +18,20 @@
|
|
|
18
18
|
)
|
|
19
19
|
);
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
21
|
+
:is(.#{$prefix}root, .#{$prefix}root *) {
|
|
22
|
+
&[data-has-pt] {
|
|
23
|
+
padding-top: var(--#{$prefix}pt);
|
|
24
|
+
}
|
|
24
25
|
|
|
25
|
-
[data-has-pr] {
|
|
26
|
-
|
|
27
|
-
}
|
|
26
|
+
&[data-has-pr] {
|
|
27
|
+
padding-right: var(--#{$prefix}pr);
|
|
28
|
+
}
|
|
28
29
|
|
|
29
|
-
[data-has-pb] {
|
|
30
|
-
|
|
31
|
-
}
|
|
30
|
+
&[data-has-pb] {
|
|
31
|
+
padding-bottom: var(--#{$prefix}pb);
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
[data-has-pl] {
|
|
34
|
-
|
|
34
|
+
&[data-has-pl] {
|
|
35
|
+
padding-left: var(--#{$prefix}pl);
|
|
36
|
+
}
|
|
35
37
|
}
|
|
@@ -20,26 +20,28 @@
|
|
|
20
20
|
)
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
23
|
+
:is(.#{$prefix}root, .#{$prefix}root *) {
|
|
24
|
+
&[data-has-w] {
|
|
25
|
+
width: var(--#{$prefix}w);
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
[data-has-min-w] {
|
|
28
|
-
|
|
29
|
-
}
|
|
28
|
+
&[data-has-min-w] {
|
|
29
|
+
min-width: var(--#{$prefix}min-w);
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
[data-has-max-w] {
|
|
32
|
-
|
|
33
|
-
}
|
|
32
|
+
&[data-has-max-w] {
|
|
33
|
+
max-width: var(--#{$prefix}max-w);
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
[data-has-h] {
|
|
36
|
-
|
|
37
|
-
}
|
|
36
|
+
&[data-has-h] {
|
|
37
|
+
height: var(--#{$prefix}h);
|
|
38
|
+
}
|
|
38
39
|
|
|
39
|
-
[data-has-min-h] {
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
&[data-has-min-h] {
|
|
41
|
+
min-height: var(--#{$prefix}min-h);
|
|
42
|
+
}
|
|
42
43
|
|
|
43
|
-
[data-has-max-h] {
|
|
44
|
-
|
|
44
|
+
&[data-has-max-h] {
|
|
45
|
+
max-height: var(--#{$prefix}max-h);
|
|
46
|
+
}
|
|
45
47
|
}
|
|
@@ -19,25 +19,27 @@
|
|
|
19
19
|
)
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
text-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
:is(.#{$prefix}root, .#{$prefix}root *) {
|
|
23
|
+
&[data-text-truncate] {
|
|
24
|
+
text-overflow: ellipsis;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
27
28
|
|
|
28
|
-
[data-has-text-size] {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
29
|
+
&[data-has-text-size] {
|
|
30
|
+
font-size: var(--#{$prefix}font-size);
|
|
31
|
+
line-height: var(--#{$prefix}line-height);
|
|
32
|
+
}
|
|
32
33
|
|
|
33
|
-
[data-has-text-align] {
|
|
34
|
-
|
|
35
|
-
}
|
|
34
|
+
&[data-has-text-align] {
|
|
35
|
+
text-align: var(--#{$prefix}text-align);
|
|
36
|
+
}
|
|
36
37
|
|
|
37
|
-
[data-has-font-weight] {
|
|
38
|
-
|
|
39
|
-
}
|
|
38
|
+
&[data-has-font-weight] {
|
|
39
|
+
font-weight: var(--#{$prefix}font-weight);
|
|
40
|
+
}
|
|
40
41
|
|
|
41
|
-
[data-has-text-wrap] {
|
|
42
|
-
|
|
42
|
+
&[data-has-text-wrap] {
|
|
43
|
+
text-wrap: var(--#{$prefix}text-wrap);
|
|
44
|
+
}
|
|
43
45
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
// Hide content visually while keeping it accessible to assistive technologies
|
|
7
7
|
.#{$prefix}visually-hidden,
|
|
8
|
-
.#{$prefix}visually-hidden-focusable:not(:focus
|
|
8
|
+
.#{$prefix}visually-hidden-focusable:not(:focus, :focus-within) {
|
|
9
9
|
width: 1px !important;
|
|
10
10
|
height: 1px !important;
|
|
11
11
|
padding: 0 !important;
|
|
@@ -22,6 +22,9 @@ $button-disabled-opacity: 0.65 !default;
|
|
|
22
22
|
$button-disabled-cursor: not-allowed !default;
|
|
23
23
|
$button-disabled-box-shadow: none !default;
|
|
24
24
|
|
|
25
|
+
// Spinning
|
|
26
|
+
$button-spinning-cursor: progress !default;
|
|
27
|
+
|
|
25
28
|
// Solid variant
|
|
26
29
|
$button-solid-background-color: var(--#{$prefix}accent-a9) !default;
|
|
27
30
|
$button-solid-background-image: null !default;
|
|
@@ -39,15 +39,16 @@
|
|
|
39
39
|
cursor: $button-disabled-cursor;
|
|
40
40
|
opacity: $button-disabled-opacity;
|
|
41
41
|
box-shadow: $button-disabled-box-shadow;
|
|
42
|
-
}
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
&[data-spinning] {
|
|
44
|
+
cursor: $button-spinning-cursor;
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
&:focus-visible {
|
|
49
49
|
outline: $button-focus-outline-width solid $button-focus-outline-color;
|
|
50
50
|
outline-offset: var(--#{$prefix}button-focus-outline-offset);
|
|
51
|
+
z-index: $button-focus-z-index;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
&[aria-haspopup][aria-expanded="true"]:not([data-inactive]) {
|
|
@@ -41,6 +41,9 @@ $menu-item-text-cursor: null !default;
|
|
|
41
41
|
$menu-item-disabled-cursor: not-allowed !default;
|
|
42
42
|
$menu-item-disabled-opacity: 0.5 !default;
|
|
43
43
|
|
|
44
|
+
// Item - Spinning
|
|
45
|
+
$menu-item-spinning-cursor: progress !default;
|
|
46
|
+
|
|
44
47
|
// Item - Focus
|
|
45
48
|
$menu-item-focus-outline-width: 2px !default;
|
|
46
49
|
$menu-item-focus-outline-color: var(--#{$prefix}primary-8) !default;
|
|
@@ -208,7 +211,7 @@ $menu-item-keybinds-subtle-highlighted-selected-color: $menu-item-keybinds-subtl
|
|
|
208
211
|
$menu-item-keybinds-subtle-highlighted-selected-accent-color: null !default;
|
|
209
212
|
|
|
210
213
|
// Sub trigger icon
|
|
211
|
-
$menu-sub-trigger-icon-font-size: var(--#{$prefix}font-size-
|
|
214
|
+
$menu-sub-trigger-icon-font-size: var(--#{$prefix}font-size-xs) !default;
|
|
212
215
|
|
|
213
216
|
// Checkable
|
|
214
217
|
$menu-checkable-size: 16px !default;
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import type { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { type UseMarginPropsOptions } from "../../utils/useMarginProps.ts";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PaginationProps } from "../Pagination";
|
|
4
4
|
/** Properties of the data table pagination component. */
|
|
5
|
-
export interface DataTablePaginationProps extends UseMarginPropsOptions, ComponentProps<"div"> {
|
|
5
|
+
export interface DataTablePaginationProps extends UseMarginPropsOptions, ComponentProps<"div">, Pick<PaginationProps, "size" | "siblingCount" | "boundaryCount" | "label" | "previousPageButtonLabel" | "nextPageButtonLabel" | "pageButtonLabel" | "previousPageButtonProps" | "nextPageButtonProps" | "pageButtonProps" | "ellipsisButtonProps" | "loadingButtonProps"> {
|
|
6
6
|
/**
|
|
7
|
-
* Function used to render the range of displayed rows.
|
|
7
|
+
* Function used to render the range of displayed rows (only relevant is scrolled mode).
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
9
|
+
* @param rangeStart Start of the range.
|
|
10
|
+
* @param rangeEnd End of the range.
|
|
10
11
|
* @param total Total number of rows.
|
|
11
12
|
*/
|
|
12
|
-
rowsRange?: (
|
|
13
|
-
/** Label of the rows range select (only relevant in paged mode). */
|
|
14
|
-
rowsRangeSelectLabel?: (total: number) => string;
|
|
15
|
-
/** Label of the previous page button (only relevant in paged mode). */
|
|
16
|
-
previousPageButtonLabel?: string;
|
|
17
|
-
/** Label of the next page button (only relevant in paged mode). */
|
|
18
|
-
nextPageButtonLabel?: string;
|
|
13
|
+
rowsRange?: (rangeStart: number, rangeEnd: number, total: number) => ReactNode;
|
|
19
14
|
/**
|
|
20
15
|
* Whether the component should preferably be aligned to the right. This only has an effect when
|
|
21
16
|
* the component is nested directly under the `DataTable`.
|
|
@@ -23,10 +18,6 @@ export interface DataTablePaginationProps extends UseMarginPropsOptions, Compone
|
|
|
23
18
|
* @default true
|
|
24
19
|
*/
|
|
25
20
|
preferRightAlignment?: boolean;
|
|
26
|
-
/** Properties to pass to the previous page button (only relevant in paged mode). */
|
|
27
|
-
previousPageButtonProps?: IconButtonProps;
|
|
28
|
-
/** Properties to pass to the next page button (only relevant in paged mode). */
|
|
29
|
-
nextPageButtonProps?: IconButtonProps;
|
|
30
21
|
}
|
|
31
22
|
/** Component used to provide pagination to the data table. */
|
|
32
|
-
export declare function DataTablePagination({ rowsRange: rowsRangeProp,
|
|
23
|
+
export declare function DataTablePagination({ rowsRange: rowsRangeProp, size, siblingCount, boundaryCount, label: labelProp, previousPageButtonLabel: previousPageButtonLabelProp, nextPageButtonLabel: nextPageButtonLabelProp, pageButtonLabel: pageButtonLabelProp, previousPageButtonProps, nextPageButtonProps, pageButtonProps, ellipsisButtonProps, loadingButtonProps, preferRightAlignment, style, ...otherProps }: DataTablePaginationProps): import("react").JSX.Element | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PaginationProps } from "../Pagination";
|
|
2
2
|
import type { DataTablePaginationProps } from "./DataTablePagination.tsx";
|
|
3
|
-
/** Properties of the
|
|
4
|
-
export interface PagedDataTablePaginationProps extends
|
|
3
|
+
/** Properties of the paged data table pagination. */
|
|
4
|
+
export interface PagedDataTablePaginationProps extends Pick<DataTablePaginationProps, "preferRightAlignment">, Omit<PaginationProps, "count" | "defaultPage" | "page" | "onPageChange" | "disabled" | "loading"> {
|
|
5
5
|
}
|
|
6
|
-
/** Pagination component of the
|
|
7
|
-
export declare function PagedDataTablePagination({
|
|
6
|
+
/** Pagination component of the paged data table. */
|
|
7
|
+
export declare function PagedDataTablePagination({ preferRightAlignment, className, ...otherProps }: PagedDataTablePaginationProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { SortDirection } from "../../utils/sorting.ts";
|
|
2
2
|
import type { DataTableColumnObject } from "./DataTableColumn.tsx";
|
|
3
|
-
/** Sanitizes an integer property. */
|
|
4
|
-
export declare function sanitizeInt(value: number | string | undefined): number | undefined;
|
|
5
3
|
/** Sanitizes the `sortBy` property. */
|
|
6
4
|
export declare function sanitizeSortBy<T>(sortBy: string | null | undefined, leaves: Record<string, DataTableColumnObject<T>>): string | null | undefined;
|
|
7
5
|
/** Sanitizes the `sortDirection` property. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import type { KeybindsProps } from "./Keybinds.tsx";
|
|
3
|
-
export interface KeyPressProps extends Pick<KeybindsProps, "keySymbols" | "keyLabels"> {
|
|
3
|
+
export interface KeyPressProps extends Pick<KeybindsProps, "keysSeparatorLabel" | "keySymbols" | "keyLabels"> {
|
|
4
4
|
/** Key press. */
|
|
5
5
|
keyPress: string[];
|
|
6
6
|
}
|
|
7
|
-
export declare function KeyPress({ keyPress, keySymbols, keyLabels }: KeyPressProps): ReactNode;
|
|
7
|
+
export declare function KeyPress({ keyPress, keysSeparatorLabel, keySymbols, keyLabels, }: KeyPressProps): ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { KeybindsProps } from "./Keybinds.tsx";
|
|
3
|
-
export interface KeybindProps extends Pick<KeybindsProps, "keyPressesSeparatorLabel" | "keySymbols" | "keyLabels"> {
|
|
3
|
+
export interface KeybindProps extends Pick<KeybindsProps, "keyPressesSeparatorLabel" | "keysSeparatorLabel" | "keySymbols" | "keyLabels"> {
|
|
4
4
|
/** Keybind. */
|
|
5
5
|
keybind: string[][];
|
|
6
6
|
}
|
|
7
|
-
export declare function Keybind({ keybind, keyPressesSeparatorLabel
|
|
7
|
+
export declare function Keybind({ keybind, keyPressesSeparatorLabel, keysSeparatorLabel, keySymbols, keyLabels, }: KeybindProps): ReactNode;
|
|
@@ -17,4 +17,4 @@ export interface KeybindsProps extends UseMarginPropsOptions, Omit<ComponentProp
|
|
|
17
17
|
keyLabels?: Record<string, ReactNode>;
|
|
18
18
|
}
|
|
19
19
|
/** Component which visually renders [`tinykeys`](https://jamiebuilds.github.io/tinykeys) keybinds. */
|
|
20
|
-
export declare function Keybinds({ keybinds
|
|
20
|
+
export declare function Keybinds({ keybinds, limit, keybindsSeparatorLabel: keybindsSeparatorLabelProp, keyPressesSeparatorLabel: keyPressesSeparatorLabelProp, keysSeparatorLabel: keysSeparatorLabelProp, keySymbols, keyLabels, className, style, ...otherProps }: KeybindsProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import { type ButtonColor, type ButtonProps, type ButtonSize, type ButtonVariant } from "../Button";
|
|
3
|
+
import { type IconButtonProps } from "../IconButton";
|
|
4
|
+
/** Pagination buttons' variant. */
|
|
5
|
+
export type PaginationVariant = ButtonVariant;
|
|
6
|
+
/** Pagination button's colour. */
|
|
7
|
+
export type PaginationColor = ButtonColor;
|
|
8
|
+
/** Pagination buttons' size. */
|
|
9
|
+
export type PaginationSize = ButtonSize;
|
|
10
|
+
/** Properties of the pagination component. */
|
|
11
|
+
export interface PaginationProps extends ComponentProps<"nav"> {
|
|
12
|
+
/** Total number of pages. */
|
|
13
|
+
count: number;
|
|
14
|
+
/**
|
|
15
|
+
* Default (uncontrolled) current page, starting at `1`.
|
|
16
|
+
*
|
|
17
|
+
* @default 1
|
|
18
|
+
*/
|
|
19
|
+
defaultPage?: string | number;
|
|
20
|
+
/** Controlled current page, starting at `1`. Use together with `onPageChange`. */
|
|
21
|
+
page?: string | number;
|
|
22
|
+
/** Function called with the new page (starting at `1`) when the page changes. */
|
|
23
|
+
onPageChange?: (page: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Size of the pagination buttons.
|
|
26
|
+
*
|
|
27
|
+
* @default "md"
|
|
28
|
+
*/
|
|
29
|
+
size?: PaginationSize;
|
|
30
|
+
/**
|
|
31
|
+
* Number of pages shown on each side of the current page.
|
|
32
|
+
*
|
|
33
|
+
* @default 1
|
|
34
|
+
*/
|
|
35
|
+
siblingCount?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Number of pages always shown at the start and end.
|
|
38
|
+
*
|
|
39
|
+
* @default 1
|
|
40
|
+
*/
|
|
41
|
+
boundaryCount?: number;
|
|
42
|
+
/** Whether to disable all pagination buttons. */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Renders the pagination in a **loading** state.
|
|
46
|
+
*
|
|
47
|
+
* When `true`, the page buttons are replaced by a single loading indicator, and the previous/next
|
|
48
|
+
* page buttons are “soft-disabled”: they look disabled and ignore user interaction but remain
|
|
49
|
+
* focusable.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
loading?: boolean;
|
|
54
|
+
/** Navigation's label (for assistive technologies). */
|
|
55
|
+
label?: ReactNode;
|
|
56
|
+
/** Label of the previous page button. */
|
|
57
|
+
previousPageButtonLabel?: ReactNode;
|
|
58
|
+
/** Label of the next page button. */
|
|
59
|
+
nextPageButtonLabel?: ReactNode;
|
|
60
|
+
/** Accessible label of each page button. */
|
|
61
|
+
pageButtonLabel?: (page: string) => ReactNode;
|
|
62
|
+
/** Properties to pass to the previous page button. */
|
|
63
|
+
previousPageButtonProps?: Partial<IconButtonProps>;
|
|
64
|
+
/** Properties to pass to the next page button. */
|
|
65
|
+
nextPageButtonProps?: Partial<IconButtonProps>;
|
|
66
|
+
/** Properties to pass to each page button. */
|
|
67
|
+
pageButtonProps?: Omit<ButtonProps, "children">;
|
|
68
|
+
/** Properties to pass to each ellipsis button. */
|
|
69
|
+
ellipsisButtonProps?: Omit<ButtonProps, "children">;
|
|
70
|
+
/** Properties to pass to the loading button. */
|
|
71
|
+
loadingButtonProps?: Omit<ButtonProps, "children">;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The pagination component allows users to navigate between pages of content.
|
|
75
|
+
*
|
|
76
|
+
* Pages are numbered starting at `1`.
|
|
77
|
+
*
|
|
78
|
+
* Built on top of the browser's [`<nav>`
|
|
79
|
+
* element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/nav) and the
|
|
80
|
+
* [`Button`](/docs/ostack-ui-forms-button--docs)/[`IconButton`](/docs/ostack-ui-forms-icon-button--docs)
|
|
81
|
+
* components.
|
|
82
|
+
*
|
|
83
|
+
* Example usage:
|
|
84
|
+
*
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import { Pagination } from "@ostack.tech/ui";
|
|
87
|
+
*
|
|
88
|
+
* function SearchResultsPagination() {
|
|
89
|
+
* return <Pagination count={20} />;
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function Pagination({ count, defaultPage, page: controllablePage, onPageChange, size, siblingCount, boundaryCount, disabled, loading, label: labelProp, previousPageButtonLabel: previousPageButtonLabelProp, nextPageButtonLabel: nextPageButtonLabelProp, pageButtonLabel: pageButtonLabelProp, previousPageButtonProps, nextPageButtonProps, pageButtonProps, ellipsisButtonProps, loadingButtonProps, className, ...otherProps }: PaginationProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Pagination.tsx";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Item of a pagination: a page number or an ellipsis. */
|
|
2
|
+
export type PaginationItem = number | "start-ellipsis" | "end-ellipsis";
|
|
3
|
+
/**
|
|
4
|
+
* Computes the items to display in a pagination, e.g. `[1, "start-ellipsis", 4, 5, 6,
|
|
5
|
+
* "end-ellipsis", 20]`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function paginationItems(page: number, count: number, siblingCount: number, boundaryCount: number): PaginationItem[];
|
|
@@ -100,7 +100,7 @@ export interface PrinterProps extends PrintOptions {
|
|
|
100
100
|
* to a hidden `<iframe>` which is then printed by the browser.
|
|
101
101
|
*
|
|
102
102
|
* Content being printed is aware of the fact that it is being printed and can adapt its appearance
|
|
103
|
-
* accordingly. Use the `usePrinting` and `
|
|
103
|
+
* accordingly. Use the `usePrinting` and `usePrintingTask` hooks to control the printing
|
|
104
104
|
* behaviour.
|
|
105
105
|
*
|
|
106
106
|
* Built on top of the [`react-to-print`](https://github.com/MatthewHerbst/react-to-print) package.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** Value of the printer content context. */
|
|
2
2
|
export interface PrinterContextValue {
|
|
3
3
|
printing: boolean;
|
|
4
|
-
startPrintingTask?: () => void;
|
|
5
|
-
finishPrintingTask?: () => void;
|
|
4
|
+
startPrintingTask?: () => () => void;
|
|
6
5
|
}
|
|
7
6
|
/** Printer content context. */
|
|
8
7
|
export declare const PrinterContentContext: import("react").Context<PrinterContextValue>;
|
|
@@ -18,20 +17,9 @@ export declare function usePrinterContentContext(): PrinterContextValue;
|
|
|
18
17
|
* > **Note:** This hook **can** be called outside the printer context.
|
|
19
18
|
*/
|
|
20
19
|
export declare function usePrinting(): boolean;
|
|
21
|
-
/** Options for the `useStartPrintingTask` hook. */
|
|
22
|
-
export interface UseStartPrintingTaskOptions {
|
|
23
|
-
/**
|
|
24
|
-
* Whether to enable the printing task.
|
|
25
|
-
*
|
|
26
|
-
* @default true
|
|
27
|
-
*/
|
|
28
|
-
enabled?: boolean;
|
|
29
|
-
}
|
|
30
20
|
/**
|
|
31
|
-
*
|
|
32
|
-
* finishes. The printer will wait for any ongoing printing tasks before printing.
|
|
21
|
+
* Prevents printing from happening while `pending` is `true`.
|
|
33
22
|
*
|
|
34
|
-
* > **Note:** This hook **can** be called outside the printer context, in which case
|
|
35
|
-
* > starting/finishing printing tasks will be no-ops but **won't** fail.
|
|
23
|
+
* > **Note:** This hook **can** be called outside the printer context, in which case it is a no-op.
|
|
36
24
|
*/
|
|
37
|
-
export declare function
|
|
25
|
+
export declare function usePrintingTask(pending: boolean): void;
|
|
@@ -9,8 +9,7 @@ interface PrinterContextValue {
|
|
|
9
9
|
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
10
10
|
contentRef: RefObject<Element | Text | null>;
|
|
11
11
|
print: (options?: PrintOptions) => Promise<void>;
|
|
12
|
-
startPrintingTask: () => void;
|
|
13
|
-
finishPrintingTask: () => void;
|
|
12
|
+
startPrintingTask: () => () => void;
|
|
14
13
|
}
|
|
15
14
|
/** Printer context. */
|
|
16
15
|
export declare const PrinterContext: import("react").Context<PrinterContextValue | null>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./Printer.tsx";
|
|
2
2
|
export * from "./PrinterContent.tsx";
|
|
3
|
-
export { usePrinting,
|
|
3
|
+
export { usePrinting, usePrintingTask } from "./PrinterContentContext.tsx";
|
|
4
4
|
export { usePrint, usePrinterDocumentTitle, usePrintInProgress } from "./PrinterContext.ts";
|
|
5
5
|
export * from "./PrinterTrigger.tsx";
|
|
6
6
|
export * from "./usePrintClassNames.ts";
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/** Print-related class names. */
|
|
2
|
+
export interface PrintClassNames {
|
|
3
|
+
/** Class name used for content that should only be visible while printing. */
|
|
2
4
|
printOnly: string;
|
|
5
|
+
/** Class name used for content that should be hidden while printing. */
|
|
3
6
|
printHidden: string;
|
|
4
7
|
}
|
|
5
|
-
|
|
8
|
+
/** Hook which exposes print-related class names. */
|
|
9
|
+
export declare function usePrintClassNames(): PrintClassNames;
|
|
@@ -2,6 +2,7 @@ import type { ScrollPosition } from "../../utils/useScrollPosition.ts";
|
|
|
2
2
|
import type { ControlStatus } from "../Control";
|
|
3
3
|
import type { TableLayout } from "./Table.tsx";
|
|
4
4
|
import type { TableColumnObject } from "./TableColumn.tsx";
|
|
5
|
+
import type { TableColumnGroupObject } from "./TableColumnGroup.tsx";
|
|
5
6
|
/** Value of the table context. */
|
|
6
7
|
export interface TableContextValue {
|
|
7
8
|
editable: boolean;
|
|
@@ -13,6 +14,7 @@ export interface TableContextValue {
|
|
|
13
14
|
export interface TableState {
|
|
14
15
|
scrollPosition?: ScrollPosition;
|
|
15
16
|
leafColumns?: TableColumnObject[];
|
|
17
|
+
columnKeys?: Map<TableColumnObject | TableColumnGroupObject, string>;
|
|
16
18
|
defaultColumnWidth: number;
|
|
17
19
|
numberOfColumns: () => number | undefined;
|
|
18
20
|
stickyColumnOffsets: () => (number | undefined)[] | undefined;
|
|
@@ -27,3 +27,7 @@ export declare function leftMostLeafColumn(column: TableColumnGroupObject | Tabl
|
|
|
27
27
|
export declare function rightMostLeafColumn(column: TableColumnGroupObject | TableColumnObject): TableColumnObject;
|
|
28
28
|
/** Offsets (`left`/`right` CSS properties) to provide to sticky columns. */
|
|
29
29
|
export declare function stickyColumnOffsets(leaves: TableColumnObject[], defaultColumnWidth: number): (number | undefined)[];
|
|
30
|
+
/** Keys of all columns (leaves and groups), based on their location in the column tree. */
|
|
31
|
+
export declare function columnKeys(columns: TableColumnObjects): Map<TableColumnObject | TableColumnGroupObject, string>;
|
|
32
|
+
/** Keys of the `<col>` elements, aligned with the result of `columnWidths`. */
|
|
33
|
+
export declare function colKeys(leaves: TableColumnObject[], keys: Map<TableColumnObject | TableColumnGroupObject, string>): string[];
|
package/types/index.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export * from "./components/Mark";
|
|
|
44
44
|
export * from "./components/MenuList";
|
|
45
45
|
export * from "./components/NumericInput";
|
|
46
46
|
export * from "./components/Output";
|
|
47
|
+
export * from "./components/Pagination";
|
|
47
48
|
export * from "./components/Popover";
|
|
48
49
|
export * from "./components/Portal";
|
|
49
50
|
export * from "./components/Printer";
|
|
@@ -101,6 +102,7 @@ export * from "./utils/useMediaQuery.ts";
|
|
|
101
102
|
export * from "./utils/useNumericTransformer.tsx";
|
|
102
103
|
export * from "./utils/usePaddingProps.ts";
|
|
103
104
|
export * from "./utils/usePrevious.ts";
|
|
105
|
+
export * from "./utils/useResizeObserver.ts";
|
|
104
106
|
export * from "./utils/useSafeLayoutEffect.ts";
|
|
105
107
|
export * from "./utils/useScrollPosition.ts";
|
|
106
108
|
export * from "./utils/useScrollbarSize.ts";
|