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.
Files changed (96) hide show
  1. package/es/GlobalStyles.js +1 -31
  2. package/es/SystemThemeProvider.js +11 -5
  3. package/es/assets/Colour/Colour.stories.js +211 -0
  4. package/es/assets/Colour/index.js +3 -3
  5. package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
  6. package/es/components/ActionsMenu/index.js +144 -229
  7. package/es/components/Avatar/Avatar.stories.js +212 -196
  8. package/es/components/Avatar/index.js +280 -307
  9. package/es/components/Badge/Badge.stories.js +71 -46
  10. package/es/components/Badge/index.js +71 -74
  11. package/es/components/Box/Box.stories.js +51 -35
  12. package/es/components/Box/index.js +33 -34
  13. package/es/components/Button/Button.stories.js +161 -145
  14. package/es/components/Button/ButtonLink.stories.js +152 -139
  15. package/es/components/Button/index.js +79 -99
  16. package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
  17. package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
  18. package/es/components/ButtonGroup/index.js +103 -99
  19. package/es/components/Card/Card.stories.js +94 -62
  20. package/es/components/Card/index.js +50 -71
  21. package/es/components/Checkbox/Checkbox.stories.js +37 -43
  22. package/es/components/Checkbox/index.js +61 -76
  23. package/es/components/DatePicker/DatePicker.stories.js +86 -118
  24. package/es/components/DatePicker/index.js +71 -187
  25. package/es/components/Divider/Divider.stories.js +39 -42
  26. package/es/components/Divider/index.js +21 -27
  27. package/es/components/Expandable/Expandable.stories.js +46 -36
  28. package/es/components/Expandable/index.js +55 -82
  29. package/es/components/Flex/Flex.stories.js +19 -5
  30. package/es/components/Flex/FlexItem.stories.js +10 -9
  31. package/es/components/Flex/index.js +34 -27
  32. package/es/components/Grid/Grid.stories.js +129 -55
  33. package/es/components/Grid/index.js +25 -24
  34. package/es/components/Header/Header.stories.js +101 -92
  35. package/es/components/Header/index.js +433 -436
  36. package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
  37. package/es/components/HeaderSimple/index.js +73 -68
  38. package/es/components/Icon/Icon.stories.js +58 -57
  39. package/es/components/Icon/index.js +48 -46
  40. package/es/components/Loading/Loading.stories.js +32 -39
  41. package/es/components/Loading/index.js +44 -51
  42. package/es/components/Modal/Modal.stories.js +172 -153
  43. package/es/components/Modal/index.js +126 -134
  44. package/es/components/Notification/Notification.stories.js +59 -58
  45. package/es/components/Notification/index.js +123 -133
  46. package/es/components/Popover/Popover.stories.js +134 -102
  47. package/es/components/Popover/index.js +65 -111
  48. package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
  49. package/es/components/ProgressBar/index.js +29 -34
  50. package/es/components/RadioButton/RadioButton.stories.js +32 -37
  51. package/es/components/RadioButton/index.js +170 -184
  52. package/es/components/Range/Range.stories.js +19 -19
  53. package/es/components/Range/index.js +35 -45
  54. package/es/components/Select/Select.stories.js +107 -128
  55. package/es/components/Select/index.js +324 -336
  56. package/es/components/SideNav/NavItem.js +112 -122
  57. package/es/components/SideNav/SideNav.stories.js +84 -57
  58. package/es/components/SideNav/index.js +161 -185
  59. package/es/components/Sidebar/Sidebar.stories.js +50 -33
  60. package/es/components/Sidebar/index.js +152 -155
  61. package/es/components/Spacer/Spacer.stories.js +35 -32
  62. package/es/components/Spacer/index.js +20 -20
  63. package/es/components/StatusDot/StatusDot.stories.js +103 -90
  64. package/es/components/StatusDot/index.js +36 -38
  65. package/es/components/StyledLink/StyledLink.stories.js +68 -69
  66. package/es/components/StyledLink/index.js +47 -48
  67. package/es/components/Table/Table.stories.js +118 -112
  68. package/es/components/Table/getExpandColumnConfig.js +67 -62
  69. package/es/components/Table/index.js +24 -27
  70. package/es/components/Table/muiStyleOverrides.js +10 -8
  71. package/es/components/Tabs/Tab.stories.js +55 -38
  72. package/es/components/Tabs/TabsContainer.stories.js +30 -22
  73. package/es/components/Tabs/index.js +95 -92
  74. package/es/components/Tag/Tag.stories.js +250 -220
  75. package/es/components/Tag/index.js +118 -190
  76. package/es/components/TextArea/TextArea.stories.js +76 -89
  77. package/es/components/TextArea/index.js +117 -115
  78. package/es/components/TextInput/TextInput.stories.js +41 -61
  79. package/es/components/TextInput/index.js +127 -171
  80. package/es/components/Toggle/Toggle.stories.js +63 -62
  81. package/es/components/Toggle/index.js +43 -77
  82. package/es/components/TreeNav/TreeNav.stories.js +7 -8
  83. package/es/components/TreeNav/index.js +72 -69
  84. package/es/components/Typography/Typography.stories.js +174 -0
  85. package/es/components/Typography/index.js +252 -308
  86. package/es/components.test.js +1 -1
  87. package/es/hooks/isVisible.js +6 -10
  88. package/es/hooks/keepInView.js +27 -32
  89. package/es/hooks/keypress.js +14 -14
  90. package/es/hooks/useInputFocus.js +5 -5
  91. package/es/hooks/usePrevious.js +3 -3
  92. package/es/systemThemeCollapsed.js +53 -53
  93. package/es/systemtheme.js +53 -53
  94. package/es/utils/selectUtil.js +1 -1
  95. package/es/utils/selectUtil.test.js +6 -6
  96. 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 _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["titleLevel"],
