@protonradio/proton-ui 0.11.0-beta.21 → 0.11.0-beta.4
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/README.md +73 -73
- package/dist/constants.cjs.js +1 -1
- package/dist/constants.cjs.js.map +1 -1
- package/dist/constants.d.ts +0 -2
- package/dist/constants.es.js +1 -1
- package/dist/constants.es.js.map +1 -1
- package/dist/icons.svg +10 -10
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +24 -152
- package/dist/index.es.js +4100 -4304
- package/dist/index.es.js.map +1 -1
- package/dist/palettes-BX86v-qb.js +2 -0
- package/dist/palettes-BX86v-qb.js.map +1 -0
- package/dist/{palettes-D006-kxf.mjs → palettes-mcF0lNKY.mjs} +62 -65
- package/dist/palettes-mcF0lNKY.mjs.map +1 -0
- package/dist/style.css +1 -1
- package/dist/useBreakpoint-CjRyGKN-.mjs.map +1 -1
- package/dist/useBreakpoint-DA-JqOu3.js.map +1 -1
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.cjs.js.map +1 -1
- package/dist/utils.d.ts +0 -7
- package/dist/utils.es.js +105 -111
- package/dist/utils.es.js.map +1 -1
- package/package.json +100 -100
- package/dist/palettes-D006-kxf.mjs.map +0 -1
- package/dist/palettes-DfloGKJz.js +0 -2
- package/dist/palettes-DfloGKJz.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { AriaButtonProps } from 'react-aria';
|
|
2
1
|
import { AriaDialogProps } from 'react-aria';
|
|
3
2
|
import { AriaPopoverProps } from 'react-aria';
|
|
4
3
|
import { AriaTableProps } from 'react-aria';
|
|
@@ -10,18 +9,13 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
10
9
|
import { OverlayTriggerProps } from 'react-stately';
|
|
11
10
|
import { OverlayTriggerState } from 'react-stately';
|
|
12
11
|
import { PressEvent } from 'react-aria';
|
|
13
|
-
import { ReactElement } from 'react';
|
|
14
12
|
import { ReactNode } from 'react';
|
|
15
13
|
import { RefAttributes } from 'react';
|
|
16
14
|
import { RowProps } from '@react-stately/table';
|
|
17
15
|
import { Section } from '@react-stately/table';
|
|
18
16
|
import { Selection as Selection_2 } from 'react-stately';
|
|
19
|
-
import { TableBodyProps
|
|
20
|
-
import { TableCellProps as TableCellProps_2 } from './Collection/CompoundComponents';
|
|
21
|
-
import { TableColumnData as TableColumnData_2 } from '../Table';
|
|
22
|
-
import { TableColumnProps as TableColumnProps_2 } from './Collection/CompoundComponents';
|
|
17
|
+
import { TableBodyProps } from '@react-stately/table';
|
|
23
18
|
import { TableHeader } from '@react-stately/table';
|
|
24
|
-
import { TableRowProps as TableRowProps_2 } from './Collection/CompoundComponents';
|
|
25
19
|
import { TableStateProps } from 'react-stately';
|
|
26
20
|
import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
|
|
27
21
|
import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
@@ -31,12 +25,11 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
|
31
25
|
* Renders a list of actions as a focusable menu, or non-focusable children.
|
|
32
26
|
* @interface ActionMenuProps
|
|
33
27
|
*/
|
|
34
|
-
export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions,
|
|
28
|
+
export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
|
|
35
29
|
|
|
36
30
|
declare interface ActionMenuAction {
|
|
37
31
|
key: string;
|
|
38
32
|
label?: ReactNode;
|
|
39
|
-
description?: ReactNode;
|
|
40
33
|
to?: string;
|
|
41
34
|
onAction?: (key: string) => void;
|
|
42
35
|
children?: ActionMenuAction[];
|
|
@@ -53,8 +46,8 @@ declare interface ActionMenuProps {
|
|
|
53
46
|
}) => ReactNode);
|
|
54
47
|
showCancel?: boolean;
|
|
55
48
|
cancelButtonText?: string;
|
|
56
|
-
title?: string;
|
|
57
49
|
actions?: ActionMenuAction[];
|
|
50
|
+
id?: string;
|
|
58
51
|
onClose?: () => void;
|
|
59
52
|
onSelectionChange?: (keys: Selection_2) => void;
|
|
60
53
|
"data-testid"?: string;
|
|
@@ -211,7 +204,7 @@ declare interface BaseInputProps {
|
|
|
211
204
|
* A customizable button component that can render as either a button or anchor element
|
|
212
205
|
* @interface ButtonProps
|
|
213
206
|
*/
|
|
214
|
-
export declare
|
|
207
|
+
export declare function Button({ variant, size, fullWidth, icon, to, target, onPress, type, isDisabled, "data-testid": testId, children, __textShift, }: ButtonProps): JSX_2.Element;
|
|
215
208
|
|
|
216
209
|
export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
|
|
217
210
|
|
|
@@ -251,7 +244,7 @@ declare interface ButtonGroupProps {
|
|
|
251
244
|
children?: React.ReactNode;
|
|
252
245
|
}
|
|
253
246
|
|
|
254
|
-
declare interface ButtonProps
|
|
247
|
+
declare interface ButtonProps {
|
|
255
248
|
/** The button's visual aesthetic
|
|
256
249
|
* @param {ButtonVariant} variant
|
|
257
250
|
*/
|
|
@@ -280,7 +273,7 @@ declare interface ButtonProps extends AriaButtonProps<"button"> {
|
|
|
280
273
|
/** The target attribute for the link. Defaults to `_blank` if the URL is external.
|
|
281
274
|
* @param {string} target
|
|
282
275
|
*/
|
|
283
|
-
target?: "_blank" | "_self" | "_parent" | "_top"
|
|
276
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
284
277
|
/** Called when the button is pressed (on release, not keydown)
|
|
285
278
|
* @param {(e: PressEvent) => void} onPress
|
|
286
279
|
*/
|
|
@@ -297,6 +290,10 @@ declare interface ButtonProps extends AriaButtonProps<"button"> {
|
|
|
297
290
|
* @param {React.ReactNode} children
|
|
298
291
|
*/
|
|
299
292
|
children?: React.ReactNode;
|
|
293
|
+
/** DO NOT USE. INTERNAL USE ONLY. Will be used in calculation for the shift of the button text. Represents the # of horizontal pixels to shift.
|
|
294
|
+
* @param {number} __textShift
|
|
295
|
+
*/
|
|
296
|
+
__textShift?: number;
|
|
300
297
|
}
|
|
301
298
|
|
|
302
299
|
declare type ButtonSize = "small" | "medium" | "large" | "xlarge" | "2xlarge";
|
|
@@ -428,14 +425,12 @@ export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps &
|
|
|
428
425
|
declare type MenuItemType = ActionMenuAction;
|
|
429
426
|
|
|
430
427
|
declare interface MenuProps {
|
|
428
|
+
/** The id of the menu */
|
|
429
|
+
menuId?: string;
|
|
431
430
|
/** Custom trigger component. If not provided, defaults to ellipsis icon */
|
|
432
|
-
renderTrigger?: (triggerProps: TriggerProps) => ReactNode;
|
|
433
|
-
/** Size of the trigger icon
|
|
434
|
-
* @default 24
|
|
435
|
-
*/
|
|
431
|
+
renderTrigger?: (triggerProps: TriggerProps, isOpen: boolean) => ReactNode;
|
|
432
|
+
/** Size of the trigger icon */
|
|
436
433
|
size?: number;
|
|
437
|
-
/** Title of the parent menu */
|
|
438
|
-
title?: string;
|
|
439
434
|
/** Array of menu actions/items to display */
|
|
440
435
|
items: MenuItemType[];
|
|
441
436
|
/** Whether the menu is disabled */
|
|
@@ -443,7 +438,7 @@ declare interface MenuProps {
|
|
|
443
438
|
/** Callback when menu closes */
|
|
444
439
|
onClose?: () => void;
|
|
445
440
|
/** Test ID for the trigger component */
|
|
446
|
-
|
|
441
|
+
testId?: string;
|
|
447
442
|
/** Test ID for the menu */
|
|
448
443
|
menuTestId?: string;
|
|
449
444
|
/** Callback when a menu item is selected */
|
|
@@ -454,7 +449,7 @@ declare interface MenuProps {
|
|
|
454
449
|
disabledKeys?: string[];
|
|
455
450
|
}
|
|
456
451
|
|
|
457
|
-
export declare function MenuTrigger({ renderTrigger,
|
|
452
|
+
export declare function MenuTrigger({ renderTrigger, menuId, size, items, disabled, onClose, testId: triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
|
|
458
453
|
|
|
459
454
|
export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, "data-testid": dataTestId, }: ModalProps) => JSX_2.Element) & {
|
|
460
455
|
Title: ({ children }: {
|
|
@@ -513,7 +508,6 @@ declare type Palette = {
|
|
|
513
508
|
BRAND: {
|
|
514
509
|
PRIMARY: string;
|
|
515
510
|
PRIMARY_LIGHT: string;
|
|
516
|
-
PRIMARY_SUPER_LIGHT: string;
|
|
517
511
|
SECONDARY: string;
|
|
518
512
|
};
|
|
519
513
|
PRIMARY: {
|
|
@@ -595,7 +589,7 @@ export declare interface ProtonRowProps<T = object> extends RowProps<T> {
|
|
|
595
589
|
onClick?: (key: string) => void;
|
|
596
590
|
}
|
|
597
591
|
|
|
598
|
-
export declare interface ProtonTableBodyProps<T = object> extends
|
|
592
|
+
export declare interface ProtonTableBodyProps<T = object> extends TableBodyProps<T> {
|
|
599
593
|
showLines?: boolean;
|
|
600
594
|
}
|
|
601
595
|
|
|
@@ -719,120 +713,18 @@ declare interface SwitchProps {
|
|
|
719
713
|
children?: React.ReactNode;
|
|
720
714
|
}
|
|
721
715
|
|
|
722
|
-
export declare function Table(props:
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* Base Table component that renders data in rows and columns using collections.
|
|
726
|
-
*
|
|
727
|
-
* - Built-in keyboard navigation for interactive rows.
|
|
728
|
-
* - Full ARIA table semantics with proper roles, labels, and indices.
|
|
729
|
-
*
|
|
730
|
-
* API:
|
|
731
|
-
* - {@link TableProps}
|
|
732
|
-
*
|
|
733
|
-
* @example
|
|
734
|
-
* ```tsx
|
|
735
|
-
* <Table caption="Employee Directory">
|
|
736
|
-
* <Table.Header>
|
|
737
|
-
* <Table.Column id="name">Name</Table.Column>
|
|
738
|
-
* </Table.Header>
|
|
739
|
-
* <Table.Body>
|
|
740
|
-
* <Table.Row key="1">
|
|
741
|
-
* <Table.Cell>Joe</Table.Cell>
|
|
742
|
-
* </Table.Row>
|
|
743
|
-
* </Table.Body>
|
|
744
|
-
* </Table>
|
|
745
|
-
* ```
|
|
746
|
-
*/
|
|
747
|
-
export declare const Table2: (({ children, name }: TableProps) => JSX_2.Element) & {
|
|
748
|
-
/** Table header: {@link TableHeaderProps} */
|
|
749
|
-
Header: ({ ...props }: TableHeaderProps) => any;
|
|
750
|
-
/** Table column: {@link TableColumnProps} */
|
|
751
|
-
Column: ({ ...props }: TableColumnProps_2) => any;
|
|
752
|
-
/** Table body: {@link TableBodyProps} */
|
|
753
|
-
Body: ({ ...props }: TableBodyProps) => any;
|
|
754
|
-
/** Table row: {@link TableRowProps} */
|
|
755
|
-
Row: ({ ...props }: TableRowProps_2) => any;
|
|
756
|
-
/** Table cell: {@link TableCellProps} */
|
|
757
|
-
Cell: ({ ...props }: TableCellProps_2) => any;
|
|
758
|
-
};
|
|
716
|
+
export declare function Table(props: TableProps): JSX_2.Element;
|
|
759
717
|
|
|
760
718
|
export declare const TableBody: <T = object>(props: ProtonTableBodyProps<T>) => JSX.Element;
|
|
761
719
|
|
|
762
|
-
export declare interface TableBodyProps {
|
|
763
|
-
children: TableRowElement | TableRowElement[];
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
declare const TableCell: ({ ...props }: TableCellProps) => any;
|
|
767
|
-
|
|
768
|
-
export declare type TableCellData = {
|
|
769
|
-
columnKey: string | number;
|
|
770
|
-
value: ReactNode;
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
declare type TableCellElement = ReactElement<TableCellProps, typeof TableCell>;
|
|
774
|
-
|
|
775
|
-
export declare interface TableCellProps {
|
|
776
|
-
columnKey?: string;
|
|
777
|
-
children: ReactNode;
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
export declare type TableCollection = ReturnType<typeof useTableCollection>;
|
|
781
|
-
|
|
782
|
-
declare const TableColumn: ({ ...props }: TableColumnProps) => any;
|
|
783
|
-
|
|
784
|
-
export declare type TableColumnData = {
|
|
785
|
-
key: string | number;
|
|
786
|
-
header: ReactNode;
|
|
787
|
-
isHidden?: boolean;
|
|
788
|
-
};
|
|
789
|
-
|
|
790
|
-
declare type TableColumnElement = ReactElement<TableColumnProps, typeof TableColumn>;
|
|
791
|
-
|
|
792
|
-
export declare interface TableColumnProps {
|
|
793
|
-
id: string;
|
|
794
|
-
children: ReactNode;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
export declare type TableData = {
|
|
798
|
-
columns: TableColumnData[];
|
|
799
|
-
rows: TableRowData[];
|
|
800
|
-
};
|
|
801
|
-
|
|
802
720
|
export { TableHeader }
|
|
803
721
|
|
|
804
|
-
|
|
805
|
-
children: TableColumnElement | TableColumnElement[];
|
|
806
|
-
isHidden?: boolean;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
declare interface TableProps {
|
|
810
|
-
children: [ReactElement<TableHeaderProps>, ReactElement<TableBodyProps>];
|
|
811
|
-
name?: string;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
declare interface TableProps_2 extends AriaTableProps, TableStateProps<object> {
|
|
722
|
+
declare interface TableProps extends AriaTableProps, TableStateProps<object> {
|
|
815
723
|
headerProps?: {
|
|
816
724
|
isHidden?: boolean;
|
|
817
725
|
};
|
|
818
726
|
}
|
|
819
727
|
|
|
820
|
-
declare const TableRow: ({ ...props }: TableRowProps) => any;
|
|
821
|
-
|
|
822
|
-
export declare type TableRowData = {
|
|
823
|
-
key: string | number;
|
|
824
|
-
cells: TableCellData[];
|
|
825
|
-
onClick?: () => void;
|
|
826
|
-
};
|
|
827
|
-
|
|
828
|
-
declare type TableRowElement = ReactElement<TableRowProps, typeof TableRow>;
|
|
829
|
-
|
|
830
|
-
export declare interface TableRowProps {
|
|
831
|
-
key?: string | number;
|
|
832
|
-
children: TableCellElement | TableCellElement[];
|
|
833
|
-
onClick?: () => void;
|
|
834
|
-
}
|
|
835
|
-
|
|
836
728
|
/**
|
|
837
729
|
* A component that displays text with an ellipsis when it overflows its container.
|
|
838
730
|
* @interface TextEllipsisProps
|
|
@@ -926,7 +818,6 @@ declare interface ThemeVariables {
|
|
|
926
818
|
"--proton-control__shadow-color": string;
|
|
927
819
|
"--proton-color__primary": string;
|
|
928
820
|
"--proton-color__primary-light": string;
|
|
929
|
-
"--proton-color__primary-super-light": string;
|
|
930
821
|
"--proton-color__secondary": string;
|
|
931
822
|
"--proton-control__primary-super-dark": string;
|
|
932
823
|
"--proton-control__primary-dark": string;
|
|
@@ -1005,10 +896,11 @@ export declare interface TooltipTriggerProps extends TooltipProps, TooltipTrigge
|
|
|
1005
896
|
* @returns {JSX.Element} - The MenuTrigger component.
|
|
1006
897
|
*/
|
|
1007
898
|
declare interface TriggerProps {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
899
|
+
isDisabled?: boolean;
|
|
900
|
+
"data-testid"?: string;
|
|
901
|
+
ref?: React.RefObject<HTMLButtonElement>;
|
|
902
|
+
onPress?: () => void;
|
|
903
|
+
"aria-label": string;
|
|
1012
904
|
}
|
|
1013
905
|
|
|
1014
906
|
/**
|
|
@@ -1022,26 +914,6 @@ export declare function usePopoverTrigger(props?: OverlayTriggerProps): {
|
|
|
1022
914
|
state: OverlayTriggerState;
|
|
1023
915
|
};
|
|
1024
916
|
|
|
1025
|
-
/**
|
|
1026
|
-
* Hook for managing table data structure and providing navigation methods
|
|
1027
|
-
*/
|
|
1028
|
-
export declare function useTableCollection(data: TableData): {
|
|
1029
|
-
columns: TableColumnData_2[];
|
|
1030
|
-
rows: TableRowData[];
|
|
1031
|
-
size: number;
|
|
1032
|
-
firstItem: TableRowData;
|
|
1033
|
-
lastItem: TableRowData;
|
|
1034
|
-
hasHeader: boolean;
|
|
1035
|
-
isHeaderHidden: boolean;
|
|
1036
|
-
hasVisibleHeader: boolean;
|
|
1037
|
-
getTotalRowCount: number;
|
|
1038
|
-
getRowAriaIndex: (rowIndex: number) => number;
|
|
1039
|
-
getItemByKey: (key: string | number) => TableRowData | null;
|
|
1040
|
-
getItemAfter: (key: string | number) => TableRowData | null;
|
|
1041
|
-
getItemBefore: (key: string | number) => TableRowData | null;
|
|
1042
|
-
getItemIndex: (key: string | number) => number;
|
|
1043
|
-
};
|
|
1044
|
-
|
|
1045
917
|
export declare const useTheme: () => ThemeContextType;
|
|
1046
918
|
|
|
1047
919
|
/**
|