@react-ui-org/react-ui 0.42.0 → 0.44.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CONTRIBUTING.md +44 -25
- package/README.md +1 -1
- package/dist/lib.development.js +1598 -652
- package/dist/lib.js +1 -9
- package/package.json +49 -48
- package/src/lib/components/{ui/Alert → Alert}/Alert.jsx +17 -14
- package/src/lib/components/{ui/Alert → Alert}/Alert.scss +3 -3
- package/src/lib/components/{ui/Alert → Alert}/README.mdx +6 -6
- package/src/lib/components/{ui/Alert → Alert}/_settings.scss +1 -1
- package/src/lib/components/{ui/Alert → Alert}/_theme.scss +0 -0
- package/src/lib/components/{ui/Alert → Alert}/_tools.scss +0 -0
- package/src/lib/components/{ui/Alert → Alert}/index.js +0 -0
- package/src/lib/components/{ui/Badge → Badge}/Badge.jsx +2 -2
- package/src/lib/components/{ui/Badge → Badge}/Badge.scss +3 -3
- package/src/lib/components/{ui/Badge → Badge}/README.mdx +3 -3
- package/src/lib/components/{ui/Badge → Badge}/index.js +0 -0
- package/src/lib/components/Button/Button.jsx +198 -0
- package/src/lib/components/{ui/Button → Button}/Button.scss +0 -0
- package/src/lib/components/{ui/Button → Button}/README.mdx +160 -75
- package/src/lib/components/Button/_base.scss +148 -0
- package/src/lib/components/{ui/Button → Button}/_priorities.scss +0 -4
- package/src/lib/components/{ui/Button → Button}/_settings.scss +2 -3
- package/src/lib/components/{ui/Button → Button}/_theme.scss +3 -11
- package/src/lib/components/{ui/Button → Button}/_tools.scss +27 -44
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +33 -0
- package/src/lib/components/{ui/Button → Button}/helpers/getRootPriorityClassName.js +0 -4
- package/src/lib/components/{ui/Button → Button}/index.js +0 -0
- package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.jsx +9 -11
- package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/ButtonGroup.scss +0 -0
- package/src/lib/components/ButtonGroup/ButtonGroupContext.js +3 -0
- package/src/lib/components/{ui/ButtonGroup → ButtonGroup}/README.mdx +26 -2
- package/src/lib/components/ButtonGroup/index.js +2 -0
- package/src/lib/components/{layout/CTA → CTA}/CTA.jsx +5 -2
- package/src/lib/components/{layout/CTA → CTA}/CTA.scss +2 -2
- package/src/lib/components/{layout/CTA → CTA}/CTACenter.jsx +1 -1
- package/src/lib/components/{layout/CTA → CTA}/CTAEnd.jsx +1 -1
- package/src/lib/components/{layout/CTA → CTA}/CTAStart.jsx +1 -1
- package/src/lib/components/{layout/CTA → CTA}/README.mdx +3 -3
- package/src/lib/components/{layout/CTA → CTA}/index.js +0 -0
- package/src/lib/components/{ui/Card → Card}/Card.jsx +6 -4
- package/src/lib/components/{ui/Card → Card}/Card.scss +1 -1
- package/src/lib/components/{ui/Card → Card}/CardBody.jsx +1 -1
- package/src/lib/components/{ui/Card → Card}/CardFooter.jsx +1 -1
- package/src/lib/components/{ui/Card → Card}/README.mdx +2 -2
- package/src/lib/components/{ui/Card → Card}/_theme.scss +0 -0
- package/src/lib/components/{ui/Card → Card}/_tools.scss +0 -0
- package/src/lib/components/{ui/Card → Card}/index.js +0 -0
- package/src/lib/components/{layout/Center → Center}/Center.jsx +1 -1
- package/src/lib/components/{layout/Center → Center}/Center.scss +0 -0
- package/src/lib/components/{layout/Center → Center}/README.mdx +2 -2
- package/src/lib/components/{layout/Center → Center}/index.js +0 -0
- package/src/lib/components/CheckboxField/CheckboxField.jsx +164 -0
- package/src/lib/components/{ui/CheckboxField → CheckboxField}/CheckboxField.scss +5 -5
- package/src/lib/components/{ui/CheckboxField → CheckboxField}/README.mdx +15 -12
- package/src/lib/components/{ui/CheckboxField → CheckboxField}/index.js +0 -0
- package/src/lib/components/FileInputField/FileInputField.jsx +162 -0
- package/src/lib/components/{ui/FileInputField → FileInputField}/FileInputField.scss +5 -5
- package/src/lib/components/{ui/FileInputField → FileInputField}/README.mdx +8 -6
- package/src/lib/components/{ui/FileInputField → FileInputField}/index.js +0 -0
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.jsx +16 -18
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayout.scss +3 -3
- package/src/lib/components/FormLayout/FormLayoutContext.js +3 -0
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.jsx +33 -30
- package/src/lib/components/{layout/FormLayout → FormLayout}/FormLayoutCustomField.scss +4 -4
- package/src/lib/components/{layout/FormLayout → FormLayout}/README.mdx +30 -40
- package/src/lib/components/{layout/FormLayout → FormLayout}/_theme.scss +0 -0
- package/src/lib/components/{layout/FormLayout → FormLayout}/index.js +1 -0
- package/src/lib/components/{layout/Grid → Grid}/Grid.jsx +23 -5
- package/src/lib/components/{layout/Grid → Grid}/Grid.scss +2 -4
- package/src/lib/components/{layout/Grid → Grid}/GridSpan.jsx +10 -3
- package/src/lib/components/{layout/Grid → Grid}/README.mdx +42 -38
- package/src/lib/components/{layout/Grid → Grid}/_theme.scss +1 -2
- package/src/lib/components/{layout/Grid → Grid}/_tools.scss +2 -2
- package/src/lib/components/{layout/Grid → Grid}/helpers/generateResponsiveCustomProperties.js +0 -0
- package/src/lib/components/{layout/Grid → Grid}/index.js +0 -0
- package/src/lib/components/Link/Link.jsx +45 -0
- package/src/lib/components/Link/Link.scss +11 -0
- package/src/lib/components/Link/README.mdx +85 -0
- package/src/lib/components/Link/_theme.scss +4 -0
- package/src/lib/components/Link/index.js +1 -0
- package/src/lib/components/{layout/List → List}/List.jsx +1 -1
- package/src/lib/components/{layout/List → List}/List.scss +2 -2
- package/src/lib/components/{layout/List → List}/ListItem.jsx +1 -1
- package/src/lib/components/{layout/List → List}/README.mdx +2 -2
- package/src/lib/components/{layout/List → List}/_theme.scss +0 -0
- package/src/lib/components/{layout/List → List}/index.js +0 -0
- package/src/lib/components/{layout/Media → Media}/Media.jsx +4 -2
- package/src/lib/components/{layout/Media → Media}/Media.scss +1 -1
- package/src/lib/components/{layout/Media → Media}/MediaBody.jsx +1 -1
- package/src/lib/components/{layout/Media → Media}/MediaObject.jsx +1 -1
- package/src/lib/components/{layout/Media → Media}/README.mdx +2 -2
- package/src/lib/components/{layout/Media → Media}/index.js +0 -0
- package/src/lib/components/{ui/Modal → Modal}/Modal.jsx +28 -27
- package/src/lib/components/{ui/Modal → Modal}/Modal.scss +5 -5
- package/src/lib/components/{ui/Modal → Modal}/README.mdx +40 -40
- package/src/lib/components/{ui/Modal → Modal}/_settings.scss +4 -4
- package/src/lib/components/{ui/Modal → Modal}/_theme.scss +0 -0
- package/src/lib/components/{ui/Modal → Modal}/index.js +0 -0
- package/src/lib/components/{ui/Paper → Paper}/Paper.jsx +8 -1
- package/src/lib/components/{ui/Paper → Paper}/Paper.scss +5 -0
- package/src/lib/components/{ui/Paper → Paper}/README.mdx +14 -2
- package/src/lib/components/{ui/Paper → Paper}/_theme.scss +2 -0
- package/src/lib/components/{ui/Paper → Paper}/index.js +0 -0
- package/src/lib/components/{ui/Radio → Radio}/README.mdx +17 -14
- package/src/lib/components/Radio/Radio.jsx +188 -0
- package/src/lib/components/{ui/Radio → Radio}/Radio.scss +9 -9
- package/src/lib/components/{ui/Radio → Radio}/index.js +0 -0
- package/src/lib/components/{ui/ScrollView → ScrollView}/README.mdx +10 -10
- package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.jsx +9 -10
- package/src/lib/components/{ui/ScrollView → ScrollView}/ScrollView.scss +6 -6
- package/src/lib/components/{ui/ScrollView → ScrollView}/_theme.scss +0 -0
- package/src/lib/components/{ui/ScrollView → ScrollView}/index.js +0 -0
- package/src/lib/components/{ui/SelectField → SelectField}/README.mdx +44 -41
- package/src/lib/components/SelectField/SelectField.jsx +219 -0
- package/src/lib/components/{ui/SelectField → SelectField}/SelectField.scss +6 -6
- package/src/lib/components/{ui/SelectField → SelectField}/index.js +0 -0
- package/src/lib/components/{ui/Table → Table}/README.mdx +7 -7
- package/src/lib/components/{ui/Table → Table}/Table.jsx +9 -13
- package/src/lib/components/{ui/Table → Table}/Table.scss +1 -1
- package/src/lib/components/{ui/Table → Table}/_settings.scss +4 -4
- package/src/lib/components/{ui/Table → Table}/index.js +0 -0
- package/src/lib/components/{ui/Tabs → Tabs}/README.mdx +3 -3
- package/src/lib/components/{ui/Tabs → Tabs}/Tabs.jsx +4 -4
- package/src/lib/components/{ui/Tabs → Tabs}/Tabs.scss +1 -1
- package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.jsx +4 -3
- package/src/lib/components/{ui/Tabs → Tabs}/TabsItem.scss +3 -3
- package/src/lib/components/{ui/Tabs → Tabs}/_theme.scss +0 -0
- package/src/lib/components/{ui/Tabs → Tabs}/index.js +0 -0
- package/src/lib/components/{ui/Text → Text}/README.mdx +19 -19
- package/src/lib/components/{ui/Text → Text}/Text.jsx +1 -1
- package/src/lib/components/{ui/Text → Text}/Text.scss +0 -0
- package/src/lib/components/{ui/Text → Text}/helpers/getRootHyphensClassName.js +0 -0
- package/src/lib/components/{ui/Text → Text}/helpers/getRootWordWrappingClassName.js +0 -0
- package/src/lib/components/{ui/Text → Text}/index.js +0 -0
- package/src/lib/components/{ui/TextArea → TextArea}/README.mdx +8 -6
- package/src/lib/components/{ui/TextArea → TextArea}/TextArea.jsx +78 -78
- package/src/lib/components/{ui/TextArea → TextArea}/TextArea.scss +6 -6
- package/src/lib/components/{ui/TextArea → TextArea}/index.js +0 -0
- package/src/lib/components/{ui/TextField → TextField}/README.mdx +7 -6
- package/src/lib/components/{ui/TextField → TextField}/TextField.jsx +20 -23
- package/src/lib/components/{ui/TextField → TextField}/TextField.scss +6 -6
- package/src/lib/components/{ui/TextField → TextField}/index.js +0 -0
- package/src/lib/components/{ui/Toggle → Toggle}/README.mdx +15 -12
- package/src/lib/components/Toggle/Toggle.jsx +163 -0
- package/src/lib/components/{ui/Toggle → Toggle}/Toggle.scss +5 -5
- package/src/lib/components/{ui/Toggle → Toggle}/index.js +0 -0
- package/src/lib/components/{layout/Toolbar → Toolbar}/README.mdx +26 -26
- package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.jsx +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/Toolbar.scss +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarGroup.jsx +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/ToolbarItem.jsx +1 -1
- package/src/lib/components/{layout/Toolbar → Toolbar}/_theme.scss +0 -0
- package/src/lib/components/{layout/Toolbar → Toolbar}/index.js +0 -0
- package/src/lib/components/{ui/withForwardedRef.jsx → withForwardedRef.jsx} +0 -0
- package/src/lib/helpers/resolveContextOrProp.js +7 -0
- package/src/lib/index.js +34 -35
- package/src/lib/styles/tools/_accessibility.scss +9 -0
- package/src/lib/theme.scss +25 -7
- package/src/lib/components/ui/Button/Button.jsx +0 -191
- package/src/lib/components/ui/Button/_base.scss +0 -154
- package/src/lib/components/ui/Button/helpers/getRootLabelVisibilityClassName.js +0 -11
- package/src/lib/components/ui/ButtonGroup/index.js +0 -1
- package/src/lib/components/ui/CheckboxField/CheckboxField.jsx +0 -173
- package/src/lib/components/ui/FileInputField/FileInputField.jsx +0 -158
- package/src/lib/components/ui/Radio/Radio.jsx +0 -179
- package/src/lib/components/ui/SelectField/SelectField.jsx +0 -214
- package/src/lib/components/ui/Toggle/Toggle.jsx +0 -174
@@ -1,191 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import getRootSizeClassName from '../../../helpers/getRootSizeClassName';
|
4
|
-
import getRootColorClassName from '../../../helpers/getRootColorClassName';
|
5
|
-
import { withProviderContext } from '../../../provider';
|
6
|
-
import transferProps from '../../../utils/transferProps';
|
7
|
-
import withForwardedRef from '../withForwardedRef';
|
8
|
-
import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
|
9
|
-
import getRootPriorityClassName from './helpers/getRootPriorityClassName';
|
10
|
-
import styles from './Button.scss';
|
11
|
-
|
12
|
-
export const Button = ({
|
13
|
-
afterLabel,
|
14
|
-
beforeLabel,
|
15
|
-
block,
|
16
|
-
clickHandler,
|
17
|
-
disabled,
|
18
|
-
endCorner,
|
19
|
-
forwardedRef,
|
20
|
-
grouped,
|
21
|
-
id,
|
22
|
-
label,
|
23
|
-
labelVisibility,
|
24
|
-
loadingIcon,
|
25
|
-
priority,
|
26
|
-
size,
|
27
|
-
startCorner,
|
28
|
-
type,
|
29
|
-
color,
|
30
|
-
...restProps
|
31
|
-
}) => (
|
32
|
-
/* No worries, `type` is always assigned correctly through props. */
|
33
|
-
/* eslint-disable react/button-has-type */
|
34
|
-
<button
|
35
|
-
{...transferProps(restProps)}
|
36
|
-
className={
|
37
|
-
priority === 'link'
|
38
|
-
? [
|
39
|
-
styles.root,
|
40
|
-
getRootPriorityClassName(priority, styles),
|
41
|
-
].join(' ')
|
42
|
-
: [
|
43
|
-
styles.root,
|
44
|
-
getRootPriorityClassName(priority, styles),
|
45
|
-
getRootColorClassName(color, styles),
|
46
|
-
getRootSizeClassName(size, styles),
|
47
|
-
getRootLabelVisibilityClassName(labelVisibility, styles),
|
48
|
-
block ? styles.rootBlock : '',
|
49
|
-
grouped ? styles.rootGrouped : '',
|
50
|
-
loadingIcon ? styles.isRootLoading : '',
|
51
|
-
].join(' ')
|
52
|
-
}
|
53
|
-
disabled={disabled || !!loadingIcon}
|
54
|
-
id={id}
|
55
|
-
onClick={clickHandler}
|
56
|
-
ref={forwardedRef}
|
57
|
-
type={type}
|
58
|
-
>
|
59
|
-
{priority !== 'link' && startCorner && (
|
60
|
-
<span className={styles.startCorner}>
|
61
|
-
{startCorner}
|
62
|
-
</span>
|
63
|
-
)}
|
64
|
-
{beforeLabel && (
|
65
|
-
<span className={styles.beforeLabel}>
|
66
|
-
{beforeLabel}
|
67
|
-
</span>
|
68
|
-
)}
|
69
|
-
<span
|
70
|
-
className={styles.label}
|
71
|
-
{...(id && { id: `${id}__labelText` })}
|
72
|
-
>
|
73
|
-
{label}
|
74
|
-
</span>
|
75
|
-
{afterLabel && (
|
76
|
-
<span className={styles.afterLabel}>
|
77
|
-
{afterLabel}
|
78
|
-
</span>
|
79
|
-
)}
|
80
|
-
{priority !== 'link' && endCorner && (
|
81
|
-
<span className={styles.endCorner}>
|
82
|
-
{endCorner}
|
83
|
-
</span>
|
84
|
-
)}
|
85
|
-
{priority !== 'link' && loadingIcon && (
|
86
|
-
<span className={styles.loadingIcon}>
|
87
|
-
{loadingIcon}
|
88
|
-
</span>
|
89
|
-
)}
|
90
|
-
</button>
|
91
|
-
/* eslint-enable react/button-has-type */
|
92
|
-
);
|
93
|
-
|
94
|
-
Button.defaultProps = {
|
95
|
-
afterLabel: null,
|
96
|
-
beforeLabel: null,
|
97
|
-
block: false,
|
98
|
-
clickHandler: null,
|
99
|
-
color: 'primary',
|
100
|
-
disabled: false,
|
101
|
-
endCorner: null,
|
102
|
-
forwardedRef: undefined,
|
103
|
-
grouped: false,
|
104
|
-
id: undefined,
|
105
|
-
labelVisibility: 'all',
|
106
|
-
loadingIcon: null,
|
107
|
-
priority: 'filled',
|
108
|
-
size: 'medium',
|
109
|
-
startCorner: null,
|
110
|
-
type: 'button',
|
111
|
-
};
|
112
|
-
|
113
|
-
Button.propTypes = {
|
114
|
-
/**
|
115
|
-
* Element to be displayed after label, eg. an icon.
|
116
|
-
*/
|
117
|
-
afterLabel: PropTypes.node,
|
118
|
-
/**
|
119
|
-
* Element to be displayed before label, eg. an icon.
|
120
|
-
*/
|
121
|
-
beforeLabel: PropTypes.node,
|
122
|
-
/**
|
123
|
-
* If `true`, the button will span the full width of its parent.
|
124
|
-
*/
|
125
|
-
block: PropTypes.bool,
|
126
|
-
/**
|
127
|
-
* Function to call when the button is clicked.
|
128
|
-
*/
|
129
|
-
clickHandler: PropTypes.func,
|
130
|
-
/**
|
131
|
-
* [Color variant](/foundation/colors#component-colors) to clarify importance and meaning of the button.
|
132
|
-
*/
|
133
|
-
color: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
|
134
|
-
/**
|
135
|
-
* If `true`, the button will be disabled.
|
136
|
-
*/
|
137
|
-
disabled: PropTypes.bool,
|
138
|
-
/**
|
139
|
-
* Element to be displayed in the top right corner.
|
140
|
-
*/
|
141
|
-
endCorner: PropTypes.node,
|
142
|
-
/**
|
143
|
-
* Reference forwarded to the `button` element.
|
144
|
-
*/
|
145
|
-
forwardedRef: PropTypes.oneOfType([
|
146
|
-
PropTypes.func,
|
147
|
-
// eslint-disable-next-line react/forbid-prop-types
|
148
|
-
PropTypes.shape({ current: PropTypes.any }),
|
149
|
-
]),
|
150
|
-
/**
|
151
|
-
* Treat button differently when it's inside `ButtonGroup`. Do not set manually!
|
152
|
-
*/
|
153
|
-
grouped: PropTypes.bool,
|
154
|
-
/**
|
155
|
-
* ID of the root HTML element.
|
156
|
-
*/
|
157
|
-
id: PropTypes.string,
|
158
|
-
/**
|
159
|
-
* Button label.
|
160
|
-
*/
|
161
|
-
label: PropTypes.string.isRequired,
|
162
|
-
/**
|
163
|
-
* Defines when the button label should be visible.
|
164
|
-
*/
|
165
|
-
labelVisibility: PropTypes.oneOf(['all', 'desktop', 'none']),
|
166
|
-
/**
|
167
|
-
* Element to be displayed as a loading icon. When defined, it implies the button is in the
|
168
|
-
* loading state.
|
169
|
-
*/
|
170
|
-
loadingIcon: PropTypes.node,
|
171
|
-
/**
|
172
|
-
* Visual priority to highlight or suppress the button.
|
173
|
-
*/
|
174
|
-
priority: PropTypes.oneOf(['filled', 'outline', 'flat', 'link']),
|
175
|
-
/**
|
176
|
-
* Size of the button.
|
177
|
-
*/
|
178
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
179
|
-
/**
|
180
|
-
* Element to be displayed in the top left corner.
|
181
|
-
*/
|
182
|
-
startCorner: PropTypes.node,
|
183
|
-
/**
|
184
|
-
* Set the HTML `type` attribute of the `button` element.
|
185
|
-
*/
|
186
|
-
type: PropTypes.oneOf(['button', 'submit']),
|
187
|
-
};
|
188
|
-
|
189
|
-
export const ButtonWithContext = withForwardedRef(withProviderContext(Button, 'Button'));
|
190
|
-
|
191
|
-
export default ButtonWithContext;
|
@@ -1,154 +0,0 @@
|
|
1
|
-
@use 'sass:map';
|
2
|
-
@use '../../../styles/tools/accessibility';
|
3
|
-
@use '../../../styles/tools/breakpoint';
|
4
|
-
@use 'settings';
|
5
|
-
@use 'theme';
|
6
|
-
@use 'tools';
|
7
|
-
|
8
|
-
.root {
|
9
|
-
@include tools.button();
|
10
|
-
}
|
11
|
-
|
12
|
-
.label {
|
13
|
-
display: block;
|
14
|
-
}
|
15
|
-
|
16
|
-
.beforeLabel,
|
17
|
-
.afterLabel,
|
18
|
-
.startCorner,
|
19
|
-
.endCorner,
|
20
|
-
.loadingIcon {
|
21
|
-
display: flex;
|
22
|
-
align-items: baseline;
|
23
|
-
justify-content: center;
|
24
|
-
}
|
25
|
-
|
26
|
-
.beforeLabel {
|
27
|
-
margin-right: settings.$icon-spacing;
|
28
|
-
}
|
29
|
-
|
30
|
-
.afterLabel,
|
31
|
-
.loadingIcon {
|
32
|
-
margin-left: settings.$icon-spacing;
|
33
|
-
}
|
34
|
-
|
35
|
-
.startCorner,
|
36
|
-
.endCorner {
|
37
|
-
position: absolute;
|
38
|
-
top: -0.35rem;
|
39
|
-
}
|
40
|
-
|
41
|
-
.startCorner {
|
42
|
-
left: 0;
|
43
|
-
margin-left: -0.35rem;
|
44
|
-
}
|
45
|
-
|
46
|
-
.endCorner {
|
47
|
-
right: 0;
|
48
|
-
margin-right: -0.35rem;
|
49
|
-
}
|
50
|
-
|
51
|
-
.rootSizeSmall {
|
52
|
-
@include tools.button-size(small);
|
53
|
-
}
|
54
|
-
|
55
|
-
.rootSizeMedium {
|
56
|
-
@include tools.button-size(medium);
|
57
|
-
}
|
58
|
-
|
59
|
-
.rootSizeLarge {
|
60
|
-
@include tools.button-size(large);
|
61
|
-
}
|
62
|
-
|
63
|
-
.rootBlock {
|
64
|
-
width: 100%;
|
65
|
-
}
|
66
|
-
|
67
|
-
.rootBlock.withLabelHiddenMobile {
|
68
|
-
@include breakpoint.up(settings.$breakpoint) {
|
69
|
-
width: 100%;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
.rootGrouped {
|
74
|
-
z-index: map.get(settings.$group-z-indexes, button);
|
75
|
-
|
76
|
-
&:not(:first-child) {
|
77
|
-
margin-left: var(--local-gap);
|
78
|
-
border-top-left-radius: 0;
|
79
|
-
border-bottom-left-radius: 0;
|
80
|
-
}
|
81
|
-
|
82
|
-
&:not(:last-child) {
|
83
|
-
border-top-right-radius: 0;
|
84
|
-
border-bottom-right-radius: 0;
|
85
|
-
}
|
86
|
-
|
87
|
-
&:focus,
|
88
|
-
&:not(:disabled):hover {
|
89
|
-
z-index: map.get(settings.$group-z-indexes, button-hover);
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
.rootGrouped .startCorner,
|
94
|
-
.rootGrouped .endCorner {
|
95
|
-
z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
|
96
|
-
}
|
97
|
-
|
98
|
-
.withLabelHidden .label,
|
99
|
-
.withLabelHiddenMobile .label {
|
100
|
-
@include accessibility.hide-text();
|
101
|
-
}
|
102
|
-
|
103
|
-
.withLabelHiddenMobile .label {
|
104
|
-
@include breakpoint.up(settings.$breakpoint) {
|
105
|
-
position: relative;
|
106
|
-
width: auto;
|
107
|
-
height: auto;
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
.withLabelHidden .beforeLabel,
|
112
|
-
.withLabelHidden .afterLabel,
|
113
|
-
.withLabelHiddenMobile .beforeLabel,
|
114
|
-
.withLabelHiddenMobile .afterLabel {
|
115
|
-
margin-right: 0;
|
116
|
-
margin-left: 0;
|
117
|
-
}
|
118
|
-
|
119
|
-
.withLabelHiddenMobile .beforeLabel {
|
120
|
-
@include breakpoint.up(settings.$breakpoint) {
|
121
|
-
margin-right: settings.$icon-spacing;
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
.withLabelHiddenMobile .afterLabel {
|
126
|
-
@include breakpoint.up(settings.$breakpoint) {
|
127
|
-
margin-left: settings.$icon-spacing;
|
128
|
-
}
|
129
|
-
}
|
130
|
-
|
131
|
-
.withLabelHidden.isRootLoading .loadingIcon,
|
132
|
-
.withLabelHiddenMobile.isRootLoading .loadingIcon {
|
133
|
-
margin-left: 0;
|
134
|
-
}
|
135
|
-
|
136
|
-
.withLabelHidden.isRootLoading .beforeLabel,
|
137
|
-
.withLabelHidden.isRootLoading .afterLabel,
|
138
|
-
.withLabelHiddenMobile.isRootLoading .beforeLabel,
|
139
|
-
.withLabelHiddenMobile.isRootLoading .afterLabel {
|
140
|
-
display: none;
|
141
|
-
}
|
142
|
-
|
143
|
-
.withLabelHiddenMobile.isRootLoading .beforeLabel,
|
144
|
-
.withLabelHiddenMobile.isRootLoading .afterLabel {
|
145
|
-
@include breakpoint.up(settings.$breakpoint) {
|
146
|
-
display: flex;
|
147
|
-
}
|
148
|
-
}
|
149
|
-
|
150
|
-
.withLabelHiddenMobile.isRootLoading .loadingIcon {
|
151
|
-
@include breakpoint.up(settings.$breakpoint) {
|
152
|
-
margin-left: settings.$icon-spacing;
|
153
|
-
}
|
154
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export { default } from './ButtonGroup';
|
@@ -1,173 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import getRootValidationStateClassName from '../../../helpers/getRootValidationStateClassName';
|
4
|
-
import { withProviderContext } from '../../../provider';
|
5
|
-
import transferProps from '../../../utils/transferProps';
|
6
|
-
import withForwardedRef from '../withForwardedRef';
|
7
|
-
import styles from './CheckboxField.scss';
|
8
|
-
|
9
|
-
export const CheckboxField = ({
|
10
|
-
changeHandler,
|
11
|
-
checked,
|
12
|
-
disabled,
|
13
|
-
forwardedRef,
|
14
|
-
helpText,
|
15
|
-
id,
|
16
|
-
inFormLayout,
|
17
|
-
isLabelVisible,
|
18
|
-
label,
|
19
|
-
labelPosition,
|
20
|
-
layout,
|
21
|
-
required,
|
22
|
-
validationState,
|
23
|
-
validationText,
|
24
|
-
value,
|
25
|
-
...restProps
|
26
|
-
}) => (
|
27
|
-
<label
|
28
|
-
className={[
|
29
|
-
styles.root,
|
30
|
-
inFormLayout ? styles.isRootInFormLayout : '',
|
31
|
-
labelPosition === 'before' ? styles.hasRootLabelBefore : '',
|
32
|
-
layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
|
33
|
-
disabled ? styles.isRootDisabled : '',
|
34
|
-
required ? styles.isRootRequired : '',
|
35
|
-
getRootValidationStateClassName(validationState, styles),
|
36
|
-
].join(' ')}
|
37
|
-
htmlFor={id}
|
38
|
-
id={id && `${id}__label`}
|
39
|
-
>
|
40
|
-
<div className={styles.field}>
|
41
|
-
<input
|
42
|
-
{...transferProps(restProps)}
|
43
|
-
checked={checked}
|
44
|
-
className={styles.input}
|
45
|
-
disabled={disabled}
|
46
|
-
id={id}
|
47
|
-
onChange={changeHandler}
|
48
|
-
ref={forwardedRef}
|
49
|
-
required={required}
|
50
|
-
type="checkbox"
|
51
|
-
value={value}
|
52
|
-
/>
|
53
|
-
<div
|
54
|
-
className={[
|
55
|
-
styles.label,
|
56
|
-
isLabelVisible ? '' : styles.isLabelHidden,
|
57
|
-
].join(' ')}
|
58
|
-
id={id && `${id}__labelText`}
|
59
|
-
>
|
60
|
-
{label}
|
61
|
-
</div>
|
62
|
-
</div>
|
63
|
-
{helpText && (
|
64
|
-
<div
|
65
|
-
className={styles.helpText}
|
66
|
-
id={id && `${id}__helpText`}
|
67
|
-
>
|
68
|
-
{helpText}
|
69
|
-
</div>
|
70
|
-
)}
|
71
|
-
{validationText && (
|
72
|
-
<div
|
73
|
-
className={styles.validationText}
|
74
|
-
id={id && `${id}__validationText`}
|
75
|
-
>
|
76
|
-
{validationText}
|
77
|
-
</div>
|
78
|
-
)}
|
79
|
-
</label>
|
80
|
-
);
|
81
|
-
|
82
|
-
CheckboxField.defaultProps = {
|
83
|
-
changeHandler: null,
|
84
|
-
checked: false,
|
85
|
-
disabled: false,
|
86
|
-
forwardedRef: undefined,
|
87
|
-
helpText: null,
|
88
|
-
id: undefined,
|
89
|
-
inFormLayout: false,
|
90
|
-
isLabelVisible: true,
|
91
|
-
labelPosition: 'after',
|
92
|
-
layout: 'vertical',
|
93
|
-
required: false,
|
94
|
-
validationState: null,
|
95
|
-
validationText: null,
|
96
|
-
value: undefined,
|
97
|
-
};
|
98
|
-
|
99
|
-
CheckboxField.propTypes = {
|
100
|
-
/**
|
101
|
-
* Function to call when the input is toggled.
|
102
|
-
*/
|
103
|
-
changeHandler: PropTypes.func,
|
104
|
-
/**
|
105
|
-
* If `true`, the input will be checked.
|
106
|
-
*/
|
107
|
-
checked: PropTypes.bool,
|
108
|
-
/**
|
109
|
-
* If `true`, the input will be disabled.
|
110
|
-
*/
|
111
|
-
disabled: PropTypes.bool,
|
112
|
-
/**
|
113
|
-
* Reference forwarded to the `input` element.
|
114
|
-
*/
|
115
|
-
forwardedRef: PropTypes.oneOfType([
|
116
|
-
PropTypes.func,
|
117
|
-
// eslint-disable-next-line react/forbid-prop-types
|
118
|
-
PropTypes.shape({ current: PropTypes.any }),
|
119
|
-
]),
|
120
|
-
/**
|
121
|
-
* Optional help text.
|
122
|
-
*/
|
123
|
-
helpText: PropTypes.node,
|
124
|
-
/**
|
125
|
-
* ID of the input HTML element. It also serves as a prefix for important inner elements:
|
126
|
-
* `<ID>__label`, `<ID>__labelText`, `<ID>__helpText`, and `<ID>__validationText`.
|
127
|
-
*/
|
128
|
-
id: PropTypes.string,
|
129
|
-
/**
|
130
|
-
* Treat the field differently when it's inside a FormLayout. Do not set manually!
|
131
|
-
*/
|
132
|
-
inFormLayout: PropTypes.bool,
|
133
|
-
/**
|
134
|
-
* If `false`, the label will be visually hidden (but remains accessible by assistive
|
135
|
-
* technologies).
|
136
|
-
*/
|
137
|
-
isLabelVisible: PropTypes.bool,
|
138
|
-
/**
|
139
|
-
* Checkbox field label.
|
140
|
-
*/
|
141
|
-
label: PropTypes.string.isRequired,
|
142
|
-
/**
|
143
|
-
* Placement of the label relative to the input.
|
144
|
-
*/
|
145
|
-
labelPosition: PropTypes.oneOf(['before', 'after']),
|
146
|
-
/**
|
147
|
-
* Layout of the field. It has impact only on CheckboxField inside a FormLayout.
|
148
|
-
*/
|
149
|
-
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
150
|
-
/**
|
151
|
-
* If `true`, the input will be required.
|
152
|
-
*/
|
153
|
-
required: PropTypes.bool,
|
154
|
-
/**
|
155
|
-
* Alter the field to provide feedback based on validation result.
|
156
|
-
*/
|
157
|
-
validationState: PropTypes.oneOf(['invalid', 'valid', 'warning']),
|
158
|
-
/**
|
159
|
-
* Validation message to be displayed.
|
160
|
-
*/
|
161
|
-
validationText: PropTypes.node,
|
162
|
-
/**
|
163
|
-
* Value of the input.
|
164
|
-
*/
|
165
|
-
value: PropTypes.oneOfType([
|
166
|
-
PropTypes.string,
|
167
|
-
PropTypes.number,
|
168
|
-
]),
|
169
|
-
};
|
170
|
-
|
171
|
-
export const CheckboxFieldWithContext = withForwardedRef(withProviderContext(CheckboxField, 'CheckboxField'));
|
172
|
-
|
173
|
-
export default CheckboxFieldWithContext;
|
@@ -1,158 +0,0 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
|
-
import React from 'react';
|
3
|
-
import getRootValidationStateClassName from '../../../helpers/getRootValidationStateClassName';
|
4
|
-
import { withProviderContext } from '../../../provider';
|
5
|
-
import transferProps from '../../../utils/transferProps';
|
6
|
-
import withForwardedRef from '../withForwardedRef';
|
7
|
-
import styles from './FileInputField.scss';
|
8
|
-
|
9
|
-
export const FileInputField = ({
|
10
|
-
changeHandler,
|
11
|
-
disabled,
|
12
|
-
forwardedRef,
|
13
|
-
fullWidth,
|
14
|
-
helpText,
|
15
|
-
id,
|
16
|
-
inFormLayout,
|
17
|
-
isLabelVisible,
|
18
|
-
label,
|
19
|
-
layout,
|
20
|
-
required,
|
21
|
-
validationState,
|
22
|
-
validationText,
|
23
|
-
...restProps
|
24
|
-
}) => (
|
25
|
-
<label
|
26
|
-
className={[
|
27
|
-
styles.root,
|
28
|
-
fullWidth ? styles.isRootFullWidth : '',
|
29
|
-
inFormLayout ? styles.isRootInFormLayout : '',
|
30
|
-
layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
|
31
|
-
disabled ? styles.isRootDisabled : '',
|
32
|
-
required ? styles.isRootRequired : '',
|
33
|
-
getRootValidationStateClassName(validationState, styles),
|
34
|
-
].join(' ')}
|
35
|
-
htmlFor={id}
|
36
|
-
id={id && `${id}__label`}
|
37
|
-
>
|
38
|
-
<div
|
39
|
-
className={[
|
40
|
-
styles.label,
|
41
|
-
isLabelVisible ? '' : styles.isLabelHidden,
|
42
|
-
].join(' ')}
|
43
|
-
id={id && `${id}__labelText`}
|
44
|
-
>
|
45
|
-
{label}
|
46
|
-
</div>
|
47
|
-
<div className={styles.field}>
|
48
|
-
<div className={styles.inputContainer}>
|
49
|
-
<input
|
50
|
-
{...transferProps(restProps)}
|
51
|
-
className={styles.input}
|
52
|
-
disabled={disabled}
|
53
|
-
id={id}
|
54
|
-
onChange={changeHandler}
|
55
|
-
ref={forwardedRef}
|
56
|
-
required={required}
|
57
|
-
type="file"
|
58
|
-
/>
|
59
|
-
</div>
|
60
|
-
{helpText && (
|
61
|
-
<div
|
62
|
-
className={styles.helpText}
|
63
|
-
id={id && `${id}__helpText`}
|
64
|
-
>
|
65
|
-
{helpText}
|
66
|
-
</div>
|
67
|
-
)}
|
68
|
-
{validationText && (
|
69
|
-
<div
|
70
|
-
className={styles.validationText}
|
71
|
-
id={id && `${id}__validationText`}
|
72
|
-
>
|
73
|
-
{validationText}
|
74
|
-
</div>
|
75
|
-
)}
|
76
|
-
</div>
|
77
|
-
</label>
|
78
|
-
);
|
79
|
-
|
80
|
-
FileInputField.defaultProps = {
|
81
|
-
changeHandler: null,
|
82
|
-
disabled: false,
|
83
|
-
forwardedRef: undefined,
|
84
|
-
fullWidth: false,
|
85
|
-
helpText: null,
|
86
|
-
id: undefined,
|
87
|
-
inFormLayout: false,
|
88
|
-
isLabelVisible: true,
|
89
|
-
layout: 'vertical',
|
90
|
-
required: false,
|
91
|
-
validationState: null,
|
92
|
-
validationText: null,
|
93
|
-
};
|
94
|
-
|
95
|
-
FileInputField.propTypes = {
|
96
|
-
/**
|
97
|
-
* Function to call when the input has changed.
|
98
|
-
*/
|
99
|
-
changeHandler: PropTypes.func,
|
100
|
-
/**
|
101
|
-
* If `true`, the input will be disabled.
|
102
|
-
*/
|
103
|
-
disabled: PropTypes.bool,
|
104
|
-
/**
|
105
|
-
* Reference forwarded to the `input` element.
|
106
|
-
*/
|
107
|
-
forwardedRef: PropTypes.oneOfType([
|
108
|
-
PropTypes.func,
|
109
|
-
// eslint-disable-next-line react/forbid-prop-types
|
110
|
-
PropTypes.shape({ current: PropTypes.any }),
|
111
|
-
]),
|
112
|
-
/**
|
113
|
-
* If `true`, the field will span the full width of its parent.
|
114
|
-
*/
|
115
|
-
fullWidth: PropTypes.bool,
|
116
|
-
/**
|
117
|
-
* Optional help text.
|
118
|
-
*/
|
119
|
-
helpText: PropTypes.node,
|
120
|
-
/**
|
121
|
-
* ID of the input HTML element. It also serves as a prefix for important inner elements:
|
122
|
-
* `<ID>__label`, `<ID>__labelText`, `<ID>__helpText`, and `<ID>__validationText`.
|
123
|
-
*/
|
124
|
-
id: PropTypes.string,
|
125
|
-
/**
|
126
|
-
* Treat the field differently when it's inside a FormLayout. Do not set manually!
|
127
|
-
*/
|
128
|
-
inFormLayout: PropTypes.bool,
|
129
|
-
/**
|
130
|
-
* If `false`, the label will be visually hidden (but remains accessible by assistive
|
131
|
-
* technologies).
|
132
|
-
*/
|
133
|
-
isLabelVisible: PropTypes.bool,
|
134
|
-
/**
|
135
|
-
* Text field label.
|
136
|
-
*/
|
137
|
-
label: PropTypes.string.isRequired,
|
138
|
-
/**
|
139
|
-
* Layout of the field.
|
140
|
-
*/
|
141
|
-
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
142
|
-
/**
|
143
|
-
* If `true`, the input will be required.
|
144
|
-
*/
|
145
|
-
required: PropTypes.bool,
|
146
|
-
/**
|
147
|
-
* Alter the field to provide feedback based on validation result.
|
148
|
-
*/
|
149
|
-
validationState: PropTypes.oneOf(['invalid', 'valid', 'warning']),
|
150
|
-
/**
|
151
|
-
* Validation message to be displayed.
|
152
|
-
*/
|
153
|
-
validationText: PropTypes.node,
|
154
|
-
};
|
155
|
-
|
156
|
-
export const FileInputFieldWithContext = withForwardedRef(withProviderContext(FileInputField, 'FileInputField'));
|
157
|
-
|
158
|
-
export default FileInputFieldWithContext;
|