@databricks/design-system 1.12.8 → 1.12.9
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/Typography-91d3d591.js +2106 -0
- package/dist/Typography-91d3d591.js.map +1 -0
- package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxContent.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionControlledList.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionList.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListCheckboxItem.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxOptionListSelectItem.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/DialogComboboxTrigger.d.ts +3 -2
- package/dist/design-system/DialogCombobox/DialogComboboxTrigger.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/providers/DialogComboboxOptionListContext.d.ts +2 -2
- package/dist/design-system/DialogCombobox/providers/DialogComboboxOptionListContext.d.ts.map +1 -1
- package/dist/design-system/DialogCombobox/shared.d.ts +2 -0
- package/dist/design-system/DialogCombobox/shared.d.ts.map +1 -1
- package/dist/design-system/FormV2/RHFAdapters.d.ts +32 -1
- package/dist/design-system/FormV2/RHFAdapters.d.ts.map +1 -1
- package/dist/design-system/Icon/__generated/icons/index.d.ts +0 -1
- package/dist/design-system/Icon/__generated/icons/index.d.ts.map +1 -1
- package/dist/design-system/SelectV2/Select.d.ts +7 -0
- package/dist/design-system/SelectV2/Select.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectContent.d.ts +6 -0
- package/dist/design-system/SelectV2/SelectContent.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectOption.d.ts +6 -0
- package/dist/design-system/SelectV2/SelectOption.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectOptionGroup.d.ts +7 -0
- package/dist/design-system/SelectV2/SelectOptionGroup.d.ts.map +1 -0
- package/dist/design-system/SelectV2/SelectTrigger.d.ts +6 -0
- package/dist/design-system/SelectV2/SelectTrigger.d.ts.map +1 -0
- package/dist/design-system/SelectV2/hooks/useSelectContext.d.ts +2 -0
- package/dist/design-system/SelectV2/hooks/useSelectContext.d.ts.map +1 -0
- package/dist/design-system/SelectV2/index.d.ts +6 -0
- package/dist/design-system/SelectV2/index.d.ts.map +1 -0
- package/dist/design-system/SelectV2/providers/SelectContext.d.ts +11 -0
- package/dist/design-system/SelectV2/providers/SelectContext.d.ts.map +1 -0
- package/dist/design-system/index.d.ts +1 -0
- package/dist/design-system/index.d.ts.map +1 -1
- package/dist/development/ChatUI/ChatInput.d.ts.map +1 -1
- package/dist/development/ChatUI/CodeSnippet.d.ts.map +1 -1
- package/dist/development/ChatUI/Feedback.d.ts.map +1 -1
- package/dist/development/ChatUI/MessageActionButton.d.ts +4 -0
- package/dist/development/ChatUI/MessageActionButton.d.ts.map +1 -0
- package/dist/development/ChatUI/index.d.ts +1 -0
- package/dist/development/ChatUI/index.d.ts.map +1 -1
- package/dist/development.js +92 -22
- package/dist/development.js.map +1 -1
- package/dist/index.js +380 -128
- package/dist/index.js.map +1 -1
- package/dist/test-utils/enzyme.js.map +1 -1
- package/dist/test-utils/rtl/selectEvent.d.ts.map +1 -1
- package/dist/test-utils/rtl.js +25 -8
- package/dist/test-utils/rtl.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,2106 @@
|
|
|
1
|
+
import React__default, { createContext, useContext, useMemo, useEffect, forwardRef } from 'react';
|
|
2
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
3
|
+
import { useTheme, ThemeProvider, css } from '@emotion/react';
|
|
4
|
+
import { notification, ConfigProvider, Button as Button$1, Input as Input$1, Typography as Typography$1 } from 'antd';
|
|
5
|
+
import chroma from 'chroma-js';
|
|
6
|
+
import AntDIcon from '@ant-design/icons';
|
|
7
|
+
import _isNil from 'lodash/isNil';
|
|
8
|
+
import _endsWith from 'lodash/endsWith';
|
|
9
|
+
import _isBoolean from 'lodash/isBoolean';
|
|
10
|
+
import _isNumber from 'lodash/isNumber';
|
|
11
|
+
import _isString from 'lodash/isString';
|
|
12
|
+
import _mapValues from 'lodash/mapValues';
|
|
13
|
+
import unitless from '@emotion/unitless';
|
|
14
|
+
|
|
15
|
+
// Border variables
|
|
16
|
+
const borders = {
|
|
17
|
+
borderRadiusMd: 4
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
21
|
+
var borders$1 = {
|
|
22
|
+
...borders
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* These values are based on AntD's breakpoints which follow BootStrap 4 media query rules.
|
|
27
|
+
* The numerical values represent the min-width of the given size.
|
|
28
|
+
* AntD values: https://ant.design/components/grid#col
|
|
29
|
+
* Bootstrap: https://getbootstrap.com/docs/4.0/layout/overview/#responsive-breakpoints
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const breakpoints = {
|
|
33
|
+
xs: 0,
|
|
34
|
+
sm: 576,
|
|
35
|
+
md: 768,
|
|
36
|
+
lg: 992,
|
|
37
|
+
xl: 1200,
|
|
38
|
+
xxl: 1600
|
|
39
|
+
};
|
|
40
|
+
const mediaQueries = {
|
|
41
|
+
xs: '@media (max-width: 575.98px)',
|
|
42
|
+
sm: `@media (min-width: ${breakpoints.sm}px)`,
|
|
43
|
+
md: `@media (min-width: ${breakpoints.md}px)`,
|
|
44
|
+
lg: `@media (min-width: ${breakpoints.lg}px)`,
|
|
45
|
+
xl: `@media (min-width: ${breakpoints.xl}px)`,
|
|
46
|
+
xxl: `@media (min-width: ${breakpoints.xxl}px)`
|
|
47
|
+
};
|
|
48
|
+
const responsive = {
|
|
49
|
+
breakpoints,
|
|
50
|
+
mediaQueries
|
|
51
|
+
};
|
|
52
|
+
var responsive$1 = responsive;
|
|
53
|
+
|
|
54
|
+
// Exported from go/designsystem/colorsheet
|
|
55
|
+
const colorPalettePrimary = {
|
|
56
|
+
primary: '#2272B4',
|
|
57
|
+
blue100: '#F0F8FF',
|
|
58
|
+
blue200: '#D7EDFE',
|
|
59
|
+
blue300: '#BAE1FC',
|
|
60
|
+
blue400: '#8FCDFF',
|
|
61
|
+
blue500: '#4299E0',
|
|
62
|
+
blue600: '#2272B4',
|
|
63
|
+
blue700: '#0E538B',
|
|
64
|
+
blue800: '#04355D',
|
|
65
|
+
green100: '#F3FCF6',
|
|
66
|
+
green200: '#D4F7DF',
|
|
67
|
+
green300: '#B1ECC5',
|
|
68
|
+
green400: '#8DDDA8',
|
|
69
|
+
green500: '#3CAA60',
|
|
70
|
+
green600: '#277C43',
|
|
71
|
+
green700: '#115026',
|
|
72
|
+
green800: '#093919',
|
|
73
|
+
white: '#FFFFFF',
|
|
74
|
+
grey100: '#F2F5F7',
|
|
75
|
+
grey200: '#E4ECF1',
|
|
76
|
+
grey300: '#CDDAE5',
|
|
77
|
+
grey400: '#BDCDDB',
|
|
78
|
+
grey500: '#8196A7',
|
|
79
|
+
grey600: '#5D7283',
|
|
80
|
+
grey700: '#44535F',
|
|
81
|
+
grey800: '#1F272D',
|
|
82
|
+
red100: '#FFF5F7',
|
|
83
|
+
red200: '#FDE2E8',
|
|
84
|
+
red300: '#FBD0D8',
|
|
85
|
+
red400: '#F792A6',
|
|
86
|
+
red500: '#E65B77',
|
|
87
|
+
red600: '#C82D4C',
|
|
88
|
+
red700: '#9E102C',
|
|
89
|
+
red800: '#630316',
|
|
90
|
+
yellow100: '#FFF9EB',
|
|
91
|
+
yellow200: '#FCEACA',
|
|
92
|
+
yellow300: '#F8D4A5',
|
|
93
|
+
yellow400: '#F2BE88',
|
|
94
|
+
yellow500: '#DE7921',
|
|
95
|
+
yellow600: '#BE501E',
|
|
96
|
+
yellow700: '#93320B',
|
|
97
|
+
yellow800: '#5F1B02'
|
|
98
|
+
};
|
|
99
|
+
const colorPaletteSecondary = {
|
|
100
|
+
brown: '#A6630C',
|
|
101
|
+
coral: '#C83243',
|
|
102
|
+
charcoal: '#5D7283',
|
|
103
|
+
indigo: '#434A93',
|
|
104
|
+
lemon: '#FACB66',
|
|
105
|
+
lime: '#308613',
|
|
106
|
+
pink: '#B45091',
|
|
107
|
+
purple: '#8A63BF',
|
|
108
|
+
teal: '#04867D',
|
|
109
|
+
turquoise: '#157CBC'
|
|
110
|
+
};
|
|
111
|
+
const lightColorList = {
|
|
112
|
+
backgroundPrimary: colorPalettePrimary.white,
|
|
113
|
+
actionDangerPrimaryBackgroundDefault: colorPalettePrimary.red600,
|
|
114
|
+
actionDangerPrimaryBackgroundHover: colorPalettePrimary.red700,
|
|
115
|
+
actionDangerPrimaryBackgroundPress: colorPalettePrimary.red800,
|
|
116
|
+
actionDangerDefaultBackgroundDefault: chroma(colorPalettePrimary.red600).alpha(0).hex(),
|
|
117
|
+
actionDangerDefaultBackgroundHover: chroma(colorPalettePrimary.red600).alpha(0.08).hex(),
|
|
118
|
+
actionDangerDefaultBackgroundPress: chroma(colorPalettePrimary.red600).alpha(0.16).hex(),
|
|
119
|
+
actionDangerDefaultBorderDefault: colorPalettePrimary.red600,
|
|
120
|
+
actionDangerDefaultBorderHover: colorPalettePrimary.red700,
|
|
121
|
+
actionDangerDefaultBorderPress: colorPalettePrimary.red800,
|
|
122
|
+
actionDangerDefaultTextDefault: colorPalettePrimary.red600,
|
|
123
|
+
actionDangerDefaultTextHover: colorPalettePrimary.red700,
|
|
124
|
+
actionDangerDefaultTextPress: colorPalettePrimary.red800,
|
|
125
|
+
actionDefaultBackgroundDefault: chroma(colorPalettePrimary.blue800).alpha(0).hex(),
|
|
126
|
+
actionDefaultBackgroundHover: chroma(colorPalettePrimary.blue600).alpha(0.08).hex(),
|
|
127
|
+
actionDefaultBackgroundPress: chroma(colorPalettePrimary.blue600).alpha(0.16).hex(),
|
|
128
|
+
actionDefaultBorderDefault: colorPalettePrimary.grey300,
|
|
129
|
+
actionDefaultBorderFocus: colorPalettePrimary.blue600,
|
|
130
|
+
actionDefaultBorderHover: colorPalettePrimary.blue700,
|
|
131
|
+
actionDefaultBorderPress: colorPalettePrimary.blue800,
|
|
132
|
+
actionDefaultTextDefault: colorPalettePrimary.grey800,
|
|
133
|
+
actionDefaultTextHover: colorPalettePrimary.blue700,
|
|
134
|
+
actionDefaultTextPress: colorPalettePrimary.blue800,
|
|
135
|
+
actionDisabledBackground: colorPalettePrimary.grey200,
|
|
136
|
+
actionDisabledText: colorPalettePrimary.grey400,
|
|
137
|
+
actionPrimaryBackgroundDefault: colorPalettePrimary.blue600,
|
|
138
|
+
actionPrimaryBackgroundHover: colorPalettePrimary.blue700,
|
|
139
|
+
actionPrimaryBackgroundPress: colorPalettePrimary.blue800,
|
|
140
|
+
actionPrimaryTextDefault: colorPalettePrimary.white,
|
|
141
|
+
actionPrimaryTextHover: colorPalettePrimary.white,
|
|
142
|
+
actionPrimaryTextPress: colorPalettePrimary.white,
|
|
143
|
+
actionTertiaryBackgroundDefault: chroma(colorPalettePrimary.blue600).alpha(0).hex(),
|
|
144
|
+
actionTertiaryBackgroundHover: chroma(colorPalettePrimary.blue600).alpha(0.08).hex(),
|
|
145
|
+
actionTertiaryBackgroundPress: chroma(colorPalettePrimary.blue600).alpha(0.16).hex(),
|
|
146
|
+
actionTertiaryTextDefault: colorPalettePrimary.blue600,
|
|
147
|
+
actionTertiaryTextHover: colorPalettePrimary.blue700,
|
|
148
|
+
actionTertiaryTextPress: colorPalettePrimary.blue800,
|
|
149
|
+
backgroundDanger: chroma(colorPalettePrimary.red100).alpha(0.08).hex(),
|
|
150
|
+
backgroundSecondary: colorPalettePrimary.grey100,
|
|
151
|
+
backgroundWarning: chroma(colorPalettePrimary.yellow100).alpha(0.08).hex(),
|
|
152
|
+
backgroundValidationDanger: colorPalettePrimary.red100,
|
|
153
|
+
backgroundValidationSuccess: colorPalettePrimary.blue100,
|
|
154
|
+
backgroundValidationWarning: colorPalettePrimary.yellow100,
|
|
155
|
+
border: colorPalettePrimary.grey300,
|
|
156
|
+
borderDecorative: colorPalettePrimary.grey200,
|
|
157
|
+
borderValidationDanger: colorPalettePrimary.red300,
|
|
158
|
+
borderValidationWarning: colorPalettePrimary.yellow300,
|
|
159
|
+
textPrimary: colorPalettePrimary.grey800,
|
|
160
|
+
textSecondary: colorPalettePrimary.grey600,
|
|
161
|
+
textPlaceholder: colorPalettePrimary.grey400,
|
|
162
|
+
textValidationDanger: colorPalettePrimary.red600,
|
|
163
|
+
textValidationSuccess: colorPalettePrimary.green600,
|
|
164
|
+
textValidationWarning: colorPalettePrimary.yellow600,
|
|
165
|
+
textValidationInfo: colorPalettePrimary.grey600,
|
|
166
|
+
overlayOverlay: chroma(colorPalettePrimary.grey100).alpha(0.72).hex(),
|
|
167
|
+
// Tags
|
|
168
|
+
tagDefault: chroma(colorPalettePrimary.grey600).alpha(0.08).hex(),
|
|
169
|
+
tagBrown: colorPaletteSecondary.brown,
|
|
170
|
+
tagCoral: colorPaletteSecondary.coral,
|
|
171
|
+
tagCharcoal: colorPalettePrimary.grey600,
|
|
172
|
+
tagIndigo: colorPaletteSecondary.indigo,
|
|
173
|
+
tagLemon: colorPaletteSecondary.lemon,
|
|
174
|
+
tagLime: colorPaletteSecondary.lime,
|
|
175
|
+
tagPink: colorPaletteSecondary.pink,
|
|
176
|
+
tagPurple: colorPaletteSecondary.purple,
|
|
177
|
+
tagTeal: colorPaletteSecondary.teal,
|
|
178
|
+
tagTurquoise: colorPaletteSecondary.turquoise,
|
|
179
|
+
tagText: colorPalettePrimary.white,
|
|
180
|
+
tagHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
181
|
+
tagPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
182
|
+
tagIconHover: chroma(colorPalettePrimary.white).alpha(0.8).hex(),
|
|
183
|
+
tagIconPress: chroma(colorPalettePrimary.white).alpha(0.76).hex(),
|
|
184
|
+
// Typography
|
|
185
|
+
typographyCodeBg: chroma(colorPalettePrimary.grey600).alpha(0.08).hex(),
|
|
186
|
+
// Table
|
|
187
|
+
tableRowHover: chroma(colorPalettePrimary.grey600).alpha(0.04).hex(),
|
|
188
|
+
tooltipBackgroundTooltip: colorPalettePrimary.grey800
|
|
189
|
+
};
|
|
190
|
+
const darkColorList = {
|
|
191
|
+
actionDangerPrimaryBackgroundDefault: chroma(colorPalettePrimary.red400).alpha(0.84).hex(),
|
|
192
|
+
actionDangerPrimaryBackgroundHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
|
|
193
|
+
actionDangerPrimaryBackgroundPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
|
|
194
|
+
actionDangerDefaultBackgroundDefault: chroma(colorPalettePrimary.red400).alpha(0).hex(),
|
|
195
|
+
actionDangerDefaultBackgroundHover: chroma(colorPalettePrimary.red400).alpha(0.08).hex(),
|
|
196
|
+
actionDangerDefaultBackgroundPress: chroma(colorPalettePrimary.red400).alpha(0.16).hex(),
|
|
197
|
+
actionDangerDefaultBorderDefault: colorPalettePrimary.red400,
|
|
198
|
+
actionDangerDefaultBorderHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
|
|
199
|
+
actionDangerDefaultBorderPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
|
|
200
|
+
actionDangerDefaultTextDefault: colorPalettePrimary.red400,
|
|
201
|
+
actionDangerDefaultTextHover: chroma(colorPalettePrimary.red400).alpha(0.72).hex(),
|
|
202
|
+
actionDangerDefaultTextPress: chroma(colorPalettePrimary.red400).alpha(0.6).hex(),
|
|
203
|
+
actionDefaultBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0).hex(),
|
|
204
|
+
actionDefaultBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
205
|
+
actionDefaultBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
206
|
+
actionDefaultBorderDefault: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
207
|
+
actionDefaultBorderFocus: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
|
|
208
|
+
actionDefaultBorderHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
209
|
+
actionDefaultBorderPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
210
|
+
actionDefaultTextDefault: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
|
|
211
|
+
actionDefaultTextHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
212
|
+
actionDefaultTextPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
213
|
+
actionDisabledBackground: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
|
|
214
|
+
actionDisabledText: chroma(colorPalettePrimary.white).alpha(0.4).hex(),
|
|
215
|
+
actionPrimaryBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
|
|
216
|
+
actionPrimaryBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
217
|
+
actionPrimaryBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
218
|
+
actionPrimaryTextDefault: colorPalettePrimary.grey800,
|
|
219
|
+
actionPrimaryTextHover: colorPalettePrimary.grey800,
|
|
220
|
+
actionPrimaryTextPress: colorPalettePrimary.grey800,
|
|
221
|
+
actionTertiaryBackgroundDefault: chroma(colorPalettePrimary.blue400).alpha(0).hex(),
|
|
222
|
+
actionTertiaryBackgroundHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
223
|
+
actionTertiaryBackgroundPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
224
|
+
actionTertiaryTextDefault: chroma(colorPalettePrimary.blue400).alpha(0.84).hex(),
|
|
225
|
+
actionTertiaryTextHover: chroma(colorPalettePrimary.blue400).alpha(0.8).hex(),
|
|
226
|
+
actionTertiaryTextPress: chroma(colorPalettePrimary.blue400).alpha(0.76).hex(),
|
|
227
|
+
backgroundPrimary: colorPalettePrimary.grey800,
|
|
228
|
+
backgroundSecondary: '#283035',
|
|
229
|
+
backgroundValidationDanger: 'transparent',
|
|
230
|
+
backgroundValidationSuccess: 'transparent',
|
|
231
|
+
backgroundValidationWarning: 'transparent',
|
|
232
|
+
border: chroma(colorPalettePrimary.white).alpha(0.48).hex(),
|
|
233
|
+
borderDecorative: chroma(colorPalettePrimary.white).alpha(0.24).hex(),
|
|
234
|
+
borderValidationDanger: colorPalettePrimary.red300,
|
|
235
|
+
borderValidationWarning: colorPalettePrimary.yellow300,
|
|
236
|
+
textPrimary: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
|
|
237
|
+
textSecondary: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
238
|
+
textPlaceholder: chroma(colorPalettePrimary.grey400).alpha(0.84).hex(),
|
|
239
|
+
textValidationDanger: chroma(colorPalettePrimary.red400).alpha(0.84).hex(),
|
|
240
|
+
textValidationSuccess: chroma(colorPalettePrimary.green400).alpha(0.84).hex(),
|
|
241
|
+
textValidationWarning: chroma(colorPalettePrimary.yellow400).alpha(0.84).hex(),
|
|
242
|
+
textValidationInfo: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
243
|
+
overlayOverlay: chroma(colorPalettePrimary.grey800).alpha(0.72).hex(),
|
|
244
|
+
// Tags
|
|
245
|
+
tagDefault: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
|
|
246
|
+
tagBrown: chroma(colorPaletteSecondary.brown).alpha(0.84).hex(),
|
|
247
|
+
tagCoral: chroma(colorPaletteSecondary.coral).alpha(0.84).hex(),
|
|
248
|
+
tagCharcoal: chroma(colorPalettePrimary.grey600).alpha(0.84).hex(),
|
|
249
|
+
tagIndigo: chroma(colorPaletteSecondary.indigo).alpha(0.84).hex(),
|
|
250
|
+
tagLemon: chroma(colorPaletteSecondary.lemon).alpha(0.84).hex(),
|
|
251
|
+
tagLime: chroma(colorPaletteSecondary.lime).alpha(0.84).hex(),
|
|
252
|
+
tagPink: chroma(colorPaletteSecondary.pink).alpha(0.84).hex(),
|
|
253
|
+
tagPurple: chroma(colorPaletteSecondary.purple).alpha(0.84).hex(),
|
|
254
|
+
tagTeal: chroma(colorPaletteSecondary.teal).alpha(0.84).hex(),
|
|
255
|
+
tagTurquoise: chroma(colorPaletteSecondary.turquoise).alpha(0.84).hex(),
|
|
256
|
+
tagText: chroma(colorPalettePrimary.white).alpha(0.84).hex(),
|
|
257
|
+
tagHover: chroma(colorPalettePrimary.blue400).alpha(0.08).hex(),
|
|
258
|
+
tagPress: chroma(colorPalettePrimary.blue400).alpha(0.16).hex(),
|
|
259
|
+
tagIconHover: chroma(colorPalettePrimary.white).alpha(0.8).hex(),
|
|
260
|
+
tagIconPress: chroma(colorPalettePrimary.white).alpha(0.76).hex(),
|
|
261
|
+
// Typography
|
|
262
|
+
typographyCodeBg: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
|
|
263
|
+
// Table
|
|
264
|
+
tableRowHover: chroma(colorPalettePrimary.white).alpha(0.16).hex(),
|
|
265
|
+
tooltipBackgroundTooltip: chroma(colorPalettePrimary.white).alpha(0.6).hex(),
|
|
266
|
+
// Missing in list
|
|
267
|
+
backgroundDanger: 'rgba(200,45,76,0.08)',
|
|
268
|
+
backgroundWarning: 'rgba(222,121,33,0.08)'
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const darkColors = {
|
|
272
|
+
...darkColorList,
|
|
273
|
+
...colorPalettePrimary,
|
|
274
|
+
...colorPaletteSecondary
|
|
275
|
+
};
|
|
276
|
+
const lightColors = {
|
|
277
|
+
...lightColorList,
|
|
278
|
+
...colorPalettePrimary,
|
|
279
|
+
...colorPaletteSecondary
|
|
280
|
+
};
|
|
281
|
+
function getSemanticColors(isDarkMode) {
|
|
282
|
+
return isDarkMode ? darkColors : lightColors;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// TODO (FEINF-1674): Remove when removing USE_NEW_RADIO_STYLES
|
|
286
|
+
/*
|
|
287
|
+
Colors that need to be replaced by semantic colors.
|
|
288
|
+
*/
|
|
289
|
+
const deprecatedColors = {
|
|
290
|
+
// Radio Colors
|
|
291
|
+
radioInteractiveAvailable: colorPalettePrimary.primary,
|
|
292
|
+
radioInteractiveHover: '#186099',
|
|
293
|
+
radioInteractivePress: '#0D4F85',
|
|
294
|
+
radioDisabled: '#A2AEB8',
|
|
295
|
+
radioDefaultBorder: '#64727D',
|
|
296
|
+
radioDefaultBackground: '#FFFFFF',
|
|
297
|
+
radioInteractiveHoverSecondary: 'rgba(34, 115, 181, 0.08)',
|
|
298
|
+
// Fade of Interactive Available
|
|
299
|
+
radioInteractivePressSecondary: 'rgba(34, 115, 181, 0.16)' // Fade of Interactive Available
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
function getColors(isDarkMode) {
|
|
303
|
+
return {
|
|
304
|
+
...deprecatedColors,
|
|
305
|
+
...getSemanticColors(isDarkMode)
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
310
|
+
var antdVars = {
|
|
311
|
+
// IMPORTANT: Do not read this directly from components. Use `React.useContext`.
|
|
312
|
+
'ant-prefix': 'du-bois'
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const DEFAULT_SPACING_UNIT = 8;
|
|
316
|
+
const MODAL_PADDING = 40;
|
|
317
|
+
const spacing = {
|
|
318
|
+
xs: DEFAULT_SPACING_UNIT / 2,
|
|
319
|
+
sm: DEFAULT_SPACING_UNIT,
|
|
320
|
+
md: DEFAULT_SPACING_UNIT * 2,
|
|
321
|
+
lg: DEFAULT_SPACING_UNIT * 3
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// Less variables that are used by AntD
|
|
325
|
+
({
|
|
326
|
+
defaultPaddingLg: spacing.lg,
|
|
327
|
+
defaultPaddingMd: spacing.md,
|
|
328
|
+
defaultPaddingSm: spacing.sm,
|
|
329
|
+
defaultPaddingXs: spacing.sm,
|
|
330
|
+
defaultPaddingXss: spacing.xs,
|
|
331
|
+
paddingLg: spacing.md,
|
|
332
|
+
// TODO: Check if there is a better alternative with team
|
|
333
|
+
paddingMd: spacing.sm,
|
|
334
|
+
paddingSm: spacing.sm,
|
|
335
|
+
paddingXs: spacing.xs,
|
|
336
|
+
paddingXss: 0,
|
|
337
|
+
marginSm: 12,
|
|
338
|
+
marginLg: spacing.lg,
|
|
339
|
+
// Button
|
|
340
|
+
btnPaddingHorizontalBase: DEFAULT_SPACING_UNIT * 2,
|
|
341
|
+
btnPaddingHorizontalLg: DEFAULT_SPACING_UNIT * 2,
|
|
342
|
+
btnPaddingHorizontalSm: DEFAULT_SPACING_UNIT * 2,
|
|
343
|
+
// Input
|
|
344
|
+
inputPaddingHorizontal: DEFAULT_SPACING_UNIT * 1.5,
|
|
345
|
+
inputPaddingHorizontalBase: DEFAULT_SPACING_UNIT * 1.5,
|
|
346
|
+
inputPaddingHorizontalSm: DEFAULT_SPACING_UNIT * 1.5,
|
|
347
|
+
inputPaddingHorizontalLg: DEFAULT_SPACING_UNIT * 1.5,
|
|
348
|
+
inputPaddingVertical: spacing.xs + 1,
|
|
349
|
+
inputPaddingVerticalBase: spacing.xs + 1,
|
|
350
|
+
inputPaddingVerticalSm: spacing.xs + 1,
|
|
351
|
+
inputPaddingVerticalLg: spacing.xs + 1,
|
|
352
|
+
// Modal
|
|
353
|
+
modalPadding: MODAL_PADDING,
|
|
354
|
+
modalLessPadding: MODAL_PADDING - 20,
|
|
355
|
+
modalHeaderPadding: `${MODAL_PADDING}px ${MODAL_PADDING}px ${MODAL_PADDING - 20}px`,
|
|
356
|
+
modalHeaderCloseSize: MODAL_PADDING * 2 + 22,
|
|
357
|
+
modalHeaderBorderWidth: 0,
|
|
358
|
+
modalBodyPadding: `0 ${MODAL_PADDING}px`,
|
|
359
|
+
modalFooterPaddingVertical: 0,
|
|
360
|
+
modalFooterPaddingHorizontal: 0,
|
|
361
|
+
modalFooterBorderWidth: 0,
|
|
362
|
+
// Switch
|
|
363
|
+
switchPadding: 0,
|
|
364
|
+
switchHeight: 16,
|
|
365
|
+
switchMinWidth: 28,
|
|
366
|
+
switchPinSize: 14
|
|
367
|
+
});
|
|
368
|
+
var spacing$1 = spacing;
|
|
369
|
+
|
|
370
|
+
const heightBase = 40;
|
|
371
|
+
const borderWidth = 1;
|
|
372
|
+
const antdGeneralVariables = {
|
|
373
|
+
classnamePrefix: antdVars['ant-prefix'],
|
|
374
|
+
iconfontCssPrefix: 'anticon',
|
|
375
|
+
borderRadiusBase: 4,
|
|
376
|
+
borderWidth: borderWidth,
|
|
377
|
+
heightSm: 32,
|
|
378
|
+
heightBase: heightBase,
|
|
379
|
+
iconSize: 24,
|
|
380
|
+
iconFontSize: 16,
|
|
381
|
+
buttonHeight: heightBase,
|
|
382
|
+
// Height available within button (for label and icon). Same for middle and small buttons.
|
|
383
|
+
buttonInnerHeight: heightBase - spacing$1.sm * 2 - borderWidth * 2
|
|
384
|
+
};
|
|
385
|
+
const getShadowVariables = isDarkMode => {
|
|
386
|
+
if (isDarkMode) {
|
|
387
|
+
return {
|
|
388
|
+
shadowLow: '0px 4px 16px rgba(0, 0, 0, 0.12)',
|
|
389
|
+
shadowHigh: '0px 8px 24px rgba(0, 0, 0, 0.2);'
|
|
390
|
+
};
|
|
391
|
+
} else {
|
|
392
|
+
return {
|
|
393
|
+
shadowLow: '0px 4px 16px rgba(31, 39, 45, 0.12)',
|
|
394
|
+
shadowHigh: '0px 8px 24px rgba(31, 39, 45, 0.2)'
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
var generalVariables = antdGeneralVariables;
|
|
399
|
+
|
|
400
|
+
const FONT_SIZE_BASE = 13;
|
|
401
|
+
|
|
402
|
+
// Less variables that are used by AntD
|
|
403
|
+
const antdTypography = {
|
|
404
|
+
fontSizeSm: 12,
|
|
405
|
+
fontSizeBase: FONT_SIZE_BASE,
|
|
406
|
+
fontSizeMd: FONT_SIZE_BASE,
|
|
407
|
+
fontSizeLg: 18,
|
|
408
|
+
fontSizeXl: 22,
|
|
409
|
+
fontSizeXxl: 32,
|
|
410
|
+
lineHeightSm: '16px',
|
|
411
|
+
lineHeightBase: '20px',
|
|
412
|
+
lineHeightMd: '20px',
|
|
413
|
+
lineHeightLg: '24px',
|
|
414
|
+
lineHeightXl: '28px',
|
|
415
|
+
lineHeightXxl: '40px',
|
|
416
|
+
typographyBoldFontWeight: 600
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
420
|
+
var typography = {
|
|
421
|
+
...antdTypography
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const defaultOptions = {
|
|
425
|
+
enableAnimation: false,
|
|
426
|
+
zIndexBase: 1000
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
// Function to get variables for a certain theme.
|
|
430
|
+
// End users should use useDesignSystemTheme instead.
|
|
431
|
+
function getTheme(isDarkMode) {
|
|
432
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
|
|
433
|
+
return {
|
|
434
|
+
colors: getColors(isDarkMode),
|
|
435
|
+
spacing: spacing$1,
|
|
436
|
+
general: {
|
|
437
|
+
...generalVariables,
|
|
438
|
+
...getShadowVariables(isDarkMode)
|
|
439
|
+
},
|
|
440
|
+
typography,
|
|
441
|
+
borders: borders$1,
|
|
442
|
+
responsive: responsive$1,
|
|
443
|
+
isDarkMode,
|
|
444
|
+
options
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function getClassNamePrefix(theme) {
|
|
449
|
+
const antdThemeName = theme.isDarkMode ? 'dark' : 'light';
|
|
450
|
+
return `${theme.general.classnamePrefix}-${antdThemeName}`;
|
|
451
|
+
}
|
|
452
|
+
function getPrefixedClassNameFromTheme(theme, className) {
|
|
453
|
+
return [getClassNamePrefix(theme), className].filter(Boolean).join('-');
|
|
454
|
+
}
|
|
455
|
+
function useDesignSystemTheme() {
|
|
456
|
+
const emotionTheme = useTheme();
|
|
457
|
+
// Graceful fallback to default theme in case a test or developer forgot context.
|
|
458
|
+
const theme = emotionTheme && emotionTheme.general ? emotionTheme : getTheme(false);
|
|
459
|
+
return {
|
|
460
|
+
theme: theme,
|
|
461
|
+
classNamePrefix: getClassNamePrefix(theme),
|
|
462
|
+
getPrefixedClassName: className => getPrefixedClassNameFromTheme(theme, className)
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
// This is a simple typed HOC wrapper around the useDesignSystemTheme hook, for use in older react components.
|
|
466
|
+
function WithDesignSystemThemeHoc(Component) {
|
|
467
|
+
return function WrappedWithDesignSystemTheme(props) {
|
|
468
|
+
const themeValues = useDesignSystemTheme();
|
|
469
|
+
return jsx(Component, {
|
|
470
|
+
...props,
|
|
471
|
+
designSystemThemeApi: themeValues
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const DuboisContextDefaults = {
|
|
477
|
+
enableAnimation: false,
|
|
478
|
+
// Prefer to use useDesignSystemTheme.getPrefixedClassName instead
|
|
479
|
+
getPrefixCls: suffix => suffix ? `du-bois-${suffix}` : 'du-bois',
|
|
480
|
+
flags: {}
|
|
481
|
+
};
|
|
482
|
+
const DesignSystemThemeContext = /*#__PURE__*/createContext({
|
|
483
|
+
isDarkMode: false
|
|
484
|
+
});
|
|
485
|
+
const DesignSystemContext = /*#__PURE__*/createContext(DuboisContextDefaults);
|
|
486
|
+
const DU_BOIS_ENABLE_ANIMATION_CLASSNAME = 'du-bois-enable-animation';
|
|
487
|
+
function getAnimationCss(enableAnimation) {
|
|
488
|
+
const disableAnimationCss = {
|
|
489
|
+
animationDuration: '0s !important',
|
|
490
|
+
transition: 'none !important'
|
|
491
|
+
};
|
|
492
|
+
return enableAnimation ? {} : {
|
|
493
|
+
// Apply to the current element
|
|
494
|
+
...disableAnimationCss,
|
|
495
|
+
'&::before': disableAnimationCss,
|
|
496
|
+
'&::after': disableAnimationCss,
|
|
497
|
+
// Also apply to all child elements with a class that starts with our prefix
|
|
498
|
+
[`[class*=du-bois]:not(.${DU_BOIS_ENABLE_ANIMATION_CLASSNAME}, .${DU_BOIS_ENABLE_ANIMATION_CLASSNAME} *)`]: {
|
|
499
|
+
...disableAnimationCss,
|
|
500
|
+
// Also target any pseudo-elements associated with those elements, since these can also be animated.
|
|
501
|
+
'&::before': disableAnimationCss,
|
|
502
|
+
'&::after': disableAnimationCss
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
const DesignSystemProviderPropsContext = /*#__PURE__*/React__default.createContext(null);
|
|
507
|
+
const AntDConfigProviderPropsContext = /*#__PURE__*/React__default.createContext(null);
|
|
508
|
+
|
|
509
|
+
/** Only to be accessed by SupportsDuBoisThemes, except for special exceptions like tests and storybook. Ask in #dubois first if you need to use it. */
|
|
510
|
+
const DesignSystemThemeProvider = _ref => {
|
|
511
|
+
let {
|
|
512
|
+
isDarkMode = false,
|
|
513
|
+
children
|
|
514
|
+
} = _ref;
|
|
515
|
+
return jsx(DesignSystemThemeContext.Provider, {
|
|
516
|
+
value: {
|
|
517
|
+
isDarkMode
|
|
518
|
+
},
|
|
519
|
+
children: children
|
|
520
|
+
});
|
|
521
|
+
};
|
|
522
|
+
const DesignSystemProvider = _ref2 => {
|
|
523
|
+
let {
|
|
524
|
+
isDarkMode: deprecatedDarkModeProp,
|
|
525
|
+
children,
|
|
526
|
+
enableAnimation = false,
|
|
527
|
+
zIndexBase = 1000,
|
|
528
|
+
getPopupContainer,
|
|
529
|
+
flags = {}
|
|
530
|
+
} = _ref2;
|
|
531
|
+
const {
|
|
532
|
+
isDarkMode: contextDarkModeVal
|
|
533
|
+
} = useContext(DesignSystemThemeContext);
|
|
534
|
+
const isDarkMode = deprecatedDarkModeProp !== null && deprecatedDarkModeProp !== void 0 ? deprecatedDarkModeProp : contextDarkModeVal;
|
|
535
|
+
const theme = useMemo(() => getTheme(isDarkMode, {
|
|
536
|
+
enableAnimation,
|
|
537
|
+
zIndexBase
|
|
538
|
+
}),
|
|
539
|
+
// TODO: revisit this
|
|
540
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
541
|
+
[isDarkMode, zIndexBase]);
|
|
542
|
+
const providerPropsContext = useMemo(() => ({
|
|
543
|
+
isDarkMode,
|
|
544
|
+
enableAnimation,
|
|
545
|
+
zIndexBase,
|
|
546
|
+
getPopupContainer,
|
|
547
|
+
flags
|
|
548
|
+
}), [isDarkMode, enableAnimation, zIndexBase, getPopupContainer, flags]);
|
|
549
|
+
const classNamePrefix = getClassNamePrefix(theme);
|
|
550
|
+
const value = useMemo(() => {
|
|
551
|
+
return {
|
|
552
|
+
enableAnimation,
|
|
553
|
+
isDarkMode,
|
|
554
|
+
getPrefixCls: suffix => getPrefixedClassNameFromTheme(theme, suffix),
|
|
555
|
+
getPopupContainer,
|
|
556
|
+
flags
|
|
557
|
+
};
|
|
558
|
+
}, [enableAnimation, theme, isDarkMode, getPopupContainer, flags]);
|
|
559
|
+
useEffect(() => {
|
|
560
|
+
return () => {
|
|
561
|
+
// when the design system context is unmounted, make sure the notification cache is also cleaned up
|
|
562
|
+
notification.destroy();
|
|
563
|
+
};
|
|
564
|
+
}, []);
|
|
565
|
+
return jsx(DesignSystemProviderPropsContext.Provider, {
|
|
566
|
+
value: providerPropsContext,
|
|
567
|
+
children: jsx(ThemeProvider, {
|
|
568
|
+
theme: theme,
|
|
569
|
+
children: jsx(AntDConfigProviderPropsContext.Provider, {
|
|
570
|
+
value: {
|
|
571
|
+
prefixCls: classNamePrefix,
|
|
572
|
+
getPopupContainer
|
|
573
|
+
},
|
|
574
|
+
children: jsx(DesignSystemContext.Provider, {
|
|
575
|
+
value: value,
|
|
576
|
+
children: children
|
|
577
|
+
})
|
|
578
|
+
})
|
|
579
|
+
})
|
|
580
|
+
});
|
|
581
|
+
};
|
|
582
|
+
const ApplyDesignSystemContextOverrides = _ref3 => {
|
|
583
|
+
let {
|
|
584
|
+
enableAnimation,
|
|
585
|
+
zIndexBase,
|
|
586
|
+
getPopupContainer,
|
|
587
|
+
flags,
|
|
588
|
+
children
|
|
589
|
+
} = _ref3;
|
|
590
|
+
const parentDesignSystemProviderProps = useContext(DesignSystemProviderPropsContext);
|
|
591
|
+
if (parentDesignSystemProviderProps === null) {
|
|
592
|
+
throw new Error(`ApplyDesignSystemContextOverrides cannot be used standalone - DesignSystemProvider must exist in the React context`);
|
|
593
|
+
}
|
|
594
|
+
const newProps = useMemo(() => ({
|
|
595
|
+
...parentDesignSystemProviderProps,
|
|
596
|
+
enableAnimation: enableAnimation !== null && enableAnimation !== void 0 ? enableAnimation : parentDesignSystemProviderProps.enableAnimation,
|
|
597
|
+
zIndexBase: zIndexBase !== null && zIndexBase !== void 0 ? zIndexBase : parentDesignSystemProviderProps.zIndexBase,
|
|
598
|
+
getPopupContainer: getPopupContainer !== null && getPopupContainer !== void 0 ? getPopupContainer : parentDesignSystemProviderProps.getPopupContainer,
|
|
599
|
+
flags: {
|
|
600
|
+
...parentDesignSystemProviderProps.flags,
|
|
601
|
+
...flags
|
|
602
|
+
}
|
|
603
|
+
}), [parentDesignSystemProviderProps, enableAnimation, zIndexBase, getPopupContainer, flags]);
|
|
604
|
+
return jsx(DesignSystemProvider, {
|
|
605
|
+
...newProps,
|
|
606
|
+
children: children
|
|
607
|
+
});
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
// This is a more-specific version of `ApplyDesignSystemContextOverrides` that only allows overriding the flags.
|
|
611
|
+
const ApplyDesignSystemFlags = _ref4 => {
|
|
612
|
+
let {
|
|
613
|
+
flags,
|
|
614
|
+
children
|
|
615
|
+
} = _ref4;
|
|
616
|
+
const parentDesignSystemProviderProps = useContext(DesignSystemProviderPropsContext);
|
|
617
|
+
if (parentDesignSystemProviderProps === null) {
|
|
618
|
+
throw new Error(`ApplyDesignSystemFlags cannot be used standalone - DesignSystemProvider must exist in the React context`);
|
|
619
|
+
}
|
|
620
|
+
const newProps = useMemo(() => ({
|
|
621
|
+
...parentDesignSystemProviderProps,
|
|
622
|
+
flags: {
|
|
623
|
+
...parentDesignSystemProviderProps.flags,
|
|
624
|
+
...flags
|
|
625
|
+
}
|
|
626
|
+
}), [parentDesignSystemProviderProps, flags]);
|
|
627
|
+
return jsx(DesignSystemProvider, {
|
|
628
|
+
...newProps,
|
|
629
|
+
children: children
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
const DesignSystemAntDConfigProvider = _ref5 => {
|
|
633
|
+
let {
|
|
634
|
+
children
|
|
635
|
+
} = _ref5;
|
|
636
|
+
const antdContext = useAntDConfigProviderContext();
|
|
637
|
+
return jsx(ConfigProvider, {
|
|
638
|
+
...antdContext,
|
|
639
|
+
children: children
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
const useAntDConfigProviderContext = () => {
|
|
643
|
+
var _useContext;
|
|
644
|
+
return (_useContext = useContext(AntDConfigProviderPropsContext)) !== null && _useContext !== void 0 ? _useContext : {
|
|
645
|
+
prefixCls: undefined
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* When using AntD components inside Design System wrapper components (e.g. Modal, Collapse etc),
|
|
651
|
+
* we don't want Design System's prefix class to override them.
|
|
652
|
+
*
|
|
653
|
+
* Since all Design System's components have are wrapped with DesignSystemAntDConfigProvider,
|
|
654
|
+
* this won't affect their own prefixCls, but just allow nested antd components to keep their ant prefix.
|
|
655
|
+
*/
|
|
656
|
+
const RestoreAntDDefaultClsPrefix = _ref6 => {
|
|
657
|
+
let {
|
|
658
|
+
children
|
|
659
|
+
} = _ref6;
|
|
660
|
+
return jsx(ConfigProvider, {
|
|
661
|
+
prefixCls: "ant",
|
|
662
|
+
children: children
|
|
663
|
+
});
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
function useDesignSystemContext() {
|
|
667
|
+
return useContext(DesignSystemContext);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
function useDesignSystemFlags() {
|
|
671
|
+
const context = useDesignSystemContext();
|
|
672
|
+
return context.flags;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
const getIconEmotionStyles = theme => {
|
|
676
|
+
return /*#__PURE__*/css({
|
|
677
|
+
fontSize: theme.general.iconFontSize
|
|
678
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getIconEmotionStyles;");
|
|
679
|
+
};
|
|
680
|
+
const getIconValidationColor = (theme, color) => {
|
|
681
|
+
switch (color) {
|
|
682
|
+
case 'success':
|
|
683
|
+
return theme.colors.textValidationSuccess;
|
|
684
|
+
case 'warning':
|
|
685
|
+
return theme.colors.textValidationWarning;
|
|
686
|
+
case 'danger':
|
|
687
|
+
return theme.colors.textValidationDanger;
|
|
688
|
+
default:
|
|
689
|
+
return color;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
const Icon = props => {
|
|
693
|
+
const {
|
|
694
|
+
component: Component,
|
|
695
|
+
dangerouslySetAntdProps,
|
|
696
|
+
color,
|
|
697
|
+
style,
|
|
698
|
+
...otherProps
|
|
699
|
+
} = props;
|
|
700
|
+
const {
|
|
701
|
+
theme
|
|
702
|
+
} = useDesignSystemTheme();
|
|
703
|
+
const MemoizedComponent = useMemo(() => Component ? _ref => {
|
|
704
|
+
let {
|
|
705
|
+
fill,
|
|
706
|
+
...iconProps
|
|
707
|
+
} = _ref;
|
|
708
|
+
return (
|
|
709
|
+
// We don't rely on top-level fills for our colors. Fills are specified
|
|
710
|
+
// with "currentColor" on children of the top-most svg.
|
|
711
|
+
jsx(Component, {
|
|
712
|
+
fill: "none",
|
|
713
|
+
...iconProps
|
|
714
|
+
})
|
|
715
|
+
);
|
|
716
|
+
} : undefined, [Component]);
|
|
717
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
718
|
+
children: jsx(AntDIcon, {
|
|
719
|
+
css: getIconEmotionStyles(theme),
|
|
720
|
+
component: MemoizedComponent,
|
|
721
|
+
style: {
|
|
722
|
+
color: getIconValidationColor(theme, color),
|
|
723
|
+
...style
|
|
724
|
+
},
|
|
725
|
+
...otherProps,
|
|
726
|
+
...dangerouslySetAntdProps
|
|
727
|
+
})
|
|
728
|
+
});
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
function SvgCheckIcon(props) {
|
|
732
|
+
return jsx("svg", {
|
|
733
|
+
width: "1em",
|
|
734
|
+
height: "1em",
|
|
735
|
+
viewBox: "0 0 16 16",
|
|
736
|
+
fill: "none",
|
|
737
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
738
|
+
...props,
|
|
739
|
+
children: jsx("path", {
|
|
740
|
+
fillRule: "evenodd",
|
|
741
|
+
clipRule: "evenodd",
|
|
742
|
+
d: "M15.06 3.56l-9.53 9.531L1 8.561 2.06 7.5l3.47 3.47L14 2.5l1.06 1.06z",
|
|
743
|
+
fill: "currentColor"
|
|
744
|
+
})
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
function CheckIcon(props) {
|
|
748
|
+
return jsx(Icon, {
|
|
749
|
+
...props,
|
|
750
|
+
component: SvgCheckIcon
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function SvgChevronLeftIcon(props) {
|
|
755
|
+
return jsx("svg", {
|
|
756
|
+
width: "1em",
|
|
757
|
+
height: "1em",
|
|
758
|
+
viewBox: "0 0 16 16",
|
|
759
|
+
fill: "none",
|
|
760
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
761
|
+
...props,
|
|
762
|
+
children: jsx("path", {
|
|
763
|
+
fillRule: "evenodd",
|
|
764
|
+
clipRule: "evenodd",
|
|
765
|
+
d: "M7.083 8L10 10.947 8.958 12 5 8l3.958-4L10 5.053 7.083 8z",
|
|
766
|
+
fill: "currentColor"
|
|
767
|
+
})
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
function ChevronLeftIcon(props) {
|
|
771
|
+
return jsx(Icon, {
|
|
772
|
+
...props,
|
|
773
|
+
component: SvgChevronLeftIcon
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function SvgChevronRightIcon(props) {
|
|
778
|
+
return jsx("svg", {
|
|
779
|
+
width: "1em",
|
|
780
|
+
height: "1em",
|
|
781
|
+
viewBox: "0 0 16 16",
|
|
782
|
+
fill: "none",
|
|
783
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
784
|
+
...props,
|
|
785
|
+
children: jsx("path", {
|
|
786
|
+
fillRule: "evenodd",
|
|
787
|
+
clipRule: "evenodd",
|
|
788
|
+
d: "M8.917 8L6 5.053 7.042 4 11 8l-3.958 4L6 10.947 8.917 8z",
|
|
789
|
+
fill: "currentColor"
|
|
790
|
+
})
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
function ChevronRightIcon(props) {
|
|
794
|
+
return jsx(Icon, {
|
|
795
|
+
...props,
|
|
796
|
+
component: SvgChevronRightIcon
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
function SvgCloseIcon(props) {
|
|
801
|
+
return jsx("svg", {
|
|
802
|
+
width: "1em",
|
|
803
|
+
height: "1em",
|
|
804
|
+
viewBox: "0 0 16 16",
|
|
805
|
+
fill: "none",
|
|
806
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
807
|
+
...props,
|
|
808
|
+
children: jsx("path", {
|
|
809
|
+
fillRule: "evenodd",
|
|
810
|
+
clipRule: "evenodd",
|
|
811
|
+
d: "M6.97 8.03L2 3.06 3.06 2l4.97 4.97L13 2l1.06 1.06-4.969 4.97 4.97 4.97L13 14.06 8.03 9.092l-4.97 4.97L2 13l4.97-4.97z",
|
|
812
|
+
fill: "currentColor"
|
|
813
|
+
})
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
function CloseIcon(props) {
|
|
817
|
+
return jsx(Icon, {
|
|
818
|
+
...props,
|
|
819
|
+
component: SvgCloseIcon
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function SvgCursorIcon(props) {
|
|
824
|
+
return jsxs("svg", {
|
|
825
|
+
width: "1em",
|
|
826
|
+
height: "1em",
|
|
827
|
+
viewBox: "0 0 16 16",
|
|
828
|
+
fill: "none",
|
|
829
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
830
|
+
...props,
|
|
831
|
+
children: [jsx("g", {
|
|
832
|
+
clipPath: "url(#CursorIcon_svg__clip0_14914_35410)",
|
|
833
|
+
children: jsx("path", {
|
|
834
|
+
fillRule: "evenodd",
|
|
835
|
+
clipRule: "evenodd",
|
|
836
|
+
d: "M1.22 1.22a.75.75 0 01.802-.169l13.5 5.25a.75.75 0 01-.043 1.413L9.597 9.597l-1.883 5.882a.75.75 0 01-1.413.043l-5.25-13.5a.75.75 0 01.169-.802zm1.847 1.847l3.864 9.937 1.355-4.233a.75.75 0 01.485-.485l4.233-1.355-9.937-3.864z",
|
|
837
|
+
fill: "currentColor"
|
|
838
|
+
})
|
|
839
|
+
}), jsx("defs", {
|
|
840
|
+
children: jsx("clipPath", {
|
|
841
|
+
id: "CursorIcon_svg__clip0_14914_35410",
|
|
842
|
+
children: jsx("path", {
|
|
843
|
+
fill: "#fff",
|
|
844
|
+
transform: "matrix(-1 0 0 1 16 0)",
|
|
845
|
+
d: "M0 0h16v16H0z"
|
|
846
|
+
})
|
|
847
|
+
})
|
|
848
|
+
})]
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
function CursorIcon(props) {
|
|
852
|
+
return jsx(Icon, {
|
|
853
|
+
...props,
|
|
854
|
+
component: SvgCursorIcon
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
function SvgFaceFrownIcon(props) {
|
|
859
|
+
return jsxs("svg", {
|
|
860
|
+
width: "1em",
|
|
861
|
+
height: "1em",
|
|
862
|
+
viewBox: "0 0 16 16",
|
|
863
|
+
fill: "none",
|
|
864
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
865
|
+
...props,
|
|
866
|
+
children: [jsxs("g", {
|
|
867
|
+
clipPath: "url(#FaceFrownIcon_svg__clip0_16320_32311)",
|
|
868
|
+
fill: "currentColor",
|
|
869
|
+
children: [jsx("path", {
|
|
870
|
+
d: "M6 5.25a.75.75 0 000 1.5h.007a.75.75 0 000-1.5H6zM9.25 6a.75.75 0 01.75-.75h.007a.75.75 0 010 1.5H10A.75.75 0 019.25 6zM10.07 11.12a.75.75 0 001.197-.903l-.001-.001v-.001l-.003-.003-.005-.006-.015-.02a2.95 2.95 0 00-.217-.246 4.717 4.717 0 00-.627-.546C9.86 9 9.04 8.584 8 8.584s-1.858.416-2.4.81a4.716 4.716 0 00-.795.733 2.87 2.87 0 00-.048.06l-.015.019-.005.006-.002.003-.031.044.03-.042a.75.75 0 101.22.875 3.219 3.219 0 01.529-.485c.375-.273.89-.523 1.517-.523.627 0 1.142.25 1.517.523a3.219 3.219 0 01.529.485l.021.025.002.003z"
|
|
871
|
+
}), jsx("path", {
|
|
872
|
+
fillRule: "evenodd",
|
|
873
|
+
clipRule: "evenodd",
|
|
874
|
+
d: "M8 .583a7.417 7.417 0 100 14.834A7.417 7.417 0 008 .583zM2.083 8a5.917 5.917 0 1111.834 0A5.917 5.917 0 012.083 8z"
|
|
875
|
+
})]
|
|
876
|
+
}), jsx("defs", {
|
|
877
|
+
children: jsx("clipPath", {
|
|
878
|
+
id: "FaceFrownIcon_svg__clip0_16320_32311",
|
|
879
|
+
children: jsx("path", {
|
|
880
|
+
fill: "#fff",
|
|
881
|
+
d: "M0 0h16v16H0z"
|
|
882
|
+
})
|
|
883
|
+
})
|
|
884
|
+
})]
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
function FaceFrownIcon(props) {
|
|
888
|
+
return jsx(Icon, {
|
|
889
|
+
...props,
|
|
890
|
+
component: SvgFaceFrownIcon
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
function SvgFaceNeutralIcon(props) {
|
|
895
|
+
return jsxs("svg", {
|
|
896
|
+
width: "1em",
|
|
897
|
+
height: "1em",
|
|
898
|
+
viewBox: "0 0 16 16",
|
|
899
|
+
fill: "none",
|
|
900
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
901
|
+
...props,
|
|
902
|
+
children: [jsxs("g", {
|
|
903
|
+
clipPath: "url(#FaceNeutralIcon_svg__clip0_16320_32309)",
|
|
904
|
+
fillRule: "evenodd",
|
|
905
|
+
clipRule: "evenodd",
|
|
906
|
+
fill: "currentColor",
|
|
907
|
+
children: [jsx("path", {
|
|
908
|
+
d: "M8 2.083a5.917 5.917 0 100 11.834A5.917 5.917 0 008 2.084zM.583 8a7.417 7.417 0 1114.834 0A7.417 7.417 0 01.583 8z"
|
|
909
|
+
}), jsx("path", {
|
|
910
|
+
d: "M4.583 10a.75.75 0 01.75-.75h5.334a.75.75 0 110 1.5H5.333a.75.75 0 01-.75-.75zM5.25 6A.75.75 0 016 5.25h.007a.75.75 0 010 1.5H6A.75.75 0 015.25 6zM9.25 6a.75.75 0 01.75-.75h.007a.75.75 0 110 1.5H10A.75.75 0 019.25 6z"
|
|
911
|
+
})]
|
|
912
|
+
}), jsx("defs", {
|
|
913
|
+
children: jsx("clipPath", {
|
|
914
|
+
id: "FaceNeutralIcon_svg__clip0_16320_32309",
|
|
915
|
+
children: jsx("path", {
|
|
916
|
+
fill: "#fff",
|
|
917
|
+
d: "M0 0h16v16H0z"
|
|
918
|
+
})
|
|
919
|
+
})
|
|
920
|
+
})]
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
function FaceNeutralIcon(props) {
|
|
924
|
+
return jsx(Icon, {
|
|
925
|
+
...props,
|
|
926
|
+
component: SvgFaceNeutralIcon
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function SvgFaceSmileIcon(props) {
|
|
931
|
+
return jsxs("svg", {
|
|
932
|
+
width: "1em",
|
|
933
|
+
height: "1em",
|
|
934
|
+
viewBox: "0 0 16 16",
|
|
935
|
+
fill: "none",
|
|
936
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
937
|
+
...props,
|
|
938
|
+
children: [jsxs("g", {
|
|
939
|
+
clipPath: "url(#FaceSmileIcon_svg__clip0_16320_32307)",
|
|
940
|
+
fill: "currentColor",
|
|
941
|
+
children: [jsx("path", {
|
|
942
|
+
fillRule: "evenodd",
|
|
943
|
+
clipRule: "evenodd",
|
|
944
|
+
d: "M8 2.083a5.917 5.917 0 100 11.834A5.917 5.917 0 008 2.084zM.583 8a7.417 7.417 0 1114.834 0A7.417 7.417 0 01.583 8z"
|
|
945
|
+
}), jsx("path", {
|
|
946
|
+
d: "M4.883 8.733a.75.75 0 011.048.147l.002.003.021.026a3.216 3.216 0 00.529.485c.375.273.89.523 1.517.523.627 0 1.142-.25 1.517-.523a3.215 3.215 0 00.55-.511.75.75 0 011.2.9l.029-.042-.03.043-.001.002-.002.002-.005.007-.015.019a3.878 3.878 0 01-.217.247c-.144.15-.354.348-.627.546-.54.393-1.359.81-2.399.81s-1.858-.417-2.4-.81a4.716 4.716 0 01-.795-.734 2.643 2.643 0 01-.048-.059l-.015-.02-.005-.006-.002-.002v-.002h-.002a.75.75 0 01.15-1.05z"
|
|
947
|
+
}), jsx("path", {
|
|
948
|
+
fillRule: "evenodd",
|
|
949
|
+
clipRule: "evenodd",
|
|
950
|
+
d: "M5.25 6A.75.75 0 016 5.25h.007a.75.75 0 010 1.5H6A.75.75 0 015.25 6zM9.25 6a.75.75 0 01.75-.75h.007a.75.75 0 110 1.5H10A.75.75 0 019.25 6z"
|
|
951
|
+
})]
|
|
952
|
+
}), jsx("defs", {
|
|
953
|
+
children: jsx("clipPath", {
|
|
954
|
+
id: "FaceSmileIcon_svg__clip0_16320_32307",
|
|
955
|
+
children: jsx("path", {
|
|
956
|
+
fill: "#fff",
|
|
957
|
+
d: "M0 0h16v16H0z"
|
|
958
|
+
})
|
|
959
|
+
})
|
|
960
|
+
})]
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
function FaceSmileIcon(props) {
|
|
964
|
+
return jsx(Icon, {
|
|
965
|
+
...props,
|
|
966
|
+
component: SvgFaceSmileIcon
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
function SvgNewWindowIcon(props) {
|
|
971
|
+
return jsxs("svg", {
|
|
972
|
+
width: "1em",
|
|
973
|
+
height: "1em",
|
|
974
|
+
viewBox: "0 0 16 16",
|
|
975
|
+
fill: "none",
|
|
976
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
977
|
+
...props,
|
|
978
|
+
children: [jsx("path", {
|
|
979
|
+
d: "M10 1h5v5h-1.5V3.56L8.53 8.53 7.47 7.47l4.97-4.97H10V1z",
|
|
980
|
+
fill: "currentColor"
|
|
981
|
+
}), jsx("path", {
|
|
982
|
+
d: "M1 2.75A.75.75 0 011.75 2H8v1.5H2.5v10h10V8H14v6.25a.75.75 0 01-.75.75H1.75a.75.75 0 01-.75-.75V2.75z",
|
|
983
|
+
fill: "currentColor"
|
|
984
|
+
})]
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
function NewWindowIcon(props) {
|
|
988
|
+
return jsx(Icon, {
|
|
989
|
+
...props,
|
|
990
|
+
component: SvgNewWindowIcon
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
const ColorVars = {
|
|
995
|
+
primary: 'textPrimary',
|
|
996
|
+
secondary: 'textSecondary',
|
|
997
|
+
info: 'textValidationInfo',
|
|
998
|
+
error: 'textValidationDanger',
|
|
999
|
+
success: 'textValidationSuccess',
|
|
1000
|
+
warning: 'textValidationWarning'
|
|
1001
|
+
};
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Recursively appends `!important` to all CSS properties in an Emotion `CSSObject`.
|
|
1005
|
+
* Used to ensure that we always override Ant styles, without worrying about selector precedence.
|
|
1006
|
+
*/
|
|
1007
|
+
function importantify(obj) {
|
|
1008
|
+
return _mapValues(obj, (value, key) => {
|
|
1009
|
+
if (_isString(value) || _isNumber(value) || _isBoolean(value)) {
|
|
1010
|
+
// Make sure we don't double-append important
|
|
1011
|
+
if (_isString(value) && _endsWith(value, '!important')) {
|
|
1012
|
+
return value;
|
|
1013
|
+
}
|
|
1014
|
+
if (_isNumber(value)) {
|
|
1015
|
+
if (unitless[key]) {
|
|
1016
|
+
return `${value}!important`;
|
|
1017
|
+
}
|
|
1018
|
+
return `${value}px!important`;
|
|
1019
|
+
}
|
|
1020
|
+
return `${value}!important`;
|
|
1021
|
+
}
|
|
1022
|
+
if (_isNil(value)) {
|
|
1023
|
+
return value;
|
|
1024
|
+
}
|
|
1025
|
+
return importantify(value);
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Returns a text color, in case of invalid/missing key and missing fallback color it will return textPrimary
|
|
1031
|
+
* @param theme
|
|
1032
|
+
* @param key - key of TypographyColor
|
|
1033
|
+
* @param fallbackColor - color to return as fallback -- used to remove tertiary check inline
|
|
1034
|
+
*/
|
|
1035
|
+
function getTypographyColor(theme, key, fallbackColor) {
|
|
1036
|
+
if (theme && key && Object(theme.colors).hasOwnProperty(ColorVars[key])) {
|
|
1037
|
+
return theme.colors[ColorVars[key]];
|
|
1038
|
+
}
|
|
1039
|
+
return fallbackColor !== null && fallbackColor !== void 0 ? fallbackColor : theme.colors.textPrimary;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Returns validation color based on state, has default validation colors if params are not provided
|
|
1044
|
+
* @param theme
|
|
1045
|
+
* @param validationState
|
|
1046
|
+
* @param errorColor
|
|
1047
|
+
* @param warningColor
|
|
1048
|
+
* @param successColor
|
|
1049
|
+
*/
|
|
1050
|
+
function getValidationStateColor(theme, validationState) {
|
|
1051
|
+
let {
|
|
1052
|
+
errorColor,
|
|
1053
|
+
warningColor,
|
|
1054
|
+
successColor
|
|
1055
|
+
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1056
|
+
switch (validationState) {
|
|
1057
|
+
case 'error':
|
|
1058
|
+
return errorColor || theme.colors.actionDangerPrimaryBackgroundDefault;
|
|
1059
|
+
case 'warning':
|
|
1060
|
+
return warningColor || theme.colors.textValidationWarning;
|
|
1061
|
+
case 'success':
|
|
1062
|
+
return successColor || theme.colors.textValidationSuccess;
|
|
1063
|
+
default:
|
|
1064
|
+
return undefined;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
function getDefaultStyles(theme) {
|
|
1069
|
+
return {
|
|
1070
|
+
backgroundColor: theme.colors.actionDefaultBackgroundDefault,
|
|
1071
|
+
borderColor: theme.colors.actionDefaultBorderDefault,
|
|
1072
|
+
color: theme.colors.actionDefaultTextDefault,
|
|
1073
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1074
|
+
textDecoration: 'none',
|
|
1075
|
+
'&:hover': {
|
|
1076
|
+
backgroundColor: theme.colors.actionDefaultBackgroundHover,
|
|
1077
|
+
borderColor: theme.colors.actionDefaultBorderHover,
|
|
1078
|
+
color: theme.colors.actionDefaultTextHover
|
|
1079
|
+
},
|
|
1080
|
+
'&:active': {
|
|
1081
|
+
backgroundColor: theme.colors.actionDefaultBackgroundPress,
|
|
1082
|
+
borderColor: theme.colors.actionDefaultBorderPress,
|
|
1083
|
+
color: theme.colors.actionDefaultTextPress
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function getPrimaryStyles(theme) {
|
|
1088
|
+
return {
|
|
1089
|
+
backgroundColor: theme.colors.actionPrimaryBackgroundDefault,
|
|
1090
|
+
borderColor: 'transparent',
|
|
1091
|
+
color: theme.colors.actionPrimaryTextDefault,
|
|
1092
|
+
textShadow: 'none',
|
|
1093
|
+
'&:hover': {
|
|
1094
|
+
backgroundColor: theme.colors.actionPrimaryBackgroundHover,
|
|
1095
|
+
borderColor: 'transparent',
|
|
1096
|
+
color: theme.colors.actionPrimaryTextHover
|
|
1097
|
+
},
|
|
1098
|
+
'&:active': {
|
|
1099
|
+
backgroundColor: theme.colors.actionPrimaryBackgroundPress,
|
|
1100
|
+
borderColor: 'transparent',
|
|
1101
|
+
color: theme.colors.actionPrimaryTextPress
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
function getLinkStyles$1(theme) {
|
|
1106
|
+
return {
|
|
1107
|
+
backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
|
|
1108
|
+
borderColor: theme.colors.actionTertiaryBackgroundDefault,
|
|
1109
|
+
color: theme.colors.actionTertiaryTextDefault,
|
|
1110
|
+
'&:hover': {
|
|
1111
|
+
backgroundColor: theme.colors.actionTertiaryBackgroundHover,
|
|
1112
|
+
borderColor: 'transparent',
|
|
1113
|
+
color: theme.colors.actionTertiaryTextHover
|
|
1114
|
+
},
|
|
1115
|
+
'&:active': {
|
|
1116
|
+
backgroundColor: theme.colors.actionTertiaryBackgroundPress,
|
|
1117
|
+
borderColor: 'transparent',
|
|
1118
|
+
color: theme.colors.actionTertiaryTextPress
|
|
1119
|
+
},
|
|
1120
|
+
'&[disabled]:hover': {
|
|
1121
|
+
background: 'none',
|
|
1122
|
+
color: theme.colors.actionDisabledText
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function getPrimaryDangerStyles(theme) {
|
|
1127
|
+
return {
|
|
1128
|
+
backgroundColor: theme.colors.actionDangerPrimaryBackgroundDefault,
|
|
1129
|
+
borderColor: 'transparent',
|
|
1130
|
+
color: theme.colors.white,
|
|
1131
|
+
'&:hover': {
|
|
1132
|
+
backgroundColor: theme.colors.actionDangerPrimaryBackgroundHover,
|
|
1133
|
+
borderColor: 'transparent',
|
|
1134
|
+
color: theme.colors.white
|
|
1135
|
+
},
|
|
1136
|
+
'&:active': {
|
|
1137
|
+
backgroundColor: theme.colors.actionDangerPrimaryBackgroundPress,
|
|
1138
|
+
borderColor: 'transparent',
|
|
1139
|
+
color: theme.colors.white
|
|
1140
|
+
},
|
|
1141
|
+
'&:focus-visible': {
|
|
1142
|
+
outlineColor: theme.colors.actionDangerPrimaryBackgroundDefault
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
function getSecondaryDangerStyles(theme) {
|
|
1147
|
+
return {
|
|
1148
|
+
backgroundColor: theme.colors.actionDangerDefaultBackgroundDefault,
|
|
1149
|
+
borderColor: theme.colors.actionDangerDefaultBorderDefault,
|
|
1150
|
+
color: theme.colors.actionDangerDefaultTextDefault,
|
|
1151
|
+
'&:hover': {
|
|
1152
|
+
backgroundColor: theme.colors.actionDangerDefaultBackgroundHover,
|
|
1153
|
+
borderColor: theme.colors.actionDangerDefaultBorderHover,
|
|
1154
|
+
color: theme.colors.actionDangerDefaultTextHover
|
|
1155
|
+
},
|
|
1156
|
+
'&:active': {
|
|
1157
|
+
backgroundColor: theme.colors.actionDangerDefaultBackgroundPress,
|
|
1158
|
+
borderColor: theme.colors.actionDangerDefaultBorderPress,
|
|
1159
|
+
color: theme.colors.actionDangerDefaultTextPress
|
|
1160
|
+
},
|
|
1161
|
+
'&:focus-visible': {
|
|
1162
|
+
outlineColor: theme.colors.actionDangerPrimaryBackgroundDefault
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
function getDisabledStyles(theme) {
|
|
1167
|
+
return {
|
|
1168
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
1169
|
+
borderColor: 'transparent',
|
|
1170
|
+
color: theme.colors.actionDisabledText,
|
|
1171
|
+
'&:hover': {
|
|
1172
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
1173
|
+
borderColor: 'transparent',
|
|
1174
|
+
color: theme.colors.actionDisabledText
|
|
1175
|
+
},
|
|
1176
|
+
'&:active': {
|
|
1177
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
1178
|
+
borderColor: 'transparent',
|
|
1179
|
+
color: theme.colors.actionDisabledText
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
function getDisabledTertiaryStyles(theme) {
|
|
1184
|
+
return {
|
|
1185
|
+
backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
|
|
1186
|
+
borderColor: 'transparent',
|
|
1187
|
+
color: theme.colors.actionDisabledText,
|
|
1188
|
+
'&:hover': {
|
|
1189
|
+
backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
|
|
1190
|
+
borderColor: 'transparent',
|
|
1191
|
+
color: theme.colors.actionDisabledText
|
|
1192
|
+
},
|
|
1193
|
+
'&:active': {
|
|
1194
|
+
backgroundColor: theme.colors.actionTertiaryBackgroundDefault,
|
|
1195
|
+
borderColor: 'transparent',
|
|
1196
|
+
color: theme.colors.actionDisabledText
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
function getEndIconClsName(theme) {
|
|
1202
|
+
return `${theme.general.iconfontCssPrefix}-btn-end-icon`;
|
|
1203
|
+
}
|
|
1204
|
+
const getButtonEmotionStyles = _ref => {
|
|
1205
|
+
let {
|
|
1206
|
+
theme,
|
|
1207
|
+
classNamePrefix,
|
|
1208
|
+
loading,
|
|
1209
|
+
withIcon,
|
|
1210
|
+
onlyIcon,
|
|
1211
|
+
isAnchor,
|
|
1212
|
+
enableAnimation,
|
|
1213
|
+
size,
|
|
1214
|
+
type,
|
|
1215
|
+
isFlex,
|
|
1216
|
+
useFocusPseudoClass,
|
|
1217
|
+
forceIconStyles
|
|
1218
|
+
} = _ref;
|
|
1219
|
+
const clsIcon = `.${theme.general.iconfontCssPrefix}`;
|
|
1220
|
+
const clsEndIcon = `.${getEndIconClsName(theme)}`;
|
|
1221
|
+
const clsLoadingIcon = `.${classNamePrefix}-btn-loading-icon`;
|
|
1222
|
+
const clsIconOnly = `.${classNamePrefix}-btn-icon-only`;
|
|
1223
|
+
const classPrimary = `.${classNamePrefix}-btn-primary`;
|
|
1224
|
+
const classLink = `.${classNamePrefix}-btn-link`;
|
|
1225
|
+
const classDangerous = `.${classNamePrefix}-btn-dangerous`;
|
|
1226
|
+
const SMALL_BUTTON_HEIGHT = 24;
|
|
1227
|
+
const tertiaryColors = {
|
|
1228
|
+
background: theme.colors.actionTertiaryBackgroundDefault,
|
|
1229
|
+
color: theme.colors.actionTertiaryTextDefault,
|
|
1230
|
+
'&:hover': {
|
|
1231
|
+
background: theme.colors.actionTertiaryBackgroundHover,
|
|
1232
|
+
color: theme.colors.actionTertiaryTextHover
|
|
1233
|
+
},
|
|
1234
|
+
'&:active': {
|
|
1235
|
+
background: theme.colors.actionTertiaryBackgroundPress,
|
|
1236
|
+
color: theme.colors.actionTertiaryTextPress
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
const iconCss = {
|
|
1240
|
+
fontSize: theme.general.iconFontSize,
|
|
1241
|
+
...(!isFlex && {
|
|
1242
|
+
// verticalAlign used by AntD to move icon and label to center
|
|
1243
|
+
// TODO(schs): Try to move buttons to flexbox to solve this. Main problem is that flex-inline and inline-block
|
|
1244
|
+
// behave differently (vertically align of multiple buttons is off). See https://codepen.io/qfactor/pen/JXVzBe
|
|
1245
|
+
verticalAlign: -4,
|
|
1246
|
+
...(onlyIcon && {
|
|
1247
|
+
verticalAlign: -3
|
|
1248
|
+
}),
|
|
1249
|
+
// verticalAlign used by AntD to move icon and label to center
|
|
1250
|
+
// TODO(schs): Try to move buttons to flexbox to solve this. Main problem is that flex-inline and inline-block
|
|
1251
|
+
// behave differently (vertically align of multiple buttons is off). See https://codepen.io/qfactor/pen/JXVzBe
|
|
1252
|
+
// Need to make sure not to apply this to regular buttons as it will offset the icons
|
|
1253
|
+
...(!onlyIcon && {
|
|
1254
|
+
verticalAlign: -3
|
|
1255
|
+
})
|
|
1256
|
+
}),
|
|
1257
|
+
lineHeight: 0,
|
|
1258
|
+
...(size === 'small' && {
|
|
1259
|
+
lineHeight: theme.typography.lineHeightSm,
|
|
1260
|
+
...((onlyIcon || forceIconStyles) && {
|
|
1261
|
+
fontSize: 16,
|
|
1262
|
+
...(isFlex && {
|
|
1263
|
+
height: 16
|
|
1264
|
+
})
|
|
1265
|
+
})
|
|
1266
|
+
})
|
|
1267
|
+
};
|
|
1268
|
+
const inactiveIconCss = {
|
|
1269
|
+
color: theme.colors.grey600
|
|
1270
|
+
};
|
|
1271
|
+
const endIconCssSelector = `span > ${clsEndIcon} > ${clsIcon}`;
|
|
1272
|
+
const styles = {
|
|
1273
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1274
|
+
boxShadow: 'none',
|
|
1275
|
+
height: theme.general.heightSm,
|
|
1276
|
+
...(isFlex && {
|
|
1277
|
+
display: 'inline-flex',
|
|
1278
|
+
alignItems: 'center',
|
|
1279
|
+
justifyContent: 'center',
|
|
1280
|
+
verticalAlign: 'middle'
|
|
1281
|
+
}),
|
|
1282
|
+
...(!onlyIcon && !forceIconStyles && {
|
|
1283
|
+
'&&': {
|
|
1284
|
+
padding: '4px 12px',
|
|
1285
|
+
...(size === 'small' && {
|
|
1286
|
+
padding: '0 8px'
|
|
1287
|
+
})
|
|
1288
|
+
}
|
|
1289
|
+
}),
|
|
1290
|
+
...((onlyIcon || forceIconStyles) && {
|
|
1291
|
+
width: theme.general.heightSm
|
|
1292
|
+
}),
|
|
1293
|
+
...(size === 'small' && {
|
|
1294
|
+
height: SMALL_BUTTON_HEIGHT,
|
|
1295
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1296
|
+
...((onlyIcon || forceIconStyles) && {
|
|
1297
|
+
width: SMALL_BUTTON_HEIGHT,
|
|
1298
|
+
paddingTop: 0,
|
|
1299
|
+
paddingBottom: 0,
|
|
1300
|
+
verticalAlign: 'middle'
|
|
1301
|
+
})
|
|
1302
|
+
}),
|
|
1303
|
+
'&:focus-visible': {
|
|
1304
|
+
outlineStyle: 'solid',
|
|
1305
|
+
outlineWidth: '2px',
|
|
1306
|
+
outlineOffset: '1px',
|
|
1307
|
+
outlineColor: theme.isDarkMode ? theme.colors.actionDefaultBorderFocus : theme.colors.primary
|
|
1308
|
+
},
|
|
1309
|
+
...getDefaultStyles(theme),
|
|
1310
|
+
[`&${classPrimary}`]: {
|
|
1311
|
+
...getPrimaryStyles(theme)
|
|
1312
|
+
},
|
|
1313
|
+
[`&${classLink}`]: {
|
|
1314
|
+
...getLinkStyles$1(theme),
|
|
1315
|
+
...(type === 'link' && {
|
|
1316
|
+
padding: 'unset',
|
|
1317
|
+
height: 'auto',
|
|
1318
|
+
border: 'none',
|
|
1319
|
+
boxShadow: 'none',
|
|
1320
|
+
'&[disabled],&:hover': {
|
|
1321
|
+
background: 'none'
|
|
1322
|
+
}
|
|
1323
|
+
})
|
|
1324
|
+
},
|
|
1325
|
+
[`&${classDangerous}${classPrimary}`]: {
|
|
1326
|
+
...getPrimaryDangerStyles(theme)
|
|
1327
|
+
},
|
|
1328
|
+
[`&${classDangerous}`]: {
|
|
1329
|
+
...getSecondaryDangerStyles(theme)
|
|
1330
|
+
},
|
|
1331
|
+
[`&[disabled], &${classDangerous}:disabled`]: {
|
|
1332
|
+
...getDisabledStyles(theme),
|
|
1333
|
+
...((onlyIcon || forceIconStyles) && {
|
|
1334
|
+
backgroundColor: 'transparent',
|
|
1335
|
+
'&:hover': {
|
|
1336
|
+
backgroundColor: 'transparent'
|
|
1337
|
+
},
|
|
1338
|
+
'&:active': {
|
|
1339
|
+
backgroundColor: 'transparent'
|
|
1340
|
+
}
|
|
1341
|
+
})
|
|
1342
|
+
},
|
|
1343
|
+
// Loading styles
|
|
1344
|
+
...(loading && {
|
|
1345
|
+
'::before': {
|
|
1346
|
+
opacity: 0
|
|
1347
|
+
},
|
|
1348
|
+
[`${clsLoadingIcon}`]: {
|
|
1349
|
+
...(onlyIcon ? {
|
|
1350
|
+
// In case of only icon, the icon is already centered but vertically not aligned, this fixes that
|
|
1351
|
+
verticalAlign: 'middle'
|
|
1352
|
+
} : {
|
|
1353
|
+
// Position loading indicator in center
|
|
1354
|
+
// This would break vertical centering of loading circle when onlyIcon is true
|
|
1355
|
+
position: 'absolute'
|
|
1356
|
+
}),
|
|
1357
|
+
...(!isFlex && !forceIconStyles && {
|
|
1358
|
+
// Normally we'd do `transform: translateX(-50%)` but `antd` crushes that with injected inline `style`.
|
|
1359
|
+
left: 'calc(50% - 7px)'
|
|
1360
|
+
}),
|
|
1361
|
+
// Re-enable animation for the loading spinner, since it can be disabled by the global animation CSS.
|
|
1362
|
+
svg: {
|
|
1363
|
+
animationDuration: '1s !important'
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
[`& > ${clsLoadingIcon} .anticon`]: {
|
|
1367
|
+
paddingRight: 0 // to horizontally center icon
|
|
1368
|
+
},
|
|
1369
|
+
|
|
1370
|
+
[`> :not(${clsLoadingIcon})`]: {
|
|
1371
|
+
// Hide all content except loading icon
|
|
1372
|
+
opacity: 0,
|
|
1373
|
+
visibility: 'hidden',
|
|
1374
|
+
// Add horizontal space for icon
|
|
1375
|
+
...(withIcon && {
|
|
1376
|
+
paddingLeft: theme.spacing.sm * 2 + 14
|
|
1377
|
+
})
|
|
1378
|
+
}
|
|
1379
|
+
}),
|
|
1380
|
+
// Icon styles
|
|
1381
|
+
[`> ${clsIcon} + span, > span + ${clsIcon}`]: {
|
|
1382
|
+
marginRight: 0,
|
|
1383
|
+
marginLeft: theme.spacing.xs
|
|
1384
|
+
},
|
|
1385
|
+
[`> ${clsIcon}`]: iconCss,
|
|
1386
|
+
[`> ${endIconCssSelector}`]: {
|
|
1387
|
+
...iconCss,
|
|
1388
|
+
marginLeft: theme.spacing.sm
|
|
1389
|
+
},
|
|
1390
|
+
...(!type && {
|
|
1391
|
+
[`&:enabled:not(:hover):not(:active) > ${clsIcon}`]: inactiveIconCss
|
|
1392
|
+
}),
|
|
1393
|
+
...(!type && {
|
|
1394
|
+
[`&:enabled:not(:hover):not(:active) > ${endIconCssSelector}`]: inactiveIconCss
|
|
1395
|
+
}),
|
|
1396
|
+
// Disable animations
|
|
1397
|
+
[`&[${classNamePrefix}-click-animating-without-extra-node='true']::after`]: {
|
|
1398
|
+
display: 'none'
|
|
1399
|
+
},
|
|
1400
|
+
[`&${clsIconOnly}`]: {
|
|
1401
|
+
border: 'none',
|
|
1402
|
+
[`&:enabled:not(${classLink})`]: {
|
|
1403
|
+
...tertiaryColors,
|
|
1404
|
+
color: theme.colors.textSecondary,
|
|
1405
|
+
'&:hover > .anticon': {
|
|
1406
|
+
color: tertiaryColors['&:hover'].color
|
|
1407
|
+
},
|
|
1408
|
+
'&:active > .anticon': {
|
|
1409
|
+
color: tertiaryColors['&:active'].color
|
|
1410
|
+
}
|
|
1411
|
+
},
|
|
1412
|
+
[`&:enabled:not(${classLink}) > .anticon`]: {
|
|
1413
|
+
color: theme.colors.textSecondary
|
|
1414
|
+
},
|
|
1415
|
+
...(isAnchor && {
|
|
1416
|
+
lineHeight: `${theme.general.heightSm}px`,
|
|
1417
|
+
...getLinkStyles$1(theme),
|
|
1418
|
+
'&:disabled': {
|
|
1419
|
+
color: theme.colors.actionDisabledText
|
|
1420
|
+
}
|
|
1421
|
+
}),
|
|
1422
|
+
'&[disabled]:hover': {
|
|
1423
|
+
backgroundColor: 'transparent'
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
[`&:focus`]: {
|
|
1427
|
+
...(useFocusPseudoClass && {
|
|
1428
|
+
outlineStyle: 'solid',
|
|
1429
|
+
outlineWidth: '2px',
|
|
1430
|
+
outlineOffset: '1px',
|
|
1431
|
+
outlineColor: theme.isDarkMode ? theme.colors.actionDefaultBorderFocus : theme.colors.primary
|
|
1432
|
+
}),
|
|
1433
|
+
[`${clsLoadingIcon}`]: {
|
|
1434
|
+
...(onlyIcon && {
|
|
1435
|
+
// Mitigate wrong left offset for loading state with onlyIcon
|
|
1436
|
+
left: 0
|
|
1437
|
+
})
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
...(forceIconStyles && {
|
|
1441
|
+
padding: '0 6px',
|
|
1442
|
+
lineHeight: theme.typography.lineHeightSm,
|
|
1443
|
+
color: theme.colors.textSecondary,
|
|
1444
|
+
'& > span': {
|
|
1445
|
+
verticalAlign: -1,
|
|
1446
|
+
height: theme.general.heightSm / 2,
|
|
1447
|
+
width: theme.general.heightSm / 2
|
|
1448
|
+
},
|
|
1449
|
+
[`& > ${clsLoadingIcon} .anticon`]: {
|
|
1450
|
+
// left: `calc(50% - 6px)!important`,
|
|
1451
|
+
height: theme.general.heightSm / 2,
|
|
1452
|
+
width: theme.general.heightSm / 2,
|
|
1453
|
+
padding: 0
|
|
1454
|
+
}
|
|
1455
|
+
}),
|
|
1456
|
+
...getAnimationCss(enableAnimation)
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
// Moved outside main style object because state & selector matching in the already existing object keys can create bugs and unwanted overwrites
|
|
1460
|
+
const typeStyles = {
|
|
1461
|
+
...(type === 'tertiary' && {
|
|
1462
|
+
[`&:enabled:not(${clsIconOnly})`]: tertiaryColors,
|
|
1463
|
+
[`&${classLink}[disabled]`]: {
|
|
1464
|
+
...getDisabledTertiaryStyles(theme)
|
|
1465
|
+
}
|
|
1466
|
+
})
|
|
1467
|
+
};
|
|
1468
|
+
const importantStyles = importantify(styles);
|
|
1469
|
+
const importantTypeStyles = importantify(typeStyles);
|
|
1470
|
+
return /*#__PURE__*/css(importantStyles, importantTypeStyles, process.env.NODE_ENV === "production" ? "" : ";label:getButtonEmotionStyles;");
|
|
1471
|
+
};
|
|
1472
|
+
const Button = /* #__PURE__ */(() => {
|
|
1473
|
+
const Button = /*#__PURE__*/forwardRef(function Button( // Keep size out of props passed to AntD to make deprecation and eventual removal have 0 impact
|
|
1474
|
+
_ref2, ref) {
|
|
1475
|
+
let {
|
|
1476
|
+
dangerouslySetAntdProps,
|
|
1477
|
+
children,
|
|
1478
|
+
size,
|
|
1479
|
+
type,
|
|
1480
|
+
endIcon,
|
|
1481
|
+
dangerouslySetForceIconStyles,
|
|
1482
|
+
dangerouslyUseFocusPseudoClass,
|
|
1483
|
+
...props
|
|
1484
|
+
} = _ref2;
|
|
1485
|
+
const {
|
|
1486
|
+
theme,
|
|
1487
|
+
classNamePrefix
|
|
1488
|
+
} = useDesignSystemTheme();
|
|
1489
|
+
const {
|
|
1490
|
+
USE_FLEX_BUTTON: isFlex
|
|
1491
|
+
} = useDesignSystemFlags();
|
|
1492
|
+
const clsEndIcon = getEndIconClsName(theme);
|
|
1493
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1494
|
+
children: jsx(Button$1, {
|
|
1495
|
+
...props,
|
|
1496
|
+
css: getButtonEmotionStyles({
|
|
1497
|
+
theme,
|
|
1498
|
+
classNamePrefix,
|
|
1499
|
+
loading: Boolean(props.loading),
|
|
1500
|
+
withIcon: Boolean(props.icon),
|
|
1501
|
+
onlyIcon: Boolean((props.icon || endIcon) && !children),
|
|
1502
|
+
isAnchor: Boolean(props.href && !type),
|
|
1503
|
+
danger: Boolean(props.danger),
|
|
1504
|
+
enableAnimation: theme.options.enableAnimation,
|
|
1505
|
+
size: size || 'middle',
|
|
1506
|
+
type,
|
|
1507
|
+
isFlex,
|
|
1508
|
+
forceIconStyles: Boolean(dangerouslySetForceIconStyles),
|
|
1509
|
+
useFocusPseudoClass: Boolean(dangerouslyUseFocusPseudoClass)
|
|
1510
|
+
}),
|
|
1511
|
+
href: props.disabled ? undefined : props.href,
|
|
1512
|
+
...dangerouslySetAntdProps,
|
|
1513
|
+
ref: ref,
|
|
1514
|
+
type: type === 'tertiary' ? 'link' : type,
|
|
1515
|
+
children: children && jsxs("span", {
|
|
1516
|
+
style: {
|
|
1517
|
+
visibility: props !== null && props !== void 0 && props.loading ? 'hidden' : 'visible',
|
|
1518
|
+
...(isFlex && {
|
|
1519
|
+
display: 'inline-flex',
|
|
1520
|
+
alignItems: 'center'
|
|
1521
|
+
})
|
|
1522
|
+
},
|
|
1523
|
+
children: [children, endIcon && jsx("span", {
|
|
1524
|
+
className: clsEndIcon,
|
|
1525
|
+
style: {
|
|
1526
|
+
...(isFlex && {
|
|
1527
|
+
display: 'inline-flex',
|
|
1528
|
+
alignItems: 'center'
|
|
1529
|
+
})
|
|
1530
|
+
},
|
|
1531
|
+
children: endIcon
|
|
1532
|
+
})]
|
|
1533
|
+
})
|
|
1534
|
+
})
|
|
1535
|
+
});
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
// This is needed for other Ant components that wrap Button, such as Tooltip, to correctly
|
|
1539
|
+
// identify it as an Ant button.
|
|
1540
|
+
// This should be removed if the component is rewritten to no longer be a wrapper around Ant.
|
|
1541
|
+
// See: https://github.com/ant-design/ant-design/blob/6dd39c1f89b4d6632e6ed022ff1bc275ca1e0f1f/components/button/button.tsx#L291
|
|
1542
|
+
Button.__ANT_BUTTON = true;
|
|
1543
|
+
return Button;
|
|
1544
|
+
})();
|
|
1545
|
+
|
|
1546
|
+
const getInputEmotionStyles = (clsPrefix, theme, _ref, useTransparent) => {
|
|
1547
|
+
let {
|
|
1548
|
+
validationState
|
|
1549
|
+
} = _ref;
|
|
1550
|
+
const inputClass = `.${clsPrefix}-input`;
|
|
1551
|
+
const affixClass = `.${clsPrefix}-input-affix-wrapper`;
|
|
1552
|
+
const affixClassFocused = `.${clsPrefix}-input-affix-wrapper-focused`;
|
|
1553
|
+
const clearIcon = `.${clsPrefix}-input-clear-icon`;
|
|
1554
|
+
const prefixIcon = `.${clsPrefix}-input-prefix`;
|
|
1555
|
+
const suffixIcon = `.${clsPrefix}-input-suffix`;
|
|
1556
|
+
const validationColor = getValidationStateColor(theme, validationState);
|
|
1557
|
+
const styles = {
|
|
1558
|
+
'&&': {
|
|
1559
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1560
|
+
minHeight: theme.general.heightSm,
|
|
1561
|
+
...(validationState && {
|
|
1562
|
+
borderColor: validationColor
|
|
1563
|
+
}),
|
|
1564
|
+
'&:hover': {
|
|
1565
|
+
borderColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundHover
|
|
1566
|
+
},
|
|
1567
|
+
'&:focus': {
|
|
1568
|
+
outlineColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundDefault,
|
|
1569
|
+
outlineWidth: 2,
|
|
1570
|
+
outlineOffset: -2,
|
|
1571
|
+
outlineStyle: 'solid',
|
|
1572
|
+
boxShadow: 'none',
|
|
1573
|
+
borderColor: 'transparent'
|
|
1574
|
+
},
|
|
1575
|
+
'&:disabled': {
|
|
1576
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
1577
|
+
color: theme.colors.actionDisabledText
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
[`&${inputClass}, ${inputClass}`]: {
|
|
1581
|
+
...(useTransparent && {
|
|
1582
|
+
backgroundColor: 'transparent'
|
|
1583
|
+
})
|
|
1584
|
+
},
|
|
1585
|
+
[`&${affixClass}`]: {
|
|
1586
|
+
...(useTransparent && {
|
|
1587
|
+
backgroundColor: 'transparent'
|
|
1588
|
+
}),
|
|
1589
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1590
|
+
paddingTop: 5,
|
|
1591
|
+
paddingBottom: 5,
|
|
1592
|
+
minHeight: theme.general.heightSm,
|
|
1593
|
+
'::before': {
|
|
1594
|
+
lineHeight: theme.typography.lineHeightBase
|
|
1595
|
+
},
|
|
1596
|
+
'&:hover': {
|
|
1597
|
+
borderColor: theme.colors.actionPrimaryBackgroundHover
|
|
1598
|
+
},
|
|
1599
|
+
[`input.${clsPrefix}-input`]: {
|
|
1600
|
+
borderRadius: 0
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
[`&${affixClassFocused}`]: {
|
|
1604
|
+
boxShadow: 'none',
|
|
1605
|
+
'&&, &:focus': {
|
|
1606
|
+
outlineColor: theme.colors.actionPrimaryBackgroundDefault,
|
|
1607
|
+
outlineWidth: 2,
|
|
1608
|
+
outlineOffset: -2,
|
|
1609
|
+
outlineStyle: 'solid',
|
|
1610
|
+
boxShadow: 'none',
|
|
1611
|
+
borderColor: 'transparent'
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
[clearIcon]: {
|
|
1615
|
+
fontSize: theme.general.iconFontSize
|
|
1616
|
+
},
|
|
1617
|
+
[prefixIcon]: {
|
|
1618
|
+
marginRight: theme.spacing.sm,
|
|
1619
|
+
color: theme.colors.textSecondary
|
|
1620
|
+
},
|
|
1621
|
+
[suffixIcon]: {
|
|
1622
|
+
marginLeft: theme.spacing.sm,
|
|
1623
|
+
color: theme.colors.textSecondary
|
|
1624
|
+
},
|
|
1625
|
+
...getAnimationCss(theme.options.enableAnimation)
|
|
1626
|
+
};
|
|
1627
|
+
return /*#__PURE__*/css(importantify(styles), process.env.NODE_ENV === "production" ? "" : ";label:getInputEmotionStyles;");
|
|
1628
|
+
};
|
|
1629
|
+
const getInputGroupStyling = (clsPrefix, theme) => {
|
|
1630
|
+
const inputClass = `.${clsPrefix}-input`;
|
|
1631
|
+
const buttonClass = `.${clsPrefix}-btn`;
|
|
1632
|
+
return /*#__PURE__*/css({
|
|
1633
|
+
display: 'inline-flex !important',
|
|
1634
|
+
width: 'auto',
|
|
1635
|
+
[`& > ${inputClass}`]: {
|
|
1636
|
+
flexGrow: 1,
|
|
1637
|
+
'&:disabled': {
|
|
1638
|
+
border: 'none',
|
|
1639
|
+
'&:hover': {
|
|
1640
|
+
borderRight: `1px solid ${theme.colors.actionDisabledText} !important`
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
[`& > ${buttonClass} > span`]: {
|
|
1645
|
+
verticalAlign: 'middle'
|
|
1646
|
+
},
|
|
1647
|
+
[`& > ${buttonClass}:disabled, & > ${buttonClass}:disabled:hover`]: {
|
|
1648
|
+
borderLeft: `1px solid ${theme.colors.actionDisabledText} !important`
|
|
1649
|
+
}
|
|
1650
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getInputGroupStyling;");
|
|
1651
|
+
};
|
|
1652
|
+
const TextArea = /*#__PURE__*/forwardRef(function TextArea(_ref2, ref) {
|
|
1653
|
+
let {
|
|
1654
|
+
validationState,
|
|
1655
|
+
autoComplete = 'off',
|
|
1656
|
+
dangerouslySetAntdProps,
|
|
1657
|
+
dangerouslyAppendEmotionCSS,
|
|
1658
|
+
...props
|
|
1659
|
+
} = _ref2;
|
|
1660
|
+
const {
|
|
1661
|
+
classNamePrefix,
|
|
1662
|
+
theme
|
|
1663
|
+
} = useDesignSystemTheme();
|
|
1664
|
+
const {
|
|
1665
|
+
USE_TRANSPARENT_INPUT: useTransparent
|
|
1666
|
+
} = useDesignSystemFlags();
|
|
1667
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1668
|
+
children: jsx(Input$1.TextArea, {
|
|
1669
|
+
ref: ref,
|
|
1670
|
+
autoComplete: autoComplete,
|
|
1671
|
+
css: [getInputEmotionStyles(classNamePrefix, theme, {
|
|
1672
|
+
validationState
|
|
1673
|
+
}, useTransparent), dangerouslyAppendEmotionCSS, process.env.NODE_ENV === "production" ? "" : ";label:TextArea;"],
|
|
1674
|
+
...props,
|
|
1675
|
+
...dangerouslySetAntdProps
|
|
1676
|
+
})
|
|
1677
|
+
});
|
|
1678
|
+
});
|
|
1679
|
+
const Password = /*#__PURE__*/forwardRef(function Password(_ref3, ref) {
|
|
1680
|
+
let {
|
|
1681
|
+
validationState,
|
|
1682
|
+
autoComplete = 'off',
|
|
1683
|
+
dangerouslySetAntdProps,
|
|
1684
|
+
dangerouslyAppendEmotionCSS,
|
|
1685
|
+
...props
|
|
1686
|
+
} = _ref3;
|
|
1687
|
+
const {
|
|
1688
|
+
classNamePrefix,
|
|
1689
|
+
theme
|
|
1690
|
+
} = useDesignSystemTheme();
|
|
1691
|
+
const {
|
|
1692
|
+
USE_TRANSPARENT_INPUT: useTransparent
|
|
1693
|
+
} = useDesignSystemFlags();
|
|
1694
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1695
|
+
children: jsx(Input$1.Password, {
|
|
1696
|
+
visibilityToggle: false,
|
|
1697
|
+
ref: ref,
|
|
1698
|
+
autoComplete: autoComplete,
|
|
1699
|
+
css: [getInputEmotionStyles(classNamePrefix, theme, {
|
|
1700
|
+
validationState
|
|
1701
|
+
}, useTransparent), dangerouslyAppendEmotionCSS, process.env.NODE_ENV === "production" ? "" : ";label:Password;"],
|
|
1702
|
+
...props,
|
|
1703
|
+
...dangerouslySetAntdProps
|
|
1704
|
+
})
|
|
1705
|
+
});
|
|
1706
|
+
});
|
|
1707
|
+
const DuboisInput = /*#__PURE__*/forwardRef(function Input(_ref4, ref) {
|
|
1708
|
+
let {
|
|
1709
|
+
validationState,
|
|
1710
|
+
autoComplete = 'off',
|
|
1711
|
+
dangerouslySetAntdProps,
|
|
1712
|
+
dangerouslyAppendEmotionCSS,
|
|
1713
|
+
onChange,
|
|
1714
|
+
onClear,
|
|
1715
|
+
...props
|
|
1716
|
+
} = _ref4;
|
|
1717
|
+
const {
|
|
1718
|
+
classNamePrefix,
|
|
1719
|
+
theme
|
|
1720
|
+
} = useDesignSystemTheme();
|
|
1721
|
+
const {
|
|
1722
|
+
USE_TRANSPARENT_INPUT: useTransparent
|
|
1723
|
+
} = useDesignSystemFlags();
|
|
1724
|
+
const handleChange = e => {
|
|
1725
|
+
// If the input is cleared, call the onClear handler, but only
|
|
1726
|
+
// if the event is not an input event -- which is the case when you click the
|
|
1727
|
+
// ant-provided (X) button.
|
|
1728
|
+
if (!e.target.value && e.nativeEvent instanceof InputEvent === false && onClear) {
|
|
1729
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
1730
|
+
} else {
|
|
1731
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
1732
|
+
}
|
|
1733
|
+
};
|
|
1734
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1735
|
+
children: jsx(Input$1, {
|
|
1736
|
+
autoComplete: autoComplete,
|
|
1737
|
+
ref: ref,
|
|
1738
|
+
css: [getInputEmotionStyles(classNamePrefix, theme, {
|
|
1739
|
+
validationState
|
|
1740
|
+
}, useTransparent), dangerouslyAppendEmotionCSS, process.env.NODE_ENV === "production" ? "" : ";label:DuboisInput;"],
|
|
1741
|
+
onChange: handleChange,
|
|
1742
|
+
...props,
|
|
1743
|
+
...dangerouslySetAntdProps
|
|
1744
|
+
})
|
|
1745
|
+
});
|
|
1746
|
+
});
|
|
1747
|
+
const Group = _ref5 => {
|
|
1748
|
+
let {
|
|
1749
|
+
dangerouslySetAntdProps,
|
|
1750
|
+
dangerouslyAppendEmotionCSS,
|
|
1751
|
+
compact = true,
|
|
1752
|
+
...props
|
|
1753
|
+
} = _ref5;
|
|
1754
|
+
const {
|
|
1755
|
+
classNamePrefix,
|
|
1756
|
+
theme
|
|
1757
|
+
} = useDesignSystemTheme();
|
|
1758
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1759
|
+
children: jsx(Input$1.Group, {
|
|
1760
|
+
css: [getInputGroupStyling(classNamePrefix, theme), dangerouslyAppendEmotionCSS, process.env.NODE_ENV === "production" ? "" : ";label:Group;"],
|
|
1761
|
+
compact: compact,
|
|
1762
|
+
...props,
|
|
1763
|
+
...dangerouslySetAntdProps
|
|
1764
|
+
})
|
|
1765
|
+
});
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
// Properly creates the namespace and dot-notation components with correct types.
|
|
1769
|
+
const InputNamespace = /* #__PURE__ */Object.assign(DuboisInput, {
|
|
1770
|
+
TextArea,
|
|
1771
|
+
Password,
|
|
1772
|
+
Group
|
|
1773
|
+
});
|
|
1774
|
+
const Input = InputNamespace;
|
|
1775
|
+
|
|
1776
|
+
// TODO: I'm doing this to support storybook's docgen;
|
|
1777
|
+
// We should remove this once we have a better storybook integration,
|
|
1778
|
+
// since these will be exposed in the library's exports.
|
|
1779
|
+
const __INTERNAL_DO_NOT_USE__TextArea = TextArea;
|
|
1780
|
+
const __INTERNAL_DO_NOT_USE__Password = Password;
|
|
1781
|
+
const __INTERNAL_DO_NOT_USE_DEDUPE__Group = Group;
|
|
1782
|
+
|
|
1783
|
+
const getLinkStyles = (theme, clsPrefix) => {
|
|
1784
|
+
const classTypography = `.${clsPrefix}-typography`;
|
|
1785
|
+
const styles = {
|
|
1786
|
+
[`&${classTypography}, &${classTypography}:focus`]: {
|
|
1787
|
+
color: theme.colors.actionTertiaryTextDefault
|
|
1788
|
+
},
|
|
1789
|
+
[`&${classTypography}:hover, &${classTypography}:hover .anticon`]: {
|
|
1790
|
+
color: theme.colors.actionTertiaryTextHover,
|
|
1791
|
+
textDecoration: 'underline'
|
|
1792
|
+
},
|
|
1793
|
+
[`&${classTypography}:active, &${classTypography}:active .anticon`]: {
|
|
1794
|
+
color: theme.colors.actionTertiaryTextPress,
|
|
1795
|
+
textDecoration: 'underline'
|
|
1796
|
+
},
|
|
1797
|
+
[`&${classTypography}:focus-visible`]: {
|
|
1798
|
+
textDecoration: 'underline'
|
|
1799
|
+
},
|
|
1800
|
+
'.anticon': {
|
|
1801
|
+
fontSize: 12
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getLinkStyles;");
|
|
1805
|
+
};
|
|
1806
|
+
const getEllipsisNewTabLinkStyles = () => {
|
|
1807
|
+
const styles = {
|
|
1808
|
+
paddingRight: 'calc(2px + 1em)',
|
|
1809
|
+
// 1em for icon
|
|
1810
|
+
position: 'relative'
|
|
1811
|
+
};
|
|
1812
|
+
return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisNewTabLinkStyles;");
|
|
1813
|
+
};
|
|
1814
|
+
const getIconStyles = theme => {
|
|
1815
|
+
const styles = {
|
|
1816
|
+
marginLeft: 2,
|
|
1817
|
+
color: theme.colors.actionTertiaryTextDefault
|
|
1818
|
+
};
|
|
1819
|
+
return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getIconStyles;");
|
|
1820
|
+
};
|
|
1821
|
+
const getEllipsisIconStyles = useNewIcons => {
|
|
1822
|
+
const styles = {
|
|
1823
|
+
position: 'absolute',
|
|
1824
|
+
right: 0,
|
|
1825
|
+
bottom: 0,
|
|
1826
|
+
top: 0,
|
|
1827
|
+
display: 'flex',
|
|
1828
|
+
alignItems: 'center',
|
|
1829
|
+
...(useNewIcons && {
|
|
1830
|
+
fontSize: 12
|
|
1831
|
+
})
|
|
1832
|
+
};
|
|
1833
|
+
return /*#__PURE__*/css(styles, process.env.NODE_ENV === "production" ? "" : ";label:getEllipsisIconStyles;");
|
|
1834
|
+
};
|
|
1835
|
+
function Link(_ref) {
|
|
1836
|
+
let {
|
|
1837
|
+
dangerouslySetAntdProps,
|
|
1838
|
+
...props
|
|
1839
|
+
} = _ref;
|
|
1840
|
+
const {
|
|
1841
|
+
children,
|
|
1842
|
+
openInNewTab,
|
|
1843
|
+
...restProps
|
|
1844
|
+
} = props;
|
|
1845
|
+
const {
|
|
1846
|
+
theme,
|
|
1847
|
+
classNamePrefix
|
|
1848
|
+
} = useDesignSystemTheme();
|
|
1849
|
+
const newTabProps = {
|
|
1850
|
+
rel: 'noopener noreferrer',
|
|
1851
|
+
target: '_blank'
|
|
1852
|
+
};
|
|
1853
|
+
const linkProps = openInNewTab ? {
|
|
1854
|
+
...restProps,
|
|
1855
|
+
...newTabProps
|
|
1856
|
+
} : {
|
|
1857
|
+
...restProps
|
|
1858
|
+
};
|
|
1859
|
+
const linkStyles = props.ellipsis && openInNewTab ? [getLinkStyles(theme, classNamePrefix), getEllipsisNewTabLinkStyles()] : getLinkStyles(theme, classNamePrefix);
|
|
1860
|
+
const iconStyles = props.ellipsis ? [getIconStyles(theme), getEllipsisIconStyles()] : getIconStyles(theme);
|
|
1861
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1862
|
+
children: jsxs(Typography$1.Link, {
|
|
1863
|
+
"aria-disabled": linkProps.disabled,
|
|
1864
|
+
css: linkStyles,
|
|
1865
|
+
...linkProps,
|
|
1866
|
+
...dangerouslySetAntdProps,
|
|
1867
|
+
children: [children, openInNewTab ? jsx(NewWindowIcon, {
|
|
1868
|
+
css: iconStyles,
|
|
1869
|
+
...newTabProps
|
|
1870
|
+
}) : null]
|
|
1871
|
+
})
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
const {
|
|
1876
|
+
Paragraph: AntDParagraph
|
|
1877
|
+
} = Typography$1;
|
|
1878
|
+
function getParagraphEmotionStyles(theme, props) {
|
|
1879
|
+
return /*#__PURE__*/css({
|
|
1880
|
+
'&&': {
|
|
1881
|
+
fontSize: theme.typography.fontSizeBase,
|
|
1882
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1883
|
+
color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
|
|
1884
|
+
}
|
|
1885
|
+
}, props.disabled && {
|
|
1886
|
+
'&&': {
|
|
1887
|
+
color: theme.colors.actionDisabledText
|
|
1888
|
+
}
|
|
1889
|
+
}, props.withoutMargins && {
|
|
1890
|
+
'&&': {
|
|
1891
|
+
marginTop: 0,
|
|
1892
|
+
marginBottom: 0
|
|
1893
|
+
}
|
|
1894
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getParagraphEmotionStyles;");
|
|
1895
|
+
}
|
|
1896
|
+
function Paragraph(userProps) {
|
|
1897
|
+
const {
|
|
1898
|
+
dangerouslySetAntdProps,
|
|
1899
|
+
withoutMargins,
|
|
1900
|
+
color,
|
|
1901
|
+
...props
|
|
1902
|
+
} = userProps;
|
|
1903
|
+
const {
|
|
1904
|
+
theme
|
|
1905
|
+
} = useDesignSystemTheme();
|
|
1906
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
1907
|
+
children: jsx(AntDParagraph, {
|
|
1908
|
+
...props,
|
|
1909
|
+
className: props.className,
|
|
1910
|
+
css: getParagraphEmotionStyles(theme, userProps),
|
|
1911
|
+
...dangerouslySetAntdProps
|
|
1912
|
+
})
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
const {
|
|
1917
|
+
Text: AntDText
|
|
1918
|
+
} = Typography$1;
|
|
1919
|
+
function getTextEmotionStyles(theme, props) {
|
|
1920
|
+
return /*#__PURE__*/css({
|
|
1921
|
+
'&&': {
|
|
1922
|
+
fontSize: theme.typography.fontSizeBase,
|
|
1923
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1924
|
+
color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
|
|
1925
|
+
}
|
|
1926
|
+
}, props.disabled && {
|
|
1927
|
+
'&&': {
|
|
1928
|
+
color: theme.colors.actionDisabledText
|
|
1929
|
+
}
|
|
1930
|
+
}, props.hint && {
|
|
1931
|
+
'&&': {
|
|
1932
|
+
fontSize: theme.typography.fontSizeSm,
|
|
1933
|
+
lineHeight: theme.typography.lineHeightSm
|
|
1934
|
+
}
|
|
1935
|
+
}, props.bold && {
|
|
1936
|
+
'&&': {
|
|
1937
|
+
fontSize: theme.typography.fontSizeBase,
|
|
1938
|
+
fontWeight: theme.typography.typographyBoldFontWeight,
|
|
1939
|
+
lineHeight: theme.typography.lineHeightBase
|
|
1940
|
+
}
|
|
1941
|
+
}, props.code && {
|
|
1942
|
+
'&& > code': {
|
|
1943
|
+
fontSize: theme.typography.fontSizeBase,
|
|
1944
|
+
lineHeight: theme.typography.lineHeightBase,
|
|
1945
|
+
background: theme.colors.typographyCodeBg,
|
|
1946
|
+
fontFamily: 'monospace',
|
|
1947
|
+
borderRadius: theme.borders.borderRadiusMd,
|
|
1948
|
+
padding: '2px 4px',
|
|
1949
|
+
border: 'unset',
|
|
1950
|
+
margin: 0
|
|
1951
|
+
}
|
|
1952
|
+
}, props.size && {
|
|
1953
|
+
'&&': (() => {
|
|
1954
|
+
switch (props.size) {
|
|
1955
|
+
case 'xxl':
|
|
1956
|
+
return {
|
|
1957
|
+
fontSize: theme.typography.fontSizeXxl,
|
|
1958
|
+
lineHeight: theme.typography.lineHeightXxl
|
|
1959
|
+
};
|
|
1960
|
+
case 'xl':
|
|
1961
|
+
return {
|
|
1962
|
+
fontSize: theme.typography.fontSizeXl,
|
|
1963
|
+
lineHeight: theme.typography.lineHeightXl
|
|
1964
|
+
};
|
|
1965
|
+
case 'lg':
|
|
1966
|
+
return {
|
|
1967
|
+
fontSize: theme.typography.fontSizeLg,
|
|
1968
|
+
lineHeight: theme.typography.lineHeightLg
|
|
1969
|
+
};
|
|
1970
|
+
case 'sm':
|
|
1971
|
+
return {
|
|
1972
|
+
fontSize: theme.typography.fontSizeSm,
|
|
1973
|
+
lineHeight: theme.typography.lineHeightSm
|
|
1974
|
+
};
|
|
1975
|
+
default:
|
|
1976
|
+
return {
|
|
1977
|
+
fontSize: theme.typography.fontSizeMd,
|
|
1978
|
+
lineHeight: theme.typography.lineHeightMd
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
})()
|
|
1982
|
+
}, props.withoutMargins && {
|
|
1983
|
+
'&&': {
|
|
1984
|
+
marginTop: 0,
|
|
1985
|
+
marginBottom: 0
|
|
1986
|
+
}
|
|
1987
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getTextEmotionStyles;");
|
|
1988
|
+
}
|
|
1989
|
+
function Text(userProps) {
|
|
1990
|
+
// Omit props that are not supported by `antd`
|
|
1991
|
+
const {
|
|
1992
|
+
dangerouslySetAntdProps,
|
|
1993
|
+
bold,
|
|
1994
|
+
hint,
|
|
1995
|
+
withoutMargins,
|
|
1996
|
+
color,
|
|
1997
|
+
...props
|
|
1998
|
+
} = userProps;
|
|
1999
|
+
const {
|
|
2000
|
+
theme
|
|
2001
|
+
} = useDesignSystemTheme();
|
|
2002
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
2003
|
+
children: jsx(AntDText, {
|
|
2004
|
+
...props,
|
|
2005
|
+
className: props.className,
|
|
2006
|
+
css: getTextEmotionStyles(theme, userProps),
|
|
2007
|
+
...dangerouslySetAntdProps
|
|
2008
|
+
})
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
const {
|
|
2013
|
+
Title: AntDTitle
|
|
2014
|
+
} = Typography$1;
|
|
2015
|
+
function getLevelStyles(theme, props) {
|
|
2016
|
+
switch (props.level) {
|
|
2017
|
+
case 1:
|
|
2018
|
+
return /*#__PURE__*/css({
|
|
2019
|
+
'&&': {
|
|
2020
|
+
fontSize: theme.typography.fontSizeXxl,
|
|
2021
|
+
lineHeight: theme.typography.lineHeightXxl,
|
|
2022
|
+
fontWeight: theme.typography.typographyBoldFontWeight
|
|
2023
|
+
}
|
|
2024
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
|
|
2025
|
+
case 2:
|
|
2026
|
+
return /*#__PURE__*/css({
|
|
2027
|
+
'&&': {
|
|
2028
|
+
fontSize: theme.typography.fontSizeXl,
|
|
2029
|
+
lineHeight: theme.typography.lineHeightXl,
|
|
2030
|
+
fontWeight: theme.typography.typographyBoldFontWeight
|
|
2031
|
+
}
|
|
2032
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
|
|
2033
|
+
case 3:
|
|
2034
|
+
return /*#__PURE__*/css({
|
|
2035
|
+
'&&': {
|
|
2036
|
+
fontSize: theme.typography.fontSizeLg,
|
|
2037
|
+
lineHeight: theme.typography.lineHeightLg,
|
|
2038
|
+
fontWeight: theme.typography.typographyBoldFontWeight
|
|
2039
|
+
}
|
|
2040
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
|
|
2041
|
+
case 4:
|
|
2042
|
+
default:
|
|
2043
|
+
return /*#__PURE__*/css({
|
|
2044
|
+
'&&': {
|
|
2045
|
+
fontSize: theme.typography.fontSizeMd,
|
|
2046
|
+
lineHeight: theme.typography.lineHeightMd,
|
|
2047
|
+
fontWeight: theme.typography.typographyBoldFontWeight
|
|
2048
|
+
}
|
|
2049
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getLevelStyles;");
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
function getTitleEmotionStyles(theme, props) {
|
|
2053
|
+
return /*#__PURE__*/css(getLevelStyles(theme, props), {
|
|
2054
|
+
'&&': {
|
|
2055
|
+
color: getTypographyColor(theme, props.color, theme.colors.textPrimary)
|
|
2056
|
+
}
|
|
2057
|
+
}, props.withoutMargins && {
|
|
2058
|
+
'&&': {
|
|
2059
|
+
marginTop: '0 !important',
|
|
2060
|
+
// override general styling
|
|
2061
|
+
marginBottom: '0 !important' // override general styling
|
|
2062
|
+
}
|
|
2063
|
+
}, process.env.NODE_ENV === "production" ? "" : ";label:getTitleEmotionStyles;");
|
|
2064
|
+
}
|
|
2065
|
+
function Title(userProps) {
|
|
2066
|
+
const {
|
|
2067
|
+
dangerouslySetAntdProps,
|
|
2068
|
+
withoutMargins,
|
|
2069
|
+
color,
|
|
2070
|
+
...props
|
|
2071
|
+
} = userProps;
|
|
2072
|
+
const {
|
|
2073
|
+
theme
|
|
2074
|
+
} = useDesignSystemTheme();
|
|
2075
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
2076
|
+
children: jsx(AntDTitle, {
|
|
2077
|
+
...props,
|
|
2078
|
+
className: props.className,
|
|
2079
|
+
css: getTitleEmotionStyles(theme, userProps),
|
|
2080
|
+
...dangerouslySetAntdProps
|
|
2081
|
+
})
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
const Typography = /* #__PURE__ */(() => {
|
|
2086
|
+
function Typography(_ref) {
|
|
2087
|
+
let {
|
|
2088
|
+
dangerouslySetAntdProps,
|
|
2089
|
+
...props
|
|
2090
|
+
} = _ref;
|
|
2091
|
+
return jsx(DesignSystemAntDConfigProvider, {
|
|
2092
|
+
children: jsx(Typography$1, {
|
|
2093
|
+
...props,
|
|
2094
|
+
...dangerouslySetAntdProps
|
|
2095
|
+
})
|
|
2096
|
+
});
|
|
2097
|
+
}
|
|
2098
|
+
Typography.Text = Text;
|
|
2099
|
+
Typography.Title = Title;
|
|
2100
|
+
Typography.Paragraph = Paragraph;
|
|
2101
|
+
Typography.Link = Link;
|
|
2102
|
+
return Typography;
|
|
2103
|
+
})();
|
|
2104
|
+
|
|
2105
|
+
export { ApplyDesignSystemContextOverrides as A, Button as B, CloseIcon as C, DesignSystemAntDConfigProvider as D, __INTERNAL_DO_NOT_USE__Password as E, FaceFrownIcon as F, __INTERNAL_DO_NOT_USE_DEDUPE__Group as G, Icon as I, NewWindowIcon as N, RestoreAntDDefaultClsPrefix as R, Typography as T, WithDesignSystemThemeHoc as W, __INTERNAL_DO_NOT_USE__TextArea as _, ChevronRightIcon as a, useDesignSystemFlags as b, DU_BOIS_ENABLE_ANIMATION_CLASSNAME as c, useDesignSystemContext as d, CheckIcon as e, Input as f, getAnimationCss as g, getValidationStateColor as h, importantify as i, Title as j, ChevronLeftIcon as k, getDefaultStyles as l, getPrimaryStyles as m, getDisabledStyles as n, lightColorList as o, getButtonEmotionStyles as p, DesignSystemThemeContext as q, DesignSystemContext as r, DesignSystemThemeProvider as s, DesignSystemProvider as t, useDesignSystemTheme as u, ApplyDesignSystemFlags as v, useAntDConfigProviderContext as w, CursorIcon as x, FaceNeutralIcon as y, FaceSmileIcon as z };
|
|
2106
|
+
//# sourceMappingURL=Typography-91d3d591.js.map
|