@protonradio/proton-ui 0.6.6 → 0.6.8
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/README.md +73 -50
- package/dist/constants.cjs.js +1 -1
- package/dist/constants.d.ts +12 -0
- package/dist/constants.es.js +5 -4
- package/dist/icons.svg +10 -10
- package/dist/{index-BQ3T2g7K.mjs → index-BCAZu2vD.mjs} +17 -11
- package/dist/index-BCAZu2vD.mjs.map +1 -0
- package/dist/index-Dcfu6hWE.js +2 -0
- package/dist/index-Dcfu6hWE.js.map +1 -0
- package/dist/index.cjs.js +11 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +119 -51
- package/dist/index.es.js +5143 -4248
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils.cjs.js.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.es.js.map +1 -1
- package/package.json +90 -89
- package/dist/index-BQ3T2g7K.mjs.map +0 -1
- package/dist/index-BjFfiHOL.js +0 -2
- package/dist/index-BjFfiHOL.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,10 +20,18 @@ import { TableStateProps } from 'react-stately';
|
|
|
20
20
|
import { TooltipProps as TooltipProps_2 } from 'react-aria-components';
|
|
21
21
|
import { TooltipTriggerComponentProps } from 'react-aria-components';
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* [ActionMenu] - React hooks-based ActionMenu that renders into a Portal layer.
|
|
25
|
+
* @interface ActionMenuProps
|
|
26
|
+
* @interface ActionMenuToggleState
|
|
27
|
+
*/
|
|
23
28
|
export declare function ActionMenu({ children, closeOnNavigation, isDisabled, showCancel, isOpen, close, "data-testId": testId, }: ActionMenuProps): JSX_2.Element;
|
|
24
29
|
|
|
25
30
|
export declare namespace ActionMenu {
|
|
26
31
|
var Item: ({ name, to }: ActionMenuItemProps) => JSX_2.Element;
|
|
32
|
+
var List: ({ children }: {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}) => JSX_2.Element;
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
declare interface ActionMenuItemProps {
|
|
@@ -31,47 +39,25 @@ declare interface ActionMenuItemProps {
|
|
|
31
39
|
to?: string;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
/**
|
|
35
|
-
* @interface ActionMenuProps
|
|
36
|
-
* @description Props interface for the ActionMenu component
|
|
37
|
-
*/
|
|
38
42
|
declare interface ActionMenuProps extends ActionMenuToggleState {
|
|
39
|
-
/**
|
|
40
|
-
* @param {ReactNode | function} children - Content to be rendered inside the menu, can be components or render function
|
|
41
|
-
*/
|
|
43
|
+
/** Content to be rendered inside the menu, can be components or render function */
|
|
42
44
|
children?: ReactNode | ((props: {
|
|
43
45
|
close: () => void;
|
|
44
46
|
}) => ReactNode);
|
|
45
|
-
/**
|
|
46
|
-
* @param {boolean} isDisabled - Prevents the menu from closing
|
|
47
|
-
*/
|
|
47
|
+
/** Prevents the menu from closing */
|
|
48
48
|
isDisabled?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* @param {boolean} showCancel - Shows the cancel button
|
|
51
|
-
*/
|
|
49
|
+
/** Shows the cancel button */
|
|
52
50
|
showCancel?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* @param {string} data-testId - Test ID for the menu container
|
|
55
|
-
*/
|
|
51
|
+
/** Test ID for the menu container */
|
|
56
52
|
"data-testId"?: string;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
|
-
/**
|
|
60
|
-
* @interface ActionMenuToggleState
|
|
61
|
-
* @description State interface for controlling the ActionMenu's open/close behavior
|
|
62
|
-
*/
|
|
63
55
|
declare interface ActionMenuToggleState {
|
|
64
|
-
/**
|
|
65
|
-
* @param {boolean} isOpen - Controls whether the menu is displayed
|
|
66
|
-
*/
|
|
56
|
+
/** Controls whether the menu is displayed */
|
|
67
57
|
isOpen: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* @param {() => void} close - Closes the menu
|
|
70
|
-
*/
|
|
58
|
+
/** Closes the menu */
|
|
71
59
|
close: () => void;
|
|
72
|
-
/**
|
|
73
|
-
* @param {boolean} closeOnNavigation - Automatically closes when route changes
|
|
74
|
-
*/
|
|
60
|
+
/** Automatically closes when route changes */
|
|
75
61
|
closeOnNavigation?: boolean;
|
|
76
62
|
}
|
|
77
63
|
|
|
@@ -160,6 +146,66 @@ declare interface BannerProps extends BannerIconProps, default_2.HTMLAttributes<
|
|
|
160
146
|
|
|
161
147
|
export declare type BannerVariant = "default" | "success" | "warning" | "danger";
|
|
162
148
|
|
|
149
|
+
declare interface BaseInputProps {
|
|
150
|
+
/**
|
|
151
|
+
* onChange handler for the input
|
|
152
|
+
*/
|
|
153
|
+
onChange?: (value: string) => void;
|
|
154
|
+
/** Whether the input is disabled. */
|
|
155
|
+
isDisabled?: boolean;
|
|
156
|
+
/** Description text shown above the input. */
|
|
157
|
+
description?: default_2.ReactNode | string;
|
|
158
|
+
/**
|
|
159
|
+
* The position of the description text.
|
|
160
|
+
* @default "top"
|
|
161
|
+
*/
|
|
162
|
+
descriptionPosition?: "top" | "bottom";
|
|
163
|
+
/** Error state that changes the input's visual style and displays an error message. */
|
|
164
|
+
error?: default_2.ReactNode | string;
|
|
165
|
+
/**
|
|
166
|
+
* Label for the input element.
|
|
167
|
+
* @note When a label is provided, the input will have extra padding, and the label will float above the text input when focused or filled.
|
|
168
|
+
*/
|
|
169
|
+
label?: string;
|
|
170
|
+
/** Test ID for the component. */
|
|
171
|
+
"data-testid"?: string;
|
|
172
|
+
/** Content to display before the input. Typically used for icons. */
|
|
173
|
+
prefix?: default_2.ReactNode;
|
|
174
|
+
/** Content to display after the input. Typically used for icons. */
|
|
175
|
+
suffix?: default_2.ReactNode;
|
|
176
|
+
/**
|
|
177
|
+
* Should the browser's autocomplete be enabled?
|
|
178
|
+
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
179
|
+
*/
|
|
180
|
+
autoComplete?: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Should the input be autofocused?
|
|
183
|
+
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autofocus
|
|
184
|
+
*/
|
|
185
|
+
autoFocus?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* The name attribute of the input element.
|
|
188
|
+
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/name
|
|
189
|
+
*/
|
|
190
|
+
name: string;
|
|
191
|
+
/**
|
|
192
|
+
* The placeholder text to display when the input is empty.
|
|
193
|
+
* @note Placeholder takes precedence over label, if both are provided.
|
|
194
|
+
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/placeholder
|
|
195
|
+
*/
|
|
196
|
+
placeholder?: string;
|
|
197
|
+
/**
|
|
198
|
+
* The type attribute of the input element.
|
|
199
|
+
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/type
|
|
200
|
+
*/
|
|
201
|
+
type?: string;
|
|
202
|
+
/**
|
|
203
|
+
* The value of the input.
|
|
204
|
+
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#value
|
|
205
|
+
*/
|
|
206
|
+
value?: string;
|
|
207
|
+
}
|
|
208
|
+
|
|
163
209
|
declare const BRAND: {
|
|
164
210
|
PRIMARY: string;
|
|
165
211
|
PRIMARY_LIGHT: string;
|
|
@@ -308,6 +354,11 @@ declare interface IconProps {
|
|
|
308
354
|
color?: string;
|
|
309
355
|
}
|
|
310
356
|
|
|
357
|
+
/**
|
|
358
|
+
* A controlled and customizable input component with support for labels, prefixes, suffixes, and error states.
|
|
359
|
+
*/
|
|
360
|
+
export declare const Input: default_2.ForwardRefExoticComponent<BaseInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
361
|
+
|
|
311
362
|
export declare function Popover({ children, state, arrow, offset, ...props }: PopoverProps): JSX_2.Element;
|
|
312
363
|
|
|
313
364
|
/**
|
|
@@ -340,10 +391,40 @@ export declare interface ProtonColumnProps<T> extends ColumnProps<T> {
|
|
|
340
391
|
align?: "left" | "center" | "right";
|
|
341
392
|
}
|
|
342
393
|
|
|
394
|
+
export declare const ResponsiveSelect: {
|
|
395
|
+
Menu: typeof ResponsiveSelectMenu;
|
|
396
|
+
Option: <T>(props: ItemProps<T>) => JSX_3.Element;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* A dropdown select menu that opens a Popover, or an ActionMenu on mobile.
|
|
401
|
+
* Supports controlled and uncontrolled modes.
|
|
402
|
+
* @interface SelectProps
|
|
403
|
+
*/
|
|
404
|
+
declare function ResponsiveSelectMenu<T extends object>({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, items, "data-testid": testId, children, }: SelectProps<T>): JSX_2.Element;
|
|
405
|
+
|
|
343
406
|
declare type RGBArray = [number, number, number];
|
|
344
407
|
|
|
345
408
|
export { Row }
|
|
346
409
|
|
|
410
|
+
/**
|
|
411
|
+
* A search input component with optional clear functionality and URL parameter sync.
|
|
412
|
+
*/
|
|
413
|
+
export declare const SearchInput: ({ name, placeholder, autoComplete, isClearable, error, defaultValue, value: controlledValue, "data-testid": testId, onChange, onClear, }: SearchInputProps) => JSX_2.Element;
|
|
414
|
+
|
|
415
|
+
declare interface SearchInputProps extends Omit<BaseInputProps, "prefix" | "suffix" | "value" | "onChange" | "description" | "descriptionPosition" | "label"> {
|
|
416
|
+
/** Should the clear button be shown when there is text? */
|
|
417
|
+
isClearable?: boolean;
|
|
418
|
+
/** Called when the input value changes. */
|
|
419
|
+
onChange?: (value: string) => void;
|
|
420
|
+
/** Called when the clear button is clicked. */
|
|
421
|
+
onClear?: () => void;
|
|
422
|
+
/** The initial value of the input. */
|
|
423
|
+
defaultValue?: string;
|
|
424
|
+
/** The current value of the input (for controlled usage) */
|
|
425
|
+
value?: string;
|
|
426
|
+
}
|
|
427
|
+
|
|
347
428
|
export { Section }
|
|
348
429
|
|
|
349
430
|
export declare const Select: {
|
|
@@ -352,8 +433,7 @@ export declare const Select: {
|
|
|
352
433
|
};
|
|
353
434
|
|
|
354
435
|
/**
|
|
355
|
-
* A
|
|
356
|
-
* Supports controlled and uncontrolled modes, and urlSearchParam syncing.
|
|
436
|
+
* A dropdown select menu that opens a popover. Supports controlled and uncontrolled modes.
|
|
357
437
|
* @interface SelectProps
|
|
358
438
|
*/
|
|
359
439
|
declare function SelectMenu<T extends object>({ label, name, isDisabled, disabledKeys, selectedKey, onSelectionChange, items, "data-testid": testId, children, }: SelectProps<T>): JSX_2.Element;
|
|
@@ -361,44 +441,29 @@ declare function SelectMenu<T extends object>({ label, name, isDisabled, disable
|
|
|
361
441
|
declare interface SelectProps<T> {
|
|
362
442
|
/** The name of the select field
|
|
363
443
|
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
364
|
-
* @prop {string} name
|
|
365
444
|
*/
|
|
366
445
|
name: string;
|
|
367
446
|
/** Label to display above the select
|
|
368
447
|
* @external https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label#text
|
|
369
|
-
* @prop {string} label
|
|
370
448
|
*/
|
|
371
449
|
label?: string;
|
|
372
|
-
/** Whether the select is disabled
|
|
373
|
-
* @prop {boolean} isDisabled
|
|
374
|
-
*/
|
|
450
|
+
/** Whether the select is disabled */
|
|
375
451
|
isDisabled?: boolean;
|
|
376
452
|
/** Array of keys that should be disabled
|
|
377
453
|
* @example ["Thing 1", "Thing 2"]
|
|
378
|
-
* @prop {string[] | number[]} disabledKeys
|
|
379
454
|
*/
|
|
380
455
|
disabledKeys?: (string | number)[];
|
|
381
|
-
/** Currently selected key
|
|
382
|
-
* @prop {string | number} selectedKey
|
|
383
|
-
*/
|
|
456
|
+
/** Currently selected key */
|
|
384
457
|
selectedKey?: string | number;
|
|
385
|
-
/** Callback fired when selection changes
|
|
386
|
-
* @prop {(key: string | number) => void} onSelectionChange
|
|
387
|
-
*/
|
|
458
|
+
/** Callback fired when selection changes */
|
|
388
459
|
onSelectionChange?: (key: string | number) => void;
|
|
389
460
|
/** Array of items to display
|
|
390
461
|
* @example [{ name: "thing 1", label: "Thing 1" }, { name: "thing 2", label: "Thing 2" }]
|
|
391
|
-
* @prop {object[]} items
|
|
392
462
|
*/
|
|
393
463
|
items?: T[];
|
|
394
|
-
/**
|
|
395
|
-
* Test ID for the select
|
|
396
|
-
* @prop {string} data-testid
|
|
397
|
-
*/
|
|
464
|
+
/** Test ID for the select */
|
|
398
465
|
"data-testid"?: string;
|
|
399
|
-
/** Children elements or render function
|
|
400
|
-
* @prop {CollectionChildren<T>} children
|
|
401
|
-
*/
|
|
466
|
+
/** Children elements or render function */
|
|
402
467
|
children: CollectionChildren<T>;
|
|
403
468
|
}
|
|
404
469
|
|
|
@@ -605,4 +670,7 @@ declare namespace ButtonGroup {
|
|
|
605
670
|
|
|
606
671
|
declare namespace ActionMenu {
|
|
607
672
|
var Item: ({ name, to }: ActionMenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
673
|
+
var List: ({ children }: {
|
|
674
|
+
children: ReactNode;
|
|
675
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
608
676
|
}
|