5
- _excluded2 = ["sizing", "image", "imageAlt", "initials", "title", "titleLevel", "subtitle", "subtitleContent", "type", "theme", "shape", "localTime", "uppercase", "whiteInitials"];
6
1
  import React, { useMemo } from "react";
7
2
  import styled, { ThemeProvider } from "styled-components";
8
3
  import { space, layout, variant } from "styled-system";
@@ -13,7 +8,8 @@ import Popover from "../Popover";
13
8
  import StatusDot from "../StatusDot";
14
9
  import css from "@styled-system/css";
15
10
  import { themeGet } from "@styled-system/theme-get";
16
- var AvatarWrapper = styled("div").withConfig({
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ const AvatarWrapper = styled("div").withConfig({
17
13
  displayName: "Avatar__AvatarWrapper",
18
14
  componentId: "sc-1wtet2j-0"
19
15
  })(layout, space, css({
@@ -21,350 +17,327 @@ var AvatarWrapper = styled("div").withConfig({
21
17
  position: "relative",
22
18
  display: "flex",
23
19
  alignItems: "center"
24
- }), function (props) {
25
- return variant({
26
- prop: "sizing",
27
- variants: {
28
- small: {
29
- fontSize: themeGet("fontSizes.1")(props)
30
- },
31
- large: {
32
- fontSize: themeGet("fontSizes.2")(props)
33
- },
34
- "default": {}
35
- }
36
- });
37
- }, variant({
20
+ }), props => variant({
21
+ prop: "sizing",
22
+ variants: {
23
+ small: {
24
+ fontSize: themeGet("fontSizes.1")(props)
25
+ },
26
+ large: {
27
+ fontSize: themeGet("fontSizes.2")(props)
28
+ },
29
+ default: {}
30
+ }
31
+ }), variant({
38
32
  prop: "type",
39
33
  variants: {
40
34
  inverted: {}
41
35
  }
42
36
  }));
43
- var TextContent = styled("div").withConfig({
37
+ const TextContent = styled("div").withConfig({
44
38
  displayName: "Avatar__TextContent",
45
39
  componentId: "sc-1wtet2j-1"
46
40
  })(css({
47
41
  marginLeft: 3,
48
42
  lineHeight: "0.8"
49
- }), function (props) {
50
- return variant({
51
- prop: "sizing",
52
- variants: {
53
- small: {
54
- fontSize: themeGet("fontSizes.1")(props)
55
- },
56
- large: {
57
- marginLeft: "16px",
58
- fontSize: themeGet("fontSizes.2")(props)
59
- }
43
+ }), props => variant({
44
+ prop: "sizing",
45
+ variants: {
46
+ small: {
47
+ fontSize: themeGet("fontSizes.1")(props)
48
+ },
49
+ large: {
50
+ marginLeft: "16px",
51
+ fontSize: themeGet("fontSizes.2")(props)
60
52
  }
61
- });
62
- }, function (props) {
63
- return variant({
64
- prop: "type",
65
- variants: {
66
- inverted: {
67
- color: themeGet("colors.white")(props)
68
- }
53
+ }
54
+ }), props => variant({
55
+ prop: "type",
56
+ variants: {
57
+ inverted: {
58
+ color: themeGet("colors.white")(props)
69
59
  }
70
- });
71
- });
72
- var Image = styled("img").withConfig({
60
+ }
61
+ }));
62
+ const Image = styled("img").withConfig({
73
63
  displayName: "Avatar__Image",
74
64
  componentId: "sc-1wtet2j-2"
75
- })(function (props) {
76
- return css({
77
- width: themeGet("appScale.avatarDefault")(props),
78
- height: themeGet("appScale.avatarDefault")(props),
79
- flex: "0 0 auto",
80
- backgroundColor: themeGet("colors.greyLighter")(props),
81
- border: "0",
82
- display: "block",
83
- borderRadius: "50%"
84
- });
85
- }, function (props) {
86
- return variant({
87
- prop: "sizing",
88
- variants: {
89
- small: {
90
- width: themeGet("appScale.avatarSmall")(props),
91
- height: themeGet("appScale.avatarSmall")(props)
92
- },
93
- large: {
94
- width: themeGet("appScale.avatarLarge")(props),
95
- height: themeGet("appScale.avatarLarge")(props)
96
- }
65
+ })(props => css({
66
+ width: themeGet("appScale.avatarDefault")(props),
67
+ height: themeGet("appScale.avatarDefault")(props),
68
+ flex: "0 0 auto",
69
+ backgroundColor: themeGet("colors.greyLighter")(props),
70
+ border: "0",
71
+ display: "block",
72
+ borderRadius: "50%"
73
+ }), props => variant({
74
+ prop: "sizing",
75
+ variants: {
76
+ small: {
77
+ width: themeGet("appScale.avatarSmall")(props),
78
+ height: themeGet("appScale.avatarSmall")(props)
79
+ },
80
+ large: {
81
+ width: themeGet("appScale.avatarLarge")(props),
82
+ height: themeGet("appScale.avatarLarge")(props)
97
83
  }
98
- });
99
- }, function (props) {
100
- return variant({
101
- prop: "shape",
102
- variants: {
103
- square: {
104
- borderRadius: themeGet("radii.2")(props)
105
- },
106
- hexagon: {
107
- borderRadius: "0",
108
- clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
109
- },
110
- tag: {
111
- borderRadius: "0",
112
- clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
113
- }
84
+ }
85
+ }), props => variant({
86
+ prop: "shape",
87
+ variants: {
88
+ square: {
89
+ borderRadius: themeGet("radii.2")(props)
90
+ },
91
+ hexagon: {
92
+ borderRadius: "0",
93
+ clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
94
+ },
95
+ tag: {
96
+ borderRadius: "0",
97
+ clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
114
98
  }
115
- });
116
- });
117
- var Shape = styled("div").withConfig({
99
+ }
100
+ }));
101
+ const Shape = styled("div").withConfig({
118
102
  displayName: "Avatar__Shape",
119
103
  componentId: "sc-1wtet2j-3"
120
- })(function (props) {
121
- return css({
122
- width: themeGet("appScale.avatarDefault")(props),
123
- height: themeGet("appScale.avatarDefault")(props),
124
- fontWeight: themeGet("fontWeights.2")(props),
125
- flex: "0 0 auto",
126
- backgroundColor: themeGet("colors.greyLighter")(props),
127
- color: props.whiteInitials ? themeGet("colors.white")(props) : themeGet("colors.greyDarkest")(props),
128
- border: "0",
129
- display: "flex",
130
- borderRadius: "50%",
131
- alignItems: "center",
132
- justifyContent: "center",
133
- textAlign: "center",
134
- textTransform: "".concat(function (props) {
135
- return props.uppercase ? "uppercase" : "none";
136
- }),
137
- a: {
138
- color: themeGet("colors.greyDarkest")(props)
104
+ })(props => css({
105
+ width: themeGet("appScale.avatarDefault")(props),
106
+ height: themeGet("appScale.avatarDefault")(props),
107
+ fontWeight: themeGet("fontWeights.2")(props),
108
+ flex: "0 0 auto",
109
+ backgroundColor: themeGet("colors.greyLighter")(props),
110
+ color: props.whiteInitials ? themeGet("colors.white")(props) : themeGet("colors.greyDarkest")(props),
111
+ border: "0",
112
+ display: "flex",
113
+ borderRadius: "50%",
114
+ alignItems: "center",
115
+ justifyContent: "center",
116
+ textAlign: "center",
117
+ textTransform: "".concat(props => props.uppercase ? "uppercase" : "none"),
118
+ a: {
119
+ color: themeGet("colors.greyDarkest")(props)
120
+ },
121
+ "&.inverted a": {
122
+ color: themeGet("colors.white")(props)
123
+ }
124
+ }), props => variant({
125
+ prop: "sizing",
126
+ variants: {
127
+ small: {
128
+ width: themeGet("appScale.avatarSmall")(props),
129
+ height: themeGet("appScale.avatarSmall")(props)
130
+ },
131
+ large: {
132
+ width: themeGet("appScale.avatarLarge")(props),
133
+ height: themeGet("appScale.avatarLarge")(props)
139
134
  },
140
- "&.inverted a": {
135
+ default: {}
136
+ }
137
+ }), props => variant({
138
+ prop: "type",
139
+ variants: {
140
+ inverted: {
141
+ backgroundColor: themeGet("colors.greyDarker")(props),
141
142
  color: themeGet("colors.white")(props)
143
+ },
144
+ default: {}
145
+ }
146
+ }), props => variant({
147
+ prop: "shape",
148
+ variants: {
149
+ square: {
150
+ borderRadius: themeGet("radii.2")(props)
151
+ },
152
+ hexagon: {
153
+ borderRadius: "0",
154
+ clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
155
+ },
156
+ tag: {
157
+ borderRadius: "0",
158
+ paddingBottom: "8px",
159
+ clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
142
160
  }
143
- });
144
- }, function (props) {
145
- return variant({
146
- prop: "sizing",
147
- variants: {
148
- small: {
149
- width: themeGet("appScale.avatarSmall")(props),
150
- height: themeGet("appScale.avatarSmall")(props)
151
- },
152
- large: {
153
- width: themeGet("appScale.avatarLarge")(props),
154
- height: themeGet("appScale.avatarLarge")(props)
155
- },
156
- "default": {}
157
- }
158
- });
159
- }, function (props) {
160
- return variant({
161
- prop: "type",
162
- variants: {
163
- inverted: {
164
- backgroundColor: themeGet("colors.greyDarker")(props),
165
- color: themeGet("colors.white")(props)
166
- },
167
- "default": {}
168
- }
169
- });
170
- }, function (props) {
171
- return variant({
172
- prop: "shape",
173
- variants: {
174
- square: {
175
- borderRadius: themeGet("radii.2")(props)
176
- },
177
- hexagon: {
178
- borderRadius: "0",
179
- clipPath: "polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)"
180
- },
181
- tag: {
182
- borderRadius: "0",
183
- paddingBottom: "8px",
184
- clipPath: "polygon(6% 0, 95% 0, 95% 65%, 50% 100%, 6% 65%)"
185
- }
186
- }
187
- });
188
- });
189
- var Title = styled(function (_ref) {
190
- var titleLevel = _ref.titleLevel,
191
- props = _objectWithoutProperties(_ref, _excluded);
192
- var Heading = Header[titleLevel];
193
- return /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.createElement(Heading, null), props);
161
+ }
162
+ }));
163
+ const Title = styled(_ref => {
164
+ let {
165
+ titleLevel,
166
+ ...props
167
+ } = _ref;
168
+ const Heading = Header[titleLevel];
169
+ return /*#__PURE__*/React.cloneElement( /*#__PURE__*/_jsx(Heading, {}), props);
194
170
  }).withConfig({
195
171
  displayName: "Avatar__Title",
196
172
  componentId: "sc-1wtet2j-4"
197
- })(function (props) {
198
- return css({
173
+ })(props => css({
174
+ fontSize: themeGet("fontSizes.2")(props),
175
+ "> a": {
199
176
  fontSize: themeGet("fontSizes.2")(props),
200
- "> a": {
201
- fontSize: themeGet("fontSizes.2")(props),
202
- color: props.type == "inverted" ? themeGet("colors.primaryLight")(props) : themeGet("colors.primary")(props)
203
- },
204
- "> div > a": {
177
+ color: props.type == "inverted" ? themeGet("colors.primaryLight")(props) : themeGet("colors.primary")(props)
178
+ },
179
+ "> div > a": {
180
+ fontSize: themeGet("fontSizes.2")(props),
181
+ color: props.type == "inverted" ? themeGet("colors.primaryLight")(props) : themeGet("colors.primary")(props)
182
+ },
183
+ "> div > div > a": {
184
+ fontSize: themeGet("fontSizes.2")(props),
185
+ color: props.type == "inverted" ? themeGet("colors.primaryLight")(props) : themeGet("colors.primary")(props)
186
+ }
187
+ }), props => variant({
188
+ prop: "sizing",
189
+ variants: {
190
+ small: {
205
191
  fontSize: themeGet("fontSizes.2")(props),
206
- color: props.type == "inverted" ? themeGet("colors.primaryLight")(props) : themeGet("colors.primary")(props)
192
+ "> a": {
193
+ fontSize: themeGet("fontSizes.2")(props)
194
+ },
195
+ "> div > a": {
196
+ fontSize: themeGet("fontSizes.2")(props)
197
+ },
198
+ "> div > div > a": {
199
+ fontSize: themeGet("fontSizes.2")(props)
200
+ }
207
201
  },
208
- "> div > div > a": {
209
- fontSize: themeGet("fontSizes.2")(props),
210
- color: props.type == "inverted" ? themeGet("colors.primaryLight")(props) : themeGet("colors.primary")(props)
211
- }
212
- });
213
- }, function (props) {
214
- return variant({
215
- prop: "sizing",
216
- variants: {
217
- small: {
218
- fontSize: themeGet("fontSizes.2")(props),
219
- "> a": {
220
- fontSize: themeGet("fontSizes.2")(props)
221
- },
222
- "> div > a": {
223
- fontSize: themeGet("fontSizes.2")(props)
224
- },
225
- "> div > div > a": {
226
- fontSize: themeGet("fontSizes.2")(props)
227
- }
202
+ large: {
203
+ fontSize: themeGet("fontSizes.3")(props),
204
+ "> a": {
205
+ fontSize: themeGet("fontSizes.3")(props)
206
+ },
207
+ "> div > a": {
208
+ fontSize: themeGet("fontSizes.3")(props)
228
209
  },
229
- large: {
230
- fontSize: themeGet("fontSizes.3")(props),
231
- "> a": {
232
- fontSize: themeGet("fontSizes.3")(props)
233
- },
234
- "> div > a": {
235
- fontSize: themeGet("fontSizes.3")(props)
236
- },
237
- "> div > div > a": {
238
- fontSize: themeGet("fontSizes.3")(props)
239
- }
210
+ "> div > div > a": {
211
+ fontSize: themeGet("fontSizes.3")(props)
240
212
  }
241
213
  }
242
- });
243
- }, function (props) {
244
- return variant({
245
- prop: "type",
246
- variants: {
247
- inverted: {
248
- color: themeGet("colors.white")(props)
249
- }
214
+ }
215
+ }), props => variant({
216
+ prop: "type",
217
+ variants: {
218
+ inverted: {
219
+ color: themeGet("colors.white")(props)
250
220
  }
251
- });
252
- });
253
- var Subtitle = styled(Text).withConfig({
221
+ }
222
+ }));
223
+ const Subtitle = styled(Text).withConfig({
254
224
  displayName: "Avatar__Subtitle",
255
225
  componentId: "sc-1wtet2j-5"
256
- })(function (props) {
257
- return css({
258
- color: themeGet("colors.greyDark")(props),
259
- fontSize: themeGet("fontSizes.1")(props)
260
- });
261
- }, function (props) {
262
- return variant({
263
- prop: "sizing",
264
- variants: {
265
- small: {
266
- fontSize: themeGet("fontSizes.0")(props),
267
- fontWeight: themeGet("fontWeights.1")(props)
268
- },
269
- large: {
270
- fontSize: themeGet("fontSizes.2")(props),
271
- fontWeight: themeGet("fontWeights.1")(props)
272
- }
273
- }
274
- });
275
- }, function (props) {
276
- return variant({
277
- prop: "type",
278
- variants: {
279
- inverted: {
280
- color: themeGet("colors.white")(props)
281
- },
282
- "default": {}
226
+ })(props => css({
227
+ color: themeGet("colors.greyDark")(props),
228
+ fontSize: themeGet("fontSizes.1")(props)
229
+ }), props => variant({
230
+ prop: "sizing",
231
+ variants: {
232
+ small: {
233
+ fontSize: themeGet("fontSizes.0")(props),
234
+ fontWeight: themeGet("fontWeights.1")(props)
235
+ },
236
+ large: {
237
+ fontSize: themeGet("fontSizes.2")(props),
238
+ fontWeight: themeGet("fontWeights.1")(props)
283
239
  }
284
- });
285
- });
286
- var LocalTime = styled(Popover).withConfig({
240
+ }
241
+ }), props => variant({
242
+ prop: "type",
243
+ variants: {
244
+ inverted: {
245
+ color: themeGet("colors.white")(props)
246
+ },
247
+ default: {}
248
+ }
249
+ }));
250
+ const LocalTime = styled(Popover).withConfig({
287
251
  displayName: "Avatar__LocalTime",
288
252
  componentId: "sc-1wtet2j-6"
289
253
  })(["position:absolute;top:0;left:0;"]);
290
- var Avatar = function Avatar(_ref2) {
291
- var sizing = _ref2.sizing,
292
- image = _ref2.image,
293
- imageAlt = _ref2.imageAlt,
294
- initials = _ref2.initials,
295
- title = _ref2.title,
296
- _ref2$titleLevel = _ref2.titleLevel,
297
- titleLevel = _ref2$titleLevel === void 0 ? "H3" : _ref2$titleLevel,
298
- subtitle = _ref2.subtitle,
299
- subtitleContent = _ref2.subtitleContent,
300
- type = _ref2.type,
301
- theme = _ref2.theme,
302
- shape = _ref2.shape,
303
- localTime = _ref2.localTime,
304
- _ref2$uppercase = _ref2.uppercase,
305
- uppercase = _ref2$uppercase === void 0 ? true : _ref2$uppercase,
306
- whiteInitials = _ref2.whiteInitials,
307
- props = _objectWithoutProperties(_ref2, _excluded2);
308
- var hasTitle = !!title;
309
- var hasSubtitle = !!subtitle;
310
- var hasSubtitleContent = !!subtitleContent;
311
- var alt = useMemo(function () {
254
+ const Avatar = _ref2 => {
255
+ let {
256
+ sizing,
257
+ image,
258
+ imageAlt,
259
+ initials,
260
+ title,
261
+ titleLevel = "H3",
262
+ subtitle,
263
+ subtitleContent,
264
+ type,
265
+ theme,
266
+ shape,
267
+ localTime,
268
+ uppercase = true,
269
+ whiteInitials,
270
+ ...props
271
+ } = _ref2;
272
+ const hasTitle = !!title;
273
+ const hasSubtitle = !!subtitle;
274
+ const hasSubtitleContent = !!subtitleContent;
275
+ const alt = useMemo(() => {
312
276
  if (imageAlt) {
313
277
  return imageAlt;
314
278
  } else if (typeof title === "string") {
315
279
  return "Avatar for ".concat(title);
316
280
  }
317
281
  }, [imageAlt, title]);
318
- var component = /*#__PURE__*/React.createElement(AvatarWrapper, _extends({}, props, {
319
- type: type,
320
- sizing: sizing
321
- }), image ? /*#__PURE__*/React.createElement(Image, {
322
- src: image,
323
- sizing: sizing,
324
- shape: shape,
325
- alt: alt
326
- }) : /*#__PURE__*/React.createElement(Shape, {
327
- shape: shape,
328
- sizing: sizing,
329
- type: type,
330
- className: type == "inverted" ? "inverted" : "",
331
- whiteInitials: whiteInitials,
332
- uppercase: uppercase
333
- }, initials ? initials : shape === "hexagon" ? /*#__PURE__*/React.createElement(Icon, {
334
- icon: ["fas", "users"]
335
- }) : shape === "tag" ? /*#__PURE__*/React.createElement(Icon, {
336
- icon: ["fas", "tag"]
337
- }) : shape === "square" ? /*#__PURE__*/React.createElement(Icon, {
338
- icon: ["fas", "users"]
339
- }) : /*#__PURE__*/React.createElement(Icon, {
340
- icon: ["fas", "user"]
341
- })), (hasTitle || hasSubtitle) && /*#__PURE__*/React.createElement(TextContent, {
282
+ const component = /*#__PURE__*/_jsxs(AvatarWrapper, {
283
+ ...props,
342
284
  type: type,
343
285
  sizing: sizing,
344
- theme: theme
345
- }, hasTitle && /*#__PURE__*/React.createElement(Title, {
346
- titleLevel: titleLevel,
347
- type: type,
348
- sizing: sizing,
349
- theme: theme
350
- }, title), hasSubtitle && /*#__PURE__*/React.createElement(Subtitle, {
351
- type: type,
352
- sizing: sizing
353
- }, subtitle), hasSubtitleContent && subtitleContent), localTime && /*#__PURE__*/React.createElement(LocalTime, {
354
- direction: "topRight",
355
- textAlign: "center",
356
- width: "130px",
357
- text: localTime
358
- }, /*#__PURE__*/React.createElement(StatusDot, {
359
- icon: true
360
- }, /*#__PURE__*/React.createElement(Icon, {
361
- icon: ["fas", "clock"],
362
- color: "white",
363
- transform: "grow-2"
364
- }))));
365
- return theme ? /*#__PURE__*/React.createElement(ThemeProvider, {
366
- theme: theme
367
- }, component) : component;
286
+ children: [image ? /*#__PURE__*/_jsx(Image, {
287
+ src: image,
288
+ sizing: sizing,
289
+ shape: shape,
290
+ alt: alt
291
+ }) : /*#__PURE__*/_jsx(Shape, {
292
+ shape: shape,
293
+ sizing: sizing,
294
+ type: type,
295
+ className: type == "inverted" ? "inverted" : "",
296
+ whiteInitials: whiteInitials,
297
+ uppercase: uppercase,
298
+ children: initials ? initials : shape === "hexagon" ? /*#__PURE__*/_jsx(Icon, {
299
+ icon: ["fas", "users"]
300
+ }) : shape === "tag" ? /*#__PURE__*/_jsx(Icon, {
301
+ icon: ["fas", "tag"]
302
+ }) : shape === "square" ? /*#__PURE__*/_jsx(Icon, {
303
+ icon: ["fas", "users"]
304
+ }) : /*#__PURE__*/_jsx(Icon, {
305
+ icon: ["fas", "user"]
306
+ })
307
+ }), (hasTitle || hasSubtitle) && /*#__PURE__*/_jsxs(TextContent, {
308
+ type: type,
309
+ sizing: sizing,
310
+ theme: theme,
311
+ children: [hasTitle && /*#__PURE__*/_jsx(Title, {
312
+ titleLevel: titleLevel,
313
+ type: type,
314
+ sizing: sizing,
315
+ theme: theme,
316
+ children: title
317
+ }), hasSubtitle && /*#__PURE__*/_jsx(Subtitle, {
318
+ type: type,
319
+ sizing: sizing,
320
+ children: subtitle
321
+ }), hasSubtitleContent && subtitleContent]
322
+ }), localTime && /*#__PURE__*/_jsx(LocalTime, {
323
+ direction: "topRight",
324
+ textAlign: "center",
325
+ width: "130px",
326
+ text: localTime,
327
+ children: /*#__PURE__*/_jsx(StatusDot, {
328
+ icon: true,
329
+ children: /*#__PURE__*/_jsx(Icon, {
330
+ icon: ["fas", "clock"],
331
+ color: "white",
332
+ transform: "grow-2"
333
+ })
334
+ })
335
+ })]
336
+ });
337
+ return theme ? /*#__PURE__*/_jsx(ThemeProvider, {
338
+ theme: theme,
339
+ children: component
340
+ }) : component;
368
341
  };
369
342
  Avatar.propTypes = {
370
343
  /** Changes the sizing of the Avatar component */
@@ -376,12 +349,12 @@ Avatar.propTypes = {
376
349
  /** Specifies a source path for an image */
377
350
  image: PropTypes.string,
378
351
  /** Specifies the alt text for an image. This must be specified if image prop is used and title prop is not a string. */
379
- imageAlt: function imageAlt(props, propName) {
352
+ imageAlt: (props, propName) => {
380
353
  if (props.image && props.title && typeof props.title !== "string" && (props[propName] == null || props[propName] === "")) {
381
354
  return new Error("Missing prop `".concat(propName, "` not specified for Avatar component. When `image` is provided, `").concat(propName, "` is required."));
382
355
  }
383
356
  if (props[propName] && typeof props[propName] !== "string") {
384
- return new Error("Invalid propType `".concat(propName, "` supplied to Avatar component. Expected `string`, received `").concat(_typeof(props[propName]), "`."));
357
+ return new Error("Invalid propType `".concat(propName, "` supplied to Avatar component. Expected `string`, received `").concat(typeof props[propName], "`."));
385
358
  }
386
359
  return null;
387
360
  },