orcs-design-system 2.1.24 → 2.1.26
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 +32 -2
- package/es/components/ActionsMenu/ActionsMenu.stories.js +1 -0
- package/es/components/ActionsMenu/index.js +43 -8
- package/es/components/Avatar/Avatar.stories.js +38 -8
- package/es/components/Avatar/index.js +80 -19
- package/es/components/Card/Card.stories.js +1 -0
- package/es/components/Expandable/index.js +13 -5
- package/es/components/Header/Header.stories.js +40 -0
- package/es/components/Header/index.js +49 -12
- package/es/components/HeaderSimple/HeaderSimple.stories.js +50 -0
- package/es/components/HeaderSimple/index.js +224 -0
- package/es/components/Icon/Icon.stories.js +36 -18
- package/es/components/Icon/index.js +15 -3
- package/es/components/Loading/index.js +20 -2
- package/es/components/Notification/index.js +4 -2
- package/es/components/ProgressBar/ProgressBar.stories.js +5 -0
- package/es/components/ProgressBar/index.js +24 -3
- package/es/components/Range/Range.stories.js +3 -1
- package/es/components/Range/index.js +23 -5
- package/es/components/SideNav/SideNav.stories.js +93 -0
- package/es/components/SideNav/index.js +528 -0
- package/es/components/Sidebar/Sidebar.stories.js +7 -3
- package/es/components/Sidebar/index.js +11 -3
- package/es/components/Tabs/index.js +10 -2
- package/es/components/Tag/Tag.stories.js +23 -6
- package/es/components/Tag/index.js +8 -2
- package/es/components/TextInput/index.js +8 -2
- package/es/components.test.js +1 -1
- package/es/index.js +2 -0
- package/package.json +1 -3
package/es/GlobalStyles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
|
|
3
3
|
function _templateObject() {
|
|
4
|
-
var data = _taggedTemplateLiteral(["\n/* apply a natural box layout model to all elements, but allowing components to change */\nhtml {\n box-sizing: border-box;\n line-height: 1.15;\n line-height: calc(2px + 2ex + 2px);\n}\nhtml * {\n line-height: calc(2px + 2ex + 2px);\n}\n*, *:before, *:after {\n box-sizing: inherit;\n}\nhtml,\nbody {\n height: 100%;\n width: 100%;\n margin: ", ";\n}\nbody {\n font-family: ", ";\n color: ", ";\n}\n/* set rem text size and styling */\nhtml { font-size: 62.5%; }\nbody {\n font-size: ", "; // equivalent to 16px (or 14px with collapsed theme) because of % change to html font size above\n}\nmain {\n display: flex;\n\talign-items: stretch;\n\talign-content: stretch;\n\twidth: 100%;\n}\nsection {\n height:
|
|
4
|
+
var data = _taggedTemplateLiteral(["\n/* apply a natural box layout model to all elements, but allowing components to change */\nhtml {\n box-sizing: border-box;\n line-height: 1.15;\n line-height: calc(2px + 2ex + 2px);\n}\nhtml * {\n line-height: calc(2px + 2ex + 2px);\n}\n*, *:before, *:after {\n box-sizing: inherit;\n}\nhtml,\nbody {\n height: 100%;\n width: 100%;\n margin: ", ";\n}\nbody {\n font-family: ", ";\n color: ", ";\n}\n/* set rem text size and styling */\nhtml { font-size: 62.5%; }\nbody {\n font-size: ", "; // equivalent to 16px (or 14px with collapsed theme) because of % change to html font size above\n}\nmain {\n display: flex;\n\talign-items: stretch;\n\talign-content: stretch;\n\twidth: 100%;\n}\nsection {\n height: ", ";\n width: 100%;\n overflow-y: scroll;\n}\nimg {\n border-style: none;\n}\nsmall {\n font-size: 80%;\n}\np {\n margin: ", ";\n}\nh1, h2, h3, h4, h5, h6 {\n font-weight: ", ";\n font-family: ", ";\n margin: ", ";\n}\nh1 {\n font-size: ", "\n}\nh2 {\n font-size: ", "\n}\nh3 {\n font-size: ", "\n}\nh4 {\n font-size: ", "\n}\nh5 {\n font-size: ", "\n}\nh6 {\n font-size: ", "\n}\na,\np,\nsmall,\nli,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n word-break: break-word;\n}\n"]);
|
|
5
5
|
|
|
6
6
|
_templateObject = function _templateObject() {
|
|
7
7
|
return data;
|
|
@@ -14,5 +14,35 @@ import { createGlobalStyle } from "styled-components";
|
|
|
14
14
|
import { themeGet } from "@styled-system/theme-get"; // GLOBAL STYLES
|
|
15
15
|
// For browser reset, setting global box sizing and font sizing etc.
|
|
16
16
|
|
|
17
|
-
var GlobalStyles = createGlobalStyle(_templateObject(),
|
|
17
|
+
var GlobalStyles = createGlobalStyle(_templateObject(), function (props) {
|
|
18
|
+
return themeGet("space.0")(props);
|
|
19
|
+
}, function (props) {
|
|
20
|
+
return themeGet("fonts.main")(props);
|
|
21
|
+
}, function (props) {
|
|
22
|
+
return themeGet("colors.greyDarkest")(props);
|
|
23
|
+
}, function (props) {
|
|
24
|
+
return themeGet("fontSizes.2")(props);
|
|
25
|
+
}, function (props) {
|
|
26
|
+
return themeGet("appScale.navBarSize")(props);
|
|
27
|
+
}, function (props) {
|
|
28
|
+
return themeGet("space.0")(props);
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return themeGet("fontWeights.1")(props);
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return themeGet("fonts.main")(props);
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return themeGet("space.0")(props);
|
|
35
|
+
}, function (props) {
|
|
36
|
+
return themeGet("fontSizes.6")(props);
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return themeGet("fontSizes.5")(props);
|
|
39
|
+
}, function (props) {
|
|
40
|
+
return themeGet("fontSizes.4")(props);
|
|
41
|
+
}, function (props) {
|
|
42
|
+
return themeGet("fontSizes.3")(props);
|
|
43
|
+
}, function (props) {
|
|
44
|
+
return themeGet("fontSizes.2")(props);
|
|
45
|
+
}, function (props) {
|
|
46
|
+
return themeGet("fontSizes.1")(props);
|
|
47
|
+
});
|
|
18
48
|
export default GlobalStyles;
|
|
@@ -41,6 +41,7 @@ export var leftOffsetActionsMenu = function leftOffsetActionsMenu() {
|
|
|
41
41
|
return /*#__PURE__*/React.createElement(Flex, {
|
|
42
42
|
justifyContent: "flex-end"
|
|
43
43
|
}, /*#__PURE__*/React.createElement(ActionsMenu, {
|
|
44
|
+
ariaLabel: "Options Menu",
|
|
44
45
|
direction: "left"
|
|
45
46
|
}, /*#__PURE__*/React.createElement(ActionsMenuItem, {
|
|
46
47
|
href: "https://orchestrated.io/"
|
|
@@ -46,7 +46,9 @@ var Icon = styled.div.withConfig({
|
|
|
46
46
|
var Menu = styled.div.withConfig({
|
|
47
47
|
displayName: "ActionsMenu__Menu",
|
|
48
48
|
componentId: "yvbni2-3"
|
|
49
|
-
})(["display:
|
|
49
|
+
})(["display:", ";position:absolute;left:", ";right:", ";top:", ";width:", ";z-index:5;background-color:", ";border-radius:", ";transform:scale(0);opacity:0;pointer-events:none;transform-origin:", ";transition:all 300ms;transition-timing-function:cubic-bezier(0,1.4,1,1);", ";"], function (props) {
|
|
50
|
+
return props.isOpen ? "block" : "none";
|
|
51
|
+
}, function (props) {
|
|
50
52
|
return props.menuLeftPosition ? props.menuLeftPosition : props.direction == "left" ? "auto" : "34px";
|
|
51
53
|
}, function (props) {
|
|
52
54
|
return props.menuRightPosition ? props.menuRightPosition : props.direction == "left" ? "34px" : "auto";
|
|
@@ -91,6 +93,8 @@ export var ActionsMenuItem = styled(function (props) {
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
return /*#__PURE__*/React.createElement(Component, newProps);
|
|
96
|
+
}).attrs({
|
|
97
|
+
role: "listitem"
|
|
94
98
|
}).withConfig({
|
|
95
99
|
displayName: "ActionsMenu__ActionsMenuItem",
|
|
96
100
|
componentId: "yvbni2-5"
|
|
@@ -134,7 +138,8 @@ export var ActionsMenuBody = function ActionsMenuBody(_ref) {
|
|
|
134
138
|
menuWidth = _ref.menuWidth,
|
|
135
139
|
customTriggerComponent = _ref.customTriggerComponent,
|
|
136
140
|
children = _ref.children,
|
|
137
|
-
|
|
141
|
+
ariaLabel = _ref.ariaLabel,
|
|
142
|
+
props = _objectWithoutProperties(_ref, ["theme", "onToggle", "toggleState", "direction", "menuTopPosition", "menuLeftPosition", "menuRightPosition", "menuWidth", "customTriggerComponent", "children", "ariaLabel"]);
|
|
138
143
|
|
|
139
144
|
var _useState = useState({
|
|
140
145
|
menuLeftPosition: menuLeftPosition,
|
|
@@ -180,10 +185,14 @@ export var ActionsMenuBody = function ActionsMenuBody(_ref) {
|
|
|
180
185
|
|
|
181
186
|
if (customTriggerComponent) {
|
|
182
187
|
triggerBtn = /*#__PURE__*/React.cloneElement(customTriggerComponent, {
|
|
183
|
-
onClick: onToggleInView
|
|
188
|
+
onClick: onToggleInView,
|
|
189
|
+
"aria-label": ariaLabel,
|
|
190
|
+
"aria-expanded": "".concat(toggleState)
|
|
184
191
|
});
|
|
185
192
|
} else {
|
|
186
193
|
triggerBtn = /*#__PURE__*/React.createElement(Control, {
|
|
194
|
+
"aria-label": ariaLabel,
|
|
195
|
+
"aria-expanded": "".concat(toggleState),
|
|
187
196
|
onClick: onToggleInView
|
|
188
197
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
189
198
|
isOpen: toggleState
|
|
@@ -197,7 +206,8 @@ export var ActionsMenuBody = function ActionsMenuBody(_ref) {
|
|
|
197
206
|
menuLeftPosition: menuPosition.menuLeftPosition,
|
|
198
207
|
menuRightPosition: menuPosition.menuRightPosition,
|
|
199
208
|
menuWidth: menuWidth,
|
|
200
|
-
ref: ref
|
|
209
|
+
ref: ref,
|
|
210
|
+
role: "list"
|
|
201
211
|
}, children));
|
|
202
212
|
return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
203
213
|
theme: theme
|
|
@@ -213,7 +223,8 @@ ActionsMenuBody.propTypes = {
|
|
|
213
223
|
menuWidth: PropTypes.string,
|
|
214
224
|
customTriggerComponent: PropTypes.node,
|
|
215
225
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
216
|
-
theme: PropTypes.object
|
|
226
|
+
theme: PropTypes.object,
|
|
227
|
+
ariaLabel: PropTypes.string
|
|
217
228
|
};
|
|
218
229
|
var ActionsMenu = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
219
230
|
var children = _ref2.children,
|
|
@@ -224,7 +235,9 @@ var ActionsMenu = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
224
235
|
theme = _ref2.theme,
|
|
225
236
|
_ref2$closeOnClick = _ref2.closeOnClick,
|
|
226
237
|
closeOnClick = _ref2$closeOnClick === void 0 ? true : _ref2$closeOnClick,
|
|
227
|
-
|
|
238
|
+
_ref2$ariaLabel = _ref2.ariaLabel,
|
|
239
|
+
ariaLabel = _ref2$ariaLabel === void 0 ? "Options Menu" : _ref2$ariaLabel,
|
|
240
|
+
props = _objectWithoutProperties(_ref2, ["children", "customTriggerComponent", "direction", "isOpen", "theme", "closeOnClick", "ariaLabel"]);
|
|
228
241
|
|
|
229
242
|
var _useState5 = useState(isOpen),
|
|
230
243
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
@@ -270,7 +283,8 @@ var ActionsMenu = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
270
283
|
toggleState: toggleState,
|
|
271
284
|
customTriggerComponent: customTriggerComponent,
|
|
272
285
|
direction: direction,
|
|
273
|
-
theme: theme
|
|
286
|
+
theme: theme,
|
|
287
|
+
ariaLabel: ariaLabel
|
|
274
288
|
}, props), children);
|
|
275
289
|
});
|
|
276
290
|
ActionsMenu.propTypes = {
|
|
@@ -281,7 +295,10 @@ ActionsMenu.propTypes = {
|
|
|
281
295
|
children: PropTypes.oneOfType([PropTypes.node, PropTypes.arrayOf(PropTypes.node)]),
|
|
282
296
|
|
|
283
297
|
/** Specifies the colour theme */
|
|
284
|
-
theme: PropTypes.object
|
|
298
|
+
theme: PropTypes.object,
|
|
299
|
+
|
|
300
|
+
/** Specifies the aria-label for the button */
|
|
301
|
+
ariaLabel: PropTypes.object
|
|
285
302
|
};
|
|
286
303
|
ActionsMenu.__docgenInfo = {
|
|
287
304
|
"description": "",
|
|
@@ -310,6 +327,17 @@ ActionsMenu.__docgenInfo = {
|
|
|
310
327
|
"required": false,
|
|
311
328
|
"description": ""
|
|
312
329
|
},
|
|
330
|
+
"ariaLabel": {
|
|
331
|
+
"defaultValue": {
|
|
332
|
+
"value": "\"Options Menu\"",
|
|
333
|
+
"computed": false
|
|
334
|
+
},
|
|
335
|
+
"type": {
|
|
336
|
+
"name": "object"
|
|
337
|
+
},
|
|
338
|
+
"required": false,
|
|
339
|
+
"description": "Specifies the aria-label for the button"
|
|
340
|
+
},
|
|
313
341
|
"direction": {
|
|
314
342
|
"type": {
|
|
315
343
|
"name": "string"
|
|
@@ -431,6 +459,13 @@ ActionsMenuBody.__docgenInfo = {
|
|
|
431
459
|
},
|
|
432
460
|
"required": false,
|
|
433
461
|
"description": ""
|
|
462
|
+
},
|
|
463
|
+
"ariaLabel": {
|
|
464
|
+
"type": {
|
|
465
|
+
"name": "string"
|
|
466
|
+
},
|
|
467
|
+
"required": false,
|
|
468
|
+
"description": ""
|
|
434
469
|
}
|
|
435
470
|
}
|
|
436
471
|
};
|
|
@@ -43,7 +43,8 @@ export var imageOnly = function imageOnly() {
|
|
|
43
43
|
return /*#__PURE__*/React.createElement(Spacer, {
|
|
44
44
|
my: 4
|
|
45
45
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
46
|
-
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png"
|
|
46
|
+
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
47
|
+
imageAlt: "Ayden Lundgre"
|
|
47
48
|
}));
|
|
48
49
|
};
|
|
49
50
|
imageOnly.storyName = "Image only";
|
|
@@ -63,7 +64,8 @@ export var nameLink = function nameLink() {
|
|
|
63
64
|
}, "Ayden Lundgre"),
|
|
64
65
|
subtitle: "Senior Business Analyst",
|
|
65
66
|
initials: "AL",
|
|
66
|
-
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png"
|
|
67
|
+
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
68
|
+
imageAlt: "Ayden Lundgre"
|
|
67
69
|
});
|
|
68
70
|
};
|
|
69
71
|
nameLink.storyName = "Name as link";
|
|
@@ -97,7 +99,8 @@ export var large = function large() {
|
|
|
97
99
|
my: 4
|
|
98
100
|
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
99
101
|
sizing: "large",
|
|
100
|
-
title: "Ayden Lundgre",
|
|
102
|
+
title: "Ayden Lundgre TESTER",
|
|
103
|
+
titleLevel: "H1",
|
|
101
104
|
subtitle: "Senior Business Analyst",
|
|
102
105
|
initials: "AL"
|
|
103
106
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
@@ -117,6 +120,18 @@ export var large = function large() {
|
|
|
117
120
|
}));
|
|
118
121
|
};
|
|
119
122
|
large.storyName = "Large";
|
|
123
|
+
export var titleLevel = function titleLevel() {
|
|
124
|
+
return /*#__PURE__*/React.createElement(Spacer, {
|
|
125
|
+
my: 4
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
127
|
+
sizing: "large",
|
|
128
|
+
title: "Ayden Lundgre",
|
|
129
|
+
titleLevel: "H1",
|
|
130
|
+
subtitle: "Senior Business Analyst",
|
|
131
|
+
initials: "AL"
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
titleLevel.storyName = "Title Level";
|
|
120
135
|
export var subtitleContent = function subtitleContent() {
|
|
121
136
|
return /*#__PURE__*/React.createElement(Spacer, {
|
|
122
137
|
my: 4
|
|
@@ -137,6 +152,7 @@ export var subtitleContent = function subtitleContent() {
|
|
|
137
152
|
}, "Ayden Lundgre"),
|
|
138
153
|
initials: "AL",
|
|
139
154
|
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
155
|
+
imageAlt: "Ayden Lundgre",
|
|
140
156
|
subtitleContent: /*#__PURE__*/React.createElement(Flex, {
|
|
141
157
|
flexWrap: "wrap"
|
|
142
158
|
}, /*#__PURE__*/React.createElement(Spacer, {
|
|
@@ -158,6 +174,7 @@ export var localTime = function localTime() {
|
|
|
158
174
|
}, "Ayden Lundgre"),
|
|
159
175
|
initials: "AL",
|
|
160
176
|
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
177
|
+
imageAlt: "Ayden Lundgre",
|
|
161
178
|
subtitleContent: /*#__PURE__*/React.createElement(Badge, {
|
|
162
179
|
mt: "xs"
|
|
163
180
|
}, "Senior Business Analyst"),
|
|
@@ -184,7 +201,8 @@ export var inverted = function inverted() {
|
|
|
184
201
|
}, "Ayden Lundgre"),
|
|
185
202
|
subtitle: "Senior Business Analyst",
|
|
186
203
|
initials: "AL",
|
|
187
|
-
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png"
|
|
204
|
+
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
205
|
+
imageAlt: "Ayden Lundgre"
|
|
188
206
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
189
207
|
type: "inverted",
|
|
190
208
|
sizing: "small",
|
|
@@ -201,7 +219,8 @@ export var inverted = function inverted() {
|
|
|
201
219
|
}, "Ayden Lundgre"),
|
|
202
220
|
subtitle: "Senior Business Analyst",
|
|
203
221
|
initials: "AL",
|
|
204
|
-
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png"
|
|
222
|
+
image: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
223
|
+
imageAlt: "Ayden Lundgre"
|
|
205
224
|
})));
|
|
206
225
|
};
|
|
207
226
|
inverted.storyName = "Inverted";
|
|
@@ -215,6 +234,7 @@ export var alternateShapes = function alternateShapes() {
|
|
|
215
234
|
}, "Innovation Lab"),
|
|
216
235
|
subtitle: "15 team members",
|
|
217
236
|
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
237
|
+
imageAlt: "Team Photo",
|
|
218
238
|
sizing: "large"
|
|
219
239
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
220
240
|
shape: "square",
|
|
@@ -222,7 +242,8 @@ export var alternateShapes = function alternateShapes() {
|
|
|
222
242
|
href: "#"
|
|
223
243
|
}, "Innovation Lab"),
|
|
224
244
|
subtitle: "15 team members",
|
|
225
|
-
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80"
|
|
245
|
+
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
246
|
+
imageAlt: "Team Photo"
|
|
226
247
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
227
248
|
shape: "square",
|
|
228
249
|
sizing: "small",
|
|
@@ -245,6 +266,7 @@ export var alternateShapes = function alternateShapes() {
|
|
|
245
266
|
}, "Innovation Lab"),
|
|
246
267
|
subtitle: "15 team members",
|
|
247
268
|
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
269
|
+
imageAlt: "Team Photo",
|
|
248
270
|
sizing: "large"
|
|
249
271
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
250
272
|
shape: "hexagon",
|
|
@@ -252,7 +274,8 @@ export var alternateShapes = function alternateShapes() {
|
|
|
252
274
|
href: "#"
|
|
253
275
|
}, "Innovation Lab"),
|
|
254
276
|
subtitle: "15 team members",
|
|
255
|
-
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80"
|
|
277
|
+
image: "https://images.unsplash.com/photo-1582213782179-e0d53f98f2ca?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2370&q=80",
|
|
278
|
+
imageAlt: "Team Photo"
|
|
256
279
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
257
280
|
shape: "hexagon",
|
|
258
281
|
sizing: "small",
|
|
@@ -275,6 +298,7 @@ export var alternateShapes = function alternateShapes() {
|
|
|
275
298
|
}, "Javascript"),
|
|
276
299
|
subtitle: "Tagged 123 times",
|
|
277
300
|
image: "https://images.unsplash.com/photo-1627398242454-45a1465c2479?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2148&q=80",
|
|
301
|
+
imageAlt: "Screen Photo",
|
|
278
302
|
sizing: "large"
|
|
279
303
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
280
304
|
shape: "tag",
|
|
@@ -282,7 +306,8 @@ export var alternateShapes = function alternateShapes() {
|
|
|
282
306
|
href: "#"
|
|
283
307
|
}, "Javascript"),
|
|
284
308
|
subtitle: "Tagged 123 times",
|
|
285
|
-
image: "https://images.unsplash.com/photo-1627398242454-45a1465c2479?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2148&q=80"
|
|
309
|
+
image: "https://images.unsplash.com/photo-1627398242454-45a1465c2479?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2148&q=80",
|
|
310
|
+
imageAlt: "Screen Photo"
|
|
286
311
|
}), /*#__PURE__*/React.createElement(Avatar, {
|
|
287
312
|
shape: "tag",
|
|
288
313
|
sizing: "small",
|
|
@@ -336,6 +361,11 @@ large.__docgenInfo = {
|
|
|
336
361
|
"methods": [],
|
|
337
362
|
"displayName": "large"
|
|
338
363
|
};
|
|
364
|
+
titleLevel.__docgenInfo = {
|
|
365
|
+
"description": "",
|
|
366
|
+
"methods": [],
|
|
367
|
+
"displayName": "titleLevel"
|
|
368
|
+
};
|
|
339
369
|
subtitleContent.__docgenInfo = {
|
|
340
370
|
"description": "",
|
|
341
371
|
"methods": [],
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useMemo } from "react";
|
|
4
4
|
import styled, { ThemeProvider } from "styled-components";
|
|
5
5
|
import { space, layout, variant } from "styled-system";
|
|
6
6
|
import PropTypes from "prop-types";
|
|
7
|
-
import {
|
|
7
|
+
import Header, { Text } from "../Typography";
|
|
8
8
|
import Icon from "../Icon";
|
|
9
9
|
import Popover from "../Popover";
|
|
10
10
|
import StatusDot from "../StatusDot";
|
|
@@ -183,7 +183,13 @@ var Shape = styled("div").withConfig({
|
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
});
|
|
186
|
-
var Title = styled(
|
|
186
|
+
var Title = styled(function (_ref) {
|
|
187
|
+
var titleLevel = _ref.titleLevel,
|
|
188
|
+
props = _objectWithoutProperties(_ref, ["titleLevel"]);
|
|
189
|
+
|
|
190
|
+
var Heading = Header[titleLevel];
|
|
191
|
+
return /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.createElement(Heading, null), props);
|
|
192
|
+
}).withConfig({
|
|
187
193
|
displayName: "Avatar__Title",
|
|
188
194
|
componentId: "sc-1wtet2j-4"
|
|
189
195
|
})(function (props) {
|
|
@@ -277,32 +283,43 @@ var LocalTime = styled(Popover).withConfig({
|
|
|
277
283
|
componentId: "sc-1wtet2j-6"
|
|
278
284
|
})(["position:absolute;top:0;left:0;"]);
|
|
279
285
|
|
|
280
|
-
var Avatar = function Avatar(
|
|
281
|
-
var sizing =
|
|
282
|
-
image =
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
var Avatar = function Avatar(_ref2) {
|
|
287
|
+
var sizing = _ref2.sizing,
|
|
288
|
+
image = _ref2.image,
|
|
289
|
+
imageAlt = _ref2.imageAlt,
|
|
290
|
+
initials = _ref2.initials,
|
|
291
|
+
title = _ref2.title,
|
|
292
|
+
_ref2$titleLevel = _ref2.titleLevel,
|
|
293
|
+
titleLevel = _ref2$titleLevel === void 0 ? "H3" : _ref2$titleLevel,
|
|
294
|
+
subtitle = _ref2.subtitle,
|
|
295
|
+
subtitleContent = _ref2.subtitleContent,
|
|
296
|
+
type = _ref2.type,
|
|
297
|
+
theme = _ref2.theme,
|
|
298
|
+
shape = _ref2.shape,
|
|
299
|
+
localTime = _ref2.localTime,
|
|
300
|
+
_ref2$uppercase = _ref2.uppercase,
|
|
301
|
+
uppercase = _ref2$uppercase === void 0 ? true : _ref2$uppercase,
|
|
302
|
+
whiteInitials = _ref2.whiteInitials,
|
|
303
|
+
props = _objectWithoutProperties(_ref2, ["sizing", "image", "imageAlt", "initials", "title", "titleLevel", "subtitle", "subtitleContent", "type", "theme", "shape", "localTime", "uppercase", "whiteInitials"]);
|
|
295
304
|
|
|
296
305
|
var hasTitle = !!title;
|
|
297
306
|
var hasSubtitle = !!subtitle;
|
|
298
307
|
var hasSubtitleContent = !!subtitleContent;
|
|
308
|
+
var alt = useMemo(function () {
|
|
309
|
+
if (imageAlt) {
|
|
310
|
+
return imageAlt;
|
|
311
|
+
} else if (typeof title === "string") {
|
|
312
|
+
return title;
|
|
313
|
+
}
|
|
314
|
+
}, [imageAlt, title]);
|
|
299
315
|
var component = /*#__PURE__*/React.createElement(AvatarWrapper, _extends({}, props, {
|
|
300
316
|
type: type,
|
|
301
317
|
sizing: sizing
|
|
302
318
|
}), image ? /*#__PURE__*/React.createElement(Image, {
|
|
303
319
|
src: image,
|
|
304
320
|
sizing: sizing,
|
|
305
|
-
shape: shape
|
|
321
|
+
shape: shape,
|
|
322
|
+
alt: alt
|
|
306
323
|
}) : /*#__PURE__*/React.createElement(Shape, {
|
|
307
324
|
shape: shape,
|
|
308
325
|
sizing: sizing,
|
|
@@ -323,6 +340,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
323
340
|
sizing: sizing,
|
|
324
341
|
theme: theme
|
|
325
342
|
}, hasTitle && /*#__PURE__*/React.createElement(Title, {
|
|
343
|
+
titleLevel: titleLevel,
|
|
326
344
|
type: type,
|
|
327
345
|
sizing: sizing,
|
|
328
346
|
theme: theme
|
|
@@ -360,6 +378,9 @@ Avatar.propTypes = {
|
|
|
360
378
|
/** Specifies a source path for an image */
|
|
361
379
|
image: PropTypes.string,
|
|
362
380
|
|
|
381
|
+
/** Specifies the alt text for an image */
|
|
382
|
+
imageAlt: PropTypes.string,
|
|
383
|
+
|
|
363
384
|
/** Specifies initials of person if available */
|
|
364
385
|
initials: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
365
386
|
|
|
@@ -375,6 +396,9 @@ Avatar.propTypes = {
|
|
|
375
396
|
/** Specifies title / name as just plain text, or an element like a hyperlink or react router link */
|
|
376
397
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
377
398
|
|
|
399
|
+
/** Specifies the component to wrap the heading, defaults to H3 */
|
|
400
|
+
titleLevel: PropTypes.oneOf(["H1", "H2", "H3", "H4", "H5", "H6"]),
|
|
401
|
+
|
|
378
402
|
/** Specifies subtitle / role */
|
|
379
403
|
subtitle: PropTypes.string,
|
|
380
404
|
|
|
@@ -389,6 +413,36 @@ Avatar.__docgenInfo = {
|
|
|
389
413
|
"methods": [],
|
|
390
414
|
"displayName": "Avatar",
|
|
391
415
|
"props": {
|
|
416
|
+
"titleLevel": {
|
|
417
|
+
"defaultValue": {
|
|
418
|
+
"value": "\"H3\"",
|
|
419
|
+
"computed": false
|
|
420
|
+
},
|
|
421
|
+
"type": {
|
|
422
|
+
"name": "enum",
|
|
423
|
+
"value": [{
|
|
424
|
+
"value": "\"H1\"",
|
|
425
|
+
"computed": false
|
|
426
|
+
}, {
|
|
427
|
+
"value": "\"H2\"",
|
|
428
|
+
"computed": false
|
|
429
|
+
}, {
|
|
430
|
+
"value": "\"H3\"",
|
|
431
|
+
"computed": false
|
|
432
|
+
}, {
|
|
433
|
+
"value": "\"H4\"",
|
|
434
|
+
"computed": false
|
|
435
|
+
}, {
|
|
436
|
+
"value": "\"H5\"",
|
|
437
|
+
"computed": false
|
|
438
|
+
}, {
|
|
439
|
+
"value": "\"H6\"",
|
|
440
|
+
"computed": false
|
|
441
|
+
}]
|
|
442
|
+
},
|
|
443
|
+
"required": false,
|
|
444
|
+
"description": "Specifies the component to wrap the heading, defaults to H3"
|
|
445
|
+
},
|
|
392
446
|
"uppercase": {
|
|
393
447
|
"defaultValue": {
|
|
394
448
|
"value": "true",
|
|
@@ -458,6 +512,13 @@ Avatar.__docgenInfo = {
|
|
|
458
512
|
"required": false,
|
|
459
513
|
"description": "Specifies a source path for an image"
|
|
460
514
|
},
|
|
515
|
+
"imageAlt": {
|
|
516
|
+
"type": {
|
|
517
|
+
"name": "string"
|
|
518
|
+
},
|
|
519
|
+
"required": false,
|
|
520
|
+
"description": "Specifies the alt text for an image"
|
|
521
|
+
},
|
|
461
522
|
"initials": {
|
|
462
523
|
"type": {
|
|
463
524
|
"name": "union",
|
|
@@ -30,6 +30,7 @@ export var basicCard = function basicCard() {
|
|
|
30
30
|
}, /*#__PURE__*/React.createElement(P, {
|
|
31
31
|
marginBottom: 4
|
|
32
32
|
}, "Card content lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."), /*#__PURE__*/React.createElement(StyledLink, {
|
|
33
|
+
"aria-label": "Card title - Learn More",
|
|
33
34
|
href: "#",
|
|
34
35
|
bold: true
|
|
35
36
|
}, "Learn more"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import React, { useState } from "react";
|
|
3
|
+
import React, { useMemo, useState } from "react";
|
|
4
4
|
import styled, { ThemeProvider } from "styled-components";
|
|
5
5
|
import PropTypes from "prop-types";
|
|
6
6
|
import Flex from "../Flex";
|
|
@@ -47,9 +47,13 @@ var Text = styled.div.withConfig({
|
|
|
47
47
|
displayName: "Expandable__Text",
|
|
48
48
|
componentId: "na4gdb-2"
|
|
49
49
|
})(["padding-right:18px;"]);
|
|
50
|
+
var SubTitle = styled(Typography.Small).withConfig({
|
|
51
|
+
displayName: "Expandable__SubTitle",
|
|
52
|
+
componentId: "na4gdb-3"
|
|
53
|
+
})(["display:block;"]);
|
|
50
54
|
var Content = styled.div.withConfig({
|
|
51
55
|
displayName: "Expandable__Content",
|
|
52
|
-
componentId: "na4gdb-
|
|
56
|
+
componentId: "na4gdb-4"
|
|
53
57
|
})(["padding:", ";transition:", ";display:", ";"], function (props) {
|
|
54
58
|
return themeGet("space.r")(props);
|
|
55
59
|
}, function (props) {
|
|
@@ -86,12 +90,16 @@ export default function Expandable(_ref) {
|
|
|
86
90
|
toggleState = _useState4[0],
|
|
87
91
|
setToggle = _useState4[1];
|
|
88
92
|
|
|
93
|
+
var Heading = useMemo(function () {
|
|
94
|
+
return small ? Typography.H5 : Typography.H4;
|
|
95
|
+
}, [small]);
|
|
96
|
+
|
|
89
97
|
var onToggle = function onToggle() {
|
|
90
98
|
if (!toggleState) setToggle(true);else setToggle(false);
|
|
91
99
|
if (!baseState) setBase(true);else setBase(false);
|
|
92
100
|
};
|
|
93
101
|
|
|
94
|
-
var component = /*#__PURE__*/React.createElement(Item, props, /*#__PURE__*/React.createElement(Button, {
|
|
102
|
+
var component = /*#__PURE__*/React.createElement(Item, props, /*#__PURE__*/React.createElement(Heading, null, /*#__PURE__*/React.createElement(Button, {
|
|
95
103
|
open: baseState,
|
|
96
104
|
small: small,
|
|
97
105
|
"aria-expanded": baseState,
|
|
@@ -99,11 +107,11 @@ export default function Expandable(_ref) {
|
|
|
99
107
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
100
108
|
alignItems: "center",
|
|
101
109
|
justifyContent: "space-between"
|
|
102
|
-
}, /*#__PURE__*/React.createElement(Text, null,
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Text, null, title, subtitle && /*#__PURE__*/React.createElement(SubTitle, {
|
|
103
111
|
grey: true
|
|
104
112
|
}, subtitle)), badge && /*#__PURE__*/React.createElement(Badge, {
|
|
105
113
|
variant: badgeColour
|
|
106
|
-
}, badge))), /*#__PURE__*/React.createElement(Content, {
|
|
114
|
+
}, badge)))), /*#__PURE__*/React.createElement(Content, {
|
|
107
115
|
open: baseState,
|
|
108
116
|
expanded: toggleState
|
|
109
117
|
}, children));
|
|
@@ -72,6 +72,41 @@ export var headerWithSearch = function headerWithSearch() {
|
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
headerWithSearch.storyName = "Alternative Header with search";
|
|
75
|
+
export var headerWithSearchAndLinks = function headerWithSearchAndLinks() {
|
|
76
|
+
return /*#__PURE__*/React.createElement(Header, {
|
|
77
|
+
variant: "searchAndLinks",
|
|
78
|
+
appName: "App Name",
|
|
79
|
+
userName: "Michael",
|
|
80
|
+
avatarSource: "https://uploads-ssl.webflow.com/5f4852427e784b4cada3e0d0/62f1f587bc47b25676f9ed1d_bw_avatar_adam.png",
|
|
81
|
+
logoutFunction: action("clicked-logout"),
|
|
82
|
+
searchComponent: /*#__PURE__*/React.createElement(TextInput, {
|
|
83
|
+
fullWidth: true,
|
|
84
|
+
id: "search",
|
|
85
|
+
key: "search",
|
|
86
|
+
type: "text",
|
|
87
|
+
placeholder: "Search for...",
|
|
88
|
+
iconRight: ["fas", "search"]
|
|
89
|
+
}),
|
|
90
|
+
navToggleId: "headerWithSearchAndLinks"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(StyledLink, {
|
|
92
|
+
href: "#",
|
|
93
|
+
white: true,
|
|
94
|
+
bold: true
|
|
95
|
+
}, "Summary"), /*#__PURE__*/React.createElement(StyledLink, {
|
|
96
|
+
href: "#",
|
|
97
|
+
white: true,
|
|
98
|
+
bold: true
|
|
99
|
+
}, "Teams"), /*#__PURE__*/React.createElement(StyledLink, {
|
|
100
|
+
href: "#",
|
|
101
|
+
white: true,
|
|
102
|
+
bold: true
|
|
103
|
+
}, "People"), /*#__PURE__*/React.createElement(StyledLink, {
|
|
104
|
+
href: "#",
|
|
105
|
+
white: true,
|
|
106
|
+
bold: true
|
|
107
|
+
}, "Reports"));
|
|
108
|
+
};
|
|
109
|
+
headerWithSearch.storyName = "Alternative Header with search";
|
|
75
110
|
export var headerWithWorkspaceSwitching = function headerWithWorkspaceSwitching() {
|
|
76
111
|
var options = [{
|
|
77
112
|
label: "Workspace A"
|
|
@@ -138,6 +173,11 @@ headerWithSearch.__docgenInfo = {
|
|
|
138
173
|
"methods": [],
|
|
139
174
|
"displayName": "headerWithSearch"
|
|
140
175
|
};
|
|
176
|
+
headerWithSearchAndLinks.__docgenInfo = {
|
|
177
|
+
"description": "",
|
|
178
|
+
"methods": [],
|
|
179
|
+
"displayName": "headerWithSearchAndLinks"
|
|
180
|
+
};
|
|
141
181
|
headerWithWorkspaceSwitching.__docgenInfo = {
|
|
142
182
|
"description": "",
|
|
143
183
|
"methods": [],
|