@protonradio/proton-ui 0.10.16 → 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/constants.es.js +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.es.js +1 -1
- package/dist/index.cjs.js +15 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +78 -43
- package/dist/index.es.js +7950 -6570
- package/dist/index.es.js.map +1 -1
- package/dist/{palettes-BgYtmc18.mjs → palettes-mcF0lNKY.mjs} +3 -3
- package/dist/{palettes-BgYtmc18.mjs.map → palettes-mcF0lNKY.mjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{useBreakpoint-y9OWm50p.mjs → useBreakpoint-CjRyGKN-.mjs} +15 -15
- package/dist/useBreakpoint-CjRyGKN-.mjs.map +1 -0
- package/dist/useBreakpoint-DA-JqOu3.js +2 -0
- package/dist/useBreakpoint-DA-JqOu3.js.map +1 -0
- 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 +451 -10
- package/dist/utils.es.js.map +1 -1
- package/package.json +5 -4
- package/dist/useBreakpoint-Du8PkzTj.js +0 -2
- package/dist/useBreakpoint-Du8PkzTj.js.map +0 -1
- package/dist/useBreakpoint-y9OWm50p.mjs.map +0 -1
- package/dist/utils-BOQ-r-2W.js +0 -2
- package/dist/utils-BOQ-r-2W.js.map +0 -1
- package/dist/utils-BiD166LN.mjs +0 -451
- package/dist/utils-BiD166LN.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,6 +10,7 @@ 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';
|
|
@@ -25,25 +27,29 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
|
25
27
|
* Renders a list of actions as a focusable menu, or non-focusable children.
|
|
26
28
|
* @interface ActionMenuProps
|
|
27
29
|
*/
|
|
28
|
-
export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, 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;
|
|
29
31
|
|
|
30
32
|
declare interface ActionMenuAction {
|
|
31
33
|
key: string;
|
|
32
34
|
label?: ReactNode;
|
|
35
|
+
description?: ReactNode;
|
|
33
36
|
to?: string;
|
|
34
37
|
onAction?: (key: string) => void;
|
|
38
|
+
children?: ActionMenuAction[];
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
declare interface ActionMenuProps {
|
|
38
42
|
isOpen: boolean;
|
|
39
43
|
selectionMode?: "single" | "multiple" | "none";
|
|
40
44
|
selectedKeys?: string[];
|
|
45
|
+
defaultSelectedKeys?: string[];
|
|
41
46
|
disabledKeys?: string[];
|
|
42
47
|
children?: ReactNode | ((props: {
|
|
43
48
|
close: () => void;
|
|
44
49
|
}) => ReactNode);
|
|
45
50
|
showCancel?: boolean;
|
|
46
51
|
cancelButtonText?: string;
|
|
52
|
+
title?: string;
|
|
47
53
|
actions?: ActionMenuAction[];
|
|
48
54
|
id?: string;
|
|
49
55
|
onClose?: () => void;
|
|
@@ -202,7 +208,7 @@ declare interface BaseInputProps {
|
|
|
202
208
|
* A customizable button component that can render as either a button or anchor element
|
|
203
209
|
* @interface ButtonProps
|
|
204
210
|
*/
|
|
205
|
-
export declare
|
|
211
|
+
export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
206
212
|
|
|
207
213
|
export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
|
|
208
214
|
|
|
@@ -242,7 +248,7 @@ declare interface ButtonGroupProps {
|
|
|
242
248
|
children?: React.ReactNode;
|
|
243
249
|
}
|
|
244
250
|
|
|
245
|
-
declare interface ButtonProps {
|
|
251
|
+
declare interface ButtonProps extends AriaButtonProps<"button"> {
|
|
246
252
|
/** The button's visual aesthetic
|
|
247
253
|
* @param {ButtonVariant} variant
|
|
248
254
|
*/
|
|
@@ -252,6 +258,10 @@ declare interface ButtonProps {
|
|
|
252
258
|
* @default "fullWidth"
|
|
253
259
|
*/
|
|
254
260
|
size?: ButtonSize;
|
|
261
|
+
/** Should the button be full width?
|
|
262
|
+
* @param {boolean} fullWidth
|
|
263
|
+
*/
|
|
264
|
+
fullWidth?: boolean;
|
|
255
265
|
/** The prefix to display within the button
|
|
256
266
|
* @param {React.ReactNode} icon
|
|
257
267
|
*/
|
|
@@ -267,7 +277,7 @@ declare interface ButtonProps {
|
|
|
267
277
|
/** The target attribute for the link. Defaults to `_blank` if the URL is external.
|
|
268
278
|
* @param {string} target
|
|
269
279
|
*/
|
|
270
|
-
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
280
|
+
target?: "_blank" | "_self" | "_parent" | "_top" | string;
|
|
271
281
|
/** Called when the button is pressed (on release, not keydown)
|
|
272
282
|
* @param {(e: PressEvent) => void} onPress
|
|
273
283
|
*/
|
|
@@ -284,12 +294,27 @@ declare interface ButtonProps {
|
|
|
284
294
|
* @param {React.ReactNode} children
|
|
285
295
|
*/
|
|
286
296
|
children?: React.ReactNode;
|
|
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.
|
|
298
|
+
* @param {number} __textShift
|
|
299
|
+
*/
|
|
300
|
+
__textShift?: number;
|
|
287
301
|
}
|
|
288
302
|
|
|
289
|
-
declare type ButtonSize = "
|
|
303
|
+
declare type ButtonSize = "small" | "medium" | "large" | "xlarge" | "2xlarge";
|
|
290
304
|
|
|
291
305
|
export declare type ButtonVariant = "primary" | "secondary" | "success" | "danger" | "translucent";
|
|
292
306
|
|
|
307
|
+
export declare function ButtonWithSelect({ items, defaultValue, children, onSelectionChange, disabledKeys, selectedKey, icon, variant, fullWidth, onPress, ...buttonProps }: ButtonWithSelectProps): JSX_2.Element;
|
|
308
|
+
|
|
309
|
+
declare type ButtonWithSelectProps = {
|
|
310
|
+
items: MenuItemType[];
|
|
311
|
+
defaultValue?: string;
|
|
312
|
+
children: default_2.ReactNode;
|
|
313
|
+
onSelectionChange?: (key: string) => void;
|
|
314
|
+
selectedKey?: string;
|
|
315
|
+
disabledKeys?: string[];
|
|
316
|
+
} & ButtonProps;
|
|
317
|
+
|
|
293
318
|
export declare const Cell: <T>(props: ProtonColumnProps<T>) => JSX.Element;
|
|
294
319
|
|
|
295
320
|
export declare const Column: <T>(props: ProtonColumnProps<T>) => JSX.Element;
|
|
@@ -353,7 +378,7 @@ declare interface ElevationProps {
|
|
|
353
378
|
|
|
354
379
|
export declare function Icon(props: Omit<IconProps, "svgContent">): JSX_2.Element;
|
|
355
380
|
|
|
356
|
-
declare type IconID = "external-link" | "caret-down";
|
|
381
|
+
declare type IconID = "external-link" | "caret-down" | "caret-right" | "chevron-right" | "chevron-left" | "chevron-up" | "chevron-down";
|
|
357
382
|
|
|
358
383
|
declare interface IconProps {
|
|
359
384
|
/**
|
|
@@ -401,7 +426,36 @@ declare interface ImageBackgroundProps {
|
|
|
401
426
|
*/
|
|
402
427
|
export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
403
428
|
|
|
404
|
-
|
|
429
|
+
declare type MenuItemType = ActionMenuAction;
|
|
430
|
+
|
|
431
|
+
declare interface MenuProps {
|
|
432
|
+
/** The id of the menu */
|
|
433
|
+
menuId?: string;
|
|
434
|
+
/** Custom trigger component. If not provided, defaults to ellipsis icon */
|
|
435
|
+
renderTrigger?: (triggerProps: TriggerProps) => ReactNode;
|
|
436
|
+
/** Size of the trigger icon */
|
|
437
|
+
size?: number;
|
|
438
|
+
/** Title of the parent menu */
|
|
439
|
+
title?: string;
|
|
440
|
+
/** Array of menu actions/items to display */
|
|
441
|
+
items: MenuItemType[];
|
|
442
|
+
/** Whether the menu is disabled */
|
|
443
|
+
disabled?: boolean;
|
|
444
|
+
/** Callback when menu closes */
|
|
445
|
+
onClose?: () => void;
|
|
446
|
+
/** Test ID for the trigger component */
|
|
447
|
+
testId?: string;
|
|
448
|
+
/** Test ID for the menu */
|
|
449
|
+
menuTestId?: string;
|
|
450
|
+
/** Callback when a menu item is selected */
|
|
451
|
+
onSelectionChange?: (key: string) => void;
|
|
452
|
+
/** The key of the selected item */
|
|
453
|
+
selectedKey?: string;
|
|
454
|
+
/** The keys of the disabled items */
|
|
455
|
+
disabledKeys?: string[];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export declare function MenuTrigger({ renderTrigger, menuId, size, title, items, disabled, onClose, testId: triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
|
|
405
459
|
|
|
406
460
|
export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, "data-testid": dataTestId, }: ModalProps) => JSX_2.Element) & {
|
|
407
461
|
Title: ({ children }: {
|
|
@@ -545,25 +599,6 @@ export declare interface ProtonTableBodyProps<T = object> extends TableBodyProps
|
|
|
545
599
|
showLines?: boolean;
|
|
546
600
|
}
|
|
547
601
|
|
|
548
|
-
declare interface ResponsiveMenuProps {
|
|
549
|
-
/** The id of the menu */
|
|
550
|
-
menuId?: string;
|
|
551
|
-
/** Custom trigger component. If not provided, defaults to ellipsis icon */
|
|
552
|
-
renderTrigger?: (triggerProps: TriggerProps, isOpen: boolean) => ReactNode;
|
|
553
|
-
/** Size of the trigger icon */
|
|
554
|
-
size?: number;
|
|
555
|
-
/** Array of menu actions/items to display */
|
|
556
|
-
actions: ActionMenuAction[];
|
|
557
|
-
/** Whether the menu is disabled */
|
|
558
|
-
disabled?: boolean;
|
|
559
|
-
/** Callback when menu closes */
|
|
560
|
-
onClose?: () => void;
|
|
561
|
-
/** Test ID for the trigger component */
|
|
562
|
-
testId?: string;
|
|
563
|
-
/** Test ID for the menu */
|
|
564
|
-
menuTestId?: string;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
602
|
export declare const Row: <T = object>(props: ProtonRowProps<T>) => JSX.Element;
|
|
568
603
|
|
|
569
604
|
/**
|
|
@@ -611,22 +646,18 @@ declare interface SearchInputProps extends Omit<BaseInputProps, "prefix" | "suff
|
|
|
611
646
|
|
|
612
647
|
export { Section }
|
|
613
648
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
649
|
+
/**
|
|
650
|
+
* A dropdown select menu that opens a popover on desktop and an action menu on mobile.
|
|
651
|
+
* Supports controlled and uncontrolled modes.
|
|
652
|
+
*/
|
|
653
|
+
export declare function Select({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, defaultSelectedKey, onOpen, onClose, items, "data-testid": testId, }: SelectProps): JSX_2.Element;
|
|
617
654
|
|
|
618
655
|
declare interface SelectItem {
|
|
619
656
|
label: string;
|
|
620
|
-
|
|
657
|
+
key: string;
|
|
621
658
|
to?: string;
|
|
622
659
|
}
|
|
623
660
|
|
|
624
|
-
/**
|
|
625
|
-
* A dropdown select menu that opens a popover on desktop and an action menu on mobile.
|
|
626
|
-
* Supports controlled and uncontrolled modes.
|
|
627
|
-
*/
|
|
628
|
-
declare function SelectMenu({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, onOpen, onClose, items, "data-testid": testId, }: SelectProps): JSX_2.Element;
|
|
629
|
-
|
|
630
661
|
declare interface SelectProps {
|
|
631
662
|
/** The name of the select field */
|
|
632
663
|
name: string;
|
|
@@ -644,12 +675,14 @@ declare interface SelectProps {
|
|
|
644
675
|
selectedKey?: string;
|
|
645
676
|
/** Callback fired when selection changes */
|
|
646
677
|
onSelectionChange?: (key: string) => void;
|
|
678
|
+
/** The key of the default selected item */
|
|
679
|
+
defaultSelectedKey?: string;
|
|
647
680
|
/** Callback fired when the menu opens */
|
|
648
681
|
onOpen?: () => void;
|
|
649
682
|
/** Callback fired when the menu closes */
|
|
650
683
|
onClose?: () => void;
|
|
651
684
|
/** Array of items to display
|
|
652
|
-
* @example [{
|
|
685
|
+
* @example [{ key: "thing-1", label: "Thing 1" }, { key: "thing-2", label: "Thing 2" }]
|
|
653
686
|
*/
|
|
654
687
|
items: SelectItem[];
|
|
655
688
|
/** Test ID for the select */
|
|
@@ -865,15 +898,17 @@ export declare interface TooltipTriggerProps extends TooltipProps, TooltipTrigge
|
|
|
865
898
|
* A component that displays either a popover menu or an action menu
|
|
866
899
|
* depending on the screen size when the menu trigger is pressed.
|
|
867
900
|
*
|
|
868
|
-
* @param {
|
|
869
|
-
* @returns {JSX.Element} - The
|
|
901
|
+
* @param {MenuProps} props - The props for the MenuTrigger component.
|
|
902
|
+
* @returns {JSX.Element} - The MenuTrigger component.
|
|
870
903
|
*/
|
|
871
904
|
declare interface TriggerProps {
|
|
872
|
-
"data-testid"?: string;
|
|
873
905
|
disabled?: boolean;
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
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>;
|
|
877
912
|
}
|
|
878
913
|
|
|
879
914
|
/**
|