@protonradio/proton-ui 0.11.0-beta.0 → 0.11.0-beta.10

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';
@@ -9,12 +10,12 @@ 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 { PressProps } from 'react-aria';
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 { Selection as Selection_3 } from 'react-aria-components';
18
19
  import { TableBodyProps } from '@react-stately/table';
19
20
  import { TableHeader } from '@react-stately/table';
20
21
  import { TableStateProps } from 'react-stately';
@@ -26,11 +27,12 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
26
27
  * Renders a list of actions as a focusable menu, or non-focusable children.
27
28
  * @interface ActionMenuProps
28
29
  */
29
- export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
30
+ export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, defaultSelectedKeys, disabledKeys, children, showCancel, cancelButtonText, actions, title, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
30
31
 
31
32
  declare interface ActionMenuAction {
32
33
  key: string;
33
34
  label?: ReactNode;
35
+ description?: ReactNode;
34
36
  to?: string;
35
37
  onAction?: (key: string) => void;
36
38
  children?: ActionMenuAction[];
@@ -47,6 +49,7 @@ declare interface ActionMenuProps {
47
49
  }) => ReactNode);
48
50
  showCancel?: boolean;
49
51
  cancelButtonText?: string;
52
+ title?: string;
50
53
  actions?: ActionMenuAction[];
51
54
  id?: string;
52
55
  onClose?: () => void;
@@ -205,7 +208,7 @@ declare interface BaseInputProps {
205
208
  * A customizable button component that can render as either a button or anchor element
206
209
  * @interface ButtonProps
207
210
  */
208
- export declare function Button({ variant, size, fullWidth, icon, to, target, onPress, type, isDisabled, "data-testid": testId, children, __textShift, }: ButtonProps): JSX_2.Element;
211
+ export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
209
212
 
210
213
  export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
211
214
 
@@ -245,7 +248,7 @@ declare interface ButtonGroupProps {
245
248
  children?: React.ReactNode;
246
249
  }
247
250
 
248
- declare interface ButtonProps {
251
+ declare interface ButtonProps extends AriaButtonProps<"button"> {
249
252
  /** The button's visual aesthetic
250
253
  * @param {ButtonVariant} variant
251
254
  */
@@ -274,7 +277,7 @@ declare interface ButtonProps {
274
277
  /** The target attribute for the link. Defaults to `_blank` if the URL is external.
275
278
  * @param {string} target
276
279
  */
277
- target?: "_blank" | "_self" | "_parent" | "_top";
280
+ target?: "_blank" | "_self" | "_parent" | "_top" | string;
278
281
  /** Called when the button is pressed (on release, not keydown)
279
282
  * @param {(e: PressEvent) => void} onPress
280
283
  */
@@ -291,7 +294,7 @@ declare interface ButtonProps {
291
294
  * @param {React.ReactNode} children
292
295
  */
293
296
  children?: React.ReactNode;
294
- /** DO NOT USE. INTERNAL USE ONLY. The manual shift of the button text.
297
+ /** 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
298
  * @param {number} __textShift
296
299
  */
297
300
  __textShift?: number;
@@ -301,7 +304,7 @@ declare type ButtonSize = "small" | "medium" | "large" | "xlarge" | "2xlarge";
301
304
 
302
305
  export declare type ButtonVariant = "primary" | "secondary" | "success" | "danger" | "translucent";
303
306
 
304
- export declare function ButtonWithSelect({ items, defaultValue, children, onSelectionChange, disabledKeys, selectedKey, icon, variant, fullWidth, ...buttonProps }: ButtonWithSelectProps): JSX_2.Element;
307
+ export declare function ButtonWithSelect({ items, defaultValue, children, onSelectionChange, disabledKeys, selectedKey, icon, variant, fullWidth, onPress, ...buttonProps }: ButtonWithSelectProps): JSX_2.Element;
305
308
 
306
309
  declare type ButtonWithSelectProps = {
307
310
  items: MenuItemType[];
@@ -429,9 +432,11 @@ declare interface MenuProps {
429
432
  /** The id of the menu */
430
433
  menuId?: string;
431
434
  /** Custom trigger component. If not provided, defaults to ellipsis icon */
432
- renderTrigger?: (triggerProps: TriggerProps, isOpen: boolean) => ReactNode;
435
+ renderTrigger?: (triggerProps: TriggerProps) => ReactNode;
433
436
  /** Size of the trigger icon */
434
437
  size?: number;
438
+ /** Title of the parent menu */
439
+ title?: string;
435
440
  /** Array of menu actions/items to display */
436
441
  items: MenuItemType[];
437
442
  /** Whether the menu is disabled */
@@ -443,14 +448,14 @@ declare interface MenuProps {
443
448
  /** Test ID for the menu */
444
449
  menuTestId?: string;
445
450
  /** Callback when a menu item is selected */
446
- onSelectionChange?: (keys: Selection_3) => void;
451
+ onSelectionChange?: (key: string) => void;
447
452
  /** The key of the selected item */
448
453
  selectedKey?: string;
449
454
  /** The keys of the disabled items */
450
455
  disabledKeys?: string[];
451
456
  }
452
457
 
453
- export declare function MenuTrigger({ renderTrigger, menuId, size, items, disabled, onClose, testId: triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
458
+ export declare function MenuTrigger({ renderTrigger, menuId, size, title, items, disabled, onClose, testId: triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
454
459
 
455
460
  export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, "data-testid": dataTestId, }: ModalProps) => JSX_2.Element) & {
456
461
  Title: ({ children }: {
@@ -897,11 +902,13 @@ export declare interface TooltipTriggerProps extends TooltipProps, TooltipTrigge
897
902
  * @returns {JSX.Element} - The MenuTrigger component.
898
903
  */
899
904
  declare interface TriggerProps {
900
- "data-testid"?: string;
901
905
  disabled?: boolean;
902
- ref?: React.RefObject<HTMLButtonElement>;
903
- onPress?: () => void;
904
- "aria-label": string;
906
+ /** Props for handling press interactions on the trigger element */
907
+ domTriggerProps: PressProps;
908
+ /** Props for handling menu trigger interactions */
909
+ ariaTriggerProps: AriaButtonProps<"button">;
910
+ isOpen?: boolean;
911
+ triggerRef: React.RefObject<HTMLButtonElement>;
905
912
  }
906
913
 
907
914
  /**