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,8 +1,3 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
1
|
import React, { forwardRef } from "react";
|
|
7
2
|
import PropTypes from "prop-types";
|
|
8
3
|
import styled, { ThemeProvider, useTheme } from "styled-components";
|
|
@@ -15,53 +10,52 @@ import shouldForwardProp from "@styled-system/should-forward-prop";
|
|
|
15
10
|
import { themeGet } from "@styled-system/theme-get";
|
|
16
11
|
import { Small } from "../Typography";
|
|
17
12
|
import useInputFocus from "../../hooks/useInputFocus";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const SelectStyles = compose(space, layout);
|
|
15
|
+
const Wrapper = styled("div").withConfig({
|
|
16
|
+
shouldForwardProp,
|
|
21
17
|
displayName: "Select__Wrapper",
|
|
22
18
|
componentId: "sc-bfi43f-0"
|
|
23
|
-
}).attrs(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
})(css({
|
|
19
|
+
}).attrs(props => ({
|
|
20
|
+
"data-testid": props["data-testid"] ? props["data-testid"] : null
|
|
21
|
+
}))(css({
|
|
28
22
|
display: "inline-block",
|
|
29
23
|
width: "100%"
|
|
30
24
|
}), SelectStyles);
|
|
31
|
-
|
|
32
|
-
shouldForwardProp
|
|
25
|
+
const Label = styled("label").withConfig({
|
|
26
|
+
shouldForwardProp,
|
|
33
27
|
displayName: "Select__Label",
|
|
34
28
|
componentId: "sc-bfi43f-1"
|
|
35
|
-
}).attrs(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
29
|
+
}).attrs(props => ({
|
|
30
|
+
for: props.id
|
|
31
|
+
}))(props => css({
|
|
32
|
+
display: "block",
|
|
33
|
+
color: props.inverted ? themeGet("colors.white")(props) : props.invalid ? themeGet("colors.dangerDark")(props) : themeGet("colors.greyDarkest")(props),
|
|
34
|
+
fontSize: themeGet("fontSizes.1")(props),
|
|
35
|
+
fontWeight: props.bold ? themeGet("fontWeights.2")(props) : themeGet("fontWeights.1")(props),
|
|
36
|
+
mb: "xs"
|
|
37
|
+
}));
|
|
38
|
+
const MultiValueRemove = props => {
|
|
39
|
+
const {
|
|
40
|
+
innerProps,
|
|
41
|
+
data
|
|
42
|
+
} = props;
|
|
43
|
+
return /*#__PURE__*/_jsx(components.MultiValueRemove, {
|
|
44
|
+
...props,
|
|
45
|
+
innerProps: {
|
|
46
|
+
...innerProps,
|
|
53
47
|
"aria-label": "Remove ".concat(data.label)
|
|
54
|
-
}
|
|
55
|
-
})
|
|
48
|
+
}
|
|
49
|
+
});
|
|
56
50
|
};
|
|
57
51
|
MultiValueRemove.propTypes = {
|
|
58
52
|
data: PropTypes.object,
|
|
59
53
|
innerProps: PropTypes.object
|
|
60
54
|
};
|
|
61
|
-
|
|
55
|
+
const SELECT_TYPES = {
|
|
62
56
|
creatable: CreatableSelect,
|
|
63
57
|
async: AsyncSelect,
|
|
64
|
-
|
|
58
|
+
default: ReactSelect
|
|
65
59
|
};
|
|
66
60
|
|
|
67
61
|
/**
|
|
@@ -80,326 +74,320 @@ var SELECT_TYPES = {
|
|
|
80
74
|
* For a full list of the changes, see <https://react-select.com/upgrade-guide>.
|
|
81
75
|
*
|
|
82
76
|
*/
|
|
83
|
-
|
|
77
|
+
const Select = /*#__PURE__*/forwardRef((props, ref) => {
|
|
84
78
|
var _SELECT_TYPES$props$s;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
updateStyles =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
79
|
+
const theme = useTheme();
|
|
80
|
+
const inputRef = useInputFocus(ref, props.focus);
|
|
81
|
+
const {
|
|
82
|
+
updateStyles = s => s
|
|
83
|
+
} = props;
|
|
84
|
+
const customStyles = updateStyles({
|
|
85
|
+
menu: (provided, state) => ({
|
|
86
|
+
...provided,
|
|
87
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
88
|
+
backgroundColor: props.inverted ? themeGet("colors.greyDarker")({
|
|
89
|
+
theme
|
|
90
|
+
}) : themeGet("colors.white")({
|
|
91
|
+
theme
|
|
92
|
+
}),
|
|
93
|
+
color: props.inverted ? themeGet("colors.greyLighter") : themeGet("colors.greyDarkest")({
|
|
94
|
+
theme
|
|
95
|
+
}),
|
|
96
|
+
fontSize: themeGet("fontSizes.1")({
|
|
97
|
+
theme
|
|
98
|
+
}),
|
|
99
|
+
border: props.inverted ? themeGet("borderWidths.1")({
|
|
100
|
+
theme
|
|
101
|
+
}) + " solid " + themeGet("colors.primaryLight")({
|
|
102
|
+
theme
|
|
103
|
+
}) : themeGet("borderWidths.1")({
|
|
104
|
+
theme
|
|
105
|
+
}) + " solid " + themeGet("colors.primary")({
|
|
106
|
+
theme
|
|
107
|
+
}),
|
|
108
|
+
borderRadius: themeGet("radii.2")({
|
|
109
|
+
theme
|
|
110
|
+
}),
|
|
111
|
+
marginBottom: "0",
|
|
112
|
+
marginTop: themeGet("space.xs")({
|
|
113
|
+
theme
|
|
114
|
+
}),
|
|
115
|
+
overflow: "hidden",
|
|
116
|
+
zIndex: 12
|
|
117
|
+
}),
|
|
118
|
+
menuList: provided => ({
|
|
119
|
+
...provided,
|
|
120
|
+
paddingTop: "0",
|
|
121
|
+
overflow: "auto",
|
|
122
|
+
color: props.inverted ? themeGet("colors.greyLightest")({
|
|
123
|
+
theme
|
|
124
|
+
}) : themeGet("colors.greyDarkest")({
|
|
125
|
+
theme
|
|
126
|
+
})
|
|
127
|
+
}),
|
|
128
|
+
control: (provided, state) => ({
|
|
129
|
+
...provided,
|
|
130
|
+
minHeight: props.height ? props.height : themeGet("appScale.inputHeightDefault")({
|
|
131
|
+
theme
|
|
132
|
+
}),
|
|
133
|
+
boxShadow: "none",
|
|
134
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
135
|
+
"&:hover": {
|
|
136
|
+
borderColor: props.invalid ? themeGet("colors.danger")({
|
|
137
|
+
theme
|
|
138
|
+
}) : themeGet("colors.primary")({
|
|
139
|
+
theme
|
|
134
140
|
})
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
boxShadow: "none",
|
|
143
|
-
opacity: state.isDisabled ? 0.7 : 1,
|
|
144
|
-
"&:hover": {
|
|
145
|
-
borderColor: props.invalid ? themeGet("colors.danger")({
|
|
146
|
-
theme: theme
|
|
147
|
-
}) : themeGet("colors.primary")({
|
|
148
|
-
theme: theme
|
|
149
|
-
})
|
|
150
|
-
},
|
|
151
|
-
"&:focus-within": {
|
|
152
|
-
outline: "0",
|
|
153
|
-
borderColor: props.invalid ? themeGet("colors.danger")({
|
|
154
|
-
theme: theme
|
|
155
|
-
}) : themeGet("colors.primary")({
|
|
156
|
-
theme: theme
|
|
157
|
-
}),
|
|
158
|
-
boxShadow: props.invalid ? themeGet("shadows.thickOutline")({
|
|
159
|
-
theme: theme
|
|
160
|
-
}) + " " + themeGet("colors.danger30")({
|
|
161
|
-
theme: theme
|
|
162
|
-
}) : themeGet("shadows.thickOutline")({
|
|
163
|
-
theme: theme
|
|
164
|
-
}) + " " + themeGet("colors.primary30")({
|
|
165
|
-
theme: theme
|
|
166
|
-
})
|
|
167
|
-
},
|
|
168
|
-
borderColor: state.isFocused ? themeGet("colors.primary")({
|
|
169
|
-
theme: theme
|
|
170
|
-
}) : props.inverted ? themeGet("colors.white30")({
|
|
171
|
-
theme: theme
|
|
172
|
-
}) : themeGet("colors.black30")({
|
|
173
|
-
theme: theme
|
|
174
|
-
}),
|
|
175
|
-
backgroundColor: props.inverted ? themeGet("colors.greyDarker")({
|
|
176
|
-
theme: theme
|
|
177
|
-
}) : themeGet("colors.white")({
|
|
178
|
-
theme: theme
|
|
179
|
-
}),
|
|
180
|
-
color: props.inverted ? themeGet("colors.greyLighter")({
|
|
181
|
-
theme: theme
|
|
182
|
-
}) : themeGet("colors.greyDarkest")({
|
|
183
|
-
theme: theme
|
|
184
|
-
}),
|
|
185
|
-
borderRadius: themeGet("radii.2")({
|
|
186
|
-
theme: theme
|
|
187
|
-
}),
|
|
188
|
-
fontSize: themeGet("fontSizes.1")({
|
|
189
|
-
theme: theme
|
|
190
|
-
}),
|
|
191
|
-
overflow: "hidden",
|
|
192
|
-
border: "1px solid ".concat(props.invalid ? themeGet("colors.danger")({
|
|
193
|
-
theme: theme
|
|
194
|
-
}) : themeGet("colors.black30")({
|
|
195
|
-
theme: theme
|
|
196
|
-
}))
|
|
197
|
-
});
|
|
198
|
-
},
|
|
199
|
-
container: function container(provided, state) {
|
|
200
|
-
return _objectSpread(_objectSpread({}, provided), {}, {
|
|
201
|
-
opacity: state.isDisabled ? 0.7 : 1,
|
|
202
|
-
color: props.inverted ? themeGet("colors.greyLighter")({
|
|
203
|
-
theme: theme
|
|
204
|
-
}) : themeGet("colors.grey")({
|
|
205
|
-
theme: theme
|
|
141
|
+
},
|
|
142
|
+
"&:focus-within": {
|
|
143
|
+
outline: "0",
|
|
144
|
+
borderColor: props.invalid ? themeGet("colors.danger")({
|
|
145
|
+
theme
|
|
146
|
+
}) : themeGet("colors.primary")({
|
|
147
|
+
theme
|
|
206
148
|
}),
|
|
207
|
-
|
|
208
|
-
theme
|
|
149
|
+
boxShadow: props.invalid ? themeGet("shadows.thickOutline")({
|
|
150
|
+
theme
|
|
151
|
+
}) + " " + themeGet("colors.danger30")({
|
|
152
|
+
theme
|
|
153
|
+
}) : themeGet("shadows.thickOutline")({
|
|
154
|
+
theme
|
|
155
|
+
}) + " " + themeGet("colors.primary30")({
|
|
156
|
+
theme
|
|
209
157
|
})
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
color: themeGet("colors.
|
|
275
|
-
theme
|
|
158
|
+
},
|
|
159
|
+
borderColor: state.isFocused ? themeGet("colors.primary")({
|
|
160
|
+
theme
|
|
161
|
+
}) : props.inverted ? themeGet("colors.white30")({
|
|
162
|
+
theme
|
|
163
|
+
}) : themeGet("colors.black30")({
|
|
164
|
+
theme
|
|
165
|
+
}),
|
|
166
|
+
backgroundColor: props.inverted ? themeGet("colors.greyDarker")({
|
|
167
|
+
theme
|
|
168
|
+
}) : themeGet("colors.white")({
|
|
169
|
+
theme
|
|
170
|
+
}),
|
|
171
|
+
color: props.inverted ? themeGet("colors.greyLighter")({
|
|
172
|
+
theme
|
|
173
|
+
}) : themeGet("colors.greyDarkest")({
|
|
174
|
+
theme
|
|
175
|
+
}),
|
|
176
|
+
borderRadius: themeGet("radii.2")({
|
|
177
|
+
theme
|
|
178
|
+
}),
|
|
179
|
+
fontSize: themeGet("fontSizes.1")({
|
|
180
|
+
theme
|
|
181
|
+
}),
|
|
182
|
+
overflow: "hidden",
|
|
183
|
+
border: "1px solid ".concat(props.invalid ? themeGet("colors.danger")({
|
|
184
|
+
theme
|
|
185
|
+
}) : themeGet("colors.black30")({
|
|
186
|
+
theme
|
|
187
|
+
}))
|
|
188
|
+
}),
|
|
189
|
+
container: (provided, state) => ({
|
|
190
|
+
...provided,
|
|
191
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
192
|
+
color: props.inverted ? themeGet("colors.greyLighter")({
|
|
193
|
+
theme
|
|
194
|
+
}) : themeGet("colors.grey")({
|
|
195
|
+
theme
|
|
196
|
+
}),
|
|
197
|
+
fontSize: themeGet("fontSizes.1")({
|
|
198
|
+
theme
|
|
199
|
+
})
|
|
200
|
+
}),
|
|
201
|
+
valueContainer: provided => ({
|
|
202
|
+
...provided,
|
|
203
|
+
padding: props.padding ? props.padding : "2px 4px",
|
|
204
|
+
overflow: "visible"
|
|
205
|
+
}),
|
|
206
|
+
clearIndicator: (provided, state) => ({
|
|
207
|
+
...provided,
|
|
208
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
209
|
+
padding: themeGet("space.xxs")({
|
|
210
|
+
theme
|
|
211
|
+
}),
|
|
212
|
+
color: !state.isFocused && !props.inverted ? themeGet("colors.greyDark")({
|
|
213
|
+
theme
|
|
214
|
+
}) : state.isFocused && !props.inverted ? themeGet("colors.primary")({
|
|
215
|
+
theme
|
|
216
|
+
}) : !state.isFocused && props.inverted ? themeGet("colors.white")({
|
|
217
|
+
theme
|
|
218
|
+
}) : themeGet("colors.primaryLight")({
|
|
219
|
+
theme
|
|
220
|
+
}),
|
|
221
|
+
"&:hover": {
|
|
222
|
+
color: themeGet("colors.danger")({
|
|
223
|
+
theme
|
|
276
224
|
})
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
theme
|
|
301
|
-
})
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
225
|
+
}
|
|
226
|
+
}),
|
|
227
|
+
dropdownIndicator: (provided, state) => ({
|
|
228
|
+
...provided,
|
|
229
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
230
|
+
padding: themeGet("space.xxs")({
|
|
231
|
+
theme
|
|
232
|
+
}),
|
|
233
|
+
color: !state.isFocused && !props.inverted ? themeGet("colors.greyDark")({
|
|
234
|
+
theme
|
|
235
|
+
}) : state.isFocused && !props.inverted ? themeGet("colors.primary")({
|
|
236
|
+
theme
|
|
237
|
+
}) : !state.isFocused && props.inverted ? themeGet("colors.white")({
|
|
238
|
+
theme
|
|
239
|
+
}) : themeGet("colors.primaryLight")({
|
|
240
|
+
theme
|
|
241
|
+
}),
|
|
242
|
+
"&:hover": {
|
|
243
|
+
color: !state.isFocused && !props.inverted ? themeGet("colors.primary")({
|
|
244
|
+
theme
|
|
245
|
+
}) : state.isFocused && !props.inverted ? themeGet("colors.primaryDarkest")({
|
|
246
|
+
theme
|
|
247
|
+
}) : !state.isFocused && props.inverted ? themeGet("colors.primary")({
|
|
248
|
+
theme
|
|
249
|
+
}) : themeGet("colors.white")({
|
|
250
|
+
theme
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
}),
|
|
254
|
+
groupHeading: provided => ({
|
|
255
|
+
...provided,
|
|
256
|
+
textTransform: "none",
|
|
257
|
+
fontSize: themeGet("fontSizes.0")({
|
|
258
|
+
theme
|
|
259
|
+
}),
|
|
260
|
+
color: themeGet("colors.greyDark")({
|
|
261
|
+
theme
|
|
262
|
+
})
|
|
263
|
+
}),
|
|
264
|
+
multiValue: (provided, state) => ({
|
|
265
|
+
...provided,
|
|
266
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
267
|
+
backgroundColor: "transparent",
|
|
268
|
+
color: themeGet("colors.white")({
|
|
269
|
+
theme
|
|
270
|
+
}),
|
|
271
|
+
alignItems: "center",
|
|
272
|
+
padding: "0 !important",
|
|
273
|
+
fontSize: themeGet("fontSizes.1")({
|
|
274
|
+
theme
|
|
275
|
+
}),
|
|
276
|
+
wordWrap: "break-word"
|
|
277
|
+
}),
|
|
278
|
+
multiValueLabel: (provided, state) => ({
|
|
279
|
+
...provided,
|
|
280
|
+
backgroundColor: themeGet("colors.primary")({
|
|
281
|
+
theme
|
|
282
|
+
}),
|
|
283
|
+
color: themeGet("colors.white")({
|
|
284
|
+
theme
|
|
285
|
+
}),
|
|
286
|
+
padding: state.data.isFixed ? "4px 10px 5px 10px !important" : "4px 8px 5px 10px !important",
|
|
287
|
+
fontSize: "1.3rem",
|
|
288
|
+
fontWeight: themeGet("fontWeights.2")({
|
|
289
|
+
theme
|
|
290
|
+
}),
|
|
291
|
+
wordWrap: "break-word",
|
|
292
|
+
whiteSpace: "break-spaces",
|
|
293
|
+
borderRadius: state.data.isFixed ? "15px" : "15px 0 0 15px"
|
|
294
|
+
}),
|
|
295
|
+
multiValueRemove: (provided, state) => {
|
|
296
|
+
return {
|
|
297
|
+
...provided,
|
|
314
298
|
backgroundColor: themeGet("colors.primary")({
|
|
315
|
-
theme
|
|
299
|
+
theme
|
|
316
300
|
}),
|
|
317
301
|
color: themeGet("colors.white")({
|
|
318
|
-
theme
|
|
302
|
+
theme
|
|
319
303
|
}),
|
|
320
304
|
borderLeft: "solid 1px ".concat(themeGet("colors.primaryDark")({
|
|
321
|
-
theme
|
|
305
|
+
theme
|
|
322
306
|
})),
|
|
323
307
|
padding: "6.5px 6px 6.5px 5px",
|
|
324
308
|
display: state.data.isFixed ? "none" : provided.display,
|
|
325
309
|
cursor: "pointer",
|
|
326
310
|
borderRadius: "0 15px 15px 0",
|
|
327
311
|
transition: themeGet("transition.transitionDefault")({
|
|
328
|
-
theme
|
|
312
|
+
theme
|
|
329
313
|
}),
|
|
330
314
|
"&:hover": {
|
|
331
315
|
backgroundColor: themeGet("colors.primaryDark")({
|
|
332
|
-
theme
|
|
316
|
+
theme
|
|
333
317
|
}),
|
|
334
318
|
color: themeGet("colors.white")({
|
|
335
|
-
theme
|
|
319
|
+
theme
|
|
336
320
|
})
|
|
337
321
|
}
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
option:
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
});
|
|
370
|
-
}
|
|
322
|
+
};
|
|
323
|
+
},
|
|
324
|
+
option: (provided, state) => ({
|
|
325
|
+
...provided,
|
|
326
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
327
|
+
backgroundColor: !state.isFocused && !props.inverted ? themeGet("colors.white")({
|
|
328
|
+
theme
|
|
329
|
+
}) : state.isFocused && !props.inverted ? themeGet("colors.primaryLightest")({
|
|
330
|
+
theme
|
|
331
|
+
}) : !state.isFocused && props.inverted ? themeGet("colors.greyDarker")({
|
|
332
|
+
theme
|
|
333
|
+
}) : themeGet("colors.primaryDark")({
|
|
334
|
+
theme
|
|
335
|
+
}),
|
|
336
|
+
fontSize: themeGet("fontSizes.1")({
|
|
337
|
+
theme
|
|
338
|
+
}),
|
|
339
|
+
whiteSpace: "break-spaces"
|
|
340
|
+
}),
|
|
341
|
+
placeholder: (provided, state) => ({
|
|
342
|
+
...provided,
|
|
343
|
+
opacity: state.isDisabled ? 0.7 : 1,
|
|
344
|
+
color: props.inverted ? themeGet("colors.greyLightest")({
|
|
345
|
+
theme
|
|
346
|
+
}) : themeGet("colors.greyDarkest")({
|
|
347
|
+
theme
|
|
348
|
+
}),
|
|
349
|
+
fontSize: themeGet("fontSizes.1")({
|
|
350
|
+
theme
|
|
351
|
+
})
|
|
352
|
+
})
|
|
371
353
|
});
|
|
372
|
-
|
|
373
|
-
MultiValueRemove
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
"data-testid": props["data-testid"]
|
|
379
|
-
}, SelectStyles), props.label && /*#__PURE__*/React.createElement(Label, {
|
|
380
|
-
inverted: props.inverted,
|
|
381
|
-
bold: props.bold,
|
|
382
|
-
htmlFor: props.inputId,
|
|
383
|
-
invalid: props.invalid
|
|
384
|
-
}, props.label, props.mandatory && /*#__PURE__*/React.createElement(Small, {
|
|
385
|
-
color: "danger",
|
|
386
|
-
ml: "xs"
|
|
387
|
-
}, "*")), /*#__PURE__*/React.createElement(SelectComponent, _extends({
|
|
388
|
-
ref: inputRef,
|
|
389
|
-
styles: customStyles,
|
|
390
|
-
theme: theme,
|
|
391
|
-
inputId: props.inputId,
|
|
354
|
+
const components = {
|
|
355
|
+
MultiValueRemove,
|
|
356
|
+
...((props === null || props === void 0 ? void 0 : props.components) || {})
|
|
357
|
+
};
|
|
358
|
+
const SelectComponent = (_SELECT_TYPES$props$s = SELECT_TYPES[props === null || props === void 0 ? void 0 : props.selectType]) !== null && _SELECT_TYPES$props$s !== void 0 ? _SELECT_TYPES$props$s : SELECT_TYPES.default;
|
|
359
|
+
const component = /*#__PURE__*/_jsxs(Wrapper, {
|
|
392
360
|
inverted: props.inverted,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
361
|
+
"data-testid": props["data-testid"],
|
|
362
|
+
...SelectStyles,
|
|
363
|
+
children: [props.label && /*#__PURE__*/_jsxs(Label, {
|
|
364
|
+
inverted: props.inverted,
|
|
365
|
+
bold: props.bold,
|
|
366
|
+
htmlFor: props.inputId,
|
|
367
|
+
invalid: props.invalid,
|
|
368
|
+
children: [props.label, props.mandatory && /*#__PURE__*/_jsx(Small, {
|
|
369
|
+
color: "danger",
|
|
370
|
+
ml: "xs",
|
|
371
|
+
children: "*"
|
|
372
|
+
})]
|
|
373
|
+
}), /*#__PURE__*/_jsx(SelectComponent, {
|
|
374
|
+
ref: inputRef,
|
|
375
|
+
styles: customStyles,
|
|
376
|
+
theme: theme,
|
|
377
|
+
inputId: props.inputId,
|
|
378
|
+
inverted: props.inverted,
|
|
379
|
+
isMulti: props.isMulti,
|
|
380
|
+
classNamePrefix: props.classNamePrefix,
|
|
381
|
+
onChange: props.onChange,
|
|
382
|
+
"aria-label": props.ariaLabel,
|
|
383
|
+
...props,
|
|
384
|
+
components: components
|
|
385
|
+
})]
|
|
386
|
+
});
|
|
387
|
+
return props.theme ? /*#__PURE__*/_jsx(ThemeProvider, {
|
|
388
|
+
theme: props.theme,
|
|
389
|
+
children: component
|
|
390
|
+
}) : component;
|
|
403
391
|
});
|
|
404
392
|
Select.propTypes = {
|
|
405
393
|
/** Points to options object, see example code above */
|
|
@@ -407,12 +395,12 @@ Select.propTypes = {
|
|
|
407
395
|
/** Specifies the label for the `Select` */
|
|
408
396
|
label: PropTypes.string,
|
|
409
397
|
// ariaLabel prop must be specified if label is not provided
|
|
410
|
-
ariaLabel:
|
|
398
|
+
ariaLabel: (props, propName) => {
|
|
411
399
|
if (!props.label && (props[propName] == null || props[propName] === "")) {
|
|
412
400
|
return new Error("Missing prop `".concat(propName, "` not specified for Select component. When `label` is not provided, `").concat(propName, "` is required."));
|
|
413
401
|
}
|
|
414
402
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
415
|
-
return new Error("Invalid propType `".concat(propName, "` supplied to Select component. Expected `string`, received `").concat(
|
|
403
|
+
return new Error("Invalid propType `".concat(propName, "` supplied to Select component. Expected `string`, received `").concat(typeof props[propName], "`."));
|
|
416
404
|
}
|
|
417
405
|
return null;
|
|
418
406
|
},
|
|
@@ -421,12 +409,12 @@ Select.propTypes = {
|
|
|
421
409
|
/** Makes select disabled */
|
|
422
410
|
isDisabled: PropTypes.bool,
|
|
423
411
|
/** Specifies the ID for the rendered Select box. If you use the label prop label will automatically point to this ID, so this is required. */
|
|
424
|
-
inputId:
|
|
412
|
+
inputId: (props, propName) => {
|
|
425
413
|
if (props.label && (props[propName] == null || props[propName] === "")) {
|
|
426
414
|
return new Error("Missing prop `".concat(propName, "` not specified for Select component. When `label` is provided, `").concat(propName, "` is required."));
|
|
427
415
|
}
|
|
428
416
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
429
|
-
return new Error("Invalid propType `".concat(propName, "` supplied to Select component. Expected `string`, received `").concat(
|
|
417
|
+
return new Error("Invalid propType `".concat(propName, "` supplied to Select component. Expected `string`, received `").concat(typeof props[propName], "`."));
|
|
430
418
|
}
|
|
431
419
|
return null;
|
|
432
420
|
},
|