@agility/plenum-ui 2.0.0-rc47 → 2.0.0-rc49
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/.eslintrc.json +6 -6
- package/.prettierrc +13 -13
- package/.storybook/Layout.jsx +12 -12
- package/.storybook/head.tsx +4 -4
- package/.storybook/main.ts +18 -18
- package/.storybook/manager-head.html +1 -1
- package/.storybook/manager.ts +25 -25
- package/.storybook/plenumTheme.ts +8 -8
- package/.storybook/preview-head.html +3 -3
- package/.storybook/preview.tsx +28 -28
- package/.vscode/settings.json +3 -3
- package/README.md +271 -271
- package/app/globals.css +99 -99
- package/app/head.tsx +59 -59
- package/app/layout.tsx +28 -28
- package/app/page.tsx +7 -7
- package/build.js +45 -45
- package/dist/index.d.ts +232 -230
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/types/stories/molecules/inputs/select/Select.d.ts +2 -0
- package/local.sh +100 -100
- package/next.config.js +8 -8
- package/package.json +82 -82
- package/pages/api/hello.ts +13 -13
- package/postcss.config.js +6 -6
- package/rollup.config.mjs +41 -41
- package/scripts/create-component.js +97 -97
- package/stories/Introduction.mdx +314 -314
- package/stories/assets/stackalt.svg +1 -1
- package/stories/atoms/Avatar/Avatar.stories.tsx +96 -96
- package/stories/atoms/Avatar/Avatar.tsx +123 -123
- package/stories/atoms/Avatar/index.ts +3 -3
- package/stories/atoms/badges/Badge.tsx +127 -127
- package/stories/atoms/badges/Pill/Pill.stories.tsx +75 -75
- package/stories/atoms/badges/Rounded/Rounded.stories.tsx +75 -75
- package/stories/atoms/badges/index.ts +3 -3
- package/stories/atoms/buttons/Button/Alternative/Alternative.stories.ts +86 -86
- package/stories/atoms/buttons/Button/Button.tsx +232 -232
- package/stories/atoms/buttons/Button/Danger/Danger.stories.ts +90 -90
- package/stories/atoms/buttons/Button/Primary/Primary.stories.ts +97 -97
- package/stories/atoms/buttons/Button/Secondary/Secondary.stories.ts +93 -93
- package/stories/atoms/buttons/Button/defaultArgs.ts +9 -9
- package/stories/atoms/buttons/Button/index.ts +3 -3
- package/stories/atoms/buttons/Capsule/Alternative/Alternative.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Capsule.tsx +88 -88
- package/stories/atoms/buttons/Capsule/Danger/Danger.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Primary/Primary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/Secondary/Secondary.stories.ts +27 -27
- package/stories/atoms/buttons/Capsule/index.ts +3 -3
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.stories.tsx +15 -15
- package/stories/atoms/buttons/FloatingActionButton/FloatingActionButton.tsx +22 -22
- package/stories/atoms/buttons/FloatingActionButton/index.tsx +3 -3
- package/stories/atoms/buttons/index.ts +4 -4
- package/stories/atoms/crumb/Crumb.stories.tsx +18 -18
- package/stories/atoms/crumb/Crumb.tsx +22 -22
- package/stories/atoms/crumb/index.tsx +3 -3
- package/stories/atoms/icons/DynamicIcon.stories.ts +43 -43
- package/stories/atoms/icons/DynamicIcon.tsx +90 -90
- package/stories/atoms/icons/IconWithShadow.stories.ts +43 -43
- package/stories/atoms/icons/IconWithShadow.tsx +16 -16
- package/stories/atoms/icons/TablerIcon.tsx +22 -22
- package/stories/atoms/icons/index.tsx +14 -14
- package/stories/atoms/icons/tablerIconNames.ts +4336 -4336
- package/stories/atoms/index.ts +46 -46
- package/stories/atoms/loaders/Loader.stories.ts +15 -15
- package/stories/atoms/loaders/Loader.tsx +21 -21
- package/stories/atoms/loaders/NProgress/RadialProgress.stories.tsx +19 -19
- package/stories/atoms/loaders/NProgress/RadialProgress.tsx +74 -74
- package/stories/atoms/loaders/NProgress/index.ts +3 -3
- package/stories/atoms/loaders/index.ts +4 -4
- package/stories/index.ts +136 -136
- package/stories/molecules/index.ts +51 -51
- package/stories/molecules/inputs/InputCounter/InputCounter.stories.tsx +18 -18
- package/stories/molecules/inputs/InputCounter/InputCounter.tsx +24 -24
- package/stories/molecules/inputs/InputCounter/index.tsx +3 -3
- package/stories/molecules/inputs/InputField/InputField.stories.tsx +29 -29
- package/stories/molecules/inputs/InputField/InputField.tsx +96 -96
- package/stories/molecules/inputs/InputField/index.tsx +3 -3
- package/stories/molecules/inputs/InputLabel/InputLabel.stories.tsx +19 -19
- package/stories/molecules/inputs/InputLabel/InputLabel.tsx +45 -45
- package/stories/molecules/inputs/InputLabel/index.tsx +3 -3
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.stories.tsx +52 -52
- package/stories/molecules/inputs/NestedInputButton/NestedInputButton.tsx +64 -64
- package/stories/molecules/inputs/NestedInputButton/index.tsx +3 -3
- package/stories/molecules/inputs/TextInput/TextInput.stories.tsx +32 -32
- package/stories/molecules/inputs/TextInput/TextInput.tsx +165 -165
- package/stories/molecules/inputs/TextInput/index.tsx +5 -5
- package/stories/molecules/inputs/checkbox/Checkbox.stories.ts +23 -23
- package/stories/molecules/inputs/checkbox/Checkbox.tsx +98 -98
- package/stories/molecules/inputs/checkbox/index.ts +3 -3
- package/stories/molecules/inputs/combobox/ComboBox.stories.ts +41 -41
- package/stories/molecules/inputs/combobox/ComboBox.tsx +185 -185
- package/stories/molecules/inputs/combobox/index.ts +3 -3
- package/stories/molecules/inputs/index.ts +38 -38
- package/stories/molecules/inputs/radio/Radio.stories.ts +27 -27
- package/stories/molecules/inputs/radio/Radio.tsx +92 -92
- package/stories/molecules/inputs/radio/index.ts +3 -3
- package/stories/molecules/inputs/select/Select.stories.ts +23 -23
- package/stories/molecules/inputs/select/Select.tsx +108 -100
- package/stories/molecules/inputs/select/index.ts +3 -3
- package/stories/molecules/inputs/textArea/TextArea.stories.ts +22 -22
- package/stories/molecules/inputs/textArea/TextArea.tsx +158 -158
- package/stories/molecules/inputs/textArea/index.ts +3 -3
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.stories.tsx +118 -118
- package/stories/molecules/inputs/toggleSwitch/ToggleSwitch.tsx +81 -81
- package/stories/molecules/inputs/toggleSwitch/index.ts +3 -3
- package/stories/molecules/tabs/Tabs.stories.tsx +18 -18
- package/stories/molecules/tabs/Tabs.tsx +22 -22
- package/stories/molecules/tabs/index.tsx +2 -2
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.stories.tsx +30 -30
- package/stories/organisms/AnimatedLabelInput/AnimatedLabelInput.tsx +66 -66
- package/stories/organisms/AnimatedLabelInput/index.tsx +3 -3
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.stories.tsx +26 -26
- package/stories/organisms/AnimatedLabelTextArea/AnimatedLabelTextArea.tsx +61 -61
- package/stories/organisms/AnimatedLabelTextArea/index.tsx +3 -3
- package/stories/organisms/ButtonDropdown/ButtonDropdown.stories.tsx +125 -125
- package/stories/organisms/ButtonDropdown/ButtonDropdown.tsx +86 -86
- package/stories/organisms/ButtonDropdown/index.tsx +3 -3
- package/stories/organisms/DropdownComponent/Dropdown.stories.tsx +73 -73
- package/stories/organisms/DropdownComponent/DropdownComponent.tsx +346 -346
- package/stories/organisms/DropdownComponent/dropdownItems.ts +122 -122
- package/stories/organisms/DropdownComponent/index.ts +4 -4
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.stories.tsx +76 -76
- package/stories/organisms/EmptySectionPlaceholder/EmptySectionPlaceholder.tsx +52 -52
- package/stories/organisms/EmptySectionPlaceholder/index.tsx +4 -4
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.stories.tsx +29 -29
- package/stories/organisms/FormInputWithAddons/FormInputWithAddons.tsx +145 -145
- package/stories/organisms/FormInputWithAddons/index.tsx +3 -3
- package/stories/organisms/TextInputSelect/InputSelect.tsx +59 -59
- package/stories/organisms/TextInputSelect/TextInputSelect.stories.tsx +33 -33
- package/stories/organisms/TextInputSelect/TextInputSelect.tsx +186 -186
- package/stories/organisms/TextInputSelect/index.tsx +3 -3
- package/stories/organisms/index.ts +27 -27
- package/tailwind.config.js +192 -192
- package/tsconfig.json +29 -29
- package/tsconfig.lib.json +25 -25
- package/utils/types.d.ts +2 -2
- package/utils/types.ts +3 -3
- package/utils/useId.d.ts +1 -1
- package/utils/useId.tsx +16 -16
|
@@ -1,158 +1,158 @@
|
|
|
1
|
-
import React, { forwardRef, useEffect, useId, useState } from "react"
|
|
2
|
-
import { default as cn } from "classnames"
|
|
3
|
-
import InputLabel from "../InputLabel"
|
|
4
|
-
import InputCounter from "../InputCounter"
|
|
5
|
-
|
|
6
|
-
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
7
|
-
display: string
|
|
8
|
-
htmlFor?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
12
|
-
/** Input ID */
|
|
13
|
-
id?: string
|
|
14
|
-
/** Input Name */
|
|
15
|
-
name?: string
|
|
16
|
-
/** Label for the input */
|
|
17
|
-
label?: ILabelProps
|
|
18
|
-
/** Error state */
|
|
19
|
-
isError?: boolean
|
|
20
|
-
/** If field is required */
|
|
21
|
-
isRequired?: boolean
|
|
22
|
-
/** Disabled state */
|
|
23
|
-
isDisabled?: boolean
|
|
24
|
-
/** Set default value */
|
|
25
|
-
defaultValue?: string
|
|
26
|
-
|
|
27
|
-
value?: string
|
|
28
|
-
|
|
29
|
-
/** Message shown under the text field */
|
|
30
|
-
message?: string
|
|
31
|
-
/** Input character counter */
|
|
32
|
-
isShowCounter?: boolean
|
|
33
|
-
/** Max length of input character */
|
|
34
|
-
maxLength?: number
|
|
35
|
-
/** Callback on change */
|
|
36
|
-
onChange?(value: string): void
|
|
37
|
-
/** Number of rows */
|
|
38
|
-
rows?: number
|
|
39
|
-
/** Number of cols */
|
|
40
|
-
cols?: number
|
|
41
|
-
placeholder?: string
|
|
42
|
-
className?: string
|
|
43
|
-
ref?: React.LegacyRef<HTMLTextAreaElement>
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const Textarea: React.FC<ITextareaProps> = ({
|
|
47
|
-
id,
|
|
48
|
-
name,
|
|
49
|
-
label,
|
|
50
|
-
isError,
|
|
51
|
-
isRequired,
|
|
52
|
-
isDisabled,
|
|
53
|
-
defaultValue,
|
|
54
|
-
message,
|
|
55
|
-
isShowCounter,
|
|
56
|
-
maxLength,
|
|
57
|
-
rows = 12,
|
|
58
|
-
cols = 48,
|
|
59
|
-
onChange,
|
|
60
|
-
value,
|
|
61
|
-
placeholder,
|
|
62
|
-
className,
|
|
63
|
-
ref,
|
|
64
|
-
...rest
|
|
65
|
-
}) => {
|
|
66
|
-
const uniqueID = useId()
|
|
67
|
-
|
|
68
|
-
const discriptionStyles = cn("text-sm mt-1 block", { "text-gray-500": !isError }, { "text-red-500": isError })
|
|
69
|
-
|
|
70
|
-
if (!id) id = `ta-${uniqueID}`
|
|
71
|
-
|
|
72
|
-
if (!label) {
|
|
73
|
-
return (
|
|
74
|
-
<textarea
|
|
75
|
-
ref={ref}
|
|
76
|
-
maxLength={maxLength}
|
|
77
|
-
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
78
|
-
const targetValue = e.target.value
|
|
79
|
-
if (onChange) {
|
|
80
|
-
onChange(targetValue)
|
|
81
|
-
}
|
|
82
|
-
}}
|
|
83
|
-
rows={rows}
|
|
84
|
-
name={name}
|
|
85
|
-
id={id}
|
|
86
|
-
cols={cols}
|
|
87
|
-
className={cn(
|
|
88
|
-
"peer block w-full rounded focus:border-purple-500 focus:ring-purple-500 sm:text-sm",
|
|
89
|
-
{ "border-gray-300 ": !isError },
|
|
90
|
-
{
|
|
91
|
-
"border-red-500 outline-red-500 focus:ring-red-500": isError
|
|
92
|
-
},
|
|
93
|
-
className
|
|
94
|
-
)}
|
|
95
|
-
disabled={isDisabled}
|
|
96
|
-
defaultValue={defaultValue}
|
|
97
|
-
value={value}
|
|
98
|
-
placeholder={placeholder}
|
|
99
|
-
{...rest}
|
|
100
|
-
/>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//with label
|
|
105
|
-
return (
|
|
106
|
-
<div>
|
|
107
|
-
<InputLabel
|
|
108
|
-
isPlaceholder
|
|
109
|
-
isActive
|
|
110
|
-
label={label.display}
|
|
111
|
-
isRequired={isRequired}
|
|
112
|
-
id={id}
|
|
113
|
-
isError={isError}
|
|
114
|
-
isDisabled={isDisabled}
|
|
115
|
-
/>
|
|
116
|
-
|
|
117
|
-
<div>
|
|
118
|
-
<textarea
|
|
119
|
-
ref={ref}
|
|
120
|
-
maxLength={maxLength}
|
|
121
|
-
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
122
|
-
const targetValue = e.target.value
|
|
123
|
-
if (onChange) {
|
|
124
|
-
onChange(targetValue)
|
|
125
|
-
}
|
|
126
|
-
}}
|
|
127
|
-
rows={rows}
|
|
128
|
-
name={name}
|
|
129
|
-
id={id}
|
|
130
|
-
cols={cols}
|
|
131
|
-
className={cn(
|
|
132
|
-
"block w-full rounded focus:border-purple-500 focus:ring-purple-500 sm:text-sm",
|
|
133
|
-
{ "border-gray-300 ": !isError },
|
|
134
|
-
{
|
|
135
|
-
"border-red-500 outline-red-500 focus:ring-red-500": isError
|
|
136
|
-
},
|
|
137
|
-
className
|
|
138
|
-
)}
|
|
139
|
-
disabled={isDisabled}
|
|
140
|
-
defaultValue={defaultValue}
|
|
141
|
-
value={value}
|
|
142
|
-
placeholder={placeholder}
|
|
143
|
-
{...rest}
|
|
144
|
-
/>
|
|
145
|
-
</div>
|
|
146
|
-
<div className="flex flex-row space-x-3">
|
|
147
|
-
<div className="grow">{message && <span className={discriptionStyles}>{message}</span>}</div>
|
|
148
|
-
{isShowCounter && (
|
|
149
|
-
<div className="shrink-0">
|
|
150
|
-
<InputCounter current={Number(value?.length)} limit={maxLength} />
|
|
151
|
-
</div>
|
|
152
|
-
)}
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export default Textarea
|
|
1
|
+
import React, { forwardRef, useEffect, useId, useState } from "react"
|
|
2
|
+
import { default as cn } from "classnames"
|
|
3
|
+
import InputLabel from "../InputLabel"
|
|
4
|
+
import InputCounter from "../InputCounter"
|
|
5
|
+
|
|
6
|
+
interface ILabelProps extends React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement> {
|
|
7
|
+
display: string
|
|
8
|
+
htmlFor?: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ITextareaProps extends Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "onChange"> {
|
|
12
|
+
/** Input ID */
|
|
13
|
+
id?: string
|
|
14
|
+
/** Input Name */
|
|
15
|
+
name?: string
|
|
16
|
+
/** Label for the input */
|
|
17
|
+
label?: ILabelProps
|
|
18
|
+
/** Error state */
|
|
19
|
+
isError?: boolean
|
|
20
|
+
/** If field is required */
|
|
21
|
+
isRequired?: boolean
|
|
22
|
+
/** Disabled state */
|
|
23
|
+
isDisabled?: boolean
|
|
24
|
+
/** Set default value */
|
|
25
|
+
defaultValue?: string
|
|
26
|
+
|
|
27
|
+
value?: string
|
|
28
|
+
|
|
29
|
+
/** Message shown under the text field */
|
|
30
|
+
message?: string
|
|
31
|
+
/** Input character counter */
|
|
32
|
+
isShowCounter?: boolean
|
|
33
|
+
/** Max length of input character */
|
|
34
|
+
maxLength?: number
|
|
35
|
+
/** Callback on change */
|
|
36
|
+
onChange?(value: string): void
|
|
37
|
+
/** Number of rows */
|
|
38
|
+
rows?: number
|
|
39
|
+
/** Number of cols */
|
|
40
|
+
cols?: number
|
|
41
|
+
placeholder?: string
|
|
42
|
+
className?: string
|
|
43
|
+
ref?: React.LegacyRef<HTMLTextAreaElement>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const Textarea: React.FC<ITextareaProps> = ({
|
|
47
|
+
id,
|
|
48
|
+
name,
|
|
49
|
+
label,
|
|
50
|
+
isError,
|
|
51
|
+
isRequired,
|
|
52
|
+
isDisabled,
|
|
53
|
+
defaultValue,
|
|
54
|
+
message,
|
|
55
|
+
isShowCounter,
|
|
56
|
+
maxLength,
|
|
57
|
+
rows = 12,
|
|
58
|
+
cols = 48,
|
|
59
|
+
onChange,
|
|
60
|
+
value,
|
|
61
|
+
placeholder,
|
|
62
|
+
className,
|
|
63
|
+
ref,
|
|
64
|
+
...rest
|
|
65
|
+
}) => {
|
|
66
|
+
const uniqueID = useId()
|
|
67
|
+
|
|
68
|
+
const discriptionStyles = cn("text-sm mt-1 block", { "text-gray-500": !isError }, { "text-red-500": isError })
|
|
69
|
+
|
|
70
|
+
if (!id) id = `ta-${uniqueID}`
|
|
71
|
+
|
|
72
|
+
if (!label) {
|
|
73
|
+
return (
|
|
74
|
+
<textarea
|
|
75
|
+
ref={ref}
|
|
76
|
+
maxLength={maxLength}
|
|
77
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
78
|
+
const targetValue = e.target.value
|
|
79
|
+
if (onChange) {
|
|
80
|
+
onChange(targetValue)
|
|
81
|
+
}
|
|
82
|
+
}}
|
|
83
|
+
rows={rows}
|
|
84
|
+
name={name}
|
|
85
|
+
id={id}
|
|
86
|
+
cols={cols}
|
|
87
|
+
className={cn(
|
|
88
|
+
"peer block w-full rounded focus:border-purple-500 focus:ring-purple-500 sm:text-sm",
|
|
89
|
+
{ "border-gray-300 ": !isError },
|
|
90
|
+
{
|
|
91
|
+
"border-red-500 outline-red-500 focus:ring-red-500": isError
|
|
92
|
+
},
|
|
93
|
+
className
|
|
94
|
+
)}
|
|
95
|
+
disabled={isDisabled}
|
|
96
|
+
defaultValue={defaultValue}
|
|
97
|
+
value={value}
|
|
98
|
+
placeholder={placeholder}
|
|
99
|
+
{...rest}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//with label
|
|
105
|
+
return (
|
|
106
|
+
<div>
|
|
107
|
+
<InputLabel
|
|
108
|
+
isPlaceholder
|
|
109
|
+
isActive
|
|
110
|
+
label={label.display}
|
|
111
|
+
isRequired={isRequired}
|
|
112
|
+
id={id}
|
|
113
|
+
isError={isError}
|
|
114
|
+
isDisabled={isDisabled}
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
<div>
|
|
118
|
+
<textarea
|
|
119
|
+
ref={ref}
|
|
120
|
+
maxLength={maxLength}
|
|
121
|
+
onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
122
|
+
const targetValue = e.target.value
|
|
123
|
+
if (onChange) {
|
|
124
|
+
onChange(targetValue)
|
|
125
|
+
}
|
|
126
|
+
}}
|
|
127
|
+
rows={rows}
|
|
128
|
+
name={name}
|
|
129
|
+
id={id}
|
|
130
|
+
cols={cols}
|
|
131
|
+
className={cn(
|
|
132
|
+
"block w-full rounded focus:border-purple-500 focus:ring-purple-500 sm:text-sm",
|
|
133
|
+
{ "border-gray-300 ": !isError },
|
|
134
|
+
{
|
|
135
|
+
"border-red-500 outline-red-500 focus:ring-red-500": isError
|
|
136
|
+
},
|
|
137
|
+
className
|
|
138
|
+
)}
|
|
139
|
+
disabled={isDisabled}
|
|
140
|
+
defaultValue={defaultValue}
|
|
141
|
+
value={value}
|
|
142
|
+
placeholder={placeholder}
|
|
143
|
+
{...rest}
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
<div className="flex flex-row space-x-3">
|
|
147
|
+
<div className="grow">{message && <span className={discriptionStyles}>{message}</span>}</div>
|
|
148
|
+
{isShowCounter && (
|
|
149
|
+
<div className="shrink-0">
|
|
150
|
+
<InputCounter current={Number(value?.length)} limit={maxLength} />
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
</div>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export default Textarea
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import TextArea, { ITextareaProps } from "./TextArea"
|
|
2
|
-
export type { ITextareaProps }
|
|
3
|
-
export default TextArea
|
|
1
|
+
import TextArea, { ITextareaProps } from "./TextArea"
|
|
2
|
+
export type { ITextareaProps }
|
|
3
|
+
export default TextArea
|
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
import Button from "stories/atoms/buttons/Button/Button"
|
|
2
|
-
|
|
3
|
-
import type { Meta, StoryObj } from "@storybook/react"
|
|
4
|
-
|
|
5
|
-
import ToggleSwitch from "./ToggleSwitch"
|
|
6
|
-
const meta: Meta<typeof ToggleSwitch> = {
|
|
7
|
-
title: "Design System/Molecules/Inputs/ToggleSwitch",
|
|
8
|
-
component: ToggleSwitch,
|
|
9
|
-
tags: ["autodocs"]
|
|
10
|
-
}
|
|
11
|
-
type Story = StoryObj<typeof ToggleSwitch>
|
|
12
|
-
export const DefaultToggleSwitch: Story = {
|
|
13
|
-
args: {
|
|
14
|
-
isChecked: false,
|
|
15
|
-
onChange: (v: boolean) => {
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
label: {
|
|
19
|
-
text: "label me",
|
|
20
|
-
className: "text-lg text-gray-400",
|
|
21
|
-
xPosition: "left",
|
|
22
|
-
},
|
|
23
|
-
variant: "base",
|
|
24
|
-
id: "toggle-switch-1",
|
|
25
|
-
name: "toggle one",
|
|
26
|
-
},
|
|
27
|
-
}
|
|
28
|
-
export const ShortToggleSwitch: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
...DefaultToggleSwitch.args,
|
|
31
|
-
label: {
|
|
32
|
-
text: "label me too",
|
|
33
|
-
className: "text-lg text-gray-400",
|
|
34
|
-
xPosition: "left",
|
|
35
|
-
},
|
|
36
|
-
variant: "short",
|
|
37
|
-
id: "toggle-switch-2",
|
|
38
|
-
name: "toggle two",
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
export const Checked: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
...DefaultToggleSwitch.args,
|
|
44
|
-
isChecked: true,
|
|
45
|
-
label: {
|
|
46
|
-
text: "label me too",
|
|
47
|
-
className: "text-lg text-gray-400",
|
|
48
|
-
xPosition: "left",
|
|
49
|
-
},
|
|
50
|
-
variant: "base",
|
|
51
|
-
id: "toggle-switch-3",
|
|
52
|
-
name: "toggle three",
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
export const WithIcon: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
...DefaultToggleSwitch.args,
|
|
58
|
-
label: {
|
|
59
|
-
text: "label me three",
|
|
60
|
-
className: "text-lg text-gray-400",
|
|
61
|
-
xPosition: "left"
|
|
62
|
-
},
|
|
63
|
-
withIcon: {
|
|
64
|
-
icon: "IconCheck"
|
|
65
|
-
},
|
|
66
|
-
variant: "base",
|
|
67
|
-
id: "toggle-switch-4",
|
|
68
|
-
name: "toggle four"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
export const NoLabel: Story = {
|
|
72
|
-
args: {
|
|
73
|
-
...DefaultToggleSwitch.args,
|
|
74
|
-
label: undefined,
|
|
75
|
-
variant: "base",
|
|
76
|
-
id: "toggle-switch-5",
|
|
77
|
-
name: "toggle five",
|
|
78
|
-
},
|
|
79
|
-
}
|
|
80
|
-
export const LabelOnTheRight: Story = {
|
|
81
|
-
args: {
|
|
82
|
-
...DefaultToggleSwitch.args,
|
|
83
|
-
variant: "base",
|
|
84
|
-
id: "toggle-switch-6",
|
|
85
|
-
name: "toggle six",
|
|
86
|
-
label: {
|
|
87
|
-
text: "Right on!",
|
|
88
|
-
className: "text-lg text-gray-400",
|
|
89
|
-
xPosition: "right",
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
}
|
|
93
|
-
export const JSXLabel: Story = {
|
|
94
|
-
args: {
|
|
95
|
-
...DefaultToggleSwitch.args,
|
|
96
|
-
variant: "base",
|
|
97
|
-
id: "toggle-switch-6",
|
|
98
|
-
name: "toggle five",
|
|
99
|
-
label: {
|
|
100
|
-
text: (
|
|
101
|
-
<span className={"inline-flex gap-2 items-center "}>
|
|
102
|
-
<Button
|
|
103
|
-
actionType="primary"
|
|
104
|
-
label="Fancy Label"
|
|
105
|
-
onClick={() => {}}
|
|
106
|
-
icon="IconConfetti"
|
|
107
|
-
size="xs"
|
|
108
|
-
className="mr-4"
|
|
109
|
-
/>
|
|
110
|
-
</span>
|
|
111
|
-
),
|
|
112
|
-
className: "text-lg text-gray-400",
|
|
113
|
-
xPosition: "left",
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export default meta
|
|
1
|
+
import Button from "stories/atoms/buttons/Button/Button"
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
4
|
+
|
|
5
|
+
import ToggleSwitch from "./ToggleSwitch"
|
|
6
|
+
const meta: Meta<typeof ToggleSwitch> = {
|
|
7
|
+
title: "Design System/Molecules/Inputs/ToggleSwitch",
|
|
8
|
+
component: ToggleSwitch,
|
|
9
|
+
tags: ["autodocs"]
|
|
10
|
+
}
|
|
11
|
+
type Story = StoryObj<typeof ToggleSwitch>
|
|
12
|
+
export const DefaultToggleSwitch: Story = {
|
|
13
|
+
args: {
|
|
14
|
+
isChecked: false,
|
|
15
|
+
onChange: (v: boolean) => {
|
|
16
|
+
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
text: "label me",
|
|
20
|
+
className: "text-lg text-gray-400",
|
|
21
|
+
xPosition: "left",
|
|
22
|
+
},
|
|
23
|
+
variant: "base",
|
|
24
|
+
id: "toggle-switch-1",
|
|
25
|
+
name: "toggle one",
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
export const ShortToggleSwitch: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
...DefaultToggleSwitch.args,
|
|
31
|
+
label: {
|
|
32
|
+
text: "label me too",
|
|
33
|
+
className: "text-lg text-gray-400",
|
|
34
|
+
xPosition: "left",
|
|
35
|
+
},
|
|
36
|
+
variant: "short",
|
|
37
|
+
id: "toggle-switch-2",
|
|
38
|
+
name: "toggle two",
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
export const Checked: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
...DefaultToggleSwitch.args,
|
|
44
|
+
isChecked: true,
|
|
45
|
+
label: {
|
|
46
|
+
text: "label me too",
|
|
47
|
+
className: "text-lg text-gray-400",
|
|
48
|
+
xPosition: "left",
|
|
49
|
+
},
|
|
50
|
+
variant: "base",
|
|
51
|
+
id: "toggle-switch-3",
|
|
52
|
+
name: "toggle three",
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
export const WithIcon: Story = {
|
|
56
|
+
args: {
|
|
57
|
+
...DefaultToggleSwitch.args,
|
|
58
|
+
label: {
|
|
59
|
+
text: "label me three",
|
|
60
|
+
className: "text-lg text-gray-400",
|
|
61
|
+
xPosition: "left"
|
|
62
|
+
},
|
|
63
|
+
withIcon: {
|
|
64
|
+
icon: "IconCheck"
|
|
65
|
+
},
|
|
66
|
+
variant: "base",
|
|
67
|
+
id: "toggle-switch-4",
|
|
68
|
+
name: "toggle four"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export const NoLabel: Story = {
|
|
72
|
+
args: {
|
|
73
|
+
...DefaultToggleSwitch.args,
|
|
74
|
+
label: undefined,
|
|
75
|
+
variant: "base",
|
|
76
|
+
id: "toggle-switch-5",
|
|
77
|
+
name: "toggle five",
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
export const LabelOnTheRight: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
...DefaultToggleSwitch.args,
|
|
83
|
+
variant: "base",
|
|
84
|
+
id: "toggle-switch-6",
|
|
85
|
+
name: "toggle six",
|
|
86
|
+
label: {
|
|
87
|
+
text: "Right on!",
|
|
88
|
+
className: "text-lg text-gray-400",
|
|
89
|
+
xPosition: "right",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
export const JSXLabel: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
...DefaultToggleSwitch.args,
|
|
96
|
+
variant: "base",
|
|
97
|
+
id: "toggle-switch-6",
|
|
98
|
+
name: "toggle five",
|
|
99
|
+
label: {
|
|
100
|
+
text: (
|
|
101
|
+
<span className={"inline-flex gap-2 items-center "}>
|
|
102
|
+
<Button
|
|
103
|
+
actionType="primary"
|
|
104
|
+
label="Fancy Label"
|
|
105
|
+
onClick={() => {}}
|
|
106
|
+
icon="IconConfetti"
|
|
107
|
+
size="xs"
|
|
108
|
+
className="mr-4"
|
|
109
|
+
/>
|
|
110
|
+
</span>
|
|
111
|
+
),
|
|
112
|
+
className: "text-lg text-gray-400",
|
|
113
|
+
xPosition: "left",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default meta
|