@react-ui-org/react-ui 0.42.0 → 0.44.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/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,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Toggle
|
|
3
|
-
menu: '
|
|
4
|
-
route: /components/
|
|
3
|
+
menu: 'Inputs'
|
|
4
|
+
route: /components/toggle
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Toggle
|
|
@@ -29,9 +29,9 @@ And use it:
|
|
|
29
29
|
const [studioQuality, setStudioQuality] = React.useState(true);
|
|
30
30
|
return (
|
|
31
31
|
<Toggle
|
|
32
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
33
32
|
checked={studioQuality}
|
|
34
33
|
label="Listen in studio quality"
|
|
34
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
35
35
|
/>
|
|
36
36
|
);
|
|
37
37
|
}}
|
|
@@ -75,13 +75,13 @@ turning the toggle on or off.
|
|
|
75
75
|
const [studioQuality, setStudioQuality] = React.useState(true);
|
|
76
76
|
return (
|
|
77
77
|
<Toggle
|
|
78
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
79
78
|
checked={studioQuality}
|
|
80
79
|
helpText={
|
|
81
80
|
'Unrivaled audio quality. Uses the MQA audio format. '
|
|
82
81
|
+ 'Transfers a lot of data.'
|
|
83
82
|
}
|
|
84
83
|
label="Listen in studio quality"
|
|
84
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
85
85
|
/>
|
|
86
86
|
);
|
|
87
87
|
}}
|
|
@@ -97,10 +97,10 @@ remains accessible to assistive technologies.
|
|
|
97
97
|
const [studioQuality, setStudioQuality] = React.useState(true);
|
|
98
98
|
return (
|
|
99
99
|
<Toggle
|
|
100
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
101
100
|
checked={studioQuality}
|
|
102
101
|
isLabelVisible={false}
|
|
103
102
|
label="You cannot see this"
|
|
103
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
104
104
|
/>
|
|
105
105
|
);
|
|
106
106
|
}}
|
|
@@ -113,10 +113,10 @@ It's also possible to display the label before the input:
|
|
|
113
113
|
const [studioQuality, setStudioQuality] = React.useState(true);
|
|
114
114
|
return (
|
|
115
115
|
<Toggle
|
|
116
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
117
116
|
checked={studioQuality}
|
|
118
117
|
label="Listen in studio quality"
|
|
119
118
|
labelPosition="before"
|
|
119
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
120
120
|
/>
|
|
121
121
|
);
|
|
122
122
|
}}
|
|
@@ -137,15 +137,15 @@ have.
|
|
|
137
137
|
return (
|
|
138
138
|
<>
|
|
139
139
|
<Toggle
|
|
140
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
141
140
|
checked={studioQuality}
|
|
142
141
|
label="Listen in studio quality"
|
|
142
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
143
143
|
validationState="valid"
|
|
144
144
|
/>
|
|
145
145
|
<Toggle
|
|
146
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
147
146
|
checked={studioQuality}
|
|
148
147
|
label="Listen in studio quality"
|
|
148
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
149
149
|
validationState="warning"
|
|
150
150
|
validationText={
|
|
151
151
|
'Looks like you are connected over cellular network. '
|
|
@@ -153,9 +153,9 @@ have.
|
|
|
153
153
|
}
|
|
154
154
|
/>
|
|
155
155
|
<Toggle
|
|
156
|
-
changeHandler={() => setStudioQuality(!studioQuality)}
|
|
157
156
|
checked={studioQuality}
|
|
158
157
|
label="Listen in studio quality"
|
|
158
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
159
159
|
validationState="invalid"
|
|
160
160
|
validationText="Please upgrade your plan to make this option available."
|
|
161
161
|
/>
|
|
@@ -179,9 +179,10 @@ Disabled state makes the input unavailable.
|
|
|
179
179
|
|
|
180
180
|
## API
|
|
181
181
|
|
|
182
|
-
In addition to the options below, you can
|
|
183
|
-
interfere with the API, and they will be
|
|
184
|
-
|
|
182
|
+
In addition to the options below, you can specify [React synthetic events] or
|
|
183
|
+
any custom HTML attributes that do not interfere with the API, and they will be
|
|
184
|
+
passed to the `input` HTML element. This enables making the component
|
|
185
|
+
interactive and helps improve its accessibility.
|
|
185
186
|
|
|
186
187
|
<Props table of={Toggle} />
|
|
187
188
|
|
|
@@ -199,3 +200,5 @@ options. On top of that, the following options are available for Toggle.
|
|
|
199
200
|
| `--rui-FormField--check__input--toggle--default__background-position` | Background position of unchecked input |
|
|
200
201
|
| `--rui-FormField--check__input--toggle--checked__background-image` | Background image of checked input |
|
|
201
202
|
| `--rui-FormField--check__input--toggle--checked__background-position` | Background position of checked input |
|
|
203
|
+
|
|
204
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
|
|
4
|
+
import { withProviderContext } from '../../provider';
|
|
5
|
+
import transferProps from '../../utils/transferProps';
|
|
6
|
+
import { FormLayoutContext } from '../FormLayout';
|
|
7
|
+
import withForwardedRef from '../withForwardedRef';
|
|
8
|
+
import styles from './Toggle.scss';
|
|
9
|
+
|
|
10
|
+
export const Toggle = ({
|
|
11
|
+
checked,
|
|
12
|
+
disabled,
|
|
13
|
+
forwardedRef,
|
|
14
|
+
helpText,
|
|
15
|
+
id,
|
|
16
|
+
isLabelVisible,
|
|
17
|
+
label,
|
|
18
|
+
labelPosition,
|
|
19
|
+
required,
|
|
20
|
+
validationState,
|
|
21
|
+
validationText,
|
|
22
|
+
value,
|
|
23
|
+
...restProps
|
|
24
|
+
}) => {
|
|
25
|
+
const context = useContext(FormLayoutContext);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<label
|
|
29
|
+
className={[
|
|
30
|
+
styles.root,
|
|
31
|
+
context ? styles.isRootInFormLayout : '',
|
|
32
|
+
context && context.layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
|
|
33
|
+
labelPosition === 'before' ? styles.hasRootLabelBefore : '',
|
|
34
|
+
disabled ? styles.isRootDisabled : '',
|
|
35
|
+
required ? styles.isRootRequired : '',
|
|
36
|
+
getRootValidationStateClassName(validationState, styles),
|
|
37
|
+
].join(' ')}
|
|
38
|
+
htmlFor={id}
|
|
39
|
+
id={id && `${id}__label`}
|
|
40
|
+
>
|
|
41
|
+
<div className={styles.field}>
|
|
42
|
+
<input
|
|
43
|
+
{...transferProps(restProps)}
|
|
44
|
+
checked={checked}
|
|
45
|
+
className={styles.input}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
id={id}
|
|
48
|
+
name={id}
|
|
49
|
+
ref={forwardedRef}
|
|
50
|
+
required={required}
|
|
51
|
+
type="checkbox"
|
|
52
|
+
value={value}
|
|
53
|
+
/>
|
|
54
|
+
<div
|
|
55
|
+
className={[
|
|
56
|
+
styles.label,
|
|
57
|
+
isLabelVisible ? '' : styles.isLabelHidden,
|
|
58
|
+
].join(' ')}
|
|
59
|
+
id={id && `${id}__labelText`}
|
|
60
|
+
>
|
|
61
|
+
{label}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
{helpText && (
|
|
65
|
+
<div
|
|
66
|
+
className={styles.helpText}
|
|
67
|
+
id={id && `${id}__helpText`}
|
|
68
|
+
>
|
|
69
|
+
{helpText}
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
{validationText && (
|
|
73
|
+
<div
|
|
74
|
+
className={styles.validationText}
|
|
75
|
+
id={id && `${id}__validationText`}
|
|
76
|
+
>
|
|
77
|
+
{validationText}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
80
|
+
</label>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
Toggle.defaultProps = {
|
|
85
|
+
checked: undefined,
|
|
86
|
+
disabled: false,
|
|
87
|
+
forwardedRef: undefined,
|
|
88
|
+
helpText: null,
|
|
89
|
+
id: undefined,
|
|
90
|
+
isLabelVisible: true,
|
|
91
|
+
labelPosition: 'after',
|
|
92
|
+
required: false,
|
|
93
|
+
validationState: null,
|
|
94
|
+
validationText: null,
|
|
95
|
+
value: undefined,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
Toggle.propTypes = {
|
|
99
|
+
/**
|
|
100
|
+
* If `true`, the input will be checked.
|
|
101
|
+
*/
|
|
102
|
+
checked: PropTypes.bool,
|
|
103
|
+
/**
|
|
104
|
+
* If `true`, the input will be disabled.
|
|
105
|
+
*/
|
|
106
|
+
disabled: PropTypes.bool,
|
|
107
|
+
/**
|
|
108
|
+
* Reference forwarded to the `input` element.
|
|
109
|
+
*/
|
|
110
|
+
forwardedRef: PropTypes.oneOfType([
|
|
111
|
+
PropTypes.func,
|
|
112
|
+
// eslint-disable-next-line react/forbid-prop-types
|
|
113
|
+
PropTypes.shape({ current: PropTypes.any }),
|
|
114
|
+
]),
|
|
115
|
+
/**
|
|
116
|
+
* Optional help text.
|
|
117
|
+
*/
|
|
118
|
+
helpText: PropTypes.node,
|
|
119
|
+
/**
|
|
120
|
+
* ID of the input HTML element. It also serves as a prefix for nested elements:
|
|
121
|
+
* * `<ID>__label`
|
|
122
|
+
* * `<ID>__labelText`
|
|
123
|
+
* * `<ID>__helpText`
|
|
124
|
+
* * `<ID>__validationText`
|
|
125
|
+
*/
|
|
126
|
+
id: PropTypes.string,
|
|
127
|
+
/**
|
|
128
|
+
* If `false`, the label will be visually hidden (but remains accessible by assistive
|
|
129
|
+
* technologies).
|
|
130
|
+
*/
|
|
131
|
+
isLabelVisible: PropTypes.bool,
|
|
132
|
+
/**
|
|
133
|
+
* Toggle label.
|
|
134
|
+
*/
|
|
135
|
+
label: PropTypes.string.isRequired,
|
|
136
|
+
/**
|
|
137
|
+
* Placement of the label relative to the input.
|
|
138
|
+
*/
|
|
139
|
+
labelPosition: PropTypes.oneOf(['before', 'after']),
|
|
140
|
+
/**
|
|
141
|
+
* If `true`, the input will be required.
|
|
142
|
+
*/
|
|
143
|
+
required: PropTypes.bool,
|
|
144
|
+
/**
|
|
145
|
+
* Alter the field to provide feedback based on validation result.
|
|
146
|
+
*/
|
|
147
|
+
validationState: PropTypes.oneOf(['invalid', 'valid', 'warning']),
|
|
148
|
+
/**
|
|
149
|
+
* Validation message to be displayed.
|
|
150
|
+
*/
|
|
151
|
+
validationText: PropTypes.node,
|
|
152
|
+
/**
|
|
153
|
+
* Value of the input.
|
|
154
|
+
*/
|
|
155
|
+
value: PropTypes.oneOfType([
|
|
156
|
+
PropTypes.string,
|
|
157
|
+
PropTypes.number,
|
|
158
|
+
]),
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const ToggleWithContext = withForwardedRef(withProviderContext(Toggle, 'Toggle'));
|
|
162
|
+
|
|
163
|
+
export default ToggleWithContext;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@use '
|
|
2
|
-
@use '
|
|
3
|
-
@use '
|
|
4
|
-
@use '
|
|
5
|
-
@use '
|
|
1
|
+
@use '../../styles/tools/form-fields/foundation';
|
|
2
|
+
@use '../../styles/tools/form-fields/inline-field-elements';
|
|
3
|
+
@use '../../styles/tools/form-fields/inline-field-layout';
|
|
4
|
+
@use '../../styles/tools/form-fields/variants';
|
|
5
|
+
@use '../../styles/tools/accessibility';
|
|
6
6
|
|
|
7
7
|
// Foundation
|
|
8
8
|
.root {
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Toolbar
|
|
3
3
|
menu: 'Layouts'
|
|
4
|
-
route: /components/
|
|
4
|
+
route: /components/toolbar
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Toolbar
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
Playground,
|
|
11
11
|
Props,
|
|
12
12
|
} from 'docz'
|
|
13
|
-
import { Placeholder } from '
|
|
14
|
-
import { CheckboxField } from '
|
|
15
|
-
import { Button } from '
|
|
16
|
-
import { ButtonGroup } from '
|
|
13
|
+
import { Placeholder } from '../../../docs/_components/Placeholder/Placeholder'
|
|
14
|
+
import { CheckboxField } from '../CheckboxField/CheckboxField'
|
|
15
|
+
import { Button } from '../Button/Button'
|
|
16
|
+
import { ButtonGroup } from '../ButtonGroup/ButtonGroup'
|
|
17
17
|
import { Toolbar } from './Toolbar'
|
|
18
18
|
import { ToolbarGroup } from './ToolbarGroup'
|
|
19
19
|
import { ToolbarItem } from './ToolbarItem'
|
|
@@ -90,24 +90,24 @@ of `right`.
|
|
|
90
90
|
<ToolbarItem>
|
|
91
91
|
<ButtonGroup aria-labelledby="#alignment-label">
|
|
92
92
|
<Button
|
|
93
|
-
label="top"
|
|
94
|
-
clickHandler={() => setAlignment('top')}
|
|
95
93
|
color={alignment === 'top' ? 'dark' : 'primary'}
|
|
94
|
+
label="top"
|
|
95
|
+
onClick={() => setAlignment('top')}
|
|
96
96
|
/>
|
|
97
97
|
<Button
|
|
98
|
-
label="middle"
|
|
99
|
-
clickHandler={() => setAlignment('middle')}
|
|
100
98
|
color={alignment === 'middle' ? 'dark' : 'primary'}
|
|
99
|
+
label="middle"
|
|
100
|
+
onClick={() => setAlignment('middle')}
|
|
101
101
|
/>
|
|
102
102
|
<Button
|
|
103
|
-
label="bottom"
|
|
104
|
-
clickHandler={() => setAlignment('bottom')}
|
|
105
103
|
color={alignment === 'bottom' ? 'dark' : 'primary'}
|
|
104
|
+
label="bottom"
|
|
105
|
+
onClick={() => setAlignment('bottom')}
|
|
106
106
|
/>
|
|
107
107
|
<Button
|
|
108
|
-
label="baseline"
|
|
109
|
-
clickHandler={() => setAlignment('baseline')}
|
|
110
108
|
color={alignment === 'baseline' ? 'dark' : 'primary'}
|
|
109
|
+
label="baseline"
|
|
110
|
+
onClick={() => setAlignment('baseline')}
|
|
111
111
|
/>
|
|
112
112
|
</ButtonGroup>
|
|
113
113
|
</ToolbarItem>
|
|
@@ -119,24 +119,24 @@ of `right`.
|
|
|
119
119
|
<ToolbarItem>
|
|
120
120
|
<ButtonGroup aria-labelledby="#justification-label">
|
|
121
121
|
<Button
|
|
122
|
-
label="start"
|
|
123
|
-
clickHandler={() => setJustification('start')}
|
|
124
122
|
color={justification === 'start' ? 'dark' : 'primary'}
|
|
123
|
+
label="start"
|
|
124
|
+
onClick={() => setJustification('start')}
|
|
125
125
|
/>
|
|
126
126
|
<Button
|
|
127
|
-
label="center"
|
|
128
|
-
clickHandler={() => setJustification('center')}
|
|
129
127
|
color={justification === 'center' ? 'dark' : 'primary'}
|
|
128
|
+
label="center"
|
|
129
|
+
onClick={() => setJustification('center')}
|
|
130
130
|
/>
|
|
131
131
|
<Button
|
|
132
|
-
label="end"
|
|
133
|
-
clickHandler={() => setJustification('end')}
|
|
134
132
|
color={justification === 'end' ? 'dark' : 'primary'}
|
|
133
|
+
label="end"
|
|
134
|
+
onClick={() => setJustification('end')}
|
|
135
135
|
/>
|
|
136
136
|
<Button
|
|
137
|
-
label="space-between"
|
|
138
|
-
clickHandler={() => setJustification('space-between')}
|
|
139
137
|
color={justification === 'space-between' ? 'dark' : 'primary'}
|
|
138
|
+
label="space-between"
|
|
139
|
+
onClick={() => setJustification('space-between')}
|
|
140
140
|
/>
|
|
141
141
|
</ButtonGroup>
|
|
142
142
|
</ToolbarItem>
|
|
@@ -207,16 +207,16 @@ toolbar groups, or on the entire toolbar.
|
|
|
207
207
|
<Toolbar>
|
|
208
208
|
<ToolbarItem>
|
|
209
209
|
<CheckboxField
|
|
210
|
-
label="Dense ToolbarGroup"
|
|
211
|
-
changeHandler={(e) => setIsGroupDense(e.target.checked)}
|
|
212
210
|
checked={isGroupDense}
|
|
211
|
+
label="Dense ToolbarGroup"
|
|
212
|
+
onChange={(e) => setIsGroupDense(e.target.checked)}
|
|
213
213
|
/>
|
|
214
214
|
</ToolbarItem>
|
|
215
215
|
<ToolbarItem>
|
|
216
216
|
<CheckboxField
|
|
217
|
-
label="Dense Toolbar"
|
|
218
|
-
changeHandler={(e) => setIsToolbarDense(e.target.checked)}
|
|
219
217
|
checked={isToolbarDense}
|
|
218
|
+
label="Dense Toolbar"
|
|
219
|
+
onChange={(e) => setIsToolbarDense(e.target.checked)}
|
|
220
220
|
/>
|
|
221
221
|
</ToolbarItem>
|
|
222
222
|
</Toolbar>
|
|
@@ -249,7 +249,7 @@ set the `nowrap` option on the Toolbar or on individual ToolbarGroups. Note that
|
|
|
249
249
|
ToolbarGroups can still wrap when the wrapping is disabled just on their parent
|
|
250
250
|
Toolbar.
|
|
251
251
|
|
|
252
|
-
Try resizing the playground below to see how it works.
|
|
252
|
+
📐 Try resizing the playground below to see how it works.
|
|
253
253
|
|
|
254
254
|
<Playground>
|
|
255
255
|
<>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/lib/index.js
CHANGED
|
@@ -1,60 +1,59 @@
|
|
|
1
|
-
//
|
|
2
|
-
export { default as
|
|
1
|
+
// Components
|
|
2
|
+
export { default as Alert } from './components/Alert';
|
|
3
|
+
export { default as Badge } from './components/Badge';
|
|
4
|
+
export { default as Button } from './components/Button';
|
|
5
|
+
export { ButtonGroup } from './components/ButtonGroup';
|
|
6
|
+
export {
|
|
7
|
+
Card,
|
|
8
|
+
CardBody,
|
|
9
|
+
CardFooter,
|
|
10
|
+
} from './components/Card';
|
|
11
|
+
export { default as Center } from './components/Center';
|
|
12
|
+
export { default as CheckboxField } from './components/CheckboxField';
|
|
3
13
|
export {
|
|
4
14
|
CTA,
|
|
5
15
|
CTACenter,
|
|
6
16
|
CTAEnd,
|
|
7
17
|
CTAStart,
|
|
8
|
-
} from './components/
|
|
18
|
+
} from './components/CTA';
|
|
19
|
+
export { default as FileInputField } from './components/FileInputField';
|
|
9
20
|
export {
|
|
10
21
|
FormLayout,
|
|
11
22
|
FormLayoutCustomField,
|
|
12
|
-
} from './components/
|
|
23
|
+
} from './components/FormLayout';
|
|
13
24
|
export {
|
|
14
25
|
Grid,
|
|
15
26
|
GridSpan,
|
|
16
|
-
} from './components/
|
|
27
|
+
} from './components/Grid';
|
|
28
|
+
export { default as Link } from './components/Link';
|
|
17
29
|
export {
|
|
18
30
|
List,
|
|
19
31
|
ListItem,
|
|
20
|
-
} from './components/
|
|
32
|
+
} from './components/List';
|
|
21
33
|
export {
|
|
22
34
|
Media,
|
|
23
35
|
MediaBody,
|
|
24
36
|
MediaObject,
|
|
25
|
-
} from './components/
|
|
37
|
+
} from './components/Media';
|
|
38
|
+
export { default as Modal } from './components/Modal';
|
|
39
|
+
export { default as Paper } from './components/Paper';
|
|
40
|
+
export { default as Radio } from './components/Radio';
|
|
41
|
+
export { default as ScrollView } from './components/ScrollView';
|
|
42
|
+
export { default as SelectField } from './components/SelectField';
|
|
43
|
+
export {
|
|
44
|
+
Tabs,
|
|
45
|
+
TabsItem,
|
|
46
|
+
} from './components/Tabs';
|
|
47
|
+
export { default as Table } from './components/Table';
|
|
48
|
+
export { default as Text } from './components/Text';
|
|
49
|
+
export { default as TextArea } from './components/TextArea';
|
|
50
|
+
export { default as TextField } from './components/TextField';
|
|
51
|
+
export { default as Toggle } from './components/Toggle';
|
|
26
52
|
export {
|
|
27
53
|
Toolbar,
|
|
28
54
|
ToolbarGroup,
|
|
29
55
|
ToolbarItem,
|
|
30
|
-
} from './components/
|
|
31
|
-
|
|
32
|
-
// UI components
|
|
33
|
-
export { default as Alert } from './components/ui/Alert';
|
|
34
|
-
export { default as Badge } from './components/ui/Badge';
|
|
35
|
-
export { default as Button } from './components/ui/Button';
|
|
36
|
-
export { default as ButtonGroup } from './components/ui/ButtonGroup';
|
|
37
|
-
export {
|
|
38
|
-
Card,
|
|
39
|
-
CardBody,
|
|
40
|
-
CardFooter,
|
|
41
|
-
} from './components/ui/Card';
|
|
42
|
-
export { default as CheckboxField } from './components/ui/CheckboxField';
|
|
43
|
-
export { default as FileInputField } from './components/ui/FileInputField';
|
|
44
|
-
export { default as Modal } from './components/ui/Modal';
|
|
45
|
-
export { default as Paper } from './components/ui/Paper';
|
|
46
|
-
export { default as Radio } from './components/ui/Radio';
|
|
47
|
-
export { default as ScrollView } from './components/ui/ScrollView';
|
|
48
|
-
export { default as SelectField } from './components/ui/SelectField';
|
|
49
|
-
export {
|
|
50
|
-
Tabs,
|
|
51
|
-
TabsItem,
|
|
52
|
-
} from './components/ui/Tabs';
|
|
53
|
-
export { default as Table } from './components/ui/Table';
|
|
54
|
-
export { default as Text } from './components/ui/Text';
|
|
55
|
-
export { default as TextArea } from './components/ui/TextArea';
|
|
56
|
-
export { default as TextField } from './components/ui/TextField';
|
|
57
|
-
export { default as Toggle } from './components/ui/Toggle';
|
|
56
|
+
} from './components/Toolbar';
|
|
58
57
|
|
|
59
58
|
// Provider
|
|
60
59
|
export { RUIProvider } from './provider';
|
|
@@ -17,6 +17,15 @@
|
|
|
17
17
|
border: 0;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
@mixin unhide-text() {
|
|
21
|
+
position: unset;
|
|
22
|
+
width: unset;
|
|
23
|
+
height: unset;
|
|
24
|
+
overflow: unset;
|
|
25
|
+
clip: unset;
|
|
26
|
+
white-space: unset;
|
|
27
|
+
}
|
|
28
|
+
|
|
20
29
|
// 2.
|
|
21
30
|
@mixin min-tap-target($size: theme.$tap-target-size, $center: true) {
|
|
22
31
|
position: relative;
|
package/src/lib/theme.scss
CHANGED
|
@@ -155,6 +155,11 @@
|
|
|
155
155
|
--rui-spacing-bottom-headings: var(--rui-spacing-5);
|
|
156
156
|
--rui-spacing-bottom-layouts: var(--rui-spacing-5);
|
|
157
157
|
|
|
158
|
+
// Disabled state
|
|
159
|
+
--rui-disabled-background-color: var(--rui-color-gray-50);
|
|
160
|
+
--rui-disabled-opacity: 0.5;
|
|
161
|
+
--rui-disabled-cursor: not-allowed;
|
|
162
|
+
|
|
158
163
|
//
|
|
159
164
|
// Elements
|
|
160
165
|
// ========
|
|
@@ -193,11 +198,11 @@
|
|
|
193
198
|
// Grid
|
|
194
199
|
// ====
|
|
195
200
|
|
|
196
|
-
--rui-Grid__auto-flow: initial;
|
|
197
201
|
--rui-Grid__columns: 1fr;
|
|
198
202
|
--rui-Grid__column-gap: var(--rui-spacing-4);
|
|
199
203
|
--rui-Grid__rows: auto;
|
|
200
204
|
--rui-Grid__row-gap: var(--rui-spacing-4);
|
|
205
|
+
--rui-Grid__auto-flow: initial;
|
|
201
206
|
--rui-Grid__align-content: initial;
|
|
202
207
|
--rui-Grid__align-items: initial;
|
|
203
208
|
--rui-Grid__justify-content: initial;
|
|
@@ -292,8 +297,10 @@
|
|
|
292
297
|
--rui-Button__text-transform: none;
|
|
293
298
|
--rui-Button__border-width: var(--rui-border-width);
|
|
294
299
|
--rui-Button__border-radius: var(--rui-border-radius);
|
|
295
|
-
--rui-Button--disabled__opacity:
|
|
296
|
-
--rui-Button--disabled__cursor:
|
|
300
|
+
--rui-Button--disabled__opacity: var(--rui-disabled-opacity);
|
|
301
|
+
--rui-Button--disabled__cursor: var(--rui-disabled-cursor);
|
|
302
|
+
--rui-Button--feedback__opacity: 1;
|
|
303
|
+
--rui-Button--feedback__cursor: var(--rui-disabled-cursor);
|
|
297
304
|
|
|
298
305
|
// Buttons: filled priority
|
|
299
306
|
|
|
@@ -674,8 +681,8 @@
|
|
|
674
681
|
--rui-Card__border-radius: var(--rui-border-radius);
|
|
675
682
|
--rui-Card--dense__padding: var(--rui-spacing-2);
|
|
676
683
|
--rui-Card--raised__box-shadow: var(--rui-elevation-1);
|
|
677
|
-
--rui-Card--disabled__background-color: var(--rui-
|
|
678
|
-
--rui-Card--disabled__opacity:
|
|
684
|
+
--rui-Card--disabled__background-color: var(--rui-disabled-background-color);
|
|
685
|
+
--rui-Card--disabled__opacity: var(--rui-disabled-opacity);
|
|
679
686
|
|
|
680
687
|
// Card: variant: primary
|
|
681
688
|
--rui-Card--primary__color: var(--rui-page-color);
|
|
@@ -758,8 +765,8 @@
|
|
|
758
765
|
--rui-FormField--horizontal--full-width__label__width: fit-content(50%);
|
|
759
766
|
|
|
760
767
|
// Forms fields: disabled state
|
|
761
|
-
--rui-FormField--disabled__cursor:
|
|
762
|
-
--rui-FormField--disabled__opacity:
|
|
768
|
+
--rui-FormField--disabled__cursor: var(--rui-disabled-cursor);
|
|
769
|
+
--rui-FormField--disabled__opacity: var(--rui-disabled-opacity);
|
|
763
770
|
|
|
764
771
|
// Form fields: validation states: invalid
|
|
765
772
|
--rui-FormField--invalid--default__border-color: var(--rui-color-danger);
|
|
@@ -851,6 +858,15 @@
|
|
|
851
858
|
--rui-FormField--check--checked__border-color: var(--rui-color-active);
|
|
852
859
|
--rui-FormField--check--checked__check-background-color: var(--rui-color-active);
|
|
853
860
|
|
|
861
|
+
//
|
|
862
|
+
// Link
|
|
863
|
+
// ====
|
|
864
|
+
|
|
865
|
+
--rui-Link__color: var(--rui-link-color);
|
|
866
|
+
--rui-Link__text-decoration: var(--rui-link-decoration);
|
|
867
|
+
--rui-Link--hover__color: var(--rui-link-hover-color);
|
|
868
|
+
--rui-Link--hover__text-decoration: var(--rui-link-hover-decoration);
|
|
869
|
+
|
|
854
870
|
//
|
|
855
871
|
// Modal
|
|
856
872
|
// =====
|
|
@@ -878,6 +894,8 @@
|
|
|
878
894
|
--rui-Paper__border-color: transparent;
|
|
879
895
|
--rui-Paper__border-radius: var(--rui-border-radius);
|
|
880
896
|
--rui-Paper__background-color: var(--rui-color-white);
|
|
897
|
+
--rui-Paper--muted__background-color: var(--rui-disabled-background-color);
|
|
898
|
+
--rui-Paper--muted__opacity: var(--rui-disabled-opacity);
|
|
881
899
|
--rui-Paper--raised__box-shadow: var(--rui-elevation-1);
|
|
882
900
|
|
|
883
901
|
//
|