@zendeskgarden/react-theming 9.0.0-next.2 → 9.0.0-next.21
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/dist/esm/elements/ThemeProvider.js +24 -0
- package/dist/esm/elements/palette/index.js +259 -0
- package/dist/esm/elements/palette/v8.js +149 -0
- package/dist/esm/elements/theme/index.js +240 -0
- package/dist/esm/index.js +28 -0
- package/dist/esm/types/index.js +11 -0
- package/dist/esm/utils/StyledBaseIcon.js +22 -0
- package/dist/esm/utils/arrowStyles.js +52 -0
- package/dist/esm/utils/focusStyles.js +43 -0
- package/dist/esm/utils/getArrowPosition.js +35 -0
- package/dist/esm/utils/getCheckeredBackground.js +40 -0
- package/dist/esm/utils/getColor.js +245 -0
- package/dist/esm/utils/getColorV8.js +72 -0
- package/dist/esm/utils/getFloatingPlacements.js +58 -0
- package/dist/esm/utils/getFocusBoxShadow.js +45 -0
- package/dist/esm/utils/getLineHeight.js +22 -0
- package/dist/esm/utils/getMenuPosition.js +11 -0
- package/dist/esm/utils/mediaQuery.js +56 -0
- package/dist/esm/utils/menuStyles.js +70 -0
- package/dist/esm/utils/retrieveComponentStyles.js +19 -0
- package/dist/esm/utils/useDocument.js +21 -0
- package/dist/esm/utils/useText.js +29 -0
- package/dist/esm/utils/useWindow.js +21 -0
- package/dist/index.cjs.js +848 -201
- package/dist/typings/elements/ThemeProvider.d.ts +1 -1
- package/dist/typings/elements/palette/index.d.ts +134 -26
- package/dist/typings/elements/palette/v8.d.ts +149 -0
- package/dist/typings/elements/theme/index.d.ts +0 -1
- package/dist/typings/index.d.ts +6 -4
- package/dist/typings/types/index.d.ts +61 -16
- package/dist/typings/utils/StyledBaseIcon.d.ts +8 -0
- package/dist/typings/utils/arrowStyles.d.ts +0 -16
- package/dist/typings/utils/focusStyles.d.ts +3 -11
- package/dist/typings/utils/getCheckeredBackground.d.ts +20 -0
- package/dist/typings/utils/getColor.d.ts +14 -9
- package/dist/typings/utils/getColorV8.d.ts +27 -0
- package/dist/typings/utils/getFocusBoxShadow.d.ts +6 -21
- package/dist/typings/utils/menuStyles.d.ts +1 -1
- package/package.json +8 -7
- package/dist/index.esm.js +0 -714
package/dist/index.cjs.js
CHANGED
|
@@ -1,178 +1,274 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var containerUtilities = require('@zendeskgarden/container-utilities');
|
|
10
|
+
var styled = require('styled-components');
|
|
11
|
+
var color2k = require('color2k');
|
|
14
12
|
var polished = require('polished');
|
|
13
|
+
var get = require('lodash.get');
|
|
15
14
|
var memoize = require('lodash.memoize');
|
|
16
15
|
|
|
17
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
|
|
19
18
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
19
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
20
|
+
var get__default = /*#__PURE__*/_interopDefault(get);
|
|
20
21
|
var memoize__default = /*#__PURE__*/_interopDefault(memoize);
|
|
21
22
|
|
|
22
|
-
function _extends() {
|
|
23
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
24
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
25
|
-
var source = arguments[i];
|
|
26
|
-
for (var key in source) {
|
|
27
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
28
|
-
target[key] = source[key];
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
};
|
|
34
|
-
return _extends.apply(this, arguments);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
23
|
const PALETTE = {
|
|
38
24
|
black: '#000',
|
|
39
25
|
white: '#fff',
|
|
40
26
|
product: {
|
|
41
27
|
support: '#00a656',
|
|
42
|
-
message: '#37b8af',
|
|
43
28
|
explore: '#30aabc',
|
|
44
29
|
gather: '#f6c8be',
|
|
45
30
|
guide: '#eb4962',
|
|
46
|
-
connect: '#ff6224',
|
|
47
31
|
chat: '#f79a3e',
|
|
48
32
|
talk: '#efc93d',
|
|
49
33
|
sell: '#c38f00'
|
|
50
34
|
},
|
|
51
35
|
grey: {
|
|
52
36
|
100: '#f8f9f9',
|
|
53
|
-
200: '#
|
|
37
|
+
200: '#e8eaec',
|
|
54
38
|
300: '#d8dcde',
|
|
55
|
-
400: '#
|
|
56
|
-
500: '#
|
|
57
|
-
600: '#
|
|
58
|
-
700: '#
|
|
59
|
-
800: '#
|
|
39
|
+
400: '#b0b8be',
|
|
40
|
+
500: '#919ca5',
|
|
41
|
+
600: '#848f99',
|
|
42
|
+
700: '#5c6970',
|
|
43
|
+
800: '#39434b',
|
|
44
|
+
900: '#293239',
|
|
45
|
+
1000: '#1c2227',
|
|
46
|
+
1100: '#151a1e',
|
|
47
|
+
1200: '#0a0d0e'
|
|
60
48
|
},
|
|
61
49
|
blue: {
|
|
62
50
|
100: '#edf7ff',
|
|
63
|
-
200: '#
|
|
64
|
-
300: '#
|
|
65
|
-
400: '#
|
|
66
|
-
500: '#
|
|
67
|
-
600: '#
|
|
68
|
-
700: '#
|
|
69
|
-
800: '#
|
|
51
|
+
200: '#ddecf8',
|
|
52
|
+
300: '#cce0f1',
|
|
53
|
+
400: '#93bcdc',
|
|
54
|
+
500: '#66a0cd',
|
|
55
|
+
600: '#2694d6',
|
|
56
|
+
700: '#1f73b7',
|
|
57
|
+
800: '#13456d',
|
|
58
|
+
900: '#0f3655',
|
|
59
|
+
1000: '#0a2338',
|
|
60
|
+
1100: '#061420',
|
|
61
|
+
1200: '#040d15'
|
|
70
62
|
},
|
|
71
63
|
red: {
|
|
72
|
-
100: '#
|
|
73
|
-
200: '#
|
|
74
|
-
300: '#
|
|
75
|
-
400: '#
|
|
76
|
-
500: '#
|
|
77
|
-
600: '#
|
|
78
|
-
700: '#
|
|
79
|
-
800: '#
|
|
64
|
+
100: '#fff2f3',
|
|
65
|
+
200: '#fee3e5',
|
|
66
|
+
300: '#f5d5d8',
|
|
67
|
+
400: '#f2a1a8',
|
|
68
|
+
500: '#ea7881',
|
|
69
|
+
600: '#eb5c69',
|
|
70
|
+
700: '#cd3642',
|
|
71
|
+
800: '#7e1d25',
|
|
72
|
+
900: '#671219',
|
|
73
|
+
1000: '#3d1418',
|
|
74
|
+
1100: '#1d1011',
|
|
75
|
+
1200: '#100b0c'
|
|
80
76
|
},
|
|
81
77
|
yellow: {
|
|
82
|
-
100: '#
|
|
83
|
-
200: '#
|
|
84
|
-
300: '#
|
|
85
|
-
400: '#
|
|
86
|
-
500: '#
|
|
87
|
-
600: '#
|
|
88
|
-
700: '#
|
|
89
|
-
800: '#
|
|
78
|
+
100: '#fff3e4',
|
|
79
|
+
200: '#ffe6cb',
|
|
80
|
+
300: '#fed6a9',
|
|
81
|
+
400: '#fca347',
|
|
82
|
+
500: '#e38215',
|
|
83
|
+
600: '#d67305',
|
|
84
|
+
700: '#ac5918',
|
|
85
|
+
800: '#673515',
|
|
86
|
+
900: '#4c2c17',
|
|
87
|
+
1000: '#2d1e15',
|
|
88
|
+
1100: '#18120f',
|
|
89
|
+
1200: '#0e0c0b'
|
|
90
90
|
},
|
|
91
91
|
green: {
|
|
92
|
-
100: '#
|
|
93
|
-
200: '#
|
|
94
|
-
300: '#
|
|
95
|
-
400: '#
|
|
96
|
-
500: '#
|
|
97
|
-
600: '#
|
|
98
|
-
700: '#
|
|
99
|
-
800: '#
|
|
92
|
+
100: '#eef8f4',
|
|
93
|
+
200: '#daeee6',
|
|
94
|
+
300: '#cae3d9',
|
|
95
|
+
400: '#94c1b0',
|
|
96
|
+
500: '#4eab89',
|
|
97
|
+
600: '#26a178',
|
|
98
|
+
700: '#037f52',
|
|
99
|
+
800: '#104b35',
|
|
100
|
+
900: '#0b3b29',
|
|
101
|
+
1000: '#0c261c',
|
|
102
|
+
1100: '#0a1511',
|
|
103
|
+
1200: '#080d0c'
|
|
100
104
|
},
|
|
101
105
|
kale: {
|
|
102
|
-
100: '#
|
|
106
|
+
100: '#ecf9f9',
|
|
103
107
|
200: '#daeded',
|
|
104
|
-
300: '#
|
|
105
|
-
400: '#
|
|
106
|
-
500: '#
|
|
107
|
-
600: '#
|
|
108
|
-
700: '#
|
|
109
|
-
800: '#
|
|
108
|
+
300: '#cbe2e1',
|
|
109
|
+
400: '#97bfbf',
|
|
110
|
+
500: '#6ba4a5',
|
|
111
|
+
600: '#4a9999',
|
|
112
|
+
700: '#40787a',
|
|
113
|
+
800: '#16494f',
|
|
114
|
+
900: '#063940',
|
|
115
|
+
1000: '#03252a',
|
|
116
|
+
1100: '#061517',
|
|
117
|
+
1200: '#060e0e'
|
|
110
118
|
},
|
|
111
119
|
fuschia: {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
100: '#fbf3f8',
|
|
121
|
+
200: '#f7e6f1',
|
|
122
|
+
300: '#f2d5e7',
|
|
123
|
+
400: '#e3a4cc',
|
|
124
|
+
500: '#d77db7',
|
|
125
|
+
600: '#d16aac',
|
|
126
|
+
700: '#b34496',
|
|
127
|
+
800: '#78116c',
|
|
128
|
+
900: '#5a0d51',
|
|
129
|
+
1000: '#3f0939',
|
|
130
|
+
1100: '#31072c',
|
|
131
|
+
1200: '#1b0418'
|
|
116
132
|
},
|
|
117
133
|
pink: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
100: '#fcf3f4',
|
|
135
|
+
200: '#f7e5e8',
|
|
136
|
+
300: '#f3d6dc',
|
|
137
|
+
400: '#e5a6b4',
|
|
138
|
+
500: '#d98193',
|
|
139
|
+
600: '#d96b81',
|
|
140
|
+
700: '#d62054',
|
|
141
|
+
800: '#75263d',
|
|
142
|
+
900: '#561d2e',
|
|
143
|
+
1000: '#3c141f',
|
|
144
|
+
1100: '#2e0f18',
|
|
145
|
+
1200: '#17080c'
|
|
122
146
|
},
|
|
123
147
|
crimson: {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
100: '#fbf3f2',
|
|
149
|
+
200: '#f7e7e4',
|
|
150
|
+
300: '#f1d7d2',
|
|
151
|
+
400: '#e2aaa0',
|
|
152
|
+
500: '#d58678',
|
|
153
|
+
600: '#cf7464',
|
|
154
|
+
700: '#be4938',
|
|
155
|
+
800: '#811b12',
|
|
156
|
+
900: '#61140d',
|
|
157
|
+
1000: '#440e09',
|
|
158
|
+
1100: '#340b07',
|
|
159
|
+
1200: '#1c0604'
|
|
128
160
|
},
|
|
129
161
|
orange: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
162
|
+
100: '#fdf3ed',
|
|
163
|
+
200: '#fae7d8',
|
|
164
|
+
300: '#f7d7be',
|
|
165
|
+
400: '#eda875',
|
|
166
|
+
500: '#e58035',
|
|
167
|
+
600: '#d57428',
|
|
168
|
+
700: '#af5626',
|
|
169
|
+
800: '#693317',
|
|
170
|
+
900: '#4d2711',
|
|
171
|
+
1000: '#361a0c',
|
|
172
|
+
1100: '#291409',
|
|
173
|
+
1200: '#150a04'
|
|
134
174
|
},
|
|
135
175
|
lemon: {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
176
|
+
100: '#fff7d4',
|
|
177
|
+
200: '#ffea97',
|
|
178
|
+
300: '#ffdc4f',
|
|
179
|
+
400: '#efab00',
|
|
180
|
+
500: '#c79100',
|
|
181
|
+
600: '#b68500',
|
|
182
|
+
700: '#8f6900',
|
|
183
|
+
800: '#563e00',
|
|
184
|
+
900: '#3f2e00',
|
|
185
|
+
1000: '#2b2000',
|
|
186
|
+
1100: '#221800',
|
|
187
|
+
1200: '#110c00'
|
|
140
188
|
},
|
|
141
189
|
lime: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
190
|
+
100: '#ecfae7',
|
|
191
|
+
200: '#d1f3c7',
|
|
192
|
+
300: '#b3eda3',
|
|
193
|
+
400: '#4fd12b',
|
|
194
|
+
500: '#45b025',
|
|
195
|
+
600: '#509f2d',
|
|
196
|
+
700: '#3d7e19',
|
|
197
|
+
800: '#2c491b',
|
|
198
|
+
900: '#203614',
|
|
199
|
+
1000: '#16250e',
|
|
200
|
+
1100: '#111d0a',
|
|
201
|
+
1200: '#090e05'
|
|
146
202
|
},
|
|
147
203
|
mint: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
204
|
+
100: '#d6ffeb',
|
|
205
|
+
200: '#9affce',
|
|
206
|
+
300: '#0afe89',
|
|
207
|
+
400: '#00d26d',
|
|
208
|
+
500: '#01b15c',
|
|
209
|
+
600: '#16a260',
|
|
210
|
+
700: '#2d7e55',
|
|
211
|
+
800: '#1b4b33',
|
|
212
|
+
900: '#143726',
|
|
213
|
+
1000: '#0e261a',
|
|
214
|
+
1100: '#0b1d14',
|
|
215
|
+
1200: '#050e0a'
|
|
152
216
|
},
|
|
153
217
|
teal: {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
218
|
+
100: '#d4fefa',
|
|
219
|
+
200: '#88fdf1',
|
|
220
|
+
300: '#0bf8e1',
|
|
221
|
+
400: '#03cdb8',
|
|
222
|
+
500: '#02ad9c',
|
|
223
|
+
600: '#2a9d8f',
|
|
224
|
+
700: '#367a74',
|
|
225
|
+
800: '#254846',
|
|
226
|
+
900: '#1b3534',
|
|
227
|
+
1000: '#122423',
|
|
228
|
+
1100: '#0e1c1a',
|
|
229
|
+
1200: '#070d0d'
|
|
158
230
|
},
|
|
159
231
|
azure: {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
232
|
+
100: '#eff7fe',
|
|
233
|
+
200: '#d9ecfc',
|
|
234
|
+
300: '#c4e0fa',
|
|
235
|
+
400: '#82bcf4',
|
|
236
|
+
500: '#4b9fee',
|
|
237
|
+
600: '#3191ea',
|
|
238
|
+
700: '#2770c3',
|
|
239
|
+
800: '#23446b',
|
|
240
|
+
900: '#1a3250',
|
|
241
|
+
1000: '#122238',
|
|
242
|
+
1100: '#0e1a2a',
|
|
243
|
+
1200: '#070d14'
|
|
164
244
|
},
|
|
165
245
|
royal: {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
246
|
+
100: '#f4f5fc',
|
|
247
|
+
200: '#e7e9f8',
|
|
248
|
+
300: '#d8dcf4',
|
|
249
|
+
400: '#acb4e7',
|
|
250
|
+
500: '#8a96dd',
|
|
251
|
+
600: '#7a88d9',
|
|
252
|
+
700: '#4c67d3',
|
|
253
|
+
800: '#1833ab',
|
|
254
|
+
900: '#122680',
|
|
255
|
+
1000: '#0d1a5a',
|
|
256
|
+
1100: '#0a1445',
|
|
257
|
+
1200: '#050a25'
|
|
170
258
|
},
|
|
171
259
|
purple: {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
260
|
+
100: '#f9f3fb',
|
|
261
|
+
200: '#f2e7f6',
|
|
262
|
+
300: '#e9d8f1',
|
|
263
|
+
400: '#d0a9e0',
|
|
264
|
+
500: '#bb86d3',
|
|
265
|
+
600: '#b276cd',
|
|
266
|
+
700: '#9256b1',
|
|
267
|
+
800: '#58209a',
|
|
268
|
+
900: '#411973',
|
|
269
|
+
1000: '#2e1150',
|
|
270
|
+
1100: '#230d3f',
|
|
271
|
+
1200: '#120720'
|
|
176
272
|
}
|
|
177
273
|
};
|
|
178
274
|
|
|
@@ -200,14 +296,112 @@ const breakpoints = {
|
|
|
200
296
|
xl: `${BASE * 300}px`
|
|
201
297
|
};
|
|
202
298
|
const colors = {
|
|
203
|
-
background: PALETTE.white,
|
|
204
|
-
foreground: PALETTE.grey[800],
|
|
205
299
|
primaryHue: 'blue',
|
|
206
300
|
dangerHue: 'red',
|
|
207
301
|
warningHue: 'yellow',
|
|
208
302
|
successHue: 'green',
|
|
209
303
|
neutralHue: 'grey',
|
|
210
|
-
chromeHue: 'kale'
|
|
304
|
+
chromeHue: 'kale',
|
|
305
|
+
variables: {
|
|
306
|
+
dark: {
|
|
307
|
+
background: {
|
|
308
|
+
default: 'neutralHue.1100',
|
|
309
|
+
raised: 'neutralHue.1000',
|
|
310
|
+
recessed: 'neutralHue.1200',
|
|
311
|
+
subtle: 'neutralHue.1000',
|
|
312
|
+
emphasis: 'neutralHue.600',
|
|
313
|
+
primary: 'primaryHue.900',
|
|
314
|
+
success: 'successHue.1000',
|
|
315
|
+
warning: 'warningHue.1000',
|
|
316
|
+
danger: 'dangerHue.1000',
|
|
317
|
+
primaryEmphasis: 'primaryHue.600',
|
|
318
|
+
successEmphasis: 'successHue.600',
|
|
319
|
+
warningEmphasis: 'warningHue.600',
|
|
320
|
+
dangerEmphasis: 'dangerHue.600',
|
|
321
|
+
disabled: 'rgba(neutralHue.500, 100)'
|
|
322
|
+
},
|
|
323
|
+
border: {
|
|
324
|
+
default: 'neutralHue.800',
|
|
325
|
+
emphasis: 'neutralHue.600',
|
|
326
|
+
subtle: 'neutralHue.900',
|
|
327
|
+
success: 'successHue.800',
|
|
328
|
+
warning: 'warningHue.800',
|
|
329
|
+
danger: 'dangerHue.800',
|
|
330
|
+
primaryEmphasis: 'primaryHue.600',
|
|
331
|
+
successEmphasis: 'successHue.600',
|
|
332
|
+
warningEmphasis: 'warningHue.600',
|
|
333
|
+
dangerEmphasis: 'dangerHue.600',
|
|
334
|
+
disabled: 'neutralHue.800'
|
|
335
|
+
},
|
|
336
|
+
foreground: {
|
|
337
|
+
default: 'neutralHue.300',
|
|
338
|
+
subtle: 'neutralHue.500',
|
|
339
|
+
onEmphasis: 'neutralHue.1100',
|
|
340
|
+
primary: 'primaryHue.600',
|
|
341
|
+
success: 'successHue.400',
|
|
342
|
+
warning: 'warningHue.400',
|
|
343
|
+
danger: 'dangerHue.400',
|
|
344
|
+
successEmphasis: 'successHue.300',
|
|
345
|
+
warningEmphasis: 'warningHue.300',
|
|
346
|
+
dangerEmphasis: 'dangerHue.300',
|
|
347
|
+
disabled: 'neutralHue.700'
|
|
348
|
+
},
|
|
349
|
+
shadow: {
|
|
350
|
+
small: 'rgba(neutralHue.1200, 1100)',
|
|
351
|
+
medium: 'rgba(neutralHue.1200, 800)',
|
|
352
|
+
large: 'rgba(neutralHue.1200, 1000)'
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
light: {
|
|
356
|
+
background: {
|
|
357
|
+
default: 'palette.white',
|
|
358
|
+
raised: 'palette.white',
|
|
359
|
+
recessed: 'neutralHue.100',
|
|
360
|
+
subtle: 'neutralHue.100',
|
|
361
|
+
emphasis: 'neutralHue.700',
|
|
362
|
+
primary: 'primaryHue.100',
|
|
363
|
+
success: 'successHue.100',
|
|
364
|
+
warning: 'warningHue.100',
|
|
365
|
+
danger: 'dangerHue.100',
|
|
366
|
+
primaryEmphasis: 'primaryHue.700',
|
|
367
|
+
successEmphasis: 'successHue.700',
|
|
368
|
+
warningEmphasis: 'warningHue.700',
|
|
369
|
+
dangerEmphasis: 'dangerHue.700',
|
|
370
|
+
disabled: 'rgba(neutralHue.700, 100)'
|
|
371
|
+
},
|
|
372
|
+
border: {
|
|
373
|
+
default: 'neutralHue.300',
|
|
374
|
+
emphasis: 'neutralHue.600',
|
|
375
|
+
subtle: 'neutralHue.200',
|
|
376
|
+
success: 'successHue.300',
|
|
377
|
+
warning: 'warningHue.300',
|
|
378
|
+
danger: 'dangerHue.300',
|
|
379
|
+
primaryEmphasis: 'primaryHue.700',
|
|
380
|
+
successEmphasis: 'successHue.700',
|
|
381
|
+
warningEmphasis: 'warningHue.700',
|
|
382
|
+
dangerEmphasis: 'dangerHue.700',
|
|
383
|
+
disabled: 'neutralHue.300'
|
|
384
|
+
},
|
|
385
|
+
foreground: {
|
|
386
|
+
default: 'neutralHue.900',
|
|
387
|
+
subtle: 'neutralHue.700',
|
|
388
|
+
onEmphasis: 'palette.white',
|
|
389
|
+
primary: 'primaryHue.700',
|
|
390
|
+
success: 'successHue.700',
|
|
391
|
+
warning: 'warningHue.700',
|
|
392
|
+
danger: 'dangerHue.700',
|
|
393
|
+
successEmphasis: 'successHue.900',
|
|
394
|
+
warningEmphasis: 'warningHue.900',
|
|
395
|
+
dangerEmphasis: 'dangerHue.900',
|
|
396
|
+
disabled: 'neutralHue.600'
|
|
397
|
+
},
|
|
398
|
+
shadow: {
|
|
399
|
+
small: 'rgba(neutralHue.1200, 200)',
|
|
400
|
+
medium: 'rgba(neutralHue.1200, 200)',
|
|
401
|
+
large: 'rgba(neutralHue.1200, 200)'
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
211
405
|
};
|
|
212
406
|
const fonts = {
|
|
213
407
|
mono: ['SFMono-Regular' , 'Consolas' , '"Liberation Mono"' , 'Menlo', 'Courier', 'monospace'].join(','),
|
|
@@ -246,6 +440,20 @@ const lineHeights = {
|
|
|
246
440
|
xxl: `${BASE * 8}px`,
|
|
247
441
|
xxxl: `${BASE * 11}px`
|
|
248
442
|
};
|
|
443
|
+
const opacity = {
|
|
444
|
+
100: 0.08,
|
|
445
|
+
200: 0.16,
|
|
446
|
+
300: 0.24,
|
|
447
|
+
400: 0.32,
|
|
448
|
+
500: 0.4,
|
|
449
|
+
600: 0.48,
|
|
450
|
+
700: 0.56,
|
|
451
|
+
800: 0.64,
|
|
452
|
+
900: 0.72,
|
|
453
|
+
1000: 0.8,
|
|
454
|
+
1100: 0.88,
|
|
455
|
+
1200: 0.96
|
|
456
|
+
};
|
|
249
457
|
const palette = {
|
|
250
458
|
...PALETTE
|
|
251
459
|
};
|
|
@@ -287,6 +495,7 @@ const DEFAULT_THEME = {
|
|
|
287
495
|
fontWeights,
|
|
288
496
|
iconSizes,
|
|
289
497
|
lineHeights,
|
|
498
|
+
opacity,
|
|
290
499
|
palette,
|
|
291
500
|
rtl: false,
|
|
292
501
|
shadowWidths,
|
|
@@ -294,42 +503,161 @@ const DEFAULT_THEME = {
|
|
|
294
503
|
space
|
|
295
504
|
};
|
|
296
505
|
|
|
297
|
-
const useDocument = theme => {
|
|
298
|
-
const [controlledDocument, setControlledDocument] = React.useState();
|
|
299
|
-
React.useEffect(() => {
|
|
300
|
-
if (theme && theme.document) {
|
|
301
|
-
setControlledDocument(theme.document);
|
|
302
|
-
} else {
|
|
303
|
-
setControlledDocument(document);
|
|
304
|
-
}
|
|
305
|
-
}, [theme]);
|
|
306
|
-
return controlledDocument;
|
|
307
|
-
};
|
|
308
|
-
|
|
309
506
|
const ThemeProvider = _ref => {
|
|
310
507
|
let {
|
|
311
508
|
theme,
|
|
312
|
-
focusVisibleRef,
|
|
313
|
-
children,
|
|
314
509
|
...other
|
|
315
510
|
} = _ref;
|
|
316
|
-
|
|
317
|
-
const relativeDocument = useDocument(theme);
|
|
318
|
-
const controlledScopeRef = focusVisibleRef === null ? React__default.default.createRef() : containerUtilities.getControlledValue(focusVisibleRef, scopeRef);
|
|
319
|
-
containerFocusvisible.useFocusVisible({
|
|
320
|
-
scope: controlledScopeRef,
|
|
321
|
-
relativeDocument
|
|
322
|
-
});
|
|
323
|
-
return React__default.default.createElement(styledComponents.ThemeProvider, _extends({
|
|
511
|
+
return React__default.default.createElement(styled.ThemeProvider, Object.assign({
|
|
324
512
|
theme: theme
|
|
325
|
-
}, other)
|
|
326
|
-
ref: scopeRef
|
|
327
|
-
}, children) : children);
|
|
513
|
+
}, other));
|
|
328
514
|
};
|
|
329
515
|
ThemeProvider.defaultProps = {
|
|
330
516
|
theme: DEFAULT_THEME
|
|
331
517
|
};
|
|
332
518
|
|
|
519
|
+
const PALETTE_V8 = {
|
|
520
|
+
black: '#000',
|
|
521
|
+
white: '#fff',
|
|
522
|
+
product: {
|
|
523
|
+
support: '#00a656',
|
|
524
|
+
message: '#37b8af',
|
|
525
|
+
explore: '#30aabc',
|
|
526
|
+
gather: '#f6c8be',
|
|
527
|
+
guide: '#eb4962',
|
|
528
|
+
connect: '#ff6224',
|
|
529
|
+
chat: '#f79a3e',
|
|
530
|
+
talk: '#efc93d',
|
|
531
|
+
sell: '#c38f00'
|
|
532
|
+
},
|
|
533
|
+
grey: {
|
|
534
|
+
100: '#f8f9f9',
|
|
535
|
+
200: '#e9ebed',
|
|
536
|
+
300: '#d8dcde',
|
|
537
|
+
400: '#c2c8cc',
|
|
538
|
+
500: '#87929d',
|
|
539
|
+
600: '#68737d',
|
|
540
|
+
700: '#49545c',
|
|
541
|
+
800: '#2f3941'
|
|
542
|
+
},
|
|
543
|
+
blue: {
|
|
544
|
+
100: '#edf7ff',
|
|
545
|
+
200: '#cee2f2',
|
|
546
|
+
300: '#adcce4',
|
|
547
|
+
400: '#5293c7',
|
|
548
|
+
500: '#337fbd',
|
|
549
|
+
600: '#1f73b7',
|
|
550
|
+
700: '#144a75',
|
|
551
|
+
800: '#0f3554'
|
|
552
|
+
},
|
|
553
|
+
red: {
|
|
554
|
+
100: '#fff0f1',
|
|
555
|
+
200: '#f5d5d8',
|
|
556
|
+
300: '#f5b5ba',
|
|
557
|
+
400: '#e35b66',
|
|
558
|
+
500: '#d93f4c',
|
|
559
|
+
600: '#cc3340',
|
|
560
|
+
700: '#8c232c',
|
|
561
|
+
800: '#681219'
|
|
562
|
+
},
|
|
563
|
+
yellow: {
|
|
564
|
+
100: '#fff7ed',
|
|
565
|
+
200: '#ffeedb',
|
|
566
|
+
300: '#fed6a8',
|
|
567
|
+
400: '#ffb057',
|
|
568
|
+
500: '#f79a3e',
|
|
569
|
+
600: '#ed8f1c',
|
|
570
|
+
700: '#ad5918',
|
|
571
|
+
800: '#703815'
|
|
572
|
+
},
|
|
573
|
+
green: {
|
|
574
|
+
100: '#edf8f4',
|
|
575
|
+
200: '#d1e8df',
|
|
576
|
+
300: '#aecfc2',
|
|
577
|
+
400: '#5eae91',
|
|
578
|
+
500: '#228f67',
|
|
579
|
+
600: '#038153',
|
|
580
|
+
700: '#186146',
|
|
581
|
+
800: '#0b3b29'
|
|
582
|
+
},
|
|
583
|
+
kale: {
|
|
584
|
+
100: '#f5fcfc',
|
|
585
|
+
200: '#daeded',
|
|
586
|
+
300: '#bdd9d7',
|
|
587
|
+
400: '#90bbbb',
|
|
588
|
+
500: '#498283',
|
|
589
|
+
600: '#17494d',
|
|
590
|
+
700: '#03363d',
|
|
591
|
+
800: '#012b30'
|
|
592
|
+
},
|
|
593
|
+
fuschia: {
|
|
594
|
+
400: '#d653c2',
|
|
595
|
+
600: '#a81897',
|
|
596
|
+
M400: '#cf62a8',
|
|
597
|
+
M600: '#a8458c'
|
|
598
|
+
},
|
|
599
|
+
pink: {
|
|
600
|
+
400: '#ec4d63',
|
|
601
|
+
600: '#d42054',
|
|
602
|
+
M400: '#d57287',
|
|
603
|
+
M600: '#b23a5d'
|
|
604
|
+
},
|
|
605
|
+
crimson: {
|
|
606
|
+
400: '#e34f32',
|
|
607
|
+
600: '#c72a1c',
|
|
608
|
+
M400: '#cc6c5b',
|
|
609
|
+
M600: '#b24a3c'
|
|
610
|
+
},
|
|
611
|
+
orange: {
|
|
612
|
+
400: '#de701d',
|
|
613
|
+
600: '#bf5000',
|
|
614
|
+
M400: '#d4772c',
|
|
615
|
+
M600: '#b35827'
|
|
616
|
+
},
|
|
617
|
+
lemon: {
|
|
618
|
+
400: '#ffd424',
|
|
619
|
+
600: '#ffbb10',
|
|
620
|
+
M400: '#e7a500',
|
|
621
|
+
M600: '#c38f00'
|
|
622
|
+
},
|
|
623
|
+
lime: {
|
|
624
|
+
400: '#43b324',
|
|
625
|
+
600: '#2e8200',
|
|
626
|
+
M400: '#519e2d',
|
|
627
|
+
M600: '#47782c'
|
|
628
|
+
},
|
|
629
|
+
mint: {
|
|
630
|
+
400: '#00a656',
|
|
631
|
+
600: '#058541',
|
|
632
|
+
M400: '#299c66',
|
|
633
|
+
M600: '#2e8057'
|
|
634
|
+
},
|
|
635
|
+
teal: {
|
|
636
|
+
400: '#02a191',
|
|
637
|
+
600: '#028079',
|
|
638
|
+
M400: '#2d9e8f',
|
|
639
|
+
M600: '#3c7873'
|
|
640
|
+
},
|
|
641
|
+
azure: {
|
|
642
|
+
400: '#3091ec',
|
|
643
|
+
600: '#1371d6',
|
|
644
|
+
M400: '#5f8dcf',
|
|
645
|
+
M600: '#3a70b2'
|
|
646
|
+
},
|
|
647
|
+
royal: {
|
|
648
|
+
400: '#5d7df5',
|
|
649
|
+
600: '#3353e2',
|
|
650
|
+
M400: '#7986d8',
|
|
651
|
+
M600: '#4b61c3'
|
|
652
|
+
},
|
|
653
|
+
purple: {
|
|
654
|
+
400: '#b552e2',
|
|
655
|
+
600: '#6a27b8',
|
|
656
|
+
M400: '#b072cc',
|
|
657
|
+
M600: '#9358b0'
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
|
|
333
661
|
function retrieveComponentStyles(componentId, props) {
|
|
334
662
|
const components = props.theme && props.theme.components;
|
|
335
663
|
if (!components) {
|
|
@@ -370,6 +698,269 @@ const getArrowPosition = (theme, placement) => {
|
|
|
370
698
|
return retVal;
|
|
371
699
|
};
|
|
372
700
|
|
|
701
|
+
const adjust$1 = (color, expected, actual) => {
|
|
702
|
+
if (expected !== actual) {
|
|
703
|
+
const amount = Math.abs(expected - actual) / 100 * 0.05;
|
|
704
|
+
return expected > actual ? polished.darken(amount, color) : polished.lighten(amount, color);
|
|
705
|
+
}
|
|
706
|
+
return color;
|
|
707
|
+
};
|
|
708
|
+
const toShade = (shade, offset, scheme) => {
|
|
709
|
+
let _shade;
|
|
710
|
+
if (shade === undefined) {
|
|
711
|
+
_shade = scheme === 'dark' ? 500 : 700;
|
|
712
|
+
} else {
|
|
713
|
+
_shade = parseInt(shade.toString(), 10);
|
|
714
|
+
if (isNaN(_shade)) {
|
|
715
|
+
throw new TypeError(`Error: unexpected '${typeof shade}' type for color shade "${shade}"`);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return _shade + (offset || 0);
|
|
719
|
+
};
|
|
720
|
+
const toHex = (hue, shade, offset, scheme) => {
|
|
721
|
+
const _shade = toShade(shade, offset, scheme);
|
|
722
|
+
let retVal = hue[_shade];
|
|
723
|
+
if (!retVal) {
|
|
724
|
+
const closestShade = Object.keys(hue).map(hueShade => parseInt(hueShade, 10)).reduce((previous, current) => {
|
|
725
|
+
return Math.abs(current - _shade) < Math.abs(previous - _shade) ? current : previous;
|
|
726
|
+
});
|
|
727
|
+
retVal = adjust$1(hue[closestShade], _shade, closestShade);
|
|
728
|
+
}
|
|
729
|
+
return retVal;
|
|
730
|
+
};
|
|
731
|
+
const isValidColor = maybeColor => {
|
|
732
|
+
try {
|
|
733
|
+
return !!color2k.parseToRgba(maybeColor);
|
|
734
|
+
} catch {
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
function findNearestIndex(target, arr) {
|
|
739
|
+
let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
740
|
+
if (typeof target !== 'number' || isNaN(target)) {
|
|
741
|
+
throw new Error('Target must be a number.');
|
|
742
|
+
}
|
|
743
|
+
if (!Array.isArray(arr)) {
|
|
744
|
+
throw new Error('Second argument must be an array.');
|
|
745
|
+
}
|
|
746
|
+
let left = startIndex;
|
|
747
|
+
let right = arr.length - 1;
|
|
748
|
+
if (target < arr[left]) return left;
|
|
749
|
+
if (target > arr[right]) return right;
|
|
750
|
+
while (left <= right) {
|
|
751
|
+
const mid = Math.floor((left + right) / 2);
|
|
752
|
+
if (arr[mid] === target) {
|
|
753
|
+
return mid;
|
|
754
|
+
} else if (arr[mid] < target) {
|
|
755
|
+
left = mid + 1;
|
|
756
|
+
} else {
|
|
757
|
+
right = mid - 1;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
return arr[left] - target < target - arr[right] ? left : right;
|
|
761
|
+
}
|
|
762
|
+
const OFFSET_TO_TARGET_RATIO = {
|
|
763
|
+
100: 1.08,
|
|
764
|
+
200: 1.2,
|
|
765
|
+
300: 1.35,
|
|
766
|
+
400: 2,
|
|
767
|
+
500: 2.8,
|
|
768
|
+
600: 3.3,
|
|
769
|
+
700: 5,
|
|
770
|
+
800: 10,
|
|
771
|
+
900: 13,
|
|
772
|
+
1000: 16,
|
|
773
|
+
1100: 17.5,
|
|
774
|
+
1200: 19
|
|
775
|
+
};
|
|
776
|
+
const generateColorScale = memoize__default.default(color => {
|
|
777
|
+
const scaleSize = 200;
|
|
778
|
+
const _scale = color2k.getScale('#FFF', color, '#000');
|
|
779
|
+
const scale = x => _scale(x / scaleSize);
|
|
780
|
+
const colors = [];
|
|
781
|
+
const contrastRatios = [];
|
|
782
|
+
for (let i = 0; i <= scaleSize; i++) {
|
|
783
|
+
const _color = scale(i);
|
|
784
|
+
colors.push(_color);
|
|
785
|
+
contrastRatios.push(polished.getContrast('#FFF', _color));
|
|
786
|
+
}
|
|
787
|
+
const palette = {};
|
|
788
|
+
let startIndex = 0;
|
|
789
|
+
for (const offset in OFFSET_TO_TARGET_RATIO) {
|
|
790
|
+
if (Object.prototype.hasOwnProperty.call(OFFSET_TO_TARGET_RATIO, offset)) {
|
|
791
|
+
const ratio = OFFSET_TO_TARGET_RATIO[offset];
|
|
792
|
+
const nearestIndex = findNearestIndex(ratio, contrastRatios, startIndex);
|
|
793
|
+
startIndex = nearestIndex + 1;
|
|
794
|
+
palette[offset] = colors[nearestIndex];
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
return palette;
|
|
798
|
+
});
|
|
799
|
+
const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transparency) => {
|
|
800
|
+
let retVal;
|
|
801
|
+
let _hue = colors[hue] || hue;
|
|
802
|
+
if (Object.hasOwn(palette, _hue)) {
|
|
803
|
+
_hue = palette[_hue];
|
|
804
|
+
}
|
|
805
|
+
if (typeof _hue === 'object') {
|
|
806
|
+
retVal = toHex(_hue, shade, offset, scheme);
|
|
807
|
+
} else if (_hue === 'transparent' || isValidColor(_hue)) {
|
|
808
|
+
if (shade === undefined) {
|
|
809
|
+
retVal = _hue;
|
|
810
|
+
} else {
|
|
811
|
+
_hue = generateColorScale(_hue);
|
|
812
|
+
retVal = toHex(_hue, shade, offset, scheme);
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
if (retVal && transparency) {
|
|
816
|
+
const alpha = transparency > 1 ? opacity[transparency] : transparency;
|
|
817
|
+
if (alpha === undefined) {
|
|
818
|
+
throw new Error('Error: invalid `transparency` parameter');
|
|
819
|
+
}
|
|
820
|
+
retVal = polished.rgba(retVal, alpha);
|
|
821
|
+
}
|
|
822
|
+
return retVal;
|
|
823
|
+
};
|
|
824
|
+
const toProperty = (object, path) => {
|
|
825
|
+
const retVal = get__default.default(object, path);
|
|
826
|
+
if (typeof retVal === 'string') {
|
|
827
|
+
return retVal;
|
|
828
|
+
} else if (retVal === undefined) {
|
|
829
|
+
throw new ReferenceError(`Error: color variable '${path}' is not defined`);
|
|
830
|
+
} else {
|
|
831
|
+
throw new TypeError(`Error: unexpected '${typeof retVal}' type for color variable "${path}"`);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
const fromRgba = value => {
|
|
835
|
+
let retVal;
|
|
836
|
+
const regex = /rgba\s*\(\s*(?<property>[#\w.]+)\s*,\s*(?<alpha>[\w.]+)\s*\)/gu;
|
|
837
|
+
const _rgba = regex.exec(value);
|
|
838
|
+
if (_rgba && _rgba.groups) {
|
|
839
|
+
const property = _rgba.groups.property;
|
|
840
|
+
const transparency = parseFloat(_rgba.groups.alpha);
|
|
841
|
+
retVal = {
|
|
842
|
+
property,
|
|
843
|
+
transparency
|
|
844
|
+
};
|
|
845
|
+
} else {
|
|
846
|
+
throw new Error(`Error: invalid \`rgba\` value "${value}"`);
|
|
847
|
+
}
|
|
848
|
+
return retVal;
|
|
849
|
+
};
|
|
850
|
+
const fromVariable = (variable, variables, palette) => {
|
|
851
|
+
const retVal = {};
|
|
852
|
+
let property = toProperty(variables, variable);
|
|
853
|
+
if (property.startsWith('rgba')) {
|
|
854
|
+
const value = fromRgba(property);
|
|
855
|
+
property = value.property;
|
|
856
|
+
retVal.transparency = value.transparency;
|
|
857
|
+
}
|
|
858
|
+
const [key, value] = property.split(/\.(?<value>.*)/u);
|
|
859
|
+
if (key === 'palette') {
|
|
860
|
+
retVal.hue = toProperty(palette, value);
|
|
861
|
+
} else {
|
|
862
|
+
retVal.hue = key;
|
|
863
|
+
if (value !== undefined) {
|
|
864
|
+
retVal.shade = parseInt(value, 10);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return retVal;
|
|
868
|
+
};
|
|
869
|
+
const getColor = memoize__default.default(_ref => {
|
|
870
|
+
let {
|
|
871
|
+
dark,
|
|
872
|
+
hue,
|
|
873
|
+
light,
|
|
874
|
+
offset,
|
|
875
|
+
shade,
|
|
876
|
+
theme,
|
|
877
|
+
transparency,
|
|
878
|
+
variable
|
|
879
|
+
} = _ref;
|
|
880
|
+
let retVal;
|
|
881
|
+
const palette = theme.palette && Object.keys(theme.palette).length > 0 ? theme.palette : DEFAULT_THEME.palette;
|
|
882
|
+
const {
|
|
883
|
+
base,
|
|
884
|
+
variables,
|
|
885
|
+
...colors
|
|
886
|
+
} = theme.colors && Object.keys(theme.colors).length > 0 ? theme.colors : DEFAULT_THEME.colors;
|
|
887
|
+
const scheme = base === 'dark' ? 'dark' : 'light';
|
|
888
|
+
const mode = scheme === 'dark' ? dark : light;
|
|
889
|
+
let _hue = mode?.hue || hue;
|
|
890
|
+
let _shade = mode?.shade === undefined ? shade : mode.shade;
|
|
891
|
+
const _offset = mode?.offset === undefined ? offset : mode.offset;
|
|
892
|
+
let _transparency = mode?.transparency === undefined ? transparency : mode.transparency;
|
|
893
|
+
if (variable) {
|
|
894
|
+
const _variables = variables?.[scheme] ? variables[scheme] : DEFAULT_THEME.colors.variables[scheme];
|
|
895
|
+
const value = fromVariable(variable, _variables, palette);
|
|
896
|
+
_hue = value.hue;
|
|
897
|
+
_shade = value.shade;
|
|
898
|
+
_transparency = _transparency === undefined ? value.transparency : _transparency;
|
|
899
|
+
}
|
|
900
|
+
if (_hue) {
|
|
901
|
+
const opacity = theme.opacity && Object.keys(theme.opacity).length > 0 ? theme.opacity : DEFAULT_THEME.opacity;
|
|
902
|
+
retVal = toColor(colors, palette, opacity, scheme, _hue, _shade, _offset, _transparency);
|
|
903
|
+
}
|
|
904
|
+
if (retVal === undefined) {
|
|
905
|
+
throw new Error('Error: invalid `getColor` parameters');
|
|
906
|
+
}
|
|
907
|
+
return retVal;
|
|
908
|
+
}, _ref2 => {
|
|
909
|
+
let {
|
|
910
|
+
dark,
|
|
911
|
+
hue,
|
|
912
|
+
light,
|
|
913
|
+
offset,
|
|
914
|
+
shade,
|
|
915
|
+
theme,
|
|
916
|
+
transparency,
|
|
917
|
+
variable
|
|
918
|
+
} = _ref2;
|
|
919
|
+
return JSON.stringify({
|
|
920
|
+
dark,
|
|
921
|
+
hue,
|
|
922
|
+
light,
|
|
923
|
+
offset,
|
|
924
|
+
shade,
|
|
925
|
+
colors: theme.colors,
|
|
926
|
+
palette: theme.palette,
|
|
927
|
+
opacity: theme.opacity,
|
|
928
|
+
transparency,
|
|
929
|
+
variable
|
|
930
|
+
});
|
|
931
|
+
});
|
|
932
|
+
|
|
933
|
+
const getCheckeredBackground = _ref => {
|
|
934
|
+
let {
|
|
935
|
+
theme,
|
|
936
|
+
size,
|
|
937
|
+
overlay,
|
|
938
|
+
positionY = 0,
|
|
939
|
+
repeat = 'repeat'
|
|
940
|
+
} = _ref;
|
|
941
|
+
const color = getColor({
|
|
942
|
+
theme,
|
|
943
|
+
variable: 'border.default'
|
|
944
|
+
});
|
|
945
|
+
const dimensions = `${size}px ${size}px`;
|
|
946
|
+
const positionX1 = theme.rtl ? '100%' : '0';
|
|
947
|
+
const positionX2 = theme.rtl ? `calc(100% - ${size / 2}px)` : `${size / 2}px`;
|
|
948
|
+
const position1 = `${positionX1} ${positionY}px`;
|
|
949
|
+
const position2 = `${positionX2} ${size / 2 + positionY}px`;
|
|
950
|
+
const position3 = `${positionX2} ${positionY}px`;
|
|
951
|
+
const position4 = `${positionX1} ${size / -2 + positionY}px`;
|
|
952
|
+
let retVal = `
|
|
953
|
+
linear-gradient(45deg, ${color} 25%, transparent 25%) ${position1} / ${dimensions} ${repeat},
|
|
954
|
+
linear-gradient(45deg, transparent 75%, ${color} 75%) ${position2} / ${dimensions} ${repeat},
|
|
955
|
+
linear-gradient(135deg, ${color} 25%, transparent 25%) ${position3} / ${dimensions} ${repeat},
|
|
956
|
+
linear-gradient(135deg, transparent 75%, ${color} 75%) ${position4} / ${dimensions} ${repeat}
|
|
957
|
+
`;
|
|
958
|
+
if (overlay) {
|
|
959
|
+
retVal = overlay.startsWith('linear-gradient') ? `${overlay}, ${retVal}` : `linear-gradient(${overlay}, ${overlay}), ${retVal}`;
|
|
960
|
+
}
|
|
961
|
+
return retVal;
|
|
962
|
+
};
|
|
963
|
+
|
|
373
964
|
const DEFAULT_SHADE = 600;
|
|
374
965
|
const adjust = (color, expected, actual) => {
|
|
375
966
|
if (expected !== actual) {
|
|
@@ -378,7 +969,7 @@ const adjust = (color, expected, actual) => {
|
|
|
378
969
|
}
|
|
379
970
|
return color;
|
|
380
971
|
};
|
|
381
|
-
const
|
|
972
|
+
const getColorV8 = memoize__default.default(function (hue) {
|
|
382
973
|
let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
|
|
383
974
|
let theme = arguments.length > 2 ? arguments[2] : undefined;
|
|
384
975
|
let transparency = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -386,7 +977,17 @@ const getColor = memoize__default.default(function (hue) {
|
|
|
386
977
|
if (isNaN(shade)) {
|
|
387
978
|
return undefined;
|
|
388
979
|
}
|
|
389
|
-
const palette =
|
|
980
|
+
const palette = {
|
|
981
|
+
background: PALETTE_V8.white,
|
|
982
|
+
foreground: PALETTE_V8.grey[800],
|
|
983
|
+
...(theme && theme.palette ? {
|
|
984
|
+
...theme.palette,
|
|
985
|
+
...PALETTE_V8
|
|
986
|
+
} : {
|
|
987
|
+
...DEFAULT_THEME.palette,
|
|
988
|
+
...PALETTE_V8
|
|
989
|
+
})
|
|
990
|
+
};
|
|
390
991
|
const colors = theme && theme.colors ? theme.colors : DEFAULT_THEME.colors;
|
|
391
992
|
let _hue;
|
|
392
993
|
if (typeof hue === 'string') {
|
|
@@ -475,22 +1076,32 @@ const getFocusBoxShadow = _ref => {
|
|
|
475
1076
|
let {
|
|
476
1077
|
boxShadow,
|
|
477
1078
|
inset = false,
|
|
478
|
-
|
|
479
|
-
|
|
1079
|
+
color = {
|
|
1080
|
+
variable: 'border.primaryEmphasis'
|
|
1081
|
+
},
|
|
480
1082
|
shadowWidth = 'md',
|
|
481
|
-
|
|
482
|
-
|
|
1083
|
+
spacerColor = {
|
|
1084
|
+
variable: 'background.default'
|
|
1085
|
+
},
|
|
483
1086
|
spacerWidth = 'xs',
|
|
484
|
-
theme = DEFAULT_THEME
|
|
1087
|
+
theme = DEFAULT_THEME,
|
|
1088
|
+
...args
|
|
485
1089
|
} = _ref;
|
|
486
|
-
const
|
|
487
|
-
const
|
|
1090
|
+
const _args = args;
|
|
1091
|
+
const _color = _args.hue ? getColorV8(_args.hue, _args.shade, theme) : getColor({
|
|
1092
|
+
...color,
|
|
1093
|
+
theme
|
|
1094
|
+
});
|
|
1095
|
+
const shadow = theme.shadows[shadowWidth](_color);
|
|
488
1096
|
if (spacerWidth === null) {
|
|
489
1097
|
return `${inset ? 'inset' : ''} ${shadow}`;
|
|
490
1098
|
}
|
|
491
|
-
const
|
|
1099
|
+
const _spacerColor = _args.spacerHue ? getColorV8(_args.spacerHue, _args.spacerShade, theme) : getColor({
|
|
1100
|
+
...spacerColor,
|
|
1101
|
+
theme
|
|
1102
|
+
});
|
|
492
1103
|
const retVal = `
|
|
493
|
-
${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](
|
|
1104
|
+
${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](_spacerColor)},
|
|
494
1105
|
${inset ? 'inset' : ''} ${shadow}`;
|
|
495
1106
|
return boxShadow ? `${retVal}, ${boxShadow}` : retVal;
|
|
496
1107
|
};
|
|
@@ -558,60 +1169,60 @@ function mediaQuery(query, breakpoint, theme) {
|
|
|
558
1169
|
return retVal;
|
|
559
1170
|
}
|
|
560
1171
|
|
|
561
|
-
const exponentialSymbols = {
|
|
562
|
-
symbols: {
|
|
563
|
-
sqrt: {
|
|
564
|
-
func: {
|
|
565
|
-
symbol: 'sqrt',
|
|
566
|
-
f: a => Math.sqrt(a),
|
|
567
|
-
notation: 'func',
|
|
568
|
-
precedence: 0,
|
|
569
|
-
rightToLeft: 0,
|
|
570
|
-
argCount: 1
|
|
571
|
-
},
|
|
572
|
-
symbol: 'sqrt',
|
|
573
|
-
regSymbol: 'sqrt\\b'
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
1172
|
const animationStyles$1 = (position, modifier) => {
|
|
578
1173
|
const property = position.split('-')[0];
|
|
579
|
-
const animationName =
|
|
580
|
-
return
|
|
1174
|
+
const animationName = styled.keyframes(["0%,66%{", ":2px;border:transparent;}"], property);
|
|
1175
|
+
return styled.css(["&", "::before,&", "::after{animation:0.3s ease-in-out ", ";}"], modifier, modifier, animationName);
|
|
581
1176
|
};
|
|
582
1177
|
const positionStyles = (position, size, inset) => {
|
|
583
|
-
const
|
|
584
|
-
const
|
|
585
|
-
|
|
1178
|
+
const defaultInset = 0.3;
|
|
1179
|
+
const margin = size / -2;
|
|
1180
|
+
const placement = Math.round((margin + inset + defaultInset) * 100) / 100;
|
|
1181
|
+
const marginPx = `${margin}px`;
|
|
1182
|
+
const placementPx = `${placement}px`;
|
|
1183
|
+
const sizePx = `${size}px`;
|
|
586
1184
|
let positionCss;
|
|
587
|
-
let
|
|
1185
|
+
let transform;
|
|
588
1186
|
if (position.startsWith('top')) {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
positionCss = styledComponents.css(["top:", ";right:", ";left:", ";margin-left:", ";"], placement, position === 'top-right' && size, position === 'top' ? '50%' : position === 'top-left' && size, position === 'top' && margin);
|
|
1187
|
+
transform = 'rotate(-135deg)';
|
|
1188
|
+
positionCss = styled.css(["top:", ";right:", ";left:", ";margin-left:", ";"], placementPx, position === 'top-right' && sizePx, position === 'top' ? '50%' : position === 'top-left' && sizePx, position === 'top' && marginPx);
|
|
592
1189
|
} else if (position.startsWith('right')) {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
positionCss = styledComponents.css(["top:", ";right:", ";bottom:", ";margin-top:", ";"], position === 'right' ? '50%' : position === 'right-top' && size, placement, position === 'right-bottom' && size, position === 'right' && margin);
|
|
1190
|
+
transform = 'rotate(-45deg)';
|
|
1191
|
+
positionCss = styled.css(["top:", ";right:", ";bottom:", ";margin-top:", ";"], position === 'right' ? '50%' : position === 'right-top' && sizePx, placementPx, position === 'right-bottom' && sizePx, position === 'right' && marginPx);
|
|
596
1192
|
} else if (position.startsWith('bottom')) {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
positionCss = styledComponents.css(["right:", ";bottom:", ";left:", ";margin-left:", ";"], position === 'bottom-right' && size, placement, position === 'bottom' ? '50%' : position === 'bottom-left' && size, position === 'bottom' && margin);
|
|
1193
|
+
transform = 'rotate(45deg)';
|
|
1194
|
+
positionCss = styled.css(["right:", ";bottom:", ";left:", ";margin-left:", ";"], position === 'bottom-right' && sizePx, placementPx, position === 'bottom' ? '50%' : position === 'bottom-left' && sizePx, position === 'bottom' && marginPx);
|
|
600
1195
|
} else if (position.startsWith('left')) {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
positionCss = styledComponents.css(["top:", ";bottom:", ";left:", ";margin-top:", ";"], position === 'left' ? '50%' : position === 'left-top' && size, size, placement, position === 'left' && margin);
|
|
1196
|
+
transform = 'rotate(135deg)';
|
|
1197
|
+
positionCss = styled.css(["top:", ";bottom:", ";left:", ";margin-top:", ";"], position === 'left' ? '50%' : position === 'left-top' && sizePx, size, placementPx, position === 'left' && marginPx);
|
|
604
1198
|
}
|
|
605
|
-
return
|
|
1199
|
+
return styled.css(["&::before,&::after{transform:", ";", ";}"], transform, positionCss);
|
|
606
1200
|
};
|
|
607
1201
|
function arrowStyles(position) {
|
|
608
1202
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
609
|
-
const
|
|
610
|
-
const
|
|
611
|
-
const
|
|
612
|
-
|
|
1203
|
+
const inset = polished.stripUnit(options.inset || '0');
|
|
1204
|
+
const size = polished.stripUnit(options.size || '6');
|
|
1205
|
+
const sizeOffset = 2;
|
|
1206
|
+
const squareSize = size * 2 / Math.sqrt(2) + sizeOffset;
|
|
1207
|
+
const squareSizeRounded = Math.round(squareSize * 100) / 100;
|
|
1208
|
+
const squareSizePx = `${squareSizeRounded}px`;
|
|
1209
|
+
const afterOffset = 0;
|
|
1210
|
+
const beforeOffset = afterOffset + 2;
|
|
1211
|
+
return styled.css(["position:relative;&::before,&::after{position:absolute;border-width:inherit;border-style:inherit;background-color:inherit;width:", ";height:", ";content:'';box-sizing:inherit;}&::before{border-color:inherit;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}&::after{border-color:transparent;background-clip:content-box;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}", ";", ";"], squareSizePx, squareSizePx, beforeOffset, beforeOffset, afterOffset, afterOffset, positionStyles(position, squareSizeRounded, inset), options.animationModifier && animationStyles$1(position, options.animationModifier));
|
|
613
1212
|
}
|
|
614
1213
|
|
|
1214
|
+
const useDocument = theme => {
|
|
1215
|
+
const [controlledDocument, setControlledDocument] = React.useState();
|
|
1216
|
+
React.useEffect(() => {
|
|
1217
|
+
if (theme && theme.document) {
|
|
1218
|
+
setControlledDocument(theme.document);
|
|
1219
|
+
} else {
|
|
1220
|
+
setControlledDocument(document);
|
|
1221
|
+
}
|
|
1222
|
+
}, [theme]);
|
|
1223
|
+
return controlledDocument;
|
|
1224
|
+
};
|
|
1225
|
+
|
|
615
1226
|
const useWindow = theme => {
|
|
616
1227
|
const [controlledWindow, setControlledWindow] = React.useState();
|
|
617
1228
|
React.useEffect(() => {
|
|
@@ -659,12 +1270,33 @@ const animationStyles = (position, options) => {
|
|
|
659
1270
|
} else {
|
|
660
1271
|
transformFunction = 'translateX';
|
|
661
1272
|
}
|
|
662
|
-
const animationName =
|
|
663
|
-
return
|
|
1273
|
+
const animationName = styled.keyframes(["0%{transform:", "(", ");}"], transformFunction, translateValue);
|
|
1274
|
+
return styled.css(["&", " ", "{animation:0.2s cubic-bezier(0.15,0.85,0.35,1.2) ", ";}"], options.animationModifier, options.childSelector || '> *', animationName);
|
|
1275
|
+
};
|
|
1276
|
+
const colorStyles = theme => {
|
|
1277
|
+
const backgroundColor = getColor({
|
|
1278
|
+
theme,
|
|
1279
|
+
variable: 'background.raised'
|
|
1280
|
+
});
|
|
1281
|
+
const borderColor = getColor({
|
|
1282
|
+
theme,
|
|
1283
|
+
variable: 'border.default'
|
|
1284
|
+
});
|
|
1285
|
+
const boxShadowColor = getColor({
|
|
1286
|
+
variable: 'shadow.medium',
|
|
1287
|
+
theme
|
|
1288
|
+
});
|
|
1289
|
+
const boxShadowBlurRadius = `${theme.space.base * (theme.colors.base === 'dark' ? 5 : 6)}px`;
|
|
1290
|
+
const boxShadowOffsetY = `${theme.space.base * (theme.colors.base === 'dark' ? 4 : 5)}px`;
|
|
1291
|
+
const foregroundColor = getColor({
|
|
1292
|
+
theme,
|
|
1293
|
+
variable: 'foreground.default'
|
|
1294
|
+
});
|
|
1295
|
+
return styled.css(["border-color:", ";box-shadow:", ";background-color:", ";color:", ";"], borderColor, theme.shadows.lg(boxShadowOffsetY, boxShadowBlurRadius, boxShadowColor), backgroundColor, foregroundColor);
|
|
664
1296
|
};
|
|
665
1297
|
const hiddenStyles = options => {
|
|
666
1298
|
const transition = 'opacity 0.2s ease-in-out, 0.2s visibility 0s linear';
|
|
667
|
-
return
|
|
1299
|
+
return styled.css(["transition:", ";visibility:hidden;opacity:0;"], options.animationModifier && transition);
|
|
668
1300
|
};
|
|
669
1301
|
function menuStyles(position) {
|
|
670
1302
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -679,10 +1311,10 @@ function menuStyles(position) {
|
|
|
679
1311
|
} else {
|
|
680
1312
|
marginProperty = 'margin-right';
|
|
681
1313
|
}
|
|
682
|
-
return
|
|
1314
|
+
return styled.css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;color-scheme:only ", ";& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", ";border-radius:", ";cursor:default;padding:0;text-align:", ";white-space:normal;font-size:", ";font-weight:", ";direction:", ";", ";:focus{outline:none;}}", ";", ";"], options.zIndex || 0, marginProperty, options.margin, p => p.theme.colors.base, options.childSelector || '> *', theme.borders.sm, theme.borderRadii.md, theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', colorStyles(theme), options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
|
|
683
1315
|
}
|
|
684
1316
|
|
|
685
|
-
const SELECTOR_FOCUS_VISIBLE = '&:focus-visible
|
|
1317
|
+
const SELECTOR_FOCUS_VISIBLE = '&:focus-visible';
|
|
686
1318
|
const focusStyles = _ref => {
|
|
687
1319
|
let {
|
|
688
1320
|
condition = true,
|
|
@@ -711,24 +1343,40 @@ const focusStyles = _ref => {
|
|
|
711
1343
|
outline = `${polished.math(`${theme.shadowWidths[shadowWidth]} - ${theme.shadowWidths[spacerWidth]}`)} solid transparent`;
|
|
712
1344
|
outlineOffset = theme.shadowWidths[spacerWidth];
|
|
713
1345
|
}
|
|
714
|
-
return
|
|
1346
|
+
return styled.css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, _boxShadow, styles);
|
|
715
1347
|
};
|
|
716
1348
|
|
|
1349
|
+
const StyledBaseIcon = styled__default.default(_ref => {
|
|
1350
|
+
let {
|
|
1351
|
+
children,
|
|
1352
|
+
theme,
|
|
1353
|
+
...props
|
|
1354
|
+
} = _ref;
|
|
1355
|
+
return React__default.default.cloneElement(React.Children.only(children), props);
|
|
1356
|
+
}).withConfig({
|
|
1357
|
+
displayName: "StyledBaseIcon",
|
|
1358
|
+
componentId: "sc-1moykgb-0"
|
|
1359
|
+
})([""]);
|
|
1360
|
+
|
|
717
1361
|
const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
|
|
718
1362
|
const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
|
|
719
1363
|
const PLACEMENT = ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
720
1364
|
|
|
721
|
-
exports.
|
|
722
|
-
exports.ARRAY_MENU_POSITION = MENU_POSITION;
|
|
1365
|
+
exports.ARROW_POSITION = ARROW_POSITION;
|
|
723
1366
|
exports.DEFAULT_THEME = DEFAULT_THEME;
|
|
1367
|
+
exports.MENU_POSITION = MENU_POSITION;
|
|
724
1368
|
exports.PALETTE = PALETTE;
|
|
1369
|
+
exports.PALETTE_V8 = PALETTE_V8;
|
|
725
1370
|
exports.PLACEMENT = PLACEMENT;
|
|
726
1371
|
exports.SELECTOR_FOCUS_VISIBLE = SELECTOR_FOCUS_VISIBLE;
|
|
1372
|
+
exports.StyledBaseIcon = StyledBaseIcon;
|
|
727
1373
|
exports.ThemeProvider = ThemeProvider;
|
|
728
1374
|
exports.arrowStyles = arrowStyles;
|
|
729
1375
|
exports.focusStyles = focusStyles;
|
|
730
1376
|
exports.getArrowPosition = getArrowPosition;
|
|
1377
|
+
exports.getCheckeredBackground = getCheckeredBackground;
|
|
731
1378
|
exports.getColor = getColor;
|
|
1379
|
+
exports.getColorV8 = getColorV8;
|
|
732
1380
|
exports.getFloatingPlacements = getFloatingPlacements;
|
|
733
1381
|
exports.getFocusBoxShadow = getFocusBoxShadow;
|
|
734
1382
|
exports.getLineHeight = getLineHeight;
|
|
@@ -736,7 +1384,6 @@ exports.getMenuPosition = getMenuPosition;
|
|
|
736
1384
|
exports.mediaQuery = mediaQuery;
|
|
737
1385
|
exports.menuStyles = menuStyles;
|
|
738
1386
|
exports.retrieveComponentStyles = retrieveComponentStyles;
|
|
739
|
-
exports.retrieveTheme = retrieveComponentStyles;
|
|
740
1387
|
exports.useDocument = useDocument;
|
|
741
1388
|
exports.useText = useText;
|
|
742
1389
|
exports.useWindow = useWindow;
|