orcs-design-system 3.2.4 → 3.2.6
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/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- package/package.json +29 -38
|
@@ -1,214 +1,200 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["name", "value", "label", "variant", "disabled", "checked", "onChange", "theme", "ariaLabel"];
|
|
5
1
|
import React from "react";
|
|
6
2
|
import PropTypes from "prop-types";
|
|
7
3
|
import styled, { ThemeProvider } from "styled-components";
|
|
8
4
|
import { space, layout, compose, variant } from "styled-system";
|
|
9
5
|
import { css } from "@styled-system/css";
|
|
10
6
|
import { themeGet } from "@styled-system/theme-get";
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const RadioButtonStyles = compose(space, layout);
|
|
9
|
+
const RadioButtonItem = styled("div").withConfig({
|
|
13
10
|
displayName: "RadioButton__RadioButtonItem",
|
|
14
11
|
componentId: "sc-d2jy6y-0"
|
|
15
|
-
})(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"default": {},
|
|
23
|
-
white: {
|
|
24
|
-
color: themeGet("colors.white")(props)
|
|
25
|
-
}
|
|
12
|
+
})(props => css({
|
|
13
|
+
color: themeGet("colors.greyDarkest")(props)
|
|
14
|
+
}), props => variant({
|
|
15
|
+
variants: {
|
|
16
|
+
default: {},
|
|
17
|
+
white: {
|
|
18
|
+
color: themeGet("colors.white")(props)
|
|
26
19
|
}
|
|
27
|
-
}
|
|
28
|
-
}, RadioButtonStyles);
|
|
29
|
-
|
|
20
|
+
}
|
|
21
|
+
}), RadioButtonStyles);
|
|
22
|
+
const RadioButtonLabel = styled("label").withConfig({
|
|
30
23
|
displayName: "RadioButton__RadioButtonLabel",
|
|
31
24
|
componentId: "sc-d2jy6y-1"
|
|
32
|
-
})(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
var RadioButtonControl = styled.input.attrs({
|
|
25
|
+
})(props => css({
|
|
26
|
+
display: "flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
cursor: props.disabled ? "default" : "pointer",
|
|
29
|
+
opacity: props.disabled ? "0.5" : "1"
|
|
30
|
+
}));
|
|
31
|
+
const RadioButtonControl = styled.input.attrs({
|
|
41
32
|
type: "radio"
|
|
42
33
|
}).withConfig({
|
|
43
34
|
displayName: "RadioButton__RadioButtonControl",
|
|
44
35
|
componentId: "sc-d2jy6y-2"
|
|
45
|
-
})(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
})(props => css({
|
|
37
|
+
opacity: "0",
|
|
38
|
+
position: "absolute",
|
|
39
|
+
margin: "0",
|
|
40
|
+
zIndex: "-1",
|
|
41
|
+
width: "0",
|
|
42
|
+
height: "0",
|
|
43
|
+
overflow: "hidden",
|
|
44
|
+
pointerEvents: "none",
|
|
45
|
+
"+ div > div": {
|
|
46
|
+
transform: "scale(0)"
|
|
47
|
+
},
|
|
48
|
+
"&:checked + div > div": {
|
|
49
|
+
transform: "scale(1)"
|
|
50
|
+
},
|
|
51
|
+
"&:focus + div": {
|
|
52
|
+
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.black30")(props)
|
|
53
|
+
}
|
|
54
|
+
}), props => variant({
|
|
55
|
+
variants: {
|
|
56
|
+
default: {},
|
|
57
|
+
white: {
|
|
58
|
+
"&:focus + div": {
|
|
59
|
+
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.white30")(props)
|
|
60
|
+
}
|
|
57
61
|
},
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
primary: {
|
|
63
|
+
"&:focus + div": {
|
|
64
|
+
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.primary30")(props)
|
|
65
|
+
}
|
|
60
66
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
primary: {
|
|
75
|
-
"&:focus + div": {
|
|
76
|
-
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.primary30")(props)
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
success: {
|
|
80
|
-
"&:focus + div": {
|
|
81
|
-
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.success30")(props)
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
warning: {
|
|
85
|
-
"&:focus + div": {
|
|
86
|
-
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.warning30")(props)
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
danger: {
|
|
90
|
-
"&:focus + div": {
|
|
91
|
-
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.danger30")(props)
|
|
92
|
-
}
|
|
67
|
+
success: {
|
|
68
|
+
"&:focus + div": {
|
|
69
|
+
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.success30")(props)
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
warning: {
|
|
73
|
+
"&:focus + div": {
|
|
74
|
+
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.warning30")(props)
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
danger: {
|
|
78
|
+
"&:focus + div": {
|
|
79
|
+
boxShadow: themeGet("shadows.thickOutline")(props) + " " + themeGet("colors.danger30")(props)
|
|
93
80
|
}
|
|
94
81
|
}
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
82
|
+
}
|
|
83
|
+
}));
|
|
84
|
+
const RadioButtonCircle = styled("div").withConfig({
|
|
98
85
|
displayName: "RadioButton__RadioButtonCircle",
|
|
99
86
|
componentId: "sc-d2jy6y-3"
|
|
100
|
-
})(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
danger: {
|
|
130
|
-
borderColor: themeGet("colors.danger")(props)
|
|
131
|
-
}
|
|
87
|
+
})(props => css({
|
|
88
|
+
position: "relative",
|
|
89
|
+
display: "flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
justifyContent: "center",
|
|
92
|
+
width: "20px",
|
|
93
|
+
height: "20px",
|
|
94
|
+
borderRadius: "10px",
|
|
95
|
+
border: "solid 2px",
|
|
96
|
+
borderColor: themeGet("colors.greyDarker")(props),
|
|
97
|
+
transition: themeGet("transition.transitionDefault")(props)
|
|
98
|
+
}), props => variant({
|
|
99
|
+
variants: {
|
|
100
|
+
default: {},
|
|
101
|
+
white: {
|
|
102
|
+
borderColor: themeGet("colors.white")(props)
|
|
103
|
+
},
|
|
104
|
+
primary: {
|
|
105
|
+
borderColor: themeGet("colors.primary")(props)
|
|
106
|
+
},
|
|
107
|
+
success: {
|
|
108
|
+
borderColor: themeGet("colors.success")(props)
|
|
109
|
+
},
|
|
110
|
+
warning: {
|
|
111
|
+
borderColor: themeGet("colors.warning")(props)
|
|
112
|
+
},
|
|
113
|
+
danger: {
|
|
114
|
+
borderColor: themeGet("colors.danger")(props)
|
|
132
115
|
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
const RadioButtonDot = styled("div").withConfig({
|
|
136
119
|
displayName: "RadioButton__RadioButtonDot",
|
|
137
120
|
componentId: "sc-d2jy6y-4"
|
|
138
|
-
})(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
danger: {
|
|
166
|
-
backgroundColor: themeGet("colors.danger")(props)
|
|
167
|
-
}
|
|
121
|
+
})(props => css({
|
|
122
|
+
position: "absolute",
|
|
123
|
+
display: "block",
|
|
124
|
+
width: "10px",
|
|
125
|
+
height: "10px",
|
|
126
|
+
borderRadius: "8px",
|
|
127
|
+
transform: "scale(0)",
|
|
128
|
+
backgroundColor: themeGet("colors.greyDarker")(props),
|
|
129
|
+
transition: themeGet("transition.transitionDefault")(props)
|
|
130
|
+
}), props => variant({
|
|
131
|
+
variants: {
|
|
132
|
+
default: {},
|
|
133
|
+
white: {
|
|
134
|
+
backgroundColor: themeGet("colors.white")(props)
|
|
135
|
+
},
|
|
136
|
+
primary: {
|
|
137
|
+
backgroundColor: themeGet("colors.primary")(props)
|
|
138
|
+
},
|
|
139
|
+
success: {
|
|
140
|
+
backgroundColor: themeGet("colors.success")(props)
|
|
141
|
+
},
|
|
142
|
+
warning: {
|
|
143
|
+
backgroundColor: themeGet("colors.warning")(props)
|
|
144
|
+
},
|
|
145
|
+
danger: {
|
|
146
|
+
backgroundColor: themeGet("colors.danger")(props)
|
|
168
147
|
}
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
const RadioButtonText = styled("div").withConfig({
|
|
172
151
|
displayName: "RadioButton__RadioButtonText",
|
|
173
152
|
componentId: "sc-d2jy6y-5"
|
|
174
|
-
})(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
});
|
|
153
|
+
})(props => css({
|
|
154
|
+
paddingLeft: "s",
|
|
155
|
+
fontSize: themeGet("fontSizes.2")(props),
|
|
156
|
+
fontWeight: themeGet("fontWeights.1")(props)
|
|
157
|
+
}));
|
|
181
158
|
export default function RadioButton(_ref) {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
disabled: disabled
|
|
196
|
-
}, /*#__PURE__*/React.createElement(RadioButtonControl, {
|
|
197
|
-
name: name,
|
|
159
|
+
let {
|
|
160
|
+
name,
|
|
161
|
+
value,
|
|
162
|
+
label,
|
|
163
|
+
variant,
|
|
164
|
+
disabled,
|
|
165
|
+
checked,
|
|
166
|
+
onChange,
|
|
167
|
+
theme,
|
|
168
|
+
ariaLabel,
|
|
169
|
+
...props
|
|
170
|
+
} = _ref;
|
|
171
|
+
const component = /*#__PURE__*/_jsx(RadioButtonItem, {
|
|
198
172
|
variant: variant,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
173
|
+
...props,
|
|
174
|
+
children: /*#__PURE__*/_jsxs(RadioButtonLabel, {
|
|
175
|
+
disabled: disabled,
|
|
176
|
+
children: [/*#__PURE__*/_jsx(RadioButtonControl, {
|
|
177
|
+
name: name,
|
|
178
|
+
variant: variant,
|
|
179
|
+
value: value,
|
|
180
|
+
disabled: disabled,
|
|
181
|
+
checked: checked,
|
|
182
|
+
onChange: onChange,
|
|
183
|
+
"aria-label": ariaLabel
|
|
184
|
+
}), /*#__PURE__*/_jsx(RadioButtonCircle, {
|
|
185
|
+
variant: variant,
|
|
186
|
+
children: /*#__PURE__*/_jsx(RadioButtonDot, {
|
|
187
|
+
variant: variant
|
|
188
|
+
})
|
|
189
|
+
}), /*#__PURE__*/_jsx(RadioButtonText, {
|
|
190
|
+
children: label
|
|
191
|
+
})]
|
|
192
|
+
})
|
|
193
|
+
});
|
|
194
|
+
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
195
|
+
theme: theme,
|
|
196
|
+
children: component
|
|
197
|
+
}) : component;
|
|
212
198
|
}
|
|
213
199
|
RadioButton.propTypes = {
|
|
214
200
|
/** Sets a name to define the radio button group */
|
|
@@ -218,12 +204,12 @@ RadioButton.propTypes = {
|
|
|
218
204
|
/** Sets the label of the radio button */
|
|
219
205
|
label: PropTypes.string,
|
|
220
206
|
// ariaLabel prop must be specified if label is not provided
|
|
221
|
-
ariaLabel:
|
|
207
|
+
ariaLabel: (props, propName) => {
|
|
222
208
|
if (!props.label && (props[propName] == null || props[propName] === "")) {
|
|
223
209
|
return new Error("Missing prop `".concat(propName, "` not specified for Radio component. When `label` is not provided, `").concat(propName, "` is required."));
|
|
224
210
|
}
|
|
225
211
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
226
|
-
return new Error("Invalid propType `".concat(propName, "` supplied to Radio component. Expected `string`, received `").concat(
|
|
212
|
+
return new Error("Invalid propType `".concat(propName, "` supplied to Radio component. Expected `string`, received `").concat(typeof props[propName], "`."));
|
|
227
213
|
}
|
|
228
214
|
return null;
|
|
229
215
|
},
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Range from ".";
|
|
3
3
|
import Box from "../Box";
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
5
|
export default {
|
|
5
6
|
title: "Components/Range",
|
|
6
7
|
component: Range
|
|
7
8
|
};
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
};
|
|
9
|
+
export const defaultRange = () => /*#__PURE__*/_jsx(Range, {
|
|
10
|
+
min: 0,
|
|
11
|
+
max: 20,
|
|
12
|
+
defaultValue: 10,
|
|
13
|
+
ariaLabel: "Default range slider"
|
|
14
|
+
});
|
|
16
15
|
defaultRange.storyName = "Default";
|
|
17
|
-
export
|
|
18
|
-
|
|
16
|
+
export const inverted = () => /*#__PURE__*/_jsx(_Fragment, {
|
|
17
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
19
18
|
bg: "greyDarker",
|
|
20
|
-
p: "r"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
19
|
+
p: "r",
|
|
20
|
+
children: /*#__PURE__*/_jsx(Range, {
|
|
21
|
+
min: 0,
|
|
22
|
+
max: 20,
|
|
23
|
+
defaultValue: 10,
|
|
24
|
+
ariaLabel: "Inverted range slider",
|
|
25
|
+
inverted: true
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
29
|
defaultRange.__docgenInfo = {
|
|
30
30
|
"description": "",
|
|
31
31
|
"methods": [],
|
|
@@ -1,70 +1,60 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["min", "max", "inverted", "defaultValue", "theme", "ariaLabel"];
|
|
4
1
|
import React from "react";
|
|
5
2
|
import PropTypes from "prop-types";
|
|
6
3
|
import styled, { css, ThemeProvider } from "styled-components";
|
|
7
4
|
import { space, layout } from "styled-system";
|
|
8
5
|
import { themeGet } from "@styled-system/theme-get";
|
|
9
|
-
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const vars = {
|
|
10
8
|
trackHeight: "4px",
|
|
11
9
|
thumbDiameter: "20px"
|
|
12
10
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var track = function track(props) {
|
|
17
|
-
return "\n box-sizing: border-box;\n border: none;\n width: 100%;\n height: ".concat(vars.trackHeight, ";\n\t background: ").concat(themeGet("colors.greyLight")(props), ";\n border-radius: 4px;\n");
|
|
18
|
-
};
|
|
19
|
-
var Wrapper = styled.div.withConfig({
|
|
11
|
+
const thumb = props => "\n margin-top: -8px;\n box-sizing: border-box;\n border: none;\n width: ".concat(vars.thumbDiameter, ";\n height: ").concat(vars.thumbDiameter, ";\n border-radius: ").concat(vars.thumbDiameter, ";\n background: ").concat(themeGet("colors.primary")(props), ";\n");
|
|
12
|
+
const track = props => "\n box-sizing: border-box;\n border: none;\n width: 100%;\n height: ".concat(vars.trackHeight, ";\n\t background: ").concat(themeGet("colors.greyLight")(props), ";\n border-radius: 4px;\n");
|
|
13
|
+
const Wrapper = styled.div.withConfig({
|
|
20
14
|
displayName: "Range__Wrapper",
|
|
21
15
|
componentId: "sc-zb0zps-0"
|
|
22
|
-
})(["", " ", " position:relative;width:100%;display:flex;flex-wrap:wrap;align-items:center;&:before{content:\"", "\";font-size:10px;font-weight:bold;}&:after{content:\"", "\";font-size:10px;font-weight:bold;}", ""], space, layout,
|
|
23
|
-
|
|
24
|
-
}, function (props) {
|
|
25
|
-
return props.maxValue;
|
|
26
|
-
}, function (props) {
|
|
27
|
-
return props.inverted ? css(["&:before,&:after{color:", ";}input{&:focus{background:rgba(255,255,255,0.1);}&::-webkit-slider-runnable-track{background:", ";}&::-moz-range-track{background:", ";}&::-ms-track{background:", ";}}output{color:", ";}"], themeGet("colors.white")(props), themeGet("colors.greyDark")(props), themeGet("colors.greyDark")(props), themeGet("colors.greyDark")(props), themeGet("colors.white")(props)) : css([""]);
|
|
28
|
-
});
|
|
29
|
-
var Input = styled.input.attrs({
|
|
16
|
+
})(["", " ", " position:relative;width:100%;display:flex;flex-wrap:wrap;align-items:center;&:before{content:\"", "\";font-size:10px;font-weight:bold;}&:after{content:\"", "\";font-size:10px;font-weight:bold;}", ""], space, layout, props => props.minValue, props => props.maxValue, props => props.inverted ? css(["&:before,&:after{color:", ";}input{&:focus{background:rgba(255,255,255,0.1);}&::-webkit-slider-runnable-track{background:", ";}&::-moz-range-track{background:", ";}&::-ms-track{background:", ";}}output{color:", ";}"], themeGet("colors.white")(props), themeGet("colors.greyDark")(props), themeGet("colors.greyDark")(props), themeGet("colors.greyDark")(props), themeGet("colors.white")(props)) : css([""]));
|
|
17
|
+
const Input = styled.input.attrs({
|
|
30
18
|
type: "range"
|
|
31
19
|
}).withConfig({
|
|
32
20
|
displayName: "Range__Input",
|
|
33
21
|
componentId: "sc-zb0zps-1"
|
|
34
|
-
})(["flex:1;margin:0;padding:0;width:100%;min-height:", ";background:transparent;cursor:ew-resize;padding:10px 10px;border-radius:25px;transition:", ";&:focus{outline:none;background:rgba(0,0,0,0.05);}&,&::-webkit-slider-thumb{-moz-appearance:none;-webkit-appearance:none;appearance:none;}&::-webkit-slider-runnable-track{", ";}&::-moz-range-track{", ";}&::-ms-track{", ";}&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}&::-ms-thumb{", ";}&::-ms-tooltip{display:none;}"], vars.thumbDiameter,
|
|
35
|
-
|
|
36
|
-
}, track, track, track, thumb, thumb, thumb);
|
|
37
|
-
var Output = styled.output.withConfig({
|
|
22
|
+
})(["flex:1;margin:0;padding:0;width:100%;min-height:", ";background:transparent;cursor:ew-resize;padding:10px 10px;border-radius:25px;transition:", ";&:focus{outline:none;background:rgba(0,0,0,0.05);}&,&::-webkit-slider-thumb{-moz-appearance:none;-webkit-appearance:none;appearance:none;}&::-webkit-slider-runnable-track{", ";}&::-moz-range-track{", ";}&::-ms-track{", ";}&::-webkit-slider-thumb{", ";}&::-moz-range-thumb{", ";}&::-ms-thumb{", ";}&::-ms-tooltip{display:none;}"], vars.thumbDiameter, props => themeGet("transition.transitionDefault")(props), track, track, track, thumb, thumb, thumb);
|
|
23
|
+
const Output = styled.output.withConfig({
|
|
38
24
|
displayName: "Range__Output",
|
|
39
25
|
componentId: "sc-zb0zps-2"
|
|
40
|
-
})(["display:block;user-select:none;font-weight:bold;text-align:center;font-size:14px;pointer-events:none;text-align:center;flex:1 1 100%;order:4;color:", ";"],
|
|
41
|
-
return themeGet("colors.greyDarker")(props);
|
|
42
|
-
});
|
|
26
|
+
})(["display:block;user-select:none;font-weight:bold;text-align:center;font-size:14px;pointer-events:none;text-align:center;flex:1 1 100%;order:4;color:", ";"], props => themeGet("colors.greyDarker")(props));
|
|
43
27
|
/**
|
|
44
28
|
* Range component is pretty self explanatory, used to select a number out of a range, make sure to set a min, max and default value.
|
|
45
29
|
*/
|
|
46
30
|
export default function Range(_ref) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
31
|
+
let {
|
|
32
|
+
min,
|
|
33
|
+
max,
|
|
34
|
+
inverted,
|
|
35
|
+
defaultValue,
|
|
36
|
+
theme,
|
|
37
|
+
ariaLabel,
|
|
38
|
+
...props
|
|
39
|
+
} = _ref;
|
|
40
|
+
const component = /*#__PURE__*/_jsxs(Wrapper, {
|
|
55
41
|
minValue: min,
|
|
56
42
|
maxValue: max,
|
|
57
|
-
inverted: inverted
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
43
|
+
inverted: inverted,
|
|
44
|
+
children: [/*#__PURE__*/_jsx(Input, {
|
|
45
|
+
min: min,
|
|
46
|
+
max: max,
|
|
47
|
+
"aria-label": ariaLabel,
|
|
48
|
+
...props
|
|
49
|
+
}), /*#__PURE__*/_jsx(Output, {
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
children: defaultValue
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
55
|
+
theme: theme,
|
|
56
|
+
children: component
|
|
57
|
+
}) : component;
|
|
68
58
|
}
|
|
69
59
|
Range.propTypes = {
|
|
70
60
|
/** Sets the minimum value for the range */
|