bromcom-ui-next 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bromcom-ui/bromcom-ui.esm.js +1 -1
- package/dist/bromcom-ui/bromcom-ui.esm.js.map +1 -1
- package/dist/bromcom-ui/global/global.js +14 -15
- package/dist/bromcom-ui/p-04f6d730.entry.js +2 -0
- package/dist/bromcom-ui/p-04f6d730.entry.js.map +1 -0
- package/dist/bromcom-ui/{p-b36f4f44.js → p-12360e4c.js} +1 -1
- package/dist/bromcom-ui/p-15fe392b.js +3 -0
- package/dist/bromcom-ui/p-15fe392b.js.map +1 -0
- package/dist/bromcom-ui/p-1b11150b.entry.js +2 -0
- package/dist/bromcom-ui/{p-6430a887.entry.js.map → p-1b11150b.entry.js.map} +1 -1
- package/dist/bromcom-ui/p-1d86c1cf.entry.js +2 -0
- package/dist/bromcom-ui/p-1d86c1cf.entry.js.map +1 -0
- package/dist/bromcom-ui/p-31354aaa.js +2 -0
- package/dist/bromcom-ui/p-31354aaa.js.map +1 -0
- package/dist/bromcom-ui/p-3b607038.entry.js +2 -0
- package/dist/bromcom-ui/p-3b607038.entry.js.map +1 -0
- package/dist/bromcom-ui/p-5d0838e9.entry.js +2 -0
- package/dist/bromcom-ui/{p-bde58312.entry.js.map → p-5d0838e9.entry.js.map} +1 -1
- package/dist/bromcom-ui/p-729a870f.js +2 -0
- package/dist/bromcom-ui/p-729a870f.js.map +1 -0
- package/dist/bromcom-ui/p-a590f793.entry.js +2 -0
- package/dist/bromcom-ui/p-a590f793.entry.js.map +1 -0
- package/dist/bromcom-ui/p-cd437280.entry.js +2 -0
- package/dist/bromcom-ui/p-cd437280.entry.js.map +1 -0
- package/dist/bromcom-ui/{p-dcc13a55.entry.js → p-dcea8d62.entry.js} +2 -2
- package/dist/bromcom-ui/{p-3805363a.entry.js → p-ebed10d5.entry.js} +2 -2
- package/dist/cjs/app-globals-29edfda4.js +39 -0
- package/dist/cjs/app-globals-29edfda4.js.map +1 -0
- package/dist/cjs/bcm-accordion-group.cjs.entry.js +3 -3
- package/dist/cjs/bcm-accordion-group.cjs.entry.js.map +1 -1
- package/dist/cjs/bcm-accordion.cjs.entry.js +7 -7
- package/dist/cjs/bcm-accordion.cjs.entry.js.map +1 -1
- package/dist/cjs/bcm-alert.cjs.entry.js +1 -1
- package/dist/cjs/bcm-avatar_4.cjs.entry.js +577 -0
- package/dist/cjs/bcm-avatar_4.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-chip.cjs.entry.js +4 -4
- package/dist/cjs/bcm-chip.cjs.entry.js.map +1 -1
- package/dist/cjs/bcm-divider.cjs.entry.js +81 -0
- package/dist/cjs/bcm-divider.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-input.cjs.entry.js +313 -0
- package/dist/cjs/bcm-input.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-text.cjs.entry.js +3 -3
- package/dist/cjs/bcm-text.cjs.entry.js.map +1 -1
- package/dist/cjs/bcm-textarea.cjs.entry.js +316 -0
- package/dist/cjs/bcm-textarea.cjs.entry.js.map +1 -0
- package/dist/cjs/bromcom-ui.cjs.js +3 -3
- package/dist/cjs/{index-c36002ae.js → index-4795c073.js} +13 -4
- package/dist/cjs/index-4795c073.js.map +1 -0
- package/dist/{components/p-b36f4f44.js → cjs/index-5a88e57b.js} +5 -3
- package/dist/cjs/{index-a4eea4bb.js.map → index-5a88e57b.js.map} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/validation-messages-c36e5c31.js +134 -0
- package/dist/cjs/validation-messages-c36e5c31.js.map +1 -0
- package/dist/collection/collection-manifest.json +5 -1
- package/dist/collection/components/accordion/accordion.component.js +5 -5
- package/dist/collection/components/accordion/accordion.component.js.map +1 -1
- package/dist/collection/components/accordion/accordion.css +1 -1
- package/dist/collection/components/accordion-group/accordion-group.component.js +1 -1
- package/dist/collection/components/accordion-group/accordion-group.component.js.map +1 -1
- package/dist/collection/components/accordion-group/accordion-group.css +1 -1
- package/dist/collection/components/avatar/avatar.component.js.map +1 -1
- package/dist/collection/components/avatar/avatar.css +1 -1
- package/dist/collection/components/badge/badge.component.js +373 -0
- package/dist/collection/components/badge/badge.component.js.map +1 -0
- package/dist/collection/components/badge/badge.css +1 -0
- package/dist/collection/components/basic-badge/basic-badge.component.js +236 -0
- package/dist/collection/components/basic-badge/basic-badge.component.js.map +1 -0
- package/dist/collection/components/basic-badge/basic-badge.css +1 -0
- package/dist/collection/components/button/button.component.js +2 -2
- package/dist/collection/components/button/button.css +1 -1
- package/dist/collection/components/chip/chip.component.js +2 -2
- package/dist/collection/components/chip/chip.component.js.map +1 -1
- package/dist/collection/components/chip/chip.css +1 -1
- package/dist/collection/components/divider/divider.component.js +190 -0
- package/dist/collection/components/divider/divider.component.js.map +1 -0
- package/dist/collection/components/divider/divider.css +1 -0
- package/dist/collection/components/input/input.component.js +209 -24
- package/dist/collection/components/input/input.component.js.map +1 -1
- package/dist/collection/components/input/input.css +1 -1
- package/dist/collection/components/input/types.js +10 -1
- package/dist/collection/components/input/types.js.map +1 -1
- package/dist/collection/components/text/text.component.js +1 -1
- package/dist/collection/components/textarea/textarea.component.js +1013 -0
- package/dist/collection/components/textarea/textarea.component.js.map +1 -0
- package/dist/collection/components/textarea/textarea.css +2 -0
- package/dist/collection/components/textarea/types.js +2 -0
- package/dist/collection/components/textarea/types.js.map +1 -0
- package/dist/collection/global/global.js +14 -15
- package/dist/collection/utils/i18n.js +29 -0
- package/dist/collection/utils/i18n.js.map +1 -0
- package/dist/collection/utils/slot/check-slot-content.js +15 -0
- package/dist/collection/utils/slot/check-slot-content.js.map +1 -0
- package/dist/collection/utils/validation-messages.js +17 -0
- package/dist/collection/utils/validation-messages.js.map +1 -0
- package/dist/components/bcm-accordion-group.js +3 -3
- package/dist/components/bcm-accordion-group.js.map +1 -1
- package/dist/components/bcm-accordion.js +7 -7
- package/dist/components/bcm-accordion.js.map +1 -1
- package/dist/components/bcm-alert.js +1 -1
- package/dist/components/bcm-avatar.js +13 -7
- package/dist/components/bcm-avatar.js.map +1 -1
- package/dist/components/bcm-badge.d.ts +11 -0
- package/dist/components/bcm-badge.js +8 -0
- package/dist/components/bcm-badge.js.map +1 -0
- package/dist/components/bcm-basic-badge.d.ts +11 -0
- package/dist/components/bcm-basic-badge.js +113 -0
- package/dist/components/bcm-basic-badge.js.map +1 -0
- package/dist/components/bcm-button.js +4 -4
- package/dist/components/bcm-button.js.map +1 -1
- package/dist/components/bcm-chip.js +4 -4
- package/dist/components/bcm-chip.js.map +1 -1
- package/dist/components/bcm-divider.d.ts +11 -0
- package/dist/components/bcm-divider.js +100 -0
- package/dist/components/bcm-divider.js.map +1 -0
- package/dist/components/bcm-input.js +168 -105
- package/dist/components/bcm-input.js.map +1 -1
- package/dist/components/bcm-text.js +3 -3
- package/dist/components/bcm-text.js.map +1 -1
- package/dist/components/bcm-textarea.d.ts +11 -0
- package/dist/components/bcm-textarea.js +369 -0
- package/dist/components/bcm-textarea.js.map +1 -0
- package/dist/components/index.js +12 -16
- package/dist/components/index.js.map +1 -1
- package/dist/{esm/index-f0e9d579.js → components/p-12360e4c.js} +3 -3
- package/dist/components/{p-b36f4f44.js.map → p-12360e4c.js.map} +1 -1
- package/dist/components/{p-8ded2c73.js → p-13582168.js} +10 -2
- package/dist/components/p-13582168.js.map +1 -0
- package/dist/components/p-31354aaa.js +129 -0
- package/dist/components/p-31354aaa.js.map +1 -0
- package/dist/components/p-39637e05.js +145 -0
- package/dist/components/p-39637e05.js.map +1 -0
- package/dist/esm/app-globals-bfa07b76.js +37 -0
- package/dist/esm/app-globals-bfa07b76.js.map +1 -0
- package/dist/esm/bcm-accordion-group.entry.js +3 -3
- package/dist/esm/bcm-accordion-group.entry.js.map +1 -1
- package/dist/esm/bcm-accordion.entry.js +7 -7
- package/dist/esm/bcm-accordion.entry.js.map +1 -1
- package/dist/esm/bcm-alert.entry.js +1 -1
- package/dist/esm/bcm-avatar_4.entry.js +570 -0
- package/dist/esm/bcm-avatar_4.entry.js.map +1 -0
- package/dist/esm/bcm-chip.entry.js +4 -4
- package/dist/esm/bcm-chip.entry.js.map +1 -1
- package/dist/esm/bcm-divider.entry.js +77 -0
- package/dist/esm/bcm-divider.entry.js.map +1 -0
- package/dist/esm/bcm-input.entry.js +309 -0
- package/dist/esm/bcm-input.entry.js.map +1 -0
- package/dist/esm/bcm-text.entry.js +3 -3
- package/dist/esm/bcm-text.entry.js.map +1 -1
- package/dist/esm/bcm-textarea.entry.js +312 -0
- package/dist/esm/bcm-textarea.entry.js.map +1 -0
- package/dist/esm/bromcom-ui.js +4 -4
- package/dist/{cjs/index-a4eea4bb.js → esm/index-097075ad.js} +3 -5
- package/dist/esm/{index-f0e9d579.js.map → index-097075ad.js.map} +1 -1
- package/dist/esm/{index-e23ee9b0.js → index-27cc1bac.js} +13 -4
- package/dist/esm/index-27cc1bac.js.map +1 -0
- package/dist/esm/loader.js +4 -4
- package/dist/esm/validation-messages-a29d53be.js +129 -0
- package/dist/esm/validation-messages-a29d53be.js.map +1 -0
- package/dist/types/components/badge/badge.component.d.ts +87 -0
- package/dist/types/components/basic-badge/basic-badge.component.d.ts +54 -0
- package/dist/types/components/divider/divider.component.d.ts +40 -0
- package/dist/types/components/input/input.component.d.ts +19 -0
- package/dist/types/components/input/types.d.ts +10 -0
- package/dist/types/components/textarea/textarea.component.d.ts +85 -0
- package/dist/types/components/textarea/types.d.ts +7 -0
- package/dist/types/components.d.ts +643 -0
- package/dist/types/utils/i18n.d.ts +8 -0
- package/dist/types/utils/slot/check-slot-content.d.ts +7 -0
- package/dist/types/utils/validation-messages.d.ts +11 -0
- package/package.json +1 -1
- package/dist/bromcom-ui/p-047e562f.entry.js +0 -2
- package/dist/bromcom-ui/p-047e562f.entry.js.map +0 -1
- package/dist/bromcom-ui/p-40643b53.js +0 -2
- package/dist/bromcom-ui/p-40643b53.js.map +0 -1
- package/dist/bromcom-ui/p-61c030c5.js +0 -3
- package/dist/bromcom-ui/p-61c030c5.js.map +0 -1
- package/dist/bromcom-ui/p-6430a887.entry.js +0 -2
- package/dist/bromcom-ui/p-9e94d920.entry.js +0 -2
- package/dist/bromcom-ui/p-9e94d920.entry.js.map +0 -1
- package/dist/bromcom-ui/p-bde58312.entry.js +0 -2
- package/dist/bromcom-ui/p-e7732b0c.entry.js +0 -2
- package/dist/bromcom-ui/p-e7732b0c.entry.js.map +0 -1
- package/dist/cjs/app-globals-e8faea0d.js +0 -43
- package/dist/cjs/app-globals-e8faea0d.js.map +0 -1
- package/dist/cjs/bcm-avatar.cjs.entry.js +0 -89
- package/dist/cjs/bcm-avatar.cjs.entry.js.map +0 -1
- package/dist/cjs/bcm-button_2.cjs.entry.js +0 -549
- package/dist/cjs/bcm-button_2.cjs.entry.js.map +0 -1
- package/dist/cjs/index-c36002ae.js.map +0 -1
- package/dist/components/p-8ded2c73.js.map +0 -1
- package/dist/esm/app-globals-f781c325.js +0 -41
- package/dist/esm/app-globals-f781c325.js.map +0 -1
- package/dist/esm/bcm-avatar.entry.js +0 -85
- package/dist/esm/bcm-avatar.entry.js.map +0 -1
- package/dist/esm/bcm-button_2.entry.js +0 -544
- package/dist/esm/bcm-button_2.entry.js.map +0 -1
- package/dist/esm/index-e23ee9b0.js.map +0 -1
- /package/dist/bromcom-ui/{p-b36f4f44.js.map → p-12360e4c.js.map} +0 -0
- /package/dist/bromcom-ui/{p-dcc13a55.entry.js.map → p-dcea8d62.entry.js.map} +0 -0
- /package/dist/bromcom-ui/{p-3805363a.entry.js.map → p-ebed10d5.entry.js.map} +0 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
/**
|
|
4
|
+
* @component BcmBadge
|
|
5
|
+
* @description A versatile badge component that can be positioned around its container.
|
|
6
|
+
* Supports different sizes, variants (dot/text), colors, and positioning options.
|
|
7
|
+
* Can display status indicators with optional blinking animation.
|
|
8
|
+
*
|
|
9
|
+
* @example Basic usage
|
|
10
|
+
* <bcm-badge color="primary" position="top-right">
|
|
11
|
+
* <div>Container Content</div>
|
|
12
|
+
* <span slot="badge">New</span>
|
|
13
|
+
* </bcm-badge>
|
|
14
|
+
*
|
|
15
|
+
* @example Status indicator with blink
|
|
16
|
+
* <bcm-badge variant="dot" color="success" blink={true} status="Online">
|
|
17
|
+
* <div>User Profile</div>
|
|
18
|
+
* </bcm-badge>
|
|
19
|
+
*/
|
|
20
|
+
export class Badge {
|
|
21
|
+
constructor() {
|
|
22
|
+
/**
|
|
23
|
+
* Determines the size of the badge.
|
|
24
|
+
* @type {'small' | 'medium' | 'large'}
|
|
25
|
+
* @default 'medium'
|
|
26
|
+
*/
|
|
27
|
+
this.size = 'medium';
|
|
28
|
+
/**
|
|
29
|
+
* Sets the visual variant of the badge.
|
|
30
|
+
* 'dot': Appears as a small dot indicator
|
|
31
|
+
* 'text': Displays content as text
|
|
32
|
+
* @type {'dot' | 'text'}
|
|
33
|
+
* @default 'text'
|
|
34
|
+
*/
|
|
35
|
+
this.variant = 'text';
|
|
36
|
+
/**
|
|
37
|
+
* Enables soft color mode for the badge.
|
|
38
|
+
* When true, uses lighter tones and pastel colors.
|
|
39
|
+
* @type {boolean}
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
this.soft = false;
|
|
43
|
+
/**
|
|
44
|
+
* Enables blinking animation for the badge.
|
|
45
|
+
* Useful for drawing attention or indicating active status.
|
|
46
|
+
* @type {boolean}
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
this.blink = false;
|
|
50
|
+
/**
|
|
51
|
+
* Sets the position of the badge relative to its container.
|
|
52
|
+
* @type {'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'}
|
|
53
|
+
* @default 'top-right'
|
|
54
|
+
*/
|
|
55
|
+
this.position = 'top-right';
|
|
56
|
+
this.classes = tv({
|
|
57
|
+
base: 'badge bcm-ui-element absolute font-medium inline-flex items-center justify-center bg-[--bcm-badge-bg] text-[--bcm-badge-text] rounded-[--bcm-badge-radius] z-10',
|
|
58
|
+
variants: {
|
|
59
|
+
size: {
|
|
60
|
+
small: 'gap-1 px-1 text-size-3',
|
|
61
|
+
medium: 'gap-1 py-0.5 px-1.5 text-size-4',
|
|
62
|
+
large: 'gap-2 py-1 px-2 text-size-5',
|
|
63
|
+
},
|
|
64
|
+
variant: {
|
|
65
|
+
dot: 'gap-0 p-0 text-[0px] leading-none',
|
|
66
|
+
text: '',
|
|
67
|
+
},
|
|
68
|
+
position: {
|
|
69
|
+
'top-right': '-top-1 -right-1',
|
|
70
|
+
'top-left': '-top-1 -left-1',
|
|
71
|
+
'bottom-right': '-bottom-1 -right-1',
|
|
72
|
+
'bottom-left': '-bottom-1 -left-1',
|
|
73
|
+
},
|
|
74
|
+
blink: {
|
|
75
|
+
true: 'after:content-[""] after:absolute after:rounded-full after:bg-[--bcm-badge-bg] after:animate-blink after:w-full after:h-full',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
compoundVariants: [
|
|
79
|
+
{
|
|
80
|
+
variant: 'dot',
|
|
81
|
+
size: 'small',
|
|
82
|
+
class: 'size-1',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
variant: 'dot',
|
|
86
|
+
size: 'medium',
|
|
87
|
+
class: 'size-1.5',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
variant: 'dot',
|
|
91
|
+
size: 'large',
|
|
92
|
+
class: 'size-2',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
defaultVariants: {
|
|
96
|
+
variant: 'text',
|
|
97
|
+
size: 'medium',
|
|
98
|
+
position: 'top-right',
|
|
99
|
+
blink: false,
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
get offsetStyle() {
|
|
104
|
+
if (!this.offset)
|
|
105
|
+
return {};
|
|
106
|
+
const [x = 0, y = 0] = this.offset.split(',').map(val => val.trim());
|
|
107
|
+
return { transform: `translate(${x}px, ${y}px)` };
|
|
108
|
+
}
|
|
109
|
+
get badgeStyle() {
|
|
110
|
+
if (!this.color)
|
|
111
|
+
return {};
|
|
112
|
+
const variantType = this.soft ? 'soft' : 'vivid';
|
|
113
|
+
return {
|
|
114
|
+
'--bcm-badge-bg': `var(--bcm-ui-color-background-${variantType}-${this.color}-default)`,
|
|
115
|
+
'--bcm-badge-text': this.soft ? `var(--bcm-ui-color-text-palette-${this.color})` : 'var(--bcm-ui-color-text-base)',
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
render() {
|
|
119
|
+
return (h("div", { key: '9c6ce83cc0ae25399f2d97139d9e91578be38237', class: "relative inline-flex" }, h("slot", { key: 'b05db7fc70a8ff5c680e79507d44678ea4f8aba4' }), h("div", { key: 'e3fe3d09e236ae1569d533824f4bb585a5871b53', role: "status", "aria-live": "polite", "aria-label": this.status ? `Status: ${this.status}` : undefined, class: this.classes({
|
|
120
|
+
size: this.size,
|
|
121
|
+
variant: this.variant,
|
|
122
|
+
position: this.position,
|
|
123
|
+
blink: this.blink,
|
|
124
|
+
}), style: Object.assign(Object.assign({}, this.badgeStyle), this.offsetStyle) }, this.variant == 'text' && h("slot", { key: '98e3f9eaa2966a748e41782efbe78ca35a9deee6', name: "badge" }, this.text))));
|
|
125
|
+
}
|
|
126
|
+
static get is() { return "bcm-badge"; }
|
|
127
|
+
static get encapsulation() { return "shadow"; }
|
|
128
|
+
static get originalStyleUrls() {
|
|
129
|
+
return {
|
|
130
|
+
"$": ["badge.css"]
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
static get styleUrls() {
|
|
134
|
+
return {
|
|
135
|
+
"$": ["badge.css"]
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
static get properties() {
|
|
139
|
+
return {
|
|
140
|
+
"size": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"mutable": false,
|
|
143
|
+
"complexType": {
|
|
144
|
+
"original": "'small' | 'medium' | 'large'",
|
|
145
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
146
|
+
"references": {}
|
|
147
|
+
},
|
|
148
|
+
"required": false,
|
|
149
|
+
"optional": false,
|
|
150
|
+
"docs": {
|
|
151
|
+
"tags": [{
|
|
152
|
+
"name": "type",
|
|
153
|
+
"text": "{'small' | 'medium' | 'large'}"
|
|
154
|
+
}, {
|
|
155
|
+
"name": "default",
|
|
156
|
+
"text": "'medium'"
|
|
157
|
+
}],
|
|
158
|
+
"text": "Determines the size of the badge."
|
|
159
|
+
},
|
|
160
|
+
"getter": false,
|
|
161
|
+
"setter": false,
|
|
162
|
+
"attribute": "size",
|
|
163
|
+
"reflect": false,
|
|
164
|
+
"defaultValue": "'medium'"
|
|
165
|
+
},
|
|
166
|
+
"variant": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"mutable": false,
|
|
169
|
+
"complexType": {
|
|
170
|
+
"original": "'dot' | 'text'",
|
|
171
|
+
"resolved": "\"dot\" | \"text\"",
|
|
172
|
+
"references": {}
|
|
173
|
+
},
|
|
174
|
+
"required": false,
|
|
175
|
+
"optional": false,
|
|
176
|
+
"docs": {
|
|
177
|
+
"tags": [{
|
|
178
|
+
"name": "type",
|
|
179
|
+
"text": "{'dot' | 'text'}"
|
|
180
|
+
}, {
|
|
181
|
+
"name": "default",
|
|
182
|
+
"text": "'text'"
|
|
183
|
+
}],
|
|
184
|
+
"text": "Sets the visual variant of the badge.\n'dot': Appears as a small dot indicator\n'text': Displays content as text"
|
|
185
|
+
},
|
|
186
|
+
"getter": false,
|
|
187
|
+
"setter": false,
|
|
188
|
+
"attribute": "variant",
|
|
189
|
+
"reflect": false,
|
|
190
|
+
"defaultValue": "'text'"
|
|
191
|
+
},
|
|
192
|
+
"color": {
|
|
193
|
+
"type": "string",
|
|
194
|
+
"mutable": false,
|
|
195
|
+
"complexType": {
|
|
196
|
+
"original": "string",
|
|
197
|
+
"resolved": "string",
|
|
198
|
+
"references": {}
|
|
199
|
+
},
|
|
200
|
+
"required": false,
|
|
201
|
+
"optional": true,
|
|
202
|
+
"docs": {
|
|
203
|
+
"tags": [{
|
|
204
|
+
"name": "type",
|
|
205
|
+
"text": "{string}"
|
|
206
|
+
}, {
|
|
207
|
+
"name": "optional",
|
|
208
|
+
"text": undefined
|
|
209
|
+
}],
|
|
210
|
+
"text": "Defines the color of the badge.\nUses system color variables (e.g., 'primary', 'success', 'warning', etc.)"
|
|
211
|
+
},
|
|
212
|
+
"getter": false,
|
|
213
|
+
"setter": false,
|
|
214
|
+
"attribute": "color",
|
|
215
|
+
"reflect": false
|
|
216
|
+
},
|
|
217
|
+
"soft": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "boolean",
|
|
222
|
+
"resolved": "boolean",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": false,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [{
|
|
229
|
+
"name": "type",
|
|
230
|
+
"text": "{boolean}"
|
|
231
|
+
}, {
|
|
232
|
+
"name": "default",
|
|
233
|
+
"text": "false"
|
|
234
|
+
}],
|
|
235
|
+
"text": "Enables soft color mode for the badge.\nWhen true, uses lighter tones and pastel colors."
|
|
236
|
+
},
|
|
237
|
+
"getter": false,
|
|
238
|
+
"setter": false,
|
|
239
|
+
"attribute": "soft",
|
|
240
|
+
"reflect": false,
|
|
241
|
+
"defaultValue": "false"
|
|
242
|
+
},
|
|
243
|
+
"blink": {
|
|
244
|
+
"type": "boolean",
|
|
245
|
+
"mutable": false,
|
|
246
|
+
"complexType": {
|
|
247
|
+
"original": "boolean",
|
|
248
|
+
"resolved": "boolean",
|
|
249
|
+
"references": {}
|
|
250
|
+
},
|
|
251
|
+
"required": false,
|
|
252
|
+
"optional": false,
|
|
253
|
+
"docs": {
|
|
254
|
+
"tags": [{
|
|
255
|
+
"name": "type",
|
|
256
|
+
"text": "{boolean}"
|
|
257
|
+
}, {
|
|
258
|
+
"name": "default",
|
|
259
|
+
"text": "false"
|
|
260
|
+
}],
|
|
261
|
+
"text": "Enables blinking animation for the badge.\nUseful for drawing attention or indicating active status."
|
|
262
|
+
},
|
|
263
|
+
"getter": false,
|
|
264
|
+
"setter": false,
|
|
265
|
+
"attribute": "blink",
|
|
266
|
+
"reflect": false,
|
|
267
|
+
"defaultValue": "false"
|
|
268
|
+
},
|
|
269
|
+
"status": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"mutable": false,
|
|
272
|
+
"complexType": {
|
|
273
|
+
"original": "string",
|
|
274
|
+
"resolved": "string",
|
|
275
|
+
"references": {}
|
|
276
|
+
},
|
|
277
|
+
"required": false,
|
|
278
|
+
"optional": true,
|
|
279
|
+
"docs": {
|
|
280
|
+
"tags": [{
|
|
281
|
+
"name": "type",
|
|
282
|
+
"text": "{string}"
|
|
283
|
+
}, {
|
|
284
|
+
"name": "optional",
|
|
285
|
+
"text": undefined
|
|
286
|
+
}],
|
|
287
|
+
"text": "Status message for accessibility purposes.\nWill be read by screen readers."
|
|
288
|
+
},
|
|
289
|
+
"getter": false,
|
|
290
|
+
"setter": false,
|
|
291
|
+
"attribute": "status",
|
|
292
|
+
"reflect": false
|
|
293
|
+
},
|
|
294
|
+
"position": {
|
|
295
|
+
"type": "string",
|
|
296
|
+
"mutable": false,
|
|
297
|
+
"complexType": {
|
|
298
|
+
"original": "'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'",
|
|
299
|
+
"resolved": "\"bottom-left\" | \"bottom-right\" | \"top-left\" | \"top-right\"",
|
|
300
|
+
"references": {}
|
|
301
|
+
},
|
|
302
|
+
"required": false,
|
|
303
|
+
"optional": false,
|
|
304
|
+
"docs": {
|
|
305
|
+
"tags": [{
|
|
306
|
+
"name": "type",
|
|
307
|
+
"text": "{'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'}"
|
|
308
|
+
}, {
|
|
309
|
+
"name": "default",
|
|
310
|
+
"text": "'top-right'"
|
|
311
|
+
}],
|
|
312
|
+
"text": "Sets the position of the badge relative to its container."
|
|
313
|
+
},
|
|
314
|
+
"getter": false,
|
|
315
|
+
"setter": false,
|
|
316
|
+
"attribute": "position",
|
|
317
|
+
"reflect": false,
|
|
318
|
+
"defaultValue": "'top-right'"
|
|
319
|
+
},
|
|
320
|
+
"offset": {
|
|
321
|
+
"type": "string",
|
|
322
|
+
"mutable": false,
|
|
323
|
+
"complexType": {
|
|
324
|
+
"original": "string",
|
|
325
|
+
"resolved": "string",
|
|
326
|
+
"references": {}
|
|
327
|
+
},
|
|
328
|
+
"required": false,
|
|
329
|
+
"optional": false,
|
|
330
|
+
"docs": {
|
|
331
|
+
"tags": [{
|
|
332
|
+
"name": "type",
|
|
333
|
+
"text": "{string}"
|
|
334
|
+
}, {
|
|
335
|
+
"name": "optional",
|
|
336
|
+
"text": undefined
|
|
337
|
+
}],
|
|
338
|
+
"text": "Fine-tune the badge position with custom offset.\nFormat: \"x,y\" in pixels (e.g., \"10,-5\")"
|
|
339
|
+
},
|
|
340
|
+
"getter": false,
|
|
341
|
+
"setter": false,
|
|
342
|
+
"attribute": "offset",
|
|
343
|
+
"reflect": false
|
|
344
|
+
},
|
|
345
|
+
"text": {
|
|
346
|
+
"type": "string",
|
|
347
|
+
"mutable": false,
|
|
348
|
+
"complexType": {
|
|
349
|
+
"original": "string",
|
|
350
|
+
"resolved": "string",
|
|
351
|
+
"references": {}
|
|
352
|
+
},
|
|
353
|
+
"required": false,
|
|
354
|
+
"optional": true,
|
|
355
|
+
"docs": {
|
|
356
|
+
"tags": [{
|
|
357
|
+
"name": "type",
|
|
358
|
+
"text": "{string}"
|
|
359
|
+
}, {
|
|
360
|
+
"name": "optional",
|
|
361
|
+
"text": undefined
|
|
362
|
+
}],
|
|
363
|
+
"text": "Text to be displayed inside the badge.\nUsed when variant is set to 'text'.\nCan be overridden using the \"badge\" slot."
|
|
364
|
+
},
|
|
365
|
+
"getter": false,
|
|
366
|
+
"setter": false,
|
|
367
|
+
"attribute": "text",
|
|
368
|
+
"reflect": false
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
//# sourceMappingURL=badge.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.component.js","sourceRoot":"","sources":["../../../src/components/badge/badge.component.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Component, ComponentInterface, Prop, h } from '@stencil/core';\nimport { tv } from 'tailwind-variants';\n\n/**\n * @component BcmBadge\n * @description A versatile badge component that can be positioned around its container.\n * Supports different sizes, variants (dot/text), colors, and positioning options.\n * Can display status indicators with optional blinking animation.\n *\n * @example Basic usage\n * <bcm-badge color=\"primary\" position=\"top-right\">\n * <div>Container Content</div>\n * <span slot=\"badge\">New</span>\n * </bcm-badge>\n *\n * @example Status indicator with blink\n * <bcm-badge variant=\"dot\" color=\"success\" blink={true} status=\"Online\">\n * <div>User Profile</div>\n * </bcm-badge>\n */\n@Component({\n tag: 'bcm-badge',\n styleUrl: 'badge.css',\n shadow: true,\n})\nexport class Badge implements ComponentInterface {\n /**\n * Determines the size of the badge.\n * @type {'small' | 'medium' | 'large'}\n * @default 'medium'\n */\n @Prop()\n size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Sets the visual variant of the badge.\n * 'dot': Appears as a small dot indicator\n * 'text': Displays content as text\n * @type {'dot' | 'text'}\n * @default 'text'\n */\n @Prop()\n variant: 'dot' | 'text' = 'text';\n\n /**\n * Defines the color of the badge.\n * Uses system color variables (e.g., 'primary', 'success', 'warning', etc.)\n * @type {string}\n * @optional\n */\n @Prop()\n color?: string;\n\n /**\n * Enables soft color mode for the badge.\n * When true, uses lighter tones and pastel colors.\n * @type {boolean}\n * @default false\n */\n @Prop()\n soft: boolean = false;\n\n /**\n * Enables blinking animation for the badge.\n * Useful for drawing attention or indicating active status.\n * @type {boolean}\n * @default false\n */\n @Prop()\n blink: boolean = false;\n\n /**\n * Status message for accessibility purposes.\n * Will be read by screen readers.\n * @type {string}\n * @optional\n */\n @Prop()\n status?: string;\n\n /**\n * Sets the position of the badge relative to its container.\n * @type {'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'}\n * @default 'top-right'\n */\n @Prop()\n position: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' = 'top-right';\n\n /**\n * Fine-tune the badge position with custom offset.\n * Format: \"x,y\" in pixels (e.g., \"10,-5\")\n * @type {string}\n * @optional\n */\n @Prop()\n offset: string;\n\n /**\n * Text to be displayed inside the badge.\n * Used when variant is set to 'text'.\n * Can be overridden using the \"badge\" slot.\n * @type {string}\n * @optional\n */\n @Prop()\n text?: string;\n\n private classes = tv({\n base: 'badge bcm-ui-element absolute font-medium inline-flex items-center justify-center bg-[--bcm-badge-bg] text-[--bcm-badge-text] rounded-[--bcm-badge-radius] z-10',\n variants: {\n size: {\n small: 'gap-1 px-1 text-size-3',\n medium: 'gap-1 py-0.5 px-1.5 text-size-4',\n large: 'gap-2 py-1 px-2 text-size-5',\n },\n variant: {\n dot: 'gap-0 p-0 text-[0px] leading-none',\n text: '',\n },\n position: {\n 'top-right': '-top-1 -right-1',\n 'top-left': '-top-1 -left-1',\n 'bottom-right': '-bottom-1 -right-1',\n 'bottom-left': '-bottom-1 -left-1',\n },\n blink: {\n true: 'after:content-[\"\"] after:absolute after:rounded-full after:bg-[--bcm-badge-bg] after:animate-blink after:w-full after:h-full',\n },\n },\n compoundVariants: [\n {\n variant: 'dot',\n size: 'small',\n class: 'size-1',\n },\n {\n variant: 'dot',\n size: 'medium',\n class: 'size-1.5',\n },\n {\n variant: 'dot',\n size: 'large',\n class: 'size-2',\n },\n ],\n defaultVariants: {\n variant: 'text',\n size: 'medium',\n position: 'top-right',\n blink: false,\n },\n });\n\n private get offsetStyle() {\n if (!this.offset) return {};\n const [x = 0, y = 0] = this.offset.split(',').map(val => val.trim());\n return { transform: `translate(${x}px, ${y}px)` };\n }\n\n private get badgeStyle() {\n if (!this.color) return {};\n const variantType = this.soft ? 'soft' : 'vivid';\n\n return {\n '--bcm-badge-bg': `var(--bcm-ui-color-background-${variantType}-${this.color}-default)`,\n '--bcm-badge-text': this.soft ? `var(--bcm-ui-color-text-palette-${this.color})` : 'var(--bcm-ui-color-text-base)',\n };\n }\n\n render() {\n return (\n <div class=\"relative inline-flex\">\n <slot></slot>\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-label={this.status ? `Status: ${this.status}` : undefined}\n class={this.classes({\n size: this.size,\n variant: this.variant,\n position: this.position,\n blink: this.blink,\n })}\n style={{\n ...this.badgeStyle,\n ...this.offsetStyle,\n }}\n >\n {this.variant == 'text' && <slot name=\"badge\">{this.text}</slot>}\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.relative{position:relative}:host{--bcm-badge-bg:var(--bcm-ui-color-background-default-default);--bcm-badge-text:var(--bcm-ui-color-text-default);--bcm-badge-radius:9999px;display:inline-block;position:relative}::slotted([slot=badge]){color:var(--bcm-badge-text);font-weight:500}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.absolute{position:absolute}.-bottom-1{bottom:-.25rem}.-left-1{left:-.25rem}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.z-10{z-index:10}.inline-flex{display:inline-flex}.size-1{height:.25rem;width:.25rem}.size-1\.5{height:.375rem;width:.375rem}.size-2{height:.5rem;width:.5rem}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.gap-0{gap:0}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.rounded-\[--bcm-badge-radius\]{border-radius:var(--bcm-badge-radius)}.bg-\[--bcm-badge-bg\]{background-color:var(--bcm-badge-bg)}.p-0{padding:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-0\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.text-\[0px\]{font-size:0}.text-size-3{font-size:var(--bcm-ui-font-size-3,12px);line-height:var(--bcm-ui-line-height-3,16px)}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.font-medium{font-weight:500}.leading-none{line-height:1}.text-\[--bcm-badge-text\]{color:var(--bcm-badge-text)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:h-full:after{content:var(--tw-content);height:100%}.after\:w-full:after{content:var(--tw-content);width:100%}@keyframes ping{75%,to{content:var(--tw-content);opacity:0;transform:scale(2)}}.after\:animate-blink:after{animation:ping 2s infinite;content:var(--tw-content)}.after\:rounded-full:after{border-radius:9999px;content:var(--tw-content)}.after\:bg-\[--bcm-badge-bg\]:after{background-color:var(--bcm-badge-bg);content:var(--tw-content)}.after\:content-\[\"\"\]:after{--tw-content:"";content:var(--tw-content)}.-right-0\.5{right:-.125rem}.-top-0\.5{top:-.125rem}.right-0{right:0}.top-0{top:0}.h-10{height:2.5rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-full{height:100%}.w-10{width:2.5rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-full{width:100%}.rounded-\[--bcm-ui-radius\]{border-radius:var(--bcm-ui-radius)}.rounded-full{border-radius:9999px}.bg-\[--bcm-avatar-bg\]{background-color:var(--bcm-avatar-bg)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.uppercase{text-transform:uppercase}.text-\[--bcm-avatar-text\]{color:var(--bcm-avatar-text)}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
/**
|
|
4
|
+
* @component BcmBasicBadge
|
|
5
|
+
* @description A basic badge component that can be used as a status indicator or to highlight content.
|
|
6
|
+
* Supports dot and text variants with different sizes and color options.
|
|
7
|
+
*
|
|
8
|
+
* @example Basic usage
|
|
9
|
+
* <bcm-basic-badge size="medium" color="primary">
|
|
10
|
+
* New
|
|
11
|
+
* </bcm-basic-badge>
|
|
12
|
+
*
|
|
13
|
+
* @example Dot variant
|
|
14
|
+
* <bcm-basic-badge variant="dot" color="success" />
|
|
15
|
+
*/
|
|
16
|
+
export class BasicBadge {
|
|
17
|
+
constructor() {
|
|
18
|
+
/**
|
|
19
|
+
* Determines the size of the badge.
|
|
20
|
+
* @type {'small' | 'medium' | 'large'}
|
|
21
|
+
* @default 'medium'
|
|
22
|
+
*/
|
|
23
|
+
this.size = 'medium';
|
|
24
|
+
/**
|
|
25
|
+
* Sets the visual variant of the badge.
|
|
26
|
+
* 'dot': Appears as a small dot indicator
|
|
27
|
+
* 'text': Displays content as text
|
|
28
|
+
* @type {'dot' | 'text'}
|
|
29
|
+
* @default 'text'
|
|
30
|
+
*/
|
|
31
|
+
this.variant = 'text';
|
|
32
|
+
/**
|
|
33
|
+
* Enables soft color mode for the badge.
|
|
34
|
+
* When true, uses lighter tones and pastel colors.
|
|
35
|
+
* @type {boolean}
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
this.soft = false;
|
|
39
|
+
this.classes = tv({
|
|
40
|
+
base: 'badge bcm-ui-element inline-flex items-center justify-center whitespace-nowrap select-none font-medium bg-[--bcm-badge-bg] text-[--bcm-badge-text] rounded-[--bcm-badge-radius]',
|
|
41
|
+
variants: {
|
|
42
|
+
size: {
|
|
43
|
+
small: 'px-1 text-size-3',
|
|
44
|
+
medium: 'py-0.5 px-1.5 text-size-4',
|
|
45
|
+
large: 'py-1 px-2 text-size-5',
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
dot: 'gap-0 p-0 text-[0px] leading-none',
|
|
49
|
+
text: '',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
compoundVariants: [
|
|
53
|
+
{
|
|
54
|
+
variant: 'dot',
|
|
55
|
+
size: 'small',
|
|
56
|
+
class: 'size-1',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
variant: 'dot',
|
|
60
|
+
size: 'medium',
|
|
61
|
+
class: 'size-1.5',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
variant: 'dot',
|
|
65
|
+
size: 'large',
|
|
66
|
+
class: 'size-2',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
defaultVariants: {
|
|
70
|
+
variant: 'text',
|
|
71
|
+
size: 'medium',
|
|
72
|
+
blink: false,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
get badgeStyle() {
|
|
77
|
+
if (!this.color)
|
|
78
|
+
return {};
|
|
79
|
+
const variantType = this.soft ? 'soft' : 'vivid';
|
|
80
|
+
return {
|
|
81
|
+
'--bcm-badge-bg': `var(--bcm-ui-color-background-${variantType}-${this.color}-default)`,
|
|
82
|
+
'--bcm-badge-text': this.soft ? `var(--bcm-ui-color-text-palette-${this.color})` : 'var(--bcm-ui-color-text-base)',
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
return (h("span", { key: '17d82a67aaf2793bbd922c901bbfb05b91abea35', part: "base", role: "status", "aria-live": "polite", style: this.badgeStyle, class: this.classes({
|
|
87
|
+
size: this.size,
|
|
88
|
+
variant: this.variant,
|
|
89
|
+
}) }, this.variant === 'text' && (h("span", { key: '5b4fffd0979dec737d0209f8268467c19a5dd795', class: "badge-content" }, h("slot", { key: 'a554c64e657079ba933ead458c76a894f236b533' })))));
|
|
90
|
+
}
|
|
91
|
+
static get is() { return "bcm-basic-badge"; }
|
|
92
|
+
static get encapsulation() { return "shadow"; }
|
|
93
|
+
static get originalStyleUrls() {
|
|
94
|
+
return {
|
|
95
|
+
"$": ["basic-badge.css"]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
static get styleUrls() {
|
|
99
|
+
return {
|
|
100
|
+
"$": ["basic-badge.css"]
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
static get properties() {
|
|
104
|
+
return {
|
|
105
|
+
"size": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "'small' | 'medium' | 'large'",
|
|
110
|
+
"resolved": "\"large\" | \"medium\" | \"small\"",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": false,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [{
|
|
117
|
+
"name": "type",
|
|
118
|
+
"text": "{'small' | 'medium' | 'large'}"
|
|
119
|
+
}, {
|
|
120
|
+
"name": "default",
|
|
121
|
+
"text": "'medium'"
|
|
122
|
+
}],
|
|
123
|
+
"text": "Determines the size of the badge."
|
|
124
|
+
},
|
|
125
|
+
"getter": false,
|
|
126
|
+
"setter": false,
|
|
127
|
+
"attribute": "size",
|
|
128
|
+
"reflect": false,
|
|
129
|
+
"defaultValue": "'medium'"
|
|
130
|
+
},
|
|
131
|
+
"variant": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "'dot' | 'text'",
|
|
136
|
+
"resolved": "\"dot\" | \"text\"",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [{
|
|
143
|
+
"name": "type",
|
|
144
|
+
"text": "{'dot' | 'text'}"
|
|
145
|
+
}, {
|
|
146
|
+
"name": "default",
|
|
147
|
+
"text": "'text'"
|
|
148
|
+
}],
|
|
149
|
+
"text": "Sets the visual variant of the badge.\n'dot': Appears as a small dot indicator\n'text': Displays content as text"
|
|
150
|
+
},
|
|
151
|
+
"getter": false,
|
|
152
|
+
"setter": false,
|
|
153
|
+
"attribute": "variant",
|
|
154
|
+
"reflect": false,
|
|
155
|
+
"defaultValue": "'text'"
|
|
156
|
+
},
|
|
157
|
+
"color": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "string",
|
|
162
|
+
"resolved": "string",
|
|
163
|
+
"references": {}
|
|
164
|
+
},
|
|
165
|
+
"required": false,
|
|
166
|
+
"optional": true,
|
|
167
|
+
"docs": {
|
|
168
|
+
"tags": [{
|
|
169
|
+
"name": "type",
|
|
170
|
+
"text": "{string}"
|
|
171
|
+
}, {
|
|
172
|
+
"name": "optional",
|
|
173
|
+
"text": undefined
|
|
174
|
+
}],
|
|
175
|
+
"text": "Defines the color of the badge.\nUses system color variables (e.g., 'primary', 'success', 'warning', etc.)"
|
|
176
|
+
},
|
|
177
|
+
"getter": false,
|
|
178
|
+
"setter": false,
|
|
179
|
+
"attribute": "color",
|
|
180
|
+
"reflect": false
|
|
181
|
+
},
|
|
182
|
+
"soft": {
|
|
183
|
+
"type": "boolean",
|
|
184
|
+
"mutable": false,
|
|
185
|
+
"complexType": {
|
|
186
|
+
"original": "boolean",
|
|
187
|
+
"resolved": "boolean",
|
|
188
|
+
"references": {}
|
|
189
|
+
},
|
|
190
|
+
"required": false,
|
|
191
|
+
"optional": false,
|
|
192
|
+
"docs": {
|
|
193
|
+
"tags": [{
|
|
194
|
+
"name": "type",
|
|
195
|
+
"text": "{boolean}"
|
|
196
|
+
}, {
|
|
197
|
+
"name": "default",
|
|
198
|
+
"text": "false"
|
|
199
|
+
}],
|
|
200
|
+
"text": "Enables soft color mode for the badge.\nWhen true, uses lighter tones and pastel colors."
|
|
201
|
+
},
|
|
202
|
+
"getter": false,
|
|
203
|
+
"setter": false,
|
|
204
|
+
"attribute": "soft",
|
|
205
|
+
"reflect": false,
|
|
206
|
+
"defaultValue": "false"
|
|
207
|
+
},
|
|
208
|
+
"text": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"mutable": false,
|
|
211
|
+
"complexType": {
|
|
212
|
+
"original": "string",
|
|
213
|
+
"resolved": "string",
|
|
214
|
+
"references": {}
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"optional": true,
|
|
218
|
+
"docs": {
|
|
219
|
+
"tags": [{
|
|
220
|
+
"name": "type",
|
|
221
|
+
"text": "{string}"
|
|
222
|
+
}, {
|
|
223
|
+
"name": "optional",
|
|
224
|
+
"text": undefined
|
|
225
|
+
}],
|
|
226
|
+
"text": "Text to be displayed inside the badge.\nUsed when variant is set to 'text'."
|
|
227
|
+
},
|
|
228
|
+
"getter": false,
|
|
229
|
+
"setter": false,
|
|
230
|
+
"attribute": "text",
|
|
231
|
+
"reflect": false
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=basic-badge.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic-badge.component.js","sourceRoot":"","sources":["../../../src/components/basic-badge/basic-badge.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAGvC;;;;;;;;;;;;GAYG;AAOH,MAAM,OAAO,UAAU;IALvB;QAMI;;;;WAIG;QAEH,SAAI,GAAiC,QAAQ,CAAC;QAE9C;;;;;;WAMG;QAEH,YAAO,GAAmB,MAAM,CAAC;QAWjC;;;;;WAKG;QAEH,SAAI,GAAY,KAAK,CAAC;QAWd,YAAO,GAAG,EAAE,CAAC;YACjB,IAAI,EAAE,iLAAiL;YACvL,QAAQ,EAAE;gBACN,IAAI,EAAE;oBACF,KAAK,EAAE,kBAAkB;oBACzB,MAAM,EAAE,2BAA2B;oBACnC,KAAK,EAAE,uBAAuB;iBACjC;gBACD,OAAO,EAAE;oBACL,GAAG,EAAE,mCAAmC;oBACxC,IAAI,EAAE,EAAE;iBACX;aACJ;YACD,gBAAgB,EAAE;gBACd;oBACI,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,QAAQ;iBAClB;gBACD;oBACI,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE,UAAU;iBACpB;gBACD;oBACI,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,QAAQ;iBAClB;aACJ;YACD,eAAe,EAAE;gBACb,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,KAAK;aACf;SACJ,CAAC,CAAC;KAgCN;IA9BG,IAAY,UAAU;QAClB,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAC;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAEjD,OAAO;YACH,gBAAgB,EAAE,iCAAiC,WAAW,IAAI,IAAI,CAAC,KAAK,WAAW;YACvF,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,mCAAmC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,+BAA+B;SACrH,CAAC;IACN,CAAC;IAED,MAAM;QACF,OAAO,CACH,6DACI,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,QAAQ,eACH,QAAQ,EAClB,KAAK,EAAE,IAAI,CAAC,UAAU,EACtB,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC;gBAChB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,OAAO,EAAE,IAAI,CAAC,OAAO;aACxB,CAAC,IAED,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CACxB,6DAAM,KAAK,EAAC,eAAe;YACvB,8DAAa,CACV,CACV,CACE,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { Component, ComponentInterface, Prop, h } from '@stencil/core';\nimport { tv } from 'tailwind-variants';\n\n\n/**\n * @component BcmBasicBadge\n * @description A basic badge component that can be used as a status indicator or to highlight content.\n * Supports dot and text variants with different sizes and color options.\n * \n * @example Basic usage\n * <bcm-basic-badge size=\"medium\" color=\"primary\">\n * New\n * </bcm-basic-badge>\n * \n * @example Dot variant\n * <bcm-basic-badge variant=\"dot\" color=\"success\" />\n */\n\n@Component({\n tag: 'bcm-basic-badge',\n styleUrl: 'basic-badge.css',\n shadow: true,\n})\nexport class BasicBadge implements ComponentInterface {\n /**\n * Determines the size of the badge.\n * @type {'small' | 'medium' | 'large'}\n * @default 'medium'\n */\n @Prop()\n size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Sets the visual variant of the badge.\n * 'dot': Appears as a small dot indicator\n * 'text': Displays content as text\n * @type {'dot' | 'text'}\n * @default 'text'\n */\n @Prop()\n variant: 'dot' | 'text' = 'text';\n\n /**\n * Defines the color of the badge.\n * Uses system color variables (e.g., 'primary', 'success', 'warning', etc.)\n * @type {string}\n * @optional\n */\n @Prop()\n color?: string;\n\n /**\n * Enables soft color mode for the badge.\n * When true, uses lighter tones and pastel colors.\n * @type {boolean}\n * @default false\n */\n @Prop()\n soft: boolean = false;\n\n /**\n * Text to be displayed inside the badge.\n * Used when variant is set to 'text'.\n * @type {string}\n * @optional\n */\n @Prop()\n text?: string;\n\n private classes = tv({\n base: 'badge bcm-ui-element inline-flex items-center justify-center whitespace-nowrap select-none font-medium bg-[--bcm-badge-bg] text-[--bcm-badge-text] rounded-[--bcm-badge-radius]',\n variants: {\n size: {\n small: 'px-1 text-size-3',\n medium: 'py-0.5 px-1.5 text-size-4',\n large: 'py-1 px-2 text-size-5',\n },\n variant: {\n dot: 'gap-0 p-0 text-[0px] leading-none',\n text: '',\n },\n },\n compoundVariants: [\n {\n variant: 'dot',\n size: 'small',\n class: 'size-1',\n },\n {\n variant: 'dot',\n size: 'medium',\n class: 'size-1.5',\n },\n {\n variant: 'dot',\n size: 'large',\n class: 'size-2',\n },\n ],\n defaultVariants: {\n variant: 'text',\n size: 'medium',\n blink: false,\n },\n });\n\n private get badgeStyle() {\n if (!this.color) return {};\n const variantType = this.soft ? 'soft' : 'vivid';\n\n return {\n '--bcm-badge-bg': `var(--bcm-ui-color-background-${variantType}-${this.color}-default)`,\n '--bcm-badge-text': this.soft ? `var(--bcm-ui-color-text-palette-${this.color})` : 'var(--bcm-ui-color-text-base)',\n };\n }\n\n render() {\n return (\n <span\n part=\"base\"\n role=\"status\"\n aria-live=\"polite\"\n style={this.badgeStyle}\n class={this.classes({\n size: this.size,\n variant: this.variant,\n })}\n >\n {this.variant === 'text' && (\n <span class=\"badge-content\">\n <slot></slot>\n </span>\n )}\n </span>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:host{--bcm-badge-bg:var(--bcm-ui-color-background-default-default);--bcm-badge-text:var(--bcm-ui-color-text-default);--bcm-badge-radius:9999px;display:inline-flex;height:-moz-fit-content;height:fit-content;width:-moz-fit-content;width:fit-content}.badge-content{color:var(--bcm-badge-text);font-weight:500}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Inter,sans-serif}.static{position:static}.inline-flex{display:inline-flex}.size-1{height:.25rem;width:.25rem}.size-1\.5{height:.375rem;width:.375rem}.size-2{height:.5rem;width:.5rem}.select-none{user-select:none}.items-center{align-items:center}.justify-center{justify-content:center}.gap-0{gap:0}.whitespace-nowrap{white-space:nowrap}.rounded-\[--bcm-badge-radius\]{border-radius:var(--bcm-badge-radius)}.bg-\[--bcm-badge-bg\]{background-color:var(--bcm-badge-bg)}.p-0{padding:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-0\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.text-\[0px\]{font-size:0}.text-size-3{font-size:var(--bcm-ui-font-size-3,12px);line-height:var(--bcm-ui-line-height-3,16px)}.text-size-4{font-size:var(--bcm-ui-font-size-4,14px);line-height:var(--bcm-ui-line-height-4,20px)}.text-size-5{font-size:var(--bcm-ui-font-size-5,16px);line-height:var(--bcm-ui-line-height-5,24px)}.font-medium{font-weight:500}.leading-none{line-height:1}.text-\[--bcm-badge-text\]{color:var(--bcm-badge-text)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}
|