baseui 14.0.0 → 15.0.0
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/accordion/accordion.js +4 -4
- package/accordion/panel.d.ts +1 -1
- package/accordion/styled-components.js +1 -1
- package/accordion/types.d.ts +1 -1
- package/app-nav-bar/mobile-menu.js +3 -1
- package/banner/banner.js +3 -1
- package/banner/types.d.ts +2 -1
- package/bottom-navigation/bottom-navigation.js +3 -1
- package/bottom-navigation/selector.js +1 -1
- package/bottom-navigation/styled-components.js +1 -1
- package/button/button.d.ts +1 -3
- package/button/button.js +6 -2
- package/button/styled-components.d.ts +1 -0
- package/button/styled-components.js +61 -4
- package/button/types.d.ts +15 -3
- package/button-timed/button-timed.js +4 -5
- package/button-timed/styled-components.js +5 -3
- package/button-timed/types.d.ts +1 -1
- package/data-table/column-categorical.js +2 -2
- package/data-table/locale.d.ts +2 -0
- package/data-table/locale.js +2 -1
- package/data-table/stateful-container.js +1 -1
- package/data-table/stateful-data-table.js +7 -3
- package/data-table/types.d.ts +2 -0
- package/datepicker/day.js +2 -4
- package/datepicker/utils/date-helpers.d.ts +1 -0
- package/datepicker/utils/date-helpers.js +3 -0
- package/dialog/dialog.d.ts +1 -1
- package/dialog/dialog.js +38 -56
- package/dialog/styled-components.d.ts +2 -2
- package/dialog/styled-components.js +56 -24
- package/dialog/types.d.ts +5 -2
- package/file-uploader/constants.d.ts +16 -0
- package/file-uploader/constants.js +30 -0
- package/file-uploader/file-uploader.d.ts +2 -2
- package/file-uploader/file-uploader.js +387 -117
- package/file-uploader/index.d.ts +1 -1
- package/file-uploader/index.js +67 -18
- package/file-uploader/locale.d.ts +10 -10
- package/file-uploader/locale.js +5 -5
- package/file-uploader/styled-components.d.ts +13 -6
- package/file-uploader/styled-components.js +261 -64
- package/file-uploader/types.d.ts +47 -32
- package/file-uploader/utils.d.ts +5 -0
- package/file-uploader/utils.js +45 -0
- package/file-uploader-basic/file-uploader-basic.d.ts +10 -0
- package/file-uploader-basic/file-uploader-basic.js +175 -0
- package/file-uploader-basic/index.d.ts +4 -0
- package/file-uploader-basic/index.js +71 -0
- package/file-uploader-basic/locale.d.ts +15 -0
- package/file-uploader-basic/locale.js +21 -0
- package/file-uploader-basic/styled-components.d.ts +7 -0
- package/file-uploader-basic/styled-components.js +83 -0
- package/file-uploader-basic/types.d.ts +41 -0
- package/form-control/form-control.js +38 -3
- package/form-control/styled-components.d.ts +2 -0
- package/form-control/styled-components.js +22 -2
- package/form-control/types.d.ts +4 -0
- package/icon/circle-check-filled.d.ts +9 -0
- package/icon/circle-check-filled.js +50 -0
- package/icon/circle-exclamation-point-filled.d.ts +9 -0
- package/icon/circle-exclamation-point-filled.js +50 -0
- package/icon/hide.js +1 -1
- package/icon/icon-exports.d.ts +4 -0
- package/icon/icon-exports.js +28 -0
- package/icon/paperclip-filled.d.ts +9 -0
- package/icon/paperclip-filled.js +50 -0
- package/icon/show.js +1 -1
- package/icon/trash-can-filled.d.ts +9 -0
- package/{button-docked/button-docked.js → icon/trash-can-filled.js} +35 -16
- package/locale/en_US.js +14 -12
- package/locale/es_AR.js +9 -1
- package/locale/index.d.ts +3 -0
- package/locale/index.js +2 -0
- package/locale/tr_TR.js +9 -1
- package/locale/types.d.ts +2 -0
- package/message-card/message-card.js +2 -2
- package/message-card/utils.js +8 -3
- package/modal/modal-button.d.ts +1 -3
- package/package.json +5 -3
- package/payment-card/custom-cards.config.d.ts +1 -11
- package/payment-card/payment-card.js +1 -3
- package/phone-input/base-country-picker.js +2 -2
- package/phone-input/country-picker.js +0 -10
- package/progress-bar/progressbar-rounded.js +1 -1
- package/progress-bar/styled-components.js +8 -6
- package/rating/styled-components.js +3 -2
- package/rating/svg-icons.d.ts +5 -5
- package/rating/svg-icons.js +20 -20
- package/select/multi-value.js +1 -1
- package/snackbar/index.d.ts +1 -0
- package/snackbar/snackbar-context.d.ts +1 -2
- package/snackbar/snackbar-context.js +27 -21
- package/spinner/index.d.ts +4 -2
- package/stepper/stepper.js +28 -27
- package/styles/__mocks__/styled.js +0 -2
- package/styles/as-primary-export-hoc.js +0 -2
- package/styles/styled.js +0 -2
- package/styles/types.d.ts +7 -3
- package/tabs-motion/tabs.js +2 -2
- package/tag/constants.d.ts +5 -4
- package/tag/constants.js +7 -6
- package/tag/index.d.ts +1 -1
- package/tag/index.js +7 -7
- package/tag/styled-components.d.ts +1 -1
- package/tag/styled-components.js +137 -124
- package/tag/tag.js +2 -2
- package/tag/types.d.ts +9 -8
- package/tag/types.js +2 -2
- package/themes/dark-theme/color-component-tokens.d.ts +2 -2
- package/themes/dark-theme/color-component-tokens.js +279 -275
- package/themes/dark-theme/color-foundation-tokens.d.ts +3 -0
- package/themes/dark-theme/{color-tokens.js → color-foundation-tokens.js} +11 -14
- package/themes/dark-theme/color-semantic-tokens.d.ts +2 -2
- package/themes/dark-theme/color-semantic-tokens.js +52 -58
- package/themes/dark-theme/create-dark-theme.d.ts +1 -1
- package/themes/dark-theme/create-dark-theme.js +12 -32
- package/themes/dark-theme/dark-theme.js +4 -4
- package/themes/dark-theme/primitives.js +2 -2
- package/themes/light-theme/color-component-tokens.d.ts +2 -2
- package/themes/light-theme/color-component-tokens.js +287 -282
- package/themes/light-theme/color-foundation-tokens.d.ts +3 -0
- package/themes/light-theme/{color-tokens.js → color-foundation-tokens.js} +10 -13
- package/themes/light-theme/color-semantic-tokens.d.ts +2 -2
- package/themes/light-theme/color-semantic-tokens.js +50 -53
- package/themes/light-theme/create-light-theme.d.ts +1 -1
- package/themes/light-theme/create-light-theme.js +12 -32
- package/themes/light-theme/light-theme.js +4 -4
- package/themes/light-theme/primitives.js +2 -2
- package/themes/types.d.ts +74 -13
- package/themes/utils.d.ts +1 -1
- package/themes/utils.js +4 -4
- package/tile/tile-group.js +2 -2
- package/timezonepicker/update-tzdata.js +0 -1
- package/tokens/color-primitive-tokens.d.ts +5 -0
- package/tokens/color-primitive-tokens.js +301 -0
- package/tokens/index.d.ts +5 -4
- package/tokens/index.js +25 -3
- package/tokens/types.d.ts +170 -1
- package/button-docked/button-docked.d.ts +0 -4
- package/button-docked/index.d.ts +0 -3
- package/button-docked/index.js +0 -40
- package/button-docked/styled-components.d.ts +0 -5
- package/button-docked/styled-components.js +0 -55
- package/button-docked/types.d.ts +0 -14
- package/themes/dark-theme/color-tokens.d.ts +0 -3
- package/themes/light-theme/color-tokens.d.ts +0 -3
- package/tokens/colors.d.ts +0 -3
- package/tokens/colors.js +0 -125
- /package/{button-docked → file-uploader-basic}/types.js +0 -0
package/tag/styled-components.js
CHANGED
|
@@ -18,34 +18,30 @@ LICENSE file in the root directory of this source tree.
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
function customOnRamp(color, unit) {
|
|
21
|
+
// This is a temporary fix to prevent the tag from crashing when the color is not defined
|
|
22
|
+
if (!color && !(unit === '0' || unit === '1000')) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
21
25
|
switch (unit) {
|
|
22
26
|
case '0':
|
|
23
27
|
return 'white';
|
|
24
28
|
case '50':
|
|
25
|
-
// @ts-ignore
|
|
26
29
|
return (0, _tint.default)(0.8, color);
|
|
27
30
|
case '100':
|
|
28
|
-
// @ts-ignore
|
|
29
31
|
return (0, _tint.default)(0.6, color);
|
|
30
32
|
case '200':
|
|
31
|
-
// @ts-ignore
|
|
32
33
|
return (0, _tint.default)(0.4, color);
|
|
33
34
|
case '300':
|
|
34
|
-
// @ts-ignore
|
|
35
35
|
return (0, _tint.default)(0.2, color);
|
|
36
36
|
case '400':
|
|
37
37
|
return color;
|
|
38
38
|
case '500':
|
|
39
|
-
// @ts-ignore
|
|
40
39
|
return (0, _shade.default)(0.2, color);
|
|
41
40
|
case '600':
|
|
42
|
-
// @ts-ignore
|
|
43
41
|
return (0, _shade.default)(0.4, color);
|
|
44
42
|
case '700':
|
|
45
|
-
// @ts-ignore
|
|
46
43
|
return (0, _shade.default)(0.6, color);
|
|
47
44
|
case '800':
|
|
48
|
-
// @ts-ignore
|
|
49
45
|
return (0, _shade.default)(0.8, color);
|
|
50
46
|
case '1000':
|
|
51
47
|
return 'black';
|
|
@@ -55,8 +51,8 @@ function customOnRamp(color, unit) {
|
|
|
55
51
|
}
|
|
56
52
|
const COLOR_STATE = {
|
|
57
53
|
disabled: 'disabled',
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
primary: 'primary',
|
|
55
|
+
secondary: 'secondary'
|
|
60
56
|
};
|
|
61
57
|
|
|
62
58
|
// Probably best to bake this into the theme once we hit our next major.
|
|
@@ -67,25 +63,22 @@ const neutralColorStates = {
|
|
|
67
63
|
// @ts-ignore
|
|
68
64
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
69
65
|
color: theme.colors.tagNeutralFontDisabled,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
borderColor: theme.colors.tagNeutralOutlinedDisabled
|
|
66
|
+
backgroundColor: pick(theme, theme.colors.gray50, theme.colors.gray100Dark),
|
|
67
|
+
borderColor: null
|
|
73
68
|
}),
|
|
74
69
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
75
70
|
// @ts-ignore
|
|
76
|
-
[COLOR_STATE.
|
|
71
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
77
72
|
color: theme.colors.tagNeutralSolidFont,
|
|
78
73
|
backgroundColor: theme.colors.tagNeutralSolidBackground,
|
|
79
|
-
// @ts-ignore
|
|
80
74
|
borderColor: null
|
|
81
75
|
}),
|
|
82
76
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
83
77
|
// @ts-ignore
|
|
84
|
-
[COLOR_STATE.
|
|
78
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
85
79
|
color: theme.colors.tagNeutralOutlinedFont,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
borderColor: theme.colors.tagNeutralOutlinedBackground
|
|
80
|
+
backgroundColor: theme.colors.tagNeutralOutlinedBackground,
|
|
81
|
+
borderColor: null
|
|
89
82
|
})
|
|
90
83
|
};
|
|
91
84
|
const primaryColorStates = {
|
|
@@ -93,228 +86,247 @@ const primaryColorStates = {
|
|
|
93
86
|
// @ts-ignore
|
|
94
87
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
95
88
|
color: theme.colors.tagPrimaryFontDisabled,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
borderColor: theme.colors.tagPrimaryOutlinedDisabled
|
|
89
|
+
backgroundColor: pick(theme, theme.colors.gray50, theme.colors.gray100Dark),
|
|
90
|
+
borderColor: null
|
|
99
91
|
}),
|
|
100
92
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
101
93
|
// @ts-ignore
|
|
102
|
-
[COLOR_STATE.
|
|
94
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
103
95
|
color: theme.colors.tagPrimarySolidFont,
|
|
104
96
|
backgroundColor: theme.colors.tagPrimarySolidBackground,
|
|
105
|
-
// @ts-ignore
|
|
106
97
|
borderColor: null
|
|
107
98
|
}),
|
|
108
99
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
100
|
// @ts-ignore
|
|
110
|
-
[COLOR_STATE.
|
|
101
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
111
102
|
color: theme.colors.tagPrimaryOutlinedFont,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
borderColor: theme.colors.tagPrimaryOutlinedBackground
|
|
103
|
+
backgroundColor: theme.colors.tagPrimaryOutlinedBackground,
|
|
104
|
+
borderColor: null
|
|
115
105
|
})
|
|
116
106
|
};
|
|
117
|
-
const
|
|
107
|
+
const blueColorStates = {
|
|
118
108
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
119
109
|
// @ts-ignore
|
|
120
110
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
121
111
|
color: theme.colors.tagAccentFontDisabled,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
borderColor: theme.colors.tagAccentOutlinedDisabled
|
|
112
|
+
backgroundColor: pick(theme, theme.colors.blue50, theme.colors.blue100Dark),
|
|
113
|
+
borderColor: null
|
|
125
114
|
}),
|
|
126
115
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
127
116
|
// @ts-ignore
|
|
128
|
-
[COLOR_STATE.
|
|
117
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
129
118
|
color: theme.colors.tagAccentSolidFont,
|
|
130
119
|
backgroundColor: theme.colors.tagAccentSolidBackground,
|
|
131
|
-
// @ts-ignore
|
|
132
120
|
borderColor: null
|
|
133
121
|
}),
|
|
134
122
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
135
123
|
// @ts-ignore
|
|
136
|
-
[COLOR_STATE.
|
|
124
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
137
125
|
color: theme.colors.tagAccentOutlinedFont,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
borderColor: theme.colors.tagAccentOutlinedBackground
|
|
126
|
+
backgroundColor: theme.colors.tagAccentOutlinedBackground,
|
|
127
|
+
borderColor: null
|
|
141
128
|
})
|
|
142
129
|
};
|
|
143
|
-
const
|
|
130
|
+
const greenColorStates = {
|
|
144
131
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
145
132
|
// @ts-ignore
|
|
146
133
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
147
134
|
color: theme.colors.tagPositiveFontDisabled,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
borderColor: theme.colors.tagPositiveOutlinedDisabled
|
|
135
|
+
backgroundColor: pick(theme, theme.colors.green50, theme.colors.green100Dark),
|
|
136
|
+
borderColor: null
|
|
151
137
|
}),
|
|
152
138
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153
139
|
// @ts-ignore
|
|
154
|
-
[COLOR_STATE.
|
|
140
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
155
141
|
color: theme.colors.tagPositiveSolidFont,
|
|
156
142
|
backgroundColor: theme.colors.tagPositiveSolidBackground,
|
|
157
|
-
// @ts-ignore
|
|
158
143
|
borderColor: null
|
|
159
144
|
}),
|
|
160
145
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
161
146
|
// @ts-ignore
|
|
162
|
-
[COLOR_STATE.
|
|
147
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
163
148
|
color: theme.colors.tagPositiveOutlinedFont,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
borderColor: theme.colors.tagPositiveOutlinedBackground
|
|
149
|
+
backgroundColor: theme.colors.tagPositiveOutlinedBackground,
|
|
150
|
+
borderColor: null
|
|
167
151
|
})
|
|
168
152
|
};
|
|
169
|
-
const
|
|
153
|
+
const yellowColorStates = {
|
|
170
154
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
171
155
|
// @ts-ignore
|
|
172
156
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
173
157
|
color: theme.colors.tagWarningFontDisabled,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
borderColor: theme.colors.tagWarningOutlinedDisabled
|
|
158
|
+
backgroundColor: pick(theme, theme.colors.yellow50, theme.colors.yellow100Dark),
|
|
159
|
+
borderColor: null
|
|
177
160
|
}),
|
|
178
161
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
179
162
|
// @ts-ignore
|
|
180
|
-
[COLOR_STATE.
|
|
163
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
181
164
|
color: theme.colors.tagWarningSolidFont,
|
|
182
165
|
backgroundColor: theme.colors.tagWarningSolidBackground,
|
|
183
|
-
// @ts-ignore
|
|
184
166
|
borderColor: null
|
|
185
167
|
}),
|
|
186
168
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
187
169
|
// @ts-ignore
|
|
188
|
-
[COLOR_STATE.
|
|
170
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
189
171
|
color: theme.colors.tagWarningOutlinedFont,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
borderColor: theme.colors.tagWarningOutlinedBackground
|
|
172
|
+
backgroundColor: theme.colors.tagWarningOutlinedBackground,
|
|
173
|
+
borderColor: null
|
|
193
174
|
})
|
|
194
175
|
};
|
|
195
|
-
const
|
|
176
|
+
const redColorStates = {
|
|
196
177
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
197
178
|
// @ts-ignore
|
|
198
179
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
199
180
|
color: theme.colors.tagNegativeFontDisabled,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
borderColor: theme.colors.tagNegativeOutlinedDisabled
|
|
181
|
+
backgroundColor: pick(theme, theme.colors.red50, theme.colors.red100Dark),
|
|
182
|
+
borderColor: null
|
|
203
183
|
}),
|
|
204
184
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
205
185
|
// @ts-ignore
|
|
206
|
-
[COLOR_STATE.
|
|
186
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
207
187
|
color: theme.colors.tagNegativeSolidFont,
|
|
208
188
|
backgroundColor: theme.colors.tagNegativeSolidBackground,
|
|
209
|
-
// @ts-ignore
|
|
210
189
|
borderColor: null
|
|
211
190
|
}),
|
|
212
191
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
213
192
|
// @ts-ignore
|
|
214
|
-
[COLOR_STATE.
|
|
193
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
215
194
|
color: theme.colors.tagNegativeOutlinedFont,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
195
|
+
backgroundColor: theme.colors.tagNegativeOutlinedBackground,
|
|
196
|
+
borderColor: null
|
|
197
|
+
})
|
|
198
|
+
};
|
|
199
|
+
const limeColorStates = {
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
201
|
+
// @ts-ignore
|
|
202
|
+
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
203
|
+
color: pick(theme, theme.colors.lime300, theme.colors.lime400Dark),
|
|
204
|
+
backgroundColor: pick(theme, theme.colors.lime50, theme.colors.lime100Dark),
|
|
205
|
+
borderColor: null
|
|
206
|
+
}),
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
210
|
+
color: pick(theme, theme.colors.white, theme.colors.lime900Dark),
|
|
211
|
+
backgroundColor: pick(theme, theme.colors.lime600, theme.colors.lime400Dark),
|
|
212
|
+
borderColor: null
|
|
213
|
+
}),
|
|
214
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
215
|
+
// @ts-ignore
|
|
216
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
217
|
+
color: pick(theme, theme.colors.lime700, theme.colors.lime700Dark),
|
|
218
|
+
backgroundColor: pick(theme, theme.colors.lime50, theme.colors.lime100Dark),
|
|
219
|
+
borderColor: null
|
|
220
|
+
})
|
|
221
|
+
};
|
|
222
|
+
const tealColorStates = {
|
|
223
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
226
|
+
color: pick(theme, theme.colors.teal300, theme.colors.teal400Dark),
|
|
227
|
+
backgroundColor: pick(theme, theme.colors.teal50, theme.colors.teal100Dark),
|
|
228
|
+
borderColor: null
|
|
229
|
+
}),
|
|
230
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
231
|
+
// @ts-ignore
|
|
232
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
233
|
+
color: pick(theme, theme.colors.white, theme.colors.teal900Dark),
|
|
234
|
+
backgroundColor: pick(theme, theme.colors.teal600, theme.colors.teal400Dark),
|
|
235
|
+
borderColor: null
|
|
236
|
+
}),
|
|
237
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
238
|
+
// @ts-ignore
|
|
239
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
240
|
+
color: pick(theme, theme.colors.teal700, theme.colors.teal700Dark),
|
|
241
|
+
backgroundColor: pick(theme, theme.colors.teal50, theme.colors.teal100Dark),
|
|
242
|
+
borderColor: null
|
|
219
243
|
})
|
|
220
244
|
};
|
|
221
245
|
const orangeColorStates = {
|
|
222
246
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
223
247
|
// @ts-ignore
|
|
224
248
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
225
|
-
color: pick(theme, theme.colors.
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
borderColor: pick(theme, theme.colors.orange200, theme.colors.orange700)
|
|
249
|
+
color: pick(theme, theme.colors.orange300, theme.colors.orange400Dark),
|
|
250
|
+
backgroundColor: pick(theme, theme.colors.orange50, theme.colors.orange100Dark),
|
|
251
|
+
borderColor: null
|
|
229
252
|
}),
|
|
230
253
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
231
254
|
// @ts-ignore
|
|
232
|
-
[COLOR_STATE.
|
|
233
|
-
color: theme.colors.white,
|
|
234
|
-
backgroundColor: pick(theme, theme.colors.
|
|
235
|
-
// @ts-ignore
|
|
255
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
256
|
+
color: pick(theme, theme.colors.white, theme.colors.orange900Dark),
|
|
257
|
+
backgroundColor: pick(theme, theme.colors.orange600, theme.colors.orange400Dark),
|
|
236
258
|
borderColor: null
|
|
237
259
|
}),
|
|
238
260
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
239
261
|
// @ts-ignore
|
|
240
|
-
[COLOR_STATE.
|
|
241
|
-
color: pick(theme, theme.colors.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
borderColor: pick(theme, theme.colors.orange200, theme.colors.orange500)
|
|
262
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
263
|
+
color: pick(theme, theme.colors.orange700, theme.colors.orange700Dark),
|
|
264
|
+
backgroundColor: pick(theme, theme.colors.orange50, theme.colors.orange100Dark),
|
|
265
|
+
borderColor: null
|
|
245
266
|
})
|
|
246
267
|
};
|
|
247
268
|
const purpleColorStates = {
|
|
248
269
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
249
270
|
// @ts-ignore
|
|
250
271
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
251
|
-
color: pick(theme, theme.colors.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
borderColor: pick(theme, theme.colors.purple200, theme.colors.purple700)
|
|
272
|
+
color: pick(theme, theme.colors.purple300, theme.colors.purple400Dark),
|
|
273
|
+
backgroundColor: pick(theme, theme.colors.purple50, theme.colors.purple100Dark),
|
|
274
|
+
borderColor: null
|
|
255
275
|
}),
|
|
256
276
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
257
277
|
// @ts-ignore
|
|
258
|
-
[COLOR_STATE.
|
|
259
|
-
color: theme.colors.white,
|
|
260
|
-
backgroundColor: pick(theme, theme.colors.
|
|
261
|
-
// @ts-ignore
|
|
278
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
279
|
+
color: pick(theme, theme.colors.white, theme.colors.purple900Dark),
|
|
280
|
+
backgroundColor: pick(theme, theme.colors.purple600, theme.colors.purple400Dark),
|
|
262
281
|
borderColor: null
|
|
263
282
|
}),
|
|
264
283
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
265
284
|
// @ts-ignore
|
|
266
|
-
[COLOR_STATE.
|
|
267
|
-
color: pick(theme, theme.colors.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
borderColor: pick(theme, theme.colors.purple200, theme.colors.purple500)
|
|
285
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
286
|
+
color: pick(theme, theme.colors.purple700, theme.colors.purple700Dark),
|
|
287
|
+
backgroundColor: pick(theme, theme.colors.purple50, theme.colors.purple100Dark),
|
|
288
|
+
borderColor: null
|
|
271
289
|
})
|
|
272
290
|
};
|
|
273
291
|
const brownColorStates = {
|
|
274
292
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
275
293
|
// @ts-ignore
|
|
276
294
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
277
|
-
color: pick(theme, theme.colors.
|
|
278
|
-
// @ts-ignore
|
|
295
|
+
color: pick(theme, theme.colors.amber200, theme.colors.amber400Dark),
|
|
279
296
|
backgroundColor: null,
|
|
280
|
-
borderColor: pick(theme, theme.colors.
|
|
297
|
+
borderColor: pick(theme, theme.colors.amber200, theme.colors.amber400Dark)
|
|
281
298
|
}),
|
|
282
299
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
283
300
|
// @ts-ignore
|
|
284
|
-
[COLOR_STATE.
|
|
285
|
-
color: theme.colors.white,
|
|
286
|
-
backgroundColor: pick(theme, theme.colors.
|
|
287
|
-
// @ts-ignore
|
|
301
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
302
|
+
color: pick(theme, theme.colors.white, theme.colors.gray900Dark),
|
|
303
|
+
backgroundColor: pick(theme, theme.colors.amber600, theme.colors.amber400Dark),
|
|
288
304
|
borderColor: null
|
|
289
305
|
}),
|
|
290
306
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
291
307
|
// @ts-ignore
|
|
292
|
-
[COLOR_STATE.
|
|
293
|
-
color: pick(theme, theme.colors.
|
|
294
|
-
// @ts-ignore
|
|
308
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
309
|
+
color: pick(theme, theme.colors.amber600, theme.colors.amber600Dark),
|
|
295
310
|
backgroundColor: null,
|
|
296
|
-
borderColor: pick(theme, theme.colors.
|
|
311
|
+
borderColor: pick(theme, theme.colors.amber600, theme.colors.amber600Dark)
|
|
297
312
|
})
|
|
298
313
|
};
|
|
299
314
|
const customColorStates = {
|
|
300
315
|
// @ts-ignore
|
|
301
316
|
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
302
317
|
color: customOnRamp(color, theme.colors.tagFontDisabledRampUnit),
|
|
303
|
-
// @ts-ignore
|
|
304
318
|
backgroundColor: null,
|
|
305
319
|
borderColor: customOnRamp(color, theme.colors.tagSolidDisabledRampUnit)
|
|
306
320
|
}),
|
|
307
321
|
// @ts-ignore
|
|
308
|
-
[COLOR_STATE.
|
|
322
|
+
[COLOR_STATE.primary]: (theme, color) => ({
|
|
309
323
|
color: customOnRamp(color, theme.colors.tagSolidFontRampUnit),
|
|
310
324
|
backgroundColor: customOnRamp(color, theme.colors.tagSolidRampUnit),
|
|
311
|
-
// @ts-ignore
|
|
312
325
|
borderColor: null
|
|
313
326
|
}),
|
|
314
327
|
// @ts-ignore
|
|
315
|
-
[COLOR_STATE.
|
|
328
|
+
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
316
329
|
color: customOnRamp(color, theme.colors.tagOutlinedFontRampUnit),
|
|
317
|
-
// @ts-ignore
|
|
318
330
|
backgroundColor: null,
|
|
319
331
|
borderColor: customOnRamp(color, theme.colors.tagOutlinedRampUnit)
|
|
320
332
|
})
|
|
@@ -322,26 +334,28 @@ const customColorStates = {
|
|
|
322
334
|
const colorMap = {
|
|
323
335
|
[_constants.KIND.neutral]: neutralColorStates,
|
|
324
336
|
[_constants.KIND.primary]: primaryColorStates,
|
|
325
|
-
[_constants.KIND.accent]:
|
|
326
|
-
[_constants.KIND.positive]:
|
|
327
|
-
[_constants.KIND.warning]:
|
|
328
|
-
[_constants.KIND.negative]:
|
|
337
|
+
[_constants.KIND.accent]: blueColorStates,
|
|
338
|
+
[_constants.KIND.positive]: greenColorStates,
|
|
339
|
+
[_constants.KIND.warning]: yellowColorStates,
|
|
340
|
+
[_constants.KIND.negative]: redColorStates,
|
|
329
341
|
[_constants.KIND.black]: primaryColorStates,
|
|
330
|
-
[_constants.KIND.blue]:
|
|
331
|
-
[_constants.KIND.green]:
|
|
332
|
-
[_constants.KIND.red]:
|
|
333
|
-
[_constants.KIND.yellow]:
|
|
342
|
+
[_constants.KIND.blue]: blueColorStates,
|
|
343
|
+
[_constants.KIND.green]: greenColorStates,
|
|
344
|
+
[_constants.KIND.red]: redColorStates,
|
|
345
|
+
[_constants.KIND.yellow]: yellowColorStates,
|
|
334
346
|
[_constants.KIND.orange]: orangeColorStates,
|
|
335
347
|
[_constants.KIND.purple]: purpleColorStates,
|
|
336
348
|
[_constants.KIND.brown]: brownColorStates,
|
|
349
|
+
[_constants.KIND.lime]: limeColorStates,
|
|
350
|
+
[_constants.KIND.teal]: tealColorStates,
|
|
337
351
|
[_constants.KIND.custom]: customColorStates
|
|
338
352
|
};
|
|
339
353
|
|
|
340
354
|
// @ts-ignore
|
|
341
355
|
const getColorStateFromProps = props => {
|
|
342
356
|
if (props.$disabled) return COLOR_STATE.disabled;
|
|
343
|
-
if (props.$
|
|
344
|
-
return COLOR_STATE.
|
|
357
|
+
if (props.$hierarchy === _constants.HIERARCHY.primary) return COLOR_STATE.primary;
|
|
358
|
+
return COLOR_STATE.secondary;
|
|
345
359
|
};
|
|
346
360
|
const Action = exports.Action = (0, _styles.styled)('span', props => {
|
|
347
361
|
const {
|
|
@@ -410,7 +424,7 @@ const Root = exports.Root = (0, _styles.styled)('span', props => {
|
|
|
410
424
|
$theme,
|
|
411
425
|
$kind = _constants.KIND.primary,
|
|
412
426
|
$clickable,
|
|
413
|
-
$
|
|
427
|
+
$hierarchy,
|
|
414
428
|
$disabled,
|
|
415
429
|
$closeable,
|
|
416
430
|
$isFocusVisible,
|
|
@@ -418,14 +432,13 @@ const Root = exports.Root = (0, _styles.styled)('span', props => {
|
|
|
418
432
|
$size = _constants.SIZE.small,
|
|
419
433
|
$contentMaxWidth
|
|
420
434
|
} = props;
|
|
421
|
-
const borderRadius = $theme.borders.
|
|
435
|
+
const borderRadius = $size === _constants.SIZE.small ? $theme.borders.radius200 : $theme.borders.radius300;
|
|
422
436
|
const paddingMagnitude = {
|
|
423
437
|
[_constants.SIZE.small]: $theme.sizing.scale300,
|
|
424
438
|
[_constants.SIZE.medium]: $theme.sizing.scale500,
|
|
425
439
|
[_constants.SIZE.large]: $theme.sizing.scale600
|
|
426
440
|
}[$size];
|
|
427
|
-
const borderWidth = !$disabled && $
|
|
428
|
-
// @ts-ignore
|
|
441
|
+
const borderWidth = !$disabled && $hierarchy === _constants.HIERARCHY.primary || $kind !== _constants.KIND.custom ? 0 : '2px';
|
|
429
442
|
const {
|
|
430
443
|
color,
|
|
431
444
|
backgroundColor,
|
package/tag/tag.js
CHANGED
|
@@ -46,7 +46,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
46
46
|
overrides = {},
|
|
47
47
|
startEnhancer,
|
|
48
48
|
title,
|
|
49
|
-
|
|
49
|
+
hierarchy = _constants.HIERARCHY.secondary
|
|
50
50
|
} = props;
|
|
51
51
|
const [focusVisible, setFocusVisible] = React.useState(false);
|
|
52
52
|
function handleFocus(event) {
|
|
@@ -103,7 +103,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
103
103
|
$isFocused: isFocused,
|
|
104
104
|
$isHovered: isHovered,
|
|
105
105
|
$kind: kind,
|
|
106
|
-
$
|
|
106
|
+
$hierarchy: hierarchy,
|
|
107
107
|
$isFocusVisible: focusVisible,
|
|
108
108
|
$size: size
|
|
109
109
|
};
|
package/tag/types.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ export declare const TagKind: Readonly<{
|
|
|
16
16
|
readonly orange: "orange";
|
|
17
17
|
readonly purple: "purple";
|
|
18
18
|
readonly brown: "brown";
|
|
19
|
+
readonly teal: "teal";
|
|
20
|
+
readonly lime: "lime";
|
|
19
21
|
}>;
|
|
20
|
-
export declare const
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly outlined: "outlined";
|
|
22
|
+
export declare const TagHierarchy: Readonly<Readonly<{
|
|
23
|
+
readonly primary: "primary";
|
|
24
|
+
readonly secondary: "secondary";
|
|
24
25
|
}>>;
|
|
25
26
|
export declare const TagSize: Readonly<{
|
|
26
27
|
readonly small: "small";
|
|
@@ -28,7 +29,7 @@ export declare const TagSize: Readonly<{
|
|
|
28
29
|
readonly large: "large";
|
|
29
30
|
}>;
|
|
30
31
|
export type TagKind = keyof typeof TagKind;
|
|
31
|
-
export type
|
|
32
|
+
export type TagHierarchy = (typeof TagHierarchy)[keyof typeof TagHierarchy];
|
|
32
33
|
export type TagSize = keyof typeof TagSize;
|
|
33
34
|
export type TagOverrides = {
|
|
34
35
|
Root?: Override;
|
|
@@ -49,8 +50,8 @@ export type TagProps = {
|
|
|
49
50
|
isHovered?: boolean;
|
|
50
51
|
/** Defines tags look by purpose. Set it to one of KIND[key] values. Defaults to KIND.primary */
|
|
51
52
|
kind?: TagKind;
|
|
52
|
-
/** Defines tags look. Set it to one of
|
|
53
|
-
|
|
53
|
+
/** Defines tags look. Set it to one of HIERARCHY[key] values. Defaults to HIERARCHY.secondary */
|
|
54
|
+
hierarchy?: TagHierarchy;
|
|
54
55
|
/** Component or String value for label of tag. Default is empty string. */
|
|
55
56
|
children?: React.ReactNode;
|
|
56
57
|
/** The color theme to be applied to a Tag. Default is `KIND.primary`. */
|
|
@@ -79,7 +80,7 @@ export type SharedPropsArg = {
|
|
|
79
80
|
$isFocused?: boolean;
|
|
80
81
|
$isHovered?: boolean;
|
|
81
82
|
$kind?: string;
|
|
82
|
-
$
|
|
83
|
+
$hierarchy?: string;
|
|
83
84
|
$isFocusVisible?: boolean;
|
|
84
85
|
$size?: string;
|
|
85
86
|
$contentMaxWidth?: string | null;
|
package/tag/types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.TagSize = exports.TagKind = exports.TagHierarchy = void 0;
|
|
7
7
|
var _constants = require("./constants");
|
|
8
8
|
/*
|
|
9
9
|
Copyright (c) Uber Technologies, Inc.
|
|
@@ -13,5 +13,5 @@ LICENSE file in the root directory of this source tree.
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const TagKind = exports.TagKind = Object.freeze(_constants.KIND);
|
|
16
|
-
const
|
|
16
|
+
const TagHierarchy = exports.TagHierarchy = Object.freeze(_constants.HIERARCHY);
|
|
17
17
|
const TagSize = exports.TagSize = Object.freeze(_constants.SIZE);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const _default: (
|
|
1
|
+
import type { SemanticColors, ComponentColors } from '../types';
|
|
2
|
+
declare const _default: (semanticColors?: SemanticColors) => ComponentColors;
|
|
3
3
|
export default _default;
|