@protonradio/proton-ui 0.10.2 → 0.10.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/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import { CollectionChildren } from '@react-types/shared';
5
5
  import { ColumnProps } from '@react-stately/table';
6
6
  import { default as default_2 } from 'react';
7
7
  import { DOMProps } from '@react-types/shared';
8
+ import { ForwardRefExoticComponent } from 'react';
8
9
  import { ItemProps } from 'react-stately';
9
10
  import { JSX as JSX_2 } from 'react/jsx-runtime';
10
11
  import { JSX as JSX_3 } from 'react';
@@ -12,6 +13,7 @@ import { OverlayTriggerProps } from 'react-stately';
12
13
  import { OverlayTriggerState } from 'react-stately';
13
14
  import { PressEvent } from 'react-aria';
14
15
  import { ReactNode } from 'react';
16
+ import { RefAttributes } from 'react';
15
17
  import { RowProps } from '@react-stately/table';
16
18
  import { Section } from '@react-stately/table';
17
19
  import { Selection as Selection_2 } from 'react-stately';
@@ -26,7 +28,7 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
26
28
  * Renders a list of actions as a focusable menu, or non-focusable children.
27
29
  * @interface ActionMenuProps
28
30
  */
29
- export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, disabledKeys, children, showCancel, actions, closeOnNavigation, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
31
+ export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, disabledKeys, children, beforeActions, afterActions, showCancel, cancelButtonText, actions, closeOnNavigation, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
30
32
 
31
33
  declare interface ActionMenuAction {
32
34
  key: string;
@@ -43,7 +45,14 @@ declare interface ActionMenuProps {
43
45
  children?: ReactNode | ((props: {
44
46
  close: () => void;
45
47
  }) => ReactNode);
48
+ beforeActions?: ReactNode | ((props: {
49
+ close: () => void;
50
+ }) => ReactNode);
51
+ afterActions?: ReactNode | ((props: {
52
+ close: () => void;
53
+ }) => ReactNode);
46
54
  showCancel?: boolean;
55
+ cancelButtonText?: string;
47
56
  closeOnNavigation?: boolean;
48
57
  actions?: ActionMenuAction[];
49
58
  id?: string;
@@ -284,6 +293,23 @@ export declare const Cell: <T>(props: ProtonColumnProps<T>) => JSX.Element;
284
293
 
285
294
  export declare const Column: <T>(props: ProtonColumnProps<T>) => JSX.Element;
286
295
 
296
+ /**
297
+ * Input with a button to copy value to the clipboard.
298
+ * @interface CopyInputProps
299
+ */
300
+ export declare function CopyInput({ name, value, onError, onSuccess }: CopyInputProps): JSX_2.Element;
301
+
302
+ declare interface CopyInputProps {
303
+ /** The name of the input field */
304
+ name: string;
305
+ /** The value to display in the input and copy to clipboard */
306
+ value: string;
307
+ /** Optional callback when copy fails, receives the error object */
308
+ onError?: (error: Error) => void;
309
+ /** Optional callback when copy succeeds */
310
+ onSuccess?: () => void;
311
+ }
312
+
287
313
  /**
288
314
  * Intended use in overlay containers such as modals or popovers.
289
315
  */
@@ -294,6 +320,36 @@ declare interface DialogProps extends AriaDialogProps {
294
320
  children: React.ReactNode;
295
321
  }
296
322
 
323
+ /**
324
+ * Elevation component creates a visual elevation effect using the theme-aware background color.
325
+ *
326
+ * This component is designed to be used as a visual layer that sits on top of other content
327
+ * to create a sense of depth or hierarchy in the UI. It uses the `--proton-control__background-color-light`
328
+ * CSS variable which is theme-aware and will adapt to light, dark, and custom-dark themes.
329
+ *
330
+ * @interface ElevationProps
331
+ */
332
+ export declare const Elevation: ({ children, backgroundGradient, backgroundGradientDirection, "data-testid": dataTestId, }: ElevationProps) => JSX_2.Element;
333
+
334
+ declare interface ElevationProps {
335
+ /**
336
+ * The content to be displayed within the elevation.
337
+ */
338
+ children?: ReactNode;
339
+ /**
340
+ * Whether the elevation should have a background gradient.
341
+ */
342
+ backgroundGradient?: boolean;
343
+ /**
344
+ * The direction of the background gradient.
345
+ */
346
+ backgroundGradientDirection?: "left" | "right";
347
+ /**
348
+ * The data-testid attribute for testing purposes.
349
+ */
350
+ "data-testid"?: string;
351
+ }
352
+
297
353
  export declare function Icon(props: Omit<IconProps, "svgContent">): JSX_2.Element;
298
354
 
299
355
  declare type IconID = "external-link" | "caret-down";
@@ -344,12 +400,51 @@ declare interface ImageBackgroundProps {
344
400
  */
345
401
  export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps & default_2.RefAttributes<HTMLInputElement>>;
346
402
 
347
- export declare const Modal: ({ isOpen, onClose, title, children }: ModalProps) => JSX_2.Element;
403
+ export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, }: ModalProps) => JSX_2.Element) & {
404
+ Title: ({ children }: {
405
+ children: React.ReactNode;
406
+ }) => JSX_2.Element;
407
+ Subtitle: ({ children }: {
408
+ children: React.ReactNode;
409
+ }) => JSX_2.Element;
410
+ Body: ({ children }: {
411
+ children: React.ReactNode;
412
+ }) => JSX_2.Element;
413
+ Action: (props: ButtonProps) => JSX_2.Element;
414
+ Actions: ({ children }: {
415
+ children: React.ReactNode;
416
+ }) => JSX_2.Element;
417
+ };
348
418
 
