@protonradio/proton-ui 0.11.0-beta.2 → 0.11.0-beta.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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';
@@ -14,8 +15,7 @@ import { RefAttributes } from 'react';
14
15
  import { RowProps } from '@react-stately/table';
15
16
  import { Section } from '@react-stately/table';
16
17
  import { Selection as Selection_2 } from 'react-stately';
17
- import { Selection as Selection_3 } from 'react-aria-components';
18
- import { TableBodyProps } from '@react-stately/table';
18
+ import { TableBodyProps as TableBodyProps_2 } from '@react-stately/table';
19
19
  import { TableHeader } from '@react-stately/table';
20
20
  import { TableStateProps } from 'react-stately';
21
21
  import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
@@ -26,11 +26,12 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
26
26
  * Renders a list of actions as a focusable menu, or non-focusable children.
27
27
  * @interface ActionMenuProps
28
28
  */
29
- export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
29
+ export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, title, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
30
30
 
31
31
  declare interface ActionMenuAction {
32
32
  key: string;
33
33
  label?: ReactNode;
34
+ description?: ReactNode;
34
35
  to?: string;
35
36
  onAction?: (key: string) => void;
36
37
  children?: ActionMenuAction[];
@@ -47,8 +48,8 @@ declare interface ActionMenuProps {
47
48
  }) => ReactNode);
48
49
  showCancel?: boolean;
49
50
  cancelButtonText?: string;
51
+ title?: string;
50
52
  actions?: ActionMenuAction[];
51
- id?: string;
52
53
  onClose?: () => void;
53
54
  onSelectionChange?: (keys: Selection_2) => void;
54
55
  "data-testid"?: string;
