@protonradio/proton-ui 0.11.0-beta.2 → 0.11.0-beta.21
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 +2 -0
- 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 +153 -26
- package/dist/index.es.js +4244 -4041
- package/dist/index.es.js.map +1 -1
- package/dist/{palettes-mcF0lNKY.mjs → palettes-D006-kxf.mjs} +65 -62
- package/dist/palettes-D006-kxf.mjs.map +1 -0
- package/dist/palettes-DfloGKJz.js +2 -0
- package/dist/palettes-DfloGKJz.js.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 +7 -0
- package/dist/utils.es.js +111 -105
- package/dist/utils.es.js.map +1 -1
- package/package.json +100 -100
- package/dist/palettes-BX86v-qb.js +0 -2
- package/dist/palettes-BX86v-qb.js.map +0 -1
- package/dist/palettes-mcF0lNKY.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AriaButtonProps } from 'react-aria';
|
|
1
2
|
import { AriaDialogProps } from 'react-aria';
|
|
2
3
|
import { AriaPopoverProps } from 'react-aria';
|
|
3
4
|
import { AriaTableProps } from 'react-aria';
|
|
@@ -9,14 +10,18 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
9
10
|
import { OverlayTriggerProps } from 'react-stately';
|
|
10
11
|
import { OverlayTriggerState } from 'react-stately';
|
|
11
12
|
import { PressEvent } from 'react-aria';
|
|
13
|
+
import { ReactElement } from 'react';
|
|
12
14
|
import { ReactNode } from 'react';
|
|
13
15
|
import { RefAttributes } from 'react';
|
|
14
16
|
import { RowProps } from '@react-stately/table';
|
|
15
17
|
import { Section } from '@react-stately/table';
|
|
16
18
|
import { Selection as Selection_2 } from 'react-stately';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
+
import { TableBodyProps as TableBodyProps_2 } from '@react-stately/table';
|
|
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';
|
|
19
23
|
import { TableHeader } from '@react-stately/table';
|
|
24
|
+
import { TableRowProps as TableRowProps_2 } from './Collection/CompoundComponents';
|
|
20
25
|
import { TableStateProps } from 'react-stately';
|
|
21
26
|
import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
|
|
22
27
|
import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
@@ -26,11 +31,12 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
|
26
31
|
* Renders a list of actions as a focusable menu, or non-focusable children.
|
|
27
32
|
* @interface ActionMenuProps
|
|
28
33
|
*/
|
|
29
|
-
export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
|
|
34
|
+
export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, title, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
|
|
30
35
|
|
|
31
36
|
declare interface ActionMenuAction {
|
|
32
37
|
key: string;
|
|
33
38
|
label?: ReactNode;
|
|
39
|
+
description?: ReactNode;
|
|
34
40
|
to?: string;
|
|
35
41
|
onAction?: (key: string) => void;
|
|
36
42
|
children?: ActionMenuAction[];
|
|
@@ -47,8 +53,8 @@ declare interface ActionMenuProps {
|
|
|
47
53
|
}) => ReactNode);
|
|
48
54
|
showCancel?: boolean;
|
|
49
55
|
cancelButtonText?: string;
|
|
56
|
+
title?: string;
|
|
50
57
|
actions?: ActionMenuAction[];
|
|
51
|
-
id?: string;
|
|
52
58
|
onClose?: () => void;
|
|
53
59
|
onSelectionChange?: (keys: Selection_2) => void;
|
|
54
60
|
"data-testid"?: string;
|
|
@@ -205,7 +211,7 @@ declare interface BaseInputProps {
|
|
|
205
211
|
* A customizable button component that can render as either a button or anchor element
|
|
206
212
|
* @interface ButtonProps
|
|
207
213
|
*/
|
|
208
|
-
export declare
|
|
214
|
+
export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
209
215
|
|
|
210
216
|
export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
|
|
211
217
|
|
|
@@ -245,7 +251,7 @@ declare interface ButtonGroupProps {
|
|
|
245
251
|
children?: React.ReactNode;
|
|
246
252
|
}
|
|
247
253
|
|
|
248
|
-
declare interface ButtonProps {
|
|
254
|
+
declare interface ButtonProps extends AriaButtonProps<"button"> {
|
|
249
255
|
/** The button's visual aesthetic
|
|
250
256
|
* @param {ButtonVariant} variant
|
|
251
257
|
*/
|
|
@@ -274,7 +280,7 @@ declare interface ButtonProps {
|
|
|
274
280
|
/** The target attribute for the link. Defaults to `_blank` if the URL is external.
|
|
275
281
|
* @param {string} target
|
|
276
282
|
*/
|
|
277
|
-
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
283
|
+
target?: "_blank" | "_self" | "_parent" | "_top" | string;
|
|
278
284
|
/** Called when the button is pressed (on release, not keydown)
|
|
279
285
|
* @param {(e: PressEvent) => void} onPress
|
|
280
286
|
*/
|
|
@@ -291,10 +297,6 @@ declare interface ButtonProps {
|
|
|
291
297
|
* @param {React.ReactNode} children
|
|
292
298
|
*/
|
|
293
299
|
children?: React.ReactNode;
|
|
294
|
-
/** 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.
|
|
295
|
-
* @param {number} __textShift
|
|
296
|
-
*/
|
|
297
|
-
__textShift?: number;
|
|
298
300
|
}
|
|
299
301
|
|
|
300
302
|
declare type ButtonSize = "small" | "medium" | "large" | "xlarge" | "2xlarge";
|
|
@@ -426,12 +428,14 @@ export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps &
|
|
|
426
428
|
declare type MenuItemType = ActionMenuAction;
|
|
427
429
|
|
|
428
430
|
declare interface MenuProps {
|
|
429
|
-
/** The id of the menu */
|
|
430
|
-
menuId?: string;
|
|
431
431
|
/** Custom trigger component. If not provided, defaults to ellipsis icon */
|
|
432
|
-
renderTrigger?: (triggerProps: TriggerProps
|
|
433
|
-
/** Size of the trigger icon
|
|
432
|
+
renderTrigger?: (triggerProps: TriggerProps) => ReactNode;
|
|
433
|
+
/** Size of the trigger icon
|
|
434
|
+
* @default 24
|
|
435
|
+
*/
|
|
434
436
|
size?: number;
|
|
437
|
+
/** Title of the parent menu */
|
|
438
|
+
title?: string;
|
|
435
439
|
/** Array of menu actions/items to display */
|
|
436
440
|
items: MenuItemType[];
|
|
437
441
|
/** Whether the menu is disabled */
|
|
@@ -439,18 +443,18 @@ declare interface MenuProps {
|
|
|
439
443
|
/** Callback when menu closes */
|
|
440
444
|
onClose?: () => void;
|
|
441
445
|
/** Test ID for the trigger component */
|
|
442
|
-
|
|
446
|
+
triggerTestId?: string;
|
|
443
447
|
/** Test ID for the menu */
|
|
444
448
|
menuTestId?: string;
|
|
445
449
|
/** Callback when a menu item is selected */
|
|
446
|
-
onSelectionChange?: (
|
|
450
|
+
onSelectionChange?: (key: string) => void;
|
|
447
451
|
/** The key of the selected item */
|
|
448
452
|
selectedKey?: string;
|
|
449
453
|
/** The keys of the disabled items */
|
|
450
454
|
disabledKeys?: string[];
|
|
451
455
|
}
|
|
452
456
|
|
|
453
|
-
export declare function MenuTrigger({ renderTrigger,
|
|
457
|
+
export declare function MenuTrigger({ renderTrigger, size, title, items, disabled, onClose, triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
|
|
454
458
|
|
|
455
459
|
export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, "data-testid": dataTestId, }: ModalProps) => JSX_2.Element) & {
|
|
456
460
|
Title: ({ children }: {
|
|
@@ -509,6 +513,7 @@ declare type Palette = {
|
|
|
509
513
|
BRAND: {
|
|
510
514
|
PRIMARY: string;
|
|
511
515
|
PRIMARY_LIGHT: string;
|
|
516
|
+
PRIMARY_SUPER_LIGHT: string;
|
|
512
517
|
SECONDARY: string;
|
|
513
518
|
};
|
|
514
519
|
PRIMARY: {
|
|
@@ -590,7 +595,7 @@ export declare interface ProtonRowProps<T = object> extends RowProps<T> {
|
|
|
590
595
|
onClick?: (key: string) => void;
|
|
591
596
|
}
|
|
592
597
|
|
|
593
|
-
export declare interface ProtonTableBodyProps<T = object> extends
|
|
598
|
+
export declare interface ProtonTableBodyProps<T = object> extends TableBodyProps_2<T> {
|
|
594
599
|
showLines?: boolean;
|
|
595
600
|
}
|
|
596
601
|
|
|
@@ -714,18 +719,120 @@ declare interface SwitchProps {
|
|
|
714
719
|
children?: React.ReactNode;
|
|
715
720
|
}
|
|
716
721
|
|
|
717
|
-
export declare function Table(props:
|
|
722
|
+
export declare function Table(props: TableProps_2): JSX_2.Element;
|
|
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
|
+
};
|
|
718
759
|
|
|
719
760
|
export declare const TableBody: <T = object>(props: ProtonTableBodyProps<T>) => JSX.Element;
|
|
720
761
|
|
|
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
|
+
|
|
721
802
|
export { TableHeader }
|
|
722
803
|
|
|
723
|
-
declare interface
|
|
804
|
+
export declare interface TableHeaderProps {
|
|
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> {
|
|
724
815
|
headerProps?: {
|
|
725
816
|
isHidden?: boolean;
|
|
726
817
|
};
|
|
727
818
|
}
|
|
728
819
|
|
|
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
|
+
|
|
729
836
|
/**
|
|
730
837
|
* A component that displays text with an ellipsis when it overflows its container.
|
|
731
838
|
* @interface TextEllipsisProps
|
|
@@ -819,6 +926,7 @@ declare interface ThemeVariables {
|
|
|
819
926
|
"--proton-control__shadow-color": string;
|
|
820
927
|
"--proton-color__primary": string;
|
|
821
928
|
"--proton-color__primary-light": string;
|
|
929
|
+
"--proton-color__primary-super-light": string;
|
|
822
930
|
"--proton-color__secondary": string;
|
|
823
931
|
"--proton-control__primary-super-dark": string;
|
|
824
932
|
"--proton-control__primary-dark": string;
|
|
@@ -897,11 +1005,10 @@ export declare interface TooltipTriggerProps extends TooltipProps, TooltipTrigge
|
|
|
897
1005
|
* @returns {JSX.Element} - The MenuTrigger component.
|
|
898
1006
|
*/
|
|
899
1007
|
declare interface TriggerProps {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
"aria-label": string;
|
|
1008
|
+
disabled?: boolean;
|
|
1009
|
+
isOpen?: boolean;
|
|
1010
|
+
setIsOpen?: (isOpen: boolean) => void;
|
|
1011
|
+
triggerRef: React.RefObject<HTMLButtonElement>;
|
|
905
1012
|
}
|
|
906
1013
|
|
|
907
1014
|
/**
|
|
@@ -915,6 +1022,26 @@ export declare function usePopoverTrigger(props?: OverlayTriggerProps): {
|
|
|
915
1022
|
state: OverlayTriggerState;
|
|
916
1023
|
};
|
|
917
1024
|
|
|
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
|
+
|
|
918
1045
|
export declare const useTheme: () => ThemeContextType;
|
|
919
1046
|
|
|
920
1047
|
/**
|