@brightspot/ui 1.0.1-4 → 1.0.1-6
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/README.md +4 -33
- package/dist/LucideDynamicLoader.d.ts +5 -0
- package/dist/LucideDynamicLoader.d.ts.map +1 -0
- package/dist/LucideDynamicLoader.js +4 -3
- package/dist/LucideDynamicLoader.js.map +1 -0
- package/dist/LucideDynamicLoader.ts +3 -3
- package/dist/components/badge/Badge.d.ts +75 -0
- package/dist/components/badge/Badge.d.ts.map +1 -0
- package/dist/components/badge/Badge.js +118 -0
- package/dist/components/badge/Badge.js.map +1 -0
- package/dist/custom-elements.json +150 -0
- package/dist/global.d.ts +14 -0
- package/dist/storybook/assets/Badge.stories-IDiQBqoG.js +134 -0
- package/dist/storybook/assets/{Button.stories-Cr7Qwtjy.js → Button.stories-BJ7xYoAn.js} +1 -1
- package/dist/storybook/assets/Color-64QXVMR3-C99RDtm5.js +1 -0
- package/dist/storybook/assets/{Colors.stories-DTkJ49c0.js → Colors.stories-DHX3REQM.js} +2 -2
- package/dist/storybook/assets/Events.stories-D5Qewoi1.js +108 -0
- package/dist/storybook/assets/{Heading.stories-DAeD9lW6.js → Heading.stories-DvZpV-7f.js} +1 -1
- package/dist/storybook/assets/{Icon.stories-cnRmIS9M.js → Icon.stories-B84kg3ID.js} +1592 -9552
- package/dist/storybook/assets/Loader.stories-p7KYzS21.js +3 -0
- package/dist/storybook/assets/ReadyMixin.stories-DavcxbQ0.js +55 -0
- package/dist/storybook/assets/{ScrollShadow.stories-DPlCRYP5.js → ScrollShadow.stories-7cskWb6D.js} +1 -1
- package/dist/storybook/assets/WithTooltip-SK46ZJ2J-DKh-Y05I.js +825 -0
- package/dist/storybook/assets/formatter-OMEEQ6HG-20tmez3v.js +1 -0
- package/dist/storybook/assets/iframe-9mlxmT2J.css +1 -0
- package/dist/storybook/assets/iframe-DEAT_PRS.js +1083 -0
- package/dist/storybook/assets/index-BGllmwBL.js +1 -0
- package/dist/storybook/assets/syntaxhighlighter-CAVLW7PM-B9DN7qXL.js +6 -0
- package/dist/storybook/iframe.html +4 -4
- package/dist/storybook/index.html +2 -13
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/docs-1/manager-bundle.js +1 -149
- package/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +158 -323
- package/dist/storybook/sb-manager/globals-runtime.js +79814 -65954
- package/dist/storybook/sb-manager/globals.js +7 -16
- package/dist/storybook/sb-manager/runtime.js +15451 -9508
- package/dist/storybook/vite-inject-mocker-entry.js +1 -17
- package/dist/tailwind-plugin-badge.d.ts +2 -0
- package/dist/tailwind-plugin-badge.d.ts.map +1 -0
- package/dist/tailwind-plugin-badge.js +28 -12
- package/dist/tailwind-plugin-badge.js.map +1 -0
- package/dist/tailwind-plugin-badge.ts +34 -15
- package/dist/tailwind-plugin-button.d.ts +2 -0
- package/dist/tailwind-plugin-button.d.ts.map +1 -0
- package/dist/tailwind-plugin-button.js +2 -5
- package/dist/tailwind-plugin-button.js.map +1 -0
- package/dist/tailwind-plugin-button.ts +8 -21
- package/dist/tailwind-plugin-heading.d.ts +2 -0
- package/dist/tailwind-plugin-heading.d.ts.map +1 -0
- package/dist/tailwind-plugin-heading.js +1 -0
- package/dist/tailwind-plugin-heading.js.map +1 -0
- package/dist/tailwind-plugin-icon.d.ts +2 -0
- package/dist/tailwind-plugin-icon.d.ts.map +1 -0
- package/dist/tailwind-plugin-icon.js +8 -7
- package/dist/tailwind-plugin-icon.js.map +1 -0
- package/dist/tailwind-plugin-icon.ts +16 -25
- package/dist/tailwind-plugin-loader.d.ts +2 -0
- package/dist/tailwind-plugin-loader.d.ts.map +1 -0
- package/dist/tailwind-plugin-loader.js +1 -0
- package/dist/tailwind-plugin-loader.js.map +1 -0
- package/dist/tailwind-plugin-scroll-shadow.d.ts +2 -0
- package/dist/tailwind-plugin-scroll-shadow.d.ts.map +1 -0
- package/dist/tailwind-plugin-scroll-shadow.js +16 -1
- package/dist/tailwind-plugin-scroll-shadow.js.map +1 -0
- package/dist/tailwind-plugin-scroll-shadow.ts +33 -22
- package/dist/tailwind-plugin-theme.d.ts +2 -0
- package/dist/tailwind-plugin-theme.d.ts.map +1 -0
- package/dist/tailwind-plugin-theme.js +2 -3
- package/dist/tailwind-plugin-theme.js.map +1 -0
- package/dist/tailwind-plugin-theme.ts +4 -15
- package/dist/tailwind.config.d.ts +693 -0
- package/dist/tailwind.config.d.ts.map +1 -0
- package/dist/tailwind.config.js +2 -4
- package/dist/tailwind.config.js.map +1 -0
- package/dist/tailwind.config.ts +2 -6
- package/dist/util/string.d.ts +3 -0
- package/dist/util/string.d.ts.map +1 -0
- package/dist/util/string.js +2 -1
- package/dist/util/string.js.map +1 -0
- package/dist/util/svg.d.ts +3 -0
- package/dist/util/svg.d.ts.map +1 -0
- package/dist/util/svg.js +1 -0
- package/dist/util/svg.js.map +1 -0
- package/dist/utils/EventEmitterMixin.d.ts +53 -0
- package/dist/utils/EventEmitterMixin.d.ts.map +1 -0
- package/dist/utils/EventEmitterMixin.js +74 -0
- package/dist/utils/EventEmitterMixin.js.map +1 -0
- package/dist/utils/ReadyMixin.d.ts +31 -0
- package/dist/utils/ReadyMixin.d.ts.map +1 -0
- package/dist/utils/ReadyMixin.js +42 -0
- package/dist/utils/ReadyMixin.js.map +1 -0
- package/package.json +46 -17
- package/dist/storybook/assets/Badge.stories-BTUP8EEA.js +0 -47
- package/dist/storybook/assets/Color-AVL7NMMY-FwGGzq-S.js +0 -1
- package/dist/storybook/assets/DocsRenderer-PQXLIZUC-czZuJbjz.js +0 -1286
- package/dist/storybook/assets/Loader.stories-i7TFXki_.js +0 -7
- package/dist/storybook/assets/iframe-CgQYHqh5.css +0 -1
- package/dist/storybook/assets/iframe-KLSeZXhG.js +0 -1059
- package/dist/storybook/assets/index-Du6pvkZG.js +0 -1
- package/dist/storybook/sb-manager/globals-module-info.js +0 -797
package/README.md
CHANGED
|
@@ -168,11 +168,15 @@ For local development and testing, use `yarn link` to create a symlink between t
|
|
|
168
168
|
This registers the package globally on your system for linking.
|
|
169
169
|
|
|
170
170
|
2. **In your consuming project directory:**
|
|
171
|
+
|
|
171
172
|
```sh
|
|
172
173
|
yarn link @brightspot/ui
|
|
173
174
|
```
|
|
175
|
+
|
|
174
176
|
This creates a symlink from your project's node_modules to the brightspot-ui package.
|
|
175
177
|
|
|
178
|
+
> **_Note_** Be sure this is done in the directory where the `package.json` file resides for the CMS UI. Currently that is at `/cms/tool-ui`. You will need to validate your changes via your locally running Brightspot Tool UI Webpack server. It will not work directly over Docker's Tomcat.
|
|
179
|
+
|
|
176
180
|
#### Working with the linked package
|
|
177
181
|
|
|
178
182
|
- From within _**this**_ module, run `yarn build` to ensure the `dist` folder is updated with your changes.
|
|
@@ -245,39 +249,6 @@ docs: update installation instructions
|
|
|
245
249
|
chore(deps): upgrade tailwindcss to 3.4.0
|
|
246
250
|
```
|
|
247
251
|
|
|
248
|
-
### Publishing
|
|
249
|
-
|
|
250
|
-
#### Prerelease (Testing)
|
|
251
|
-
|
|
252
|
-
For testing changes before a full release, create a prerelease version:
|
|
253
|
-
|
|
254
|
-
```sh
|
|
255
|
-
yarn version --prerelease
|
|
256
|
-
npm publish --tag beta
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
This automatically increments the version with a prerelease identifier (e.g., `1.2.3-0`) and publishes it under the `beta` tag. Users can install prereleases with:
|
|
260
|
-
|
|
261
|
-
```sh
|
|
262
|
-
yarn add @brightspot/ui@beta
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
#### Full Release
|
|
266
|
-
|
|
267
|
-
For a production release:
|
|
268
|
-
|
|
269
|
-
```sh
|
|
270
|
-
yarn version --patch # for bug fixes
|
|
271
|
-
# or
|
|
272
|
-
yarn version --minor # for new features
|
|
273
|
-
# or
|
|
274
|
-
yarn version --major # for breaking changes
|
|
275
|
-
|
|
276
|
-
npm publish
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
The `yarn version` command automatically updates the version number in package.json and creates a git commit and tag. Choose the appropriate version bump based on the type of changes you're releasing.
|
|
280
|
-
|
|
281
252
|
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
|
282
253
|
|
|
283
254
|
## Frequently Asked Questions
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LucideDynamicLoader.d.ts","sourceRoot":"","sources":["../src/LucideDynamicLoader.ts"],"names":[],"mappings":"AAKA,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM;;;cAiBvC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as LucideIcons from 'lucide-static';
|
|
2
|
-
import icons from 'lucide-static/font/info.json';
|
|
3
|
-
import { kebabToPascal } from '
|
|
4
|
-
import { addNameSpaceXML, encodeSVG } from '
|
|
2
|
+
import icons from 'lucide-static/font/info.json' with { type: 'json' };
|
|
3
|
+
import { kebabToPascal } from './util/string.js';
|
|
4
|
+
import { addNameSpaceXML, encodeSVG } from './util/svg.js';
|
|
5
5
|
export function getIcon(iconName) {
|
|
6
6
|
try {
|
|
7
7
|
const kebabName = iconName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
@@ -19,3 +19,4 @@ export function getIcon(iconName) {
|
|
|
19
19
|
console.error('Error loading Lucide icon ${iconName}:', e);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
//# sourceMappingURL=LucideDynamicLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LucideDynamicLoader.js","sourceRoot":"","sources":["../src/LucideDynamicLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,MAAM,8BAA8B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE1D,MAAM,UAAU,OAAO,CAAC,QAAgB;IACtC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAA;QAC5E,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAA;QAE3C,IAAI,WAAW,CAAC,UAAsC,CAAC,EAAE,CAAC;YACxD,MAAM,GAAG,GAAG,WAAW,CAAC,UAAsC,CAAW,CAAA;YACzE,MAAM,UAAU,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAA;YAElD,OAAO;gBACL,MAAM,EAAE,KAAK,CAAC,SAA+B,CAAC,EAAE,WAAW,IAAI,EAAE;gBACjE,OAAO,EAAE,UAAU;aACpB,CAAA;QACH,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAA;IAC5D,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as LucideIcons from 'lucide-static'
|
|
2
|
-
import icons from 'lucide-static/font/info.json'
|
|
3
|
-
import { kebabToPascal } from '
|
|
4
|
-
import { addNameSpaceXML, encodeSVG } from '
|
|
2
|
+
import icons from 'lucide-static/font/info.json' with { type: 'json' }
|
|
3
|
+
import { kebabToPascal } from './util/string.js'
|
|
4
|
+
import { addNameSpaceXML, encodeSVG } from './util/svg.js'
|
|
5
5
|
|
|
6
6
|
export function getIcon(iconName: string) {
|
|
7
7
|
try {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export interface BadgeProps {
|
|
3
|
+
variant?: 'info' | 'primary' | 'error' | 'success' | 'warning';
|
|
4
|
+
dot?: boolean;
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
|
+
}
|
|
7
|
+
declare const Badge_base: (new (...args: any[]) => import("../../utils/EventEmitterMixin.js").EventEmitterMixinInterface) & (new (...args: any[]) => import("../../utils/ReadyMixin.js").ReadyMixinInterface) & typeof LitElement;
|
|
8
|
+
/**
|
|
9
|
+
* A badge component for highlighting important information.
|
|
10
|
+
*
|
|
11
|
+
* Badges help highlight notifications, status, or new messages.
|
|
12
|
+
* Primarily used for communicating secondary or additional information.
|
|
13
|
+
*
|
|
14
|
+
* @element btu-badge
|
|
15
|
+
*
|
|
16
|
+
* @fires {CustomEvent} btu-badge-ready - Fired after first render and initialization
|
|
17
|
+
*
|
|
18
|
+
* @cssprop --badge-color-foreground - Text color (overrides theme color)
|
|
19
|
+
* @cssprop --badge-color-background - Background color (overrides theme color)
|
|
20
|
+
* @cssprop --badge-radius-size - Border radius size (overrides shape default, default: 999px)
|
|
21
|
+
* @cssprop --badge-px - Horizontal padding (overrides size default)
|
|
22
|
+
* @cssprop --badge-py - Vertical padding (overrides size default)
|
|
23
|
+
* @cssprop --badge-dot-size - Size of the dot affordance (default: 6px)
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```html
|
|
27
|
+
* <!-- Badge with dot -->
|
|
28
|
+
* <btu-badge variant="info" size="sm" dot>New</btu-badge>
|
|
29
|
+
*
|
|
30
|
+
* <!-- Badge with icon -->
|
|
31
|
+
* <btu-badge variant="success" size="md">
|
|
32
|
+
* <btu-icon symbol="check"></btu-icon>
|
|
33
|
+
* Success
|
|
34
|
+
* </btu-badge>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export default class Badge extends Badge_base {
|
|
38
|
+
/**
|
|
39
|
+
* Style of the badge.
|
|
40
|
+
* - 'info': Informational (default)
|
|
41
|
+
* - 'primary': Primary action or emphasis
|
|
42
|
+
* - 'error': Error or danger state
|
|
43
|
+
* - 'success': Success or completion state
|
|
44
|
+
* - 'warning': Warning or caution state
|
|
45
|
+
* @attr
|
|
46
|
+
*/
|
|
47
|
+
variant: 'info' | 'primary' | 'error' | 'success' | 'warning';
|
|
48
|
+
/**
|
|
49
|
+
* Should a dot be displayed before the label?
|
|
50
|
+
* @attr
|
|
51
|
+
*/
|
|
52
|
+
dot: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Size variant.
|
|
55
|
+
* - 'sm': Small (default)
|
|
56
|
+
* - 'md': Medium
|
|
57
|
+
* - 'lg': Large
|
|
58
|
+
* @attr
|
|
59
|
+
*/
|
|
60
|
+
size: string;
|
|
61
|
+
/** @internal */
|
|
62
|
+
private initialClasses;
|
|
63
|
+
connectedCallback(): void;
|
|
64
|
+
createRenderRoot(): this;
|
|
65
|
+
willUpdate(): void;
|
|
66
|
+
firstUpdated(): void;
|
|
67
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
68
|
+
}
|
|
69
|
+
declare global {
|
|
70
|
+
interface HTMLElementTagNameMap {
|
|
71
|
+
'btu-badge': Badge;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/badge/Badge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAA;AAKtC,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;IAC9D,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B;;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,UAAyC;IAC1E;;;;;;;;OAQG;IAEH,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAS;IAEtE;;;OAGG;IAEH,GAAG,UAAQ;IAEX;;;;;;OAMG;IAEH,IAAI,SAAO;IAEX,gBAAgB;IAChB,OAAO,CAAC,cAAc,CAAe;IAErC,iBAAiB,IAAI,IAAI;IAQzB,gBAAgB;IAIhB,UAAU,IAAI,IAAI;IAqBlB,YAAY,IAAI,IAAI;IAIpB,MAAM;CAGP;AAQD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,KAAK,CAAA;KACnB;CACF"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { EventEmitterMixin } from '../../utils/EventEmitterMixin.js';
|
|
10
|
+
import { ReadyMixin } from '../../utils/ReadyMixin.js';
|
|
11
|
+
/**
|
|
12
|
+
* A badge component for highlighting important information.
|
|
13
|
+
*
|
|
14
|
+
* Badges help highlight notifications, status, or new messages.
|
|
15
|
+
* Primarily used for communicating secondary or additional information.
|
|
16
|
+
*
|
|
17
|
+
* @element btu-badge
|
|
18
|
+
*
|
|
19
|
+
* @fires {CustomEvent} btu-badge-ready - Fired after first render and initialization
|
|
20
|
+
*
|
|
21
|
+
* @cssprop --badge-color-foreground - Text color (overrides theme color)
|
|
22
|
+
* @cssprop --badge-color-background - Background color (overrides theme color)
|
|
23
|
+
* @cssprop --badge-radius-size - Border radius size (overrides shape default, default: 999px)
|
|
24
|
+
* @cssprop --badge-px - Horizontal padding (overrides size default)
|
|
25
|
+
* @cssprop --badge-py - Vertical padding (overrides size default)
|
|
26
|
+
* @cssprop --badge-dot-size - Size of the dot affordance (default: 6px)
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <!-- Badge with dot -->
|
|
31
|
+
* <btu-badge variant="info" size="sm" dot>New</btu-badge>
|
|
32
|
+
*
|
|
33
|
+
* <!-- Badge with icon -->
|
|
34
|
+
* <btu-badge variant="success" size="md">
|
|
35
|
+
* <btu-icon symbol="check"></btu-icon>
|
|
36
|
+
* Success
|
|
37
|
+
* </btu-badge>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export default class Badge extends EventEmitterMixin(ReadyMixin(LitElement)) {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
/**
|
|
44
|
+
* Style of the badge.
|
|
45
|
+
* - 'info': Informational (default)
|
|
46
|
+
* - 'primary': Primary action or emphasis
|
|
47
|
+
* - 'error': Error or danger state
|
|
48
|
+
* - 'success': Success or completion state
|
|
49
|
+
* - 'warning': Warning or caution state
|
|
50
|
+
* @attr
|
|
51
|
+
*/
|
|
52
|
+
this.variant = 'info';
|
|
53
|
+
/**
|
|
54
|
+
* Should a dot be displayed before the label?
|
|
55
|
+
* @attr
|
|
56
|
+
*/
|
|
57
|
+
this.dot = false;
|
|
58
|
+
/**
|
|
59
|
+
* Size variant.
|
|
60
|
+
* - 'sm': Small (default)
|
|
61
|
+
* - 'md': Medium
|
|
62
|
+
* - 'lg': Large
|
|
63
|
+
* @attr
|
|
64
|
+
*/
|
|
65
|
+
this.size = 'sm';
|
|
66
|
+
/** @internal */
|
|
67
|
+
this.initialClasses = [];
|
|
68
|
+
}
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
super.connectedCallback();
|
|
71
|
+
// Capture initial classes from backend HTML
|
|
72
|
+
if (this.className) {
|
|
73
|
+
this.initialClasses = this.className.split(' ').filter(c => c.trim());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
createRenderRoot() {
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
willUpdate() {
|
|
80
|
+
// Map variant to theme color (info → gray)
|
|
81
|
+
const colorMap = {
|
|
82
|
+
info: 'gray',
|
|
83
|
+
primary: 'primary',
|
|
84
|
+
error: 'error',
|
|
85
|
+
success: 'success',
|
|
86
|
+
warning: 'warning',
|
|
87
|
+
};
|
|
88
|
+
const classes = [
|
|
89
|
+
...this.initialClasses,
|
|
90
|
+
'btu-badge',
|
|
91
|
+
`btu-badge-${this.size}`,
|
|
92
|
+
`btu-badge-${colorMap[this.variant]}`,
|
|
93
|
+
this.dot ? 'btu-badge-dot' : '',
|
|
94
|
+
];
|
|
95
|
+
this.className = classes.filter(Boolean).join(' ');
|
|
96
|
+
}
|
|
97
|
+
firstUpdated() {
|
|
98
|
+
this.emit('btu-badge-ready');
|
|
99
|
+
}
|
|
100
|
+
render() {
|
|
101
|
+
return html ``;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: String })
|
|
106
|
+
], Badge.prototype, "variant", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: Boolean })
|
|
109
|
+
], Badge.prototype, "dot", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: String })
|
|
112
|
+
], Badge.prototype, "size", void 0);
|
|
113
|
+
// Register custom element with guard to prevent double registration
|
|
114
|
+
// (common with yarn link, HMR, or webpack bundle duplication)
|
|
115
|
+
if (!customElements.get('btu-badge')) {
|
|
116
|
+
customElements.define('btu-badge', Badge);
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../src/components/badge/Badge.ts"],"names":[],"mappings":";;;;;;AAAA,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ACrC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE;SAChC,CAAA;QAED,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpD,CAAC;IAED,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA,EAAE,CAAA;IACf,CAAC;CACF;AA9DC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAC2C;AAOtE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kCACjB;AAUX;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mCAChB;AA+Cb,oEAAoE;AACpE,8DAA8D;AAC9D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;IACrC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/components/badge/Badge.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "class",
|
|
11
|
+
"description": "A badge component for highlighting important information.\n\nBadges help highlight notifications, status, or new messages.\nPrimarily used for communicating secondary or additional information.",
|
|
12
|
+
"name": "Badge",
|
|
13
|
+
"cssProperties": [
|
|
14
|
+
{
|
|
15
|
+
"description": "Text color (overrides theme color)",
|
|
16
|
+
"name": "--badge-color-foreground"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"description": "Background color (overrides theme color)",
|
|
20
|
+
"name": "--badge-color-background"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"description": "Border radius size (overrides shape default, default: 999px)",
|
|
24
|
+
"name": "--badge-radius-size"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"description": "Horizontal padding (overrides size default)",
|
|
28
|
+
"name": "--badge-px"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"description": "Vertical padding (overrides size default)",
|
|
32
|
+
"name": "--badge-py"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"description": "Size of the dot affordance (default: 6px)",
|
|
36
|
+
"name": "--badge-dot-size"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"members": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "field",
|
|
42
|
+
"name": "variant",
|
|
43
|
+
"type": {
|
|
44
|
+
"text": "'info' | 'primary' | 'error' | 'success' | 'warning'"
|
|
45
|
+
},
|
|
46
|
+
"default": "'info'",
|
|
47
|
+
"description": "Style of the badge.\n- 'info': Informational (default)\n- 'primary': Primary action or emphasis\n- 'error': Error or danger state\n- 'success': Success or completion state\n- 'warning': Warning or caution state",
|
|
48
|
+
"attribute": "variant"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "field",
|
|
52
|
+
"name": "dot",
|
|
53
|
+
"type": {
|
|
54
|
+
"text": "boolean"
|
|
55
|
+
},
|
|
56
|
+
"default": "false",
|
|
57
|
+
"description": "Should a dot be displayed before the label?",
|
|
58
|
+
"attribute": "dot"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"kind": "field",
|
|
62
|
+
"name": "size",
|
|
63
|
+
"type": {
|
|
64
|
+
"text": "string"
|
|
65
|
+
},
|
|
66
|
+
"default": "'sm'",
|
|
67
|
+
"description": "Size variant.\n- 'sm': Small (default)\n- 'md': Medium\n- 'lg': Large",
|
|
68
|
+
"attribute": "size"
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
"events": [
|
|
72
|
+
{
|
|
73
|
+
"type": {
|
|
74
|
+
"text": "CustomEvent"
|
|
75
|
+
},
|
|
76
|
+
"description": "Fired after first render and initialization",
|
|
77
|
+
"name": "btu-badge-ready"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"attributes": [
|
|
81
|
+
{
|
|
82
|
+
"name": "variant",
|
|
83
|
+
"type": {
|
|
84
|
+
"text": "'info' | 'primary' | 'error' | 'success' | 'warning'"
|
|
85
|
+
},
|
|
86
|
+
"default": "'info'",
|
|
87
|
+
"description": "Style of the badge.\n- 'info': Informational (default)\n- 'primary': Primary action or emphasis\n- 'error': Error or danger state\n- 'success': Success or completion state\n- 'warning': Warning or caution state",
|
|
88
|
+
"fieldName": "variant",
|
|
89
|
+
"attribute": "variant"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "dot",
|
|
93
|
+
"type": {
|
|
94
|
+
"text": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"default": "false",
|
|
97
|
+
"description": "Should a dot be displayed before the label?",
|
|
98
|
+
"fieldName": "dot",
|
|
99
|
+
"attribute": "dot"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "size",
|
|
103
|
+
"type": {
|
|
104
|
+
"text": "string"
|
|
105
|
+
},
|
|
106
|
+
"default": "'sm'",
|
|
107
|
+
"description": "Size variant.\n- 'sm': Small (default)\n- 'md': Medium\n- 'lg': Large",
|
|
108
|
+
"fieldName": "size",
|
|
109
|
+
"attribute": "size"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"mixins": [
|
|
113
|
+
{
|
|
114
|
+
"name": "EventEmitterMixin",
|
|
115
|
+
"module": "/src/utils/EventEmitterMixin.js"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "ReadyMixin",
|
|
119
|
+
"module": "/src/utils/ReadyMixin.js"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"superclass": {
|
|
123
|
+
"name": "LitElement",
|
|
124
|
+
"package": "lit"
|
|
125
|
+
},
|
|
126
|
+
"tagName": "btu-badge",
|
|
127
|
+
"customElement": true
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"exports": [
|
|
131
|
+
{
|
|
132
|
+
"kind": "js",
|
|
133
|
+
"name": "default",
|
|
134
|
+
"declaration": {
|
|
135
|
+
"name": "Badge",
|
|
136
|
+
"module": "src/components/badge/Badge.ts"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"kind": "custom-element-definition",
|
|
141
|
+
"name": "btu-badge",
|
|
142
|
+
"declaration": {
|
|
143
|
+
"name": "Badge",
|
|
144
|
+
"module": "src/components/badge/Badge.ts"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
package/dist/global.d.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import{g as c,x as s}from"./iframe-DEAT_PRS.js";import"./preload-helper-PPVm8Dsz.js";const{events:d,args:l,argTypes:o}=c("btu-badge"),g=["info","primary","error","success","warning"],u={title:"Components/Badge",component:"btu-badge",tags:["autodocs"],parameters:{docs:{subtitle:"A component for highlighting important information",description:{component:`
|
|
2
|
+
<h3>When to use:</h3>
|
|
3
|
+
<ul>
|
|
4
|
+
<li>To call attention to something</li>
|
|
5
|
+
<li>For presenting status</li>
|
|
6
|
+
<li>For anything longer than a very short number</li>
|
|
7
|
+
</ul>
|
|
8
|
+
|
|
9
|
+
<h3>When not to use:</h3>
|
|
10
|
+
<ul>
|
|
11
|
+
<li>For very short numbers. Instead use a notification</li>
|
|
12
|
+
<li>For circled notifications</li>
|
|
13
|
+
</ul>
|
|
14
|
+
`}},actions:{handles:d},controls:{expanded:!0}},args:{...l,variant:"success",dot:!1,size:"sm"},argTypes:{...o,"--badge-color-foreground":{table:{disable:!0}},"--badge-color-background":{table:{disable:!0}},"--badge-radius-size":{table:{disable:!0}},"--badge-px":{table:{disable:!0}},"--badge-py":{table:{disable:!0}},"--badge-dot-size":{table:{disable:!0}},variant:{...o.variant,control:{type:"select"},options:g},dot:{...o.dot,control:{type:"boolean"}},size:{...o.size,control:{type:"select"},options:["sm","md","lg"]},customBackgroundColor:{name:"--badge-color-background",control:{type:"color"},description:"Custom background color - overrides the theme color",table:{category:"CSS Properties"}},customForegroundColor:{name:"--badge-color-foreground",control:{type:"color"},description:"Custom foreground (text) color - overrides the theme color",table:{category:"CSS Properties"}},customRadiusSize:{name:"--badge-radius-size",control:{type:"text"},description:"Custom border radius size - overrides the shape default (default: 999px)",table:{category:"CSS Properties"}},customPadX:{name:"--badge-px",control:{type:"text"},description:"Horizontal padding - overrides the size default",table:{category:"CSS Properties"}},customPadY:{name:"--badge-py",control:{type:"text"},description:"Vertical padding - overrides the size default",table:{category:"CSS Properties"}},customDotSize:{name:"--badge-dot-size",control:{type:"text"},description:"Size of the dot affordance (default: 6px)",table:{category:"CSS Properties"}}},render:e=>{const a=[];e.customBackgroundColor&&a.push(`--badge-color-background: ${e.customBackgroundColor}`),e.customForegroundColor&&a.push(`--badge-color-foreground: ${e.customForegroundColor}`),e.customRadiusSize&&a.push(`--badge-radius-size: ${e.customRadiusSize}`),e.customPadX&&a.push(`--badge-px: ${e.customPadX}`),e.customPadY&&a.push(`--badge-py: ${e.customPadY}`),e.customDotSize&&a.push(`--badge-dot-size: ${e.customDotSize}`);const n=a.length>0?a.join("; "):"";return s`<btu-badge variant="${e.variant}" ?dot="${e.dot}" size="${e.size}" style="${n}"
|
|
15
|
+
>Badge</btu-badge
|
|
16
|
+
>`}},i={args:{}},t={args:{variant:"success",size:"lg"},render:e=>s`<a href="#" class="hover:text-primary inline-flex items-center gap-2 hover:underline">
|
|
17
|
+
Hover over me to see the
|
|
18
|
+
<btu-badge variant="${e.variant}" size="${e.size}">Linked Badge</btu-badge>
|
|
19
|
+
in action.
|
|
20
|
+
</a>`,parameters:{docs:{description:{story:"Badges inside anchor elements automatically handle underlines properly. The underline uses the badge background color instead of the default link color, ensuring proper visual hierarchy when badges are used within linked elements."}}}},r={render:()=>s`<div class="flex flex-col gap-4">
|
|
21
|
+
<div class="flex items-center gap-2">
|
|
22
|
+
<strong>With Icon:</strong>
|
|
23
|
+
<btu-badge variant="warning" size="md">
|
|
24
|
+
<div
|
|
25
|
+
aria-label="warning icon"
|
|
26
|
+
class="before:btu-icon before:btu-icon-md before:btu-icon-triangle-alert"
|
|
27
|
+
></div>
|
|
28
|
+
Warning
|
|
29
|
+
</btu-badge>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="flex items-center gap-2">
|
|
32
|
+
<strong>With Image:</strong>
|
|
33
|
+
<btu-badge variant="primary" size="md">
|
|
34
|
+
<div
|
|
35
|
+
class="-ms-[--badge-px] aspect-square w-[20px] bg-cover bg-center bg-no-repeat [clipPath:circle(50%_at_center)]"
|
|
36
|
+
style="background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjM1IDY1MCIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KPGRlZnM+DQo8ZyBpZD0idW5pb24iPg0KPHVzZSB5PSItLjIxNiIgeGxpbms6aHJlZj0iI3g0Ii8+DQo8dXNlIHhsaW5rOmhyZWY9IiN4NCIvPg0KPHVzZSB5PSIuMjE2IiB4bGluazpocmVmPSIjczYiLz4NCjwvZz4NCjxnIGlkPSJ4NCI+DQo8dXNlIHhsaW5rOmhyZWY9IiNzNiIvPg0KPHVzZSB5PSIuMDU0IiB4bGluazpocmVmPSIjczUiLz4NCjx1c2UgeT0iLjEwOCIgeGxpbms6aHJlZj0iI3M2Ii8+DQo8dXNlIHk9Ii4xNjIiIHhsaW5rOmhyZWY9IiNzNSIvPg0KPC9nPg0KPGcgaWQ9InM1Ij4NCjx1c2UgeD0iLS4yNTIiIHhsaW5rOmhyZWY9IiN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wZSIvPg0KPHVzZSB5PSIyMDAiIHhsaW5rOmhyZWY9IiNzdHJpcGUiLz4NCjx1c2UgeT0iMzAwIiB4bGluazpocmVmPSIjc3RyaXBlIi8+DQo8dXNlIHk9IjQwMCIgeGxpbms6aHJlZj0iI3N0cmlwZSIvPg0KPHVzZSB5PSI1MDAiIHhsaW5rOmhyZWY9IiNzdHJpcGUiLz4NCjx1c2UgeT0iNjAwIiB4bGluazpocmVmPSIjc3RyaXBlIi8+DQo8cGF0aCBmaWxsPSIjMDAyODY4IiBkPSJtMCwwaDQ5NHYzNTBoLTQ5NHoiLz4NCjx1c2UgeGxpbms6aHJlZj0iI3VuaW9uIiB0cmFuc2Zvcm09Im1hdHJpeCg2NTAgMCAwIDY1MCAyNDcgMTc1KSIvPg0KPC9zdmc+DQo=')"
|
|
37
|
+
aria-label="Flag"
|
|
38
|
+
></div>
|
|
39
|
+
United States
|
|
40
|
+
</btu-badge>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="flex items-center gap-2">
|
|
43
|
+
<strong>Rectangular Shape:</strong>
|
|
44
|
+
<btu-badge variant="success" size="md" style="--badge-radius-size: 0px">Rectangle</btu-badge>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="story-custom-colors flex items-center gap-2">
|
|
47
|
+
<strong>Custom Colors:</strong>
|
|
48
|
+
<btu-badge
|
|
49
|
+
dot
|
|
50
|
+
variant="primary"
|
|
51
|
+
size="lg"
|
|
52
|
+
style="--badge-color-background: oklch(70% 0.3 var(--hue)); --badge-color-foreground: oklch(95% 0.1 calc(-1 * var(--hue)));"
|
|
53
|
+
>Custom Badge</btu-badge
|
|
54
|
+
>
|
|
55
|
+
</div>
|
|
56
|
+
</div>`,parameters:{docs:{description:{story:`
|
|
57
|
+
Badges support advanced customization through CSS properties and content composition:
|
|
58
|
+
|
|
59
|
+
**With Icons and Images:** Place icon or image elements inside the badge along with your label text. Visual elements should always be placed before the label text.
|
|
60
|
+
|
|
61
|
+
**Custom Shape:** The badge shape defaults to pill (rounded), but can be made rectangular by setting \`--badge-radius-size: 0px\`.
|
|
62
|
+
|
|
63
|
+
**Custom Colors:** Override theme colors using \`--badge-color-background\` and \`--badge-color-foreground\` CSS properties. The foreground color controls the text color (and any child elements that inherit text color, such as the dot and icons). The background color controls the badge's background fill.`}}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
64
|
+
args: {}
|
|
65
|
+
}`,...i.parameters?.docs?.source}}};t.parameters={...t.parameters,docs:{...t.parameters?.docs,source:{originalSource:`{
|
|
66
|
+
args: {
|
|
67
|
+
variant: 'success',
|
|
68
|
+
size: 'lg'
|
|
69
|
+
},
|
|
70
|
+
render: args => html\`<a href="#" class="hover:text-primary inline-flex items-center gap-2 hover:underline">
|
|
71
|
+
Hover over me to see the
|
|
72
|
+
<btu-badge variant="\${args.variant}" size="\${args.size}">Linked Badge</btu-badge>
|
|
73
|
+
in action.
|
|
74
|
+
</a>\`,
|
|
75
|
+
parameters: {
|
|
76
|
+
docs: {
|
|
77
|
+
description: {
|
|
78
|
+
story: \`Badges inside anchor elements automatically handle underlines properly. The underline uses the badge background color instead of the default link color, ensuring proper visual hierarchy when badges are used within linked elements.\`
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}`,...t.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
83
|
+
render: () => html\`<div class="flex flex-col gap-4">
|
|
84
|
+
<div class="flex items-center gap-2">
|
|
85
|
+
<strong>With Icon:</strong>
|
|
86
|
+
<btu-badge variant="warning" size="md">
|
|
87
|
+
<div
|
|
88
|
+
aria-label="warning icon"
|
|
89
|
+
class="before:btu-icon before:btu-icon-md before:btu-icon-triangle-alert"
|
|
90
|
+
></div>
|
|
91
|
+
Warning
|
|
92
|
+
</btu-badge>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="flex items-center gap-2">
|
|
95
|
+
<strong>With Image:</strong>
|
|
96
|
+
<btu-badge variant="primary" size="md">
|
|
97
|
+
<div
|
|
98
|
+
class="-ms-[--badge-px] aspect-square w-[20px] bg-cover bg-center bg-no-repeat [clipPath:circle(50%_at_center)]"
|
|
99
|
+
style="background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMjM1IDY1MCIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPg0KPGRlZnM+DQo8ZyBpZD0idW5pb24iPg0KPHVzZSB5PSItLjIxNiIgeGxpbms6aHJlZj0iI3g0Ii8+DQo8dXNlIHhsaW5rOmhyZWY9IiN4NCIvPg0KPHVzZSB5PSIuMjE2IiB4bGluazpocmVmPSIjczYiLz4NCjwvZz4NCjxnIGlkPSJ4NCI+DQo8dXNlIHhsaW5rOmhyZWY9IiNzNiIvPg0KPHVzZSB5PSIuMDU0IiB4bGluazpocmVmPSIjczUiLz4NCjx1c2UgeT0iLjEwOCIgeGxpbms6aHJlZj0iI3M2Ii8+DQo8dXNlIHk9Ii4xNjIiIHhsaW5rOmhyZWY9IiNzNSIvPg0KPC9nPg0KPGcgaWQ9InM1Ij4NCjx1c2UgeD0iLS4yNTIiIHhsaW5rOmhyZWY9IiNzdGFyIi8+DQo8dXNlIHg9Ii0uMTI2IiB4bGluazpocmVmPSIjc3RhciIvPg0KPHVzZSB4bGluazpocmVmPSIjc3RhciIvPg0KPHVzZSB4PSIuMTI2IiB4bGluazpocmVmPSIjc3RhciIvPg0KPHVzZSB4PSIuMjUyIiB4bGluazpocmVmPSIjc3RhciIvPg0KPC9nPg0KPGcgaWQ9InM2Ij4NCjx1c2UgeD0iLS4wNjMiIHhsaW5rOmhyZWY9IiNzNSIvPg0KPHVzZSB4PSIuMzE1IiB4bGluazpocmVmPSIjc3RhciIvPg0KPC9nPg0KPGcgaWQ9InN0YXIiPg0KPHVzZSB4bGluazpocmVmPSIjcHQ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mFuc2Zvcm09Im1hdHJpeCg2NTAgMCAwIDY1MCAyNDcgMTc1KSIvPg0KPC9zdmc+DQo=')"
|
|
100
|
+
aria-label="Flag"
|
|
101
|
+
></div>
|
|
102
|
+
United States
|
|
103
|
+
</btu-badge>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="flex items-center gap-2">
|
|
106
|
+
<strong>Rectangular Shape:</strong>
|
|
107
|
+
<btu-badge variant="success" size="md" style="--badge-radius-size: 0px">Rectangle</btu-badge>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="story-custom-colors flex items-center gap-2">
|
|
110
|
+
<strong>Custom Colors:</strong>
|
|
111
|
+
<btu-badge
|
|
112
|
+
dot
|
|
113
|
+
variant="primary"
|
|
114
|
+
size="lg"
|
|
115
|
+
style="--badge-color-background: oklch(70% 0.3 var(--hue)); --badge-color-foreground: oklch(95% 0.1 calc(-1 * var(--hue)));"
|
|
116
|
+
>Custom Badge</btu-badge
|
|
117
|
+
>
|
|
118
|
+
</div>
|
|
119
|
+
</div>\`,
|
|
120
|
+
parameters: {
|
|
121
|
+
docs: {
|
|
122
|
+
description: {
|
|
123
|
+
story: \`
|
|
124
|
+
Badges support advanced customization through CSS properties and content composition:
|
|
125
|
+
|
|
126
|
+
**With Icons and Images:** Place icon or image elements inside the badge along with your label text. Visual elements should always be placed before the label text.
|
|
127
|
+
|
|
128
|
+
**Custom Shape:** The badge shape defaults to pill (rounded), but can be made rectangular by setting \\\`--badge-radius-size: 0px\\\`.
|
|
129
|
+
|
|
130
|
+
**Custom Colors:** Override theme colors using \\\`--badge-color-background\\\` and \\\`--badge-color-foreground\\\` CSS properties. The foreground color controls the text color (and any child elements that inherit text color, such as the dot and icons). The background color controls the badge's background fill.\`
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}`,...r.parameters?.docs?.source}}};const b=["Default","InsideAnchor","AdvancedUsage"];export{r as AdvancedUsage,i as Default,t as InsideAnchor,b as __namedExportsOrder,u as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as v}from"./iframe-
|
|
1
|
+
import{x as v}from"./iframe-DEAT_PRS.js";import"./preload-helper-PPVm8Dsz.js";const I=({color:r="primary",pressed:a,fill:i,contained:c,outlined:l,size:d="sm",label:u,icon:b,hideText:p,disabled:m})=>{const g=i?"":"btu-button-fill-none",y=c?"":"btu-button-container-none",h=l?"btu-button-outline":"",f=p?"btu-button-text-hidden":"",x=b?["before:btu-icon","before:btu-icon-smile"]:[];return v`
|
|
2
2
|
<button
|
|
3
3
|
type="button"
|
|
4
4
|
class=${["btu-button",`btu-button-${r}`,`btu-button-${d}`,g,y,h,f,...x].join(" ")}
|