baseui 15.0.1 → 16.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/button/button-internals.d.ts +2 -2
- package/button/button-internals.js +56 -7
- package/button/button.d.ts +2 -2
- package/button/button.js +80 -8
- package/button/constants.d.ts +22 -0
- package/button/constants.js +31 -3
- package/button/default-props.d.ts +5 -3
- package/button/default-props.js +5 -3
- package/button/index.d.ts +1 -1
- package/button/index.js +21 -0
- package/button/styled-components.d.ts +7 -0
- package/button/styled-components.js +476 -66
- package/button/types.d.ts +39 -3
- package/button/utils.d.ts +2 -2
- package/button/utils.js +9 -3
- package/button-group/button-group.d.ts +1 -0
- package/button-group/button-group.js +22 -33
- package/button-group/constants.d.ts +5 -0
- package/button-group/constants.js +6 -1
- package/button-group/index.d.ts +10 -1
- package/button-group/index.js +33 -4
- package/button-group/styled-components.d.ts +5 -2
- package/button-group/styled-components.js +47 -6
- package/button-group/types.d.ts +9 -2
- package/checkbox/styled-components.js +2 -6
- package/modal/modal-button.d.ts +8 -1
- package/package.json +1 -1
- package/tag/constants.d.ts +31 -5
- package/tag/constants.js +18 -11
- package/tag/deprecated-styles.d.ts +119 -0
- package/tag/deprecated-styles.js +179 -0
- package/tag/index.d.ts +1 -1
- package/tag/index.js +15 -1
- package/tag/styled-components.js +199 -230
- package/tag/tag.js +10 -4
- package/tag/types.d.ts +16 -11
- package/tag-group/index.d.ts +5 -0
- package/tag-group/index.js +51 -0
- package/tag-group/styled-components.d.ts +3 -0
- package/tag-group/styled-components.js +46 -0
- package/tag-group/tag-group.d.ts +4 -0
- package/tag-group/tag-group.js +65 -0
- package/tag-group/types.d.ts +18 -0
- package/tag-group/types.js +1 -0
- package/themes/dark-theme/color-component-tokens.js +56 -3
- package/themes/dark-theme/color-semantic-tokens.js +104 -0
- package/themes/light-theme/color-component-tokens.js +55 -2
- package/themes/light-theme/color-semantic-tokens.js +104 -0
- package/themes/shared/animation.js +30 -5
- package/themes/types.d.ts +76 -1
package/tag/styled-components.js
CHANGED
|
@@ -9,6 +9,9 @@ var _tint = _interopRequireDefault(require("polished/lib/color/tint.js"));
|
|
|
9
9
|
var _shade = _interopRequireDefault(require("polished/lib/color/shade.js"));
|
|
10
10
|
var _styles = require("../styles");
|
|
11
11
|
var _constants = require("./constants");
|
|
12
|
+
var DeprecatedStyles = _interopRequireWildcard(require("./deprecated-styles"));
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
16
|
/*
|
|
14
17
|
Copyright (c) Uber Technologies, Inc.
|
|
@@ -58,257 +61,174 @@ const COLOR_STATE = {
|
|
|
58
61
|
// Probably best to bake this into the theme once we hit our next major.
|
|
59
62
|
// @ts-ignore
|
|
60
63
|
const pick = (theme, light, dark) => theme.name && theme.name.includes('dark') ? dark : light;
|
|
61
|
-
const neutralColorStates = {
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
65
|
-
color: theme.colors.tagNeutralFontDisabled,
|
|
66
|
-
backgroundColor: pick(theme, theme.colors.gray50, theme.colors.gray100Dark),
|
|
67
|
-
borderColor: null
|
|
68
|
-
}),
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
[COLOR_STATE.primary]: (theme, color) => ({
|
|
72
|
-
color: theme.colors.tagNeutralSolidFont,
|
|
73
|
-
backgroundColor: theme.colors.tagNeutralSolidBackground,
|
|
74
|
-
borderColor: null
|
|
75
|
-
}),
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
79
|
-
color: theme.colors.tagNeutralOutlinedFont,
|
|
80
|
-
backgroundColor: theme.colors.tagNeutralOutlinedBackground,
|
|
81
|
-
borderColor: null
|
|
82
|
-
})
|
|
83
|
-
};
|
|
84
|
-
const primaryColorStates = {
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
86
|
-
// @ts-ignore
|
|
87
|
-
[COLOR_STATE.disabled]: (theme, color) => ({
|
|
88
|
-
color: theme.colors.tagPrimaryFontDisabled,
|
|
89
|
-
backgroundColor: pick(theme, theme.colors.gray50, theme.colors.gray100Dark),
|
|
90
|
-
borderColor: null
|
|
91
|
-
}),
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
93
|
-
// @ts-ignore
|
|
94
|
-
[COLOR_STATE.primary]: (theme, color) => ({
|
|
95
|
-
color: theme.colors.tagPrimarySolidFont,
|
|
96
|
-
backgroundColor: theme.colors.tagPrimarySolidBackground,
|
|
97
|
-
borderColor: null
|
|
98
|
-
}),
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
[COLOR_STATE.secondary]: (theme, color) => ({
|
|
102
|
-
color: theme.colors.tagPrimaryOutlinedFont,
|
|
103
|
-
backgroundColor: theme.colors.tagPrimaryOutlinedBackground,
|
|
104
|
-
borderColor: null
|
|
105
|
-
})
|
|
106
|
-
};
|
|
107
64
|
const blueColorStates = {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
color: theme.colors.tagAccentFontDisabled,
|
|
112
|
-
backgroundColor: pick(theme, theme.colors.blue50, theme.colors.blue100Dark),
|
|
65
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
66
|
+
color: theme.colors.tagBlueContentStateDisabled,
|
|
67
|
+
backgroundColor: theme.colors.tagBlueBackgroundStateDisabled,
|
|
113
68
|
borderColor: null
|
|
114
69
|
}),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
backgroundColor: theme.colors.tagAccentSolidBackground,
|
|
120
|
-
borderColor: null
|
|
70
|
+
[COLOR_STATE.primary]: theme => ({
|
|
71
|
+
color: theme.colors.tagBlueContentPrimary,
|
|
72
|
+
backgroundColor: theme.colors.tagBlueBackgroundPrimary,
|
|
73
|
+
borderColor: theme.colors.tagBlueBorderPrimaryUnselected
|
|
121
74
|
}),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
backgroundColor: theme.colors.tagAccentOutlinedBackground,
|
|
127
|
-
borderColor: null
|
|
75
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
76
|
+
color: theme.colors.tagBlueContentSecondary,
|
|
77
|
+
backgroundColor: theme.colors.tagBlueBackgroundSecondary,
|
|
78
|
+
borderColor: theme.colors.tagBlueBorderSecondaryUnselected
|
|
128
79
|
})
|
|
129
80
|
};
|
|
130
81
|
const greenColorStates = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
color: theme.colors.tagPositiveFontDisabled,
|
|
135
|
-
backgroundColor: pick(theme, theme.colors.green50, theme.colors.green100Dark),
|
|
82
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
83
|
+
color: theme.colors.tagGreenContentStateDisabled,
|
|
84
|
+
backgroundColor: theme.colors.tagGreenBackgroundStateDisabled,
|
|
136
85
|
borderColor: null
|
|
137
86
|
}),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
backgroundColor: theme.colors.tagPositiveSolidBackground,
|
|
143
|
-
borderColor: null
|
|
87
|
+
[COLOR_STATE.primary]: theme => ({
|
|
88
|
+
color: theme.colors.tagGreenContentPrimary,
|
|
89
|
+
backgroundColor: theme.colors.tagGreenBackgroundPrimary,
|
|
90
|
+
borderColor: theme.colors.tagGreenBorderPrimaryUnselected
|
|
144
91
|
}),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
backgroundColor: theme.colors.tagPositiveOutlinedBackground,
|
|
150
|
-
borderColor: null
|
|
92
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
93
|
+
color: theme.colors.tagGreenContentSecondary,
|
|
94
|
+
backgroundColor: theme.colors.tagGreenBackgroundSecondary,
|
|
95
|
+
borderColor: theme.colors.tagGreenBorderSecondaryUnselected
|
|
151
96
|
})
|
|
152
97
|
};
|
|
153
98
|
const yellowColorStates = {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
color: theme.colors.tagWarningFontDisabled,
|
|
158
|
-
backgroundColor: pick(theme, theme.colors.yellow50, theme.colors.yellow100Dark),
|
|
99
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
100
|
+
color: theme.colors.tagYellowContentStateDisabled,
|
|
101
|
+
backgroundColor: theme.colors.tagYellowBackgroundStateDisabled,
|
|
159
102
|
borderColor: null
|
|
160
103
|
}),
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
backgroundColor: theme.colors.tagWarningSolidBackground,
|
|
166
|
-
borderColor: null
|
|
104
|
+
[COLOR_STATE.primary]: theme => ({
|
|
105
|
+
color: theme.colors.tagYellowContentPrimary,
|
|
106
|
+
backgroundColor: theme.colors.tagYellowBackgroundPrimary,
|
|
107
|
+
borderColor: theme.colors.tagYellowBorderPrimaryUnselected
|
|
167
108
|
}),
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
backgroundColor: theme.colors.tagWarningOutlinedBackground,
|
|
173
|
-
borderColor: null
|
|
109
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
110
|
+
color: theme.colors.tagYellowContentSecondary,
|
|
111
|
+
backgroundColor: theme.colors.tagYellowBackgroundSecondary,
|
|
112
|
+
borderColor: theme.colors.tagYellowBorderSecondaryUnselected
|
|
174
113
|
})
|
|
175
114
|
};
|
|
176
115
|
const redColorStates = {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
color: theme.colors.tagNegativeFontDisabled,
|
|
181
|
-
backgroundColor: pick(theme, theme.colors.red50, theme.colors.red100Dark),
|
|
116
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
117
|
+
color: theme.colors.tagRedContentStateDisabled,
|
|
118
|
+
backgroundColor: theme.colors.tagRedBackgroundStateDisabled,
|
|
182
119
|
borderColor: null
|
|
183
120
|
}),
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
backgroundColor: theme.colors.tagNegativeSolidBackground,
|
|
189
|
-
borderColor: null
|
|
121
|
+
[COLOR_STATE.primary]: theme => ({
|
|
122
|
+
color: theme.colors.tagRedContentPrimary,
|
|
123
|
+
backgroundColor: theme.colors.tagRedBackgroundPrimary,
|
|
124
|
+
borderColor: theme.colors.tagRedBorderPrimaryUnselected
|
|
190
125
|
}),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
backgroundColor: theme.colors.tagNegativeOutlinedBackground,
|
|
196
|
-
borderColor: null
|
|
126
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
127
|
+
color: theme.colors.tagRedContentSecondary,
|
|
128
|
+
backgroundColor: theme.colors.tagRedBackgroundSecondary,
|
|
129
|
+
borderColor: theme.colors.tagRedBorderSecondaryUnselected
|
|
197
130
|
})
|
|
198
131
|
};
|
|
199
132
|
const limeColorStates = {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
color: pick(theme, theme.colors.lime300, theme.colors.lime400Dark),
|
|
204
|
-
backgroundColor: pick(theme, theme.colors.lime50, theme.colors.lime100Dark),
|
|
133
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
134
|
+
color: theme.colors.tagLimeContentStateDisabled,
|
|
135
|
+
backgroundColor: theme.colors.tagLimeBackgroundStateDisabled,
|
|
205
136
|
borderColor: null
|
|
206
137
|
}),
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
backgroundColor: pick(theme, theme.colors.lime600, theme.colors.lime400Dark),
|
|
212
|
-
borderColor: null
|
|
138
|
+
[COLOR_STATE.primary]: theme => ({
|
|
139
|
+
color: theme.colors.tagLimeContentPrimary,
|
|
140
|
+
backgroundColor: theme.colors.tagLimeBackgroundPrimary,
|
|
141
|
+
borderColor: theme.colors.tagLimeBorderPrimaryUnselected
|
|
213
142
|
}),
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
backgroundColor: pick(theme, theme.colors.lime50, theme.colors.lime100Dark),
|
|
219
|
-
borderColor: null
|
|
143
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
144
|
+
color: theme.colors.tagLimeContentSecondary,
|
|
145
|
+
backgroundColor: theme.colors.tagLimeBackgroundSecondary,
|
|
146
|
+
borderColor: theme.colors.tagLimeBorderSecondaryUnselected
|
|
220
147
|
})
|
|
221
148
|
};
|
|
222
149
|
const tealColorStates = {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
color: pick(theme, theme.colors.teal300, theme.colors.teal400Dark),
|
|
227
|
-
backgroundColor: pick(theme, theme.colors.teal50, theme.colors.teal100Dark),
|
|
150
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
151
|
+
color: theme.colors.tagTealContentStateDisabled,
|
|
152
|
+
backgroundColor: theme.colors.tagTealBackgroundStateDisabled,
|
|
228
153
|
borderColor: null
|
|
229
154
|
}),
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
backgroundColor: pick(theme, theme.colors.teal600, theme.colors.teal400Dark),
|
|
235
|
-
borderColor: null
|
|
155
|
+
[COLOR_STATE.primary]: theme => ({
|
|
156
|
+
color: theme.colors.tagTealContentPrimary,
|
|
157
|
+
backgroundColor: theme.colors.tagTealBackgroundPrimary,
|
|
158
|
+
borderColor: theme.colors.tagTealBorderPrimaryUnselected
|
|
236
159
|
}),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
backgroundColor: pick(theme, theme.colors.teal50, theme.colors.teal100Dark),
|
|
242
|
-
borderColor: null
|
|
160
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
161
|
+
color: theme.colors.tagTealContentSecondary,
|
|
162
|
+
backgroundColor: theme.colors.tagTealBackgroundSecondary,
|
|
163
|
+
borderColor: theme.colors.tagTealBorderSecondaryUnselected
|
|
243
164
|
})
|
|
244
165
|
};
|
|
245
166
|
const orangeColorStates = {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
color: pick(theme, theme.colors.orange300, theme.colors.orange400Dark),
|
|
250
|
-
backgroundColor: pick(theme, theme.colors.orange50, theme.colors.orange100Dark),
|
|
167
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
168
|
+
color: theme.colors.tagOrangeContentStateDisabled,
|
|
169
|
+
backgroundColor: theme.colors.tagOrangeBackgroundStateDisabled,
|
|
251
170
|
borderColor: null
|
|
252
171
|
}),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
backgroundColor: pick(theme, theme.colors.orange600, theme.colors.orange400Dark),
|
|
258
|
-
borderColor: null
|
|
172
|
+
[COLOR_STATE.primary]: theme => ({
|
|
173
|
+
color: theme.colors.tagOrangeContentPrimary,
|
|
174
|
+
backgroundColor: theme.colors.tagOrangeBackgroundPrimary,
|
|
175
|
+
borderColor: theme.colors.tagOrangeBorderPrimaryUnselected
|
|
259
176
|
}),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
backgroundColor: pick(theme, theme.colors.orange50, theme.colors.orange100Dark),
|
|
265
|
-
borderColor: null
|
|
177
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
178
|
+
color: theme.colors.tagOrangeContentSecondary,
|
|
179
|
+
backgroundColor: theme.colors.tagOrangeBackgroundSecondary,
|
|
180
|
+
borderColor: theme.colors.tagOrangeBorderSecondaryUnselected
|
|
266
181
|
})
|
|
267
182
|
};
|
|
268
183
|
const purpleColorStates = {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
color: pick(theme, theme.colors.purple300, theme.colors.purple400Dark),
|
|
273
|
-
backgroundColor: pick(theme, theme.colors.purple50, theme.colors.purple100Dark),
|
|
184
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
185
|
+
color: theme.colors.tagPurpleContentStateDisabled,
|
|
186
|
+
backgroundColor: theme.colors.tagPurpleBackgroundStateDisabled,
|
|
274
187
|
borderColor: null
|
|
275
188
|
}),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
backgroundColor: pick(theme, theme.colors.purple600, theme.colors.purple400Dark),
|
|
281
|
-
borderColor: null
|
|
189
|
+
[COLOR_STATE.primary]: theme => ({
|
|
190
|
+
color: theme.colors.tagPurpleContentPrimary,
|
|
191
|
+
backgroundColor: theme.colors.tagPurpleBackgroundPrimary,
|
|
192
|
+
borderColor: theme.colors.tagPurpleBorderPrimaryUnselected
|
|
282
193
|
}),
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
backgroundColor: pick(theme, theme.colors.purple50, theme.colors.purple100Dark),
|
|
288
|
-
borderColor: null
|
|
194
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
195
|
+
color: theme.colors.tagPurpleContentSecondary,
|
|
196
|
+
backgroundColor: theme.colors.tagPurpleBackgroundSecondary,
|
|
197
|
+
borderColor: theme.colors.tagPurpleBorderSecondaryUnselected
|
|
289
198
|
})
|
|
290
199
|
};
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
backgroundColor: null,
|
|
297
|
-
borderColor: pick(theme, theme.colors.amber200, theme.colors.amber400Dark)
|
|
200
|
+
const magentaColorStates = {
|
|
201
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
202
|
+
color: theme.colors.tagMagentaContentStateDisabled,
|
|
203
|
+
backgroundColor: theme.colors.tagMagentaBackgroundStateDisabled,
|
|
204
|
+
borderColor: null
|
|
298
205
|
}),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
206
|
+
[COLOR_STATE.primary]: theme => ({
|
|
207
|
+
color: theme.colors.tagMagentaContentPrimary,
|
|
208
|
+
backgroundColor: theme.colors.tagMagentaBackgroundPrimary,
|
|
209
|
+
borderColor: theme.colors.tagMagentaBorderPrimaryUnselected
|
|
210
|
+
}),
|
|
211
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
212
|
+
color: theme.colors.tagMagentaContentSecondary,
|
|
213
|
+
backgroundColor: theme.colors.tagMagentaBackgroundSecondary,
|
|
214
|
+
borderColor: theme.colors.tagMagentaBorderSecondaryUnselected
|
|
215
|
+
})
|
|
216
|
+
};
|
|
217
|
+
const grayColorStates = {
|
|
218
|
+
[COLOR_STATE.disabled]: theme => ({
|
|
219
|
+
color: theme.colors.tagGrayContentStateDisabled,
|
|
220
|
+
backgroundColor: theme.colors.tagGrayBackgroundStateDisabled,
|
|
304
221
|
borderColor: null
|
|
305
222
|
}),
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
223
|
+
[COLOR_STATE.primary]: theme => ({
|
|
224
|
+
color: theme.colors.tagGrayContentPrimary,
|
|
225
|
+
backgroundColor: theme.colors.tagGrayBackgroundPrimary,
|
|
226
|
+
borderColor: theme.colors.tagGrayBorderPrimaryUnselected
|
|
227
|
+
}),
|
|
228
|
+
[COLOR_STATE.secondary]: theme => ({
|
|
229
|
+
color: theme.colors.tagGrayContentSecondary,
|
|
230
|
+
backgroundColor: theme.colors.tagGrayBackgroundSecondary,
|
|
231
|
+
borderColor: theme.colors.tagGrayBorderSecondaryUnselected
|
|
312
232
|
})
|
|
313
233
|
};
|
|
314
234
|
const customColorStates = {
|
|
@@ -332,22 +252,24 @@ const customColorStates = {
|
|
|
332
252
|
})
|
|
333
253
|
};
|
|
334
254
|
const colorMap = {
|
|
335
|
-
[_constants.KIND.neutral]:
|
|
336
|
-
[_constants.KIND.primary]:
|
|
337
|
-
[_constants.KIND.accent]:
|
|
338
|
-
[_constants.KIND.positive]:
|
|
339
|
-
[_constants.KIND.warning]:
|
|
340
|
-
[_constants.KIND.negative]:
|
|
341
|
-
[_constants.KIND.black]:
|
|
255
|
+
[_constants.KIND.neutral]: DeprecatedStyles.deprecatedNeutralColorStates,
|
|
256
|
+
[_constants.KIND.primary]: DeprecatedStyles.deprecatedPrimaryColorStates,
|
|
257
|
+
[_constants.KIND.accent]: DeprecatedStyles.deprecatedBlueColorStates,
|
|
258
|
+
[_constants.KIND.positive]: DeprecatedStyles.deprecatedGreenColorStates,
|
|
259
|
+
[_constants.KIND.warning]: DeprecatedStyles.deprecatedYellowColorStates,
|
|
260
|
+
[_constants.KIND.negative]: DeprecatedStyles.deprecatedRedColorStates,
|
|
261
|
+
[_constants.KIND.black]: DeprecatedStyles.deprecatedPrimaryColorStates,
|
|
342
262
|
[_constants.KIND.blue]: blueColorStates,
|
|
343
263
|
[_constants.KIND.green]: greenColorStates,
|
|
344
264
|
[_constants.KIND.red]: redColorStates,
|
|
345
265
|
[_constants.KIND.yellow]: yellowColorStates,
|
|
346
266
|
[_constants.KIND.orange]: orangeColorStates,
|
|
347
267
|
[_constants.KIND.purple]: purpleColorStates,
|
|
348
|
-
[_constants.KIND.brown]:
|
|
268
|
+
[_constants.KIND.brown]: DeprecatedStyles.deprecatedBrownColorStates,
|
|
349
269
|
[_constants.KIND.lime]: limeColorStates,
|
|
350
270
|
[_constants.KIND.teal]: tealColorStates,
|
|
271
|
+
[_constants.KIND.magenta]: magentaColorStates,
|
|
272
|
+
[_constants.KIND.gray]: grayColorStates,
|
|
351
273
|
[_constants.KIND.custom]: customColorStates
|
|
352
274
|
};
|
|
353
275
|
|
|
@@ -373,9 +295,10 @@ const Action = exports.Action = (0, _styles.styled)('span', props => {
|
|
|
373
295
|
cursor: $disabled ? 'not-allowed' : 'pointer',
|
|
374
296
|
display: 'flex',
|
|
375
297
|
[marginDir]: {
|
|
376
|
-
[_constants.SIZE.
|
|
377
|
-
[_constants.SIZE.
|
|
378
|
-
[_constants.SIZE.
|
|
298
|
+
[_constants.SIZE.xSmall]: $theme.sizing.scale100,
|
|
299
|
+
[_constants.SIZE.small]: $theme.sizing.scale300,
|
|
300
|
+
[_constants.SIZE.medium]: $theme.sizing.scale300,
|
|
301
|
+
[_constants.SIZE.large]: $theme.sizing.scale500
|
|
379
302
|
}[$size],
|
|
380
303
|
outline: 'none',
|
|
381
304
|
transitionProperty: 'all',
|
|
@@ -389,12 +312,12 @@ const StartEnhancerContainer = exports.StartEnhancerContainer = (0, _styles.styl
|
|
|
389
312
|
$theme,
|
|
390
313
|
$size = _constants.SIZE.small
|
|
391
314
|
}) => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
315
|
+
const paddingMagnitude = {
|
|
316
|
+
[_constants.SIZE.xSmall]: $theme.sizing.scale100,
|
|
317
|
+
[_constants.SIZE.small]: $theme.sizing.scale300,
|
|
318
|
+
[_constants.SIZE.medium]: $theme.sizing.scale300,
|
|
319
|
+
[_constants.SIZE.large]: $theme.sizing.scale500
|
|
320
|
+
}[$size];
|
|
398
321
|
const paddingDir = $theme.direction === 'rtl' ? 'paddingLeft' : 'paddingRight';
|
|
399
322
|
return {
|
|
400
323
|
alignItems: 'center',
|
|
@@ -429,23 +352,40 @@ const Root = exports.Root = (0, _styles.styled)('span', props => {
|
|
|
429
352
|
$closeable,
|
|
430
353
|
$isFocusVisible,
|
|
431
354
|
$color,
|
|
432
|
-
$size = _constants.SIZE.small
|
|
433
|
-
$contentMaxWidth
|
|
355
|
+
$size = _constants.SIZE.small
|
|
434
356
|
} = props;
|
|
435
|
-
const borderRadius = $size === _constants.SIZE.small ? $theme.borders.radius200 : $theme.borders.radius300;
|
|
357
|
+
const borderRadius = $size === _constants.SIZE.small || $size === _constants.SIZE.xSmall ? $theme.borders.radius200 : $theme.borders.radius300;
|
|
436
358
|
const paddingMagnitude = {
|
|
437
|
-
[_constants.SIZE.
|
|
438
|
-
[_constants.SIZE.
|
|
439
|
-
[_constants.SIZE.
|
|
359
|
+
[_constants.SIZE.xSmall]: $theme.sizing.scale100,
|
|
360
|
+
[_constants.SIZE.small]: $theme.sizing.scale200,
|
|
361
|
+
[_constants.SIZE.medium]: $theme.sizing.scale300,
|
|
362
|
+
[_constants.SIZE.large]: $theme.sizing.scale400
|
|
363
|
+
}[$size];
|
|
364
|
+
const paddingLongitude = {
|
|
365
|
+
[_constants.SIZE.xSmall]: $theme.sizing.scale0,
|
|
366
|
+
[_constants.SIZE.small]: $theme.sizing.scale100,
|
|
367
|
+
[_constants.SIZE.medium]: $theme.sizing.scale100,
|
|
368
|
+
[_constants.SIZE.large]: $theme.sizing.scale300
|
|
369
|
+
}[$size];
|
|
370
|
+
const isActionable = !$disabled && ($clickable || $closeable);
|
|
371
|
+
const borderWidthValue = {
|
|
372
|
+
[_constants.SIZE.xSmall]: '1px',
|
|
373
|
+
[_constants.SIZE.small]: '1px',
|
|
374
|
+
[_constants.SIZE.medium]: '1px',
|
|
375
|
+
[_constants.SIZE.large]: '2px'
|
|
440
376
|
}[$size];
|
|
441
|
-
const borderWidth = !$disabled && $hierarchy === _constants.HIERARCHY.primary || $kind !== _constants.KIND.custom ? 0 : '2px';
|
|
442
377
|
const {
|
|
443
378
|
color,
|
|
444
379
|
backgroundColor,
|
|
445
380
|
borderColor
|
|
446
381
|
} = colorMap[$kind][getColorStateFromProps(props)]($theme, $color);
|
|
382
|
+
// previously, only secondary and disabled custom tags had borders
|
|
383
|
+
// now, it extends to actionable tags as well
|
|
384
|
+
const showBorder = $kind === _constants.KIND.custom && ($hierarchy === _constants.HIERARCHY.secondary || $disabled) || $kind !== _constants.KIND.custom && isActionable && !!borderColor;
|
|
385
|
+
const borderWidth = showBorder ? borderWidthValue : 0;
|
|
447
386
|
return {
|
|
448
387
|
...{
|
|
388
|
+
[_constants.SIZE.xSmall]: $theme.typography.LabelXSmall,
|
|
449
389
|
[_constants.SIZE.small]: $theme.typography.LabelSmall,
|
|
450
390
|
[_constants.SIZE.medium]: $theme.typography.LabelMedium,
|
|
451
391
|
[_constants.SIZE.large]: $theme.typography.LabelLarge
|
|
@@ -473,24 +413,53 @@ const Root = exports.Root = (0, _styles.styled)('span', props => {
|
|
|
473
413
|
cursor: $disabled ? 'not-allowed' : $clickable ? 'pointer' : 'default',
|
|
474
414
|
display: 'inline-flex',
|
|
475
415
|
height: {
|
|
416
|
+
[_constants.SIZE.xSmall]: '20px',
|
|
476
417
|
[_constants.SIZE.small]: '24px',
|
|
477
418
|
[_constants.SIZE.medium]: '32px',
|
|
478
419
|
[_constants.SIZE.large]: '40px'
|
|
479
420
|
}[$size],
|
|
480
421
|
justifyContent: 'space-between',
|
|
481
|
-
maxWith: $contentMaxWidth === null ? '100%' : 'auto',
|
|
482
422
|
marginTop: '5px',
|
|
483
423
|
marginBottom: '5px',
|
|
484
424
|
marginLeft: '5px',
|
|
485
425
|
marginRight: '5px',
|
|
486
|
-
paddingTop:
|
|
487
|
-
paddingBottom:
|
|
426
|
+
paddingTop: paddingLongitude,
|
|
427
|
+
paddingBottom: paddingLongitude,
|
|
488
428
|
paddingLeft: paddingMagnitude,
|
|
489
429
|
paddingRight: paddingMagnitude,
|
|
490
430
|
outline: 'none',
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
431
|
+
...(isActionable ? {
|
|
432
|
+
// adding overlay component to cover both border and content area for hovered and pressed state
|
|
433
|
+
position: 'relative',
|
|
434
|
+
'::before': {
|
|
435
|
+
content: "''",
|
|
436
|
+
position: 'absolute',
|
|
437
|
+
top: 0,
|
|
438
|
+
left: 0,
|
|
439
|
+
right: 0,
|
|
440
|
+
bottom: 0,
|
|
441
|
+
borderTopLeftRadius: 'inherit',
|
|
442
|
+
borderTopRightRadius: 'inherit',
|
|
443
|
+
borderBottomRightRadius: 'inherit',
|
|
444
|
+
borderBottomLeftRadius: 'inherit',
|
|
445
|
+
backgroundColor: 'transparent',
|
|
446
|
+
pointerEvents: 'none'
|
|
447
|
+
},
|
|
448
|
+
// end of overlay
|
|
449
|
+
// Applies only on devices that support hovering, like desktop computers.
|
|
450
|
+
'@media (hover: hover)': {
|
|
451
|
+
':hover::before': {
|
|
452
|
+
backgroundColor: $theme.colors.hoverOverlayAlpha,
|
|
453
|
+
// this box shadow is used to extend the overlay to the border
|
|
454
|
+
boxShadow: `0 0 0 ${borderWidth} ${$theme.colors.hoverOverlayAlpha}`
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
':active::before': {
|
|
458
|
+
backgroundColor: $theme.colors.pressedOverlayAlpha,
|
|
459
|
+
// this box shadow is used to extend the overlay to the border
|
|
460
|
+
boxShadow: `0 0 0 ${borderWidth} ${$theme.colors.pressedOverlayAlpha}`
|
|
461
|
+
}
|
|
462
|
+
} : {}),
|
|
494
463
|
':focus': $disabled || !$clickable && !$closeable ? {} : {
|
|
495
464
|
boxShadow: $isFocusVisible ? `0 0 0 3px ${$kind === _constants.KIND.accent ? $theme.colors.backgroundInversePrimary : $theme.colors.backgroundAccent}` : 'none'
|
|
496
465
|
}
|
package/tag/tag.js
CHANGED
|
@@ -36,7 +36,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
36
36
|
disabled = false,
|
|
37
37
|
isFocused = false,
|
|
38
38
|
isHovered = false,
|
|
39
|
-
kind = _constants.KIND.
|
|
39
|
+
kind = _constants.KIND.gray,
|
|
40
40
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
41
41
|
onActionClick = event => {},
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -66,7 +66,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
const key = event.key;
|
|
69
|
-
if (onClick && key === 'Enter') {
|
|
69
|
+
if (onClick && (key === 'Enter' || key === ' ')) {
|
|
70
70
|
onClick(event);
|
|
71
71
|
}
|
|
72
72
|
if (closeable && (key === 'Backspace' || key === 'Delete')) {
|
|
@@ -110,6 +110,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
110
110
|
const titleText = title || (0, _utils.getTextFromChildren)(children);
|
|
111
111
|
const isButton = (clickable || closeable) && !disabled;
|
|
112
112
|
const actionSize = {
|
|
113
|
+
[_constants.SIZE.xSmall]: 12,
|
|
113
114
|
[_constants.SIZE.small]: 12,
|
|
114
115
|
[_constants.SIZE.medium]: 16,
|
|
115
116
|
[_constants.SIZE.large]: 20
|
|
@@ -122,7 +123,7 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
122
123
|
, _extends({
|
|
123
124
|
ref: ref,
|
|
124
125
|
"data-baseweb": "tag",
|
|
125
|
-
"aria-label": isButton && closeable ?
|
|
126
|
+
"aria-label": isButton && closeable ? `Remove${typeof children === 'string' ? ` ${children}` : ''}` : null,
|
|
126
127
|
"aria-disabled": disabled ? true : null,
|
|
127
128
|
role: isButton ? 'button' : null,
|
|
128
129
|
tabIndex: isButton ? 0 : null
|
|
@@ -132,7 +133,12 @@ const Tag = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
132
133
|
$contentMaxWidth: contentMaxWidth
|
|
133
134
|
}), StartEnhancer &&
|
|
134
135
|
// @ts-expect-error todo(flow->ts) it is not expected to be a number
|
|
135
|
-
StartEnhancer !== 0 && /*#__PURE__*/React.createElement(StartEnhancerContainer,
|
|
136
|
+
StartEnhancer !== 0 && /*#__PURE__*/React.createElement(StartEnhancerContainer, _extends({
|
|
137
|
+
"aria-hidden": true,
|
|
138
|
+
role: "presentation"
|
|
139
|
+
}, startEnhancerContainerProps), /*#__PURE__*/React.createElement(StartEnhancer, {
|
|
140
|
+
size: actionSize
|
|
141
|
+
})), /*#__PURE__*/React.createElement(Text, _extends({
|
|
136
142
|
$contentMaxWidth: contentMaxWidth,
|
|
137
143
|
title: titleText
|
|
138
144
|
}, textProps), children), closeable ? /*#__PURE__*/React.createElement(Action, _extends({
|