@protonradio/proton-ui 0.10.16 → 0.11.0-beta.0
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 +66 -38
- package/dist/index.es.js +7949 -6627
- 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 +4 -0
- package/dist/utils.es.js +450 -10
- package/dist/utils.es.js.map +1 -1
- package/package.json +4 -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
|
@@ -14,6 +14,7 @@ import { RefAttributes } from 'react';
|
|
|
14
14
|
import { RowProps } from '@react-stately/table';
|
|
15
15
|
import { Section } from '@react-stately/table';
|
|
16
16
|
import { Selection as Selection_2 } from 'react-stately';
|
|
17
|
+
import { Selection as Selection_3 } from 'react-aria-components';
|
|
17
18
|
import { TableBodyProps } from '@react-stately/table';
|
|
18
19
|
import { TableHeader } from '@react-stately/table';
|
|
19
20
|
import { TableStateProps } from 'react-stately';
|
|
@@ -25,19 +26,21 @@ import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
|
25
26
|
* Renders a list of actions as a focusable menu, or non-focusable children.
|
|
26
27
|
* @interface ActionMenuProps
|
|
27
28
|
*/
|
|
28
|
-
export declare const ActionMenu: ({ isOpen, selectionMode, selectedKeys, 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, onSelectionChange, onClose, "data-testid": testId, }: ActionMenuProps) => JSX_2.Element;
|
|
29
30
|
|
|
30
31
|
declare interface ActionMenuAction {
|
|
31
32
|
key: string;
|
|
32
33
|
label?: ReactNode;
|
|
33
34
|
to?: string;
|
|
34
35
|
onAction?: (key: string) => void;
|
|
36
|
+
children?: ActionMenuAction[];
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
declare interface ActionMenuProps {
|
|
38
40
|
isOpen: boolean;
|
|
39
41
|
selectionMode?: "single" | "multiple" | "none";
|
|
40
42
|
selectedKeys?: string[];
|
|
43
|
+
defaultSelectedKeys?: string[];
|
|
41
44
|
disabledKeys?: string[];
|
|
42
45
|
children?: ReactNode | ((props: {
|
|
43
46
|
close: () => void;
|
|
@@ -202,7 +205,7 @@ declare interface BaseInputProps {
|
|
|
202
205
|
* A customizable button component that can render as either a button or anchor element
|
|
203
206
|
* @interface ButtonProps
|
|
204
207
|
*/
|
|
205
|
-
export declare function Button({ variant, size, icon, to, target, onPress, type, isDisabled, "data-testid": testId, children, }: ButtonProps): JSX_2.Element;
|
|
208
|
+
export declare function Button({ variant, size, fullWidth, icon, to, target, onPress, type, isDisabled, "data-testid": testId, children, __textShift, }: ButtonProps): JSX_2.Element;
|
|
206
209
|
|
|
207
210
|
export declare function ButtonGroup(props: ButtonGroupProps): JSX_2.Element;
|
|
208
211
|
|
|
@@ -252,6 +255,10 @@ declare interface ButtonProps {
|
|
|
252
255
|
* @default "fullWidth"
|
|
253
256
|
*/
|
|
254
257
|
size?: ButtonSize;
|
|
258
|
+
/** Should the button be full width?
|
|
259
|
+
* @param {boolean} fullWidth
|
|
260
|
+
*/
|
|
261
|
+
fullWidth?: boolean;
|
|
255
262
|
/** The prefix to display within the button
|
|
256
263
|
* @param {React.ReactNode} icon
|
|
257
264
|
*/
|
|
@@ -284,12 +291,27 @@ declare interface ButtonProps {
|
|
|
284
291
|
* @param {React.ReactNode} children
|
|
285
292
|
*/
|
|
286
293
|
children?: React.ReactNode;
|
|
294
|
+
/** DO NOT USE. INTERNAL USE ONLY. The manual shift of the button text.
|
|
295
|
+
* @param {number} __textShift
|
|
296
|
+
*/
|
|
297
|
+
__textShift?: number;
|
|
287
298
|
}
|
|
288
299
|
|
|
289
|
-
declare type ButtonSize = "
|
|
300
|
+
declare type ButtonSize = "small" | "medium" | "large" | "xlarge" | "2xlarge";
|
|
290
301
|
|
|
291
302
|
export declare type ButtonVariant = "primary" | "secondary" | "success" | "danger" | "translucent";
|
|
292
303
|
|
|
304
|
+
export declare function ButtonWithSelect({ items, defaultValue, children, onSelectionChange, disabledKeys, selectedKey, icon, variant, fullWidth, ...buttonProps }: ButtonWithSelectProps): JSX_2.Element;
|
|
305
|
+
|
|
306
|
+
declare type ButtonWithSelectProps = {
|
|
307
|
+
items: MenuItemType[];
|
|
308
|
+
defaultValue?: string;
|
|
309
|
+
children: default_2.ReactNode;
|
|
310
|
+
onSelectionChange?: (key: string) => void;
|
|
311
|
+
selectedKey?: string;
|
|
312
|
+
disabledKeys?: string[];
|
|
313
|
+
} & ButtonProps;
|
|
314
|
+
|
|
293
315
|
export declare const Cell: <T>(props: ProtonColumnProps<T>) => JSX.Element;
|
|
294
316
|
|
|
295
317
|
export declare const Column: <T>(props: ProtonColumnProps<T>) => JSX.Element;
|
|
@@ -353,7 +375,7 @@ declare interface ElevationProps {
|
|
|
353
375
|
|
|
354
376
|
export declare function Icon(props: Omit<IconProps, "svgContent">): JSX_2.Element;
|
|
355
377
|
|
|
356
|
-
declare type IconID = "external-link" | "caret-down";
|
|
378
|
+
declare type IconID = "external-link" | "caret-down" | "caret-right" | "chevron-right" | "chevron-left" | "chevron-up" | "chevron-down";
|
|
357
379
|
|
|
358
380
|
declare interface IconProps {
|
|
359
381
|
/**
|
|
@@ -401,7 +423,34 @@ declare interface ImageBackgroundProps {
|
|
|
401
423
|
*/
|
|
402
424
|
export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
403
425
|
|
|
404
|
-
|
|
426
|
+
declare type MenuItemType = ActionMenuAction;
|
|
427
|
+
|
|
428
|
+
declare interface MenuProps {
|
|
429
|
+
/** The id of the menu */
|
|
430
|
+
menuId?: string;
|
|
431
|
+
/** Custom trigger component. If not provided, defaults to ellipsis icon */
|
|
432
|
+
renderTrigger?: (triggerProps: TriggerProps, isOpen: boolean) => ReactNode;
|
|
433
|
+
/** Size of the trigger icon */
|
|
434
|
+
size?: number;
|
|
435
|
+
/** Array of menu actions/items to display */
|
|
436
|
+
items: MenuItemType[];
|
|
437
|
+
/** Whether the menu is disabled */
|
|
438
|
+
disabled?: boolean;
|
|
439
|
+
/** Callback when menu closes */
|
|
440
|
+
onClose?: () => void;
|
|
441
|
+
/** Test ID for the trigger component */
|
|
442
|
+
testId?: string;
|
|
443
|
+
/** Test ID for the menu */
|
|
444
|
+
menuTestId?: string;
|
|
445
|
+
/** Callback when a menu item is selected */
|
|
446
|
+
onSelectionChange?: (keys: Selection_3) => void;
|
|
447
|
+
/** The key of the selected item */
|
|
448
|
+
selectedKey?: string;
|
|
449
|
+
/** The keys of the disabled items */
|
|
450
|
+
disabledKeys?: string[];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export declare function MenuTrigger({ renderTrigger, menuId, size, items, disabled, onClose, testId: triggerTestId, menuTestId, onSelectionChange, selectedKey, disabledKeys, }: MenuProps): JSX_2.Element;
|
|
405
454
|
|
|
406
455
|
export declare const Modal: (({ isOpen, onClose, title, subtitle, body, children, isOverlay, "data-testid": dataTestId, }: ModalProps) => JSX_2.Element) & {
|
|
407
456
|
Title: ({ children }: {
|
|
@@ -545,25 +594,6 @@ export declare interface ProtonTableBodyProps<T = object> extends TableBodyProps
|
|
|
545
594
|
showLines?: boolean;
|
|
546
595
|
}
|
|
547
596
|
|
|
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
597
|
export declare const Row: <T = object>(props: ProtonRowProps<T>) => JSX.Element;
|
|
568
598
|
|
|
569
599
|
/**
|
|
@@ -611,22 +641,18 @@ declare interface SearchInputProps extends Omit<BaseInputProps, "prefix" | "suff
|
|
|
611
641
|
|
|
612
642
|
export { Section }
|
|
613
643
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
644
|
+
/**
|
|
645
|
+
* A dropdown select menu that opens a popover on desktop and an action menu on mobile.
|
|
646
|
+
* Supports controlled and uncontrolled modes.
|
|
647
|
+
*/
|
|
648
|
+
export declare function Select({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, defaultSelectedKey, onOpen, onClose, items, "data-testid": testId, }: SelectProps): JSX_2.Element;
|
|
617
649
|
|
|
618
650
|
declare interface SelectItem {
|
|
619
651
|
label: string;
|
|
620
|
-
|
|
652
|
+
key: string;
|
|
621
653
|
to?: string;
|
|
622
654
|
}
|
|
623
655
|
|
|
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
656
|
declare interface SelectProps {
|
|
631
657
|
/** The name of the select field */
|
|
632
658
|
name: string;
|
|
@@ -644,12 +670,14 @@ declare interface SelectProps {
|
|
|
644
670
|
selectedKey?: string;
|
|
645
671
|
/** Callback fired when selection changes */
|
|
646
672
|
onSelectionChange?: (key: string) => void;
|
|
673
|
+
/** The key of the default selected item */
|
|
674
|
+
defaultSelectedKey?: string;
|
|
647
675
|
/** Callback fired when the menu opens */
|
|
648
676
|
onOpen?: () => void;
|
|
649
677
|
/** Callback fired when the menu closes */
|
|
650
678
|
onClose?: () => void;
|
|
651
679
|
/** Array of items to display
|
|
652
|
-
* @example [{
|
|
680
|
+
* @example [{ key: "thing-1", label: "Thing 1" }, { key: "thing-2", label: "Thing 2" }]
|
|
653
681
|
*/
|
|
654
682
|
items: SelectItem[];
|
|
655
683
|
/** Test ID for the select */
|
|
@@ -865,14 +893,14 @@ export declare interface TooltipTriggerProps extends TooltipProps, TooltipTrigge
|
|
|
865
893
|
* A component that displays either a popover menu or an action menu
|
|
866
894
|
* depending on the screen size when the menu trigger is pressed.
|
|
867
895
|
*
|
|
868
|
-
* @param {
|
|
869
|
-
* @returns {JSX.Element} - The
|
|
896
|
+
* @param {MenuProps} props - The props for the MenuTrigger component.
|
|
897
|
+
* @returns {JSX.Element} - The MenuTrigger component.
|
|
870
898
|
*/
|
|
871
899
|
declare interface TriggerProps {
|
|
872
900
|
"data-testid"?: string;
|
|
873
901
|
disabled?: boolean;
|
|
874
902
|
ref?: React.RefObject<HTMLButtonElement>;
|
|
875
|
-
|
|
903
|
+
onPress?: () => void;
|
|
876
904
|
"aria-label": string;
|
|
877
905
|
}
|
|
878
906
|
|