@rovula/ui 0.0.30 → 0.0.32
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/cjs/bundle.css +1173 -243
- package/dist/cjs/bundle.js +2 -2
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +12 -2
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +12 -2
- package/dist/cjs/types/components/InputFilter/InputFilter.d.ts +63 -4
- package/dist/cjs/types/components/InputFilter/InputFilter.stories.d.ts +54 -18
- package/dist/cjs/types/components/InputFilter/InputFilter.styles.d.ts +1 -0
- package/dist/cjs/types/components/Search/Search.stories.d.ts +7 -1
- package/dist/cjs/types/stories/ColorPreview.d.ts +9 -5
- package/dist/cjs/types/utils/colors.d.ts +1 -0
- package/dist/components/ActionButton/ActionButton.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +3 -3
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +12 -8
- package/dist/components/Dropdown/Dropdown.styles.js +1 -1
- package/dist/components/InputFilter/InputFilter.js +118 -12
- package/dist/components/InputFilter/InputFilter.stories.js +5 -4
- package/dist/components/InputFilter/InputFilter.styles.js +9 -4
- package/dist/components/RadioGroup/RadioGroup.js +5 -2
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/Search/Search.stories.js +2 -1
- package/dist/components/Text/Text.stories.js +5 -1
- package/dist/components/TextInput/TextInput.js +2 -1
- package/dist/components/TextInput/TextInput.styles.js +10 -9
- package/dist/esm/bundle.css +1173 -243
- package/dist/esm/bundle.js +2 -2
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +12 -2
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +12 -2
- package/dist/esm/types/components/InputFilter/InputFilter.d.ts +63 -4
- package/dist/esm/types/components/InputFilter/InputFilter.stories.d.ts +54 -18
- package/dist/esm/types/components/InputFilter/InputFilter.styles.d.ts +1 -0
- package/dist/esm/types/components/Search/Search.stories.d.ts +7 -1
- package/dist/esm/types/stories/ColorPreview.d.ts +9 -5
- package/dist/esm/types/utils/colors.d.ts +1 -0
- package/dist/index.d.ts +83 -14
- package/dist/src/theme/global.css +1526 -348
- package/dist/stories/ColorGroupPreview.js +282 -472
- package/dist/stories/ColorPreview.js +76 -6
- package/dist/theme/main-preset.js +8 -0
- package/dist/theme/plugins/utilities/typography.js +3 -0
- package/dist/theme/presets/colors.js +18 -0
- package/dist/theme/themes/xspector/color.css +13 -0
- package/dist/theme/themes/xspector/components/action-button.css +44 -42
- package/dist/theme/themes/xspector/state.css +1 -1
- package/dist/theme/tokens/color.css +13 -0
- package/dist/theme/tokens/components/action-button.css +42 -55
- package/dist/utils/colors.js +31 -0
- package/package.json +1 -1
- package/src/components/ActionButton/ActionButton.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.tsx +4 -4
- package/src/components/Dropdown/Dropdown.styles.ts +1 -1
- package/src/components/Dropdown/Dropdown.tsx +22 -8
- package/src/components/InputFilter/InputFilter.stories.tsx +9 -8
- package/src/components/InputFilter/InputFilter.styles.ts +9 -4
- package/src/components/InputFilter/InputFilter.tsx +301 -42
- package/src/components/RadioGroup/RadioGroup.stories.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +7 -9
- package/src/components/Search/Search.stories.tsx +2 -1
- package/src/components/Text/Text.stories.tsx +5 -1
- package/src/components/TextInput/TextInput.styles.ts +10 -9
- package/src/components/TextInput/TextInput.tsx +11 -10
- package/src/stories/ColorGroupPreview.tsx +394 -486
- package/src/stories/ColorPreview.tsx +122 -33
- package/src/theme/main-preset.js +8 -0
- package/src/theme/plugins/utilities/typography.js +3 -0
- package/src/theme/presets/colors.js +18 -0
- package/src/theme/themes/xspector/color.css +13 -0
- package/src/theme/themes/xspector/components/action-button.css +44 -42
- package/src/theme/themes/xspector/state.css +1 -1
- package/src/theme/tokens/color.css +13 -0
- package/src/theme/tokens/components/action-button.css +42 -55
- package/src/utils/colors.ts +33 -0
|
@@ -25,11 +25,16 @@ export type DropdownProps = {
|
|
|
25
25
|
error?: boolean;
|
|
26
26
|
required?: boolean;
|
|
27
27
|
className?: string;
|
|
28
|
+
optionContainerClassName?: string;
|
|
28
29
|
options: Options[];
|
|
29
30
|
value?: Options;
|
|
30
31
|
onChangeText?: InputProps["onChange"];
|
|
31
32
|
onSelect?: (value: Options) => void;
|
|
32
|
-
renderOptions?: (
|
|
33
|
+
renderOptions?: (value: {
|
|
34
|
+
optionsFiltered: Options[];
|
|
35
|
+
selectedOption: Options | null | undefined;
|
|
36
|
+
onClick: (option: Options) => void;
|
|
37
|
+
}) => ReactNode;
|
|
33
38
|
} & Omit<InputProps, "value">;
|
|
34
39
|
declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
35
40
|
id?: string | undefined;
|
|
@@ -45,10 +50,15 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
45
50
|
error?: boolean | undefined;
|
|
46
51
|
required?: boolean | undefined;
|
|
47
52
|
className?: string | undefined;
|
|
53
|
+
optionContainerClassName?: string | undefined;
|
|
48
54
|
options: Options[];
|
|
49
55
|
value?: Options | undefined;
|
|
50
56
|
onChangeText?: InputProps["onChange"];
|
|
51
57
|
onSelect?: ((value: Options) => void) | undefined;
|
|
52
|
-
renderOptions?: ((
|
|
58
|
+
renderOptions?: ((value: {
|
|
59
|
+
optionsFiltered: Options[];
|
|
60
|
+
selectedOption: Options | null | undefined;
|
|
61
|
+
onClick: (option: Options) => void;
|
|
62
|
+
}) => ReactNode) | undefined;
|
|
53
63
|
} & Omit<InputProps, "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
54
64
|
export default Dropdown;
|
|
@@ -16,11 +16,16 @@ declare const meta: {
|
|
|
16
16
|
error?: boolean | undefined;
|
|
17
17
|
required?: boolean | undefined;
|
|
18
18
|
className?: string | undefined;
|
|
19
|
+
optionContainerClassName?: string | undefined;
|
|
19
20
|
options: Options[];
|
|
20
21
|
value?: Options | undefined;
|
|
21
22
|
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
22
23
|
onSelect?: ((value: Options) => void) | undefined;
|
|
23
|
-
renderOptions?: ((
|
|
24
|
+
renderOptions?: ((value: {
|
|
25
|
+
optionsFiltered: Options[];
|
|
26
|
+
selectedOption: Options | null | undefined;
|
|
27
|
+
onClick: (option: Options) => void;
|
|
28
|
+
}) => React.ReactNode) | undefined;
|
|
24
29
|
} & Omit<import("../..").InputProps, "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
25
30
|
tags: string[];
|
|
26
31
|
parameters: {
|
|
@@ -40,11 +45,16 @@ declare const meta: {
|
|
|
40
45
|
error?: boolean | undefined;
|
|
41
46
|
required?: boolean | undefined;
|
|
42
47
|
className?: string | undefined;
|
|
48
|
+
optionContainerClassName?: string | undefined;
|
|
43
49
|
options: Options[];
|
|
44
50
|
value?: Options | undefined;
|
|
45
51
|
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
46
52
|
onSelect?: (((value: Options) => void) & React.ReactEventHandler<HTMLInputElement>) | undefined;
|
|
47
|
-
renderOptions?: ((
|
|
53
|
+
renderOptions?: ((value: {
|
|
54
|
+
optionsFiltered: Options[];
|
|
55
|
+
selectedOption: Options | null | undefined;
|
|
56
|
+
onClick: (option: Options) => void;
|
|
57
|
+
}) => React.ReactNode) | undefined;
|
|
48
58
|
suppressHydrationWarning?: boolean | undefined;
|
|
49
59
|
color?: string | undefined;
|
|
50
60
|
height?: string | number | undefined;
|
|
@@ -1,5 +1,64 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { InputProps } from "../TextInput/TextInput";
|
|
3
|
+
type RenderLabelCallbackArg = {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
handleOnClick: () => void;
|
|
7
|
+
className: string;
|
|
8
|
+
};
|
|
9
|
+
export type Options = {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
renderLabel?: (config: RenderLabelCallbackArg) => ReactNode;
|
|
13
|
+
};
|
|
14
|
+
export type InputFilterProps = {
|
|
15
|
+
id?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
size?: "sm" | "md" | "lg";
|
|
18
|
+
rounded?: "none" | "normal" | "full";
|
|
19
|
+
variant?: "flat" | "outline" | "underline";
|
|
20
|
+
helperText?: string;
|
|
21
|
+
errorMessage?: string;
|
|
22
|
+
filterMode?: boolean;
|
|
23
|
+
fullwidth?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
error?: boolean;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
className?: string;
|
|
28
|
+
optionContainerClassName?: string;
|
|
29
|
+
options: Options[];
|
|
30
|
+
values?: Options[];
|
|
31
|
+
onChangeText?: InputProps["onChange"];
|
|
32
|
+
onSelect?: (values: Options[]) => void;
|
|
33
|
+
renderOptions?: (value: {
|
|
34
|
+
optionsFiltered: Options[];
|
|
35
|
+
selectedOptions: Options[];
|
|
36
|
+
onClick: (option: Options) => void;
|
|
37
|
+
}) => ReactNode;
|
|
38
|
+
} & Omit<InputProps, "value" | "onSelect">;
|
|
39
|
+
declare const InputFilter: React.ForwardRefExoticComponent<{
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
label?: string | undefined;
|
|
42
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
43
|
+
rounded?: "none" | "normal" | "full" | undefined;
|
|
44
|
+
variant?: "outline" | "flat" | "underline" | undefined;
|
|
45
|
+
helperText?: string | undefined;
|
|
46
|
+
errorMessage?: string | undefined;
|
|
47
|
+
filterMode?: boolean | undefined;
|
|
48
|
+
fullwidth?: boolean | undefined;
|
|
49
|
+
disabled?: boolean | undefined;
|
|
50
|
+
error?: boolean | undefined;
|
|
51
|
+
required?: boolean | undefined;
|
|
52
|
+
className?: string | undefined;
|
|
53
|
+
optionContainerClassName?: string | undefined;
|
|
54
|
+
options: Options[];
|
|
55
|
+
values?: Options[] | undefined;
|
|
56
|
+
onChangeText?: InputProps["onChange"];
|
|
57
|
+
onSelect?: ((values: Options[]) => void) | undefined;
|
|
58
|
+
renderOptions?: ((value: {
|
|
59
|
+
optionsFiltered: Options[];
|
|
60
|
+
selectedOptions: Options[];
|
|
61
|
+
onClick: (option: Options) => void;
|
|
62
|
+
}) => ReactNode) | undefined;
|
|
63
|
+
} & Omit<InputProps, "onSelect" | "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
5
64
|
export { InputFilter };
|
|
@@ -1,19 +1,63 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Options } from "
|
|
2
|
+
import { Options } from "./InputFilter";
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: React.ForwardRefExoticComponent<
|
|
5
|
+
component: React.ForwardRefExoticComponent<{
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
label?: string | undefined;
|
|
8
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
9
|
+
rounded?: "none" | "normal" | "full" | undefined;
|
|
10
|
+
variant?: "outline" | "flat" | "underline" | undefined;
|
|
11
|
+
helperText?: string | undefined;
|
|
12
|
+
errorMessage?: string | undefined;
|
|
13
|
+
filterMode?: boolean | undefined;
|
|
14
|
+
fullwidth?: boolean | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
error?: boolean | undefined;
|
|
17
|
+
required?: boolean | undefined;
|
|
18
|
+
className?: string | undefined;
|
|
19
|
+
optionContainerClassName?: string | undefined;
|
|
20
|
+
options: Options[];
|
|
21
|
+
values?: Options[] | undefined;
|
|
22
|
+
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
23
|
+
onSelect?: ((values: Options[]) => void) | undefined;
|
|
24
|
+
renderOptions?: ((value: {
|
|
25
|
+
optionsFiltered: Options[];
|
|
26
|
+
selectedOptions: Options[];
|
|
27
|
+
onClick: (option: Options) => void;
|
|
28
|
+
}) => React.ReactNode) | undefined;
|
|
29
|
+
} & Omit<import("../..").InputProps, "onSelect" | "value"> & React.RefAttributes<HTMLInputElement>>;
|
|
6
30
|
tags: string[];
|
|
7
31
|
parameters: {
|
|
8
32
|
layout: string;
|
|
9
33
|
};
|
|
10
34
|
decorators: ((Story: import("@storybook/types").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
35
|
+
id?: string | undefined;
|
|
36
|
+
label?: string | undefined;
|
|
37
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
38
|
+
rounded?: "none" | "normal" | "full" | undefined;
|
|
11
39
|
variant?: "outline" | "flat" | "underline" | undefined;
|
|
12
|
-
|
|
40
|
+
helperText?: string | undefined;
|
|
41
|
+
errorMessage?: string | undefined;
|
|
42
|
+
filterMode?: boolean | undefined;
|
|
43
|
+
fullwidth?: boolean | undefined;
|
|
44
|
+
disabled?: boolean | undefined;
|
|
45
|
+
error?: boolean | undefined;
|
|
46
|
+
required?: boolean | undefined;
|
|
13
47
|
className?: string | undefined;
|
|
48
|
+
optionContainerClassName?: string | undefined;
|
|
49
|
+
options: Options[];
|
|
50
|
+
values?: Options[] | undefined;
|
|
51
|
+
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
52
|
+
onSelect?: ((values: Options[]) => void) | undefined;
|
|
53
|
+
renderOptions?: ((value: {
|
|
54
|
+
optionsFiltered: Options[];
|
|
55
|
+
selectedOptions: Options[];
|
|
56
|
+
onClick: (option: Options) => void;
|
|
57
|
+
}) => React.ReactNode) | undefined;
|
|
58
|
+
suppressHydrationWarning?: boolean | undefined;
|
|
14
59
|
color?: string | undefined;
|
|
15
60
|
height?: string | number | undefined;
|
|
16
|
-
id?: string | undefined;
|
|
17
61
|
lang?: string | undefined;
|
|
18
62
|
max?: string | number | undefined;
|
|
19
63
|
min?: string | number | undefined;
|
|
@@ -200,7 +244,6 @@ declare const meta: {
|
|
|
200
244
|
onMouseOverCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
201
245
|
onMouseUp?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
202
246
|
onMouseUpCapture?: React.MouseEventHandler<HTMLInputElement> | undefined;
|
|
203
|
-
onSelect?: (((value: Options) => void) & React.ReactEventHandler<HTMLInputElement>) | undefined;
|
|
204
247
|
onSelectCapture?: React.ReactEventHandler<HTMLInputElement> | undefined;
|
|
205
248
|
onTouchCancel?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
206
249
|
onTouchCancelCapture?: React.TouchEventHandler<HTMLInputElement> | undefined;
|
|
@@ -243,18 +286,14 @@ declare const meta: {
|
|
|
243
286
|
form?: string | undefined;
|
|
244
287
|
list?: string | undefined;
|
|
245
288
|
step?: string | number | undefined;
|
|
246
|
-
error?: boolean | undefined;
|
|
247
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
248
|
-
disabled?: boolean | undefined;
|
|
249
|
-
fullwidth?: boolean | undefined;
|
|
250
289
|
title?: string | undefined;
|
|
251
290
|
startIcon?: React.ReactNode;
|
|
291
|
+
endIcon?: React.ReactNode;
|
|
252
292
|
formAction?: string | undefined;
|
|
253
293
|
formEncType?: string | undefined;
|
|
254
294
|
formMethod?: string | undefined;
|
|
255
295
|
formNoValidate?: boolean | undefined;
|
|
256
296
|
formTarget?: string | undefined;
|
|
257
|
-
value?: Options | undefined;
|
|
258
297
|
defaultChecked?: boolean | undefined;
|
|
259
298
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
260
299
|
suppressContentEditableWarning?: boolean | undefined;
|
|
@@ -294,7 +333,9 @@ declare const meta: {
|
|
|
294
333
|
unselectable?: "off" | "on" | undefined;
|
|
295
334
|
inputMode?: "none" | "search" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
296
335
|
is?: string | undefined;
|
|
297
|
-
|
|
336
|
+
hasClearIcon?: boolean | undefined;
|
|
337
|
+
hasSearchIcon?: boolean | undefined;
|
|
338
|
+
isFloatingLabel?: boolean | undefined;
|
|
298
339
|
accept?: string | undefined;
|
|
299
340
|
alt?: string | undefined;
|
|
300
341
|
autoComplete?: React.HTMLInputAutoCompleteAttribute | undefined;
|
|
@@ -307,18 +348,12 @@ declare const meta: {
|
|
|
307
348
|
pattern?: string | undefined;
|
|
308
349
|
placeholder?: string | undefined;
|
|
309
350
|
readOnly?: boolean | undefined;
|
|
310
|
-
required?: boolean | undefined;
|
|
311
351
|
src?: string | undefined;
|
|
312
|
-
|
|
313
|
-
helperText?: string | undefined;
|
|
314
|
-
errorMessage?: string | undefined;
|
|
352
|
+
keepCloseIconOnValue?: boolean | undefined;
|
|
315
353
|
labelClassName?: string | undefined;
|
|
316
354
|
onClickEndIcon?: (() => void) | undefined;
|
|
317
355
|
renderEndIcon?: (() => React.ReactNode) | undefined;
|
|
318
356
|
onClickStartIcon?: (() => void) | undefined;
|
|
319
|
-
options: Options[];
|
|
320
|
-
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
321
|
-
renderOptions?: ((optionsFiltered: Options[]) => React.ReactNode) | undefined;
|
|
322
357
|
ref?: React.LegacyRef<HTMLInputElement> | undefined;
|
|
323
358
|
key?: React.Key | null | undefined;
|
|
324
359
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -328,6 +363,7 @@ export declare const Default: {
|
|
|
328
363
|
args: {
|
|
329
364
|
label: string;
|
|
330
365
|
fullwidth: boolean;
|
|
366
|
+
disabled: boolean;
|
|
331
367
|
options: Options[];
|
|
332
368
|
};
|
|
333
369
|
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,4 +4,5 @@ export declare const filterIconVariant: (props?: ({
|
|
|
4
4
|
error?: boolean | null | undefined;
|
|
5
5
|
position?: "end" | "start" | null | undefined;
|
|
6
6
|
active?: boolean | null | undefined;
|
|
7
|
+
disabled?: boolean | null | undefined;
|
|
7
8
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -318,7 +318,12 @@ declare const meta: {
|
|
|
318
318
|
onClickStartIcon?: (() => void) | undefined;
|
|
319
319
|
options: Options[];
|
|
320
320
|
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
321
|
-
renderOptions?: ((
|
|
321
|
+
renderOptions?: ((value: {
|
|
322
|
+
optionsFiltered: Options[];
|
|
323
|
+
selectedOption: Options | null | undefined;
|
|
324
|
+
onClick: (option: Options) => void;
|
|
325
|
+
}) => React.ReactNode) | undefined;
|
|
326
|
+
optionContainerClassName?: string | undefined;
|
|
322
327
|
ref?: React.LegacyRef<HTMLInputElement> | undefined;
|
|
323
328
|
key?: React.Key | null | undefined;
|
|
324
329
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -328,6 +333,7 @@ export declare const Default: {
|
|
|
328
333
|
args: {
|
|
329
334
|
label: string;
|
|
330
335
|
fullwidth: boolean;
|
|
336
|
+
size: string;
|
|
331
337
|
options: Options[];
|
|
332
338
|
};
|
|
333
339
|
render: (args: {}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export declare const ColorBox: ({ className }: {
|
|
2
|
+
className: string;
|
|
3
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const ColorItems: ({ title, subTitle, colors, col, }: {
|
|
5
|
+
title?: string;
|
|
6
|
+
subTitle?: string;
|
|
7
|
+
colors: string[];
|
|
8
|
+
col?: number;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const srgbToHex: (color: string) => string;
|
|
@@ -10,7 +10,7 @@ const meta = {
|
|
|
10
10
|
layout: "fullscreen",
|
|
11
11
|
},
|
|
12
12
|
decorators: [
|
|
13
|
-
(Story) => (_jsx("div", { className: "p-5", children: _jsx(Story, {}) })),
|
|
13
|
+
(Story) => (_jsx("div", { className: "p-5 bg-base-bg2", children: _jsx(Story, {}) })),
|
|
14
14
|
],
|
|
15
15
|
};
|
|
16
16
|
export default meta;
|
|
@@ -17,9 +17,9 @@ import { CheckIcon } from "@heroicons/react/16/solid";
|
|
|
17
17
|
import { cn } from "@/utils/cn";
|
|
18
18
|
const Checkbox = React.forwardRef((_a, ref) => {
|
|
19
19
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
-
return (_jsx(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: cn("peer size-4 shrink-0 rounded-[var(--spacing-spacing-xxs,2px)] border border-
|
|
21
|
-
"data-[state=checked]:border-
|
|
22
|
-
"hover:data-[state=checked]:border-
|
|
20
|
+
return (_jsx(CheckboxPrimitive.Root, Object.assign({ ref: ref, className: cn("peer size-4 shrink-0 rounded-[var(--spacing-spacing-xxs,2px)] border border-function-default-solid ring-offset-background", "hover:border-function-default-hover", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", "disabled:cursor-not-allowed disabled:border-state-disable-solid disabled:text-state-disable-outline", {
|
|
21
|
+
"data-[state=checked]:border-function-active-solid data-[state=checked]:bg-function-active-solid data-[state=checked]:text-function-active-icon": !props.disabled,
|
|
22
|
+
"hover:data-[state=checked]:border-function-active-hover hover:data-[state=checked]:bg-function-active-hover": !props.disabled,
|
|
23
23
|
"bg-state-disable-solid": props.checked && props.disabled,
|
|
24
24
|
}, className) }, props, { children: _jsx(CheckboxPrimitive.Indicator, { className: cn("flex items-center justify-center text-current"), children: _jsx(CheckIcon, { className: "size-4" }) }) })));
|
|
25
25
|
});
|
|
@@ -8,7 +8,7 @@ const meta = {
|
|
|
8
8
|
layout: "fullscreen",
|
|
9
9
|
},
|
|
10
10
|
decorators: [
|
|
11
|
-
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
11
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full bg-base-bg2", children: _jsx(Story, {}) })),
|
|
12
12
|
],
|
|
13
13
|
};
|
|
14
14
|
export default meta;
|
|
@@ -14,19 +14,19 @@ import { Fragment, forwardRef, useCallback, useEffect, useMemo, useRef, useState
|
|
|
14
14
|
import TextInput from "../TextInput/TextInput";
|
|
15
15
|
import { customInputVariant, dropdownIconVariant, iconWrapperVariant, } from "./Dropdown.styles";
|
|
16
16
|
import { ChevronDownIcon } from "@heroicons/react/16/solid";
|
|
17
|
+
import { cn } from "@/utils/cn";
|
|
17
18
|
const Dropdown = forwardRef((_a, ref) => {
|
|
18
|
-
var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, onChangeText, onSelect, renderOptions: customRenderOptions } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect", "renderOptions"]);
|
|
19
|
+
var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, onChangeText, onSelect, renderOptions: customRenderOptions, optionContainerClassName } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect", "renderOptions", "optionContainerClassName"]);
|
|
19
20
|
const _id = id || `${label}-select`;
|
|
20
21
|
const [isFocused, setIsFocused] = useState(false);
|
|
21
22
|
const [selectedOption, setSelectedOption] = useState(null);
|
|
22
23
|
const [textValue, setTextValue] = useState("");
|
|
23
24
|
const keyCode = useRef("");
|
|
24
25
|
useEffect(() => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, [value, selectedOption]);
|
|
26
|
+
var _a;
|
|
27
|
+
setSelectedOption(value);
|
|
28
|
+
setTextValue((_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : "");
|
|
29
|
+
}, [value]);
|
|
30
30
|
const handleOnChangeText = useCallback((event) => {
|
|
31
31
|
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(event);
|
|
32
32
|
setTextValue(event.target.value);
|
|
@@ -48,9 +48,13 @@ const Dropdown = forwardRef((_a, ref) => {
|
|
|
48
48
|
}, [options, filterMode, textValue]);
|
|
49
49
|
const renderOptions = () => {
|
|
50
50
|
if (customRenderOptions) {
|
|
51
|
-
return customRenderOptions(
|
|
51
|
+
return customRenderOptions({
|
|
52
|
+
optionsFiltered,
|
|
53
|
+
selectedOption,
|
|
54
|
+
onClick: handleOptionClick,
|
|
55
|
+
});
|
|
52
56
|
}
|
|
53
|
-
return (_jsxs("ul", { className: "absolute mt-1 w-full bg-base-popup border border-base-popup text-base-popup-foreground rounded-md shadow-md z-10 max-h-60 overflow-y-auto", children: [optionsFiltered.map((option) => {
|
|
57
|
+
return (_jsxs("ul", { className: cn("absolute mt-1 w-full bg-base-popup border border-base-popup text-base-popup-foreground rounded-md shadow-md z-10 max-h-60 overflow-y-auto", optionContainerClassName), children: [optionsFiltered.map((option) => {
|
|
54
58
|
if (option.renderLabel) {
|
|
55
59
|
return (_jsx(Fragment, { children: option.renderLabel({
|
|
56
60
|
value: option.value,
|
|
@@ -1,18 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment, forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
14
|
+
import TextInput from "../TextInput/TextInput";
|
|
15
|
+
import { cn } from "@/utils/cn";
|
|
16
|
+
import { customInputVariant } from "../Dropdown/Dropdown.styles";
|
|
4
17
|
import Icon from "../Icon/Icon";
|
|
5
18
|
import { filterIconVariant } from "./InputFilter.styles";
|
|
6
|
-
|
|
7
|
-
|
|
19
|
+
import { Checkbox } from "../Checkbox/Checkbox";
|
|
20
|
+
const InputFilter = forwardRef((_a, ref) => {
|
|
21
|
+
var { id, options = [], values = [], label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, onChangeText, onSelect, renderOptions: customRenderOptions, optionContainerClassName } = _a, props = __rest(_a, ["id", "options", "values", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect", "renderOptions", "optionContainerClassName"]);
|
|
22
|
+
const _id = id || `${label}-select`;
|
|
23
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
24
|
+
const [selectedOptions, setSelectedOptions] = useState(values);
|
|
25
|
+
const [textValue, setTextValue] = useState("");
|
|
26
|
+
const keyCode = useRef("");
|
|
27
|
+
const containerRef = useRef(null);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
var _a;
|
|
30
|
+
setSelectedOptions(values !== null && values !== void 0 ? values : []);
|
|
31
|
+
setTextValue((_a = values === null || values === void 0 ? void 0 : values.map((option) => option.label).join(", ")) !== null && _a !== void 0 ? _a : "");
|
|
32
|
+
}, [values]);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const handleClickOutside = (event) => {
|
|
35
|
+
if (containerRef.current &&
|
|
36
|
+
!containerRef.current.contains(event.target)) {
|
|
37
|
+
setIsFocused(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
41
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
42
|
+
}, []);
|
|
43
|
+
const handleOnChangeText = useCallback((event) => {
|
|
44
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(event);
|
|
45
|
+
setTextValue(event.target.value);
|
|
46
|
+
if (!event.target.value) {
|
|
47
|
+
clearMismatchValues(event);
|
|
48
|
+
}
|
|
49
|
+
}, [onChangeText]);
|
|
50
|
+
const handleOptionClick = useCallback((option) => {
|
|
51
|
+
const isSelected = selectedOptions.some((selected) => selected.value === option.value);
|
|
52
|
+
let newSelectedOptions = [...selectedOptions];
|
|
53
|
+
if (isSelected) {
|
|
54
|
+
newSelectedOptions = newSelectedOptions.filter((selected) => selected.value !== option.value);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
newSelectedOptions.push(option);
|
|
58
|
+
}
|
|
59
|
+
setSelectedOptions(newSelectedOptions);
|
|
60
|
+
setTextValue(newSelectedOptions.map((option) => option.label).join(", "));
|
|
61
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(newSelectedOptions);
|
|
62
|
+
}, [selectedOptions, onSelect]);
|
|
63
|
+
const optionsFiltered = useMemo(() => {
|
|
64
|
+
const lastText = textValue === null || textValue === void 0 ? void 0 : textValue.split(",").pop();
|
|
65
|
+
const filterText = lastText !== null && lastText !== void 0 ? lastText : "";
|
|
66
|
+
return options.filter((option) => {
|
|
67
|
+
var _a;
|
|
68
|
+
return !filterMode ||
|
|
69
|
+
((_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filterText === null || filterText === void 0 ? void 0 : filterText.toLowerCase()));
|
|
70
|
+
});
|
|
71
|
+
}, [options, filterMode, textValue]);
|
|
72
|
+
const renderOptions = () => {
|
|
73
|
+
if (customRenderOptions) {
|
|
74
|
+
return customRenderOptions({
|
|
75
|
+
optionsFiltered,
|
|
76
|
+
selectedOptions,
|
|
77
|
+
onClick: handleOptionClick,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return (_jsxs("ul", { className: cn("absolute mt-1 w-full bg-base-popup border border-base-popup text-base-popup-foreground rounded-md shadow-md z-10 max-h-60 overflow-y-auto", optionContainerClassName), children: [optionsFiltered.map((option) => {
|
|
81
|
+
if (option.renderLabel) {
|
|
82
|
+
return (_jsx(Fragment, { children: option.renderLabel({
|
|
83
|
+
value: option.value,
|
|
84
|
+
label: option.label,
|
|
85
|
+
handleOnClick: () => handleOptionClick(option),
|
|
86
|
+
className: `p-4 typography-subtitile4 hover:bg-gray-100 cursor-pointer flex items-center gap-3 ${selectedOptions.some((selected) => selected.value === option.value)
|
|
87
|
+
? "bg-gray-200"
|
|
88
|
+
: ""}`,
|
|
89
|
+
}) }, option.value));
|
|
90
|
+
}
|
|
91
|
+
return (_jsxs("li", { onMouseDown: () => handleOptionClick(option), className: `p-4 typography-subtitile4 hover:bg-primary-hover-bg cursor-pointer flex items-center gap-3 ${selectedOptions.some((selected) => selected.value === option.value)
|
|
92
|
+
? "bg-base-popup-highlight"
|
|
93
|
+
: ""}`, children: [_jsx(Checkbox, { checked: selectedOptions.some((selected) => selected.value === option.value) }), option.label] }, option.value));
|
|
94
|
+
}), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] }));
|
|
95
|
+
};
|
|
96
|
+
const handleOnFocus = useCallback((e) => {
|
|
97
|
+
var _a;
|
|
98
|
+
setIsFocused(true);
|
|
99
|
+
(_a = props === null || props === void 0 ? void 0 : props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
100
|
+
}, [props === null || props === void 0 ? void 0 : props.onFocus]);
|
|
101
|
+
const clearMismatchValues = useCallback((e) => {
|
|
102
|
+
const matchSelectedValues = optionsFiltered.filter((opt) => { var _a, _b; return opt.value === ((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || opt.label === ((_b = e.target) === null || _b === void 0 ? void 0 : _b.value); });
|
|
103
|
+
if (keyCode.current === "Enter") {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
setSelectedOptions(matchSelectedValues);
|
|
107
|
+
setTextValue(matchSelectedValues.map((option) => option.label).join(", "));
|
|
108
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(matchSelectedValues);
|
|
109
|
+
}, [optionsFiltered, textValue]);
|
|
110
|
+
const handleOnKeyDown = useCallback((e) => {
|
|
111
|
+
var _a;
|
|
112
|
+
keyCode.current = e.code;
|
|
113
|
+
(_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
114
|
+
}, [props === null || props === void 0 ? void 0 : props.onKeyDown]);
|
|
8
115
|
const filterIconClassName = filterIconVariant({
|
|
9
|
-
size:
|
|
10
|
-
rounded:
|
|
11
|
-
error:
|
|
12
|
-
active: !!
|
|
116
|
+
size: size,
|
|
117
|
+
rounded: rounded,
|
|
118
|
+
error: error,
|
|
119
|
+
active: !!values.length,
|
|
120
|
+
disabled,
|
|
13
121
|
});
|
|
14
|
-
return (
|
|
15
|
-
return "";
|
|
16
|
-
}, filterMode: true, isFloatingLabel: false })));
|
|
122
|
+
return (_jsxs("div", { ref: containerRef, className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx("div", { className: filterIconClassName, children: _jsx(Icon, { type: "heroicons", name: "adjustments-horizontal", variant: "outline", color: "inherit", stroke: "inherit", fill: "transparent" }) }) }, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: customInputVariant({ size }), onFocus: handleOnFocus, onKeyDown: handleOnKeyDown })), isFocused && renderOptions()] }));
|
|
17
123
|
});
|
|
18
124
|
export { InputFilter };
|
|
@@ -21,13 +21,14 @@ export const Default = {
|
|
|
21
21
|
args: {
|
|
22
22
|
label: "Choose an option:",
|
|
23
23
|
fullwidth: true,
|
|
24
|
+
disabled: true,
|
|
24
25
|
options,
|
|
25
26
|
},
|
|
26
27
|
render: (args) => {
|
|
27
|
-
const [value, setValue] = useState();
|
|
28
|
-
const handleOnSelect = (
|
|
29
|
-
setValue(
|
|
28
|
+
const [value, setValue] = useState([]);
|
|
29
|
+
const handleOnSelect = (values) => {
|
|
30
|
+
setValue(values);
|
|
30
31
|
};
|
|
31
|
-
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(InputFilter, Object.assign({ id: "1", size: "lg", options: options,
|
|
32
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(InputFilter, Object.assign({ id: "1", size: "lg", options: options, values: value, onSelect: handleOnSelect, optionContainerClassName: "h-[400px]" }, args)), _jsx(InputFilter, Object.assign({ id: "2", size: "md", options: options, values: value, onSelect: handleOnSelect }, args)), _jsx(InputFilter, Object.assign({ id: "3", size: "sm", options: options, values: value, onSelect: handleOnSelect }, args))] }));
|
|
32
33
|
},
|
|
33
34
|
};
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
2
|
export const filterIconVariant = cva([
|
|
3
3
|
// Base styles
|
|
4
|
-
"absolute
|
|
4
|
+
"absolute contents items-center justify-center cursor-pointer",
|
|
5
5
|
// Border styles
|
|
6
6
|
"border-l border-l-input-default-stroke",
|
|
7
7
|
"peer-hover:border-l-input-active-stroke",
|
|
8
8
|
"peer-focus:border-l-input-active-stroke",
|
|
9
|
-
"peer-disabled:border-l-input-disable-stroke",
|
|
10
9
|
// Fill styles
|
|
11
10
|
"fill-primary",
|
|
12
11
|
"peer-hover:fill-input-filled-text",
|
|
13
12
|
"peer-focus:fill-input-filled-text",
|
|
14
|
-
"peer-disabled:fill-input-disable-stroke",
|
|
15
13
|
// Stroke styles
|
|
16
14
|
"stroke-input-default-stroke",
|
|
17
15
|
"peer-hover:stroke-input-active-stroke",
|
|
@@ -42,13 +40,19 @@ export const filterIconVariant = cva([
|
|
|
42
40
|
"fill-primary-default",
|
|
43
41
|
"peer-hover:fill-primary-default", // TODO wait for refactor color after change function button colors
|
|
44
42
|
"peer-focus:fill-primary-hover", // TODO wait for refactor color after change function button colors
|
|
45
|
-
// "peer-disabled:fill-input-disable-stroke",
|
|
46
43
|
// Stroke styles
|
|
47
44
|
"stroke-primary-default",
|
|
48
45
|
"peer-hover:stroke-primary-default",
|
|
49
46
|
"peer-focus:stroke-primary-hover",
|
|
50
47
|
],
|
|
51
48
|
},
|
|
49
|
+
disabled: {
|
|
50
|
+
true: [
|
|
51
|
+
"border-l-input-disable-stroke",
|
|
52
|
+
"fill-input-disable-stroke",
|
|
53
|
+
"stroke-input-disable-stroke",
|
|
54
|
+
],
|
|
55
|
+
},
|
|
52
56
|
},
|
|
53
57
|
defaultVariants: {
|
|
54
58
|
size: "md",
|
|
@@ -56,5 +60,6 @@ export const filterIconVariant = cva([
|
|
|
56
60
|
error: false,
|
|
57
61
|
position: "end",
|
|
58
62
|
active: false,
|
|
63
|
+
disabled: false,
|
|
59
64
|
},
|
|
60
65
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use client";
|
|
2
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
2
|
var t = {};
|
|
4
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -21,7 +20,11 @@ const RadioGroup = React.forwardRef((_a, ref) => {
|
|
|
21
20
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
22
21
|
const RadioGroupItem = React.forwardRef((_a, ref) => {
|
|
23
22
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
|
-
return (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: ref, className: cn("aspect-square box-border
|
|
23
|
+
return (_jsx(RadioGroupPrimitive.Item, Object.assign({ ref: ref, className: cn("aspect-square box-border size-4 rounded-full border border-function-default-solid text-function-default-solid", "hover:border-function-default-hover", "focus:outline-none",
|
|
24
|
+
// Disabled state styles
|
|
25
|
+
"data-[disabled]:!border-state-disable-solid data-[disabled]:!fill-state-disable-solid data-[disabled]:!cursor-not-allowed data-[disabled]:!pointer-events-none data-[disabled]:!text-state-disable-solid",
|
|
26
|
+
// Checked state styles
|
|
27
|
+
"data-[state=checked]:border-function-active-solid data-[state=checked]:text-function-active-solid", "hover:data-[state=checked]:border-function-active-hover hover:data-[state=checked]:text-function-active-hover", className) }, props, { children: _jsx(RadioGroupPrimitive.Indicator, { className: "flex items-center justify-center", children: _jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: "fill-current text-current", children: _jsx("circle", { cx: "5", cy: "5", r: "5", fill: "current" }) }) }) })));
|
|
25
28
|
});
|
|
26
29
|
RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
27
30
|
export { RadioGroup, RadioGroupItem };
|