@rovula/ui 0.0.73 → 0.0.75
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 +36 -0
- package/dist/cjs/bundle.js +3 -3
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/TextArea/TextArea.d.ts +38 -0
- package/dist/cjs/types/components/TextArea/TextArea.stories.d.ts +9 -0
- package/dist/cjs/types/components/TextArea/TextArea.styles.d.ts +27 -0
- package/dist/cjs/types/components/Tree/Tree.stories.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.js +55 -0
- package/dist/components/TextArea/TextArea.stories.js +86 -0
- package/dist/components/TextArea/TextArea.styles.js +207 -0
- package/dist/components/Tree/Tree.stories.js +73 -0
- package/dist/components/Tree/TreeItem.js +1 -1
- package/dist/esm/bundle.css +36 -0
- package/dist/esm/bundle.js +3 -3
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/TextArea/TextArea.d.ts +38 -0
- package/dist/esm/types/components/TextArea/TextArea.stories.d.ts +9 -0
- package/dist/esm/types/components/TextArea/TextArea.styles.d.ts +27 -0
- package/dist/esm/types/components/Tree/Tree.stories.d.ts +1 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +1 -0
- package/dist/src/theme/global.css +46 -0
- package/package.json +1 -1
- package/src/components/TextArea/TextArea.stories.tsx +134 -0
- package/src/components/TextArea/TextArea.styles.ts +228 -0
- package/src/components/TextArea/TextArea.tsx +150 -0
- package/src/components/Tree/Tree.stories.tsx +100 -0
- package/src/components/Tree/TreeItem.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/theme/global.css +26 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type TextAreaProps = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
rounded?: "none" | "normal" | "full";
|
|
7
|
+
variant?: "flat" | "outline" | "underline";
|
|
8
|
+
helperText?: string;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
fullwidth?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
error?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
isFloatingLabel?: boolean;
|
|
15
|
+
keepCloseIconOnValue?: boolean;
|
|
16
|
+
hasClearIcon?: boolean;
|
|
17
|
+
labelClassName?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size">;
|
|
20
|
+
export declare const TextArea: React.ForwardRefExoticComponent<{
|
|
21
|
+
id?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
|
+
rounded?: "none" | "normal" | "full";
|
|
25
|
+
variant?: "flat" | "outline" | "underline";
|
|
26
|
+
helperText?: string;
|
|
27
|
+
errorMessage?: string;
|
|
28
|
+
fullwidth?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
error?: boolean;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
isFloatingLabel?: boolean;
|
|
33
|
+
keepCloseIconOnValue?: boolean;
|
|
34
|
+
hasClearIcon?: boolean;
|
|
35
|
+
labelClassName?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
38
|
+
export default TextArea;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { TextArea } from "@/index";
|
|
3
|
+
declare const meta: Meta<typeof TextArea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof TextArea>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const ErrorState: Story;
|
|
8
|
+
export declare const HelperText: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const textareaVariant: (props?: ({
|
|
2
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
3
|
+
rounded?: "none" | "normal" | "full" | null | undefined;
|
|
4
|
+
variant?: "outline" | "flat" | "underline" | null | undefined;
|
|
5
|
+
fullwidth?: boolean | null | undefined;
|
|
6
|
+
disabled?: boolean | null | undefined;
|
|
7
|
+
error?: boolean | null | undefined;
|
|
8
|
+
hasClearIcon?: boolean | null | undefined;
|
|
9
|
+
isFloatingLabel?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
11
|
+
export declare const labelVariant: (props?: ({
|
|
12
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
disabled?: boolean | null | undefined;
|
|
14
|
+
error?: boolean | null | undefined;
|
|
15
|
+
isFloatingLabel?: boolean | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
17
|
+
export declare const clearIconWrapperVariant: (props?: ({
|
|
18
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
19
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
20
|
+
export declare const clearIconVariant: (props?: ({
|
|
21
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
22
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
23
|
+
export declare const helperTextVariant: (props?: ({
|
|
24
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
25
|
+
disabled?: boolean | null | undefined;
|
|
26
|
+
error?: boolean | null | undefined;
|
|
27
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -16,3 +16,4 @@ export declare const Leaf: StoryObj<typeof Tree>;
|
|
|
16
16
|
export declare const HideCheckboxMode: StoryObj<typeof Tree>;
|
|
17
17
|
export declare const RadioMode: StoryObj<typeof Tree>;
|
|
18
18
|
export declare const CheckAll: StoryObj<typeof Tree>;
|
|
19
|
+
export declare const LongText: StoryObj<typeof Tree>;
|
|
@@ -2,6 +2,7 @@ import "./theme/global.css";
|
|
|
2
2
|
import "./icons/iconConfig";
|
|
3
3
|
export { default as Button } from "./components/Button/Button";
|
|
4
4
|
export { default as TextInput } from "./components/TextInput/TextInput";
|
|
5
|
+
export { default as TextArea } from "./components/TextArea/TextArea";
|
|
5
6
|
export { default as Text } from "./components/Text/Text";
|
|
6
7
|
export { default as Tabs } from "./components/Tabs/Tabs";
|
|
7
8
|
export { default as Dropdown } from "./components/Dropdown/Dropdown";
|
|
@@ -37,6 +38,7 @@ export * from "./components/FocusedScrollView/FocusedScrollView";
|
|
|
37
38
|
export * from "./components/RadioGroup/RadioGroup";
|
|
38
39
|
export type { ButtonProps } from "./components/Button/Button";
|
|
39
40
|
export type { InputProps } from "./components/TextInput/TextInput";
|
|
41
|
+
export type { TextAreaProps } from "./components/TextArea/TextArea";
|
|
40
42
|
export type { DropdownProps, Options } from "./components/Dropdown/Dropdown";
|
|
41
43
|
export type { NavbarProps } from "./components/Navbar/Navbar";
|
|
42
44
|
export type { AvatarProps } from "./components/Avatar/Avatar";
|
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,43 @@ declare const TextInput: React__default.ForwardRefExoticComponent<{
|
|
|
99
99
|
renderEndIcon?: () => ReactNode;
|
|
100
100
|
} & Omit<React__default.InputHTMLAttributes<HTMLInputElement>, "size"> & React__default.RefAttributes<HTMLInputElement>>;
|
|
101
101
|
|
|
102
|
+
type TextAreaProps = {
|
|
103
|
+
id?: string;
|
|
104
|
+
label?: string;
|
|
105
|
+
size?: "sm" | "md" | "lg";
|
|
106
|
+
rounded?: "none" | "normal" | "full";
|
|
107
|
+
variant?: "flat" | "outline" | "underline";
|
|
108
|
+
helperText?: string;
|
|
109
|
+
errorMessage?: string;
|
|
110
|
+
fullwidth?: boolean;
|
|
111
|
+
disabled?: boolean;
|
|
112
|
+
error?: boolean;
|
|
113
|
+
required?: boolean;
|
|
114
|
+
isFloatingLabel?: boolean;
|
|
115
|
+
keepCloseIconOnValue?: boolean;
|
|
116
|
+
hasClearIcon?: boolean;
|
|
117
|
+
labelClassName?: string;
|
|
118
|
+
className?: string;
|
|
119
|
+
} & Omit<React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "size">;
|
|
120
|
+
declare const TextArea: React__default.ForwardRefExoticComponent<{
|
|
121
|
+
id?: string;
|
|
122
|
+
label?: string;
|
|
123
|
+
size?: "sm" | "md" | "lg";
|
|
124
|
+
rounded?: "none" | "normal" | "full";
|
|
125
|
+
variant?: "flat" | "outline" | "underline";
|
|
126
|
+
helperText?: string;
|
|
127
|
+
errorMessage?: string;
|
|
128
|
+
fullwidth?: boolean;
|
|
129
|
+
disabled?: boolean;
|
|
130
|
+
error?: boolean;
|
|
131
|
+
required?: boolean;
|
|
132
|
+
isFloatingLabel?: boolean;
|
|
133
|
+
keepCloseIconOnValue?: boolean;
|
|
134
|
+
hasClearIcon?: boolean;
|
|
135
|
+
labelClassName?: string;
|
|
136
|
+
className?: string;
|
|
137
|
+
} & Omit<React__default.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & React__default.RefAttributes<HTMLTextAreaElement>>;
|
|
138
|
+
|
|
102
139
|
type TextProps = {
|
|
103
140
|
variant?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "subtitile1" | "subtitile2" | "subtitile3" | "subtitile4" | "subtitile5" | "subtitile6" | "body1" | "body2" | "body3" | "body4" | "small1" | "small2" | "small3" | "small4" | "small5" | "small6" | "small7" | "small8" | "small9" | "label1" | "label2" | "buttonL" | "buttonMS";
|
|
104
141
|
color?: "primary" | "secondary" | "success" | "tertiary" | "info" | "warning" | "error";
|
|
@@ -772,4 +809,4 @@ declare function usePrevious<T>(value: T): T | undefined;
|
|
|
772
809
|
|
|
773
810
|
declare function cn(...inputs: ClassValue[]): string;
|
|
774
811
|
|
|
775
|
-
export { ActionButton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, Calendar, Checkbox, Collapsible, type CustomSliderProps, DataTable, type DataTableProps, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownProps, FocusedScrollView, Icon, Input, InputFilter, type InputFilterProps, type InputProps, Label, Loading, Navbar, type NavbarProps, type Options$1 as Options, Popover, PopoverContent, PopoverTrigger, ProgressBar, RadioGroup, RadioGroupItem, Search, type SearchProps, Slider, type SliderProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Text, TextInput, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipSimple, TooltipTrigger, Tree, type TreeData, TreeItem, type TreeItemProps, type TreeProps, cn, getEndDateOfDay, getStartDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, reducer, resloveTimestamp, toast, usePrevious, useToast };
|
|
812
|
+
export { ActionButton, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, type ButtonProps, Calendar, Checkbox, Collapsible, type CustomSliderProps, DataTable, type DataTableProps, DatePicker, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Dropdown, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type DropdownProps, FocusedScrollView, Icon, Input, InputFilter, type InputFilterProps, type InputProps, Label, Loading, Navbar, type NavbarProps, type Options$1 as Options, Popover, PopoverContent, PopoverTrigger, ProgressBar, RadioGroup, RadioGroupItem, Search, type SearchProps, Slider, type SliderProps, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Text, TextArea, type TextAreaProps, TextInput, Toast$1 as Toast, ToastAction, type ToastActionElement, ToastClose, ToastDescription, type ToastProps, ToastProvider, ToastTitle, ToastViewport, Toaster, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipSimple, TooltipTrigger, Tree, type TreeData, TreeItem, type TreeItemProps, type TreeProps, cn, getEndDateOfDay, getStartDateOfDay, getStartEndTimestampOfDay, getTimestampUTC, reducer, resloveTimestamp, toast, usePrevious, useToast };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import "./theme/global.css";
|
|
|
4
4
|
import "./icons/iconConfig";
|
|
5
5
|
export { default as Button } from "./components/Button/Button";
|
|
6
6
|
export { default as TextInput } from "./components/TextInput/TextInput";
|
|
7
|
+
export { default as TextArea } from "./components/TextArea/TextArea";
|
|
7
8
|
export { default as Text } from "./components/Text/Text";
|
|
8
9
|
export { default as Tabs } from "./components/Tabs/Tabs";
|
|
9
10
|
export { default as Dropdown } from "./components/Dropdown/Dropdown";
|
|
@@ -2770,6 +2770,10 @@ input[type=number] {
|
|
|
2770
2770
|
min-width: fit-content;
|
|
2771
2771
|
}
|
|
2772
2772
|
|
|
2773
|
+
.max-w-\[300px\] {
|
|
2774
|
+
max-width: 300px;
|
|
2775
|
+
}
|
|
2776
|
+
|
|
2773
2777
|
.max-w-full {
|
|
2774
2778
|
max-width: 100%;
|
|
2775
2779
|
}
|
|
@@ -2835,6 +2839,10 @@ input[type=number] {
|
|
|
2835
2839
|
cursor: default;
|
|
2836
2840
|
}
|
|
2837
2841
|
|
|
2842
|
+
.cursor-not-allowed {
|
|
2843
|
+
cursor: not-allowed;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2838
2846
|
.cursor-pointer {
|
|
2839
2847
|
cursor: pointer;
|
|
2840
2848
|
}
|
|
@@ -2849,6 +2857,10 @@ input[type=number] {
|
|
|
2849
2857
|
user-select: none;
|
|
2850
2858
|
}
|
|
2851
2859
|
|
|
2860
|
+
.resize-y {
|
|
2861
|
+
resize: vertical;
|
|
2862
|
+
}
|
|
2863
|
+
|
|
2852
2864
|
.resize {
|
|
2853
2865
|
resize: both;
|
|
2854
2866
|
}
|
|
@@ -3064,6 +3076,10 @@ input[type=number] {
|
|
|
3064
3076
|
white-space: nowrap;
|
|
3065
3077
|
}
|
|
3066
3078
|
|
|
3079
|
+
.break-all {
|
|
3080
|
+
word-break: break-all;
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3067
3083
|
.rounded {
|
|
3068
3084
|
border-radius: 0.25rem;
|
|
3069
3085
|
}
|
|
@@ -5391,6 +5407,14 @@ input[type=number] {
|
|
|
5391
5407
|
padding-right: var(--spacing-spacing-xxl);
|
|
5392
5408
|
}
|
|
5393
5409
|
|
|
5410
|
+
.pt-2 {
|
|
5411
|
+
padding-top: 0.5rem;
|
|
5412
|
+
}
|
|
5413
|
+
|
|
5414
|
+
.pt-4 {
|
|
5415
|
+
padding-top: 1rem;
|
|
5416
|
+
}
|
|
5417
|
+
|
|
5394
5418
|
.text-left {
|
|
5395
5419
|
text-align: left;
|
|
5396
5420
|
}
|
|
@@ -6312,6 +6336,28 @@ input[type=number] {
|
|
|
6312
6336
|
font-weight: var(--button-button-ms-weight, 700);
|
|
6313
6337
|
}
|
|
6314
6338
|
|
|
6339
|
+
.ui-scrollbar::-webkit-scrollbar {
|
|
6340
|
+
height: 6px;
|
|
6341
|
+
width: 6px;
|
|
6342
|
+
background: rgba(0, 0, 0, 0.08);
|
|
6343
|
+
}
|
|
6344
|
+
|
|
6345
|
+
.ui-scrollbar::-webkit-scrollbar-thumb {
|
|
6346
|
+
border-radius: 6px;
|
|
6347
|
+
background: rgba(121, 141, 150, 0.48);
|
|
6348
|
+
width: 6px;
|
|
6349
|
+
}
|
|
6350
|
+
|
|
6351
|
+
.ui-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
6352
|
+
background: rgba(251, 252, 253, 0.48);
|
|
6353
|
+
cursor: pointer;
|
|
6354
|
+
}
|
|
6355
|
+
|
|
6356
|
+
.ui-scrollbar::-webkit-scrollbar-corner {
|
|
6357
|
+
display: none;
|
|
6358
|
+
/* background: transparent; */
|
|
6359
|
+
}
|
|
6360
|
+
|
|
6315
6361
|
.placeholder\:text-input-default-text::-moz-placeholder {
|
|
6316
6362
|
--tw-text-opacity: 1;
|
|
6317
6363
|
color: color-mix(in srgb, var(--input-color-default-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
package/package.json
CHANGED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { TextArea, type TextAreaProps } from "@/index";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof TextArea> = {
|
|
6
|
+
title: "Components/TextArea",
|
|
7
|
+
component: TextArea,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "fullscreen",
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<div className="p-5 flex h-screen w-full bg-base-bg2">
|
|
15
|
+
<Story />
|
|
16
|
+
</div>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
argTypes: {
|
|
20
|
+
size: {
|
|
21
|
+
control: { type: "radio" },
|
|
22
|
+
options: ["sm", "md", "lg"],
|
|
23
|
+
},
|
|
24
|
+
rounded: {
|
|
25
|
+
control: { type: "radio" },
|
|
26
|
+
options: ["none", "normal", "full"],
|
|
27
|
+
},
|
|
28
|
+
variant: {
|
|
29
|
+
control: { type: "radio" },
|
|
30
|
+
options: ["flat", "outline", "underline"],
|
|
31
|
+
},
|
|
32
|
+
isFloatingLabel: { control: "boolean" },
|
|
33
|
+
fullwidth: { control: "boolean" },
|
|
34
|
+
disabled: { control: "boolean" },
|
|
35
|
+
error: { control: "boolean" },
|
|
36
|
+
required: { control: "boolean" },
|
|
37
|
+
},
|
|
38
|
+
args: {
|
|
39
|
+
label: "Description",
|
|
40
|
+
placeholder: "Type here...",
|
|
41
|
+
size: "md",
|
|
42
|
+
rounded: "normal",
|
|
43
|
+
variant: "outline",
|
|
44
|
+
isFloatingLabel: true,
|
|
45
|
+
fullwidth: true,
|
|
46
|
+
disabled: false,
|
|
47
|
+
error: false,
|
|
48
|
+
required: true,
|
|
49
|
+
hasClearIcon: true,
|
|
50
|
+
rows: 2,
|
|
51
|
+
} satisfies Partial<TextAreaProps>,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default meta;
|
|
55
|
+
type Story = StoryObj<typeof TextArea>;
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
render: (args) => {
|
|
59
|
+
console.log("args ", args);
|
|
60
|
+
const props: typeof args = {
|
|
61
|
+
...args,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<div className="flex flex-row gap-4 w-full">
|
|
66
|
+
<TextArea id="1" {...props} size="lg" />
|
|
67
|
+
<TextArea id="2" {...props} size="md" />
|
|
68
|
+
<TextArea id="3" {...props} size="sm" />
|
|
69
|
+
</div>
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const ErrorState: Story = {
|
|
75
|
+
args: {
|
|
76
|
+
error: true,
|
|
77
|
+
errorMessage: "This field is required",
|
|
78
|
+
},
|
|
79
|
+
render: (args) => {
|
|
80
|
+
console.log("args ", args);
|
|
81
|
+
const props: typeof args = {
|
|
82
|
+
...args,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className="flex flex-row gap-4 w-full">
|
|
87
|
+
<TextArea id="1" {...props} size="lg" />
|
|
88
|
+
<TextArea id="2" {...props} size="md" />
|
|
89
|
+
<TextArea id="3" {...props} size="sm" />
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const HelperText: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
helperText: "You can write up to 500 characters.",
|
|
98
|
+
},
|
|
99
|
+
render: (args) => {
|
|
100
|
+
console.log("args ", args);
|
|
101
|
+
const props: typeof args = {
|
|
102
|
+
...args,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div className="flex flex-row gap-4 w-full">
|
|
107
|
+
<TextArea id="1" {...props} size="lg" />
|
|
108
|
+
<TextArea id="2" {...props} size="md" />
|
|
109
|
+
<TextArea id="3" {...props} size="sm" />
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Disabled: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
disabled: true,
|
|
118
|
+
value: "Disabled text area",
|
|
119
|
+
},
|
|
120
|
+
render: (args) => {
|
|
121
|
+
console.log("args ", args);
|
|
122
|
+
const props: typeof args = {
|
|
123
|
+
...args,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div className="flex flex-row gap-4 w-full">
|
|
128
|
+
<TextArea id="1" {...props} size="lg" />
|
|
129
|
+
<TextArea id="2" {...props} size="md" />
|
|
130
|
+
<TextArea id="3" {...props} size="sm" />
|
|
131
|
+
</div>
|
|
132
|
+
);
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
export const textareaVariant = cva(
|
|
4
|
+
[
|
|
5
|
+
"peer block w-full bg-transparent outline-none placeholder:text-transparent resize-y ui-scrollbar",
|
|
6
|
+
"text-input-filled-text caret-primary",
|
|
7
|
+
],
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "p-2 px-3 typography-small1",
|
|
12
|
+
md: "py-2 px-3 typography-subtitile4",
|
|
13
|
+
lg: "p-4 typography-subtitile1",
|
|
14
|
+
},
|
|
15
|
+
rounded: {
|
|
16
|
+
none: "rounded-none",
|
|
17
|
+
normal: "rounded-md",
|
|
18
|
+
full: "rounded-full",
|
|
19
|
+
},
|
|
20
|
+
variant: {
|
|
21
|
+
flat: "",
|
|
22
|
+
outline: [
|
|
23
|
+
"ring-1 ring-inset ring-input-default-stroke",
|
|
24
|
+
"hover:ring-input-active-stroke",
|
|
25
|
+
"focus:ring-1 focus:ring-inset focus:ring-input-active-stroke",
|
|
26
|
+
],
|
|
27
|
+
underline:
|
|
28
|
+
"border-b-2 border-input-default-stroke transition-colors hover:border-input-active-stroke focus:border-input-stroke",
|
|
29
|
+
},
|
|
30
|
+
fullwidth: {
|
|
31
|
+
true: "w-full",
|
|
32
|
+
},
|
|
33
|
+
disabled: {
|
|
34
|
+
true: [
|
|
35
|
+
"bg-input-disable-bg text-input-disable-text ring-input-disable-stroke placeholder:text-input-disable-text",
|
|
36
|
+
"hover:ring-input-disable-stroke",
|
|
37
|
+
"cursor-not-allowed",
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
error: {
|
|
41
|
+
true: "ring-input-error focus:ring-input-error",
|
|
42
|
+
},
|
|
43
|
+
hasClearIcon: {
|
|
44
|
+
true: "",
|
|
45
|
+
},
|
|
46
|
+
isFloatingLabel: {
|
|
47
|
+
true: "",
|
|
48
|
+
false: "placeholder:text-input-placeholder",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
compoundVariants: [
|
|
52
|
+
{
|
|
53
|
+
variant: "underline",
|
|
54
|
+
className: "rounded-none",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
hasClearIcon: true,
|
|
58
|
+
size: "sm",
|
|
59
|
+
class: "focus:pe-6",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
hasClearIcon: true,
|
|
63
|
+
size: "md",
|
|
64
|
+
class: "focus:pe-8",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
hasClearIcon: true,
|
|
68
|
+
size: "lg",
|
|
69
|
+
class: "focus:pe-10",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
defaultVariants: {
|
|
73
|
+
size: "md",
|
|
74
|
+
variant: "outline",
|
|
75
|
+
rounded: "normal",
|
|
76
|
+
fullwidth: false,
|
|
77
|
+
disabled: false,
|
|
78
|
+
error: false,
|
|
79
|
+
hasClearIcon: false,
|
|
80
|
+
isFloatingLabel: true,
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
export const labelVariant = cva(
|
|
86
|
+
[
|
|
87
|
+
"absolute block duration-450 transition-all px-[2px] text-input-default-text",
|
|
88
|
+
"peer-focus:text-input-filled-text peer-focus:bg-input-label-bg",
|
|
89
|
+
],
|
|
90
|
+
{
|
|
91
|
+
variants: {
|
|
92
|
+
size: {
|
|
93
|
+
sm: [],
|
|
94
|
+
md: [],
|
|
95
|
+
lg: [],
|
|
96
|
+
},
|
|
97
|
+
disabled: {
|
|
98
|
+
true: "text-input-default-text placeholder:text-input-default-text",
|
|
99
|
+
},
|
|
100
|
+
error: {
|
|
101
|
+
true: "ring-error",
|
|
102
|
+
},
|
|
103
|
+
isFloatingLabel: {
|
|
104
|
+
false: "hidden peer-placeholder-shown:block peer-focus:bg-transparent",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
compoundVariants: [
|
|
108
|
+
// floating = true
|
|
109
|
+
{
|
|
110
|
+
isFloatingLabel: true,
|
|
111
|
+
size: "sm",
|
|
112
|
+
className: [
|
|
113
|
+
"left-3 -top-1.5 typography-label2 bg-input-label-bg",
|
|
114
|
+
"peer-placeholder-shown:top-2 peer-placeholder-shown:typography-small1 peer-placeholder-shown:bg-transparent",
|
|
115
|
+
"peer-focus:-top-1.5 peer-focus:typography-label2",
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
isFloatingLabel: true,
|
|
120
|
+
size: "md",
|
|
121
|
+
className: [
|
|
122
|
+
"left-3 -top-1.5 typography-label1 bg-input-label-bg",
|
|
123
|
+
"peer-placeholder-shown:top-2 peer-placeholder-shown:typography-subtitile4 peer-placeholder-shown:bg-transparent",
|
|
124
|
+
"peer-focus:-top-1.5 peer-focus:typography-label1",
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
isFloatingLabel: true,
|
|
129
|
+
size: "lg",
|
|
130
|
+
className: [
|
|
131
|
+
"left-4 -top-1.5 typography-label1 bg-input-label-bg",
|
|
132
|
+
"peer-placeholder-shown:top-4 peer-placeholder-shown:typography-subtitile1 peer-placeholder-shown:bg-transparent",
|
|
133
|
+
"peer-focus:-top-1.5 peer-focus:typography-label1",
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
// --------------
|
|
137
|
+
// floating = false
|
|
138
|
+
{
|
|
139
|
+
isFloatingLabel: false,
|
|
140
|
+
size: "sm",
|
|
141
|
+
className: [
|
|
142
|
+
"left-3 peer-placeholder-shown:top-2 peer-placeholder-shown:typography-small1",
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
isFloatingLabel: false,
|
|
147
|
+
size: "md",
|
|
148
|
+
className: [
|
|
149
|
+
"left-3 peer-placeholder-shown:top-2 peer-placeholder-shown:typography-subtitile4",
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
isFloatingLabel: false,
|
|
154
|
+
size: "lg",
|
|
155
|
+
className: [
|
|
156
|
+
"left-4 peer-placeholder-shown:top-4 peer-placeholder-shown:typography-subtitile1",
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
defaultVariants: {
|
|
161
|
+
size: "md",
|
|
162
|
+
disabled: false,
|
|
163
|
+
error: false,
|
|
164
|
+
isFloatingLabel: true,
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
export const clearIconWrapperVariant = cva(
|
|
170
|
+
[
|
|
171
|
+
"absolute inset-y-0 right-0 items-start justify-center hidden peer-focus:flex",
|
|
172
|
+
],
|
|
173
|
+
{
|
|
174
|
+
variants: {
|
|
175
|
+
size: {
|
|
176
|
+
sm: "mr-2 pt-2",
|
|
177
|
+
md: "mr-3 pt-2",
|
|
178
|
+
lg: "mr-4 pt-4",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
defaultVariants: {
|
|
182
|
+
size: "md",
|
|
183
|
+
},
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
export const clearIconVariant = cva(
|
|
188
|
+
[
|
|
189
|
+
"cursor-pointer z-50 fill-input-active-stroke hover:fill-input-default-text",
|
|
190
|
+
],
|
|
191
|
+
{
|
|
192
|
+
variants: {
|
|
193
|
+
size: {
|
|
194
|
+
sm: "size-3",
|
|
195
|
+
md: "size-4",
|
|
196
|
+
lg: "size-5",
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
defaultVariants: {
|
|
200
|
+
size: "md",
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
export const helperTextVariant = cva(
|
|
206
|
+
["text-small1 flex flex-row items-center gap-1"],
|
|
207
|
+
{
|
|
208
|
+
variants: {
|
|
209
|
+
size: {
|
|
210
|
+
sm: "mt-1",
|
|
211
|
+
md: "mt-[6px]",
|
|
212
|
+
lg: "mt-[6px]",
|
|
213
|
+
},
|
|
214
|
+
disabled: {
|
|
215
|
+
true: "text-input-disable-text",
|
|
216
|
+
},
|
|
217
|
+
error: {
|
|
218
|
+
true: "text-input-error",
|
|
219
|
+
false: "text-input-filled-text",
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
defaultVariants: {
|
|
223
|
+
size: "md",
|
|
224
|
+
disabled: false,
|
|
225
|
+
error: false,
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
);
|