349
419
  declare interface ModalProps {
420
+ /**
421
+ * Controls the visibility of the modal
422
+ * */
350
423
  isOpen: boolean;
351
- onClose: () => void;
424
+ /**
425
+ * Callback function when modal is closed
426
+ * */
427
+ onClose?: () => void;
428
+ /**
429
+ * Whether to show the modal with an overlay background.
430
+ * @default true
431
+ * */
432
+ isOverlay?: boolean;
433
+ /**
434
+ * Optional title text for the modal header
435
+ * */
352
436
  title?: string;
437
+ /**
438
+ * Optional subtitle text below the modal title
439
+ * */
440
+ subtitle?: string;
441
+ /**
442
+ * Optional body text content for the modal
443
+ * */
444
+ body?: string;
445
+ /**
446
+ * Content to render inside the modal
447
+ * */
353
448
  children: React.ReactNode;
354
449
  }
355
450
 
@@ -482,22 +577,21 @@ export declare const Row: <T = object>(props: ProtonRowProps<T>) => JSX.Element;
482
577
  * Base Overlay component for creating modal-like backgrounds.
483
578
  * @interface ScreenOverlayProps
484
579
  */
485
- export declare function ScreenOverlay({ fadeIn, fadeOut, onClose, children, }: ScreenOverlayProps): JSX_2.Element;
580
+ export declare const ScreenOverlay: ForwardRefExoticComponent<Omit<ScreenOverlayProps, "ref"> & RefAttributes<HTMLDivElement>>;
486
581
 
487
582
  declare interface ScreenOverlayProps {
488
583
  /**
489
584
  * Whether to fade in the overlay.
490
585
  */
491
586
  fadeIn?: boolean;
492
- /**
493
- * Whether to fade out the overlay.
494
- * @important Fade out triggers on click, you must provide an onClose prop to use this.
495
- */
496
- fadeOut?: boolean;
497
587
  /**
498
588
  * Callback function to handle events (click or ESC key).
499
589
  */
500
590
  onClose?: () => void;
591
+ /**
592
+ * Ref to the overlay element.
593
+ */
594
+ ref?: React.RefObject<HTMLDivElement>;
501
595
  /**
502
596
  * Children to render inside the overlay.
503
597
  */
@@ -697,6 +791,7 @@ declare const THEMES: {
697
791
 
698
792
  declare interface ThemeVariables {
699
793
  "--proton-control__background-color": string;
794
+ "--proton-control__background-color-light": string;
700
795
  "--proton-control__text-color": string;
701
796
  "--proton-control__border-color": string;
702
797
  "--proton-control__shadow-color": string;