@clicoh/orion-library 1.1.0 → 1.2.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/assets/css/base.css +24 -1
- package/dist/components/01-atoms/Badge/Badge.d.ts +13 -3
- package/dist/components/01-atoms/Badge/Badge.d.ts.map +1 -1
- package/dist/components/01-atoms/Badge/Badge.jsx +21 -4
- package/dist/components/01-atoms/Badge/Badge.jsx.map +1 -1
- package/dist/components/01-atoms/Button/Button.d.ts +7 -1
- package/dist/components/01-atoms/Button/Button.d.ts.map +1 -1
- package/dist/components/01-atoms/Button/Button.jsx +46 -4
- package/dist/components/01-atoms/Button/Button.jsx.map +1 -1
- package/dist/components/01-atoms/IconButton/IconButton.d.ts +28 -0
- package/dist/components/01-atoms/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/01-atoms/IconButton/IconButton.jsx +32 -0
- package/dist/components/01-atoms/IconButton/IconButton.jsx.map +1 -0
- package/dist/components/01-atoms/IconButton/index.d.ts +2 -0
- package/dist/components/01-atoms/IconButton/index.d.ts.map +1 -0
- package/dist/components/01-atoms/IconButton/index.js +2 -0
- package/dist/components/01-atoms/IconButton/index.js.map +1 -0
- package/dist/components/01-atoms/Input/Input.d.ts +5 -1
- package/dist/components/01-atoms/Input/Input.d.ts.map +1 -1
- package/dist/components/01-atoms/Input/Input.jsx +12 -6
- package/dist/components/01-atoms/Input/Input.jsx.map +1 -1
- package/dist/components/01-atoms/Input/utils/border.d.ts +3 -1
- package/dist/components/01-atoms/Input/utils/border.d.ts.map +1 -1
- package/dist/components/01-atoms/Input/utils/border.js +3 -3
- package/dist/components/01-atoms/Input/utils/border.js.map +1 -1
- package/dist/components/01-atoms/MultiSelect/MultiSelect.jsx +2 -2
- package/dist/components/01-atoms/MultiSelect/MultiSelect.jsx.map +1 -1
- package/dist/components/01-atoms/ProgressBar/ProgressBar.d.ts +42 -0
- package/dist/components/01-atoms/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/components/01-atoms/ProgressBar/ProgressBar.jsx +52 -0
- package/dist/components/01-atoms/ProgressBar/ProgressBar.jsx.map +1 -0
- package/dist/components/01-atoms/ProgressBar/index.d.ts +2 -0
- package/dist/components/01-atoms/ProgressBar/index.d.ts.map +1 -0
- package/dist/components/01-atoms/ProgressBar/index.js +2 -0
- package/dist/components/01-atoms/ProgressBar/index.js.map +1 -0
- package/dist/components/01-atoms/Radio/Radio.d.ts +19 -2
- package/dist/components/01-atoms/Radio/Radio.d.ts.map +1 -1
- package/dist/components/01-atoms/Radio/Radio.jsx +51 -6
- package/dist/components/01-atoms/Radio/Radio.jsx.map +1 -1
- package/dist/components/01-atoms/Select/Select.d.ts +3 -1
- package/dist/components/01-atoms/Select/Select.d.ts.map +1 -1
- package/dist/components/01-atoms/Select/Select.jsx +8 -4
- package/dist/components/01-atoms/Select/Select.jsx.map +1 -1
- package/dist/components/01-atoms/Skeleton/Skeleton.d.ts +32 -0
- package/dist/components/01-atoms/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/01-atoms/Skeleton/Skeleton.jsx +34 -0
- package/dist/components/01-atoms/Skeleton/Skeleton.jsx.map +1 -0
- package/dist/components/01-atoms/Skeleton/index.d.ts +2 -0
- package/dist/components/01-atoms/Skeleton/index.d.ts.map +1 -0
- package/dist/components/01-atoms/Skeleton/index.js +2 -0
- package/dist/components/01-atoms/Skeleton/index.js.map +1 -0
- package/dist/components/01-atoms/SmallInput/SmallInput.jsx +1 -1
- package/dist/components/01-atoms/SmallInput/SmallInput.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 +4 -0
- package/dist/components/01-atoms/index.d.ts.map +1 -1
- package/dist/components/01-atoms/index.js +4 -0
- package/dist/components/01-atoms/index.js.map +1 -1
- package/dist/components/02-molecules/Accordion/Accordion.d.ts +15 -4
- package/dist/components/02-molecules/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/Accordion.jsx +20 -6
- package/dist/components/02-molecules/Accordion/Accordion.jsx.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionContext.d.ts +5 -1
- package/dist/components/02-molecules/Accordion/AccordionContext.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionContext.jsx +4 -3
- package/dist/components/02-molecules/Accordion/AccordionContext.jsx.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.d.ts +2 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.jsx +35 -8
- package/dist/components/02-molecules/Accordion/AccordionSection.jsx.map +1 -1
- package/dist/components/02-molecules/Accordion/index.d.ts +1 -0
- package/dist/components/02-molecules/Accordion/index.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/index.js.map +1 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.d.ts +10 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.jsx +29 -10
- package/dist/components/02-molecules/Autocomplete/Autocomplete.jsx.map +1 -1
- package/dist/components/02-molecules/DatePicker/DatePicker.d.ts +79 -0
- package/dist/components/02-molecules/DatePicker/DatePicker.d.ts.map +1 -0
- package/dist/components/02-molecules/DatePicker/DatePicker.jsx +229 -0
- package/dist/components/02-molecules/DatePicker/DatePicker.jsx.map +1 -0
- package/dist/components/02-molecules/DatePicker/index.d.ts +2 -0
- package/dist/components/02-molecules/DatePicker/index.d.ts.map +1 -0
- package/dist/components/02-molecules/DatePicker/index.js +2 -0
- package/dist/components/02-molecules/DatePicker/index.js.map +1 -0
- package/dist/components/02-molecules/Filter/Filter.d.ts +1 -0
- package/dist/components/02-molecules/Filter/Filter.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/Filter.jsx +25 -4
- package/dist/components/02-molecules/Filter/Filter.jsx.map +1 -1
- package/dist/components/02-molecules/Filter/index.d.ts +1 -0
- package/dist/components/02-molecules/Filter/index.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/index.js +1 -0
- package/dist/components/02-molecules/Filter/index.js.map +1 -1
- package/dist/components/02-molecules/Filter/types.d.ts +24 -5
- package/dist/components/02-molecules/Filter/types.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.d.ts +34 -0
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.d.ts.map +1 -0
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.js +70 -0
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.js.map +1 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewer.d.ts +55 -5
- package/dist/components/02-molecules/ImageViewer/ImageViewer.d.ts.map +1 -1
- package/dist/components/02-molecules/ImageViewer/ImageViewer.jsx +118 -27
- package/dist/components/02-molecules/ImageViewer/ImageViewer.jsx.map +1 -1
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.d.ts +40 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.d.ts.map +1 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.jsx +108 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.jsx.map +1 -0
- package/dist/components/02-molecules/InlineMessage/InlineMessage.d.ts +37 -0
- package/dist/components/02-molecules/InlineMessage/InlineMessage.d.ts.map +1 -0
- package/dist/components/02-molecules/InlineMessage/InlineMessage.jsx +59 -0
- package/dist/components/02-molecules/InlineMessage/InlineMessage.jsx.map +1 -0
- package/dist/components/02-molecules/InlineMessage/index.d.ts +2 -0
- package/dist/components/02-molecules/InlineMessage/index.d.ts.map +1 -0
- package/dist/components/02-molecules/InlineMessage/index.js +2 -0
- package/dist/components/02-molecules/InlineMessage/index.js.map +1 -0
- 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 +7 -5
- package/dist/components/02-molecules/Modal/Modal.jsx.map +1 -1
- package/dist/components/02-molecules/index.d.ts +3 -0
- package/dist/components/02-molecules/index.d.ts.map +1 -1
- package/dist/components/02-molecules/index.js +3 -0
- package/dist/components/02-molecules/index.js.map +1 -1
- package/dist/components/03-organisms/MapView/MapView.d.ts +73 -0
- package/dist/components/03-organisms/MapView/MapView.d.ts.map +1 -0
- package/dist/components/03-organisms/MapView/MapView.jsx +228 -0
- package/dist/components/03-organisms/MapView/MapView.jsx.map +1 -0
- package/dist/components/03-organisms/MapView/index.d.ts +2 -0
- package/dist/components/03-organisms/MapView/index.d.ts.map +1 -0
- package/dist/components/03-organisms/MapView/index.js +2 -0
- package/dist/components/03-organisms/MapView/index.js.map +1 -0
- package/dist/components/03-organisms/index.d.ts +1 -0
- package/dist/components/03-organisms/index.d.ts.map +1 -1
- package/dist/components/03-organisms/index.js +1 -0
- package/dist/components/03-organisms/index.js.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx +2 -2
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx.map +1 -1
- package/dist/components/04-templates/SideFilterTemplate/SideFilterTemplate.d.ts.map +1 -1
- package/dist/components/04-templates/SideFilterTemplate/SideFilterTemplate.jsx +4 -1
- package/dist/components/04-templates/SideFilterTemplate/SideFilterTemplate.jsx.map +1 -1
- package/package.json +5 -2
- package/tailwind.config.ts +10 -0
package/assets/css/base.css
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import 'react-toastify/dist/ReactToastify.min.css' layer(base);
|
|
2
|
+
@import 'leaflet/dist/leaflet.css' layer(base);
|
|
2
3
|
|
|
3
4
|
@import 'tailwindcss';
|
|
4
5
|
|
|
@@ -96,6 +97,18 @@
|
|
|
96
97
|
--background-image-clicoh: linear-gradient(135deg, #6a5df9, #c854e4);
|
|
97
98
|
--background-image-brand-shipping: linear-gradient(135deg, #5683dd, #8ee3c6);
|
|
98
99
|
--background-image-brand-full: linear-gradient(135deg, #cfbdb2, #cf86f4);
|
|
100
|
+
|
|
101
|
+
--animate-progress-indeterminate: progress-indeterminate 1.5s ease-in-out
|
|
102
|
+
infinite;
|
|
103
|
+
|
|
104
|
+
@keyframes progress-indeterminate {
|
|
105
|
+
from {
|
|
106
|
+
transform: translateX(-100%);
|
|
107
|
+
}
|
|
108
|
+
to {
|
|
109
|
+
transform: translateX(250%);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
99
112
|
}
|
|
100
113
|
|
|
101
114
|
/*
|
|
@@ -125,7 +138,7 @@
|
|
|
125
138
|
|
|
126
139
|
.dark {
|
|
127
140
|
--body-text-color: var(--color-white);
|
|
128
|
-
--body-bg-color: var(--color-black);
|
|
141
|
+
--body-bg-color: var(--color-black-1);
|
|
129
142
|
color-scheme: dark;
|
|
130
143
|
}
|
|
131
144
|
|
|
@@ -179,3 +192,13 @@ body {
|
|
|
179
192
|
.dark .Toastify__close-button {
|
|
180
193
|
color: var(--color-white);
|
|
181
194
|
}
|
|
195
|
+
|
|
196
|
+
.orion-map-pin {
|
|
197
|
+
background: transparent;
|
|
198
|
+
border: none;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.leaflet-container {
|
|
202
|
+
font: inherit;
|
|
203
|
+
z-index: 0;
|
|
204
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
type BadgeProps = {
|
|
3
|
-
modifier: 'success' | 'warning' | 'error' | 'info' | 'progress' | 'disabled' | 'violet' | 'cyan' | 'olive' | 'amber';
|
|
3
|
+
modifier: 'success' | 'warning' | 'error' | 'info' | 'progress' | 'disabled' | 'violet' | 'cyan' | 'olive' | 'amber' | 'neutral';
|
|
4
4
|
accentLabel?: boolean;
|
|
5
|
+
icon?: ReactNode;
|
|
5
6
|
} & HTMLAttributes<HTMLSpanElement>;
|
|
6
7
|
/**
|
|
7
8
|
* Badge component used for indicating different statuses.
|
|
@@ -10,6 +11,10 @@ type BadgeProps = {
|
|
|
10
11
|
* label takes that same color, for outline pills meant to be told apart by hue
|
|
11
12
|
* alone; without it the label keeps the default text color.
|
|
12
13
|
*
|
|
14
|
+
* `neutral` is the one filled variant: a gray chip without the status dot, for
|
|
15
|
+
* informative attributes (a time window, a count) that carry no status. It is
|
|
16
|
+
* the only modifier meant to be paired with `icon`.
|
|
17
|
+
*
|
|
13
18
|
* @component
|
|
14
19
|
* @example
|
|
15
20
|
* // Default label color
|
|
@@ -19,13 +24,18 @@ type BadgeProps = {
|
|
|
19
24
|
* // Label in the modifier color
|
|
20
25
|
* <Badge modifier="info" accentLabel>Reviewing</Badge>
|
|
21
26
|
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Filled informative chip with an icon
|
|
29
|
+
* <Badge modifier="neutral" icon={<FiClock />}>08:00–12:00</Badge>
|
|
30
|
+
*
|
|
22
31
|
* @param {Object} props - The properties of the Badge component.
|
|
23
|
-
* @param {'success' | 'warning' | 'error' | 'info' | 'progress' | 'disabled' | 'violet' | 'cyan' | 'olive' | 'amber'} props.modifier - The modifier to determine the badge style.
|
|
32
|
+
* @param {'success' | 'warning' | 'error' | 'info' | 'progress' | 'disabled' | 'violet' | 'cyan' | 'olive' | 'amber' | 'neutral'} props.modifier - The modifier to determine the badge style.
|
|
24
33
|
* @param {boolean} [props.accentLabel] - Whether the label takes the modifier color.
|
|
34
|
+
* @param {ReactNode} [props.icon] - Small icon rendered before the label. Sized by the badge; pass the bare icon element.
|
|
25
35
|
* @param {ReactNode} props.children - The content to be displayed inside the badge.
|
|
26
36
|
*
|
|
27
37
|
* @returns {ReactNode} The rendered Badge component.
|
|
28
38
|
*/
|
|
29
|
-
export declare function Badge({ modifier, accentLabel, children, ...restProps }: BadgeProps): ReactNode;
|
|
39
|
+
export declare function Badge({ modifier, accentLabel, icon, children, ...restProps }: BadgeProps): ReactNode;
|
|
30
40
|
export {};
|
|
31
41
|
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,KAAK,UAAU,GAAG;IAChB,QAAQ,EACJ,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Badge/Badge.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,KAAK,UAAU,GAAG;IAChB,QAAQ,EACJ,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,GACR,MAAM,GACN,OAAO,GACP,OAAO,GACP,SAAS,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC;AAyDpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,UAAU,GAAG,SAAS,CA+BxB"}
|
|
@@ -11,6 +11,7 @@ const styleMap = {
|
|
|
11
11
|
cyan: clsx('border-cyan before:bg-cyan dark:border-cyan-dark dark:before:bg-cyan-dark'),
|
|
12
12
|
olive: clsx('border-olive before:bg-olive dark:border-olive-dark dark:before:bg-olive-dark'),
|
|
13
13
|
amber: clsx('border-amber before:bg-amber dark:border-amber-dark dark:before:bg-amber-dark'),
|
|
14
|
+
neutral: clsx('border-gray-6 bg-gray-6 dark:border-gray-dark-1 dark:bg-gray-dark-1'),
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* `warning` es la unica que no usa su propio token para la etiqueta: #FFC34C
|
|
@@ -28,6 +29,7 @@ const accentLabelMap = {
|
|
|
28
29
|
cyan: clsx('text-cyan dark:text-cyan-dark'),
|
|
29
30
|
olive: clsx('text-olive dark:text-olive-dark'),
|
|
30
31
|
amber: clsx('text-amber dark:text-amber-dark'),
|
|
32
|
+
neutral: clsx('text-gray-1 dark:text-gray-2'),
|
|
31
33
|
};
|
|
32
34
|
/**
|
|
33
35
|
* Badge component used for indicating different statuses.
|
|
@@ -36,6 +38,10 @@ const accentLabelMap = {
|
|
|
36
38
|
* label takes that same color, for outline pills meant to be told apart by hue
|
|
37
39
|
* alone; without it the label keeps the default text color.
|
|
38
40
|
*
|
|
41
|
+
* `neutral` is the one filled variant: a gray chip without the status dot, for
|
|
42
|
+
* informative attributes (a time window, a count) that carry no status. It is
|
|
43
|
+
* the only modifier meant to be paired with `icon`.
|
|
44
|
+
*
|
|
39
45
|
* @component
|
|
40
46
|
* @example
|
|
41
47
|
* // Default label color
|
|
@@ -45,17 +51,28 @@ const accentLabelMap = {
|
|
|
45
51
|
* // Label in the modifier color
|
|
46
52
|
* <Badge modifier="info" accentLabel>Reviewing</Badge>
|
|
47
53
|
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Filled informative chip with an icon
|
|
56
|
+
* <Badge modifier="neutral" icon={<FiClock />}>08:00–12:00</Badge>
|
|
57
|
+
*
|
|
48
58
|
* @param {Object} props - The properties of the Badge component.
|
|
49
|
-
* @param {'success' | 'warning' | 'error' | 'info' | 'progress' | 'disabled' | 'violet' | 'cyan' | 'olive' | 'amber'} props.modifier - The modifier to determine the badge style.
|
|
59
|
+
* @param {'success' | 'warning' | 'error' | 'info' | 'progress' | 'disabled' | 'violet' | 'cyan' | 'olive' | 'amber' | 'neutral'} props.modifier - The modifier to determine the badge style.
|
|
50
60
|
* @param {boolean} [props.accentLabel] - Whether the label takes the modifier color.
|
|
61
|
+
* @param {ReactNode} [props.icon] - Small icon rendered before the label. Sized by the badge; pass the bare icon element.
|
|
51
62
|
* @param {ReactNode} props.children - The content to be displayed inside the badge.
|
|
52
63
|
*
|
|
53
64
|
* @returns {ReactNode} The rendered Badge component.
|
|
54
65
|
*/
|
|
55
|
-
export function Badge({ modifier, accentLabel, children, ...restProps }) {
|
|
56
|
-
const
|
|
66
|
+
export function Badge({ modifier, accentLabel, icon, children, ...restProps }) {
|
|
67
|
+
const hasDot = modifier !== 'neutral';
|
|
68
|
+
const className = clsx('relative inline-block rounded-full border py-1 pr-2', hasDot
|
|
69
|
+
? 'pl-6 before:absolute before:start-3 before:top-[50%] before:-mt-1 before:block before:h-[6px] before:w-[6px] before:rounded-full'
|
|
70
|
+
: 'pl-2.5', styleMap[modifier], restProps.className);
|
|
57
71
|
return (<span {...restProps} className={className}>
|
|
58
|
-
<Paragraph size="chips" className={clsx('text-nowrap', accentLabel ? accentLabelMap[modifier] : 'dark:text-white')}>
|
|
72
|
+
<Paragraph size="chips" className={clsx('text-nowrap', !!icon && 'flex items-center gap-1', accentLabel ? accentLabelMap[modifier] : 'dark:text-white')}>
|
|
73
|
+
{!!icon && (<span aria-hidden="true" className="inline-flex text-[11px]">
|
|
74
|
+
{icon}
|
|
75
|
+
</span>)}
|
|
59
76
|
{children}
|
|
60
77
|
</Paragraph>
|
|
61
78
|
</span>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAmBzC,MAAM,QAAQ,GAA2C;IACvD,OAAO,EAAE,IAAI,CACX,uFAAuF,CACxF;IACD,OAAO,EAAE,IAAI,CACX,uFAAuF,CACxF;IACD,KAAK,EAAE,IAAI,CACT,+EAA+E,CAChF;IACD,IAAI,EAAE,IAAI,CACR,2EAA2E,CAC5E;IACD,QAAQ,EAAE,IAAI,CACZ,2FAA2F,CAC5F;IACD,QAAQ,EAAE,IAAI,CACZ,yEAAyE,CAC1E;IACD,MAAM,EAAE,IAAI,CACV,mFAAmF,CACpF;IACD,IAAI,EAAE,IAAI,CACR,2EAA2E,CAC5E;IACD,KAAK,EAAE,IAAI,CACT,+EAA+E,CAChF;IACD,KAAK,EAAE,IAAI,CACT,+EAA+E,CAChF;IACD,OAAO,EAAE,IAAI,CACX,qEAAqE,CACtE;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,cAAc,GAA2C;IAC7D,OAAO,EAAE,IAAI,CAAC,qCAAqC,CAAC;IACpD,OAAO,EAAE,IAAI,CAAC,mCAAmC,CAAC;IAClD,KAAK,EAAE,IAAI,CAAC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AI,CAAC,CACR,CACD;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,SAAS,CACb;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
export type ButtonProps = {
|
|
3
3
|
modifier?: ButtonsVariants;
|
|
4
|
+
size?: ButtonSize;
|
|
5
|
+
tone?: ButtonTone;
|
|
4
6
|
iconL?: ReactNode;
|
|
5
7
|
iconR?: ReactNode;
|
|
6
8
|
} & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
7
9
|
export type ButtonsVariants = 'principal' | 'second' | 'text' | 'action';
|
|
10
|
+
export type ButtonSize = 'md' | 'field' | 'sm';
|
|
11
|
+
export type ButtonTone = 'default' | 'critical';
|
|
8
12
|
/**
|
|
9
13
|
* Represents a button component with different modifiers.
|
|
10
14
|
*
|
|
@@ -15,6 +19,8 @@ export type ButtonsVariants = 'principal' | 'second' | 'text' | 'action';
|
|
|
15
19
|
*
|
|
16
20
|
* @param {Object} props - The properties of the Button component.
|
|
17
21
|
* @param {'principal' | 'second' | 'text' | 'action'} [props.modifier='principal'] - The modifier for styling the button.
|
|
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.
|
|
18
24
|
* @param {ReactNode} [props.iconL] - The icon to be displayed to the left of the button text.
|
|
19
25
|
* @param {ReactNode} [props.iconR] - The icon to be displayed to the right of the button text.
|
|
20
26
|
* @param {ReactNode} props.children - The content to be displayed inside the button.
|
|
@@ -22,5 +28,5 @@ export type ButtonsVariants = 'principal' | 'second' | 'text' | 'action';
|
|
|
22
28
|
*
|
|
23
29
|
* @returns {ReactNode} The rendered Button component.
|
|
24
30
|
*/
|
|
25
|
-
export declare function Button({ modifier, iconL, iconR, children, ...restProps }: ButtonProps): ReactNode;
|
|
31
|
+
export declare function Button({ modifier, size, tone, iconL, iconR, children, ...restProps }: ButtonProps): ReactNode;
|
|
26
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,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;
|
|
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"}
|
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
+
const sizeMap = {
|
|
3
|
+
md: {
|
|
4
|
+
base: 'py-[10px] text-sm',
|
|
5
|
+
padL: 'pl-6',
|
|
6
|
+
padR: 'pr-6',
|
|
7
|
+
iconPadL: 'pl-4',
|
|
8
|
+
iconPadR: 'pr-4',
|
|
9
|
+
icon: 'text-base',
|
|
10
|
+
},
|
|
11
|
+
field: {
|
|
12
|
+
base: 'py-1.5 text-sm',
|
|
13
|
+
padL: 'pl-5',
|
|
14
|
+
padR: 'pr-5',
|
|
15
|
+
iconPadL: 'pl-4',
|
|
16
|
+
iconPadR: 'pr-4',
|
|
17
|
+
icon: 'text-base',
|
|
18
|
+
},
|
|
19
|
+
sm: {
|
|
20
|
+
base: 'py-1 text-xs',
|
|
21
|
+
padL: 'pl-4',
|
|
22
|
+
padR: 'pr-4',
|
|
23
|
+
iconPadL: 'pl-3',
|
|
24
|
+
iconPadR: 'pr-3',
|
|
25
|
+
icon: 'text-sm',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
2
28
|
const styleMap = {
|
|
3
29
|
principal: clsx('text-white not-disabled:hover:text-black not-disabled:active:text-black disabled:text-white [&:not(:disabled):not(:hover)]:focus:text-white', 'disabled:before:bg-gray-3 not-disabled:active:before:bg-gray-6 before:bg-black not-disabled:hover:before:bg-white [&:not(:disabled):not(:hover)]:focus:before:bg-black', 'disabled:after:bg-gray-3 [&:not(:disabled):not(:hover)]:focus:after:bg-clicoh not-disabled:hover:after:bg-clicoh not-disabled:active:after:bg-clicoh after:bg-black', 'dark:not-disabled:active:text-gray-6 dark:text-black dark:not-disabled:hover:text-white dark:disabled:text-white dark:[&:not(:disabled):not(:hover)]:focus:text-black', 'dark:disabled:before:bg-gray-1 dark:[&:not(:disabled):not(:hover)]:focus:before:bg-gray-5 dark:before:bg-white dark:not-disabled:hover:before:bg-black dark:not-disabled:active:before:bg-black', 'dark:disabled:after:bg-gray-1 dark:[&:not(:disabled):not(:hover)]:focus:after:bg-gray-5 dark:not-disabled:hover:after:bg-clicoh dark:not-disabled:active:after:bg-clicoh dark:after:bg-white'),
|
|
4
30
|
second: clsx('text-gray-1 disabled:text-gray-3 [&:not(:disabled):not(:hover)]:focus:text-gray-1 not-disabled:active:text-gray-5 not-disabled:hover:text-white', 'disable:before:bg-white [&:not(:disabled):not(:hover)]:focus:before:bg-gray-6 before:bg-white not-disabled:hover:before:bg-black not-disabled:active:before:bg-black', 'after:bg-gray-1 disabled:after:bg-gray-3 [&:not(:disabled):not(:hover)]:focus:after:bg-gray-1 not-disabled:hover:after:bg-black not-disabled:active:after:bg-black', '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-6 dark:before:bg-black dark:not-disabled:hover:before:bg-white dark:disabled:before:bg-white dark:[&:not(:disabled):not(:hover)]:focus:before:bg-black', 'dark:disabled:after:bg-gray-2 dark:[&:not(:disabled):not(:hover)]:focus:after:bg-gray-5 dark:not-disabled:active:after:bg-gray-6 dark:after:bg-white dark:not-disabled:hover:after:bg-white'),
|
|
5
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'),
|
|
6
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'),
|
|
7
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
|
+
};
|
|
8
46
|
/**
|
|
9
47
|
* Represents a button component with different modifiers.
|
|
10
48
|
*
|
|
@@ -15,6 +53,8 @@ const styleMap = {
|
|
|
15
53
|
*
|
|
16
54
|
* @param {Object} props - The properties of the Button component.
|
|
17
55
|
* @param {'principal' | 'second' | 'text' | 'action'} [props.modifier='principal'] - The modifier for styling the button.
|
|
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.
|
|
18
58
|
* @param {ReactNode} [props.iconL] - The icon to be displayed to the left of the button text.
|
|
19
59
|
* @param {ReactNode} [props.iconR] - The icon to be displayed to the right of the button text.
|
|
20
60
|
* @param {ReactNode} props.children - The content to be displayed inside the button.
|
|
@@ -22,12 +62,14 @@ const styleMap = {
|
|
|
22
62
|
*
|
|
23
63
|
* @returns {ReactNode} The rendered Button component.
|
|
24
64
|
*/
|
|
25
|
-
export function Button({ modifier = 'principal', iconL, iconR, children, ...restProps }) {
|
|
26
|
-
const
|
|
65
|
+
export function Button({ modifier = 'principal', size = 'md', tone = 'default', iconL, iconR, children, ...restProps }) {
|
|
66
|
+
const sizing = sizeMap[size];
|
|
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);
|
|
27
69
|
return (<button {...restProps} className={className}>
|
|
28
|
-
{!!iconL && <span className=
|
|
70
|
+
{!!iconL && <span className={clsx('pr-2', sizing.icon)}>{iconL}</span>}
|
|
29
71
|
<span>{children}</span>
|
|
30
|
-
{!!iconR && <span className=
|
|
72
|
+
{!!iconR && <span className={clsx('pl-2', sizing.icon)}>{iconR}</span>}
|
|
31
73
|
</button>);
|
|
32
74
|
}
|
|
33
75
|
//# sourceMappingURL=Button.jsx.map
|
|
@@ -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;C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+
icon: ReactNode;
|
|
5
|
+
label: string;
|
|
6
|
+
tooltipPlacement?: ComponentProps<typeof Tooltip>['placement'];
|
|
7
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'aria-label'>;
|
|
8
|
+
/**
|
|
9
|
+
* Button that shows only an icon, for secondary actions in dense rows (lists,
|
|
10
|
+
* timelines, cards). The `label` is required because the icon alone says
|
|
11
|
+
* nothing to a screen reader or to someone who does not recognise it: it
|
|
12
|
+
* becomes the accessible name and the tooltip shown on hover and focus.
|
|
13
|
+
*
|
|
14
|
+
* @component
|
|
15
|
+
* @example
|
|
16
|
+
* // Example usage of IconButton component
|
|
17
|
+
* <IconButton icon={<FiInfo />} label="See details" onClick={openDetails} />
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} props - The properties of the IconButton component.
|
|
20
|
+
* @param {ReactNode} props.icon - The icon to render. Sized by the button's font size (16px).
|
|
21
|
+
* @param {string} props.label - Accessible name of the button and text of its tooltip.
|
|
22
|
+
* @param {UseFloatingOptions['placement']} [props.tooltipPlacement='top'] - Placement of the tooltip relative to the button.
|
|
23
|
+
* @param {ButtonHTMLAttributes<HTMLButtonElement>} restProps - Additional properties for the button element. `type` defaults to `button`.
|
|
24
|
+
*
|
|
25
|
+
* @returns {ReactNode} The rendered IconButton component.
|
|
26
|
+
*/
|
|
27
|
+
export declare function IconButton({ icon, label, tooltipPlacement, type, ...restProps }: IconButtonProps): ReactNode;
|
|
28
|
+
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/IconButton/IconButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC;CAChE,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,gBAAwB,EACxB,IAAe,EACf,GAAG,SAAS,EACb,EAAE,eAAe,GAAG,SAAS,CAuB7B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { Tooltip } from '../Tooltip';
|
|
3
|
+
/**
|
|
4
|
+
* Button that shows only an icon, for secondary actions in dense rows (lists,
|
|
5
|
+
* timelines, cards). The `label` is required because the icon alone says
|
|
6
|
+
* nothing to a screen reader or to someone who does not recognise it: it
|
|
7
|
+
* becomes the accessible name and the tooltip shown on hover and focus.
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
* @example
|
|
11
|
+
* // Example usage of IconButton component
|
|
12
|
+
* <IconButton icon={<FiInfo />} label="See details" onClick={openDetails} />
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} props - The properties of the IconButton component.
|
|
15
|
+
* @param {ReactNode} props.icon - The icon to render. Sized by the button's font size (16px).
|
|
16
|
+
* @param {string} props.label - Accessible name of the button and text of its tooltip.
|
|
17
|
+
* @param {UseFloatingOptions['placement']} [props.tooltipPlacement='top'] - Placement of the tooltip relative to the button.
|
|
18
|
+
* @param {ButtonHTMLAttributes<HTMLButtonElement>} restProps - Additional properties for the button element. `type` defaults to `button`.
|
|
19
|
+
*
|
|
20
|
+
* @returns {ReactNode} The rendered IconButton component.
|
|
21
|
+
*/
|
|
22
|
+
export function IconButton({ icon, label, tooltipPlacement = 'top', type = 'button', ...restProps }) {
|
|
23
|
+
const className = clsx('flex items-center justify-center rounded-sm p-2 text-base transition-colors', 'text-gray-1 disabled:text-gray-3 not-disabled:hover:bg-black not-disabled:hover:text-white disabled:cursor-not-allowed', 'dark:text-gray-5 dark:disabled:text-gray-2 dark:not-disabled:hover:bg-white dark:not-disabled:hover:text-black', 'focus-visible:ring-lavender dark:focus-visible:ring-lavender-dark focus-visible:ring-2 focus-visible:outline-none', restProps.className);
|
|
24
|
+
return (<Tooltip message={label} placement={tooltipPlacement}>
|
|
25
|
+
<button {...restProps} type={type} aria-label={label} className={className}>
|
|
26
|
+
<span aria-hidden="true" className="flex">
|
|
27
|
+
{icon}
|
|
28
|
+
</span>
|
|
29
|
+
</button>
|
|
30
|
+
</Tooltip>);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=IconButton.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQrC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,gBAAgB,GAAG,KAAK,EACxB,IAAI,GAAG,QAAQ,EACf,GAAG,SAAS,EACI;IAChB,MAAM,SAAS,GAAG,IAAI,CACpB,6EAA6E,EAC7E,wHAAwH,EACxH,gHAAgH,EAChH,mHAAmH,EACnH,SAAS,CAAC,SAAS,CACpB,CAAC;IAEF,OAAO,CACL,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CACnD;MAAA,CAAC,MAAM,CACL,IAAI,SAAS,CAAC,CACd,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,UAAU,CAAC,CAAC,KAAK,CAAC,CAClB,SAAS,CAAC,CAAC,SAAS,CAAC,CAErB;QAAA,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CACvC;UAAA,CAAC,IAAI,CACP;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,MAAM,CACV;IAAA,EAAE,OAAO,CAAC,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/IconButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/01-atoms/IconButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -9,6 +9,8 @@ type InputProps = {
|
|
|
9
9
|
iconL?: ReactNode;
|
|
10
10
|
iconR?: ReactNode;
|
|
11
11
|
isMutedWhenEmpty?: boolean;
|
|
12
|
+
hideLabel?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
12
14
|
showPasswordAriaLabel?: string;
|
|
13
15
|
hidePasswordAriaLabel?: string;
|
|
14
16
|
};
|
|
@@ -35,9 +37,11 @@ type InputProps = {
|
|
|
35
37
|
* @param {ReactNode} [props.iconL] - Optional icon to be displayed to the left of the input field.
|
|
36
38
|
* @param {ReactNode} [props.iconR] - Optional icon to be displayed to the right of the input field.
|
|
37
39
|
* @param {boolean} [props.isMutedWhenEmpty] - Renders the border and label in gray while the field has no value.
|
|
40
|
+
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only and drops the floating label and its border notch. Use it when a heading outside the field already names it.
|
|
41
|
+
* @param {string} [props.placeholder] - Placeholder shown inside the field. Only rendered together with `hideLabel`; otherwise the floating label takes that place.
|
|
38
42
|
*
|
|
39
43
|
* @returns {ReactNode} The rendered Input component.
|
|
40
44
|
*/
|
|
41
|
-
export declare function Input({ label, input, helperText, error, iconL, iconR, isMutedWhenEmpty, showPasswordAriaLabel, hidePasswordAriaLabel, }: InputProps): ReactNode;
|
|
45
|
+
export declare function Input({ label, input, helperText, error, iconL, iconR, isMutedWhenEmpty, hideLabel, placeholder, showPasswordAriaLabel, hidePasswordAriaLabel, }: InputProps): ReactNode;
|
|
42
46
|
export {};
|
|
43
47
|
//# sourceMappingURL=Input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAKf,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CACR,iBAAiB,CACf,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,gBAAgB,CACjB,CAAC,MAAM,CAAC,EACT,QAAQ,GAAG,UAAU,GAAG,OAAO,CAChC,CAAC;KACH,GAAG,IAAI,CACN,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EAC1E,aAAa,CACd,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Input/Input.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAKf,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CACR,iBAAiB,CACf,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,gBAAgB,CACjB,CAAC,MAAM,CAAC,EACT,QAAQ,GAAG,UAAU,GAAG,OAAO,CAChC,CAAC;KACH,GAAG,IAAI,CACN,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EAC1E,aAAa,CACd,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,KAAK,EACL,KAAK,EACL,gBAAgB,EAChB,SAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,GACtB,EAAE,UAAU,GAAG,SAAS,CA2GxB"}
|
|
@@ -27,10 +27,12 @@ import { RenderErrorOrHelperText } from './utils/RenderErrorOrHelperText';
|
|
|
27
27
|
* @param {ReactNode} [props.iconL] - Optional icon to be displayed to the left of the input field.
|
|
28
28
|
* @param {ReactNode} [props.iconR] - Optional icon to be displayed to the right of the input field.
|
|
29
29
|
* @param {boolean} [props.isMutedWhenEmpty] - Renders the border and label in gray while the field has no value.
|
|
30
|
+
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only and drops the floating label and its border notch. Use it when a heading outside the field already names it.
|
|
31
|
+
* @param {string} [props.placeholder] - Placeholder shown inside the field. Only rendered together with `hideLabel`; otherwise the floating label takes that place.
|
|
30
32
|
*
|
|
31
33
|
* @returns {ReactNode} The rendered Input component.
|
|
32
34
|
*/
|
|
33
|
-
export function Input({ label, input, helperText, error, iconL, iconR, isMutedWhenEmpty, showPasswordAriaLabel, hidePasswordAriaLabel, }) {
|
|
35
|
+
export function Input({ label, input, helperText, error, iconL, iconR, isMutedWhenEmpty, hideLabel = false, placeholder, showPasswordAriaLabel, hidePasswordAriaLabel, }) {
|
|
34
36
|
const generatedId = useId();
|
|
35
37
|
const [showPassword, setShowPassword] = useState(false);
|
|
36
38
|
const id = input.id ?? generatedId;
|
|
@@ -39,9 +41,11 @@ export function Input({ label, input, helperText, error, iconL, iconR, isMutedWh
|
|
|
39
41
|
undefined;
|
|
40
42
|
const isPassword = input.type === 'password';
|
|
41
43
|
const effectiveType = isPassword && showPassword ? 'text' : input.type;
|
|
42
|
-
const inputClasses = clsx('peer disabled:text-gray-3 dark:disabled:text-gray-2 h-full w-full rounded-full bg-transparent
|
|
44
|
+
const inputClasses = clsx('peer disabled:text-gray-3 dark:disabled:text-gray-2 h-full w-full rounded-full bg-transparent text-sm font-normal text-black outline-0 transition-all focus:text-black dark:bg-black dark:text-white dark:focus:text-white', iconL ? 'pr-5 pl-11' : 'px-5', hideLabel && 'placeholder:text-gray-2 dark:placeholder:text-gray-2', input.className);
|
|
43
45
|
const { labelProps, legendClasses, fieldsetClasses } = generateBorder(error, {
|
|
44
46
|
isMutedWhenEmpty,
|
|
47
|
+
hideLabel,
|
|
48
|
+
hasIconL: Boolean(iconL),
|
|
45
49
|
});
|
|
46
50
|
labelProps.htmlFor = id;
|
|
47
51
|
const rightSlot = isPassword ? (<button type="button" onClick={() => setShowPassword((prev) => !prev)} aria-pressed={showPassword} aria-label={showPassword ? hidePasswordAriaLabel : showPasswordAriaLabel} disabled={input.disabled} className={clsx('disabled:text-gray-3 dark:disabled:text-gray-2 flex cursor-pointer items-center justify-center rounded-full p-1 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-black/20 disabled:cursor-not-allowed dark:focus-visible:ring-white/30', error
|
|
@@ -51,12 +55,14 @@ export function Input({ label, input, helperText, error, iconL, iconR, isMutedWh
|
|
|
51
55
|
</button>) : (iconR);
|
|
52
56
|
return (<div className="w-full max-w-full">
|
|
53
57
|
<div className="relative h-9">
|
|
54
|
-
<input {...input} id={id} type={effectiveType} className={inputClasses} placeholder=
|
|
55
|
-
<label {
|
|
58
|
+
<input {...input} id={id} type={effectiveType} className={inputClasses} placeholder={hideLabel ? placeholder || ' ' : ' '} aria-invalid={error ? true : input['aria-invalid']} aria-describedby={describedBy}/>
|
|
59
|
+
{hideLabel ? (<label htmlFor={id} className="sr-only">
|
|
60
|
+
{label}
|
|
61
|
+
</label>) : (<label {...labelProps}>{label}</label>)}
|
|
56
62
|
<fieldset aria-hidden="true" className={fieldsetClasses}>
|
|
57
|
-
<legend className={legendClasses}>{label}</legend>
|
|
63
|
+
{!hideLabel && <legend className={legendClasses}>{label}</legend>}
|
|
58
64
|
</fieldset>
|
|
59
|
-
{!!iconL && (<span aria-hidden="true" className={clsx('peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 absolute top-
|
|
65
|
+
{!!iconL && (<span aria-hidden="true" className={clsx('peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 absolute top-1/2 left-4 flex -translate-y-1/2 items-center', error
|
|
60
66
|
? 'text-error dark:text-error-dark'
|
|
61
67
|
: 'text-black dark:text-white')}>
|
|
62
68
|
{iconL}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Input/Input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,KAAK,EACL,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,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qH,EACrH,KAAK;gBACH,CAAC,CAAC,iCAAiC;gBACnC,CAAC,CAAC,4BAA4B,CACjC,CAAC,CAEF;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,IAAI,CAAC,CACR,CACD;QAAA,CAAC,CAAC,CAAC,SAAS,IAAI,CACd,CAAC,IAAI,CACH,SAAS,CAAC,CAAC,IAAI,CACb,iFAAiF,EACjF,KAAK;gBACH,CAAC,CAAC,iCAAiC;gBACnC,CAAC,CAAC,4BAA4B,CACjC,CAAC,CAEF;YAAA,CAAC,SAAS,CACZ;UAAA,EAAE,IAAI,CAAC,CACR,CACH;MAAA,EAAE,GAAG,CACL;MAAA,CAAC,uBAAuB,CACtB,EAAE,CAAC,CAAC,aAAa,CAAC,CAClB,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzB,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,SAAS,CAAC,MAAM,EAEpB;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
type BorderOptions = {
|
|
2
2
|
isMuted?: boolean;
|
|
3
3
|
isMutedWhenEmpty?: boolean;
|
|
4
|
+
hideLabel?: boolean;
|
|
5
|
+
hasIconL?: boolean;
|
|
4
6
|
};
|
|
5
|
-
export declare const generateBorder: (error?: string, { isMuted, isMutedWhenEmpty }?: BorderOptions) => {
|
|
7
|
+
export declare const generateBorder: (error?: string, { isMuted, isMutedWhenEmpty, hideLabel, hasIconL }?: BorderOptions) => {
|
|
6
8
|
labelProps: {
|
|
7
9
|
htmlFor?: string;
|
|
8
10
|
className: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../../../../src/components/01-atoms/Input/utils/border.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"border.d.ts","sourceRoot":"","sources":["../../../../../src/components/01-atoms/Input/utils/border.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,WACjB,MAAM,uDACsC,aAAa;;kBAEnC,MAAM;mBAAa,MAAM;;;;CAuCxD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
export const generateBorder = (error, { isMuted, isMutedWhenEmpty } = {}) => {
|
|
2
|
+
export const generateBorder = (error, { isMuted, isMutedWhenEmpty, hideLabel, hasIconL } = {}) => {
|
|
3
3
|
const labelProps = {
|
|
4
|
-
className: clsx('pointer-events-none absolute -top-2 left-[1.0625rem] truncate overflow-visible px-1 text-xs leading-tight transition-all select-none', 'peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 peer-not-empty:-top-2 peer-not-empty:text-xs peer-placeholder-shown:top-2.5 peer-placeholder-shown:text-sm peer-placeholder-shown:leading-tight peer-autofill:-top-2 peer-autofill:text-xs peer-focus:-top-2 peer-focus:text-xs', error
|
|
4
|
+
className: clsx('pointer-events-none absolute -top-2 left-[1.0625rem] truncate overflow-visible px-1 text-xs leading-tight transition-all select-none', 'peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 peer-not-empty:-top-2 peer-not-empty:text-xs peer-placeholder-shown:top-2.5 peer-placeholder-shown:text-sm peer-placeholder-shown:leading-tight peer-autofill:-top-2 peer-autofill:text-xs peer-focus:-top-2 peer-focus:text-xs', hasIconL && 'peer-[:placeholder-shown:not(:focus)]:left-10', error
|
|
5
5
|
? 'text-error dark:text-error-dark'
|
|
6
6
|
: isMuted
|
|
7
7
|
? 'text-gray-2 dark:text-gray-2'
|
|
@@ -9,7 +9,7 @@ export const generateBorder = (error, { isMuted, isMutedWhenEmpty } = {}) => {
|
|
|
9
9
|
isMutedWhenEmpty &&
|
|
10
10
|
'peer-placeholder-shown:text-gray-2 dark:peer-placeholder-shown:text-gray-2'),
|
|
11
11
|
};
|
|
12
|
-
const fieldsetClasses = clsx('pointer-events-none absolute
|
|
12
|
+
const fieldsetClasses = clsx('pointer-events-none absolute left-0 w-full rounded-full border px-4', hideLabel ? 'top-0 h-full' : '-top-2 h-[calc(100%+.5rem)]', 'peer-disabled:border-gray-3 dark:peer-disabled:border-gray-2 peer-not-empty:*:max-w-full peer-not-empty:*:px-1 peer-placeholder-shown:*:max-w-0 peer-placeholder-shown:*:px-0 peer-autofill:max-w-full peer-autofill:*:px-1 peer-focus:*:max-w-full peer-focus:*:px-1', error
|
|
13
13
|
? 'border-error dark:border-error-dark'
|
|
14
14
|
: isMuted
|
|
15
15
|
? 'border-gray-3 dark:border-gray-2'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../../../../src/components/01-atoms/Input/utils/border.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"border.js","sourceRoot":"","sources":["../../../../../src/components/01-atoms/Input/utils/border.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AASxB,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAc,EACd,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,KAAoB,EAAE,EACtE,EAAE;IACF,MAAM,UAAU,GAA4C;QAC1D,SAAS,EAAE,IAAI,CACb,sIAAsI,EACtI,0RAA0R,EAC1R,QAAQ,IAAI,+CAA+C,EAC3D,KAAK;YACH,CAAC,CAAC,iCAAiC;YACnC,CAAC,CAAC,OAAO;gBACP,CAAC,CAAC,8BAA8B;gBAChC,CAAC,CAAC,4BAA4B,EAClC,CAAC,KAAK;YACJ,gBAAgB;YAChB,4EAA4E,CAC/E;KACF,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,CAC1B,qEAAqE,EACrE,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,6BAA6B,EAC1D,uQAAuQ,EACvQ,KAAK;QACH,CAAC,CAAC,qCAAqC;QACvC,CAAC,CAAC,OAAO;YACP,CAAC,CAAC,kCAAkC;YACpC,CAAC,CAAC,gCAAgC,EACtC,CAAC,KAAK;QACJ,gBAAgB;QAChB,qIAAqI,CACxI,CAAC;IAEF,MAAM,aAAa,GAAG,IAAI,CACxB,wEAAwE,CACzE,CAAC;IAEF,OAAO;QACL,UAAU;QACV,eAAe;QACf,aAAa;KACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -56,7 +56,7 @@ export function MultiSelect({ options, value = EMPTY_OPTIONS, onChange, label, d
|
|
|
56
56
|
const optionRefs = useRef([]);
|
|
57
57
|
const listboxId = `${id}-listbox`;
|
|
58
58
|
const feedbackId = `${id}-feedback`;
|
|
59
|
-
const inputClasses = clsx('peer disabled:text-gray-3 dark:disabled:text-gray-2 pointer-events-none h-full w-full rounded-full bg-transparent px-5 text-sm font-normal text-black outline-0 transition-all select-none focus:text-black dark:text-white dark:focus:text-white');
|
|
59
|
+
const inputClasses = clsx('peer disabled:text-gray-3 dark:disabled:text-gray-2 pointer-events-none h-full w-full rounded-full bg-transparent px-5 text-sm font-normal text-black outline-0 transition-all select-none focus:text-black dark:bg-black dark:text-white dark:focus:text-white');
|
|
60
60
|
const isMuted = Boolean(isMutedWhenEmpty) && !selectedOptions.length;
|
|
61
61
|
const { labelProps, legendClasses, fieldsetClasses } = generateBorder(error, {
|
|
62
62
|
isMuted,
|
|
@@ -177,7 +177,7 @@ export function MultiSelect({ options, value = EMPTY_OPTIONS, onChange, label, d
|
|
|
177
177
|
: 'dark:text-white')}>
|
|
178
178
|
{label}
|
|
179
179
|
</label>
|
|
180
|
-
<FaSortDown aria-hidden="true" className={clsx('absolute top-2 right-4', isMuted ? 'text-gray-2 dark:text-gray-2' : 'dark:text-white')}/>
|
|
180
|
+
<FaSortDown aria-hidden="true" className={clsx('peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 absolute top-2 right-4', isMuted ? 'text-gray-2 dark:text-gray-2' : 'dark:text-white')}/>
|
|
181
181
|
<fieldset className={clsx(fieldsetClasses, 'dark:peer-disabled:border-gray-2', error
|
|
182
182
|
? 'dark:border-error-dark'
|
|
183
183
|
: isMuted
|