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,19 +1,18 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
import Select from ".";
|
|
3
2
|
import React, { useState } from "react";
|
|
4
3
|
import Box from "../Box";
|
|
5
4
|
import Spacer from "../Spacer";
|
|
6
5
|
import { getOptionByValue } from "../../utils/selectUtil";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
7
7
|
export default {
|
|
8
8
|
title: "Components/Select",
|
|
9
9
|
component: Select,
|
|
10
|
-
decorators: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}]
|
|
10
|
+
decorators: [storyFn => /*#__PURE__*/_jsx(Box, {
|
|
11
|
+
height: "350px",
|
|
12
|
+
children: storyFn()
|
|
13
|
+
})]
|
|
15
14
|
};
|
|
16
|
-
|
|
15
|
+
const options = [{
|
|
17
16
|
value: "caramel",
|
|
18
17
|
label: "Caramel"
|
|
19
18
|
}, {
|
|
@@ -26,7 +25,7 @@ var options = [{
|
|
|
26
25
|
value: "vanilla",
|
|
27
26
|
label: "Vanilla"
|
|
28
27
|
}];
|
|
29
|
-
|
|
28
|
+
const groupedOptions = [{
|
|
30
29
|
label: "Fruit",
|
|
31
30
|
options: [{
|
|
32
31
|
value: "apple",
|
|
@@ -51,79 +50,70 @@ var groupedOptions = [{
|
|
|
51
50
|
label: "Celery"
|
|
52
51
|
}]
|
|
53
52
|
}];
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
};
|
|
53
|
+
export const defaultSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
54
|
+
options: options,
|
|
55
|
+
label: "Select label",
|
|
56
|
+
inputId: "defaultSelect"
|
|
57
|
+
});
|
|
61
58
|
defaultSelect.story = {
|
|
62
59
|
name: "Default"
|
|
63
60
|
};
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
};
|
|
61
|
+
export const invalidSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
62
|
+
options: options,
|
|
63
|
+
invalid: true,
|
|
64
|
+
label: "Select label - invalid message",
|
|
65
|
+
inputId: "invalidSelect"
|
|
66
|
+
});
|
|
72
67
|
invalidSelect.story = {
|
|
73
68
|
name: "Invalid"
|
|
74
69
|
};
|
|
75
|
-
export
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
};
|
|
70
|
+
export const mandatorySelect = () => /*#__PURE__*/_jsx(Select, {
|
|
71
|
+
options: options,
|
|
72
|
+
mandatory: true,
|
|
73
|
+
label: "Select label",
|
|
74
|
+
inputId: "mandatorySelect"
|
|
75
|
+
});
|
|
83
76
|
mandatorySelect.story = {
|
|
84
77
|
name: "Mandatory"
|
|
85
78
|
};
|
|
86
|
-
export
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
};
|
|
79
|
+
export const disabledSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
80
|
+
options: options,
|
|
81
|
+
label: "Select label",
|
|
82
|
+
inputId: "defaultSelect",
|
|
83
|
+
isDisabled: true
|
|
84
|
+
});
|
|
94
85
|
defaultSelect.story = {
|
|
95
86
|
name: "Disabled"
|
|
96
87
|
};
|
|
97
|
-
export
|
|
98
|
-
|
|
99
|
-
mb: "l"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
88
|
+
export const SpecificHeightSelect = () => /*#__PURE__*/_jsx(_Fragment, {
|
|
89
|
+
children: /*#__PURE__*/_jsxs(Spacer, {
|
|
90
|
+
mb: "l",
|
|
91
|
+
children: [/*#__PURE__*/_jsx(Select, {
|
|
92
|
+
height: "30px",
|
|
93
|
+
padding: "0 8px",
|
|
94
|
+
options: options,
|
|
95
|
+
"aria-label": "Select label"
|
|
96
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
97
|
+
height: "56px",
|
|
98
|
+
padding: "4px 12px",
|
|
99
|
+
options: options,
|
|
100
|
+
"aria-label": "Select label"
|
|
101
|
+
})]
|
|
102
|
+
})
|
|
103
|
+
});
|
|
112
104
|
defaultSelect.story = {
|
|
113
105
|
name: "SpecificHeightSelect"
|
|
114
106
|
};
|
|
115
|
-
export
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
});
|
|
121
|
-
};
|
|
107
|
+
export const multiSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
108
|
+
options: options,
|
|
109
|
+
isMulti: true,
|
|
110
|
+
"aria-label": "Select label"
|
|
111
|
+
});
|
|
122
112
|
multiSelect.story = {
|
|
123
113
|
name: "Multi-select"
|
|
124
114
|
};
|
|
125
|
-
export
|
|
126
|
-
|
|
115
|
+
export const multiSelectWithFixedOptions = () => {
|
|
116
|
+
const options = [{
|
|
127
117
|
value: "caramel",
|
|
128
118
|
label: "Caramel",
|
|
129
119
|
isFixed: true
|
|
@@ -140,13 +130,12 @@ export var multiSelectWithFixedOptions = function multiSelectWithFixedOptions()
|
|
|
140
130
|
isDisabled: true
|
|
141
131
|
}];
|
|
142
132
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
removedValue = _ref.removedValue;
|
|
133
|
+
const [selected, setSelected] = useState([options[0], options[1]]);
|
|
134
|
+
const onChange = (value, _ref) => {
|
|
135
|
+
let {
|
|
136
|
+
action,
|
|
137
|
+
removedValue
|
|
138
|
+
} = _ref;
|
|
150
139
|
switch (action) {
|
|
151
140
|
case "remove-value":
|
|
152
141
|
case "pop-value":
|
|
@@ -157,7 +146,7 @@ export var multiSelectWithFixedOptions = function multiSelectWithFixedOptions()
|
|
|
157
146
|
}
|
|
158
147
|
setSelected(value);
|
|
159
148
|
};
|
|
160
|
-
return /*#__PURE__*/
|
|
149
|
+
return /*#__PURE__*/_jsx(Select, {
|
|
161
150
|
options: options,
|
|
162
151
|
value: selected,
|
|
163
152
|
isMulti: true,
|
|
@@ -169,72 +158,62 @@ export var multiSelectWithFixedOptions = function multiSelectWithFixedOptions()
|
|
|
169
158
|
multiSelectWithFixedOptions.story = {
|
|
170
159
|
name: "Multi-select-with-fixed-options"
|
|
171
160
|
};
|
|
172
|
-
export
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
})
|
|
190
|
-
};
|
|
161
|
+
export const invertedSelect = () => /*#__PURE__*/_jsx(Box, {
|
|
162
|
+
bg: "greyDarkest",
|
|
163
|
+
width: "100%",
|
|
164
|
+
height: "270px",
|
|
165
|
+
p: "r",
|
|
166
|
+
children: /*#__PURE__*/_jsxs(Spacer, {
|
|
167
|
+
mb: "l",
|
|
168
|
+
children: [/*#__PURE__*/_jsx(Select, {
|
|
169
|
+
options: options,
|
|
170
|
+
inverted: true,
|
|
171
|
+
"aria-label": "Select label"
|
|
172
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
173
|
+
options: options,
|
|
174
|
+
inverted: true,
|
|
175
|
+
isMulti: true,
|
|
176
|
+
"aria-label": "Select label"
|
|
177
|
+
})]
|
|
178
|
+
})
|
|
179
|
+
});
|
|
191
180
|
invertedSelect.story = {
|
|
192
181
|
name: "Inverted"
|
|
193
182
|
};
|
|
194
|
-
export
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
});
|
|
200
|
-
};
|
|
183
|
+
export const withDataIdSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
184
|
+
options: options,
|
|
185
|
+
"data-testid": "test-this-component",
|
|
186
|
+
"aria-label": "Select label"
|
|
187
|
+
});
|
|
201
188
|
withDataIdSelect.story = {
|
|
202
189
|
name: "With Data ID"
|
|
203
190
|
};
|
|
204
|
-
export
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
});
|
|
210
|
-
};
|
|
191
|
+
export const withSelectedValueSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
192
|
+
options: options,
|
|
193
|
+
defaultValue: getOptionByValue(options, "chocolate"),
|
|
194
|
+
"aria-label": "Select label"
|
|
195
|
+
});
|
|
211
196
|
withSelectedValueSelect.storyName = "With Selected Value";
|
|
212
|
-
export
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
});
|
|
219
|
-
};
|
|
197
|
+
export const withCreatableSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
198
|
+
options: options,
|
|
199
|
+
selectType: "creatable",
|
|
200
|
+
isMulti: true,
|
|
201
|
+
"aria-label": "Select label"
|
|
202
|
+
});
|
|
220
203
|
withCreatableSelect.storyName = "With Creatable";
|
|
221
|
-
export
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
});
|
|
228
|
-
};
|
|
204
|
+
export const withAsyncSelect = () => /*#__PURE__*/_jsx(Select, {
|
|
205
|
+
defaultOptions: options,
|
|
206
|
+
selectType: "async",
|
|
207
|
+
isMulti: true,
|
|
208
|
+
"aria-label": "Select label"
|
|
209
|
+
});
|
|
229
210
|
withAsyncSelect.storyName = "With Async";
|
|
230
|
-
export
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
});
|
|
237
|
-
};
|
|
211
|
+
export const withGroupedOptions = () => /*#__PURE__*/_jsx(Select, {
|
|
212
|
+
options: groupedOptions,
|
|
213
|
+
isMulti: true,
|
|
214
|
+
menuIsOpen: true,
|
|
215
|
+
"aria-label": "Select label"
|
|
216
|
+
});
|
|
238
217
|
withGroupedOptions.storyName = "With Grouped Options";
|
|
239
218
|
defaultSelect.__docgenInfo = {
|
|
240
219
|
"description": "",
|