@clicoh/orion-library 1.2.0-beta.2 → 1.2.0-beta.6
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/components/01-atoms/Button/Button.d.ts +4 -1
- package/dist/components/01-atoms/Button/Button.d.ts.map +1 -1
- package/dist/components/01-atoms/Button/Button.jsx +16 -2
- package/dist/components/01-atoms/Button/Button.jsx.map +1 -1
- package/dist/components/01-atoms/Switch/Switch.d.ts +5 -2
- package/dist/components/01-atoms/Switch/Switch.d.ts.map +1 -1
- package/dist/components/01-atoms/Switch/Switch.jsx +15 -12
- package/dist/components/01-atoms/Switch/Switch.jsx.map +1 -1
- package/dist/components/01-atoms/Textarea/Textarea.d.ts +38 -0
- package/dist/components/01-atoms/Textarea/Textarea.d.ts.map +1 -0
- package/dist/components/01-atoms/Textarea/Textarea.jsx +50 -0
- package/dist/components/01-atoms/Textarea/Textarea.jsx.map +1 -0
- package/dist/components/01-atoms/Textarea/index.d.ts +2 -0
- package/dist/components/01-atoms/Textarea/index.d.ts.map +1 -0
- package/dist/components/01-atoms/Textarea/index.js +2 -0
- package/dist/components/01-atoms/Textarea/index.js.map +1 -0
- package/dist/components/01-atoms/Toast/Toast.d.ts.map +1 -1
- package/dist/components/01-atoms/Toast/Toast.jsx +3 -1
- package/dist/components/01-atoms/Toast/Toast.jsx.map +1 -1
- package/dist/components/01-atoms/index.d.ts +1 -0
- package/dist/components/01-atoms/index.d.ts.map +1 -1
- package/dist/components/01-atoms/index.js +1 -0
- package/dist/components/01-atoms/index.js.map +1 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.d.ts +4 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.jsx +25 -10
- package/dist/components/02-molecules/Autocomplete/Autocomplete.jsx.map +1 -1
- package/dist/components/02-molecules/Filter/Filter.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/Filter.jsx +14 -2
- package/dist/components/02-molecules/Filter/Filter.jsx.map +1 -1
- package/dist/components/02-molecules/Filter/types.d.ts +18 -5
- package/dist/components/02-molecules/Filter/types.d.ts.map +1 -1
- package/dist/components/02-molecules/ImageViewer/ImageViewer.d.ts +24 -4
- package/dist/components/02-molecules/ImageViewer/ImageViewer.d.ts.map +1 -1
- package/dist/components/02-molecules/ImageViewer/ImageViewer.jsx +68 -18
- package/dist/components/02-molecules/ImageViewer/ImageViewer.jsx.map +1 -1
- package/dist/components/02-molecules/Modal/Modal.d.ts +5 -1
- package/dist/components/02-molecules/Modal/Modal.d.ts.map +1 -1
- package/dist/components/02-molecules/Modal/Modal.jsx +4 -2
- package/dist/components/02-molecules/Modal/Modal.jsx.map +1 -1
- package/dist/components/03-organisms/MapView/MapView.d.ts +9 -1
- package/dist/components/03-organisms/MapView/MapView.d.ts.map +1 -1
- package/dist/components/03-organisms/MapView/MapView.jsx +27 -2
- package/dist/components/03-organisms/MapView/MapView.jsx.map +1 -1
- package/package.json +3 -2
|
@@ -2,11 +2,13 @@ import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
|
2
2
|
export type ButtonProps = {
|
|
3
3
|
modifier?: ButtonsVariants;
|
|
4
4
|
size?: ButtonSize;
|
|
5
|
+
tone?: ButtonTone;
|
|
5
6
|
iconL?: ReactNode;
|
|
6
7
|
iconR?: ReactNode;
|
|
7
8
|
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
8
9
|
export type ButtonsVariants = 'principal' | 'second' | 'text' | 'action';
|
|
9
10
|
export type ButtonSize = 'md' | 'field' | 'sm';
|
|
11
|
+
export type ButtonTone = 'default' | 'critical';
|
|
10
12
|
/**
|
|
11
13
|
* Represents a button component with different modifiers.
|
|
12
14
|
*
|
|
@@ -18,6 +20,7 @@ export type ButtonSize = 'md' | 'field' | 'sm';
|
|
|
18
20
|
* @param {Object} props - The properties of the Button component.
|
|
19
21
|
* @param {'principal' | 'second' | 'text' | 'action'} [props.modifier='principal'] - The modifier for styling the button.
|
|
20
22
|
* @param {'md' | 'field' | 'sm'} [props.size='md'] - `field` matches the 36px height of `Input`, `Select` and `DatePicker`, for buttons that sit in the same row as form controls. `sm` is the compact button for dense rows (cards, table cells): smaller padding and 12px label. All sizes share the same variants.
|
|
23
|
+
* @param {'default' | 'critical'} [props.tone='default'] - `critical` marks an action that cannot be undone (reject, delete) with the error hue, keeping the shape of the `modifier`. `action` drops its brand gradient and renders like a critical `second`: a brand accent on a destructive action would send two opposite signals.
|
|
21
24
|
* @param {ReactNode} [props.iconL] - The icon to be displayed to the left of the button text.
|
|
22
25
|
* @param {ReactNode} [props.iconR] - The icon to be displayed to the right of the button text.
|
|
23
26
|
* @param {ReactNode} props.children - The content to be displayed inside the button.
|
|
@@ -25,5 +28,5 @@ export type ButtonSize = 'md' | 'field' | 'sm';
|
|
|
25
28
|
*
|
|
26
29
|
* @returns {ReactNode} The rendered Button component.
|
|
27
30
|
*/
|
|
28
|
-
export declare function Button({ modifier, size, iconL, iconR, children, ...restProps }: ButtonProps): ReactNode;
|
|
31
|
+
export declare function Button({ modifier, size, tone, iconL, iconR, children, ...restProps }: ButtonProps): ReactNode;
|
|
29
32
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC;AAC/C,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAmHhD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAsB,EACtB,IAAW,EACX,IAAgB,EAChB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,WAAW,GAAG,SAAS,CAuBzB"}
|
|
@@ -31,6 +31,18 @@ const styleMap = {
|
|
|
31
31
|
text: clsx('underline', 'text-black', 'disabled:text-gray-3', 'active:text-gray-1', 'not-disabled:hover:before:bg-gray-5', 'not-disabled:hover:after:bg-gray-5', 'dark:active:text-gray-7 dark:disabled:text-gray-2 dark:text-white', 'dark:not-disabled:hover:before:bg-gray-1', 'dark:not-disabled:hover:after:bg-gray-1'),
|
|
32
32
|
action: clsx('disabled:text-gray-3 not-disabled:active:text-gray-5 text-black not-disabled:hover:text-white [&:not(:disabled):not(:hover)]:focus:text-black', '[&:not(:disabled):not(:hover)]:focus:before:bg-gray-5 before:bg-white not-disabled:hover:before:bg-black not-disabled:active:before:bg-black disabled:before:bg-white', 'after:bg-clicoh disabled:after:bg-gray-3 not-disabled:hover:after:bg-black not-disabled:hover:after:bg-none not-disabled:active:after:bg-black not-disabled:active:after:bg-none disabled:after:bg-none', 'dark:disabled:text-gray-2 dark:[&:not(:disabled):not(:hover)]:focus:text-gray-5 dark:text-white dark:not-disabled:hover:text-black dark:not-disabled:active:text-black', 'dark:not-disabled:active:before:bg-gray-5 dark:before:bg-black dark:not-disabled:hover:before:bg-white dark:disabled:before:bg-black dark:[&:not(:disabled):not(:hover)]:focus:before:bg-black', 'dark:after:bg-clicoh dark:disabled:after:bg-gray-2 dark:not-disabled:active:after:bg-gray-5 dark:not-disabled:hover:after:bg-white dark:not-disabled:hover:after:bg-none dark:not-disabled:active:after:bg-none dark:disabled:after:bg-none'),
|
|
33
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* El texto rojo usa `error-strong`: `error` queda por debajo de 4.5:1 sobre
|
|
36
|
+
* blanco. Los rellenos con texto blanco usan `error-strong` tambien en dark por
|
|
37
|
+
* la misma razon; el texto sobre fondo oscuro sigue la regla de `-dark`.
|
|
38
|
+
*/
|
|
39
|
+
const criticalOutline = clsx('text-error-strong disabled:text-gray-3 [&:not(:disabled):not(:hover)]:focus:text-error-strong not-disabled:hover:text-white not-disabled:active:text-white', 'not-disabled:hover:before:bg-error-strong not-disabled:active:before:bg-error-strong [&:not(:disabled):not(:hover)]:focus:before:bg-error-1 before:bg-white disabled:before:bg-white', 'after:bg-error-strong disabled:after:bg-gray-3 not-disabled:hover:after:bg-error-strong not-disabled:active:after:bg-error-strong [&:not(:disabled):not(:hover)]:focus:after:bg-error-strong', 'dark:text-error-dark dark:disabled:text-gray-2 dark:[&:not(:disabled):not(:hover)]:focus:text-error-dark dark:not-disabled:hover:text-white dark:not-disabled:active:text-white', 'dark:not-disabled:hover:before:bg-error-strong dark:not-disabled:active:before:bg-error-strong dark:[&:not(:disabled):not(:hover)]:focus:before:bg-error-dark-1 dark:before:bg-black dark:disabled:before:bg-black', 'dark:after:bg-error-dark dark:disabled:after:bg-gray-2 dark:not-disabled:hover:after:bg-error-strong dark:not-disabled:active:after:bg-error-strong dark:[&:not(:disabled):not(:hover)]:focus:after:bg-error-dark');
|
|
40
|
+
const criticalStyleMap = {
|
|
41
|
+
principal: clsx('not-disabled:hover:text-error-strong not-disabled:active:text-error-strong text-white disabled:text-white [&:not(:disabled):not(:hover)]:focus:text-white', 'before:bg-error-strong not-disabled:active:before:bg-error-1 disabled:before:bg-gray-3 [&:not(:disabled):not(:hover)]:focus:before:bg-error-strong not-disabled:hover:before:bg-white', 'after:bg-error-strong not-disabled:hover:after:bg-error-strong not-disabled:active:after:bg-error-strong disabled:after:bg-gray-3 [&:not(:disabled):not(:hover)]:focus:after:bg-clicoh', 'dark:not-disabled:hover:text-error-dark dark:not-disabled:active:text-error-dark dark:text-white dark:disabled:text-white dark:[&:not(:disabled):not(:hover)]:focus:text-white', 'dark:before:bg-error-strong dark:not-disabled:active:before:bg-error-dark-1 dark:disabled:before:bg-gray-1 dark:[&:not(:disabled):not(:hover)]:focus:before:bg-error-strong dark:not-disabled:hover:before:bg-black', 'dark:after:bg-error-strong dark:not-disabled:hover:after:bg-error-dark dark:not-disabled:active:after:bg-error-dark dark:disabled:after:bg-gray-1 dark:[&:not(:disabled):not(:hover)]:focus:after:bg-clicoh'),
|
|
42
|
+
second: criticalOutline,
|
|
43
|
+
text: clsx('underline', 'text-error-strong', 'disabled:text-gray-3', 'active:text-error', 'not-disabled:hover:before:bg-error-1', 'not-disabled:hover:after:bg-error-1', 'dark:text-error-dark dark:disabled:text-gray-2 dark:active:text-error-dark dark:not-disabled:hover:text-white', 'dark:not-disabled:hover:before:bg-error-dark-1', 'dark:not-disabled:hover:after:bg-error-dark-1'),
|
|
44
|
+
action: criticalOutline,
|
|
45
|
+
};
|
|
34
46
|
/**
|
|
35
47
|
* Represents a button component with different modifiers.
|
|
36
48
|
*
|
|
@@ -42,6 +54,7 @@ const styleMap = {
|
|
|
42
54
|
* @param {Object} props - The properties of the Button component.
|
|
43
55
|
* @param {'principal' | 'second' | 'text' | 'action'} [props.modifier='principal'] - The modifier for styling the button.
|
|
44
56
|
* @param {'md' | 'field' | 'sm'} [props.size='md'] - `field` matches the 36px height of `Input`, `Select` and `DatePicker`, for buttons that sit in the same row as form controls. `sm` is the compact button for dense rows (cards, table cells): smaller padding and 12px label. All sizes share the same variants.
|
|
57
|
+
* @param {'default' | 'critical'} [props.tone='default'] - `critical` marks an action that cannot be undone (reject, delete) with the error hue, keeping the shape of the `modifier`. `action` drops its brand gradient and renders like a critical `second`: a brand accent on a destructive action would send two opposite signals.
|
|
45
58
|
* @param {ReactNode} [props.iconL] - The icon to be displayed to the left of the button text.
|
|
46
59
|
* @param {ReactNode} [props.iconR] - The icon to be displayed to the right of the button text.
|
|
47
60
|
* @param {ReactNode} props.children - The content to be displayed inside the button.
|
|
@@ -49,9 +62,10 @@ const styleMap = {
|
|
|
49
62
|
*
|
|
50
63
|
* @returns {ReactNode} The rendered Button component.
|
|
51
64
|
*/
|
|
52
|
-
export function Button({ modifier = 'principal', size = 'md', iconL, iconR, children, ...restProps }) {
|
|
65
|
+
export function Button({ modifier = 'principal', size = 'md', tone = 'default', iconL, iconR, children, ...restProps }) {
|
|
53
66
|
const sizing = sizeMap[size];
|
|
54
|
-
const
|
|
67
|
+
const variantStyles = tone === 'critical' ? criticalStyleMap : styleMap;
|
|
68
|
+
const className = clsx('relative isolate flex items-center justify-center text-center font-semibold', 'rounded-3xl border-2 border-transparent transition-colors', 'before:absolute before:inset-0 before:-z-10 before:block before:rounded-3xl before:transition-colors', 'after:absolute after:-inset-[2px] after:-z-20 after:block after:rounded-3xl after:transition-colors', sizing.base, iconL ? sizing.iconPadL : sizing.padL, iconR ? sizing.iconPadR : sizing.padR, variantStyles[modifier], restProps.className);
|
|
55
69
|
return (<button {...restProps} className={className}>
|
|
56
70
|
{!!iconL && <span className={clsx('pr-2', sizing.icon)}>{iconL}</span>}
|
|
57
71
|
<span>{children}</span>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAexB,MAAM,OAAO,GAUT;IACF,EAAE,EAAE;QACF,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,WAAW;KAClB;IACD,KAAK,EAAE;QACL,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,WAAW;KAClB;IACD,EAAE,EAAE;QACF,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,IAAI,EAAE,SAAS;KAChB;CACF,CAAC;AAEF,MAAM,QAAQ,GAAoC;IAChD,SAAS,EAAE,IAAI,CACb,6IAA6I,EAC7I,wKAAwK,EACxK,qKAAqK,EACrK,uKAAuK,EACvK,iMAAiM,EACjM,8LAA8L,CAC/L;IACD,MAAM,EAAE,IAAI,CACV,iJAAiJ,EACjJ,sKAAsK,EACtK,oKAAoK,EACpK,wKAAwK,EACxK,gMAAgM,EAChM,6LAA6L,CAC9L;IACD,IAAI,EAAE,IAAI,CACR,WAAW,EACX,YAA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AC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EACrC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EACrC,aAAa,CAAC,QAAQ,CAAC,EACvB,SAAS,CAAC,SAAS,CACpB,CAAC;IAEF,OAAO,CACL,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAC1C;MAAA,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CACtE;MAAA,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CACtB;MAAA,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CACxE;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -5,6 +5,8 @@ type SwitchProps = {
|
|
|
5
5
|
onChange?: (checked: boolean) => void;
|
|
6
6
|
onClick?: (rollback: () => void, commit: () => void) => void;
|
|
7
7
|
label?: string;
|
|
8
|
+
/** Accessible name when there is no visible `label` (e.g. a switch inside a table row). */
|
|
9
|
+
ariaLabel?: string;
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
10
12
|
* Switch component for rendering a toggle switch with optional label.
|
|
@@ -29,11 +31,12 @@ type SwitchProps = {
|
|
|
29
31
|
* @param {boolean} isChecked - Initial checked state of the switch.
|
|
30
32
|
* @param {boolean} [isDisabled=false] - Optional boolean to disable the switch.
|
|
31
33
|
* @param {string} [label] - Optional label to be displayed next to the switch.
|
|
34
|
+
* @param {string} [ariaLabel] - Accessible name for the control when no visible `label` is rendered.
|
|
32
35
|
* @param {function} [onChange] - Optional callback function to handle change in checked state.
|
|
33
|
-
* @param {function} [onClick] - Optional callback function to handle click events with rollback and commit actions.
|
|
36
|
+
* @param {function} [onClick] - Optional callback function to handle click events with rollback and commit actions. Invoked exactly once per click.
|
|
34
37
|
*
|
|
35
38
|
* @returns {ReactNode} The rendered Switch component.
|
|
36
39
|
*/
|
|
37
|
-
export declare function Switch({ isChecked, isDisabled, label, onChange, onClick, }: SwitchProps): ReactNode;
|
|
40
|
+
export declare function Switch({ isChecked, isDisabled, label, ariaLabel, onChange, onClick, }: SwitchProps): ReactNode;
|
|
38
41
|
export {};
|
|
39
42
|
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Switch/Switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Switch/Switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2FAA2F;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,UAAkB,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAE,WAAW,GAAG,SAAS,CAyEzB"}
|
|
@@ -25,12 +25,13 @@ import { Paragraph } from '../Paragraph';
|
|
|
25
25
|
* @param {boolean} isChecked - Initial checked state of the switch.
|
|
26
26
|
* @param {boolean} [isDisabled=false] - Optional boolean to disable the switch.
|
|
27
27
|
* @param {string} [label] - Optional label to be displayed next to the switch.
|
|
28
|
+
* @param {string} [ariaLabel] - Accessible name for the control when no visible `label` is rendered.
|
|
28
29
|
* @param {function} [onChange] - Optional callback function to handle change in checked state.
|
|
29
|
-
* @param {function} [onClick] - Optional callback function to handle click events with rollback and commit actions.
|
|
30
|
+
* @param {function} [onClick] - Optional callback function to handle click events with rollback and commit actions. Invoked exactly once per click.
|
|
30
31
|
*
|
|
31
32
|
* @returns {ReactNode} The rendered Switch component.
|
|
32
33
|
*/
|
|
33
|
-
export function Switch({ isChecked, isDisabled = false, label, onChange, onClick, }) {
|
|
34
|
+
export function Switch({ isChecked, isDisabled = false, label, ariaLabel, onChange, onClick, }) {
|
|
34
35
|
const [checked, setChecked] = useState(isChecked);
|
|
35
36
|
const [disable, setDisable] = useState(isDisabled);
|
|
36
37
|
const handleChange = (event) => {
|
|
@@ -40,15 +41,17 @@ export function Switch({ isChecked, isDisabled = false, label, onChange, onClick
|
|
|
40
41
|
if (!onClick) {
|
|
41
42
|
return setChecked((prevState) => !prevState);
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
// `onClick` runs outside the state updater on purpose: React may invoke an
|
|
45
|
+
// updater more than once (Strict Mode, batching), which would fire the
|
|
46
|
+
// consumer's side effect several times per click.
|
|
47
|
+
const previous = checked;
|
|
48
|
+
setChecked(!previous);
|
|
49
|
+
setDisable(true);
|
|
50
|
+
onClick(() => {
|
|
51
|
+
setChecked(previous);
|
|
52
|
+
setDisable(false);
|
|
53
|
+
}, () => {
|
|
54
|
+
setDisable(false);
|
|
52
55
|
});
|
|
53
56
|
};
|
|
54
57
|
useEffect(() => {
|
|
@@ -58,7 +61,7 @@ export function Switch({ isChecked, isDisabled = false, label, onChange, onClick
|
|
|
58
61
|
setDisable(isDisabled);
|
|
59
62
|
}, [isDisabled]);
|
|
60
63
|
return (<label className={clsx('inline-flex items-center', disable ? 'select-none' : 'cursor-pointer')}>
|
|
61
|
-
<input type="checkbox" role="switch" aria-checked={checked} className="peer sr-only" checked={checked} onChange={handleChange} onClick={handleClick} disabled={disable}/>
|
|
64
|
+
<input type="checkbox" role="switch" aria-checked={checked} aria-label={label ? undefined : ariaLabel} className="peer sr-only" checked={checked} onChange={handleChange} onClick={handleClick} disabled={disable}/>
|
|
62
65
|
<div aria-hidden="true" className="bg-gray-3 after:border-gray-3 dark:bg-gray-1 dark:after:border-gray-2 relative h-5 w-12 rounded-full peer-checked:bg-black peer-focus-visible:ring-2 peer-focus-visible:ring-black/20 peer-disabled:opacity-80 after:absolute after:-top-0.5 after:size-6 after:rounded-full after:border after:bg-white after:shadow-sm after:shadow-[rgba(0,0,0,.5)] after:transition-all peer-checked:after:translate-x-full dark:peer-checked:bg-white dark:peer-focus-visible:ring-white/30 dark:after:bg-white dark:peer-checked:after:bg-black"/>
|
|
63
66
|
<Paragraph size="subtitle-1" className={clsx('ms-2', disable
|
|
64
67
|
? 'text-gray-3 dark:text-gray-2'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAGL,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Switch/Switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAGL,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAYzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,GACK;IACZ,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,SAAS,CAAC,CAAC;IAC3D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,UAAU,CAAC,CAAC;IAE5D,MAAM,YAAY,GAAyC,CAAC,KAAK,EAAE,EAAE;QACnE,QAAQ,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,UAAU,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QAC/C,CAAC;QAED,2EAA2E;QAC3E,uEAAuE;QACvE,kDAAkD;QAClD,MAAM,QAAQ,GAAG,OAAO,C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;YAChC,CAAC,CAAC,4BAA4B,CACjC,CAAC,CAEF;QAAA,CAAC,KAAK,CACR;MAAA,EAAE,SAAS,CACb;IAAA,EAAE,KAAK,CAAC,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type DetailedHTMLProps, type ReactNode, type TextareaHTMLAttributes } from 'react';
|
|
2
|
+
type TextareaProps = {
|
|
3
|
+
label: string;
|
|
4
|
+
textarea: Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'placeholder'>;
|
|
5
|
+
helperText?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Textarea component for multi-line text, matching Input's border, color, disabled and error
|
|
12
|
+
* states. It uses a static label above the field instead of Input's floating notch: a floating
|
|
13
|
+
* label has no natural resting place once the field grows past one line.
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @example
|
|
17
|
+
* // Example usage of Textarea component
|
|
18
|
+
* <Textarea
|
|
19
|
+
* label="Observaciones"
|
|
20
|
+
* textarea={{ value: 'Texto', rows: 3, onChange: () => console.log('Textarea changed') }}
|
|
21
|
+
* placeholder="Notas operativas"
|
|
22
|
+
* helperText="Opcional"
|
|
23
|
+
* error="Campo requerido"
|
|
24
|
+
* />
|
|
25
|
+
*
|
|
26
|
+
* @param {Object} props - The properties of the Textarea component.
|
|
27
|
+
* @param {string} props.label - The label text shown above the field.
|
|
28
|
+
* @param {Object} props.textarea - Native textarea attributes (value, rows, onChange, disabled, ...).
|
|
29
|
+
* @param {string} [props.helperText] - Optional helper text to be displayed below the field.
|
|
30
|
+
* @param {string} [props.error] - Optional error message to be displayed below the field.
|
|
31
|
+
* @param {string} [props.placeholder] - Placeholder shown inside the field.
|
|
32
|
+
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only.
|
|
33
|
+
*
|
|
34
|
+
* @returns {ReactNode} The rendered Textarea component.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Textarea({ label, textarea, helperText, error, placeholder, hideLabel, }: TextareaProps): ReactNode;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Textarea/Textarea.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,sBAAsB,EAE5B,MAAM,OAAO,CAAC;AAGf,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,CACZ,iBAAiB,CACf,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,mBAAmB,CACpB,EACD,aAAa,CACd,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAiB,GAClB,EAAE,aAAa,GAAG,SAAS,CA+C3B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useId, } from 'react';
|
|
4
|
+
import { RenderErrorOrHelperText } from '../Input/utils/RenderErrorOrHelperText';
|
|
5
|
+
/**
|
|
6
|
+
* Textarea component for multi-line text, matching Input's border, color, disabled and error
|
|
7
|
+
* states. It uses a static label above the field instead of Input's floating notch: a floating
|
|
8
|
+
* label has no natural resting place once the field grows past one line.
|
|
9
|
+
*
|
|
10
|
+
* @component
|
|
11
|
+
* @example
|
|
12
|
+
* // Example usage of Textarea component
|
|
13
|
+
* <Textarea
|
|
14
|
+
* label="Observaciones"
|
|
15
|
+
* textarea={{ value: 'Texto', rows: 3, onChange: () => console.log('Textarea changed') }}
|
|
16
|
+
* placeholder="Notas operativas"
|
|
17
|
+
* helperText="Opcional"
|
|
18
|
+
* error="Campo requerido"
|
|
19
|
+
* />
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} props - The properties of the Textarea component.
|
|
22
|
+
* @param {string} props.label - The label text shown above the field.
|
|
23
|
+
* @param {Object} props.textarea - Native textarea attributes (value, rows, onChange, disabled, ...).
|
|
24
|
+
* @param {string} [props.helperText] - Optional helper text to be displayed below the field.
|
|
25
|
+
* @param {string} [props.error] - Optional error message to be displayed below the field.
|
|
26
|
+
* @param {string} [props.placeholder] - Placeholder shown inside the field.
|
|
27
|
+
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only.
|
|
28
|
+
*
|
|
29
|
+
* @returns {ReactNode} The rendered Textarea component.
|
|
30
|
+
*/
|
|
31
|
+
export function Textarea({ label, textarea, helperText, error, placeholder, hideLabel = false, }) {
|
|
32
|
+
const generatedId = useId();
|
|
33
|
+
const id = textarea.id ?? generatedId;
|
|
34
|
+
const descriptionId = error || helperText ? `${id}-description` : undefined;
|
|
35
|
+
const describedBy = [textarea['aria-describedby'], descriptionId].filter(Boolean).join(' ') ||
|
|
36
|
+
undefined;
|
|
37
|
+
const textareaClasses = clsx('w-full resize-y rounded-lg border bg-transparent p-3.5 text-sm text-black transition-colors outline-none placeholder:text-gray-2 dark:text-white dark:placeholder:text-gray-2', 'disabled:border-gray-3 disabled:text-gray-3 dark:disabled:border-gray-2 dark:disabled:text-gray-2 disabled:cursor-not-allowed', error
|
|
38
|
+
? 'border-error focus:border-error focus:ring-error dark:border-error-dark dark:focus:border-error-dark dark:focus:ring-error-dark focus:ring-2'
|
|
39
|
+
: 'border-black hover:border-gray-1 focus:border-lavender focus:ring-lavender dark:border-white dark:hover:border-gray-2 focus:ring-2', textarea.className);
|
|
40
|
+
return (<div className="w-full max-w-full">
|
|
41
|
+
{hideLabel ? (<label htmlFor={id} className="sr-only">
|
|
42
|
+
{label}
|
|
43
|
+
</label>) : (<label htmlFor={id} className="text-gray-1 mb-1.5 ml-0.5 block text-xs font-semibold">
|
|
44
|
+
{label}
|
|
45
|
+
</label>)}
|
|
46
|
+
<textarea {...textarea} id={id} className={textareaClasses} placeholder={placeholder} aria-invalid={error ? true : textarea['aria-invalid']} aria-describedby={describedBy}/>
|
|
47
|
+
<RenderErrorOrHelperText id={descriptionId} disabled={textarea.disabled} helperText={helperText} error={error}/>
|
|
48
|
+
</div>);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=Textarea.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Textarea.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,KAAK,GACN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAiBjF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,QAAQ,CAAC,EACvB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,KAAK,EACL,WAAW,EACX,SAAS,GAAG,KAAK,GACH;IACd,MAAM,WAAW,GAAG,KAAK,EAAE,CAAC;IAC5B,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE,IAAI,WAAW,CAAC;IACtC,MAAM,aAAa,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,MAAM,WAAW,GACf,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CA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Textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/01-atoms/Textarea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Toast/Toast.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AA+B5C;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Toast/Toast.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,KAAK,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AA+B5C;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAgB9D"}
|
|
@@ -27,7 +27,9 @@ const backgroundClasses = {
|
|
|
27
27
|
* @returns {void}
|
|
28
28
|
*/
|
|
29
29
|
export function showToast(content, type) {
|
|
30
|
-
|
|
30
|
+
// A render function instead of an element: react-toastify clones a plain element
|
|
31
|
+
// with `closeToast`/`toastProps`, which `Paragraph` would forward to the DOM `<p>`.
|
|
32
|
+
toastFn(() => (<Paragraph className="text-black dark:text-white">{content}</Paragraph>), {
|
|
31
33
|
position: 'top-right',
|
|
32
34
|
hideProgressBar: true,
|
|
33
35
|
pauseOnFocusLoss: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Toast/Toast.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,MAAM,WAAW,GAAG,IAAI,CAAC,sCAAsC,CAAC,CAAC;AAEjE,MAAM,KAAK,GAA4B;IACrC,OAAO,EAAE,CACP,CAAC,OAAO,CACN,WAAW,CAAC,MAAM,CAClB,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,iCAAiC,CAAC,CAAC,EAChE,CACH;IACD,OAAO,EAAE,CACP,CAAC,SAAS,CACR,WAAW,CAAC,MAAM,CAClB,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,iCAAiC,CAAC,CAAC,EAChE,CACH;IACD,KAAK,EAAE,CACL,CAAC,OAAO,CACN,WAAW,CAAC,MAAM,CAClB,SAAS,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC,EAC5D,CACH;CACF,CAAC;AAEF,MAAM,iBAAiB,GAAyB;IAC9C,OAAO,EAAE,qCAAqC;IAC9C,OAAO,EAAE,qCAAqC;IAC9C,KAAK,EAAE,iCAAiC;CACzC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CAAC,OAAkB,EAAE,IAAU;IACtD,OAAO,CACL,CAAC,SAAS,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"Toast.jsx","sourceRoot":"","sources":["../../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,IAAI;QAChB,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;QACvB,SAAS,EAAE,iBAAiB,CAAC,IAAI,CAAC;KACnC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/01-atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/01-atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/01-atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/01-atoms/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -17,6 +17,8 @@ type AutocompleteInput = {
|
|
|
17
17
|
hideLabel?: boolean;
|
|
18
18
|
placeholder?: string;
|
|
19
19
|
toggleButtonLabel?: string;
|
|
20
|
+
/** Hides the dropdown-toggle chevron — use for search-as-you-type fields with no closed list to browse. */
|
|
21
|
+
hideToggleButton?: boolean;
|
|
20
22
|
noOptionsText?: string;
|
|
21
23
|
};
|
|
22
24
|
/**
|
|
@@ -46,12 +48,13 @@ type AutocompleteInput = {
|
|
|
46
48
|
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only and drops the floating label. Use it when a heading outside the field already names it.
|
|
47
49
|
* @param {string} [props.placeholder] - Placeholder shown inside the field. Only rendered together with `hideLabel`.
|
|
48
50
|
* @param {string} [props.toggleButtonLabel] - Accessible name of the button that opens and closes the list.
|
|
51
|
+
* @param {boolean} [props.hideToggleButton] - Hides the dropdown-toggle chevron, for search-as-you-type fields with no closed list to browse.
|
|
49
52
|
* @param {string} [props.noOptionsText='No hay opciones'] - Text shown when the query matches nothing.
|
|
50
53
|
* @param {string} [props.error] - Error message displayed below the input.
|
|
51
54
|
* @param {string} [props.value=''] - The controlled value of the input.
|
|
52
55
|
*
|
|
53
56
|
* @returns {ReactNode} The rendered Autocomplete component.
|
|
54
57
|
*/
|
|
55
|
-
export declare function Autocomplete({ options, onSelect, onChange, onDebouncedChange, debounceDelay, onHandleKeyDown, disabled, label, helperText, error, value, isMutedWhenEmpty, hideLabel, placeholder, toggleButtonLabel, noOptionsText, }: Readonly<AutocompleteInput>): ReactNode;
|
|
58
|
+
export declare function Autocomplete({ options, onSelect, onChange, onDebouncedChange, debounceDelay, onHandleKeyDown, disabled, label, helperText, error, value, isMutedWhenEmpty, hideLabel, placeholder, toggleButtonLabel, hideToggleButton, noOptionsText, }: Readonly<AutocompleteInput>): ReactNode;
|
|
56
59
|
export {};
|
|
57
60
|
//# sourceMappingURL=Autocomplete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.d.ts","sourceRoot":"","sources":["../../../../src/components/02-molecules/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,iBAAiB,CAAC,EAAE,CAClB,KAAK,EAAE,MAAM,KACV,IAAI,GAAG,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,CAAC,CAAC;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,GAAG,SAAS,KAAK,IAAI,CAAC;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,K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B,CAAC,EAAE,MAAM,CAAC;IAC3B,2GAA2G;IAC3G,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,aAAmB,EACnB,eAAe,EACf,QAAQ,EACR,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,aAAiC,GAClC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,SAAS,CA4SzC"}
|
|
@@ -31,17 +31,21 @@ import { debounce } from '../../../utils';
|
|
|
31
31
|
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only and drops the floating label. Use it when a heading outside the field already names it.
|
|
32
32
|
* @param {string} [props.placeholder] - Placeholder shown inside the field. Only rendered together with `hideLabel`.
|
|
33
33
|
* @param {string} [props.toggleButtonLabel] - Accessible name of the button that opens and closes the list.
|
|
34
|
+
* @param {boolean} [props.hideToggleButton] - Hides the dropdown-toggle chevron, for search-as-you-type fields with no closed list to browse.
|
|
34
35
|
* @param {string} [props.noOptionsText='No hay opciones'] - Text shown when the query matches nothing.
|
|
35
36
|
* @param {string} [props.error] - Error message displayed below the input.
|
|
36
37
|
* @param {string} [props.value=''] - The controlled value of the input.
|
|
37
38
|
*
|
|
38
39
|
* @returns {ReactNode} The rendered Autocomplete component.
|
|
39
40
|
*/
|
|
40
|
-
export function Autocomplete({ options, onSelect, onChange, onDebouncedChange, debounceDelay = 200, onHandleKeyDown, disabled, label, helperText, error, value, isMutedWhenEmpty, hideLabel, placeholder, toggleButtonLabel, noOptionsText = 'No hay opciones', }) {
|
|
41
|
+
export function Autocomplete({ options, onSelect, onChange, onDebouncedChange, debounceDelay = 200, onHandleKeyDown, disabled, label, helperText, error, value, isMutedWhenEmpty, hideLabel, placeholder, toggleButtonLabel, hideToggleButton, noOptionsText = 'No hay opciones', }) {
|
|
41
42
|
const [query, setQuery] = useState(value ?? '');
|
|
42
43
|
const [filteredOptions, setFilteredOptions] = useState([]);
|
|
43
44
|
const [isOpen, setIsOpen] = useState(false);
|
|
44
45
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
46
|
+
// True between a keystroke and its debounced remote result: the "no options" row
|
|
47
|
+
// must not flash while the consumer is still fetching.
|
|
48
|
+
const [isSearching, setIsSearching] = useState(false);
|
|
45
49
|
const listboxId = useId();
|
|
46
50
|
const containerRef = useRef(null);
|
|
47
51
|
const justSelectedRef = useRef(false);
|
|
@@ -59,9 +63,18 @@ export function Autocomplete({ options, onSelect, onChange, onDebouncedChange, d
|
|
|
59
63
|
setFilteredOptions([]);
|
|
60
64
|
setIsOpen(false);
|
|
61
65
|
setActiveIndex(-1);
|
|
66
|
+
setIsSearching(false);
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
64
|
-
|
|
69
|
+
let result;
|
|
70
|
+
try {
|
|
71
|
+
result = await onDebouncedChangeRef.current?.(q);
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
if (latestQueryRef.current === q) {
|
|
75
|
+
setIsSearching(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
65
78
|
if (latestQueryRef.current !== q) {
|
|
66
79
|
return;
|
|
67
80
|
}
|
|
@@ -88,6 +101,7 @@ export function Autocomplete({ options, onSelect, onChange, onDebouncedChange, d
|
|
|
88
101
|
}
|
|
89
102
|
setFilteredOptions(options.filter((option) => option.label.toLowerCase().includes(newQuery.toLowerCase())));
|
|
90
103
|
setIsOpen(true);
|
|
104
|
+
setIsSearching(Boolean(onDebouncedChangeRef.current));
|
|
91
105
|
onChange?.(newQuery);
|
|
92
106
|
debouncedCallback(newQuery);
|
|
93
107
|
};
|
|
@@ -218,14 +232,15 @@ export function Autocomplete({ options, onSelect, onChange, onDebouncedChange, d
|
|
|
218
232
|
'aria-activedescendant': isOpen && activeIndex >= 0
|
|
219
233
|
? `${listboxId}-option-${activeIndex}`
|
|
220
234
|
: undefined,
|
|
221
|
-
}} iconR={handleIcon()} helperText={helperText} error={error} isMutedWhenEmpty={isMutedWhenEmpty} hideLabel={hideLabel} placeholder={placeholder}/>
|
|
222
|
-
{!!isOpen &&
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
235
|
+
}} iconR={hideToggleButton ? undefined : handleIcon()} helperText={helperText} error={error} isMutedWhenEmpty={isMutedWhenEmpty} hideLabel={hideLabel} placeholder={placeholder}/>
|
|
236
|
+
{!!isOpen &&
|
|
237
|
+
(filteredOptions.length > 0 || (hasSearchQuery && !isSearching)) && (<ul id={listboxId} role="listbox" className="dark:bg-black-1 absolute z-40 flex max-h-28 w-full flex-col gap-y-1 overflow-y-auto rounded-md bg-white px-3 py-2 shadow-lg dark:text-white">
|
|
238
|
+
{filteredOptions?.length > 0 ? (filteredOptions.map((option, index) => (<li key={option.value} id={`${listboxId}-option-${index}`} role="option" aria-selected={activeIndex === index} className={clsx('hover:bg-gray-5 dark:hover:bg-gray-1 cursor-pointer rounded-sm px-1 py-0.5', activeIndex === index && 'bg-gray-5 dark:bg-gray-1')} onMouseEnter={() => setActiveIndex(index)} onMouseDown={(event) => event.preventDefault()} onClick={() => handleOptionClick(option)}>
|
|
239
|
+
{option.label}
|
|
240
|
+
</li>))) : hasSearchQuery && !isSearching ? (<li role="option" aria-disabled="true" className="autocomplete-option no-options">
|
|
241
|
+
{noOptionsText}
|
|
242
|
+
</li>) : null}
|
|
243
|
+
</ul>)}
|
|
229
244
|
</div>);
|
|
230
245
|
}
|
|
231
246
|
//# sourceMappingURL=Autocomplete.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.jsx","sourceRoot":"","sources":["../../../../src/components/02-molecules/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Autocomplete.jsx","sourceRoot":"","sources":["../../../../src/components/02-molecules/Autocomplete/Autocomplete.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA0B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,UAAU,YAAY,CAAC,EAC3B,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,aAAa,GAAG,GAAG,EACnB,eAAe,EACf,QAAQ,EACR,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GAAG,iBAAiB,GACL;IAC5B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAS,KAAK,IAAI,EAAE,CAAC,CAAC;IACxD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAe,EAAE,CAAC,CAAC;IACzE,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AA,EAAE,EAAE,CAAC,CACN,CACL;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Filter.d.ts","sourceRoot":"","sources":["../../../../src/components/02-molecules/Filter/Filter.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAe5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5D,KAAK,YAAY,GAAG;IAClB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,CAAC;IAChE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,IAAI,CAAC;KACtB,CAAC;IACF,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,CAAC;KACzD,CAAC;IACF,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,MAAM,CAAC,EACrB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,MAAM,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAyB,GAC1B,EAAE,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"Filter.d.ts","sourceRoot":"","sources":["../../../../src/components/02-molecules/Filter/Filter.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAe5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE5D,KAAK,YAAY,GAAG;IAClB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,CAAC;IAChE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IACpD,sFAAsF;IACtF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,IAAI,CAAC;KACtB,CAAC;IACF,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,IAAI,CAAC;KACzD,CAAC;IACF,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,MAAM,CAAC,EACrB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,MAAM,EACN,eAAe,EACf,iBAAiB,EACjB,kBAAyB,GAC1B,EAAE,YAAY,GAAG,SAAS,CAoZ1B"}
|
|
@@ -166,19 +166,31 @@ export function Filter({ filtersEnabledText, submitButton, resetButton, inputs,
|
|
|
166
166
|
</Show>
|
|
167
167
|
<div className={clsx('grid gap-4 dark:text-white', columns === 2 ? 'grid-cols-2' : 'grid-cols-1')}>
|
|
168
168
|
<Each of={config} render={(inputConfig, index) => {
|
|
169
|
-
const { type, label, options, minDate, maxDate, placeholder, helperText, onDebouncedChange, debounceDelay, toggleButtonLabel, noOptionsText, } = inputConfig;
|
|
169
|
+
const { type, label, options, minDate, maxDate, placeholder, helperText, onDebouncedChange, debounceDelay, toggleButtonLabel, hideToggleButton, noOptionsText, } = inputConfig;
|
|
170
170
|
const onAutocompleteSelect = type === 'autocomplete' &&
|
|
171
171
|
'onSelect' in inputConfig
|
|
172
172
|
? inputConfig.onSelect
|
|
173
173
|
: undefined;
|
|
174
|
+
const onSelectChange = type === 'select' && 'onChange' in inputConfig
|
|
175
|
+
? inputConfig.onChange
|
|
176
|
+
: undefined;
|
|
177
|
+
const isSelectDisabled = type === 'select' && 'disabled' in inputConfig
|
|
178
|
+
? Boolean(inputConfig.disabled)
|
|
179
|
+
: false;
|
|
174
180
|
const filterKey = config.length > 1 ? `${name}__${index}` : name;
|
|
175
181
|
return (<Show key={label}>
|
|
176
182
|
<Show.When isTrue={type === 'select'}>
|
|
177
183
|
<Select label={label} select={{
|
|
178
184
|
name: filterKey,
|
|
185
|
+
disabled: isSelectDisabled,
|
|
179
186
|
value: filters[filterKey] || '',
|
|
180
187
|
onChange: (event) => {
|
|
181
188
|
handlerChange(filterKey, event.target.value);
|
|
189
|
+
onSelectChange?.(event.target.value, {
|
|
190
|
+
filterKey,
|
|
191
|
+
setFilter: handlerChange,
|
|
192
|
+
filters,
|
|
193
|
+
});
|
|
182
194
|
},
|
|
183
195
|
}} options={options} placeholder={placeholder} helperText={helperText} isMutedWhenEmpty/>
|
|
184
196
|
</Show.When>
|
|
@@ -246,7 +258,7 @@ export function Filter({ filtersEnabledText, submitButton, resetButton, inputs,
|
|
|
246
258
|
}
|
|
247
259
|
return result;
|
|
248
260
|
}
|
|
249
|
-
: undefined} debounceDelay={debounceDelay} toggleButtonLabel={toggleButtonLabel} noOptionsText={noOptionsText} helperText={helperText} isMutedWhenEmpty/>);
|
|
261
|
+
: undefined} debounceDelay={debounceDelay} toggleButtonLabel={toggleButtonLabel} hideToggleButton={hideToggleButton} noOptionsText={noOptionsText} helperText={helperText} isMutedWhenEmpty/>);
|
|
250
262
|
})()}
|
|
251
263
|
</Show.When>
|
|
252
264
|
<Show.Else>
|