orcs-design-system 3.1.0 → 3.1.2
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/components/Divider/Divider.stories.js +33 -2
- package/es/components/Divider/index.js +16 -3
- package/es/components/SideNav/index.js +1 -1
- package/es/components/TreeNav/TreeNav.stories.js +360 -0
- package/es/components/TreeNav/index.js +108 -0
- package/es/components.test.js +1 -1
- package/es/index.js +1 -0
- package/package.json +3 -2
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
};
|
|
9
9
|
export var defaultDivider = function defaultDivider() {
|
|
10
10
|
return /*#__PURE__*/React.createElement(Spacer, {
|
|
11
|
-
my: "
|
|
11
|
+
my: "r"
|
|
12
12
|
}, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Divider, {
|
|
13
13
|
light: true
|
|
14
14
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
@@ -18,16 +18,42 @@ export var defaultDivider = function defaultDivider() {
|
|
|
18
18
|
thick: true
|
|
19
19
|
}));
|
|
20
20
|
};
|
|
21
|
+
export var dashDivider = function dashDivider() {
|
|
22
|
+
return /*#__PURE__*/React.createElement(Spacer, {
|
|
23
|
+
my: "r"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Divider, {
|
|
25
|
+
dash: true
|
|
26
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
27
|
+
light: true,
|
|
28
|
+
dash: true
|
|
29
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
30
|
+
thick: true,
|
|
31
|
+
dash: true
|
|
32
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
33
|
+
light: true,
|
|
34
|
+
thick: true,
|
|
35
|
+
dash: true
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
21
38
|
export var invertedDivider = function invertedDivider() {
|
|
22
39
|
return /*#__PURE__*/React.createElement(Box, {
|
|
23
40
|
bg: "greyDarkest",
|
|
24
41
|
p: "5"
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Spacer, {
|
|
43
|
+
my: "r"
|
|
25
44
|
}, /*#__PURE__*/React.createElement(Divider, {
|
|
26
45
|
inverted: true
|
|
27
46
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
28
47
|
inverted: true,
|
|
29
48
|
thick: true
|
|
30
|
-
})
|
|
49
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
50
|
+
inverted: true,
|
|
51
|
+
dash: true
|
|
52
|
+
}), /*#__PURE__*/React.createElement(Divider, {
|
|
53
|
+
inverted: true,
|
|
54
|
+
thick: true,
|
|
55
|
+
dash: true
|
|
56
|
+
})));
|
|
31
57
|
};
|
|
32
58
|
export var spanGrid = function spanGrid() {
|
|
33
59
|
return /*#__PURE__*/React.createElement(Divider, {
|
|
@@ -39,6 +65,11 @@ defaultDivider.__docgenInfo = {
|
|
|
39
65
|
"methods": [],
|
|
40
66
|
"displayName": "defaultDivider"
|
|
41
67
|
};
|
|
68
|
+
dashDivider.__docgenInfo = {
|
|
69
|
+
"description": "",
|
|
70
|
+
"methods": [],
|
|
71
|
+
"displayName": "dashDivider"
|
|
72
|
+
};
|
|
42
73
|
invertedDivider.__docgenInfo = {
|
|
43
74
|
"description": "",
|
|
44
75
|
"methods": [],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["light", "thick", "inverted", "spanGrid", "theme"];
|
|
3
|
+
var _excluded = ["light", "thick", "dash", "inverted", "spanGrid", "theme"];
|
|
4
4
|
import React from "react";
|
|
5
5
|
import styled, { ThemeProvider } from "styled-components";
|
|
6
6
|
import PropTypes from "prop-types";
|
|
@@ -9,16 +9,19 @@ import { themeGet } from "@styled-system/theme-get";
|
|
|
9
9
|
var Item = styled.div.withConfig({
|
|
10
10
|
displayName: "Divider__Item",
|
|
11
11
|
componentId: "sc-106mlj-0"
|
|
12
|
-
})(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";background-color:", ";"], space, layout, color, function (props) {
|
|
12
|
+
})(["", " ", " ", " display:block;width:100%;height:", ";grid-column:", ";border-bottom:", ";background-color:", ";"], space, layout, color, function (props) {
|
|
13
13
|
return props.thick ? "3px" : "1px";
|
|
14
14
|
}, function (props) {
|
|
15
15
|
return props.spanGrid ? "1 / -1" : "auto";
|
|
16
16
|
}, function (props) {
|
|
17
|
-
return props.light ? themeGet("colors.black10")(props) : props.inverted ? themeGet("colors.
|
|
17
|
+
return props.dash && props.thick && props.light ? "dashed 3px ".concat(themeGet("colors.black10")(props)) : props.dash && props.thick && props.inverted ? "dashed 3px ".concat(themeGet("colors.white20")(props)) : props.dash && props.inverted ? "dashed 1px ".concat(themeGet("colors.white20")(props)) : props.dash && props.light ? "dashed 1px ".concat(themeGet("colors.black10")(props)) : props.dash && props.thick ? "dashed 3px ".concat(themeGet("colors.black20")(props)) : props.dash ? "dashed 1px ".concat(themeGet("colors.black20")(props)) : "none";
|
|
18
|
+
}, function (props) {
|
|
19
|
+
return props.dash ? "transparent" : props.inverted ? themeGet("colors.white20")(props) : props.light ? themeGet("colors.black10")(props) : themeGet("colors.black20")(props);
|
|
18
20
|
});
|
|
19
21
|
export default function Divider(_ref) {
|
|
20
22
|
var light = _ref.light,
|
|
21
23
|
thick = _ref.thick,
|
|
24
|
+
dash = _ref.dash,
|
|
22
25
|
inverted = _ref.inverted,
|
|
23
26
|
spanGrid = _ref.spanGrid,
|
|
24
27
|
theme = _ref.theme,
|
|
@@ -26,6 +29,7 @@ export default function Divider(_ref) {
|
|
|
26
29
|
var component = /*#__PURE__*/React.createElement(Item, _extends({
|
|
27
30
|
light: light,
|
|
28
31
|
thick: thick,
|
|
32
|
+
dash: dash,
|
|
29
33
|
inverted: inverted,
|
|
30
34
|
spanGrid: spanGrid
|
|
31
35
|
}, props));
|
|
@@ -38,6 +42,8 @@ Divider.propTypes = {
|
|
|
38
42
|
light: PropTypes.bool,
|
|
39
43
|
/** Divider will be 3px instead of 1px */
|
|
40
44
|
thick: PropTypes.bool,
|
|
45
|
+
/** Divider will have a dashed line instead of solid line */
|
|
46
|
+
dash: PropTypes.bool,
|
|
41
47
|
/** Divider will be a darker colour more suited for dark backgrounds */
|
|
42
48
|
inverted: PropTypes.bool,
|
|
43
49
|
/** Divider will span all columns when in a grid so it can be used as a row divider */
|
|
@@ -64,6 +70,13 @@ Divider.__docgenInfo = {
|
|
|
64
70
|
},
|
|
65
71
|
"required": false
|
|
66
72
|
},
|
|
73
|
+
"dash": {
|
|
74
|
+
"description": "Divider will have a dashed line instead of solid line",
|
|
75
|
+
"type": {
|
|
76
|
+
"name": "bool"
|
|
77
|
+
},
|
|
78
|
+
"required": false
|
|
79
|
+
},
|
|
67
80
|
"inverted": {
|
|
68
81
|
"description": "Divider will be a darker colour more suited for dark backgrounds",
|
|
69
82
|
"type": {
|
|
@@ -569,7 +569,7 @@ var SideNav = function SideNav(_ref2) {
|
|
|
569
569
|
activeItem: activeItem,
|
|
570
570
|
handleItemClick: handleItemClick
|
|
571
571
|
});
|
|
572
|
-
}))), expandedItem !== null && allItems[expandedItem].component ? /*#__PURE__*/React.createElement(SideNavExpanded, {
|
|
572
|
+
}))), expandedItem !== null && allItems[expandedItem] && allItems[expandedItem].component ? /*#__PURE__*/React.createElement(SideNavExpanded, {
|
|
573
573
|
sideNavHeight: sideNavHeight,
|
|
574
574
|
active: expandedItem === activeItem,
|
|
575
575
|
large: allItems[expandedItem] && allItems[expandedItem].large
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TreeNav from ".";
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/TreeNav",
|
|
5
|
+
component: TreeNav
|
|
6
|
+
};
|
|
7
|
+
var data = [{
|
|
8
|
+
id: "1",
|
|
9
|
+
name: "Domains",
|
|
10
|
+
badgeText: "Domains",
|
|
11
|
+
badgeColour: "success",
|
|
12
|
+
children: [{
|
|
13
|
+
id: "1a",
|
|
14
|
+
name: "Business",
|
|
15
|
+
badgeText: "Domain",
|
|
16
|
+
badgeColour: "success",
|
|
17
|
+
checkbox: true,
|
|
18
|
+
children: [{
|
|
19
|
+
id: "1a1",
|
|
20
|
+
name: "Capture & Release",
|
|
21
|
+
badgeText: "Team",
|
|
22
|
+
badgeColour: "success",
|
|
23
|
+
checkbox: true
|
|
24
|
+
}, {
|
|
25
|
+
id: "1a2",
|
|
26
|
+
name: "Goonsquad",
|
|
27
|
+
badgeText: "Team",
|
|
28
|
+
badgeColour: "success",
|
|
29
|
+
checkbox: true
|
|
30
|
+
}, {
|
|
31
|
+
id: "1a3",
|
|
32
|
+
name: "Wolfpack",
|
|
33
|
+
badgeText: "Team",
|
|
34
|
+
badgeColour: "success",
|
|
35
|
+
checkbox: true
|
|
36
|
+
}]
|
|
37
|
+
}, {
|
|
38
|
+
id: "1b",
|
|
39
|
+
name: "Hardware Product",
|
|
40
|
+
badgeText: "Domain",
|
|
41
|
+
badgeColour: "success",
|
|
42
|
+
children: [{
|
|
43
|
+
id: "1b1",
|
|
44
|
+
name: "Blackhole",
|
|
45
|
+
badgeText: "Team",
|
|
46
|
+
badgeColour: "success"
|
|
47
|
+
}, {
|
|
48
|
+
id: "1b2",
|
|
49
|
+
name: "Marvel",
|
|
50
|
+
badgeText: "Team",
|
|
51
|
+
badgeColour: "success"
|
|
52
|
+
}, {
|
|
53
|
+
id: "1b3",
|
|
54
|
+
name: "Stargazers",
|
|
55
|
+
badgeText: "Team",
|
|
56
|
+
badgeColour: "success"
|
|
57
|
+
}]
|
|
58
|
+
}, {
|
|
59
|
+
id: "1c",
|
|
60
|
+
name: "Innovation",
|
|
61
|
+
badgeText: "Domain",
|
|
62
|
+
badgeColour: "success",
|
|
63
|
+
children: [{
|
|
64
|
+
id: "1c1",
|
|
65
|
+
name: "AI Master Race",
|
|
66
|
+
badgeText: "Team",
|
|
67
|
+
badgeColour: "success"
|
|
68
|
+
}, {
|
|
69
|
+
id: "1c2",
|
|
70
|
+
name: "Constellation",
|
|
71
|
+
badgeText: "Team",
|
|
72
|
+
badgeColour: "success"
|
|
73
|
+
}, {
|
|
74
|
+
id: "1c3",
|
|
75
|
+
name: "Dark Matter",
|
|
76
|
+
badgeText: "Team",
|
|
77
|
+
badgeColour: "success"
|
|
78
|
+
}, {
|
|
79
|
+
id: "1c4",
|
|
80
|
+
name: "Future Space",
|
|
81
|
+
badgeText: "Team",
|
|
82
|
+
badgeColour: "success"
|
|
83
|
+
}, {
|
|
84
|
+
id: "1c5",
|
|
85
|
+
name: "Innovation Lab",
|
|
86
|
+
badgeText: "Team",
|
|
87
|
+
badgeColour: "success"
|
|
88
|
+
}]
|
|
89
|
+
}, {
|
|
90
|
+
id: "1d",
|
|
91
|
+
name: "Marketing",
|
|
92
|
+
badgeText: "Domain",
|
|
93
|
+
badgeColour: "success",
|
|
94
|
+
children: [{
|
|
95
|
+
id: "1d1",
|
|
96
|
+
name: "Community",
|
|
97
|
+
badgeText: "Team",
|
|
98
|
+
badgeColour: "success"
|
|
99
|
+
}, {
|
|
100
|
+
id: "1d2",
|
|
101
|
+
name: "Product",
|
|
102
|
+
badgeText: "Team",
|
|
103
|
+
badgeColour: "success"
|
|
104
|
+
}]
|
|
105
|
+
}, {
|
|
106
|
+
id: "1e",
|
|
107
|
+
name: "Operations",
|
|
108
|
+
badgeText: "Domain",
|
|
109
|
+
badgeColour: "success",
|
|
110
|
+
children: [{
|
|
111
|
+
id: "1e1",
|
|
112
|
+
name: "Backbone",
|
|
113
|
+
badgeText: "Team",
|
|
114
|
+
badgeColour: "success"
|
|
115
|
+
}, {
|
|
116
|
+
id: "1e2",
|
|
117
|
+
name: "Blackops",
|
|
118
|
+
badgeText: "Team",
|
|
119
|
+
badgeColour: "success"
|
|
120
|
+
}]
|
|
121
|
+
}, {
|
|
122
|
+
id: "1f",
|
|
123
|
+
name: "Platform",
|
|
124
|
+
badgeText: "Domain",
|
|
125
|
+
badgeColour: "success",
|
|
126
|
+
children: [{
|
|
127
|
+
id: "1f1",
|
|
128
|
+
name: "Event Horizon",
|
|
129
|
+
badgeText: "Team",
|
|
130
|
+
badgeColour: "success"
|
|
131
|
+
}, {
|
|
132
|
+
id: "1f2",
|
|
133
|
+
name: "Transformers",
|
|
134
|
+
badgeText: "Team",
|
|
135
|
+
badgeColour: "success"
|
|
136
|
+
}, {
|
|
137
|
+
id: "1f3",
|
|
138
|
+
name: "Zeta Squad",
|
|
139
|
+
badgeText: "Team",
|
|
140
|
+
badgeColour: "success"
|
|
141
|
+
}]
|
|
142
|
+
}, {
|
|
143
|
+
id: "1g",
|
|
144
|
+
name: "Research & Analysis",
|
|
145
|
+
badgeText: "Domain",
|
|
146
|
+
badgeColour: "success",
|
|
147
|
+
children: [{
|
|
148
|
+
id: "1g1",
|
|
149
|
+
name: "Alpha Relay",
|
|
150
|
+
badgeText: "Team",
|
|
151
|
+
badgeColour: "success"
|
|
152
|
+
}, {
|
|
153
|
+
id: "1g2",
|
|
154
|
+
name: "Gizmosphere",
|
|
155
|
+
badgeText: "Team",
|
|
156
|
+
badgeColour: "success"
|
|
157
|
+
}]
|
|
158
|
+
}, {
|
|
159
|
+
id: "1h",
|
|
160
|
+
name: "Software Product",
|
|
161
|
+
badgeText: "Domain",
|
|
162
|
+
badgeColour: "success",
|
|
163
|
+
children: [{
|
|
164
|
+
id: "1h1",
|
|
165
|
+
name: "Alphazone",
|
|
166
|
+
badgeText: "Team",
|
|
167
|
+
badgeColour: "success"
|
|
168
|
+
}, {
|
|
169
|
+
id: "1h2",
|
|
170
|
+
name: "Asterism",
|
|
171
|
+
badgeText: "Team",
|
|
172
|
+
badgeColour: "success"
|
|
173
|
+
}, {
|
|
174
|
+
id: "1h3",
|
|
175
|
+
name: "Beta Testers",
|
|
176
|
+
badgeText: "Team",
|
|
177
|
+
badgeColour: "success"
|
|
178
|
+
}, {
|
|
179
|
+
id: "1h4",
|
|
180
|
+
name: "BobRossers",
|
|
181
|
+
badgeText: "Team",
|
|
182
|
+
badgeColour: "success"
|
|
183
|
+
}, {
|
|
184
|
+
id: "1h5",
|
|
185
|
+
name: "Flashdance",
|
|
186
|
+
badgeText: "Team",
|
|
187
|
+
badgeColour: "success"
|
|
188
|
+
}, {
|
|
189
|
+
id: "1h3",
|
|
190
|
+
name: "Matrix",
|
|
191
|
+
badgeText: "Team",
|
|
192
|
+
badgeColour: "success"
|
|
193
|
+
}, {
|
|
194
|
+
id: "1h4",
|
|
195
|
+
name: "Matter",
|
|
196
|
+
badgeText: "Team",
|
|
197
|
+
badgeColour: "success"
|
|
198
|
+
}, {
|
|
199
|
+
id: "1h5",
|
|
200
|
+
name: "The Incredibles",
|
|
201
|
+
badgeText: "Team",
|
|
202
|
+
badgeColour: "success"
|
|
203
|
+
}]
|
|
204
|
+
}, {
|
|
205
|
+
id: "1i",
|
|
206
|
+
name: "Support",
|
|
207
|
+
badgeText: "Domain",
|
|
208
|
+
badgeColour: "success",
|
|
209
|
+
children: [{
|
|
210
|
+
id: "1i1",
|
|
211
|
+
name: "Customer Support",
|
|
212
|
+
badgeText: "Team",
|
|
213
|
+
badgeColour: "success"
|
|
214
|
+
}, {
|
|
215
|
+
id: "1i2",
|
|
216
|
+
name: "Tech Support",
|
|
217
|
+
badgeText: "Team",
|
|
218
|
+
badgeColour: "success"
|
|
219
|
+
}]
|
|
220
|
+
}]
|
|
221
|
+
}, {
|
|
222
|
+
id: "2",
|
|
223
|
+
name: "Capabilities",
|
|
224
|
+
badgeText: "Capabilities",
|
|
225
|
+
badgeColour: "secondary",
|
|
226
|
+
children: [{
|
|
227
|
+
id: "2a",
|
|
228
|
+
name: "Analysts",
|
|
229
|
+
badgeText: "Capability",
|
|
230
|
+
badgeColour: "secondary"
|
|
231
|
+
}, {
|
|
232
|
+
id: "2b",
|
|
233
|
+
name: "Astrophysics & Aerospace Engineering",
|
|
234
|
+
badgeText: "Capability",
|
|
235
|
+
badgeColour: "secondary"
|
|
236
|
+
}, {
|
|
237
|
+
id: "2c",
|
|
238
|
+
name: "Consulting",
|
|
239
|
+
badgeText: "Capability",
|
|
240
|
+
badgeColour: "secondary"
|
|
241
|
+
}, {
|
|
242
|
+
id: "2d",
|
|
243
|
+
name: "Customer Success",
|
|
244
|
+
badgeText: "Capability",
|
|
245
|
+
badgeColour: "secondary"
|
|
246
|
+
}, {
|
|
247
|
+
id: "2e",
|
|
248
|
+
name: "Data Engineering",
|
|
249
|
+
badgeText: "Capability",
|
|
250
|
+
badgeColour: "secondary"
|
|
251
|
+
}, {
|
|
252
|
+
id: "2f",
|
|
253
|
+
name: "Design",
|
|
254
|
+
badgeText: "Capability",
|
|
255
|
+
badgeColour: "secondary"
|
|
256
|
+
}, {
|
|
257
|
+
id: "2g",
|
|
258
|
+
name: "DevOps",
|
|
259
|
+
badgeText: "Capability",
|
|
260
|
+
badgeColour: "secondary"
|
|
261
|
+
}, {
|
|
262
|
+
id: "2h",
|
|
263
|
+
name: "Finance",
|
|
264
|
+
badgeText: "Capability",
|
|
265
|
+
badgeColour: "secondary"
|
|
266
|
+
}, {
|
|
267
|
+
id: "2i",
|
|
268
|
+
name: "Hardware Engineering",
|
|
269
|
+
badgeText: "Capability",
|
|
270
|
+
badgeColour: "secondary"
|
|
271
|
+
}, {
|
|
272
|
+
id: "2j",
|
|
273
|
+
name: "Leadership",
|
|
274
|
+
badgeText: "Capability",
|
|
275
|
+
badgeColour: "secondary"
|
|
276
|
+
}, {
|
|
277
|
+
id: "2k",
|
|
278
|
+
name: "Management",
|
|
279
|
+
badgeText: "Capability",
|
|
280
|
+
badgeColour: "secondary"
|
|
281
|
+
}, {
|
|
282
|
+
id: "2l",
|
|
283
|
+
name: "Marketing",
|
|
284
|
+
badgeText: "Capability",
|
|
285
|
+
badgeColour: "secondary"
|
|
286
|
+
}, {
|
|
287
|
+
id: "2m",
|
|
288
|
+
name: "Operations",
|
|
289
|
+
badgeText: "Capability",
|
|
290
|
+
badgeColour: "secondary"
|
|
291
|
+
}, {
|
|
292
|
+
id: "2n",
|
|
293
|
+
name: "People & Culture",
|
|
294
|
+
badgeText: "Capability",
|
|
295
|
+
badgeColour: "secondary"
|
|
296
|
+
}, {
|
|
297
|
+
id: "2o",
|
|
298
|
+
name: "Product Management",
|
|
299
|
+
badgeText: "Capability",
|
|
300
|
+
badgeColour: "secondary"
|
|
301
|
+
}, {
|
|
302
|
+
id: "2p",
|
|
303
|
+
name: "Quality Assurance & Testing",
|
|
304
|
+
badgeText: "Capability",
|
|
305
|
+
badgeColour: "secondary"
|
|
306
|
+
}, {
|
|
307
|
+
id: "2q",
|
|
308
|
+
name: "Recruitment",
|
|
309
|
+
badgeText: "Capability",
|
|
310
|
+
badgeColour: "secondary"
|
|
311
|
+
}, {
|
|
312
|
+
id: "2r",
|
|
313
|
+
name: "Research",
|
|
314
|
+
badgeText: "Capability",
|
|
315
|
+
badgeColour: "secondary"
|
|
316
|
+
}, {
|
|
317
|
+
id: "2s",
|
|
318
|
+
name: "Sales",
|
|
319
|
+
badgeText: "Capability",
|
|
320
|
+
badgeColour: "secondary"
|
|
321
|
+
}, {
|
|
322
|
+
id: "2t",
|
|
323
|
+
name: "Security Engineering",
|
|
324
|
+
badgeText: "Capability",
|
|
325
|
+
badgeColour: "secondary"
|
|
326
|
+
}, {
|
|
327
|
+
id: "2u",
|
|
328
|
+
name: "Software Engineering",
|
|
329
|
+
badgeText: "Capability",
|
|
330
|
+
badgeColour: "secondary"
|
|
331
|
+
}, {
|
|
332
|
+
id: "2v",
|
|
333
|
+
name: "Support",
|
|
334
|
+
badgeText: "Capability",
|
|
335
|
+
badgeColour: "secondary"
|
|
336
|
+
}, {
|
|
337
|
+
id: "2w",
|
|
338
|
+
name: "Systems Engineering",
|
|
339
|
+
badgeText: "Capability",
|
|
340
|
+
badgeColour: "secondary"
|
|
341
|
+
}]
|
|
342
|
+
}, {
|
|
343
|
+
id: "3",
|
|
344
|
+
name: "Omega Systems",
|
|
345
|
+
badgeText: "Contractor",
|
|
346
|
+
badgeColour: "primary"
|
|
347
|
+
}];
|
|
348
|
+
export var defaultTreeNav = function defaultTreeNav() {
|
|
349
|
+
return /*#__PURE__*/React.createElement(TreeNav, {
|
|
350
|
+
data: data,
|
|
351
|
+
openByDefault: false,
|
|
352
|
+
width: 400
|
|
353
|
+
});
|
|
354
|
+
};
|
|
355
|
+
defaultTreeNav.storyName = "Default tree navigation";
|
|
356
|
+
defaultTreeNav.__docgenInfo = {
|
|
357
|
+
"description": "",
|
|
358
|
+
"methods": [],
|
|
359
|
+
"displayName": "defaultTreeNav"
|
|
360
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["data"];
|
|
4
|
+
import React from "react";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import { css } from "@styled-system/css";
|
|
7
|
+
import PropTypes from "prop-types";
|
|
8
|
+
import { themeGet } from "@styled-system/theme-get";
|
|
9
|
+
import Icon from "../Icon";
|
|
10
|
+
import Flex from "../Flex";
|
|
11
|
+
import Badge from "../Badge";
|
|
12
|
+
import Checkbox from "../Checkbox";
|
|
13
|
+
import { Small } from "../Typography";
|
|
14
|
+
import { Tree } from "react-arborist";
|
|
15
|
+
var TreeItemWrapper = styled("div").withConfig({
|
|
16
|
+
displayName: "TreeNav__TreeItemWrapper",
|
|
17
|
+
componentId: "sc-13iwmeo-0"
|
|
18
|
+
})(function (props) {
|
|
19
|
+
return css({
|
|
20
|
+
padding: "5px",
|
|
21
|
+
marginRight: "5px",
|
|
22
|
+
cursor: "pointer",
|
|
23
|
+
borderRadius: themeGet("radii.2")(props),
|
|
24
|
+
transition: themeGet("transition.transitionDefault")(props),
|
|
25
|
+
"&:hover, &:focus": {
|
|
26
|
+
backgroundColor: themeGet("colors.primary10")(props)
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
var Node = function Node(_ref) {
|
|
31
|
+
var node = _ref.node,
|
|
32
|
+
style = _ref.style,
|
|
33
|
+
dragHandle = _ref.dragHandle;
|
|
34
|
+
/* This node instance can do many things. See the API reference. */
|
|
35
|
+
return /*#__PURE__*/React.createElement(TreeItemWrapper, {
|
|
36
|
+
style: style,
|
|
37
|
+
className: "treeitem-wrapper",
|
|
38
|
+
ref: dragHandle,
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return node.toggle();
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
43
|
+
alignItems: "center"
|
|
44
|
+
}, node.isLeaf ? /*#__PURE__*/React.createElement(Icon, {
|
|
45
|
+
icon: ["fas", "chevron-down"],
|
|
46
|
+
title: "Select item",
|
|
47
|
+
mr: "xs",
|
|
48
|
+
ml: "s",
|
|
49
|
+
size: "sm",
|
|
50
|
+
rotation: 270,
|
|
51
|
+
color: "transparent"
|
|
52
|
+
}) : node.isOpen ? /*#__PURE__*/React.createElement(Icon, {
|
|
53
|
+
icon: ["fas", "chevron-down"],
|
|
54
|
+
title: "Collapse item",
|
|
55
|
+
transform: "up-1",
|
|
56
|
+
mr: "xs",
|
|
57
|
+
ml: "s",
|
|
58
|
+
size: "sm"
|
|
59
|
+
}) : /*#__PURE__*/React.createElement(Icon, {
|
|
60
|
+
icon: ["fas", "chevron-down"],
|
|
61
|
+
title: "Expand item",
|
|
62
|
+
transform: "up-1",
|
|
63
|
+
mr: "xs",
|
|
64
|
+
ml: "s",
|
|
65
|
+
size: "sm",
|
|
66
|
+
rotation: 270
|
|
67
|
+
}), node.data.checkbox && /*#__PURE__*/React.createElement(Checkbox, {
|
|
68
|
+
onChange: node.data.checkboxOnChange
|
|
69
|
+
}), /*#__PURE__*/React.createElement(Small, null, node.data.name), node.data.badgeText && /*#__PURE__*/React.createElement(Badge, {
|
|
70
|
+
variant: node.data.badgeColour,
|
|
71
|
+
ml: "auto"
|
|
72
|
+
}, node.data.badgeText)));
|
|
73
|
+
};
|
|
74
|
+
Node.propTypes = {
|
|
75
|
+
isLeaf: PropTypes.bool,
|
|
76
|
+
data: PropTypes.array
|
|
77
|
+
};
|
|
78
|
+
var TreeNav = function TreeNav(_ref2) {
|
|
79
|
+
var data = _ref2.data,
|
|
80
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
81
|
+
return /*#__PURE__*/React.createElement(Tree, _extends({
|
|
82
|
+
initialData: data
|
|
83
|
+
}, props, {
|
|
84
|
+
overscanCount: 5,
|
|
85
|
+
rowHeight: 32,
|
|
86
|
+
indent: 14
|
|
87
|
+
}), Node);
|
|
88
|
+
};
|
|
89
|
+
TreeNav.propTypes = {
|
|
90
|
+
data: PropTypes.array
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** @component */
|
|
94
|
+
TreeNav.__docgenInfo = {
|
|
95
|
+
"description": "",
|
|
96
|
+
"methods": [],
|
|
97
|
+
"displayName": "TreeNav",
|
|
98
|
+
"props": {
|
|
99
|
+
"data": {
|
|
100
|
+
"description": "",
|
|
101
|
+
"type": {
|
|
102
|
+
"name": "array"
|
|
103
|
+
},
|
|
104
|
+
"required": false
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
export default TreeNav;
|
package/es/components.test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as components from ".";
|
|
2
2
|
test("all components exported", function () {
|
|
3
|
-
expect(Object.keys(components)).toMatchInlineSnapshot("\n Array [\n \"ActionsMenu\",\n \"ActionsMenuBody\",\n \"ActionsMenuHeading\",\n \"ActionsMenuItem\",\n \"Avatar\",\n \"Badge\",\n \"Box\",\n \"Button\",\n \"ButtonGroupContainer\",\n \"ButtonGroupItem\",\n \"Card\",\n \"Checkbox\",\n \"Code\",\n \"DatePicker\",\n \"Divider\",\n \"Expandable\",\n \"Flex\",\n \"FlexItem\",\n \"GlobalStyles\",\n \"Grid\",\n \"GridItem\",\n \"H1\",\n \"H2\",\n \"H3\",\n \"H4\",\n \"H5\",\n \"H6\",\n \"Header\",\n \"HeaderSimple\",\n \"Icon\",\n \"Loading\",\n \"Modal\",\n \"Notification\",\n \"P\",\n \"Popover\",\n \"ProgressBar\",\n \"Quote\",\n \"RadioButton\",\n \"Range\",\n \"Select\",\n \"SideNav\",\n \"Sidebar\",\n \"SidebarClose\",\n \"SidebarPanel\",\n \"SidebarPanels\",\n \"SidebarTab\",\n \"SidebarTabs\",\n \"Small\",\n \"Spacer\",\n \"StatusDot\",\n \"StyledLink\",\n \"SystemThemeProvider\",\n \"Tab\",\n \"TabsContainer\",\n \"Tag\",\n \"Text\",\n \"TextArea\",\n \"TextInput\",\n \"Toggle\",\n \"Typography\",\n \"getOptionByValue\",\n \"styleLink\",\n \"systemThemeCollapsed\",\n \"systemtheme\",\n ]\n ");
|
|
3
|
+
expect(Object.keys(components)).toMatchInlineSnapshot("\n Array [\n \"ActionsMenu\",\n \"ActionsMenuBody\",\n \"ActionsMenuHeading\",\n \"ActionsMenuItem\",\n \"Avatar\",\n \"Badge\",\n \"Box\",\n \"Button\",\n \"ButtonGroupContainer\",\n \"ButtonGroupItem\",\n \"Card\",\n \"Checkbox\",\n \"Code\",\n \"DatePicker\",\n \"Divider\",\n \"Expandable\",\n \"Flex\",\n \"FlexItem\",\n \"GlobalStyles\",\n \"Grid\",\n \"GridItem\",\n \"H1\",\n \"H2\",\n \"H3\",\n \"H4\",\n \"H5\",\n \"H6\",\n \"Header\",\n \"HeaderSimple\",\n \"Icon\",\n \"Loading\",\n \"Modal\",\n \"Notification\",\n \"P\",\n \"Popover\",\n \"ProgressBar\",\n \"Quote\",\n \"RadioButton\",\n \"Range\",\n \"Select\",\n \"SideNav\",\n \"Sidebar\",\n \"SidebarClose\",\n \"SidebarPanel\",\n \"SidebarPanels\",\n \"SidebarTab\",\n \"SidebarTabs\",\n \"Small\",\n \"Spacer\",\n \"StatusDot\",\n \"StyledLink\",\n \"SystemThemeProvider\",\n \"Tab\",\n \"TabsContainer\",\n \"Tag\",\n \"Text\",\n \"TextArea\",\n \"TextInput\",\n \"Toggle\",\n \"TreeNav\",\n \"Typography\",\n \"getOptionByValue\",\n \"styleLink\",\n \"systemThemeCollapsed\",\n \"systemtheme\",\n ]\n ");
|
|
4
4
|
});
|
package/es/index.js
CHANGED
|
@@ -41,5 +41,6 @@ export { default as Tag } from "./components/Tag";
|
|
|
41
41
|
export { default as TextInput } from "./components/TextInput";
|
|
42
42
|
export { default as TextArea } from "./components/TextArea";
|
|
43
43
|
export { default as Toggle } from "./components/Toggle";
|
|
44
|
+
export { default as TreeNav } from "./components/TreeNav";
|
|
44
45
|
export { default as Typography, H1, H2, H3, H4, H5, H6, P, Text, Small, Quote, Code } from "./components/Typography";
|
|
45
46
|
export { default as getOptionByValue } from "./utils/selectUtil";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orcs-design-system",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "18.17.1"
|
|
6
6
|
},
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"polished": "^3.7.1",
|
|
52
52
|
"prop-types": "^15.6.2",
|
|
53
53
|
"react-app-polyfill": "^2.0.0",
|
|
54
|
+
"react-arborist": "^3.2.0",
|
|
54
55
|
"react-cool-onclickoutside": "^1.5.9",
|
|
55
56
|
"react-dates": "^21.8.0",
|
|
56
57
|
"react-docgen": "^5.3.0",
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
"@fortawesome/react-fontawesome": "^0.1.14",
|
|
78
79
|
"@mdx-js/loader": "^2.3.0",
|
|
79
80
|
"@mdx-js/react": "^2.3.0",
|
|
80
|
-
"@storybook/addon-a11y": "^7.
|
|
81
|
+
"@storybook/addon-a11y": "^7.5.0",
|
|
81
82
|
"@storybook/addon-actions": "^7.3.2",
|
|
82
83
|
"@storybook/addon-docs": "^7.3.2",
|
|
83
84
|
"@storybook/addon-knobs": "^7.0.2",
|