@indico-data/design-system 2.8.0 → 2.10.0
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/lib/index.css +216 -4
- package/lib/index.d.ts +41 -2
- package/lib/index.esm.css +216 -4
- package/lib/index.esm.js +19 -3
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +20 -2
- package/lib/index.js.map +1 -1
- package/lib/src/components/forms/input/Input.d.ts +2 -1
- package/lib/src/components/forms/passwordInput/PasswordInput.d.ts +16 -0
- package/lib/src/components/forms/passwordInput/PasswordInput.stories.d.ts +11 -0
- package/lib/src/components/forms/passwordInput/__tests__/PasswordInput.test.d.ts +1 -0
- package/lib/src/components/forms/passwordInput/index.d.ts +1 -0
- package/lib/src/components/forms/textarea/Textarea.d.ts +22 -0
- package/lib/src/components/forms/textarea/Textarea.stories.d.ts +11 -0
- package/lib/src/components/forms/textarea/__tests__/Textarea.test.d.ts +1 -0
- package/lib/src/components/forms/textarea/index.d.ts +1 -0
- package/lib/src/components/index.d.ts +2 -0
- package/lib/src/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/forms/checkbox/styles/Checkbox.scss +1 -1
- package/src/components/forms/input/Input.stories.tsx +70 -69
- package/src/components/forms/input/Input.tsx +3 -1
- package/src/components/forms/input/styles/Input.scss +11 -3
- package/src/components/forms/passwordInput/PasswordInput.mdx +28 -0
- package/src/components/forms/passwordInput/PasswordInput.stories.tsx +269 -0
- package/src/components/forms/passwordInput/PasswordInput.tsx +82 -0
- package/src/components/forms/passwordInput/__tests__/PasswordInput.test.tsx +129 -0
- package/src/components/forms/passwordInput/index.ts +1 -0
- package/src/components/forms/passwordInput/styles/PasswordInput.scss +120 -0
- package/src/components/forms/textarea/Textarea.mdx +19 -0
- package/src/components/forms/textarea/Textarea.stories.tsx +363 -0
- package/src/components/forms/textarea/Textarea.tsx +85 -0
- package/src/components/forms/textarea/__tests__/Textarea.test.tsx +103 -0
- package/src/components/forms/textarea/index.ts +1 -0
- package/src/components/forms/textarea/styles/Textarea.scss +102 -0
- package/src/components/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/styles/index.scss +2 -0
|
@@ -14,5 +14,6 @@ export interface InputProps {
|
|
|
14
14
|
hasHiddenLabel?: boolean;
|
|
15
15
|
iconName?: IconName;
|
|
16
16
|
isClearable?: boolean;
|
|
17
|
+
className?: string;
|
|
17
18
|
}
|
|
18
|
-
export declare const Input: ({ ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, iconName, hasHiddenLabel, isClearable, ...rest }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const Input: ({ ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, iconName, hasHiddenLabel, isClearable, className, ...rest }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface PasswordInputProps {
|
|
3
|
+
ref?: React.LegacyRef<HTMLInputElement>;
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
isRequired?: boolean;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
errorList?: string[];
|
|
12
|
+
helpText?: string;
|
|
13
|
+
hasHiddenLabel?: boolean;
|
|
14
|
+
hasShowPassword?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const PasswordInput: ({ label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, hasHiddenLabel, hasShowPassword, ...rest }: PasswordInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { PasswordInput } from './PasswordInput';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PasswordInput>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Errors: Story;
|
|
8
|
+
export declare const HiddenLabel: Story;
|
|
9
|
+
export declare const HelpText: Story;
|
|
10
|
+
export declare const Required: Story;
|
|
11
|
+
export declare const NoTogglePasswordVisibility: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PasswordInput } from './PasswordInput';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TextareaProps {
|
|
3
|
+
ref?: React.LegacyRef<HTMLTextAreaElement>;
|
|
4
|
+
label: string;
|
|
5
|
+
name: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
9
|
+
isRequired?: boolean;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
errorList?: string[];
|
|
12
|
+
helpText?: string;
|
|
13
|
+
hasHiddenLabel?: boolean;
|
|
14
|
+
rows?: number;
|
|
15
|
+
cols?: number;
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
wrap?: 'hard' | 'soft';
|
|
18
|
+
form?: string;
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
autofocus?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const Textarea: ({ ref, label, name, placeholder, value, onChange, isRequired, isDisabled, errorList, helpText, hasHiddenLabel, rows, cols, readonly, wrap, form, maxLength, autofocus, ...rest }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Textarea } from './Textarea';
|
|
3
|
+
declare const meta: Meta;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Textarea>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Errors: Story;
|
|
8
|
+
export declare const HiddenLabel: Story;
|
|
9
|
+
export declare const HelpText: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
11
|
+
export declare const Readonly: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Textarea } from './Textarea';
|
|
@@ -6,3 +6,5 @@ export { Input } from './forms/input';
|
|
|
6
6
|
export { Radio } from './forms/radio';
|
|
7
7
|
export { Checkbox } from './forms/checkbox';
|
|
8
8
|
export { Toggle } from './forms/toggle';
|
|
9
|
+
export { Textarea } from './forms/textarea';
|
|
10
|
+
export { PasswordInput } from './forms/passwordInput';
|
package/lib/src/index.d.ts
CHANGED
|
@@ -11,3 +11,5 @@ export { Input } from './components/forms/input';
|
|
|
11
11
|
export { Radio as RadioInput } from './components/forms/radio';
|
|
12
12
|
export { Checkbox } from './components/forms/checkbox';
|
|
13
13
|
export { Toggle as ToggleInput } from './components/forms/toggle';
|
|
14
|
+
export { Textarea } from './components/forms/textarea';
|
|
15
|
+
export { PasswordInput } from './components/forms/passwordInput';
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
// Dark Theme Specific Variables
|
|
12
12
|
:root [data-theme='dark'] {
|
|
13
|
-
--pf-checkbox-background-color:
|
|
13
|
+
--pf-checkbox-background-color: var(--pf-primary-color-200);
|
|
14
14
|
--pf-checkbox-check-color: var(--pf-white-color);
|
|
15
15
|
--pf-checkbox-border-color: var(--pf-white-color);
|
|
16
16
|
--pf-checkbox-disabled-color: var(--pf-gray-color-300);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { Input, InputProps } from './Input';
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { SetStateAction, useEffect, useState } from 'react';
|
|
4
4
|
import { iconNames } from 'build/generated/iconTypes';
|
|
5
5
|
|
|
6
6
|
const meta: Meta = {
|
|
@@ -27,7 +27,6 @@ const meta: Meta = {
|
|
|
27
27
|
summary: 'string',
|
|
28
28
|
},
|
|
29
29
|
},
|
|
30
|
-
defaultValue: { summary: '' },
|
|
31
30
|
},
|
|
32
31
|
name: {
|
|
33
32
|
control: 'text',
|
|
@@ -38,7 +37,6 @@ const meta: Meta = {
|
|
|
38
37
|
summary: 'string',
|
|
39
38
|
},
|
|
40
39
|
},
|
|
41
|
-
defaultValue: { summary: '' },
|
|
42
40
|
},
|
|
43
41
|
placeholder: {
|
|
44
42
|
control: 'text',
|
|
@@ -49,7 +47,6 @@ const meta: Meta = {
|
|
|
49
47
|
summary: 'string',
|
|
50
48
|
},
|
|
51
49
|
},
|
|
52
|
-
defaultValue: { summary: '' },
|
|
53
50
|
},
|
|
54
51
|
value: {
|
|
55
52
|
control: 'text',
|
|
@@ -60,7 +57,6 @@ const meta: Meta = {
|
|
|
60
57
|
summary: 'string',
|
|
61
58
|
},
|
|
62
59
|
},
|
|
63
|
-
defaultValue: { summary: '' },
|
|
64
60
|
},
|
|
65
61
|
isRequired: {
|
|
66
62
|
control: 'boolean',
|
|
@@ -104,7 +100,6 @@ const meta: Meta = {
|
|
|
104
100
|
summary: 'string',
|
|
105
101
|
},
|
|
106
102
|
},
|
|
107
|
-
defaultValue: { summary: '' },
|
|
108
103
|
},
|
|
109
104
|
hasHiddenLabel: {
|
|
110
105
|
control: 'boolean',
|
|
@@ -174,15 +169,15 @@ export const Default: Story = {
|
|
|
174
169
|
},
|
|
175
170
|
render: (args) => {
|
|
176
171
|
const [value, setValue] = useState('');
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
172
|
+
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
setValue(args.value);
|
|
175
|
+
}, [args.value]);
|
|
176
|
+
|
|
177
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
178
|
+
setValue(e.target.value);
|
|
179
|
+
};
|
|
180
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
186
181
|
},
|
|
187
182
|
};
|
|
188
183
|
|
|
@@ -193,15 +188,16 @@ export const Errors: Story = {
|
|
|
193
188
|
},
|
|
194
189
|
render: (args) => {
|
|
195
190
|
const [value, setValue] = useState('');
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
191
|
+
|
|
192
|
+
useEffect(() => {
|
|
193
|
+
setValue(args.value);
|
|
194
|
+
}, [args.value]);
|
|
195
|
+
|
|
196
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
197
|
+
setValue(e.target.value);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
205
201
|
},
|
|
206
202
|
};
|
|
207
203
|
|
|
@@ -212,15 +208,16 @@ export const HiddenLabel: Story = {
|
|
|
212
208
|
},
|
|
213
209
|
render: (args) => {
|
|
214
210
|
const [value, setValue] = useState('');
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
211
|
+
|
|
212
|
+
useEffect(() => {
|
|
213
|
+
setValue(args.value);
|
|
214
|
+
}, [args.value]);
|
|
215
|
+
|
|
216
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
217
|
+
setValue(e.target.value);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
224
221
|
},
|
|
225
222
|
};
|
|
226
223
|
|
|
@@ -231,15 +228,16 @@ export const HelpText: Story = {
|
|
|
231
228
|
},
|
|
232
229
|
render: (args) => {
|
|
233
230
|
const [value, setValue] = useState('');
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
231
|
+
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
setValue(args.value);
|
|
234
|
+
}, [args.value]);
|
|
235
|
+
|
|
236
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
237
|
+
setValue(e.target.value);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
243
241
|
},
|
|
244
242
|
};
|
|
245
243
|
|
|
@@ -250,15 +248,16 @@ export const Clearable: Story = {
|
|
|
250
248
|
},
|
|
251
249
|
render: (args) => {
|
|
252
250
|
const [value, setValue] = useState('');
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
251
|
+
|
|
252
|
+
useEffect(() => {
|
|
253
|
+
setValue(args.value);
|
|
254
|
+
}, [args.value]);
|
|
255
|
+
|
|
256
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
257
|
+
setValue(e.target.value);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
262
261
|
},
|
|
263
262
|
};
|
|
264
263
|
|
|
@@ -269,15 +268,16 @@ export const Icon: Story = {
|
|
|
269
268
|
},
|
|
270
269
|
render: (args) => {
|
|
271
270
|
const [value, setValue] = useState('');
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
271
|
+
|
|
272
|
+
useEffect(() => {
|
|
273
|
+
setValue(args.value);
|
|
274
|
+
}, [args.value]);
|
|
275
|
+
|
|
276
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
277
|
+
setValue(e.target.value);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
281
281
|
},
|
|
282
282
|
};
|
|
283
283
|
|
|
@@ -288,14 +288,15 @@ export const Required: Story = {
|
|
|
288
288
|
},
|
|
289
289
|
render: (args) => {
|
|
290
290
|
const [value, setValue] = useState('');
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
291
|
+
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
setValue(args.value);
|
|
294
|
+
}, [args.value]);
|
|
295
|
+
|
|
296
|
+
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
297
|
+
setValue(e.target.value);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
return <Input {...args} value={value} onChange={handleChange} />;
|
|
300
301
|
},
|
|
301
302
|
};
|
|
@@ -18,6 +18,7 @@ export interface InputProps {
|
|
|
18
18
|
hasHiddenLabel?: boolean;
|
|
19
19
|
iconName?: IconName;
|
|
20
20
|
isClearable?: boolean;
|
|
21
|
+
className?: string;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export const Input = ({
|
|
@@ -34,6 +35,7 @@ export const Input = ({
|
|
|
34
35
|
iconName,
|
|
35
36
|
hasHiddenLabel,
|
|
36
37
|
isClearable,
|
|
38
|
+
className = '',
|
|
37
39
|
...rest
|
|
38
40
|
}: InputProps) => {
|
|
39
41
|
const hasErrors = errorList && errorList.length > 0;
|
|
@@ -58,7 +60,7 @@ export const Input = ({
|
|
|
58
60
|
placeholder={placeholder}
|
|
59
61
|
value={value}
|
|
60
62
|
onChange={onChange}
|
|
61
|
-
className={`input ${hasErrors ? 'error' : ''} ${iconName ? 'input--has-icon' : ''}`}
|
|
63
|
+
className={`input ${hasErrors ? 'error' : ''} ${iconName ? 'input--has-icon' : ''} ${className}`}
|
|
62
64
|
aria-invalid={hasErrors}
|
|
63
65
|
aria-describedby={hasErrors || helpText ? `${name}-helper` : undefined}
|
|
64
66
|
aria-required={isRequired}
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
--pf-input-text-color: var(--pf-gray-color);
|
|
9
9
|
--pf-input-placeholder-text-color: var(--pf-gray-color-300);
|
|
10
10
|
--pf-input-help-text-color: var(--pf-gray-color-400);
|
|
11
|
+
--pf-input-disabled-background-color: var(--pf-gray-color-100);
|
|
12
|
+
--pf-input-border-color: var(--pf-gray-color);
|
|
13
|
+
--pf-input-disabled-color: var(--pf-gray-color-400);
|
|
14
|
+
--pf-input-border-color: var(--pf-gray-color);
|
|
11
15
|
|
|
12
16
|
// input Radius
|
|
13
17
|
--pf-input-rounded: var(--pf-rounded);
|
|
@@ -20,6 +24,9 @@
|
|
|
20
24
|
--pf-input-text-color: var(--pf-gray-color-100);
|
|
21
25
|
--pf-input-placeholder-text-color: var(--pf-gray-color);
|
|
22
26
|
--pf-input-help-text-color: var(--pf-gray-color-200);
|
|
27
|
+
--pf-input-disabled-background-color: var(--pf-primary-color-200);
|
|
28
|
+
--pf-input-disabled-border-color: var(--pf-gray-color-300);
|
|
29
|
+
--pf-input-disabled-color: var(--pf-gray-color-400);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
.input {
|
|
@@ -56,9 +63,9 @@
|
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
&:disabled {
|
|
59
|
-
background-color: var(--pf-
|
|
60
|
-
border-color: var(--pf-
|
|
61
|
-
color: var(--pf-
|
|
66
|
+
background-color: var(--pf-input-disabled-background-color);
|
|
67
|
+
border-color: var(--pf-input-disabled-border-color);
|
|
68
|
+
color: var(--pf-input-disabled-color);
|
|
62
69
|
}
|
|
63
70
|
&--has-icon {
|
|
64
71
|
padding-left: var(--pf-padding-7);
|
|
@@ -93,6 +100,7 @@
|
|
|
93
100
|
top: var(--pf-margin-3);
|
|
94
101
|
right: var(--pf-margin-2);
|
|
95
102
|
color: var(--pf-input-text-color);
|
|
103
|
+
cursor: pointer;
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
106
|
.is-visually-hidden {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/blocks';
|
|
2
|
+
import * as PasswordInput from './PasswordInput.stories';
|
|
3
|
+
|
|
4
|
+
<Meta title="Forms/PasswordInput" name="PasswordInput" />
|
|
5
|
+
|
|
6
|
+
# Password Input
|
|
7
|
+
|
|
8
|
+
The password input component is the building block of any form. Below you will find the accepted properties for this component. It is encouraged to build forms utilizing [React Hook Form](https://react-hook-form.com/) library in your application. This will facilitate form state management and enforce best practices. (***Our components are compatible with but do not provide the plugin***)
|
|
9
|
+
|
|
10
|
+
<Canvas
|
|
11
|
+
of={PasswordInput.Default}
|
|
12
|
+
source={{
|
|
13
|
+
code: `
|
|
14
|
+
<PasswordInput
|
|
15
|
+
name="first_name"
|
|
16
|
+
isRequired
|
|
17
|
+
hasShowPassword
|
|
18
|
+
placeholder="Placeholder Text"
|
|
19
|
+
value=''
|
|
20
|
+
onChange={() => {}}
|
|
21
|
+
helpText="This Is Help Text"
|
|
22
|
+
label="Label Name"
|
|
23
|
+
/>
|
|
24
|
+
`,
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<Controls of={PasswordInput.Default} />
|