@indico-data/design-system 2.17.2 → 2.19.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 +616 -184
- package/lib/index.d.ts +17 -21
- package/lib/index.esm.css +616 -184
- package/lib/index.esm.js +36 -462
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +37 -463
- package/lib/index.js.map +1 -1
- package/lib/src/components/button/Button.stories.d.ts +1 -0
- package/lib/src/components/forms/input/Input.d.ts +5 -7
- package/lib/src/components/forms/passwordInput/PasswordInput.d.ts +5 -7
- package/lib/src/components/forms/subcomponents/Label.d.ts +6 -3
- package/lib/src/components/forms/textarea/Textarea.d.ts +5 -7
- package/lib/src/legacy/components/modals/ModalBase/ModalBase.d.ts +0 -1
- package/lib/src/storybook/labelArgTypes.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/button/Button.mdx +6 -3
- package/src/components/button/Button.stories.tsx +8 -0
- package/src/components/button/Button.tsx +14 -6
- package/src/components/button/__tests__/Button.test.tsx +38 -0
- package/src/components/button/styles/Button.scss +14 -22
- package/src/components/button/styles/_variables.scss +77 -4
- package/src/components/forms/checkbox/styles/Checkbox.scss +3 -3
- package/src/components/forms/input/Input.mdx +15 -2
- package/src/components/forms/input/Input.stories.tsx +10 -45
- package/src/components/forms/input/Input.tsx +22 -15
- package/src/components/forms/input/styles/Input.scss +2 -15
- package/src/components/forms/passwordInput/PasswordInput.mdx +10 -8
- package/src/components/forms/passwordInput/PasswordInput.stories.tsx +3 -44
- package/src/components/forms/passwordInput/PasswordInput.tsx +20 -15
- package/src/components/forms/passwordInput/styles/PasswordInput.scss +2 -15
- package/src/components/forms/radio/styles/Radio.scss +3 -3
- package/src/components/forms/select/styles/Select.scss +21 -4
- package/src/components/forms/subcomponents/Label.tsx +29 -6
- package/src/components/forms/subcomponents/__tests__/Label.test.tsx +63 -15
- package/src/components/forms/textarea/Textarea.mdx +12 -2
- package/src/components/forms/textarea/Textarea.stories.tsx +4 -46
- package/src/components/forms/textarea/Textarea.tsx +15 -13
- package/src/components/forms/textarea/styles/Textarea.scss +2 -14
- package/src/components/forms/toggle/styles/Toggle.scss +2 -2
- package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.scss +441 -0
- package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +3 -4
- package/src/legacy/components/modals/ModalBase/ModalBase.tsx +5 -1
- package/src/storybook/labelArgTypes.ts +50 -0
- package/src/styles/globals.scss +11 -0
- package/src/styles/index.scss +2 -2
- package/src/styles/variables/themes/dark.scss +8 -7
- package/src/styles/variables/themes/light.scss +1 -0
- package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +0 -1
- package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.ts +0 -449
|
@@ -14,6 +14,7 @@ export declare const InfoOutline: Story;
|
|
|
14
14
|
export declare const Text: Story;
|
|
15
15
|
export declare const IconLeft: Story;
|
|
16
16
|
export declare const IconRight: Story;
|
|
17
|
+
export declare const IconOnly: Story;
|
|
17
18
|
export declare const Error: Story;
|
|
18
19
|
export declare const Success: Story;
|
|
19
20
|
export declare const Warning: Story;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IconName } from '@/types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
3
|
+
import { WithLabelProps } from '../subcomponents/Label';
|
|
4
|
+
export interface InputProps extends WithLabelProps {
|
|
6
5
|
value?: string | undefined;
|
|
7
|
-
placeholder
|
|
6
|
+
placeholder?: string;
|
|
8
7
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
-
isRequired?: boolean;
|
|
10
8
|
isDisabled?: boolean;
|
|
11
9
|
errorMessage?: string | undefined;
|
|
12
10
|
helpText?: string;
|
|
13
|
-
hasHiddenLabel?: boolean;
|
|
14
11
|
iconName?: IconName;
|
|
15
12
|
isClearable?: boolean;
|
|
16
13
|
className?: string;
|
|
17
14
|
defaultValue?: string;
|
|
18
15
|
}
|
|
19
|
-
|
|
16
|
+
declare const LabeledInput: React.ForwardRefExoticComponent<Omit<InputProps & React.RefAttributes<HTMLInputElement> & WithLabelProps, "ref"> & React.RefAttributes<any>>;
|
|
17
|
+
export { LabeledInput as Input };
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { WithLabelProps } from '../subcomponents/Label';
|
|
3
|
+
export interface PasswordInputProps extends WithLabelProps {
|
|
3
4
|
ref?: React.LegacyRef<HTMLInputElement>;
|
|
4
|
-
label: string;
|
|
5
5
|
value?: string | undefined;
|
|
6
|
-
|
|
7
|
-
placeholder: string;
|
|
6
|
+
placeholder?: string;
|
|
8
7
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
-
isRequired?: boolean;
|
|
10
8
|
isDisabled?: boolean;
|
|
11
9
|
errorMessage?: string | undefined;
|
|
12
10
|
helpText?: string;
|
|
13
|
-
hasHiddenLabel?: boolean;
|
|
14
11
|
hasShowPassword?: boolean;
|
|
15
12
|
defaultValue?: string;
|
|
16
13
|
}
|
|
17
|
-
|
|
14
|
+
declare const LabeledPasswordInput: React.ForwardRefExoticComponent<Omit<Omit<PasswordInputProps, "ref"> & React.RefAttributes<HTMLInputElement> & WithLabelProps, "ref"> & React.RefAttributes<any>>;
|
|
15
|
+
export { LabeledPasswordInput as PasswordInput };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface LabelProps {
|
|
2
3
|
label: string;
|
|
3
4
|
name: string;
|
|
4
5
|
isRequired?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface WithLabelProps extends LabelProps {
|
|
5
8
|
hasHiddenLabel?: boolean;
|
|
6
9
|
}
|
|
7
|
-
export declare const Label: ({ label, name, isRequired
|
|
8
|
-
export
|
|
10
|
+
export declare const Label: ({ label, name, isRequired }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function withLabel<P extends object>(WrappedComponent: React.ComponentType<P>): React.ForwardRefExoticComponent<React.PropsWithoutRef<P & WithLabelProps> & React.RefAttributes<any>>;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
import { WithLabelProps } from '../subcomponents/Label';
|
|
3
|
+
export interface TextareaProps extends WithLabelProps {
|
|
3
4
|
ref?: React.LegacyRef<HTMLTextAreaElement>;
|
|
4
|
-
|
|
5
|
-
name: string;
|
|
6
|
-
placeholder: string;
|
|
5
|
+
placeholder?: string;
|
|
7
6
|
value?: string | undefined;
|
|
8
7
|
onChange: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
9
|
-
isRequired?: boolean;
|
|
10
8
|
isDisabled?: boolean;
|
|
11
9
|
errorMessage?: string | undefined;
|
|
12
10
|
helpText?: string;
|
|
13
|
-
hasHiddenLabel?: boolean;
|
|
14
11
|
rows?: number;
|
|
15
12
|
cols?: number;
|
|
16
13
|
readonly?: boolean;
|
|
@@ -20,4 +17,5 @@ export interface TextareaProps {
|
|
|
20
17
|
autofocus?: boolean;
|
|
21
18
|
defaultValue?: string;
|
|
22
19
|
}
|
|
23
|
-
|
|
20
|
+
declare const LabeledTextarea: React.ForwardRefExoticComponent<Omit<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement> & WithLabelProps, "ref"> & React.RefAttributes<any>>;
|
|
21
|
+
export { LabeledTextarea as Textarea };
|
|
@@ -4,7 +4,6 @@ export type ModalBaseProps = PermafrostComponent & {
|
|
|
4
4
|
children: React.ReactNode | React.ReactNode[];
|
|
5
5
|
clickToDismiss?(): void;
|
|
6
6
|
describedBy?: string;
|
|
7
|
-
/** a selector representing the desired parent; defaults to `#root` */
|
|
8
7
|
node?: string;
|
|
9
8
|
open: boolean;
|
|
10
9
|
preventEscDismiss?: boolean;
|
package/package.json
CHANGED
|
@@ -86,13 +86,16 @@ The states available are enabled, `disabled`, and `loading`. The button is enabl
|
|
|
86
86
|
|
|
87
87
|
## Icons
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
To include an Icon pass an `iconName` prop with a valid icon name. The `iconName` is the name of the icon you want to use. You can optionally pass an `iconPosition` argument to set the position of the icon in relation to the text. The default value for `iconPosition` is `left`. If no children are passed, the button will render as an icon-only button.
|
|
90
90
|
|
|
91
91
|
<Row>
|
|
92
92
|
<Col xs={6} sm={4} md={3} lg={2}>
|
|
93
93
|
<Story of={ButtonStories.IconLeft} />
|
|
94
94
|
</Col>
|
|
95
|
-
<Col xs={2}>
|
|
95
|
+
<Col xs={6} sm={4} md={3} lg={2}>
|
|
96
96
|
<Story of={ButtonStories.IconRight} />
|
|
97
97
|
</Col>
|
|
98
|
-
|
|
98
|
+
<Col xs={6} sm={4} md={3} lg={2}>
|
|
99
|
+
<Story of={ButtonStories.IconOnly} />
|
|
100
|
+
</Col>
|
|
101
|
+
</Row>
|
|
@@ -254,6 +254,14 @@ export const IconRight: Story = {
|
|
|
254
254
|
render: (args) => <Button {...args}>Icon Right</Button>,
|
|
255
255
|
};
|
|
256
256
|
|
|
257
|
+
export const IconOnly: Story = {
|
|
258
|
+
args: {
|
|
259
|
+
color: 'primary',
|
|
260
|
+
iconName: 'fa-check',
|
|
261
|
+
},
|
|
262
|
+
render: (args) => <Button {...args} />,
|
|
263
|
+
};
|
|
264
|
+
|
|
257
265
|
export const Error: Story = {
|
|
258
266
|
args: {
|
|
259
267
|
color: 'error',
|
|
@@ -57,21 +57,29 @@ export const Button = (props: ButtonProps) => {
|
|
|
57
57
|
onKeyDown={onKeyDown}
|
|
58
58
|
{...rest}
|
|
59
59
|
>
|
|
60
|
+
{/* Loading Icon */}
|
|
60
61
|
{isLoading && (
|
|
61
62
|
<Icon
|
|
62
63
|
name="fa-circle-notch"
|
|
63
|
-
style={{
|
|
64
|
-
animation: 'spin 1s linear infinite',
|
|
65
|
-
}}
|
|
64
|
+
style={{ animation: 'spin 1s linear infinite' }}
|
|
66
65
|
className="mr-2"
|
|
67
|
-
ariaLabel=
|
|
66
|
+
ariaLabel="Loading..."
|
|
68
67
|
/>
|
|
69
68
|
)}
|
|
70
|
-
|
|
69
|
+
|
|
70
|
+
{/* Icon without children */}
|
|
71
|
+
{!children && iconName && <Icon name={iconName} ariaLabel={`${iconName} Icon`} />}
|
|
72
|
+
|
|
73
|
+
{/* Left Icon with children */}
|
|
74
|
+
{children && iconPosition === 'left' && iconName && (
|
|
71
75
|
<Icon name={iconName} className="mr-2" ariaLabel={`${iconName} Icon`} />
|
|
72
76
|
)}
|
|
77
|
+
|
|
78
|
+
{/* Button children */}
|
|
73
79
|
{children}
|
|
74
|
-
|
|
80
|
+
|
|
81
|
+
{/* Right Icon with children */}
|
|
82
|
+
{children && iconPosition === 'right' && iconName && (
|
|
75
83
|
<Icon name={iconName} className="ml-2" ariaLabel={`${iconName} Icon`} />
|
|
76
84
|
)}
|
|
77
85
|
</button>
|
|
@@ -70,6 +70,7 @@ describe('Button', () => {
|
|
|
70
70
|
expect(button).toBeDisabled();
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
|
+
|
|
73
74
|
describe('button interactions', () => {
|
|
74
75
|
beforeEach(() => {
|
|
75
76
|
onClick.mockClear();
|
|
@@ -77,11 +78,13 @@ describe('Button', () => {
|
|
|
77
78
|
onMouseExit.mockClear();
|
|
78
79
|
onKeyDown.mockClear();
|
|
79
80
|
});
|
|
81
|
+
|
|
80
82
|
it('calls the onKeyDown function when a key is pressed', async () => {
|
|
81
83
|
render(<Button onKeyDown={onKeyDown} onClick={onClick} ariaLabel="btn" />);
|
|
82
84
|
await userEvent.type(screen.getByRole('button'), '{enter}');
|
|
83
85
|
expect(onKeyDown).toHaveBeenCalledTimes(1);
|
|
84
86
|
});
|
|
87
|
+
|
|
85
88
|
it('calls the onClick function when the button is clicked', async () => {
|
|
86
89
|
render(<Button onClick={onClick} ariaLabel="btn" />);
|
|
87
90
|
await userEvent.click(screen.getByRole('button'));
|
|
@@ -99,10 +102,45 @@ describe('Button', () => {
|
|
|
99
102
|
await userEvent.hover(screen.getByRole('button'));
|
|
100
103
|
expect(onMouseEnter).toHaveBeenCalledTimes(1);
|
|
101
104
|
});
|
|
105
|
+
|
|
102
106
|
it('calls the onMouseExit function when the mouse leaves the button', async () => {
|
|
103
107
|
render(<Button onMouseExit={onMouseExit} onClick={onClick} ariaLabel="btn" />);
|
|
104
108
|
await userEvent.unhover(screen.getByRole('button'));
|
|
105
109
|
expect(onMouseExit).toHaveBeenCalledTimes(1);
|
|
106
110
|
});
|
|
107
111
|
});
|
|
112
|
+
|
|
113
|
+
describe('button with icons', () => {
|
|
114
|
+
it('renders an icon when iconName is provided and no children', () => {
|
|
115
|
+
render(<Button iconName="fa-wind" ariaLabel="icon button" />);
|
|
116
|
+
const icon = screen.getByLabelText('fa-wind Icon');
|
|
117
|
+
expect(icon).toBeInTheDocument();
|
|
118
|
+
expect(icon).not.toHaveClass('mr-2');
|
|
119
|
+
expect(icon).not.toHaveClass('ml-2');
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('renders an icon to the left when iconPosition is left and children are present', () => {
|
|
123
|
+
render(
|
|
124
|
+
<Button iconName="fa-wind" iconPosition="left" ariaLabel="icon button">
|
|
125
|
+
Button
|
|
126
|
+
</Button>,
|
|
127
|
+
);
|
|
128
|
+
const icon = screen.getByLabelText('fa-wind Icon');
|
|
129
|
+
const button = screen.getByRole('button');
|
|
130
|
+
expect(button).toContainElement(icon);
|
|
131
|
+
expect(icon).toHaveClass('mr-2');
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('renders an icon to the right when iconPosition is right and children are present', () => {
|
|
135
|
+
render(
|
|
136
|
+
<Button iconName="fa-wind" iconPosition="right" ariaLabel="icon button">
|
|
137
|
+
Button
|
|
138
|
+
</Button>,
|
|
139
|
+
);
|
|
140
|
+
const icon = screen.getByLabelText('fa-wind Icon');
|
|
141
|
+
const button = screen.getByRole('button');
|
|
142
|
+
expect(button).toContainElement(icon);
|
|
143
|
+
expect(icon).toHaveClass('ml-2');
|
|
144
|
+
});
|
|
145
|
+
});
|
|
108
146
|
});
|
|
@@ -47,38 +47,30 @@
|
|
|
47
47
|
background: var(--pf-button-hover-#{$color-name}-color);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
&:focus {
|
|
51
|
-
border-color: var(--pf-button-focus-#{$color-name}-color);
|
|
52
|
-
background: var(--pf-button-focus-#{$color-name}-color);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
50
|
&:disabled {
|
|
56
|
-
background: var(--pf-button-disabled-#{$color-name}-color);
|
|
57
|
-
|
|
51
|
+
background: var(--pf-button-disabled-#{$color-name}-background-color);
|
|
52
|
+
color: var(--pf-button-disabled-#{$color-name}-text-color);
|
|
53
|
+
border-color: var(--pf-button-disabled-#{$color-name}-border-color);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
56
|
&.btn--outline {
|
|
61
|
-
color: var(--pf-button-#{$color-name}-color);
|
|
62
|
-
background-color: var(--pf-button-outline-background-color);
|
|
57
|
+
color: var(--pf-button-outline-#{$color-name}-text-color);
|
|
58
|
+
background-color: var(--pf-button-outline-#{$color-name}-background-color);
|
|
59
|
+
border-color: var(--pf-button-#{$color-name}-outline-border-color);
|
|
63
60
|
|
|
64
61
|
&:hover {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
&:focus {
|
|
70
|
-
border-color: var(--pf-button-focus-#{$color-name}-color);
|
|
71
|
-
background-color: var(--pf-button-outline-hover-#{$color-name}-color);
|
|
72
|
-
color: var(--pf-button-focus-#{$color-name}-color);
|
|
62
|
+
color: var(--pf-button-outline-#{$color-name}-hover-text-color);
|
|
63
|
+
background-color: var(--pf-button-outline-hover-#{$color-name}-background-color);
|
|
64
|
+
border-color: var(--pf-button-hover-#{$color-name}-outline-border-color);
|
|
73
65
|
}
|
|
74
66
|
|
|
75
67
|
&:disabled {
|
|
76
|
-
border-color: var(--pf-button-disabled-#{$color-name}-color);
|
|
77
|
-
color: var(--pf-button-disabled-#{$color-name}-color);
|
|
68
|
+
border-color: var(--pf-button-disabled-#{$color-name}-outline-border-color);
|
|
69
|
+
color: var(--pf-button-disabled-#{$color-name}-outline-text-color);
|
|
70
|
+
background-color: var(--pf-button-disabled-#{$color-name}-outline-background-color);
|
|
78
71
|
&:hover {
|
|
79
|
-
|
|
80
|
-
color: var(--pf-button-disabled-#{$color-name}-color);
|
|
81
|
-
background-color: var(--pf-button-outline-background-color);
|
|
72
|
+
color: var(--pf-button-disabled-#{$color-name}-outline-text-color);
|
|
73
|
+
background-color: var(--pf-button-disabled-#{$color-name}-outline-background-color);
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
76
|
}
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
--pf-button-disabled-primary-color: var(--pf-primary-color-300);
|
|
12
12
|
--pf-button-focus-primary-color: var(--pf-primary-color-900);
|
|
13
13
|
--pf-button-hover-primary-color: var(--pf-primary-color-400);
|
|
14
|
-
--pf-button-outline-hover-primary-color: var(--pf-primary-color-100);
|
|
15
14
|
--pf-button-primary-color: var(--pf-primary-color);
|
|
16
15
|
--pf-button-primary-text-color: var(--pf-white-color);
|
|
17
16
|
|
|
@@ -61,8 +60,6 @@
|
|
|
61
60
|
|
|
62
61
|
// Outline Buttons
|
|
63
62
|
--pf-button-outline-background-color: var(--pf-white-color);
|
|
64
|
-
|
|
65
|
-
// Button Radius
|
|
66
63
|
--pf-button-rounded: var(--pf-rounded);
|
|
67
64
|
}
|
|
68
65
|
|
|
@@ -75,6 +72,47 @@
|
|
|
75
72
|
--pf-button-background-info-color: var(--pf-info-color);
|
|
76
73
|
--pf-button-hover-info-color: var(--pf-gray-color-400);
|
|
77
74
|
--pf-button-outline-hover-info-color: var(--pf-gray-color-100);
|
|
75
|
+
|
|
76
|
+
--pf-button-outline-primary-background-color: var(--pf-white-color);
|
|
77
|
+
--pf-button-outline-primary-text-color: var(--pf-primary-color);
|
|
78
|
+
--pf-button-outline-primary-border-color: var(--pf-primary-color);
|
|
79
|
+
|
|
80
|
+
--pf-button-outline-secondary-background-color: var(--pf-white-color);
|
|
81
|
+
--pf-button-outline-secondary-text-color: var(--pf-secondary-color);
|
|
82
|
+
--pf-button-outline-secondary-border-color: var(--pf-secondary-color);
|
|
83
|
+
|
|
84
|
+
// outline
|
|
85
|
+
--pf-button-primary-outline-border-color: var(--pf-primary-color);
|
|
86
|
+
|
|
87
|
+
--pf-button-secondary-outline-border-color: var(--pf-secondary-color);
|
|
88
|
+
|
|
89
|
+
// hover
|
|
90
|
+
--pf-button-outline-primary-hover-text-color: var(--pf-primary-color-400);
|
|
91
|
+
--pf-button-outline-hover-primary-color: var(--pf-primary-color-300);
|
|
92
|
+
--pf-button-outline-hover-primary-background-color: var(--pf-primary-color-100);
|
|
93
|
+
|
|
94
|
+
--pf-button-outline-secondary-hover-text-color: var(--pf-secondary-color-400);
|
|
95
|
+
--pf-button-outline-hover-secondary-color: var(--pf-secondary-color-300);
|
|
96
|
+
--pf-button-outline-hover-secondary-background-color: var(--pf-secondary-color-100);
|
|
97
|
+
|
|
98
|
+
// disabled
|
|
99
|
+
//general
|
|
100
|
+
--pf-button-disabled-primary-background-color: var(--pf-primary-color-300);
|
|
101
|
+
--pf-button-disabled-primary-text-color: var(--pf-gray-color-100);
|
|
102
|
+
--pf-button-disabled-primary-border-color: var(--pf-primary-color-300);
|
|
103
|
+
|
|
104
|
+
--pf-button-disabled-secondary-background-color: var(--pf-secondary-color-300);
|
|
105
|
+
--pf-button-disabled-secondary-text-color: var(--pf-gray-color-100);
|
|
106
|
+
--pf-button-disabled-secondary-border-color: var(--pf-secondary-color-300);
|
|
107
|
+
|
|
108
|
+
// outline
|
|
109
|
+
--pf-button-disabled-primary-outline-background-color: var(--pf-white-color);
|
|
110
|
+
--pf-button-disabled-primary-outline-text-color: var(--pf-primary-color-300);
|
|
111
|
+
--pf-button-disabled-primary-outline-border-color: var(--pf-primary-color-300);
|
|
112
|
+
|
|
113
|
+
--pf-button-disabled-secondary-outline-background-color: var(--pf-white-color);
|
|
114
|
+
--pf-button-disabled-secondary-outline-text-color: var(--pf-secondary-color-300);
|
|
115
|
+
--pf-button-disabled-secondary-outline-border-color: var(--pf-secondary-color-300);
|
|
78
116
|
}
|
|
79
117
|
|
|
80
118
|
// Dark Theme Specific Variables
|
|
@@ -82,8 +120,43 @@
|
|
|
82
120
|
--pf-button-disabled-success-color: var(--pf-green-color-400);
|
|
83
121
|
--pf-button-disabled-warning-color: var(--pf-orange-color-400);
|
|
84
122
|
--pf-button-outline-hover-warning-color: var(--pf-orange-color-300);
|
|
85
|
-
|
|
86
123
|
--pf-button-background-info-color: var(--pf-gray-color-800);
|
|
87
124
|
--pf-button-hover-info-color: var(--pf-gray-color-600);
|
|
88
125
|
--pf-button-outline-hover-info-color: var(--pf-gray-color-300);
|
|
126
|
+
|
|
127
|
+
// outline
|
|
128
|
+
--pf-button-outline-primary-background-color: var(--pf-primary-color-600);
|
|
129
|
+
--pf-button-outline-primary-text-color: var(--pf-primary-color-100);
|
|
130
|
+
--pf-button-primary-outline-border-color: var(--pf-primary-color-100);
|
|
131
|
+
|
|
132
|
+
--pf-button-outline-secondary-background-color: var(--pf-primary-color-600);
|
|
133
|
+
--pf-button-outline-secondary-text-color: var(--pf-secondary-color-700);
|
|
134
|
+
--pf-button-secondary-outline-border-color: var(--pf-secondary-color-700);
|
|
135
|
+
|
|
136
|
+
//hover
|
|
137
|
+
--pf-button-outline-primary-hover-text-color: var(--pf-primary-color-200);
|
|
138
|
+
--pf-button-outline-hover-primary-background-color: var(--pf-primary-color-600);
|
|
139
|
+
--pf-button-outline-hover-primary-border-color: var(--pf-primary-color-200);
|
|
140
|
+
|
|
141
|
+
--pf-button-outline-secondary-hover-text-color: var(--pf-secondary-color-400);
|
|
142
|
+
--pf-button-outline-hover-secondary-background-color: var(--pf-primary-color-600);
|
|
143
|
+
--pf-button-outline-hover-secondary-border-color: var(--pf-secondary-color-400);
|
|
144
|
+
|
|
145
|
+
//disabled
|
|
146
|
+
// general
|
|
147
|
+
--pf-button-disabled-primary-background-color: var(--pf-primary-color-900);
|
|
148
|
+
--pf-button-disabled-primary-text-color: var(--pf-primary-color-400);
|
|
149
|
+
--pf-button-disabled-primary-border-color: var(--pf-primary-color-900);
|
|
150
|
+
|
|
151
|
+
--pf-button-disabled-secondary-background-color: var(--pf-secondary-color-900);
|
|
152
|
+
--pf-button-disabled-secondary-text-color: var(--pf-secondary-color-400);
|
|
153
|
+
--pf-button-disabled-secondary-border-color: var(--pf-secondary-color-900);
|
|
154
|
+
// outline
|
|
155
|
+
--pf-button-disabled-primary-outline-background-color: var(--pf-primary-color-900);
|
|
156
|
+
--pf-button-disabled-primary-outline-text-color: var(--pf-primary-color-400);
|
|
157
|
+
--pf-button-disabled-primary-outline-border-color: var(--pf-primary-color-400);
|
|
158
|
+
|
|
159
|
+
--pf-button-disabled-secondary-outline-background-color: var(--pf-primary-color-900);
|
|
160
|
+
--pf-button-disabled-secondary-outline-text-color: var(--pf-primary-color-400);
|
|
161
|
+
--pf-button-disabled-secondary-outline-border-color: var(--pf-primary-color-400);
|
|
89
162
|
}
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
:root [data-theme='dark'] {
|
|
5
5
|
--pf-checkbox-background-color: var(--pf-white-color);
|
|
6
6
|
--pf-checkbox-check-color: var(--pf-primary-color);
|
|
7
|
-
--pf-checkbox-border-color: var(--pf-
|
|
7
|
+
--pf-checkbox-border-color: var(--pf-form-input-border-color);
|
|
8
8
|
--pf-checkbox-disabled-color: var(--pf-gray-color-400);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// Dark Theme Specific Variables
|
|
12
12
|
:root [data-theme='dark'] {
|
|
13
|
-
--pf-checkbox-background-color: var(--pf-primary-color-
|
|
13
|
+
--pf-checkbox-background-color: var(--pf-primary-color-500);
|
|
14
14
|
--pf-checkbox-check-color: var(--pf-white-color);
|
|
15
|
-
--pf-checkbox-border-color: var(--pf-
|
|
15
|
+
--pf-checkbox-border-color: var(--pf-form-input-border-color);
|
|
16
16
|
--pf-checkbox-disabled-color: var(--pf-gray-color-300);
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -5,13 +5,26 @@ import * as Input from './Input.stories';
|
|
|
5
5
|
|
|
6
6
|
# Input
|
|
7
7
|
|
|
8
|
-
The 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. (
|
|
8
|
+
The 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
9
|
|
|
10
10
|
<Canvas
|
|
11
11
|
of={Input.Default}
|
|
12
12
|
source={{
|
|
13
13
|
code: `
|
|
14
|
-
|
|
14
|
+
<Input
|
|
15
|
+
label="Label Name"
|
|
16
|
+
name="first_name"
|
|
17
|
+
placeholder="Please enter a value"
|
|
18
|
+
helpText="This Is Help Text"
|
|
19
|
+
isRequired
|
|
20
|
+
hasHiddenLabel={false}
|
|
21
|
+
isClearable
|
|
22
|
+
iconName="user"
|
|
23
|
+
isDisabled={false}
|
|
24
|
+
errorMessage=""
|
|
25
|
+
value=""
|
|
26
|
+
onChange={() => {}}
|
|
27
|
+
/>
|
|
15
28
|
`,
|
|
16
29
|
}}
|
|
17
30
|
/>
|
|
@@ -2,6 +2,7 @@ import { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { Input, InputProps } from './Input';
|
|
3
3
|
import { SetStateAction, useEffect, useState } from 'react';
|
|
4
4
|
import { iconNames } from 'build/generated/iconTypes';
|
|
5
|
+
import labelArgTypes from '@/storybook/labelArgTypes';
|
|
5
6
|
|
|
6
7
|
const meta: Meta = {
|
|
7
8
|
title: 'Forms/Input',
|
|
@@ -16,28 +17,9 @@ const meta: Meta = {
|
|
|
16
17
|
summary: '(e: React.ChangeEvent<HTMLInputElement>) => void',
|
|
17
18
|
},
|
|
18
19
|
},
|
|
20
|
+
type: { name: 'function', required: true },
|
|
19
21
|
action: 'onChange',
|
|
20
22
|
},
|
|
21
|
-
label: {
|
|
22
|
-
control: 'text',
|
|
23
|
-
description: 'The label for the input field',
|
|
24
|
-
table: {
|
|
25
|
-
category: 'Props',
|
|
26
|
-
type: {
|
|
27
|
-
summary: 'string',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
name: {
|
|
32
|
-
control: 'text',
|
|
33
|
-
description: 'The name for the input field',
|
|
34
|
-
table: {
|
|
35
|
-
category: 'Props',
|
|
36
|
-
type: {
|
|
37
|
-
summary: 'string',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
23
|
placeholder: {
|
|
42
24
|
control: 'text',
|
|
43
25
|
description: 'The placeholder for the input field',
|
|
@@ -47,6 +29,7 @@ const meta: Meta = {
|
|
|
47
29
|
summary: 'string',
|
|
48
30
|
},
|
|
49
31
|
},
|
|
32
|
+
type: { name: 'string', required: false },
|
|
50
33
|
},
|
|
51
34
|
value: {
|
|
52
35
|
control: 'text',
|
|
@@ -57,17 +40,7 @@ const meta: Meta = {
|
|
|
57
40
|
summary: 'string',
|
|
58
41
|
},
|
|
59
42
|
},
|
|
60
|
-
|
|
61
|
-
isRequired: {
|
|
62
|
-
control: 'boolean',
|
|
63
|
-
description: 'Toggles the required asterisk on the label',
|
|
64
|
-
table: {
|
|
65
|
-
category: 'Props',
|
|
66
|
-
type: {
|
|
67
|
-
summary: 'boolean',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
defaultValue: { summary: 'false' },
|
|
43
|
+
type: { name: 'string', required: false },
|
|
71
44
|
},
|
|
72
45
|
isDisabled: {
|
|
73
46
|
control: 'boolean',
|
|
@@ -81,7 +54,7 @@ const meta: Meta = {
|
|
|
81
54
|
defaultValue: { summary: 'false' },
|
|
82
55
|
},
|
|
83
56
|
errorMessage: {
|
|
84
|
-
control:
|
|
57
|
+
control: 'text',
|
|
85
58
|
description: 'Error message',
|
|
86
59
|
table: {
|
|
87
60
|
category: 'Props',
|
|
@@ -101,17 +74,6 @@ const meta: Meta = {
|
|
|
101
74
|
},
|
|
102
75
|
},
|
|
103
76
|
},
|
|
104
|
-
hasHiddenLabel: {
|
|
105
|
-
control: 'boolean',
|
|
106
|
-
description: 'Hides the label visually (retains it for screen readers)',
|
|
107
|
-
table: {
|
|
108
|
-
category: 'Props',
|
|
109
|
-
type: {
|
|
110
|
-
summary: 'boolean',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
defaultValue: { summary: 'false' },
|
|
114
|
-
},
|
|
115
77
|
iconName: {
|
|
116
78
|
control: 'select',
|
|
117
79
|
options: iconNames,
|
|
@@ -140,6 +102,7 @@ const meta: Meta = {
|
|
|
140
102
|
disable: true,
|
|
141
103
|
},
|
|
142
104
|
},
|
|
105
|
+
...labelArgTypes,
|
|
143
106
|
},
|
|
144
107
|
};
|
|
145
108
|
|
|
@@ -147,11 +110,12 @@ export default meta;
|
|
|
147
110
|
|
|
148
111
|
type Story = StoryObj<typeof Input>;
|
|
149
112
|
|
|
150
|
-
const defaultArgs = {
|
|
113
|
+
const defaultArgs: InputProps = {
|
|
151
114
|
label: 'Enter your name',
|
|
152
115
|
name: 'first_name',
|
|
153
116
|
placeholder: 'Please enter a value',
|
|
154
|
-
|
|
117
|
+
onChange: () => {},
|
|
118
|
+
};
|
|
155
119
|
|
|
156
120
|
export const Default: Story = {
|
|
157
121
|
args: {
|
|
@@ -177,6 +141,7 @@ export const Default: Story = {
|
|
|
177
141
|
const handleChange = (e: { target: { value: SetStateAction<string> } }) => {
|
|
178
142
|
setValue(e.target.value);
|
|
179
143
|
};
|
|
144
|
+
|
|
180
145
|
return <Input {...args} value={value} onChange={handleChange} />;
|
|
181
146
|
},
|
|
182
147
|
};
|