@protonradio/proton-ui 0.10.13-beta.5 → 0.10.13

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,11 +1,14 @@
1
1
  import { AriaDialogProps } from 'react-aria';
2
2
  import { AriaPopoverProps } from 'react-aria';
3
3
  import { AriaTableProps } from 'react-aria';
4
+ import { CollectionChildren } from '@react-types/shared';
4
5
  import { ColumnProps } from '@react-stately/table';
5
6
  import { default as default_2 } from 'react';
6
7
  import { DOMProps } from '@react-types/shared';
7
8
  import { ForwardRefExoticComponent } from 'react';
9
+ import { ItemProps } from 'react-stately';
8
10
  import { JSX as JSX_2 } from 'react/jsx-runtime';
11
+ import { JSX as JSX_3 } from 'react';
9
12
  import { OverlayTriggerProps } from 'react-stately';
10
13
  import { OverlayTriggerState } from 'react-stately';
11
14
  import { PressEvent } from 'react-aria';
@@ -182,7 +185,7 @@ declare interface BaseInputProps {
182
185
  name: string;
183
186
  /**
184
187
  * The placeholder text to display when the input is empty.
185
- * @note label takes precedence over placeholder, if both are provided.
188
+ * @note Placeholder takes precedence over label, if both are provided.
186
189
  * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder
187
190
  */
188
191
  placeholder?: string;
@@ -332,7 +335,7 @@ declare interface DialogProps extends AriaDialogProps {
332
335
  *
333
336
  * @interface ElevationProps
334
337
  */
335
- export declare const Elevation: ({ children, hasPrimaryGradient, "data-testid": dataTestId, }: ElevationProps) => JSX_2.Element;
338
+ export declare const Elevation: ({ children, hasPrimaryGradient, backgroundGradientDirection, "data-testid": dataTestId, }: ElevationProps) => JSX_2.Element;
336
339
 
337
340
  declare interface ElevationProps {
338
341
  /**
@@ -345,6 +348,10 @@ declare interface ElevationProps {
345
348
  * @default false
346
349
  */
347
350
  hasPrimaryGradient?: boolean;
351
+ /**
352
+ * The direction of the background gradient.
353
+ */
354
+ backgroundGradientDirection?: "left" | "right";
348
355
  /**
349
356
  * The data-testid attribute for testing purposes.
350
357
  */
@@ -564,6 +571,18 @@ declare interface ResponsiveMenuProps {
564
571
 
565
572
  export declare function ResponsiveMenuTrigger({ renderTrigger, menuId, size, actions, disabled, onClose, testId: triggerTestId, menuTestId, }: ResponsiveMenuProps): JSX_2.Element;
566
573
 
574
+ export declare const ResponsiveSelect: {
575
+ Menu: typeof ResponsiveSelectMenu;
576
+ Option: <T>(props: ItemProps<T>) => JSX_3.Element;
577
+ };
578
+
579
+ /**
580
+ * A dropdown select menu that opens a Popover, or an ActionMenu on mobile.
581
+ * Supports controlled and uncontrolled modes.
582
+ * @interface SelectProps
583
+ */
584
+ declare function ResponsiveSelectMenu<T extends object>({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, onOpen, onClose, items, "data-testid": testId, children, }: SelectProps<T>): JSX_2.Element;
585
+
567
586
  export declare const Row: <T = object>(props: ProtonRowProps<T>) => JSX.Element;
568
587
 
569
588
  /**
@@ -613,23 +632,19 @@ export { Section }
613
632
 
614
633
  export declare const Select: {
615
634
  Menu: typeof SelectMenu;
635
+ Option: <T>(props: ItemProps<T>) => JSX_3.Element;
616
636
  };
617
637
 
618
- declare interface SelectItem {
619
- key: string;
620
- label: string;
621
- to?: string;
622
- onAction?: (key: string) => void;
623
- }
624
-
625
638
  /**
626
- * A dropdown select menu that opens a popover on desktop and an action menu on mobile.
627
- * Supports controlled and uncontrolled modes.
639
+ * A dropdown select menu that opens a popover. Supports controlled and uncontrolled modes.
640
+ * @interface SelectProps
628
641
  */
629
- declare function SelectMenu({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, onOpen, onClose, items, "data-testid": testId, }: SelectProps): JSX_2.Element;
642
+ declare function SelectMenu<T extends object>({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, onOpen, onClose, items, "data-testid": testId, children, }: SelectProps<T>): JSX_2.Element;
630
643
 
631
- declare interface SelectProps {
632
- /** The name of the select field */
644
+ declare interface SelectProps<T> {
645
+ /** The name of the select field
646
+ * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
647
+ */
633
648
  name: string;
634
649
  /** Label to display above the select
635
650
  * @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#text
@@ -640,21 +655,23 @@ declare interface SelectProps {
640
655
  /** Array of keys that should be disabled
641
656
  * @example ["Thing 1", "Thing 2"]
642
657
  */
643
- disabledKeys?: string[];
658
+ disabledKeys?: (string | number)[];
644
659
  /** Currently selected key */
645
- selectedKey?: string;
660
+ selectedKey?: string | number;
646
661
  /** Callback fired when selection changes */
647
- onSelectionChange?: (key: string) => void;
662
+ onSelectionChange?: (key: string | number) => void;
648
663
  /** Callback fired when the menu opens */
649
664
  onOpen?: () => void;
650
665
  /** Callback fired when the menu closes */
651
666
  onClose?: () => void;
652
667
  /** Array of items to display
653
- * @example [{ key: "thing-1", label: "Thing 1" }, { key: "thing-2", label: "Thing 2" }]
668
+ * @example [{ name: "thing 1", label: "Thing 1" }, { name: "thing 2", label: "Thing 2" }]
654
669
  */
655
- items: SelectItem[];
670
+ items?: T[];
656
671
  /** Test ID for the select */
657
672
  "data-testid"?: string;
673
+ /** Children elements or render function */
674
+ children: CollectionChildren<T>;
658
675
  }
659
676
 
660
677
  export declare function Switch(props: SwitchProps): JSX_2.Element;