@@ -205,7 +206,7 @@ declare interface BaseInputProps {
205
206
  * A customizable button component that can render as either a button or anchor element
206
207
  * @interface ButtonProps
207
208
  */
208
- export declare function Button({ variant, size, fullWidth, icon, to, target, onPress, type, isDisabled, "data-testid": testId, children, __textShift, }: ButtonProps): JSX_2.Element;
209
+ export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
209
210
 
210
211
  export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
211
212
 
@@ -245,7 +246,7 @@ declare interface ButtonGroupProps {
245
246
  children?: React.ReactNode;
246
247
  }
247
248
 
248
- declare interface ButtonProps {
249
+ declare interface ButtonProps extends AriaButtonProps<"button"> {
249
250
  /** The button's visual aesthetic
250
251
  * @param {ButtonVariant} variant
251
252
  */
@@ -274,7 +275,7 @@ declare interface ButtonProps {
274
275
  /** The target attribute for the link. Defaults to `_blank` if the URL is external.
275
276
  * @param {string} target
276
277
  */
277
- target?: "_blank" | "_self" | "_parent" | "_top";
278
+ target?: "_blank" | "_self" | "_parent" | "_top" | string;
278
279
  /** Called when the button is pressed (on release, not keydown)
279
280
  * @param {(e: PressEvent) => void} onPress
280
281
  */
@@ -291,10 +292,6 @@ declare interface ButtonProps {
291
292
  * @param {React.ReactNode} children
292
293
  */
293
294
  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
295
  }
299
296
 
300
297
  declare type ButtonSize = "small" | "medium" | "large" | "xlarge" | "2xlarge";
@@ -426,12 +423,14 @@ export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps &
426
423
  declare type MenuItemType = ActionMenuAction;
427
424
 
428
425
  declare interface MenuProps {
429
- /** The id of the menu */
430
- menuId?: string;
431
426
  /** Custom trigger component. If not provided, defaults to ellipsis icon */
432
- renderTrigger?: (triggerProps: TriggerProps, isOpen: boolean) => ReactNode;
433
- /** Size of the trigger icon */
427
+ renderTrigger?: (triggerProps: TriggerProps) => ReactNode;
428
+ /** Size of the trigger icon
429
+ * @default 24
430
+ */
434
431
  size?: number;
432
+ /** Title of the parent menu */
433
+ title?: string;
435
434
  /** Array of menu actions/items to display */
436
435
  items: MenuItemType[];
437
436
  /** Whether the menu is disabled */
@@ -439,18 +438,18 @@ declare interface MenuProps {
439
438
  /** Callback when menu closes */
440
439
  onClose?: () => void;
441
440
  /** Test ID for the trigger component */
442
- testId?: string;
441
+ triggerTestId?: string;
443
442
  /** Test ID for the menu */
444
443
  menuTestId?: string;
445
444
  /** Callback when a menu item is selected */
446
- onSelectionChange?: (keys: Selection_3) => void;
445
+ onSelectionChange?: (key: string) => void;
447
446
  /** The key of the selected item */
448
447
  selectedKey?: string;
449
448
  /** The keys of the disabled items */
450
449
  disabledKeys?: string[];
451
450
  }
452
451
 
453
- export declare function MenuTrigger({ renderTrigger, menuId, size, items, disabled, onClose, testId: triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
452
+ export declare function MenuTrigger({ renderTrigger, size, title, items, disabled, onClose, triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
454
453
 
455
454
  export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, "data-testid": dataTestId, }: ModalProps) => JSX_2.Element) & {
456
455
  Title: ({ children }: {
@@ -509,6 +508,7 @@ declare type Palette = {
509
508
  BRAND: {
510
509
  PRIMARY: string;
511
510
  PRIMARY_LIGHT: string;
511
+ PRIMARY_SUPER_LIGHT: string;
512
512
  SECONDARY: string;
513
513
  };
514
514
  PRIMARY: {
@@ -590,7 +590,7 @@ export declare interface ProtonRowProps<T = object> extends RowProps<T> {
590
590
  onClick?: (key: string) => void;
591
591
  }
592
592
 
593
- export declare interface ProtonTableBodyProps<T = object> extends TableBodyProps<T> {
593
+ export declare interface ProtonTableBodyProps<T = object> extends TableBodyProps_2<T> {
594
594
  showLines?: boolean;
595
595
  }
596
596
 
@@ -714,18 +714,92 @@ declare interface SwitchProps {
714
714
  children?: React.ReactNode;
715
715
  }
716
716
 
717
- export declare function Table(props: TableProps): JSX_2.Element;
717
+ export declare function Table(props: TableProps_2): JSX_2.Element;
718
+
719
+ /**
720
+ * Base Table component that renders data in rows and columns using collections.
721
+ *
722
+ * Accessibility features are built-in:
723
+ * - aria-label is automatically generated from table structure and content
724
+ * - aria-describedby links to caption when provided
725
+ * - Full ARIA table semantics with proper roles and indices
726
+ *
727
+ * @example
728
+ * ```tsx
729
+ * <Table caption="Employee Directory">
730
+ * <Table.Header>
731
+ * <Table.Column id="name">Name</Table.Column>
732
+ * </Table.Header>
733
+ * <Table.Body>
734
+ * <Table.Row key="1">
735
+ * <Table.Cell>Joe</Table.Cell>
736
+ * </Table.Row>
737
+ * </Table.Body>
738
+ * </Table>
739
+ * ```
740
+ */
741
+ export declare const Table2: (({ children, name, className }: TableProps) => JSX_2.Element) & {
742
+ /** Table header: {@link TableHeaderProps} */
743
+ Header: typeof TableHeader_2;
744
+ /** Table column: {@link TableColumnProps} */
745
+ Column: typeof TableColumn;
746
+ /** Table body: {@link TableBodyProps} */
747
+ Body: typeof TableBody_2;
748
+ /** Table row: {@link TableRowProps} */
749
+ Row: typeof TableRow;
750
+ /** Table cell: {@link TableCellProps} */
751
+ Cell: typeof TableCell;
752
+ };
718
753
 
719
754
  export declare const TableBody: <T = object>(props: ProtonTableBodyProps<T>) => JSX.Element;
720
755
 
756
+ declare function TableBody_2({ children }: TableBodyProps): any;
757
+
758
+ export declare interface TableBodyProps {
759
+ children: ReactNode;
760
+ }
761
+
762
+ declare function TableCell({ columnKey, children }: TableCellProps): any;
763
+
764
+ export declare interface TableCellProps {
765
+ columnKey?: string;
766
+ children: ReactNode;
767
+ }
768
+
769
+ declare function TableColumn({ id, children }: TableColumnProps): any;
770
+
771
+ export declare interface TableColumnProps {
772
+ id: string;
773
+ children: ReactNode;
774
+ }
775
+
721
776
  export { TableHeader }
722
777
 
723
- declare interface TableProps extends AriaTableProps, TableStateProps<object> {
778
+ declare function TableHeader_2({ children }: TableHeaderProps): any;
779
+
780
+ export declare interface TableHeaderProps {
781
+ children: ReactNode;
782
+ }
783
+
784
+ declare interface TableProps {
785
+ children: default_2.ReactNode;
786
+ name?: string;
787
+ className?: string;
788
+ }
789
+
790
+ declare interface TableProps_2 extends AriaTableProps, TableStateProps<object> {
724
791
  headerProps?: {
725
792
  isHidden?: boolean;
726
793
  };
727
794
  }
728
795
 
796
+ declare function TableRow({ key, children }: TableRowProps): any;
797
+
798
+ export declare interface TableRowProps {
799
+ key?: string;
800
+ children: ReactNode;
801
+ }
802
+
729
803
  /**
730
804
  * A component that displays text with an ellipsis when it overflows its container.
731
805
  * @interface TextEllipsisProps
@@ -819,6 +893,7 @@ declare interface ThemeVariables {
819
893
  "--proton-control__shadow-color": string;
820
894
  "--proton-color__primary": string;
821
895
  "--proton-color__primary-light": string;
896
+ "--proton-color__primary-super-light": string;
822
897
  "--proton-color__secondary": string;
823
898
  "--proton-control__primary-super-dark": string;
824
899
  "--proton-control__primary-dark": string;
@@ -897,11 +972,10 @@ export declare interface TooltipTriggerProps extends TooltipProps, TooltipTrigge
897
972
  * @returns {JSX.Element} - The MenuTrigger component.
898
973
  */
899
974
  declare interface TriggerProps {
900
- isDisabled?: boolean;
901
- "data-testid"?: string;
902
- ref?: React.RefObject<HTMLButtonElement>;
903
- onPress?: () => void;
904
- "aria-label": string;
975
+ disabled?: boolean;
976
+ isOpen?: boolean;
977
+ setIsOpen?: (isOpen: boolean) => void;
978
+ triggerRef: React.RefObject<HTMLButtonElement>;
905
979
  }
906
980
 
907
981
  /**