@spectrum-web-components/badge 1.12.0-testing.20260223092154 → 1.12.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/custom-elements.json +262 -3
- package/package.json +5 -6
- package/src/Badge.base.d.ts +71 -0
- package/src/Badge.base.dev.js +102 -0
- package/src/Badge.base.dev.js.map +7 -0
- package/src/Badge.base.js +2 -0
- package/src/Badge.base.js.map +7 -0
- package/src/Badge.d.ts +2 -1
- package/src/Badge.dev.js +3 -3
- package/src/Badge.dev.js.map +2 -2
- package/src/Badge.js +2 -2
- package/src/Badge.js.map +3 -3
- package/src/Badge.types.d.ts +25 -0
- package/src/Badge.types.dev.js +67 -0
- package/src/Badge.types.dev.js.map +7 -0
- package/src/Badge.types.js +2 -0
- package/src/Badge.types.js.map +7 -0
package/custom-elements.json
CHANGED
|
@@ -17,6 +17,93 @@
|
|
|
17
17
|
}
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "src/Badge.base.js",
|
|
23
|
+
"declarations": [
|
|
24
|
+
{
|
|
25
|
+
"kind": "class",
|
|
26
|
+
"description": "A badge component that displays short, descriptive information about an element.\nBadges are typically used to indicate status, categories, or provide supplementary information.",
|
|
27
|
+
"name": "BadgeBase",
|
|
28
|
+
"slots": [
|
|
29
|
+
{
|
|
30
|
+
"description": "Text label of the badge.",
|
|
31
|
+
"name": ""
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"description": "Optional icon that appears to the left of the label",
|
|
35
|
+
"name": "icon"
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"members": [
|
|
39
|
+
{
|
|
40
|
+
"kind": "field",
|
|
41
|
+
"name": "fixed",
|
|
42
|
+
"type": {
|
|
43
|
+
"text": "FixedValues | undefined"
|
|
44
|
+
},
|
|
45
|
+
"privacy": "public",
|
|
46
|
+
"description": "The fixed position of the badge.",
|
|
47
|
+
"attribute": "fixed",
|
|
48
|
+
"reflects": true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "field",
|
|
52
|
+
"name": "_fixed",
|
|
53
|
+
"type": {
|
|
54
|
+
"text": "FixedValues | undefined"
|
|
55
|
+
},
|
|
56
|
+
"privacy": "private"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"attributes": [
|
|
60
|
+
{
|
|
61
|
+
"type": {
|
|
62
|
+
"text": "ElementSize"
|
|
63
|
+
},
|
|
64
|
+
"description": "The size of the badge.",
|
|
65
|
+
"name": "size"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "fixed",
|
|
69
|
+
"type": {
|
|
70
|
+
"text": "FixedValues | undefined"
|
|
71
|
+
},
|
|
72
|
+
"description": "The fixed position of the badge.",
|
|
73
|
+
"fieldName": "fixed"
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"mixins": [
|
|
77
|
+
{
|
|
78
|
+
"name": "SizedMixin",
|
|
79
|
+
"package": "@spectrum-web-components/base/src/sizedMixin.js"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "ObserveSlotText",
|
|
83
|
+
"package": "@spectrum-web-components/shared/src/observe-slot-text.js"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "ObserveSlotPresence",
|
|
87
|
+
"package": "@spectrum-web-components/shared/src/observe-slot-presence.js"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"superclass": {
|
|
91
|
+
"name": "SpectrumElement",
|
|
92
|
+
"package": "@spectrum-web-components/base"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"exports": [
|
|
97
|
+
{
|
|
98
|
+
"kind": "js",
|
|
99
|
+
"name": "BadgeBase",
|
|
100
|
+
"declaration": {
|
|
101
|
+
"name": "BadgeBase",
|
|
102
|
+
"module": "src/Badge.base.js"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
20
107
|
{
|
|
21
108
|
"kind": "javascript-module",
|
|
22
109
|
"path": "src/Badge.js",
|
|
@@ -40,11 +127,19 @@
|
|
|
40
127
|
"slots": [
|
|
41
128
|
{
|
|
42
129
|
"description": "Text label of the badge",
|
|
43
|
-
"name": ""
|
|
130
|
+
"name": "",
|
|
131
|
+
"inheritedFrom": {
|
|
132
|
+
"name": "BadgeBase",
|
|
133
|
+
"module": "src/Badge.base.ts"
|
|
134
|
+
}
|
|
44
135
|
},
|
|
45
136
|
{
|
|
46
137
|
"description": "Optional icon that appears to the left of the label",
|
|
47
|
-
"name": "icon"
|
|
138
|
+
"name": "icon",
|
|
139
|
+
"inheritedFrom": {
|
|
140
|
+
"name": "BadgeBase",
|
|
141
|
+
"module": "src/Badge.base.ts"
|
|
142
|
+
}
|
|
48
143
|
}
|
|
49
144
|
],
|
|
50
145
|
"members": [
|
|
@@ -59,6 +154,33 @@
|
|
|
59
154
|
"description": "The variant of the badge.",
|
|
60
155
|
"attribute": "variant",
|
|
61
156
|
"reflects": true
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"kind": "field",
|
|
160
|
+
"name": "fixed",
|
|
161
|
+
"type": {
|
|
162
|
+
"text": "FixedValues | undefined"
|
|
163
|
+
},
|
|
164
|
+
"privacy": "public",
|
|
165
|
+
"description": "The fixed position of the badge.",
|
|
166
|
+
"attribute": "fixed",
|
|
167
|
+
"reflects": true,
|
|
168
|
+
"inheritedFrom": {
|
|
169
|
+
"name": "BadgeBase",
|
|
170
|
+
"module": "src/Badge.base.js"
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"kind": "field",
|
|
175
|
+
"name": "_fixed",
|
|
176
|
+
"type": {
|
|
177
|
+
"text": "FixedValues | undefined"
|
|
178
|
+
},
|
|
179
|
+
"privacy": "private",
|
|
180
|
+
"inheritedFrom": {
|
|
181
|
+
"name": "BadgeBase",
|
|
182
|
+
"module": "src/Badge.base.js"
|
|
183
|
+
}
|
|
62
184
|
}
|
|
63
185
|
],
|
|
64
186
|
"attributes": [
|
|
@@ -70,11 +192,34 @@
|
|
|
70
192
|
"default": "'informative'",
|
|
71
193
|
"description": "The variant of the badge.",
|
|
72
194
|
"fieldName": "variant"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"type": {
|
|
198
|
+
"text": "ElementSize"
|
|
199
|
+
},
|
|
200
|
+
"description": "The size of the badge.",
|
|
201
|
+
"name": "size",
|
|
202
|
+
"inheritedFrom": {
|
|
203
|
+
"name": "BadgeBase",
|
|
204
|
+
"module": "src/Badge.base.ts"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"name": "fixed",
|
|
209
|
+
"type": {
|
|
210
|
+
"text": "FixedValues | undefined"
|
|
211
|
+
},
|
|
212
|
+
"description": "The fixed position of the badge.",
|
|
213
|
+
"fieldName": "fixed",
|
|
214
|
+
"inheritedFrom": {
|
|
215
|
+
"name": "BadgeBase",
|
|
216
|
+
"module": "src/Badge.base.ts"
|
|
217
|
+
}
|
|
73
218
|
}
|
|
74
219
|
],
|
|
75
220
|
"superclass": {
|
|
76
221
|
"name": "BadgeBase",
|
|
77
|
-
"
|
|
222
|
+
"module": "/src/Badge.base.js"
|
|
78
223
|
},
|
|
79
224
|
"tagName": "sp-badge",
|
|
80
225
|
"customElement": true
|
|
@@ -106,6 +251,120 @@
|
|
|
106
251
|
}
|
|
107
252
|
}
|
|
108
253
|
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"kind": "javascript-module",
|
|
257
|
+
"path": "src/Badge.types.js",
|
|
258
|
+
"declarations": [
|
|
259
|
+
{
|
|
260
|
+
"kind": "variable",
|
|
261
|
+
"name": "BADGE_VALID_SIZES",
|
|
262
|
+
"default": "[ 's', 'm', 'l', 'xl', ] as const satisfies readonly ElementSize[]"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"kind": "variable",
|
|
266
|
+
"name": "BADGE_VARIANTS_SEMANTIC",
|
|
267
|
+
"type": {
|
|
268
|
+
"text": "[\n 'accent',\n 'informative',\n 'neutral',\n 'positive',\n 'notice',\n 'negative',\n]"
|
|
269
|
+
},
|
|
270
|
+
"default": "[ 'accent', 'informative', 'neutral', 'positive', 'notice', 'negative', ]"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"kind": "variable",
|
|
274
|
+
"name": "BADGE_VARIANTS_COLOR",
|
|
275
|
+
"type": {
|
|
276
|
+
"text": "[\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n 'gray',\n 'red',\n 'orange',\n 'chartreuse',\n 'celery',\n 'green',\n 'cyan',\n 'blue',\n 'pink',\n 'turquoise',\n 'brown',\n 'cinnamon',\n 'silver',\n]"
|
|
277
|
+
},
|
|
278
|
+
"default": "[ 'fuchsia', 'indigo', 'magenta', 'purple', 'seafoam', 'yellow', 'gray', 'red', 'orange', 'chartreuse', 'celery', 'green', 'cyan', 'blue', 'pink', 'turquoise', 'brown', 'cinnamon', 'silver', ]"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"kind": "variable",
|
|
282
|
+
"name": "FIXED_VALUES",
|
|
283
|
+
"type": {
|
|
284
|
+
"text": "[\n 'block-start',\n 'block-end',\n 'inline-start',\n 'inline-end',\n]"
|
|
285
|
+
},
|
|
286
|
+
"default": "[ 'block-start', 'block-end', 'inline-start', 'inline-end', ]"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"kind": "variable",
|
|
290
|
+
"name": "BADGE_VARIANTS_COLOR_S1",
|
|
291
|
+
"default": "[ 'fuchsia', 'indigo', 'magenta', 'purple', 'seafoam', 'yellow', 'gray', 'red', 'orange', 'chartreuse', 'celery', 'green', 'cyan', 'blue', ] as const satisfies readonly BadgeColorVariant[]"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"kind": "variable",
|
|
295
|
+
"name": "BADGE_VARIANTS_S1",
|
|
296
|
+
"type": {
|
|
297
|
+
"text": "[\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR_S1,\n]"
|
|
298
|
+
},
|
|
299
|
+
"default": "[ ...BADGE_VARIANTS_SEMANTIC, ...BADGE_VARIANTS_COLOR_S1, ]"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"kind": "variable",
|
|
303
|
+
"name": "BADGE_VARIANTS",
|
|
304
|
+
"type": {
|
|
305
|
+
"text": "[\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR,\n]"
|
|
306
|
+
},
|
|
307
|
+
"default": "[ ...BADGE_VARIANTS_SEMANTIC, ...BADGE_VARIANTS_COLOR, ]"
|
|
308
|
+
}
|
|
309
|
+
],
|
|
310
|
+
"exports": [
|
|
311
|
+
{
|
|
312
|
+
"kind": "js",
|
|
313
|
+
"name": "BADGE_VALID_SIZES",
|
|
314
|
+
"declaration": {
|
|
315
|
+
"name": "BADGE_VALID_SIZES",
|
|
316
|
+
"module": "src/Badge.types.js"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"kind": "js",
|
|
321
|
+
"name": "BADGE_VARIANTS_SEMANTIC",
|
|
322
|
+
"declaration": {
|
|
323
|
+
"name": "BADGE_VARIANTS_SEMANTIC",
|
|
324
|
+
"module": "src/Badge.types.js"
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"kind": "js",
|
|
329
|
+
"name": "BADGE_VARIANTS_COLOR",
|
|
330
|
+
"declaration": {
|
|
331
|
+
"name": "BADGE_VARIANTS_COLOR",
|
|
332
|
+
"module": "src/Badge.types.js"
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"kind": "js",
|
|
337
|
+
"name": "FIXED_VALUES",
|
|
338
|
+
"declaration": {
|
|
339
|
+
"name": "FIXED_VALUES",
|
|
340
|
+
"module": "src/Badge.types.js"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"kind": "js",
|
|
345
|
+
"name": "BADGE_VARIANTS_COLOR_S1",
|
|
346
|
+
"declaration": {
|
|
347
|
+
"name": "BADGE_VARIANTS_COLOR_S1",
|
|
348
|
+
"module": "src/Badge.types.js"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"kind": "js",
|
|
353
|
+
"name": "BADGE_VARIANTS_S1",
|
|
354
|
+
"declaration": {
|
|
355
|
+
"name": "BADGE_VARIANTS_S1",
|
|
356
|
+
"module": "src/Badge.types.js"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"kind": "js",
|
|
361
|
+
"name": "BADGE_VARIANTS",
|
|
362
|
+
"declaration": {
|
|
363
|
+
"name": "BADGE_VARIANTS",
|
|
364
|
+
"module": "src/Badge.types.js"
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
]
|
|
109
368
|
}
|
|
110
369
|
]
|
|
111
370
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/badge",
|
|
3
|
-
"version": "1.12.0
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "Web component implementation of a Spectrum design Badge",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"default": "./sp-badge.js"
|
|
26
26
|
},
|
|
27
27
|
"./src/Badge.js": {
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"development": "./src/Badge.dev.js",
|
|
29
|
+
"default": "./src/Badge.js"
|
|
30
30
|
},
|
|
31
31
|
"./src/badge-overrides.css.js": "./src/badge-overrides.css.js",
|
|
32
32
|
"./src/badge.css.js": "./src/badge.css.js",
|
|
@@ -54,9 +54,8 @@
|
|
|
54
54
|
],
|
|
55
55
|
"types": "./src/index.d.ts",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@spectrum-web-components/base": "1.12.0
|
|
58
|
-
"@spectrum-web-components/
|
|
59
|
-
"@spectrum-web-components/shared": "1.12.0-testing.20260223092154"
|
|
57
|
+
"@spectrum-web-components/base": "1.12.0",
|
|
58
|
+
"@spectrum-web-components/shared": "1.12.0"
|
|
60
59
|
},
|
|
61
60
|
"keywords": [
|
|
62
61
|
"design-system",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { PropertyValues, SpectrumElement } from '@spectrum-web-components/base';
|
|
13
|
+
import { type BadgeVariant, type FixedValues } from './Badge.types.js';
|
|
14
|
+
declare const BadgeBase_base: typeof SpectrumElement & {
|
|
15
|
+
new (...args: any[]): import("@spectrum-web-components/shared/src/observe-slot-presence.js").SlotPresenceObservingInterface;
|
|
16
|
+
prototype: import("@spectrum-web-components/shared/src/observe-slot-presence.js").SlotPresenceObservingInterface;
|
|
17
|
+
} & {
|
|
18
|
+
new (...args: any[]): import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
|
|
19
|
+
prototype: import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
|
|
20
|
+
} & import("@spectrum-web-components/base").Constructor<import("@spectrum-web-components/base").SizedElementInterface> & import("@spectrum-web-components/base").SizedElementConstructor;
|
|
21
|
+
/**
|
|
22
|
+
* A badge component that displays short, descriptive information about an element.
|
|
23
|
+
* Badges are typically used to indicate status, categories, or provide supplementary information.
|
|
24
|
+
*
|
|
25
|
+
* @attribute {ElementSize} size - The size of the badge.
|
|
26
|
+
*
|
|
27
|
+
* @slot - Text label of the badge.
|
|
28
|
+
* @slot icon - Optional icon that appears to the left of the label
|
|
29
|
+
*/
|
|
30
|
+
export declare abstract class BadgeBase extends BadgeBase_base {
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*
|
|
34
|
+
* A readonly array of the valid color variants for the badge.
|
|
35
|
+
*/
|
|
36
|
+
static readonly VARIANTS_COLOR: readonly string[];
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*
|
|
40
|
+
* A readonly array of all valid variants for the badge.
|
|
41
|
+
*/
|
|
42
|
+
static readonly VARIANTS: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
*
|
|
46
|
+
* The variant of the badge.
|
|
47
|
+
*/
|
|
48
|
+
variant: BadgeVariant;
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
static readonly FIXED_VALUES: readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
static readonly VARIANTS_SEMANTIC: readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
* The fixed position of the badge.
|
|
59
|
+
*/
|
|
60
|
+
get fixed(): FixedValues | undefined;
|
|
61
|
+
set fixed(fixed: FixedValues | undefined);
|
|
62
|
+
private _fixed?;
|
|
63
|
+
/**
|
|
64
|
+
* Used for rendering gap when the badge has an icon.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
protected get hasIcon(): boolean;
|
|
69
|
+
protected update(changedProperties: PropertyValues): void;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import { SpectrumElement } from "@spectrum-web-components/base";
|
|
13
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
14
|
+
import { SizedMixin } from "@spectrum-web-components/base/src/sizedMixin.js";
|
|
15
|
+
import { ObserveSlotPresence } from "@spectrum-web-components/shared/src/observe-slot-presence.js";
|
|
16
|
+
import { ObserveSlotText } from "@spectrum-web-components/shared/src/observe-slot-text.js";
|
|
17
|
+
import {
|
|
18
|
+
BADGE_VARIANTS_SEMANTIC,
|
|
19
|
+
FIXED_VALUES
|
|
20
|
+
} from "./Badge.types.dev.js";
|
|
21
|
+
export class BadgeBase extends SizedMixin(
|
|
22
|
+
ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot="icon"]'), ""),
|
|
23
|
+
{
|
|
24
|
+
noDefaultSize: true
|
|
25
|
+
}
|
|
26
|
+
) {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.variant = "informative";
|
|
30
|
+
}
|
|
31
|
+
get fixed() {
|
|
32
|
+
return this._fixed;
|
|
33
|
+
}
|
|
34
|
+
set fixed(fixed) {
|
|
35
|
+
if (fixed === this.fixed) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const oldValue = this.fixed;
|
|
39
|
+
this._fixed = fixed;
|
|
40
|
+
if (fixed) {
|
|
41
|
+
this.setAttribute("fixed", fixed);
|
|
42
|
+
} else {
|
|
43
|
+
this.removeAttribute("fixed");
|
|
44
|
+
}
|
|
45
|
+
this.requestUpdate("fixed", oldValue);
|
|
46
|
+
}
|
|
47
|
+
// ──────────────────────
|
|
48
|
+
// IMPLEMENTATION
|
|
49
|
+
// ──────────────────────
|
|
50
|
+
/**
|
|
51
|
+
* Used for rendering gap when the badge has an icon.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
get hasIcon() {
|
|
56
|
+
return this.slotContentIsPresent;
|
|
57
|
+
}
|
|
58
|
+
update(changedProperties) {
|
|
59
|
+
super.update(changedProperties);
|
|
60
|
+
if (true) {
|
|
61
|
+
const constructor = this.constructor;
|
|
62
|
+
if (!constructor.VARIANTS.includes(this.variant)) {
|
|
63
|
+
window.__swc.warn(
|
|
64
|
+
this,
|
|
65
|
+
`<${this.localName}> element expect the "variant" attribute to be one of the following:`,
|
|
66
|
+
"https://opensource.adobe.com/spectrum-web-components/components/badge/#variants",
|
|
67
|
+
{
|
|
68
|
+
issues: [...constructor.VARIANTS]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if ("outline" in this && this.outline === true && !constructor.VARIANTS_SEMANTIC.includes(this.variant)) {
|
|
73
|
+
window.__swc.warn(
|
|
74
|
+
this,
|
|
75
|
+
`<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,
|
|
76
|
+
"https://opensource.adobe.com/spectrum-web-components/components/badge/#variants",
|
|
77
|
+
{
|
|
78
|
+
issues: [...constructor.VARIANTS_SEMANTIC]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// ──────────────────
|
|
86
|
+
// SHARED API
|
|
87
|
+
// ──────────────────
|
|
88
|
+
/**
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
BadgeBase.FIXED_VALUES = FIXED_VALUES;
|
|
92
|
+
/**
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
BadgeBase.VARIANTS_SEMANTIC = BADGE_VARIANTS_SEMANTIC;
|
|
96
|
+
__decorateClass([
|
|
97
|
+
property({ type: String, reflect: true })
|
|
98
|
+
], BadgeBase.prototype, "variant", 2);
|
|
99
|
+
__decorateClass([
|
|
100
|
+
property({ reflect: true })
|
|
101
|
+
], BadgeBase.prototype, "fixed", 1);
|
|
102
|
+
//# sourceMappingURL=Badge.base.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Badge.base.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues, SpectrumElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { SizedMixin } from '@spectrum-web-components/base/src/sizedMixin.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\n\nimport {\n BADGE_VARIANTS_SEMANTIC,\n type BadgeVariant,\n FIXED_VALUES,\n type FixedValues,\n} from './Badge.types.dev.js'\n\n/**\n * A badge component that displays short, descriptive information about an element.\n * Badges are typically used to indicate status, categories, or provide supplementary information.\n *\n * @attribute {ElementSize} size - The size of the badge.\n *\n * @slot - Text label of the badge.\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport abstract class BadgeBase extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), ''),\n {\n noDefaultSize: true,\n }\n) {\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // API TO OVERRIDE\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * @internal\n *\n * A readonly array of the valid color variants for the badge.\n */\n static readonly VARIANTS_COLOR: readonly string[];\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the badge.\n */\n static readonly VARIANTS: readonly string[];\n\n /**\n * @internal\n *\n * The variant of the badge.\n */\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // SHARED API\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * @internal\n */\n static readonly FIXED_VALUES: readonly string[] = FIXED_VALUES;\n\n /**\n * @internal\n */\n static readonly VARIANTS_SEMANTIC: readonly string[] =\n BADGE_VARIANTS_SEMANTIC;\n\n /**\n * The fixed position of the badge.\n */\n @property({ reflect: true })\n public get fixed(): FixedValues | undefined {\n return this._fixed;\n }\n\n public set fixed(fixed: FixedValues | undefined) {\n if (fixed === this.fixed) {\n return;\n }\n const oldValue = this.fixed;\n this._fixed = fixed;\n if (fixed) {\n this.setAttribute('fixed', fixed);\n } else {\n this.removeAttribute('fixed');\n }\n this.requestUpdate('fixed', oldValue);\n }\n\n private _fixed?: FixedValues;\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // IMPLEMENTATION\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Used for rendering gap when the badge has an icon.\n *\n * @internal\n */\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override update(changedProperties: PropertyValues): void {\n super.update(changedProperties);\n if (window.__swc?.DEBUG) {\n const constructor = this.constructor as typeof BadgeBase;\n if (!constructor.VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS],\n }\n );\n }\n // Check outline property if it exists (S2 only)\n if (\n 'outline' in this &&\n (this as { outline: boolean }).outline === true &&\n !constructor.VARIANTS_SEMANTIC.includes(this.variant)\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS_SEMANTIC],\n }\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAWA,SAAyB,uBAAuB;AAChD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EAEA;AAAA,OAEK;AAWA,aAAe,kBAAkB;AAAA,EACtC,gBAAgB,oBAAoB,iBAAiB,eAAe,GAAG,EAAE;AAAA,EACzE;AAAA,IACE,eAAe;AAAA,EACjB;AACF,EAAE;AAAA,EALK;AAAA;AA8BL,SAAO,UAAwB;AAAA;AAAA,EAqB/B,IAAW,QAAiC;AAC1C,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAW,MAAM,OAAgC;AAC/C,QAAI,UAAU,KAAK,OAAO;AACxB;AAAA,IACF;AACA,UAAM,WAAW,KAAK;AACtB,SAAK,SAAS;AACd,QAAI,OAAO;AACT,WAAK,aAAa,SAAS,KAAK;AAAA,IAClC,OAAO;AACL,WAAK,gBAAgB,OAAO;AAAA,IAC9B;AACA,SAAK,cAAc,SAAS,QAAQ;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,IAAc,UAAmB;AAC/B,WAAO,KAAK;AAAA,EACd;AAAA,EAEmB,OAAO,mBAAyC;AACjE,UAAM,OAAO,iBAAiB;AAC9B,QAAI,MAAqB;AACvB,YAAM,cAAc,KAAK;AACzB,UAAI,CAAC,YAAY,SAAS,SAAS,KAAK,OAAO,GAAG;AAChD,eAAO,MAAM;AAAA,UACX;AAAA,UACA,IAAI,KAAK,SAAS;AAAA,UAClB;AAAA,UACA;AAAA,YACE,QAAQ,CAAC,GAAG,YAAY,QAAQ;AAAA,UAClC;AAAA,QACF;AAAA,MACF;AAEA,UACE,aAAa,QACZ,KAA8B,YAAY,QAC3C,CAAC,YAAY,kBAAkB,SAAS,KAAK,OAAO,GACpD;AACA,eAAO,MAAM;AAAA,UACX;AAAA,UACA,IAAI,KAAK,SAAS;AAAA,UAClB;AAAA,UACA;AAAA,YACE,QAAQ,CAAC,GAAG,YAAY,iBAAiB;AAAA,UAC3C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAnHsB,UAuCJ,eAAkC;AAAA;AAAA;AAAA;AAvC9B,UA4CJ,oBACd;AAfK;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GA7BrB,UA8Bb;AAqBI;AAAA,EADV,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAlDP,UAmDT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var a=(r,o,t,e)=>{for(var i=e>1?void 0:e?u(o,t):o,s=r.length-1,n;s>=0;s--)(n=r[s])&&(i=(e?n(o,t,i):n(i))||i);return e&&i&&l(o,t,i),i};import{SpectrumElement as d}from"@spectrum-web-components/base";import{property as c}from"@spectrum-web-components/base/src/decorators.js";import{SizedMixin as p}from"@spectrum-web-components/base/src/sizedMixin.js";import{ObserveSlotPresence as m}from"@spectrum-web-components/shared/src/observe-slot-presence.js";import{ObserveSlotText as f}from"@spectrum-web-components/shared/src/observe-slot-text.js";import{BADGE_VARIANTS_SEMANTIC as A,FIXED_VALUES as h}from"./Badge.types.js";export class BadgeBase extends p(f(m(d,'[slot="icon"]'),""),{noDefaultSize:!0}){constructor(){super(...arguments);this.variant="informative"}get fixed(){return this._fixed}set fixed(t){if(t===this.fixed)return;const e=this.fixed;this._fixed=t,t?this.setAttribute("fixed",t):this.removeAttribute("fixed"),this.requestUpdate("fixed",e)}get hasIcon(){return this.slotContentIsPresent}update(t){super.update(t)}}BadgeBase.FIXED_VALUES=h,BadgeBase.VARIANTS_SEMANTIC=A,a([c({type:String,reflect:!0})],BadgeBase.prototype,"variant",2),a([c({reflect:!0})],BadgeBase.prototype,"fixed",1);
|
|
2
|
+
//# sourceMappingURL=Badge.base.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Badge.base.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues, SpectrumElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { SizedMixin } from '@spectrum-web-components/base/src/sizedMixin.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\n\nimport {\n BADGE_VARIANTS_SEMANTIC,\n type BadgeVariant,\n FIXED_VALUES,\n type FixedValues,\n} from './Badge.types.js';\n\n/**\n * A badge component that displays short, descriptive information about an element.\n * Badges are typically used to indicate status, categories, or provide supplementary information.\n *\n * @attribute {ElementSize} size - The size of the badge.\n *\n * @slot - Text label of the badge.\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport abstract class BadgeBase extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), ''),\n {\n noDefaultSize: true,\n }\n) {\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // API TO OVERRIDE\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * @internal\n *\n * A readonly array of the valid color variants for the badge.\n */\n static readonly VARIANTS_COLOR: readonly string[];\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the badge.\n */\n static readonly VARIANTS: readonly string[];\n\n /**\n * @internal\n *\n * The variant of the badge.\n */\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // SHARED API\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * @internal\n */\n static readonly FIXED_VALUES: readonly string[] = FIXED_VALUES;\n\n /**\n * @internal\n */\n static readonly VARIANTS_SEMANTIC: readonly string[] =\n BADGE_VARIANTS_SEMANTIC;\n\n /**\n * The fixed position of the badge.\n */\n @property({ reflect: true })\n public get fixed(): FixedValues | undefined {\n return this._fixed;\n }\n\n public set fixed(fixed: FixedValues | undefined) {\n if (fixed === this.fixed) {\n return;\n }\n const oldValue = this.fixed;\n this._fixed = fixed;\n if (fixed) {\n this.setAttribute('fixed', fixed);\n } else {\n this.removeAttribute('fixed');\n }\n this.requestUpdate('fixed', oldValue);\n }\n\n private _fixed?: FixedValues;\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // IMPLEMENTATION\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * Used for rendering gap when the badge has an icon.\n *\n * @internal\n */\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override update(changedProperties: PropertyValues): void {\n super.update(changedProperties);\n if (window.__swc?.DEBUG) {\n const constructor = this.constructor as typeof BadgeBase;\n if (!constructor.VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS],\n }\n );\n }\n // Check outline property if it exists (S2 only)\n if (\n 'outline' in this &&\n (this as { outline: boolean }).outline === true &&\n !constructor.VARIANTS_SEMANTIC.includes(this.variant)\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS_SEMANTIC],\n }\n );\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OAAyB,mBAAAA,MAAuB,gCAChD,OAAS,YAAAC,MAAgB,kDACzB,OAAS,cAAAC,MAAkB,kDAC3B,OAAS,uBAAAC,MAA2B,+DACpC,OAAS,mBAAAC,MAAuB,2DAEhC,OACE,2BAAAC,EAEA,gBAAAC,MAEK,mBAWA,aAAe,kBAAkBJ,EACtCE,EAAgBD,EAAoBH,EAAiB,eAAe,EAAG,EAAE,EACzE,CACE,cAAe,EACjB,CACF,CAAE,CALK,kCA8BL,KAAO,QAAwB,cAqB/B,IAAW,OAAiC,CAC1C,OAAO,KAAK,MACd,CAEA,IAAW,MAAMO,EAAgC,CAC/C,GAAIA,IAAU,KAAK,MACjB,OAEF,MAAMC,EAAW,KAAK,MACtB,KAAK,OAASD,EACVA,EACF,KAAK,aAAa,QAASA,CAAK,EAEhC,KAAK,gBAAgB,OAAO,EAE9B,KAAK,cAAc,QAASC,CAAQ,CACtC,CAaA,IAAc,SAAmB,CAC/B,OAAO,KAAK,oBACd,CAEmB,OAAOC,EAAyC,CACjE,MAAM,OAAOA,CAAiB,CA6BhC,CACF,CAnHsB,UAuCJ,aAAkCH,EAvC9B,UA4CJ,kBACdD,EAfKK,EAAA,CADNT,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GA7BrB,UA8Bb,uBAqBIS,EAAA,CADVT,EAAS,CAAE,QAAS,EAAK,CAAC,GAlDP,UAmDT",
|
|
6
|
+
"names": ["SpectrumElement", "property", "SizedMixin", "ObserveSlotPresence", "ObserveSlotText", "BADGE_VARIANTS_SEMANTIC", "FIXED_VALUES", "fixed", "oldValue", "changedProperties", "__decorateClass"]
|
|
7
|
+
}
|
package/src/Badge.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
import { CSSResultArray, TemplateResult } from '@spectrum-web-components/base';
|
|
13
|
-
import { BadgeBase
|
|
13
|
+
import { BadgeBase } from './Badge.base.js';
|
|
14
|
+
import { type BadgeVariantS1, type FixedValues as FixedValuesBase } from './Badge.types.js';
|
|
14
15
|
/**
|
|
15
16
|
* @deprecated The `BADGE_VARIANTS` export is deprecated and will be removed
|
|
16
17
|
* in a future release. If needed, you can access the internal
|
package/src/Badge.dev.js
CHANGED
|
@@ -14,13 +14,13 @@ import {
|
|
|
14
14
|
nothing
|
|
15
15
|
} from "@spectrum-web-components/base";
|
|
16
16
|
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
17
|
+
import { BadgeBase } from "./Badge.base.dev.js";
|
|
18
|
+
import styles from "./badge.css.js";
|
|
17
19
|
import {
|
|
18
20
|
BADGE_VARIANTS_COLOR_S1,
|
|
19
21
|
BADGE_VARIANTS_S1,
|
|
20
|
-
BadgeBase,
|
|
21
22
|
FIXED_VALUES as FIXED_VALUES_BASE
|
|
22
|
-
} from "
|
|
23
|
-
import styles from "./badge.css.js";
|
|
23
|
+
} from "./Badge.types.dev.js";
|
|
24
24
|
export const BADGE_VARIANTS = BADGE_VARIANTS_S1;
|
|
25
25
|
export const FIXED_VALUES = FIXED_VALUES_BASE;
|
|
26
26
|
export class Badge extends BadgeBase {
|
package/src/Badge.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Badge.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n BADGE_VARIANTS_COLOR_S1,\n BADGE_VARIANTS_S1,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,gBAAgB;
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { BadgeBase } from './Badge.base.dev.js'\nimport styles from './badge.css.js';\nimport {\n BADGE_VARIANTS_COLOR_S1,\n BADGE_VARIANTS_S1,\n type BadgeVariantS1,\n FIXED_VALUES as FIXED_VALUES_BASE,\n type FixedValues as FixedValuesBase,\n} from './Badge.types.dev.js'\n\n/**\n * @deprecated The `BADGE_VARIANTS` export is deprecated and will be removed\n * in a future release. If needed, you can access the internal\n * `Badge.VARIANTS` property from the constructor.\n */\nexport const BADGE_VARIANTS = BADGE_VARIANTS_S1;\n\n/**\n * @deprecated The `FIXED_VALUES` export is deprecated and will be removed\n * in a future release. If needed, you can access the internal\n * `Badge.FIXED_VALUES` property from the constructor.\n */\nexport const FIXED_VALUES = FIXED_VALUES_BASE;\n\n/**\n * @deprecated The `BadgeVariant` type export is deprecated and will be removed\n * in a future release. If needed, you can infer this type from the `Badge`\n * prototype as follows: `typeof Badge.prototype.variant`\n */\nexport type BadgeVariant = BadgeVariantS1;\n\n/**\n * @deprecated The `FixedValues` type export is deprecated and will be removed\n * in a future release. If needed, you can infer this type from the `Badge`\n * constructor as follows: `typeof Badge.FIXED_VALUES`\n */\nexport type FixedValues = FixedValuesBase;\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends BadgeBase {\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // API OVERRIDES\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * @internal\n */\n static override readonly VARIANTS_COLOR = BADGE_VARIANTS_COLOR_S1;\n\n /**\n * @internal\n */\n static override readonly VARIANTS = BADGE_VARIANTS_S1;\n\n /**\n * The variant of the badge.\n */\n @property({ type: String, reflect: true })\n public override variant: BadgeVariantS1 = 'informative';\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // RENDERING & STYLING\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.hasIcon\n ? html`\n <slot name=\"icon\" ?icon-only=${!this.slotHasContent}></slot>\n `\n : nothing}\n <div class=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA,EAEE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAC1B,OAAO,YAAY;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EAEA,gBAAgB;AAAA,OAEX;AAOA,aAAM,iBAAiB;AAOvB,aAAM,eAAe;AAsBrB,aAAM,cAAc,UAAU;AAAA,EAA9B;AAAA;AAmBL,SAAgB,UAA0B;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1C,WAA2B,SAAyB;AAClD,WAAO,CAAC,MAAM;AAAA,EAChB;AAAA,EAEmB,SAAyB;AAC1C,WAAO;AAAA,QACH,KAAK,UACH;AAAA,2CACiC,CAAC,KAAK,cAAc;AAAA,cAErD,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKf;AACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAzCa,MAQc,iBAAiB;AAAA;AAAA;AAAA;AAR/B,MAac,WAAW;AAMpB;AAAA,EADf,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAlB9B,MAmBK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Badge.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var l=(a,t,o,r)=>{for(var e=r>1?void 0:r?A(t,o):t,s=a.length-1,i;s>=0;s--)(i=a[s])&&(e=(r?i(t,o,e):i(e))||e);return r&&e&&d(t,o,e),e};import{html as n,nothing as S}from"@spectrum-web-components/base";import{property as V}from"@spectrum-web-components/base/src/decorators.js";import{
|
|
1
|
+
"use strict";var d=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var l=(a,t,o,r)=>{for(var e=r>1?void 0:r?A(t,o):t,s=a.length-1,i;s>=0;s--)(i=a[s])&&(e=(r?i(t,o,e):i(e))||e);return r&&e&&d(t,o,e),e};import{html as n,nothing as S}from"@spectrum-web-components/base";import{property as V}from"@spectrum-web-components/base/src/decorators.js";import{BadgeBase as m}from"./Badge.base.js";import c from"./badge.css.js";import{BADGE_VARIANTS_COLOR_S1 as u,BADGE_VARIANTS_S1 as p,FIXED_VALUES as y}from"./Badge.types.js";export const BADGE_VARIANTS=p,FIXED_VALUES=y;export class Badge extends m{constructor(){super(...arguments);this.variant="informative"}static get styles(){return[c]}render(){return n`
|
|
2
2
|
${this.hasIcon?n`
|
|
3
3
|
<slot name="icon" ?icon-only=${!this.slotHasContent}></slot>
|
|
4
4
|
`:S}
|
|
5
5
|
<div class="label">
|
|
6
6
|
<slot></slot>
|
|
7
7
|
</div>
|
|
8
|
-
`}}Badge.VARIANTS_COLOR=
|
|
8
|
+
`}}Badge.VARIANTS_COLOR=u,Badge.VARIANTS=p,l([V({type:String,reflect:!0})],Badge.prototype,"variant",2);
|
|
9
9
|
//# sourceMappingURL=Badge.js.map
|
package/src/Badge.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Badge.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport {\n BADGE_VARIANTS_COLOR_S1,\n BADGE_VARIANTS_S1,\n
|
|
5
|
-
"mappings": "qNAYA,OAEE,QAAAA,EACA,WAAAC,MAEK,gCACP,OAAS,YAAAC,MAAgB,
|
|
6
|
-
"names": ["html", "nothing", "property", "
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n CSSResultArray,\n html,\n nothing,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { BadgeBase } from './Badge.base.js';\nimport styles from './badge.css.js';\nimport {\n BADGE_VARIANTS_COLOR_S1,\n BADGE_VARIANTS_S1,\n type BadgeVariantS1,\n FIXED_VALUES as FIXED_VALUES_BASE,\n type FixedValues as FixedValuesBase,\n} from './Badge.types.js';\n\n/**\n * @deprecated The `BADGE_VARIANTS` export is deprecated and will be removed\n * in a future release. If needed, you can access the internal\n * `Badge.VARIANTS` property from the constructor.\n */\nexport const BADGE_VARIANTS = BADGE_VARIANTS_S1;\n\n/**\n * @deprecated The `FIXED_VALUES` export is deprecated and will be removed\n * in a future release. If needed, you can access the internal\n * `Badge.FIXED_VALUES` property from the constructor.\n */\nexport const FIXED_VALUES = FIXED_VALUES_BASE;\n\n/**\n * @deprecated The `BadgeVariant` type export is deprecated and will be removed\n * in a future release. If needed, you can infer this type from the `Badge`\n * prototype as follows: `typeof Badge.prototype.variant`\n */\nexport type BadgeVariant = BadgeVariantS1;\n\n/**\n * @deprecated The `FixedValues` type export is deprecated and will be removed\n * in a future release. If needed, you can infer this type from the `Badge`\n * constructor as follows: `typeof Badge.FIXED_VALUES`\n */\nexport type FixedValues = FixedValuesBase;\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends BadgeBase {\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // API OVERRIDES\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n /**\n * @internal\n */\n static override readonly VARIANTS_COLOR = BADGE_VARIANTS_COLOR_S1;\n\n /**\n * @internal\n */\n static override readonly VARIANTS = BADGE_VARIANTS_S1;\n\n /**\n * The variant of the badge.\n */\n @property({ type: String, reflect: true })\n public override variant: BadgeVariantS1 = 'informative';\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // RENDERING & STYLING\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n protected override render(): TemplateResult {\n return html`\n ${this.hasIcon\n ? html`\n <slot name=\"icon\" ?icon-only=${!this.slotHasContent}></slot>\n `\n : nothing}\n <div class=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEE,QAAAA,EACA,WAAAC,MAEK,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAS,aAAAC,MAAiB,kBAC1B,OAAOC,MAAY,iBACnB,OACE,2BAAAC,EACA,qBAAAC,EAEA,gBAAgBC,MAEX,mBAOA,aAAM,eAAiBD,EAOjB,aAAeC,EAsBrB,aAAM,cAAcJ,CAAU,CAA9B,kCAmBL,KAAgB,QAA0B,cAM1C,WAA2B,QAAyB,CAClD,MAAO,CAACC,CAAM,CAChB,CAEmB,QAAyB,CAC1C,OAAOJ;AAAA,QACH,KAAK,QACHA;AAAA,2CACiC,CAAC,KAAK,cAAc;AAAA,YAErDC,CAAO;AAAA;AAAA;AAAA;AAAA,KAKf,CACF,CAzCa,MAQc,eAAiBI,EAR/B,MAac,SAAWC,EAMpBE,EAAA,CADfN,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAlB9B,MAmBK",
|
|
6
|
+
"names": ["html", "nothing", "property", "BadgeBase", "styles", "BADGE_VARIANTS_COLOR_S1", "BADGE_VARIANTS_S1", "FIXED_VALUES_BASE", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BADGE_VALID_SIZES: readonly ["s", "m", "l", "xl"];
|
|
13
|
+
export declare const BADGE_VARIANTS_SEMANTIC: readonly ["accent", "informative", "neutral", "positive", "notice", "negative"];
|
|
14
|
+
export declare const BADGE_VARIANTS_COLOR: readonly ["fuchsia", "indigo", "magenta", "purple", "seafoam", "yellow", "gray", "red", "orange", "chartreuse", "celery", "green", "cyan", "blue", "pink", "turquoise", "brown", "cinnamon", "silver"];
|
|
15
|
+
export declare const FIXED_VALUES: readonly ["block-start", "block-end", "inline-start", "inline-end"];
|
|
16
|
+
export declare const BADGE_VARIANTS_COLOR_S1: readonly ["fuchsia", "indigo", "magenta", "purple", "seafoam", "yellow", "gray", "red", "orange", "chartreuse", "celery", "green", "cyan", "blue"];
|
|
17
|
+
export declare const BADGE_VARIANTS_S1: readonly ["accent", "informative", "neutral", "positive", "notice", "negative", "fuchsia", "indigo", "magenta", "purple", "seafoam", "yellow", "gray", "red", "orange", "chartreuse", "celery", "green", "cyan", "blue"];
|
|
18
|
+
export declare const BADGE_VARIANTS: readonly ["accent", "informative", "neutral", "positive", "notice", "negative", "fuchsia", "indigo", "magenta", "purple", "seafoam", "yellow", "gray", "red", "orange", "chartreuse", "celery", "green", "cyan", "blue", "pink", "turquoise", "brown", "cinnamon", "silver"];
|
|
19
|
+
export type FixedValues = (typeof FIXED_VALUES)[number];
|
|
20
|
+
export type BadgeSize = (typeof BADGE_VALID_SIZES)[number];
|
|
21
|
+
export type BadgeSemanticVariant = (typeof BADGE_VARIANTS_SEMANTIC)[number];
|
|
22
|
+
export type BadgeColorVariantS1 = (typeof BADGE_VARIANTS_COLOR_S1)[number];
|
|
23
|
+
export type BadgeVariantS1 = (typeof BADGE_VARIANTS_S1)[number];
|
|
24
|
+
export type BadgeColorVariant = (typeof BADGE_VARIANTS_COLOR)[number];
|
|
25
|
+
export type BadgeVariant = (typeof BADGE_VARIANTS)[number];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export const BADGE_VALID_SIZES = [
|
|
3
|
+
"s",
|
|
4
|
+
"m",
|
|
5
|
+
"l",
|
|
6
|
+
"xl"
|
|
7
|
+
];
|
|
8
|
+
export const BADGE_VARIANTS_SEMANTIC = [
|
|
9
|
+
"accent",
|
|
10
|
+
"informative",
|
|
11
|
+
"neutral",
|
|
12
|
+
"positive",
|
|
13
|
+
"notice",
|
|
14
|
+
"negative"
|
|
15
|
+
];
|
|
16
|
+
export const BADGE_VARIANTS_COLOR = [
|
|
17
|
+
"fuchsia",
|
|
18
|
+
"indigo",
|
|
19
|
+
"magenta",
|
|
20
|
+
"purple",
|
|
21
|
+
"seafoam",
|
|
22
|
+
"yellow",
|
|
23
|
+
"gray",
|
|
24
|
+
"red",
|
|
25
|
+
"orange",
|
|
26
|
+
"chartreuse",
|
|
27
|
+
"celery",
|
|
28
|
+
"green",
|
|
29
|
+
"cyan",
|
|
30
|
+
"blue",
|
|
31
|
+
"pink",
|
|
32
|
+
"turquoise",
|
|
33
|
+
"brown",
|
|
34
|
+
"cinnamon",
|
|
35
|
+
"silver"
|
|
36
|
+
];
|
|
37
|
+
export const FIXED_VALUES = [
|
|
38
|
+
"block-start",
|
|
39
|
+
"block-end",
|
|
40
|
+
"inline-start",
|
|
41
|
+
"inline-end"
|
|
42
|
+
];
|
|
43
|
+
export const BADGE_VARIANTS_COLOR_S1 = [
|
|
44
|
+
"fuchsia",
|
|
45
|
+
"indigo",
|
|
46
|
+
"magenta",
|
|
47
|
+
"purple",
|
|
48
|
+
"seafoam",
|
|
49
|
+
"yellow",
|
|
50
|
+
"gray",
|
|
51
|
+
"red",
|
|
52
|
+
"orange",
|
|
53
|
+
"chartreuse",
|
|
54
|
+
"celery",
|
|
55
|
+
"green",
|
|
56
|
+
"cyan",
|
|
57
|
+
"blue"
|
|
58
|
+
];
|
|
59
|
+
export const BADGE_VARIANTS_S1 = [
|
|
60
|
+
...BADGE_VARIANTS_SEMANTIC,
|
|
61
|
+
...BADGE_VARIANTS_COLOR_S1
|
|
62
|
+
];
|
|
63
|
+
export const BADGE_VARIANTS = [
|
|
64
|
+
...BADGE_VARIANTS_SEMANTIC,
|
|
65
|
+
...BADGE_VARIANTS_COLOR
|
|
66
|
+
];
|
|
67
|
+
//# sourceMappingURL=Badge.types.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Badge.types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { ElementSize } from '@spectrum-web-components/base/src/sizedMixin.js';\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// SHARED\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const BADGE_VALID_SIZES = [\n 's',\n 'm',\n 'l',\n 'xl',\n] as const satisfies readonly ElementSize[];\n\nexport const BADGE_VARIANTS_SEMANTIC = [\n 'accent',\n 'informative',\n 'neutral',\n 'positive',\n 'notice',\n 'negative',\n] as const;\n\nexport const BADGE_VARIANTS_COLOR = [\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n 'gray',\n 'red',\n 'orange',\n 'chartreuse',\n 'celery',\n 'green',\n 'cyan',\n 'blue',\n 'pink',\n 'turquoise',\n 'brown',\n 'cinnamon',\n 'silver',\n] as const;\n\nexport const FIXED_VALUES = [\n 'block-start',\n 'block-end',\n 'inline-start',\n 'inline-end',\n] as const;\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// S1-ONLY (remove with 1st-gen)\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const BADGE_VARIANTS_COLOR_S1 = [\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n 'gray',\n 'red',\n 'orange',\n 'chartreuse',\n 'celery',\n 'green',\n 'cyan',\n 'blue',\n] as const satisfies readonly BadgeColorVariant[];\n\nexport const BADGE_VARIANTS_S1 = [\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR_S1,\n] as const;\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// CANONICAL\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const BADGE_VARIANTS = [\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR,\n] as const;\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// TYPES\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// Shared\nexport type FixedValues = (typeof FIXED_VALUES)[number];\nexport type BadgeSize = (typeof BADGE_VALID_SIZES)[number];\nexport type BadgeSemanticVariant = (typeof BADGE_VARIANTS_SEMANTIC)[number];\n\n// S1-only (remove with 1st-gen)\nexport type BadgeColorVariantS1 = (typeof BADGE_VARIANTS_COLOR_S1)[number]; // remove with 1st-gen\nexport type BadgeVariantS1 = (typeof BADGE_VARIANTS_S1)[number]; // remove with 1st-gen\n\n// Canonical\nexport type BadgeColorVariant = (typeof BADGE_VARIANTS_COLOR)[number];\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n"],
|
|
5
|
+
"mappings": ";AAkBO,aAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,aAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,aAAM,uBAAuB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,aAAM,eAAe;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAMO,aAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,aAAM,oBAAoB;AAAA,EAC/B,GAAG;AAAA,EACH,GAAG;AACL;AAMO,aAAM,iBAAiB;AAAA,EAC5B,GAAG;AAAA,EACH,GAAG;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";export const BADGE_VALID_SIZES=["s","m","l","xl"],BADGE_VARIANTS_SEMANTIC=["accent","informative","neutral","positive","notice","negative"],BADGE_VARIANTS_COLOR=["fuchsia","indigo","magenta","purple","seafoam","yellow","gray","red","orange","chartreuse","celery","green","cyan","blue","pink","turquoise","brown","cinnamon","silver"],FIXED_VALUES=["block-start","block-end","inline-start","inline-end"],BADGE_VARIANTS_COLOR_S1=["fuchsia","indigo","magenta","purple","seafoam","yellow","gray","red","orange","chartreuse","celery","green","cyan","blue"],BADGE_VARIANTS_S1=[...BADGE_VARIANTS_SEMANTIC,...BADGE_VARIANTS_COLOR_S1],BADGE_VARIANTS=[...BADGE_VARIANTS_SEMANTIC,...BADGE_VARIANTS_COLOR];
|
|
2
|
+
//# sourceMappingURL=Badge.types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["Badge.types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { ElementSize } from '@spectrum-web-components/base/src/sizedMixin.js';\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// SHARED\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const BADGE_VALID_SIZES = [\n 's',\n 'm',\n 'l',\n 'xl',\n] as const satisfies readonly ElementSize[];\n\nexport const BADGE_VARIANTS_SEMANTIC = [\n 'accent',\n 'informative',\n 'neutral',\n 'positive',\n 'notice',\n 'negative',\n] as const;\n\nexport const BADGE_VARIANTS_COLOR = [\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n 'gray',\n 'red',\n 'orange',\n 'chartreuse',\n 'celery',\n 'green',\n 'cyan',\n 'blue',\n 'pink',\n 'turquoise',\n 'brown',\n 'cinnamon',\n 'silver',\n] as const;\n\nexport const FIXED_VALUES = [\n 'block-start',\n 'block-end',\n 'inline-start',\n 'inline-end',\n] as const;\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// S1-ONLY (remove with 1st-gen)\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const BADGE_VARIANTS_COLOR_S1 = [\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n 'gray',\n 'red',\n 'orange',\n 'chartreuse',\n 'celery',\n 'green',\n 'cyan',\n 'blue',\n] as const satisfies readonly BadgeColorVariant[];\n\nexport const BADGE_VARIANTS_S1 = [\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR_S1,\n] as const;\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// CANONICAL\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nexport const BADGE_VARIANTS = [\n ...BADGE_VARIANTS_SEMANTIC,\n ...BADGE_VARIANTS_COLOR,\n] as const;\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// TYPES\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// Shared\nexport type FixedValues = (typeof FIXED_VALUES)[number];\nexport type BadgeSize = (typeof BADGE_VALID_SIZES)[number];\nexport type BadgeSemanticVariant = (typeof BADGE_VARIANTS_SEMANTIC)[number];\n\n// S1-only (remove with 1st-gen)\nexport type BadgeColorVariantS1 = (typeof BADGE_VARIANTS_COLOR_S1)[number]; // remove with 1st-gen\nexport type BadgeVariantS1 = (typeof BADGE_VARIANTS_S1)[number]; // remove with 1st-gen\n\n// Canonical\nexport type BadgeColorVariant = (typeof BADGE_VARIANTS_COLOR)[number];\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n"],
|
|
5
|
+
"mappings": "aAkBO,aAAM,kBAAoB,CAC/B,IACA,IACA,IACA,IACF,EAEa,wBAA0B,CACrC,SACA,cACA,UACA,WACA,SACA,UACF,EAEa,qBAAuB,CAClC,UACA,SACA,UACA,SACA,UACA,SACA,OACA,MACA,SACA,aACA,SACA,QACA,OACA,OACA,OACA,YACA,QACA,WACA,QACF,EAEa,aAAe,CAC1B,cACA,YACA,eACA,YACF,EAMa,wBAA0B,CACrC,UACA,SACA,UACA,SACA,UACA,SACA,OACA,MACA,SACA,aACA,SACA,QACA,OACA,MACF,EAEa,kBAAoB,CAC/B,GAAG,wBACH,GAAG,uBACL,EAMa,eAAiB,CAC5B,GAAG,wBACH,GAAG,oBACL",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|