@backstage/ui 0.11.0-next.0 → 0.11.0-next.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/CHANGELOG.md +63 -0
- package/css/styles.css +36 -12
- package/dist/components/Box/Box.esm.js +13 -6
- package/dist/components/Box/Box.esm.js.map +1 -1
- package/dist/components/Box/Box.module.css.esm.js +1 -1
- package/dist/components/Box/definition.esm.js +4 -1
- package/dist/components/Box/definition.esm.js.map +1 -1
- package/dist/components/Button/Button.esm.js +12 -1
- package/dist/components/Button/Button.esm.js.map +1 -1
- package/dist/components/Button/Button.module.css.esm.js +1 -1
- package/dist/components/Flex/Flex.esm.js +14 -6
- package/dist/components/Flex/Flex.esm.js.map +1 -1
- package/dist/components/Flex/Flex.module.css.esm.js +1 -1
- package/dist/components/Flex/definition.esm.js +4 -1
- package/dist/components/Flex/definition.esm.js.map +1 -1
- package/dist/components/Grid/Grid.esm.js +27 -12
- package/dist/components/Grid/Grid.esm.js.map +1 -1
- package/dist/components/Grid/Grid.module.css.esm.js +2 -2
- package/dist/components/Grid/definition.esm.js +8 -2
- package/dist/components/Grid/definition.esm.js.map +1 -1
- package/dist/components/Link/Link.esm.js +9 -6
- package/dist/components/Link/Link.esm.js.map +1 -1
- package/dist/components/Table/Table.module.css.esm.js +1 -1
- package/dist/components/Table/components/Table.esm.js +154 -15
- package/dist/components/Table/components/Table.esm.js.map +1 -1
- package/dist/components/Table/components/TableRoot.esm.js +26 -0
- package/dist/components/Table/components/TableRoot.esm.js.map +1 -0
- package/dist/components/Table/definition.esm.js +3 -0
- package/dist/components/Table/definition.esm.js.map +1 -1
- package/dist/components/Table/hooks/useCompletePagination.esm.js +106 -0
- package/dist/components/Table/hooks/useCompletePagination.esm.js.map +1 -0
- package/dist/components/Table/hooks/useCursorPagination.esm.js +58 -0
- package/dist/components/Table/hooks/useCursorPagination.esm.js.map +1 -0
- package/dist/components/Table/hooks/useDebouncedReload.esm.js +17 -0
- package/dist/components/Table/hooks/useDebouncedReload.esm.js.map +1 -0
- package/dist/components/Table/hooks/useOffsetPagination.esm.js +64 -0
- package/dist/components/Table/hooks/useOffsetPagination.esm.js.map +1 -0
- package/dist/components/Table/hooks/usePageCache.esm.js +168 -0
- package/dist/components/Table/hooks/usePageCache.esm.js.map +1 -0
- package/dist/components/Table/hooks/useQueryState.esm.js +42 -0
- package/dist/components/Table/hooks/useQueryState.esm.js.map +1 -0
- package/dist/components/Table/hooks/useStableCallback.esm.js +10 -0
- package/dist/components/Table/hooks/useStableCallback.esm.js.map +1 -0
- package/dist/components/Table/hooks/useTable.esm.js +80 -99
- package/dist/components/Table/hooks/useTable.esm.js.map +1 -1
- package/dist/components/TablePagination/TablePagination.esm.js +76 -101
- package/dist/components/TablePagination/TablePagination.esm.js.map +1 -1
- package/dist/components/ToggleButton/ToggleButton.esm.js +51 -0
- package/dist/components/ToggleButton/ToggleButton.esm.js.map +1 -0
- package/dist/components/ToggleButton/ToggleButton.module.css.esm.js +8 -0
- package/dist/components/ToggleButton/ToggleButton.module.css.esm.js.map +1 -0
- package/dist/components/ToggleButton/definition.esm.js +12 -0
- package/dist/components/ToggleButton/definition.esm.js.map +1 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js +33 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.esm.js.map +1 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.module.css.esm.js +8 -0
- package/dist/components/ToggleButtonGroup/ToggleButtonGroup.module.css.esm.js.map +1 -0
- package/dist/components/ToggleButtonGroup/definition.esm.js +11 -0
- package/dist/components/ToggleButtonGroup/definition.esm.js.map +1 -0
- package/dist/hooks/useSurface.esm.js +74 -0
- package/dist/hooks/useSurface.esm.js.map +1 -0
- package/dist/index.d.ts +306 -92
- package/dist/index.esm.js +5 -0
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactElement, ReactNode, ElementType, ComponentPropsWithRef, ComponentProps } from 'react';
|
|
3
|
-
import { ButtonProps as ButtonProps$1, DisclosureProps, HeadingProps, DisclosurePanelProps, DisclosureGroupProps, DialogTriggerProps as DialogTriggerProps$1, ModalOverlayProps, TabsProps as TabsProps$1, TabListProps as TabListProps$1, TabProps as TabProps$1, TabPanelProps as TabPanelProps$1, LinkProps as LinkProps$1, CheckboxProps as CheckboxProps$1, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, TableProps
|
|
3
|
+
import { ButtonProps as ButtonProps$1, DisclosureProps, HeadingProps, DisclosurePanelProps, DisclosureGroupProps, DialogTriggerProps as DialogTriggerProps$1, ModalOverlayProps, TabsProps as TabsProps$1, TabListProps as TabListProps$1, TabProps as TabProps$1, TabPanelProps as TabPanelProps$1, LinkProps as LinkProps$1, CheckboxProps as CheckboxProps$1, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, TableProps as TableProps$1, ColumnProps as ColumnProps$1, CellProps as CellProps$1, TableHeaderProps, TableBodyProps, RowProps, TagGroupProps as TagGroupProps$1, TagListProps, TagProps as TagProps$1, TextFieldProps as TextFieldProps$1, TooltipProps as TooltipProps$1, TooltipTriggerComponentProps, MenuTriggerProps as MenuTriggerProps$1, SubmenuTriggerProps as SubmenuTriggerProps$1, MenuProps as MenuProps$1, PopoverProps, ListBoxProps, MenuItemProps as MenuItemProps$1, ListBoxItemProps, MenuSectionProps as MenuSectionProps$1, SeparatorProps, SearchFieldProps as SearchFieldProps$1, SelectProps as SelectProps$1, SwitchProps as SwitchProps$1, ToggleButtonProps as ToggleButtonProps$1, ToggleButtonGroupProps as ToggleButtonGroupProps$1 } from 'react-aria-components';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import { NavigateOptions } from 'react-router-dom';
|
|
6
|
+
import { SortDescriptor as SortDescriptor$1 } from 'react-stately';
|
|
6
7
|
|
|
7
8
|
/** @public */
|
|
8
9
|
type Breakpoint = 'initial' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -91,6 +92,15 @@ interface ComponentDefinition {
|
|
|
91
92
|
dataAttributes?: DataAttributesMap;
|
|
92
93
|
utilityProps?: string[];
|
|
93
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Surface type
|
|
97
|
+
*
|
|
98
|
+
* Supports absolute levels ('0'-'3'), intent surfaces ('danger', 'warning', 'success'),
|
|
99
|
+
* and 'auto' which increments from the parent surface context.
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
type Surface = '0' | '1' | '2' | '3' | 'danger' | 'warning' | 'success' | 'auto';
|
|
94
104
|
|
|
95
105
|
/** @public */
|
|
96
106
|
interface BoxProps extends SpaceProps {
|
|
@@ -106,6 +116,7 @@ interface BoxProps extends SpaceProps {
|
|
|
106
116
|
children?: React.ReactNode;
|
|
107
117
|
className?: string;
|
|
108
118
|
style?: React.CSSProperties;
|
|
119
|
+
surface?: Responsive<Surface>;
|
|
109
120
|
}
|
|
110
121
|
|
|
111
122
|
/** @public */
|
|
@@ -120,6 +131,9 @@ declare const BoxDefinition: {
|
|
|
120
131
|
readonly root: "bui-Box";
|
|
121
132
|
};
|
|
122
133
|
readonly utilityProps: ["m", "mb", "ml", "mr", "mt", "mx", "my", "p", "pb", "pl", "pr", "pt", "px", "py", "position", "display", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight"];
|
|
134
|
+
readonly dataAttributes: {
|
|
135
|
+
readonly surface: readonly ["0", "1", "2", "3", "danger", "warning", "success"];
|
|
136
|
+
};
|
|
123
137
|
};
|
|
124
138
|
|
|
125
139
|
/** @public */
|
|
@@ -129,6 +143,7 @@ interface GridProps extends SpaceProps {
|
|
|
129
143
|
columns?: Responsive<Columns>;
|
|
130
144
|
gap?: Responsive<Space>;
|
|
131
145
|
style?: React.CSSProperties;
|
|
146
|
+
surface?: Responsive<Surface>;
|
|
132
147
|
}
|
|
133
148
|
/** @public */
|
|
134
149
|
interface GridItemProps {
|
|
@@ -139,6 +154,7 @@ interface GridItemProps {
|
|
|
139
154
|
colStart?: Responsive<Columns>;
|
|
140
155
|
rowSpan?: Responsive<Columns>;
|
|
141
156
|
style?: React.CSSProperties;
|
|
157
|
+
surface?: Responsive<Surface>;
|
|
142
158
|
}
|
|
143
159
|
|
|
144
160
|
/** @public */
|
|
@@ -156,6 +172,9 @@ declare const GridDefinition: {
|
|
|
156
172
|
readonly root: "bui-Grid";
|
|
157
173
|
};
|
|
158
174
|
readonly utilityProps: ["columns", "gap", "m", "mb", "ml", "mr", "mt", "mx", "my", "p", "pb", "pl", "pr", "pt", "px", "py"];
|
|
175
|
+
readonly dataAttributes: {
|
|
176
|
+
readonly surface: readonly ["0", "1", "2", "3", "danger", "warning", "success"];
|
|
177
|
+
};
|
|
159
178
|
};
|
|
160
179
|
/**
|
|
161
180
|
* Component definition for GridItem
|
|
@@ -166,6 +185,9 @@ declare const GridItemDefinition: {
|
|
|
166
185
|
readonly root: "bui-GridItem";
|
|
167
186
|
};
|
|
168
187
|
readonly utilityProps: ["colSpan", "colEnd", "colStart", "rowSpan"];
|
|
188
|
+
readonly dataAttributes: {
|
|
189
|
+
readonly surface: readonly ["0", "1", "2", "3", "danger", "warning", "success"];
|
|
190
|
+
};
|
|
169
191
|
};
|
|
170
192
|
|
|
171
193
|
/** @public */
|
|
@@ -177,6 +199,7 @@ interface FlexProps extends SpaceProps {
|
|
|
177
199
|
direction?: Responsive<'row' | 'column' | 'row-reverse' | 'column-reverse'>;
|
|
178
200
|
className?: string;
|
|
179
201
|
style?: React.CSSProperties;
|
|
202
|
+
surface?: Responsive<Surface>;
|
|
180
203
|
}
|
|
181
204
|
|
|
182
205
|
/** @public */
|
|
@@ -191,6 +214,9 @@ declare const FlexDefinition: {
|
|
|
191
214
|
readonly root: "bui-Flex";
|
|
192
215
|
};
|
|
193
216
|
readonly utilityProps: ["m", "mb", "ml", "mr", "mt", "mx", "my", "p", "pb", "pl", "pr", "pt", "px", "py", "gap", "align", "justify", "direction"];
|
|
217
|
+
readonly dataAttributes: {
|
|
218
|
+
readonly surface: readonly ["0", "1", "2", "3", "danger", "warning", "success"];
|
|
219
|
+
};
|
|
194
220
|
};
|
|
195
221
|
|
|
196
222
|
/** @public */
|
|
@@ -274,9 +300,40 @@ interface ButtonProps extends ButtonProps$1 {
|
|
|
274
300
|
iconEnd?: ReactElement;
|
|
275
301
|
children?: ReactNode;
|
|
276
302
|
loading?: boolean;
|
|
303
|
+
/** Surface the button is placed on. Defaults to context surface if available */
|
|
304
|
+
onSurface?: Responsive<Surface>;
|
|
277
305
|
}
|
|
278
306
|
|
|
279
|
-
/**
|
|
307
|
+
/**
|
|
308
|
+
* A button component built on React Aria Components that provides accessible
|
|
309
|
+
* interactive elements for triggering actions.
|
|
310
|
+
*
|
|
311
|
+
* @remarks
|
|
312
|
+
* The Button component supports multiple variants (primary, secondary, tertiary, danger),
|
|
313
|
+
* sizes (small, medium), and states including loading and disabled. It automatically
|
|
314
|
+
* handles keyboard navigation, focus management, and ARIA attributes for accessibility.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* Basic usage:
|
|
318
|
+
* ```tsx
|
|
319
|
+
* <Button>Click me</Button>
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* With icons and loading state:
|
|
324
|
+
* ```tsx
|
|
325
|
+
* <Button
|
|
326
|
+
* variant="primary"
|
|
327
|
+
* size="medium"
|
|
328
|
+
* iconStart={<IconComponent />}
|
|
329
|
+
* loading={isSubmitting}
|
|
330
|
+
* >
|
|
331
|
+
* Submit
|
|
332
|
+
* </Button>
|
|
333
|
+
* ```
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
280
337
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
281
338
|
|
|
282
339
|
/**
|
|
@@ -814,14 +871,52 @@ declare const RadioGroupDefinition: {
|
|
|
814
871
|
};
|
|
815
872
|
|
|
816
873
|
/** @public */
|
|
817
|
-
|
|
874
|
+
interface TablePaginationProps {
|
|
875
|
+
pageSize: number;
|
|
876
|
+
offset?: number;
|
|
877
|
+
totalCount?: number;
|
|
878
|
+
hasNextPage: boolean;
|
|
879
|
+
hasPreviousPage: boolean;
|
|
880
|
+
onNextPage: () => void;
|
|
881
|
+
onPreviousPage: () => void;
|
|
882
|
+
onPageSizeChange?: (size: number) => void;
|
|
883
|
+
showPageSizeOptions?: boolean;
|
|
884
|
+
getLabel?: (params: {
|
|
885
|
+
pageSize: number;
|
|
886
|
+
offset?: number;
|
|
887
|
+
totalCount?: number;
|
|
888
|
+
}) => string;
|
|
889
|
+
}
|
|
818
890
|
|
|
819
|
-
/**
|
|
820
|
-
|
|
891
|
+
/**
|
|
892
|
+
* Pagination controls for Table components with page navigation and size selection.
|
|
893
|
+
*
|
|
894
|
+
* @public
|
|
895
|
+
*/
|
|
896
|
+
declare function TablePagination({ pageSize, offset, totalCount, hasNextPage, hasPreviousPage, onNextPage, onPreviousPage, onPageSizeChange, showPageSizeOptions, getLabel, }: TablePaginationProps): react_jsx_runtime.JSX.Element;
|
|
821
897
|
|
|
822
|
-
/**
|
|
823
|
-
|
|
898
|
+
/**
|
|
899
|
+
* Component definition for TablePagination
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
declare const TablePaginationDefinition: {
|
|
903
|
+
readonly classNames: {
|
|
904
|
+
readonly root: "bui-TablePagination";
|
|
905
|
+
readonly left: "bui-TablePaginationLeft";
|
|
906
|
+
readonly right: "bui-TablePaginationRight";
|
|
907
|
+
readonly select: "bui-TablePaginationSelect";
|
|
908
|
+
};
|
|
909
|
+
};
|
|
824
910
|
|
|
911
|
+
/**
|
|
912
|
+
* @public
|
|
913
|
+
*/
|
|
914
|
+
type SortDescriptor = SortDescriptor$1;
|
|
915
|
+
/** @public */
|
|
916
|
+
interface SortState {
|
|
917
|
+
descriptor: SortDescriptor | null;
|
|
918
|
+
onSortChange: (descriptor: SortDescriptor) => void;
|
|
919
|
+
}
|
|
825
920
|
/** @public */
|
|
826
921
|
interface CellProps extends CellProps$1 {
|
|
827
922
|
}
|
|
@@ -845,6 +940,78 @@ interface CellProfileProps extends CellProps$1 {
|
|
|
845
940
|
interface ColumnProps extends Omit<ColumnProps$1, 'children'> {
|
|
846
941
|
children?: React.ReactNode;
|
|
847
942
|
}
|
|
943
|
+
/** @public */
|
|
944
|
+
interface TableRootProps extends TableProps$1 {
|
|
945
|
+
stale?: boolean;
|
|
946
|
+
}
|
|
947
|
+
/** @public */
|
|
948
|
+
interface TableItem {
|
|
949
|
+
id: string | number;
|
|
950
|
+
}
|
|
951
|
+
/** @public */
|
|
952
|
+
interface NoPagination {
|
|
953
|
+
type: 'none';
|
|
954
|
+
}
|
|
955
|
+
/** @public */
|
|
956
|
+
interface PagePagination extends TablePaginationProps {
|
|
957
|
+
type: 'page';
|
|
958
|
+
}
|
|
959
|
+
/** @public */
|
|
960
|
+
type TablePaginationType = NoPagination | PagePagination;
|
|
961
|
+
/** @public */
|
|
962
|
+
interface ColumnConfig<T extends TableItem> {
|
|
963
|
+
id: string;
|
|
964
|
+
label: string;
|
|
965
|
+
cell: (item: T) => ReactNode;
|
|
966
|
+
header?: () => ReactNode;
|
|
967
|
+
isSortable?: boolean;
|
|
968
|
+
isHidden?: boolean;
|
|
969
|
+
width?: number | string;
|
|
970
|
+
isRowHeader?: boolean;
|
|
971
|
+
}
|
|
972
|
+
/** @public */
|
|
973
|
+
interface RowConfig<T extends TableItem> {
|
|
974
|
+
getHref?: (item: T) => string | undefined;
|
|
975
|
+
onClick?: (item: T) => void;
|
|
976
|
+
getIsDisabled?: (item: T) => boolean;
|
|
977
|
+
}
|
|
978
|
+
/** @public */
|
|
979
|
+
type RowRenderFn<T extends TableItem> = (params: {
|
|
980
|
+
item: T;
|
|
981
|
+
index: number;
|
|
982
|
+
}) => ReactNode;
|
|
983
|
+
/** @public */
|
|
984
|
+
interface TableSelection {
|
|
985
|
+
mode?: TableProps$1['selectionMode'];
|
|
986
|
+
behavior?: TableProps$1['selectionBehavior'];
|
|
987
|
+
selected?: TableProps$1['selectedKeys'];
|
|
988
|
+
onSelectionChange?: TableProps$1['onSelectionChange'];
|
|
989
|
+
}
|
|
990
|
+
/** @public */
|
|
991
|
+
interface TableProps<T extends TableItem> {
|
|
992
|
+
columnConfig: readonly ColumnConfig<T>[];
|
|
993
|
+
data: T[] | undefined;
|
|
994
|
+
loading?: boolean;
|
|
995
|
+
isStale?: boolean;
|
|
996
|
+
error?: Error;
|
|
997
|
+
pagination: TablePaginationType;
|
|
998
|
+
sort?: SortState;
|
|
999
|
+
rowConfig?: RowConfig<T> | RowRenderFn<T>;
|
|
1000
|
+
selection?: TableSelection;
|
|
1001
|
+
emptyState?: ReactNode;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
/** @public */
|
|
1005
|
+
declare function Table<T extends TableItem>({ columnConfig, data, loading, isStale, error, pagination, sort, rowConfig, selection, emptyState, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
1006
|
+
|
|
1007
|
+
/** @public */
|
|
1008
|
+
declare const TableRoot: (props: TableRootProps) => react_jsx_runtime.JSX.Element;
|
|
1009
|
+
|
|
1010
|
+
/** @public */
|
|
1011
|
+
declare const TableHeader: <T extends object>(props: TableHeaderProps<T>) => react_jsx_runtime.JSX.Element;
|
|
1012
|
+
|
|
1013
|
+
/** @public */
|
|
1014
|
+
declare const TableBody: <T extends object>(props: TableBodyProps<T>) => react_jsx_runtime.JSX.Element;
|
|
848
1015
|
|
|
849
1016
|
/** @public */
|
|
850
1017
|
declare const Column: (props: ColumnProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -868,84 +1035,97 @@ declare const CellText: {
|
|
|
868
1035
|
declare const CellProfile: (props: CellProfileProps) => react_jsx_runtime.JSX.Element;
|
|
869
1036
|
|
|
870
1037
|
/** @public */
|
|
871
|
-
interface
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
setPageSize?: (pageSize: number) => void;
|
|
875
|
-
setOffset?: (offset: number) => void;
|
|
876
|
-
rowCount?: number;
|
|
877
|
-
onNextPage?: () => void;
|
|
878
|
-
onPreviousPage?: () => void;
|
|
879
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
880
|
-
showPageSizeOptions?: boolean;
|
|
1038
|
+
interface FilterState<TFilter> {
|
|
1039
|
+
value: TFilter | undefined;
|
|
1040
|
+
onChange: (value: TFilter) => void;
|
|
881
1041
|
}
|
|
882
|
-
|
|
883
1042
|
/** @public */
|
|
884
|
-
interface
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1043
|
+
interface SearchState {
|
|
1044
|
+
value: string;
|
|
1045
|
+
onChange: (value: string) => void;
|
|
1046
|
+
}
|
|
1047
|
+
/** @public */
|
|
1048
|
+
interface QueryOptions<TFilter> {
|
|
1049
|
+
initialSort?: SortDescriptor;
|
|
1050
|
+
sort?: SortDescriptor | null;
|
|
1051
|
+
onSortChange?: (sort: SortDescriptor) => void;
|
|
1052
|
+
initialFilter?: TFilter;
|
|
1053
|
+
filter?: TFilter;
|
|
1054
|
+
onFilterChange?: (filter: TFilter) => void;
|
|
1055
|
+
initialSearch?: string;
|
|
1056
|
+
search?: string;
|
|
1057
|
+
onSearchChange?: (search: string) => void;
|
|
1058
|
+
}
|
|
1059
|
+
/** @public */
|
|
1060
|
+
interface PaginationOptions {
|
|
890
1061
|
pageSize?: number;
|
|
891
|
-
|
|
892
|
-
onOffsetChange?: (offset: number) => void;
|
|
893
|
-
/** Callback when page size changes */
|
|
894
|
-
onPageSizeChange?: (pageSize: number) => void;
|
|
895
|
-
/** Default page size for uncontrolled mode */
|
|
896
|
-
defaultPageSize?: number;
|
|
897
|
-
/** Default offset for uncontrolled mode */
|
|
898
|
-
defaultOffset?: number;
|
|
899
|
-
/** Callback when next page is clicked */
|
|
900
|
-
onNextPage?: () => void;
|
|
901
|
-
/** Callback when previous page is clicked */
|
|
902
|
-
onPreviousPage?: () => void;
|
|
903
|
-
/** Whether to show page size options */
|
|
1062
|
+
initialOffset?: number;
|
|
904
1063
|
showPageSizeOptions?: boolean;
|
|
1064
|
+
getLabel?: TablePaginationProps['getLabel'];
|
|
905
1065
|
}
|
|
906
1066
|
/** @public */
|
|
907
|
-
interface
|
|
908
|
-
/** Props to pass to TablePagination component */
|
|
909
|
-
paginationProps: TablePaginationProps;
|
|
910
|
-
/** Current offset */
|
|
1067
|
+
interface OffsetParams<TFilter> {
|
|
911
1068
|
offset: number;
|
|
912
|
-
/** Current page size */
|
|
913
1069
|
pageSize: number;
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
/** Go to previous page */
|
|
919
|
-
previousPage: () => void;
|
|
920
|
-
/** Set specific offset */
|
|
921
|
-
setOffset: (offset: number) => void;
|
|
922
|
-
/** Set page size */
|
|
923
|
-
setPageSize: (pageSize: number) => void;
|
|
1070
|
+
sort: SortDescriptor | null;
|
|
1071
|
+
filter: TFilter | undefined;
|
|
1072
|
+
search: string;
|
|
1073
|
+
signal: AbortSignal;
|
|
924
1074
|
}
|
|
925
1075
|
/** @public */
|
|
926
|
-
interface
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1076
|
+
interface CursorParams<TFilter> {
|
|
1077
|
+
cursor: string | undefined;
|
|
1078
|
+
pageSize: number;
|
|
1079
|
+
sort: SortDescriptor | null;
|
|
1080
|
+
filter: TFilter | undefined;
|
|
1081
|
+
search: string;
|
|
1082
|
+
signal: AbortSignal;
|
|
1083
|
+
}
|
|
1084
|
+
/** @public */
|
|
1085
|
+
interface OffsetResponse<T> {
|
|
1086
|
+
data: T[];
|
|
1087
|
+
totalCount: number;
|
|
1088
|
+
}
|
|
1089
|
+
/** @public */
|
|
1090
|
+
interface CursorResponse<T> {
|
|
1091
|
+
data: T[];
|
|
1092
|
+
nextCursor?: string;
|
|
1093
|
+
prevCursor?: string;
|
|
1094
|
+
totalCount?: number;
|
|
931
1095
|
}
|
|
932
1096
|
/** @public */
|
|
933
|
-
interface
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1097
|
+
interface UseTableCompleteOptions<T extends TableItem, TFilter = unknown> extends QueryOptions<TFilter> {
|
|
1098
|
+
mode: 'complete';
|
|
1099
|
+
getData: () => T[] | Promise<T[]>;
|
|
1100
|
+
paginationOptions?: PaginationOptions;
|
|
1101
|
+
sortFn?: (data: T[], sort: SortDescriptor) => T[];
|
|
1102
|
+
filterFn?: (data: T[], filter: TFilter) => T[];
|
|
1103
|
+
searchFn?: (data: T[], search: string) => T[];
|
|
1104
|
+
}
|
|
1105
|
+
/** @public */
|
|
1106
|
+
interface UseTableOffsetOptions<T extends TableItem, TFilter = unknown> extends QueryOptions<TFilter> {
|
|
1107
|
+
mode: 'offset';
|
|
1108
|
+
getData: (params: OffsetParams<TFilter>) => Promise<OffsetResponse<T>>;
|
|
1109
|
+
paginationOptions?: PaginationOptions;
|
|
1110
|
+
}
|
|
1111
|
+
/** @public */
|
|
1112
|
+
interface UseTableCursorOptions<T extends TableItem, TFilter = unknown> extends QueryOptions<TFilter> {
|
|
1113
|
+
mode: 'cursor';
|
|
1114
|
+
getData: (params: CursorParams<TFilter>) => Promise<CursorResponse<T>>;
|
|
1115
|
+
paginationOptions?: Omit<PaginationOptions, 'initialOffset'>;
|
|
1116
|
+
}
|
|
1117
|
+
/** @public */
|
|
1118
|
+
type UseTableOptions<T extends TableItem, TFilter = unknown> = UseTableCompleteOptions<T, TFilter> | UseTableOffsetOptions<T, TFilter> | UseTableCursorOptions<T, TFilter>;
|
|
1119
|
+
/** @public */
|
|
1120
|
+
interface UseTableResult<T extends TableItem, TFilter = unknown> {
|
|
1121
|
+
tableProps: Omit<TableProps<T>, 'columnConfig' | 'rowConfig' | 'selection' | 'emptyState'>;
|
|
1122
|
+
reload: () => void;
|
|
1123
|
+
filter: FilterState<TFilter>;
|
|
1124
|
+
search: SearchState;
|
|
940
1125
|
}
|
|
941
1126
|
|
|
942
|
-
/**
|
|
943
|
-
|
|
944
|
-
* Supports both controlled and uncontrolled modes using offset/pageSize pattern (Backstage style).
|
|
945
|
-
*
|
|
946
|
-
* @public
|
|
947
|
-
*/
|
|
948
|
-
declare function useTable<T = any>(config?: UseTableConfig<T>): UseTableResult<T>;
|
|
1127
|
+
/** @public */
|
|
1128
|
+
declare function useTable<T extends TableItem, TFilter = unknown>(options: UseTableOptions<T, TFilter>): UseTableResult<T, TFilter>;
|
|
949
1129
|
|
|
950
1130
|
/**
|
|
951
1131
|
* Component definition for Table
|
|
@@ -973,25 +1153,8 @@ declare const TableDefinition: {
|
|
|
973
1153
|
readonly headSelection: "bui-TableHeadSelection";
|
|
974
1154
|
readonly cellSelection: "bui-TableCellSelection";
|
|
975
1155
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
/**
|
|
979
|
-
* Pagination controls for Table components with page navigation and size selection.
|
|
980
|
-
*
|
|
981
|
-
* @public
|
|
982
|
-
*/
|
|
983
|
-
declare function TablePagination(props: TablePaginationProps): react_jsx_runtime.JSX.Element;
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Component definition for TablePagination
|
|
987
|
-
* @public
|
|
988
|
-
*/
|
|
989
|
-
declare const TablePaginationDefinition: {
|
|
990
|
-
readonly classNames: {
|
|
991
|
-
readonly root: "bui-TablePagination";
|
|
992
|
-
readonly left: "bui-TablePaginationLeft";
|
|
993
|
-
readonly right: "bui-TablePaginationRight";
|
|
994
|
-
readonly select: "bui-TablePaginationSelect";
|
|
1156
|
+
readonly dataAttributes: {
|
|
1157
|
+
readonly stale: readonly [true, false];
|
|
995
1158
|
};
|
|
996
1159
|
};
|
|
997
1160
|
|
|
@@ -1429,6 +1592,57 @@ declare const SwitchDefinition: {
|
|
|
1429
1592
|
};
|
|
1430
1593
|
};
|
|
1431
1594
|
|
|
1595
|
+
/**
|
|
1596
|
+
* Properties for {@link ToggleButton}
|
|
1597
|
+
*
|
|
1598
|
+
* @public
|
|
1599
|
+
*/
|
|
1600
|
+
interface ToggleButtonProps extends ToggleButtonProps$1 {
|
|
1601
|
+
size?: 'small' | 'medium' | Partial<Record<Breakpoint, 'small' | 'medium'>>;
|
|
1602
|
+
iconStart?: ReactElement;
|
|
1603
|
+
iconEnd?: ReactElement;
|
|
1604
|
+
/** Surface the toggle button is placed on. Defaults to context surface if available */
|
|
1605
|
+
onSurface?: Responsive<Surface>;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
/** @public */
|
|
1609
|
+
declare const ToggleButton: react.ForwardRefExoticComponent<ToggleButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Component definition for ToggleButton
|
|
1613
|
+
* @public
|
|
1614
|
+
*/
|
|
1615
|
+
declare const ToggleButtonDefinition: {
|
|
1616
|
+
readonly classNames: {
|
|
1617
|
+
readonly root: "bui-ToggleButton";
|
|
1618
|
+
readonly content: "bui-ToggleButtonContent";
|
|
1619
|
+
};
|
|
1620
|
+
readonly dataAttributes: {
|
|
1621
|
+
readonly size: readonly ["small", "medium"];
|
|
1622
|
+
};
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
/** @public */
|
|
1626
|
+
interface ToggleButtonGroupProps extends Omit<ToggleButtonGroupProps$1, 'orientation'> {
|
|
1627
|
+
orientation?: NonNullable<ToggleButtonGroupProps$1['orientation']>;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
/** @public */
|
|
1631
|
+
declare const ToggleButtonGroup: react.ForwardRefExoticComponent<ToggleButtonGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Component definition for ToggleButtonGroup
|
|
1635
|
+
* @public
|
|
1636
|
+
*/
|
|
1637
|
+
declare const ToggleButtonGroupDefinition: {
|
|
1638
|
+
readonly classNames: {
|
|
1639
|
+
readonly root: "bui-ToggleButtonGroup";
|
|
1640
|
+
};
|
|
1641
|
+
readonly dataAttributes: {
|
|
1642
|
+
readonly orientation: readonly ["horizontal", "vertical"];
|
|
1643
|
+
};
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1432
1646
|
/**
|
|
1433
1647
|
* Properties for {@link VisuallyHidden}
|
|
1434
1648
|
*
|
|
@@ -1466,5 +1680,5 @@ declare const useBreakpoint: () => {
|
|
|
1466
1680
|
down: (key: Breakpoint) => boolean;
|
|
1467
1681
|
};
|
|
1468
1682
|
|
|
1469
|
-
export { Accordion, AccordionDefinition, AccordionGroup, AccordionPanel, AccordionTrigger, Avatar, AvatarDefinition, Box, BoxDefinition, Button, ButtonDefinition, ButtonIcon, ButtonIconDefinition, ButtonLink, ButtonLinkDefinition, Card, CardBody, CardDefinition, CardFooter, CardHeader, Cell, CellProfile, CellText, Checkbox, CheckboxDefinition, Column, Container, ContainerDefinition, Dialog, DialogBody, DialogDefinition, DialogFooter, DialogHeader, DialogTrigger, FieldLabel, FieldLabelDefinition, Flex, FlexDefinition, Grid, GridDefinition, GridItemDefinition, Header, HeaderDefinition, HeaderPage, HeaderPageDefinition, Link, LinkDefinition, Menu, MenuAutocomplete, MenuAutocompleteListbox, MenuDefinition, MenuItem, MenuListBox, MenuListBoxItem, MenuSection, MenuSeparator, MenuTrigger, Radio, RadioGroup, RadioGroupDefinition, Row, SearchField, SearchFieldDefinition, Select, SelectDefinition, Skeleton, SkeletonDefinition, SubmenuTrigger, Switch, SwitchDefinition, Tab, TabList, TabPanel, Table, TableBody, TableDefinition, TableHeader, TablePagination, TablePaginationDefinition, Tabs, TabsDefinition, Tag, TagGroup, TagGroupDefinition, Text, TextDefinition, TextField, TextFieldDefinition, Tooltip, TooltipDefinition, TooltipTrigger, VisuallyHidden, VisuallyHiddenDefinition, useBreakpoint, useTable };
|
|
1470
|
-
export type { AccordionGroupProps, AccordionPanelProps, AccordionProps, AccordionTriggerProps, AlignItems, AvatarProps, Border, BorderRadius, BoxProps, Breakpoint, ButtonIconProps, ButtonLinkProps, ButtonProps, CardBodyProps, CardFooterProps, CardHeaderProps, CardProps, CellProfileProps, CellProps, CellTextProps, CheckboxProps, ClassNamesMap, ColumnProps, Columns, ComponentDefinition, ContainerProps, DataAttributeValues, DataAttributesMap, DialogBodyProps, DialogHeaderProps, DialogProps, DialogTriggerProps, Display, FieldLabelProps, FlexDirection, FlexProps, FlexWrap, GridItemProps, GridProps, HeaderPageBreadcrumb, HeaderPageProps, HeaderProps, HeaderTab, JustifyContent, LinkProps, MenuAutocompleteListBoxProps, MenuAutocompleteProps, MenuItemProps, MenuListBoxItemProps, MenuListBoxProps, MenuProps, MenuSectionProps, MenuSeparatorProps, MenuTriggerProps, Option, RadioGroupProps, RadioProps, Responsive, SearchFieldProps, SelectProps, SkeletonProps, Space, SpaceProps, SubmenuTriggerProps, SwitchProps, TabListProps, TabMatchStrategy, TabPanelProps, TabProps, TablePaginationProps, TabsProps, TagGroupProps, TagProps, TextColorStatus, TextColors, TextFieldProps, TextOwnProps, TextProps, TextVariants, TextWeights, TooltipProps,
|
|
1683
|
+
export { Accordion, AccordionDefinition, AccordionGroup, AccordionPanel, AccordionTrigger, Avatar, AvatarDefinition, Box, BoxDefinition, Button, ButtonDefinition, ButtonIcon, ButtonIconDefinition, ButtonLink, ButtonLinkDefinition, Card, CardBody, CardDefinition, CardFooter, CardHeader, Cell, CellProfile, CellText, Checkbox, CheckboxDefinition, Column, Container, ContainerDefinition, Dialog, DialogBody, DialogDefinition, DialogFooter, DialogHeader, DialogTrigger, FieldLabel, FieldLabelDefinition, Flex, FlexDefinition, Grid, GridDefinition, GridItemDefinition, Header, HeaderDefinition, HeaderPage, HeaderPageDefinition, Link, LinkDefinition, Menu, MenuAutocomplete, MenuAutocompleteListbox, MenuDefinition, MenuItem, MenuListBox, MenuListBoxItem, MenuSection, MenuSeparator, MenuTrigger, Radio, RadioGroup, RadioGroupDefinition, Row, SearchField, SearchFieldDefinition, Select, SelectDefinition, Skeleton, SkeletonDefinition, SubmenuTrigger, Switch, SwitchDefinition, Tab, TabList, TabPanel, Table, TableBody, TableDefinition, TableHeader, TablePagination, TablePaginationDefinition, TableRoot, Tabs, TabsDefinition, Tag, TagGroup, TagGroupDefinition, Text, TextDefinition, TextField, TextFieldDefinition, ToggleButton, ToggleButtonDefinition, ToggleButtonGroup, ToggleButtonGroupDefinition, Tooltip, TooltipDefinition, TooltipTrigger, VisuallyHidden, VisuallyHiddenDefinition, useBreakpoint, useTable };
|
|
1684
|
+
export type { AccordionGroupProps, AccordionPanelProps, AccordionProps, AccordionTriggerProps, AlignItems, AvatarProps, Border, BorderRadius, BoxProps, Breakpoint, ButtonIconProps, ButtonLinkProps, ButtonProps, CardBodyProps, CardFooterProps, CardHeaderProps, CardProps, CellProfileProps, CellProps, CellTextProps, CheckboxProps, ClassNamesMap, ColumnConfig, ColumnProps, Columns, ComponentDefinition, ContainerProps, CursorParams, CursorResponse, DataAttributeValues, DataAttributesMap, DialogBodyProps, DialogHeaderProps, DialogProps, DialogTriggerProps, Display, FieldLabelProps, FilterState, FlexDirection, FlexProps, FlexWrap, GridItemProps, GridProps, HeaderPageBreadcrumb, HeaderPageProps, HeaderProps, HeaderTab, JustifyContent, LinkProps, MenuAutocompleteListBoxProps, MenuAutocompleteProps, MenuItemProps, MenuListBoxItemProps, MenuListBoxProps, MenuProps, MenuSectionProps, MenuSeparatorProps, MenuTriggerProps, NoPagination, OffsetParams, OffsetResponse, Option, PagePagination, PaginationOptions, QueryOptions, RadioGroupProps, RadioProps, Responsive, RowConfig, RowRenderFn, SearchFieldProps, SearchState, SelectProps, SkeletonProps, SortDescriptor, SortState, Space, SpaceProps, SubmenuTriggerProps, Surface, SwitchProps, TabListProps, TabMatchStrategy, TabPanelProps, TabProps, TableItem, TablePaginationProps, TablePaginationType, TableProps, TableRootProps, TableSelection, TabsProps, TagGroupProps, TagProps, TextColorStatus, TextColors, TextFieldProps, TextOwnProps, TextProps, TextVariants, TextWeights, ToggleButtonGroupProps, ToggleButtonProps, TooltipProps, UseTableCompleteOptions, UseTableCursorOptions, UseTableOffsetOptions, UseTableOptions, UseTableResult, UtilityProps, VisuallyHiddenProps };
|
package/dist/index.esm.js
CHANGED
|
@@ -31,6 +31,7 @@ export { CheckboxDefinition } from './components/Checkbox/definition.esm.js';
|
|
|
31
31
|
export { Radio, RadioGroup } from './components/RadioGroup/RadioGroup.esm.js';
|
|
32
32
|
export { RadioGroupDefinition } from './components/RadioGroup/definition.esm.js';
|
|
33
33
|
export { Table } from './components/Table/components/Table.esm.js';
|
|
34
|
+
export { TableRoot } from './components/Table/components/TableRoot.esm.js';
|
|
34
35
|
export { TableHeader } from './components/Table/components/TableHeader.esm.js';
|
|
35
36
|
export { TableBody } from './components/Table/components/TableBody.esm.js';
|
|
36
37
|
export { Column } from './components/Table/components/Column.esm.js';
|
|
@@ -64,6 +65,10 @@ export { Skeleton } from './components/Skeleton/Skeleton.esm.js';
|
|
|
64
65
|
export { SkeletonDefinition } from './components/Skeleton/definition.esm.js';
|
|
65
66
|
export { Switch } from './components/Switch/Switch.esm.js';
|
|
66
67
|
export { SwitchDefinition } from './components/Switch/definition.esm.js';
|
|
68
|
+
export { ToggleButton } from './components/ToggleButton/ToggleButton.esm.js';
|
|
69
|
+
export { ToggleButtonDefinition } from './components/ToggleButton/definition.esm.js';
|
|
70
|
+
export { ToggleButtonGroup } from './components/ToggleButtonGroup/ToggleButtonGroup.esm.js';
|
|
71
|
+
export { ToggleButtonGroupDefinition } from './components/ToggleButtonGroup/definition.esm.js';
|
|
67
72
|
export { VisuallyHidden } from './components/VisuallyHidden/VisuallyHidden.esm.js';
|
|
68
73
|
export { VisuallyHiddenDefinition } from './components/VisuallyHidden/definition.esm.js';
|
|
69
74
|
export { useBreakpoint } from './hooks/useBreakpoint.esm.js';
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/ui",
|
|
3
|
-
"version": "0.11.0-next.
|
|
3
|
+
"version": "0.11.0-next.1",
|
|
4
4
|
"backstage": {
|
|
5
5
|
"role": "web-library"
|
|
6
6
|
},
|
|
@@ -40,17 +40,18 @@
|
|
|
40
40
|
"test": "backstage-cli package test"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@backstage/version-bridge": "1.0.11",
|
|
43
44
|
"@remixicon/react": "^4.6.0",
|
|
44
45
|
"@tanstack/react-table": "^8.21.3",
|
|
45
46
|
"clsx": "^2.1.1",
|
|
46
47
|
"react-aria-components": "^1.13.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@backstage/cli": "0.35.2-next.
|
|
50
|
+
"@backstage/cli": "0.35.2-next.1",
|
|
50
51
|
"@types/react": "^18.0.0",
|
|
51
52
|
"@types/react-dom": "^18.0.0",
|
|
52
53
|
"chalk": "^5.4.1",
|
|
53
|
-
"eslint-plugin-storybook": "^10.
|
|
54
|
+
"eslint-plugin-storybook": "^10.2.0-alpha.7",
|
|
54
55
|
"glob": "^11.0.1",
|
|
55
56
|
"globals": "^15.11.0",
|
|
56
57
|
"lightningcss": "^1.29.1",
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
"react": "^18.0.2",
|
|
59
60
|
"react-dom": "^18.0.2",
|
|
60
61
|
"react-router-dom": "^6.3.0",
|
|
61
|
-
"storybook": "^10.
|
|
62
|
+
"storybook": "^10.2.0-alpha.7"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
65
|
"@types/react": "^17.0.0 || ^18.0.0",
|