orcs-design-system 3.2.4 → 3.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/GlobalStyles.js +1 -31
- package/es/SystemThemeProvider.js +11 -5
- package/es/assets/Colour/Colour.stories.js +211 -0
- package/es/assets/Colour/index.js +3 -3
- package/es/components/ActionsMenu/ActionsMenu.stories.js +260 -233
- package/es/components/ActionsMenu/index.js +144 -229
- package/es/components/Avatar/Avatar.stories.js +212 -196
- package/es/components/Avatar/index.js +280 -307
- package/es/components/Badge/Badge.stories.js +71 -46
- package/es/components/Badge/index.js +71 -74
- package/es/components/Box/Box.stories.js +51 -35
- package/es/components/Box/index.js +33 -34
- package/es/components/Button/Button.stories.js +161 -145
- package/es/components/Button/ButtonLink.stories.js +152 -139
- package/es/components/Button/index.js +79 -99
- package/es/components/ButtonGroup/ButtonGroup.stories.js +43 -42
- package/es/components/ButtonGroup/ButtonGroupItem.stories.js +11 -13
- package/es/components/ButtonGroup/index.js +103 -99
- package/es/components/Card/Card.stories.js +94 -62
- package/es/components/Card/index.js +50 -71
- package/es/components/Checkbox/Checkbox.stories.js +37 -43
- package/es/components/Checkbox/index.js +61 -76
- package/es/components/DatePicker/DatePicker.stories.js +86 -118
- package/es/components/DatePicker/index.js +71 -187
- package/es/components/Divider/Divider.stories.js +39 -42
- package/es/components/Divider/index.js +21 -27
- package/es/components/Expandable/Expandable.stories.js +46 -36
- package/es/components/Expandable/index.js +55 -82
- package/es/components/Flex/Flex.stories.js +19 -5
- package/es/components/Flex/FlexItem.stories.js +10 -9
- package/es/components/Flex/index.js +34 -27
- package/es/components/Grid/Grid.stories.js +129 -55
- package/es/components/Grid/index.js +25 -24
- package/es/components/Header/Header.stories.js +101 -92
- package/es/components/Header/index.js +433 -436
- package/es/components/HeaderSimple/HeaderSimple.stories.js +23 -27
- package/es/components/HeaderSimple/index.js +73 -68
- package/es/components/Icon/Icon.stories.js +58 -57
- package/es/components/Icon/index.js +48 -46
- package/es/components/Loading/Loading.stories.js +32 -39
- package/es/components/Loading/index.js +44 -51
- package/es/components/Modal/Modal.stories.js +172 -153
- package/es/components/Modal/index.js +126 -134
- package/es/components/Notification/Notification.stories.js +59 -58
- package/es/components/Notification/index.js +123 -133
- package/es/components/Popover/Popover.stories.js +134 -102
- package/es/components/Popover/index.js +65 -111
- package/es/components/ProgressBar/ProgressBar.stories.js +36 -39
- package/es/components/ProgressBar/index.js +29 -34
- package/es/components/RadioButton/RadioButton.stories.js +32 -37
- package/es/components/RadioButton/index.js +170 -184
- package/es/components/Range/Range.stories.js +19 -19
- package/es/components/Range/index.js +35 -45
- package/es/components/Select/Select.stories.js +107 -128
- package/es/components/Select/index.js +324 -336
- package/es/components/SideNav/NavItem.js +112 -122
- package/es/components/SideNav/SideNav.stories.js +84 -57
- package/es/components/SideNav/index.js +161 -185
- package/es/components/Sidebar/Sidebar.stories.js +50 -33
- package/es/components/Sidebar/index.js +152 -155
- package/es/components/Spacer/Spacer.stories.js +35 -32
- package/es/components/Spacer/index.js +20 -20
- package/es/components/StatusDot/StatusDot.stories.js +103 -90
- package/es/components/StatusDot/index.js +36 -38
- package/es/components/StyledLink/StyledLink.stories.js +68 -69
- package/es/components/StyledLink/index.js +47 -48
- package/es/components/Table/Table.stories.js +118 -112
- package/es/components/Table/getExpandColumnConfig.js +67 -62
- package/es/components/Table/index.js +24 -27
- package/es/components/Table/muiStyleOverrides.js +10 -8
- package/es/components/Tabs/Tab.stories.js +55 -38
- package/es/components/Tabs/TabsContainer.stories.js +30 -22
- package/es/components/Tabs/index.js +95 -92
- package/es/components/Tag/Tag.stories.js +250 -220
- package/es/components/Tag/index.js +118 -190
- package/es/components/TextArea/TextArea.stories.js +76 -89
- package/es/components/TextArea/index.js +117 -115
- package/es/components/TextInput/TextInput.stories.js +41 -61
- package/es/components/TextInput/index.js +127 -171
- package/es/components/Toggle/Toggle.stories.js +63 -62
- package/es/components/Toggle/index.js +43 -77
- package/es/components/TreeNav/TreeNav.stories.js +7 -8
- package/es/components/TreeNav/index.js +72 -69
- package/es/components/Typography/Typography.stories.js +174 -0
- package/es/components/Typography/index.js +252 -308
- package/es/components.test.js +1 -1
- package/es/hooks/isVisible.js +6 -10
- package/es/hooks/keepInView.js +27 -32
- package/es/hooks/keypress.js +14 -14
- package/es/hooks/useInputFocus.js +5 -5
- package/es/hooks/usePrevious.js +3 -3
- package/es/systemThemeCollapsed.js +53 -53
- package/es/systemtheme.js +53 -53
- package/es/utils/selectUtil.js +1 -1
- package/es/utils/selectUtil.test.js +6 -6
- package/package.json +29 -38
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import _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
|
-
|
|
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
|
-
}),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
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
|
-
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
const Image = styled("img").withConfig({
|
|
73
63
|
displayName: "Avatar__Image",
|
|
74
64
|
componentId: "sc-1wtet2j-2"
|
|
75
|
-
})(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
const Shape = styled("div").withConfig({
|
|
118
102
|
displayName: "Avatar__Shape",
|
|
119
103
|
componentId: "sc-1wtet2j-3"
|
|
120
|
-
})(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
})(
|
|
198
|
-
|
|
173
|
+
})(props => css({
|
|
174
|
+
fontSize: themeGet("fontSizes.2")(props),
|
|
175
|
+
"> a": {
|
|
199
176
|
fontSize: themeGet("fontSizes.2")(props),
|
|
200
|
-
"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
"
|
|
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
|
-
|
|
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
|
-
|
|
209
|
-
fontSize: themeGet("fontSizes.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
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
|
-
},
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
-
|
|
221
|
+
}
|
|
222
|
+
}));
|
|
223
|
+
const Subtitle = styled(Text).withConfig({
|
|
254
224
|
displayName: "Avatar__Subtitle",
|
|
255
225
|
componentId: "sc-1wtet2j-5"
|
|
256
|
-
})(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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
|
-
|
|
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
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
titleLevel =
|
|
298
|
-
subtitle
|
|
299
|
-
subtitleContent
|
|
300
|
-
type
|
|
301
|
-
theme
|
|
302
|
-
shape
|
|
303
|
-
localTime
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
319
|
-
|
|
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
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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:
|
|
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(
|
|
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
|
},
|