bromcom-ui-next 0.1.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/LICENSE +21 -0
- package/dist/bromcom-ui/bromcom-ui.css +1 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js +2 -0
- package/dist/bromcom-ui/bromcom-ui.esm.js.map +1 -0
- package/dist/bromcom-ui/global/global.js +40 -0
- package/dist/bromcom-ui/index.esm.js +2 -0
- package/dist/bromcom-ui/index.esm.js.map +1 -0
- package/dist/bromcom-ui/p-27c997d8.js +3 -0
- package/dist/bromcom-ui/p-27c997d8.js.map +1 -0
- package/dist/bromcom-ui/p-341d46a8.entry.js +2 -0
- package/dist/bromcom-ui/p-341d46a8.entry.js.map +1 -0
- package/dist/bromcom-ui/p-40643b53.js +2 -0
- package/dist/bromcom-ui/p-40643b53.js.map +1 -0
- package/dist/bromcom-ui/p-5fcf77f9.js +2 -0
- package/dist/bromcom-ui/p-5fcf77f9.js.map +1 -0
- package/dist/bromcom-ui/p-997f314c.entry.js +2 -0
- package/dist/bromcom-ui/p-997f314c.entry.js.map +1 -0
- package/dist/bromcom-ui/p-b36f4f44.js +7 -0
- package/dist/bromcom-ui/p-b36f4f44.js.map +1 -0
- package/dist/bromcom-ui/p-dcb9df00.entry.js +2 -0
- package/dist/bromcom-ui/p-dcb9df00.entry.js.map +1 -0
- package/dist/bromcom-ui/p-f0c61f8c.entry.js +2 -0
- package/dist/bromcom-ui/p-f0c61f8c.entry.js.map +1 -0
- package/dist/cjs/app-globals-e8faea0d.js +43 -0
- package/dist/cjs/app-globals-e8faea0d.js.map +1 -0
- package/dist/cjs/bcm-accordion_4.cjs.entry.js +623 -0
- package/dist/cjs/bcm-accordion_4.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-alert.cjs.entry.js +99 -0
- package/dist/cjs/bcm-alert.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-avatar.cjs.entry.js +89 -0
- package/dist/cjs/bcm-avatar.cjs.entry.js.map +1 -0
- package/dist/cjs/bcm-text.cjs.entry.js +119 -0
- package/dist/cjs/bcm-text.cjs.entry.js.map +1 -0
- package/dist/cjs/bromcom-ui.cjs.js +27 -0
- package/dist/cjs/bromcom-ui.cjs.js.map +1 -0
- package/dist/cjs/index-310db2a6.js +2584 -0
- package/dist/cjs/index-310db2a6.js.map +1 -0
- package/dist/cjs/index-638f2d15.js +1441 -0
- package/dist/cjs/index-638f2d15.js.map +1 -0
- package/dist/cjs/index-a4eea4bb.js +84 -0
- package/dist/cjs/index-a4eea4bb.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +18 -0
- package/dist/collection/components/accordion/accordion.component.js +399 -0
- package/dist/collection/components/accordion/accordion.component.js.map +1 -0
- package/dist/collection/components/accordion/accordion.css +1 -0
- package/dist/collection/components/accordion/types.js +2 -0
- package/dist/collection/components/accordion/types.js.map +1 -0
- package/dist/collection/components/accordion-group/accordion-group.component.js +269 -0
- package/dist/collection/components/accordion-group/accordion-group.component.js.map +1 -0
- package/dist/collection/components/accordion-group/accordion-group.css +1 -0
- package/dist/collection/components/accordion-group/types.js +2 -0
- package/dist/collection/components/accordion-group/types.js.map +1 -0
- package/dist/collection/components/alert/alert.component.js +241 -0
- package/dist/collection/components/alert/alert.component.js.map +1 -0
- package/dist/collection/components/alert/alert.css +1 -0
- package/dist/collection/components/alert/types.js +2 -0
- package/dist/collection/components/alert/types.js.map +1 -0
- package/dist/collection/components/avatar/avatar.component.js +290 -0
- package/dist/collection/components/avatar/avatar.component.js.map +1 -0
- package/dist/collection/components/avatar/avatar.css +1 -0
- package/dist/collection/components/avatar/types.js +2 -0
- package/dist/collection/components/avatar/types.js.map +1 -0
- package/dist/collection/components/button/button.component.js +628 -0
- package/dist/collection/components/button/button.component.js.map +1 -0
- package/dist/collection/components/button/button.css +1 -0
- package/dist/collection/components/button/types.js +142 -0
- package/dist/collection/components/button/types.js.map +1 -0
- package/dist/collection/components/chip/chip.component.js +308 -0
- package/dist/collection/components/chip/chip.component.js.map +1 -0
- package/dist/collection/components/chip/chip.css +1 -0
- package/dist/collection/components/chip/types.js +7 -0
- package/dist/collection/components/chip/types.js.map +1 -0
- package/dist/collection/components/text/text.component.js +176 -0
- package/dist/collection/components/text/text.component.js.map +1 -0
- package/dist/collection/components/text/text.css +1 -0
- package/dist/collection/components/text/text.types.js +2 -0
- package/dist/collection/components/text/text.types.js.map +1 -0
- package/dist/collection/components/text/text.utils.js +18 -0
- package/dist/collection/components/text/text.utils.js.map +1 -0
- package/dist/collection/global/global.js +40 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/styles/theme-variables.js +355 -0
- package/dist/collection/styles/theme-variables.js.map +1 -0
- package/dist/components/bcm-accordion-group.d.ts +11 -0
- package/dist/components/bcm-accordion-group.js +113 -0
- package/dist/components/bcm-accordion-group.js.map +1 -0
- package/dist/components/bcm-accordion.d.ts +11 -0
- package/dist/components/bcm-accordion.js +152 -0
- package/dist/components/bcm-accordion.js.map +1 -0
- package/dist/components/bcm-alert.d.ts +11 -0
- package/dist/components/bcm-alert.js +120 -0
- package/dist/components/bcm-alert.js.map +1 -0
- package/dist/components/bcm-avatar.d.ts +11 -0
- package/dist/components/bcm-avatar.js +115 -0
- package/dist/components/bcm-avatar.js.map +1 -0
- package/dist/components/bcm-button.d.ts +11 -0
- package/dist/components/bcm-button.js +334 -0
- package/dist/components/bcm-button.js.map +1 -0
- package/dist/components/bcm-chip.d.ts +11 -0
- package/dist/components/bcm-chip.js +152 -0
- package/dist/components/bcm-chip.js.map +1 -0
- package/dist/components/bcm-text.d.ts +11 -0
- package/dist/components/bcm-text.js +138 -0
- package/dist/components/bcm-text.js.map +1 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +38 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/p-0adcc84f.js +1222 -0
- package/dist/components/p-0adcc84f.js.map +1 -0
- package/dist/components/p-5fcf77f9.js +2582 -0
- package/dist/components/p-5fcf77f9.js.map +1 -0
- package/dist/components/p-b36f4f44.js +82 -0
- package/dist/components/p-b36f4f44.js.map +1 -0
- package/dist/esm/app-globals-f781c325.js +41 -0
- package/dist/esm/app-globals-f781c325.js.map +1 -0
- package/dist/esm/bcm-accordion_4.entry.js +616 -0
- package/dist/esm/bcm-accordion_4.entry.js.map +1 -0
- package/dist/esm/bcm-alert.entry.js +95 -0
- package/dist/esm/bcm-alert.entry.js.map +1 -0
- package/dist/esm/bcm-avatar.entry.js +85 -0
- package/dist/esm/bcm-avatar.entry.js.map +1 -0
- package/dist/esm/bcm-text.entry.js +115 -0
- package/dist/esm/bcm-text.entry.js.map +1 -0
- package/dist/esm/bromcom-ui.js +22 -0
- package/dist/esm/bromcom-ui.js.map +1 -0
- package/dist/esm/index-ce2fac11.js +1412 -0
- package/dist/esm/index-ce2fac11.js.map +1 -0
- package/dist/esm/index-f0e9d579.js +82 -0
- package/dist/esm/index-f0e9d579.js.map +1 -0
- package/dist/esm/index-f3b17e60.js +2582 -0
- package/dist/esm/index-f3b17e60.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/accordion/accordion.component.d.ts +137 -0
- package/dist/types/components/accordion/types.d.ts +16 -0
- package/dist/types/components/accordion-group/accordion-group.component.d.ts +95 -0
- package/dist/types/components/accordion-group/types.d.ts +13 -0
- package/dist/types/components/alert/alert.component.d.ts +28 -0
- package/dist/types/components/alert/types.d.ts +3 -0
- package/dist/types/components/avatar/avatar.component.d.ts +24 -0
- package/dist/types/components/avatar/types.d.ts +3 -0
- package/dist/types/components/button/button.component.d.ts +52 -0
- package/dist/types/components/button/types.d.ts +15 -0
- package/dist/types/components/chip/chip.component.d.ts +48 -0
- package/dist/types/components/chip/types.d.ts +9 -0
- package/dist/types/components/text/text.component.d.ts +12 -0
- package/dist/types/components/text/text.types.d.ts +3 -0
- package/dist/types/components/text/text.utils.d.ts +2 -0
- package/dist/types/components.d.ts +1116 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/dist/types/styles/theme-variables.d.ts +384 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +49 -0
- package/readme.md +170 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, h } from './p-0adcc84f.js';
|
|
2
|
+
import { c as cs } from './p-b36f4f44.js';
|
|
3
|
+
|
|
4
|
+
const avatarCss = "*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid oklch(.928 .006 264.531);box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:oklch(.707 .022 261.325);opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:host{--bcm-avatar-bg:var(--bcm-ui-color-background-default-default);--bcm-avatar-text:var(--bcm-ui-color-text-default);--bcm-avatar-radius:50%}.bcm-ui-element{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.static{position:static}.-right-0\\.5{right:-.125rem}.-top-0\\.5{top:-.125rem}.right-0{right:0}.top-0{top:0}.inline-flex{display:inline-flex}.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%}.items-center{align-items:center}.justify-center{justify-content:center}.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-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)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.font-medium{font-weight:500}.uppercase{text-transform:uppercase}.text-\\[--bcm-avatar-text\\]{color:var(--bcm-avatar-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)}";
|
|
5
|
+
const BcmAvatarStyle0 = avatarCss;
|
|
6
|
+
|
|
7
|
+
const BcmAvatar$1 = /*@__PURE__*/ proxyCustomElement(class BcmAvatar extends H {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
/** Shape of the avatar (ellipse/square) */
|
|
13
|
+
this.shape = 'ellipse';
|
|
14
|
+
/** Size of the avatar */
|
|
15
|
+
this.size = 'medium';
|
|
16
|
+
/** Fallback icon class */
|
|
17
|
+
this.icon = 'fas fa-user';
|
|
18
|
+
/** Status indicator animation */
|
|
19
|
+
this.blink = false;
|
|
20
|
+
this.isFallback = false;
|
|
21
|
+
}
|
|
22
|
+
getFirstLetters(name) {
|
|
23
|
+
const words = name.split(' ');
|
|
24
|
+
const initials = words.map(word => word.charAt(0).toUpperCase()).join('');
|
|
25
|
+
return initials.substring(0, 2);
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
const baseClass = cs('bcm-avatar bcm-ui-element bcm-ui-content-display', 'uppercase font-medium', 'inline-flex items-center justify-center', 'bg-[--bcm-avatar-bg] text-[--bcm-avatar-text]', {
|
|
29
|
+
'shape-ellipse rounded-full': this.shape === 'ellipse',
|
|
30
|
+
'shape-square rounded-[--bcm-ui-radius]': this.shape === 'square',
|
|
31
|
+
'size-small text-size-4 w-6 h-6': this.size === 'small',
|
|
32
|
+
'size-medium text-size-5 w-8 h-8': this.size === 'medium',
|
|
33
|
+
'size-large text-size-6 w-10 h-10': this.size === 'large',
|
|
34
|
+
});
|
|
35
|
+
const badgeClass = cs('badge', {
|
|
36
|
+
'top-0 right-0': this.shape === 'ellipse',
|
|
37
|
+
'-top-0.5 -right-0.5': this.shape === 'square',
|
|
38
|
+
});
|
|
39
|
+
const imageClass = cs('image w-full h-full', {
|
|
40
|
+
'rounded-full': this.shape === 'ellipse',
|
|
41
|
+
'rounded-[--bcm-ui-radius]': this.shape === 'square',
|
|
42
|
+
});
|
|
43
|
+
let style = {};
|
|
44
|
+
if (this.color) {
|
|
45
|
+
const isColorTone = this.color.includes('-');
|
|
46
|
+
const _color = isColorTone ? this.color.split('-')[0] : this.color;
|
|
47
|
+
const bgColor = `var(--bcm-ui-color-background-palette-${_color}-default)`;
|
|
48
|
+
const textColor = `var(--bcm-ui-color-text-palette-${_color}`;
|
|
49
|
+
style = {
|
|
50
|
+
'--bcm-avatar-bg': bgColor,
|
|
51
|
+
'--bcm-avatar-text': textColor,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const customSize = !Object.keys(['small', 'medium', 'large']).includes(this.size)
|
|
55
|
+
? {
|
|
56
|
+
width: `${this.size}px`,
|
|
57
|
+
height: `${this.size}px`,
|
|
58
|
+
fontSize: `${+this.size / 2}px`,
|
|
59
|
+
}
|
|
60
|
+
: {};
|
|
61
|
+
const RenderContent = () => {
|
|
62
|
+
if (this.isFallback) {
|
|
63
|
+
if (this.name) {
|
|
64
|
+
return this.getFirstLetters(this.name);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return h("i", { class: this.icon });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (this.image) {
|
|
71
|
+
return h("img", { class: imageClass, onError: () => (this.isFallback = true), src: this.image, alt: this.alt, "aria-label": this.alt || this.name || 'Avatar' });
|
|
72
|
+
}
|
|
73
|
+
else if (this.name) {
|
|
74
|
+
return this.getFirstLetters(this.name);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return h("i", { class: this.icon });
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return (h("div", { role: "img", "aria-label": this.alt || this.name || 'Avatar', class: baseClass, style: Object.assign(Object.assign({}, style), customSize) }, h(RenderContent, null), this.status && h("bcm-badge", { class: badgeClass, status: this.status, blink: this.blink, "aria-hidden": "true" }), h("slot", null)));
|
|
81
|
+
}
|
|
82
|
+
static get style() { return BcmAvatarStyle0; }
|
|
83
|
+
}, [1, "bcm-avatar", {
|
|
84
|
+
"image": [1],
|
|
85
|
+
"alt": [1],
|
|
86
|
+
"shape": [1],
|
|
87
|
+
"size": [1],
|
|
88
|
+
"color": [1],
|
|
89
|
+
"icon": [1],
|
|
90
|
+
"status": [1],
|
|
91
|
+
"blink": [4],
|
|
92
|
+
"name": [1],
|
|
93
|
+
"isFallback": [32]
|
|
94
|
+
}]);
|
|
95
|
+
function defineCustomElement$1() {
|
|
96
|
+
if (typeof customElements === "undefined") {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const components = ["bcm-avatar"];
|
|
100
|
+
components.forEach(tagName => { switch (tagName) {
|
|
101
|
+
case "bcm-avatar":
|
|
102
|
+
if (!customElements.get(tagName)) {
|
|
103
|
+
customElements.define(tagName, BcmAvatar$1);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
} });
|
|
107
|
+
}
|
|
108
|
+
defineCustomElement$1();
|
|
109
|
+
|
|
110
|
+
const BcmAvatar = BcmAvatar$1;
|
|
111
|
+
const defineCustomElement = defineCustomElement$1;
|
|
112
|
+
|
|
113
|
+
export { BcmAvatar, defineCustomElement };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=bcm-avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"bcm-avatar.js","mappings":";;;AAAA,MAAM,SAAS,GAAG,6rJAA6rJ,CAAC;AAChtJ,wBAAe,SAAS;;MCQXA,WAAS;IALtB;;;;;QAgBE,UAAK,GAAgB,SAAS,CAAC;;QAI/B,SAAI,GAAe,QAAQ,CAAC;;QAQ5B,SAAI,GAAW,aAAa,CAAC;;QAQ7B,UAAK,GAAG,KAAK,CAAC;QAML,eAAU,GAAY,KAAK,CAAC;KA+EtC;IA7ES,eAAe,CAAC,IAAY;QAClC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,C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,IAAI,IAAI,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,kCAAO,KAAK,GAAK,UAAU,KAC/G,EAAC,aAAa,OAAG,EAChB,IAAI,CAAC,MAAM,IAAI,iBAAW,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,iBAAc,MAAM,GAAa,EACrH,eAAa,CACT,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["BcmAvatar"],"sources":["src/components/avatar/avatar.css?tag=bcm-avatar&encapsulation=shadow","src/components/avatar/avatar.component.tsx"],"sourcesContent":[":host {\n --bcm-avatar-bg: var(--bcm-ui-color-background-default-default);\n --bcm-avatar-text: var(--bcm-ui-color-text-default);\n --bcm-avatar-radius: 50%;\n}\n","import { Component, Prop, State, h } from '@stencil/core';\nimport cs from 'classnames';\nimport { AvatarShape, AvatarSize, AvatarStatus } from './types';\n\n@Component({\n tag: 'bcm-avatar',\n styleUrl: 'avatar.css',\n shadow: true,\n})\nexport class BcmAvatar {\n /** Source URL for avatar image */\n @Prop()\n image: string;\n\n /** Alternative text for image */\n @Prop()\n alt: string;\n\n /** Shape of the avatar (ellipse/square) */\n @Prop()\n shape: AvatarShape = 'ellipse';\n\n /** Size of the avatar */\n @Prop()\n size: AvatarSize = 'medium';\n\n /** Custom background color */\n @Prop()\n color: string;\n\n /** Fallback icon class */\n @Prop()\n icon: string = 'fas fa-user';\n\n /** Status indicator type */\n @Prop()\n status: AvatarStatus;\n\n /** Status indicator animation */\n @Prop()\n blink = false;\n\n /** Display name (used for initials) */\n @Prop()\n name: string;\n\n @State() isFallback: boolean = false;\n\n private getFirstLetters(name: string): string {\n const words = name.split(' ');\n const initials = words.map(word => word.charAt(0).toUpperCase()).join('');\n return initials.substring(0, 2);\n }\n\n render() {\n const baseClass = cs(\n 'bcm-avatar bcm-ui-element bcm-ui-content-display',\n 'uppercase font-medium',\n 'inline-flex items-center justify-center',\n 'bg-[--bcm-avatar-bg] text-[--bcm-avatar-text]',\n {\n 'shape-ellipse rounded-full': this.shape === 'ellipse',\n 'shape-square rounded-[--bcm-ui-radius]': this.shape === 'square',\n 'size-small text-size-4 w-6 h-6': this.size === 'small',\n 'size-medium text-size-5 w-8 h-8': this.size === 'medium',\n 'size-large text-size-6 w-10 h-10': this.size === 'large',\n },\n );\n\n const badgeClass = cs('badge', {\n 'top-0 right-0': this.shape === 'ellipse',\n '-top-0.5 -right-0.5': this.shape === 'square',\n });\n\n const imageClass = cs('image w-full h-full', {\n 'rounded-full': this.shape === 'ellipse',\n 'rounded-[--bcm-ui-radius]': this.shape === 'square',\n });\n\n let style = {};\n\n if (this.color) {\n const isColorTone = this.color.includes('-');\n const _color = isColorTone ? this.color.split('-')[0] : this.color;\n\n const bgColor = `var(--bcm-ui-color-background-palette-${_color}-default)`;\n const textColor = `var(--bcm-ui-color-text-palette-${_color}`;\n style = {\n '--bcm-avatar-bg': bgColor,\n '--bcm-avatar-text': textColor,\n };\n }\n\n const customSize = !Object.keys(['small', 'medium', 'large']).includes(this.size)\n ? {\n width: `${this.size}px`,\n height: `${this.size}px`,\n fontSize: `${+this.size / 2}px`,\n }\n : {};\n\n const RenderContent = () => {\n if (this.isFallback) {\n if (this.name) {\n return this.getFirstLetters(this.name);\n } else {\n return <i class={this.icon}></i>;\n }\n } else if (this.image) {\n return <img class={imageClass} onError={() => (this.isFallback = true)} src={this.image} alt={this.alt} aria-label={this.alt || this.name || 'Avatar'} />;\n } else if (this.name) {\n return this.getFirstLetters(this.name);\n } else {\n return <i class={this.icon}></i>;\n }\n };\n\n return (\n <div role=\"img\" aria-label={this.alt || this.name || 'Avatar'} class={baseClass} style={{ ...style, ...customSize }}>\n <RenderContent />\n {this.status && <bcm-badge class={badgeClass} status={this.status} blink={this.blink} aria-hidden=\"true\"></bcm-badge>}\n <slot></slot>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BcmButton extends Components.BcmButton, HTMLElement {}
|
|
4
|
+
export const BcmButton: {
|
|
5
|
+
prototype: BcmButton;
|
|
6
|
+
new (): BcmButton;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { p as proxyCustomElement, H, c as createEvent, h, d as Host } from './p-0adcc84f.js';
|
|
2
|
+
import { c as ce } from './p-5fcf77f9.js';
|
|
3
|
+
|
|
4
|
+
const variantOptions = {
|
|
5
|
+
save: {
|
|
6
|
+
text: 'Save',
|
|
7
|
+
status: 'success',
|
|
8
|
+
icon: 'far fa-save',
|
|
9
|
+
iconPosition: 'prefix',
|
|
10
|
+
kind: 'primary',
|
|
11
|
+
},
|
|
12
|
+
ok: {
|
|
13
|
+
text: 'Ok',
|
|
14
|
+
status: 'success',
|
|
15
|
+
icon: 'far fa-check',
|
|
16
|
+
iconPosition: 'prefix',
|
|
17
|
+
},
|
|
18
|
+
new: {
|
|
19
|
+
text: 'New',
|
|
20
|
+
status: 'success',
|
|
21
|
+
icon: 'far fa-plus',
|
|
22
|
+
iconPosition: 'prefix',
|
|
23
|
+
},
|
|
24
|
+
add: {
|
|
25
|
+
text: 'Add',
|
|
26
|
+
status: 'success',
|
|
27
|
+
icon: 'far fa-plus',
|
|
28
|
+
iconPosition: 'prefix',
|
|
29
|
+
},
|
|
30
|
+
create: {
|
|
31
|
+
text: 'Create',
|
|
32
|
+
status: 'success',
|
|
33
|
+
icon: 'far fa-plus',
|
|
34
|
+
iconPosition: 'prefix',
|
|
35
|
+
},
|
|
36
|
+
prev: {
|
|
37
|
+
text: 'Prev',
|
|
38
|
+
status: 'default',
|
|
39
|
+
icon: 'far fa-arrow-left',
|
|
40
|
+
iconPosition: 'prefix',
|
|
41
|
+
},
|
|
42
|
+
next: {
|
|
43
|
+
text: 'Next',
|
|
44
|
+
status: 'default',
|
|
45
|
+
icon: 'far fa-arrow-right',
|
|
46
|
+
iconPosition: 'suffix',
|
|
47
|
+
},
|
|
48
|
+
apply: {
|
|
49
|
+
text: 'Apply',
|
|
50
|
+
status: 'default',
|
|
51
|
+
icon: 'far fa-check-circle',
|
|
52
|
+
iconPosition: 'prefix',
|
|
53
|
+
},
|
|
54
|
+
submit: {
|
|
55
|
+
text: 'Submit',
|
|
56
|
+
status: 'default',
|
|
57
|
+
icon: 'far fa-save',
|
|
58
|
+
iconPosition: 'prefix',
|
|
59
|
+
},
|
|
60
|
+
send: {
|
|
61
|
+
text: 'Send',
|
|
62
|
+
status: 'success',
|
|
63
|
+
icon: 'far fa-paper-plane',
|
|
64
|
+
iconPosition: 'prefix',
|
|
65
|
+
},
|
|
66
|
+
delete: {
|
|
67
|
+
text: 'Delete',
|
|
68
|
+
status: 'error',
|
|
69
|
+
icon: 'far fa-trash',
|
|
70
|
+
iconPosition: 'prefix',
|
|
71
|
+
},
|
|
72
|
+
cancel: {
|
|
73
|
+
text: 'Cancel',
|
|
74
|
+
status: 'error',
|
|
75
|
+
icon: 'far fa-times',
|
|
76
|
+
iconPosition: 'prefix',
|
|
77
|
+
},
|
|
78
|
+
decline: {
|
|
79
|
+
text: 'Decline',
|
|
80
|
+
status: 'error',
|
|
81
|
+
icon: 'far fa-ban',
|
|
82
|
+
iconPosition: 'prefix',
|
|
83
|
+
},
|
|
84
|
+
close: {
|
|
85
|
+
text: 'Close',
|
|
86
|
+
status: 'error',
|
|
87
|
+
icon: 'far fa-times-circle',
|
|
88
|
+
iconPosition: 'prefix',
|
|
89
|
+
},
|
|
90
|
+
archive: {
|
|
91
|
+
text: 'Archive',
|
|
92
|
+
status: 'error',
|
|
93
|
+
icon: 'far fa-folder-open',
|
|
94
|
+
iconPosition: 'prefix',
|
|
95
|
+
},
|
|
96
|
+
remove: {
|
|
97
|
+
text: 'Remove',
|
|
98
|
+
status: 'error',
|
|
99
|
+
icon: 'far fa-minus-circle',
|
|
100
|
+
iconPosition: 'prefix',
|
|
101
|
+
},
|
|
102
|
+
edit: {
|
|
103
|
+
text: 'Edit',
|
|
104
|
+
status: 'default',
|
|
105
|
+
icon: 'far fa-edit',
|
|
106
|
+
iconPosition: 'prefix',
|
|
107
|
+
},
|
|
108
|
+
export: {
|
|
109
|
+
text: 'Export',
|
|
110
|
+
status: 'default',
|
|
111
|
+
icon: 'far fa-sign-out',
|
|
112
|
+
iconPosition: 'prefix',
|
|
113
|
+
},
|
|
114
|
+
import: {
|
|
115
|
+
text: 'Import',
|
|
116
|
+
status: 'default',
|
|
117
|
+
icon: 'far fa-sign-in',
|
|
118
|
+
iconPosition: 'prefix',
|
|
119
|
+
},
|
|
120
|
+
filter: {
|
|
121
|
+
text: 'Filter',
|
|
122
|
+
status: 'default',
|
|
123
|
+
icon: 'far fa-filter',
|
|
124
|
+
iconPosition: 'prefix',
|
|
125
|
+
},
|
|
126
|
+
update: {
|
|
127
|
+
text: 'Update',
|
|
128
|
+
status: 'default',
|
|
129
|
+
icon: 'far fa-sync',
|
|
130
|
+
iconPosition: 'prefix',
|
|
131
|
+
},
|
|
132
|
+
reset: {
|
|
133
|
+
text: 'Reset',
|
|
134
|
+
status: 'default',
|
|
135
|
+
icon: 'far fa-sync',
|
|
136
|
+
iconPosition: 'prefix',
|
|
137
|
+
},
|
|
138
|
+
download: {
|
|
139
|
+
text: 'Download',
|
|
140
|
+
status: 'default',
|
|
141
|
+
icon: 'far fa-download',
|
|
142
|
+
iconPosition: 'prefix',
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const buttonCss = "*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid oklch(.928 .006 264.531);box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:oklch(.707 .022 261.325);opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:host{display:inline-block}:host([full-width]){width:100%}.static{position:static}.inline-flex{display:inline-flex}.min-h-10{min-height:2.5rem}.min-h-6{min-height:1.5rem}.min-h-8{min-height:2rem}.w-full{width:100%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.appearance-none{appearance:none}.items-center{align-items:center}.justify-center{justify-content:center}.rounded{border-radius:.25rem}.border{border-width:1px}.border-\\[--bcm-button-border\\]{border-color:var(--bcm-button-border)}.bg-\\[--bcm-button-bg\\]{background-color:var(--bcm-button-bg)}.bg-\\[--bcm-ui-color-background-disabled-default\\]{background-color:var(--bcm-ui-color-background-disabled-default)}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-px{padding-bottom:1px;padding-top:1px}.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)}.text-size-6{font-size:var(--bcm-ui-font-size-6,18px);line-height:var(--bcm-ui-line-height-6,24px)}.leading-none{line-height:1}.text-\\[--bcm-button-text\\]{color:var(--bcm-button-text)}.text-color-disabled{color:var(--bcm-ui-color-text-disabled)}.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)}.outline{outline-style:solid}.hover\\:bg-\\[--bcm-button-bg-hover\\]:hover{background-color:var(--bcm-button-bg-hover)}.focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.active\\:bg-\\[--bcm-button-bg-active\\]:active{background-color:var(--bcm-button-bg-active)}";
|
|
147
|
+
const BcmButtonStyle0 = buttonCss;
|
|
148
|
+
|
|
149
|
+
const BcmButton$1 = /*@__PURE__*/ proxyCustomElement(class BcmButton extends H {
|
|
150
|
+
constructor() {
|
|
151
|
+
super();
|
|
152
|
+
this.__registerHost();
|
|
153
|
+
this.__attachShadow();
|
|
154
|
+
this.bcmClick = createEvent(this, "bcmClick", 1);
|
|
155
|
+
this.bcmFocus = createEvent(this, "bcmFocus", 1);
|
|
156
|
+
this.bcmBlur = createEvent(this, "bcmBlur", 1);
|
|
157
|
+
/** Defines the main visual style of the button */
|
|
158
|
+
this.kind = 'primary';
|
|
159
|
+
/** Controls the button size */
|
|
160
|
+
this.size = 'medium';
|
|
161
|
+
/** Defines the button's status/state color */
|
|
162
|
+
this.status = 'default';
|
|
163
|
+
/** Icon placement (prefix/suffix) */
|
|
164
|
+
this.iconPosition = 'prefix';
|
|
165
|
+
/** Icon-only button mode */
|
|
166
|
+
this.iconOnly = false;
|
|
167
|
+
/** Full width button */
|
|
168
|
+
this.fullWidth = false;
|
|
169
|
+
/** HTML button type */
|
|
170
|
+
this.type = 'button';
|
|
171
|
+
/** Loading state */
|
|
172
|
+
this.loading = false;
|
|
173
|
+
/** Disabled state */
|
|
174
|
+
this.disabled = false;
|
|
175
|
+
/** Active state */
|
|
176
|
+
this.active = false;
|
|
177
|
+
this.handleClick = (event) => {
|
|
178
|
+
if (!this.disabled && !this.loading) {
|
|
179
|
+
this.bcmClick.emit(event);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
this.handleFocus = (event) => {
|
|
183
|
+
this.bcmFocus.emit(event);
|
|
184
|
+
};
|
|
185
|
+
this.handleBlur = (event) => {
|
|
186
|
+
this.bcmBlur.emit(event);
|
|
187
|
+
};
|
|
188
|
+
this.buttonClass = ce({
|
|
189
|
+
base: 'bcm-button appearance-none inline-flex items-center justify-center border rounded',
|
|
190
|
+
variants: {
|
|
191
|
+
size: {
|
|
192
|
+
small: 'text-size-4 py-px px-2 min-h-6',
|
|
193
|
+
medium: 'text-size-5 py-0.5 px-3 min-h-8',
|
|
194
|
+
large: 'text-size-6 py-1 px-3 min-h-10',
|
|
195
|
+
},
|
|
196
|
+
kind: {
|
|
197
|
+
primary: 'kind-primary',
|
|
198
|
+
ghost: 'kind-ghost',
|
|
199
|
+
text: 'kind-text',
|
|
200
|
+
outline: 'kind-outline',
|
|
201
|
+
},
|
|
202
|
+
fullWidth: {
|
|
203
|
+
true: 'full-width w-full',
|
|
204
|
+
},
|
|
205
|
+
disabled: {
|
|
206
|
+
true: 'disabled cursor-not-allowed bg-[--bcm-ui-color-background-disabled-default] text-color-disabled border-color-disabled',
|
|
207
|
+
false: [
|
|
208
|
+
'cursor-pointer',
|
|
209
|
+
'bg-[--bcm-button-bg] text-[--bcm-button-text] border-[--bcm-button-border]',
|
|
210
|
+
'hover:bg-[--bcm-button-bg-hover]',
|
|
211
|
+
'active:bg-[--bcm-button-bg-active]',
|
|
212
|
+
'focus-visible:ring',
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
loading: {
|
|
216
|
+
true: '',
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
defaultVariants: {
|
|
220
|
+
size: 'medium',
|
|
221
|
+
kind: 'primary',
|
|
222
|
+
fullWidth: false,
|
|
223
|
+
disabled: false,
|
|
224
|
+
loading: false,
|
|
225
|
+
},
|
|
226
|
+
}, {
|
|
227
|
+
twMerge: false,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
get buttonText() {
|
|
231
|
+
return this.text || (this.variant ? variantOptions[this.variant].text : '');
|
|
232
|
+
}
|
|
233
|
+
get buttonIcon() {
|
|
234
|
+
if (this.variant && variantOptions[this.variant].icon) {
|
|
235
|
+
return {
|
|
236
|
+
icon: variantOptions[this.variant].icon,
|
|
237
|
+
position: variantOptions[this.variant].iconPosition || 'prefix',
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
icon: this.icon,
|
|
242
|
+
position: this.iconPosition,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
get buttonStatus() {
|
|
246
|
+
return this.variant ? variantOptions[this.variant].status : this.status;
|
|
247
|
+
}
|
|
248
|
+
get buttonStyles() {
|
|
249
|
+
const status = this.buttonStatus === 'default' ? 'primary' : this.buttonStatus;
|
|
250
|
+
const kindStyleMap = {
|
|
251
|
+
primary: {
|
|
252
|
+
'--bcm-button-bg': `var(--bcm-ui-color-background-${status}-default)`,
|
|
253
|
+
'--bcm-button-bg-hover': `var(--bcm-ui-color-background-${status}-hover)`,
|
|
254
|
+
'--bcm-button-bg-active': `var(--bcm-ui-color-background-${status}-active)`,
|
|
255
|
+
'--bcm-button-border': 'transparent',
|
|
256
|
+
'--bcm-button-text': 'var(--bcm-ui-color-text-base)',
|
|
257
|
+
},
|
|
258
|
+
outline: {
|
|
259
|
+
'--bcm-button-bg': 'var(--bcm-ui-color-background-default-default)',
|
|
260
|
+
'--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',
|
|
261
|
+
'--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',
|
|
262
|
+
'--bcm-button-border': `var(--bcm-ui-color-border-${this.buttonStatus})`,
|
|
263
|
+
'--bcm-button-text': `var(--bcm-ui-color-text-${this.buttonStatus})`,
|
|
264
|
+
},
|
|
265
|
+
ghost: {
|
|
266
|
+
'--bcm-button-bg': 'transparent',
|
|
267
|
+
'--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',
|
|
268
|
+
'--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',
|
|
269
|
+
'--bcm-button-border': 'transparent',
|
|
270
|
+
'--bcm-button-text': `var(--bcm-ui-color-text-${this.buttonStatus})`,
|
|
271
|
+
},
|
|
272
|
+
text: {
|
|
273
|
+
'--bcm-button-bg': 'transparent',
|
|
274
|
+
'--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',
|
|
275
|
+
'--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',
|
|
276
|
+
'--bcm-button-border': 'transparent',
|
|
277
|
+
'--bcm-button-text': `var(--bcm-ui-color-text-${status})`,
|
|
278
|
+
},
|
|
279
|
+
};
|
|
280
|
+
return kindStyleMap[this.kind];
|
|
281
|
+
}
|
|
282
|
+
render() {
|
|
283
|
+
const { icon, position } = this.buttonIcon;
|
|
284
|
+
return (h(Host, { key: '271947a40a1f166d146ea106530b76744b06650a' }, h("button", { key: '10407570f7bbf2a5293714d040aae3f9404f2be5', type: this.type, disabled: this.disabled || this.loading, "aria-label": this.label, "aria-expanded": this.expanded, "aria-controls": this.controls, "aria-disabled": this.disabled, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur, style: this.buttonStyles, class: this.buttonClass({
|
|
285
|
+
size: this.size,
|
|
286
|
+
kind: this.kind,
|
|
287
|
+
fullWidth: this.fullWidth,
|
|
288
|
+
disabled: this.disabled,
|
|
289
|
+
loading: this.loading,
|
|
290
|
+
}) }, this.loading && h("slot", { key: '551abf095e2594ad1e7a8723c14342528cc5bc0c', name: "loading" }), h("span", { key: '36ff02f068fd14ee868977ce819f9dce3c6c881e' }, h("slot", { key: '6e87ba2465b6ef1fa4349640d7b9c10ed7d9b662', name: "prefix" }, position === 'prefix' && icon && h("i", { key: '51062786f476b57af571db5ecb974a35af565a5a', class: ' leading-none ' + icon }))), h("slot", { key: 'a32959e426991f1a117632426688eb997b1e4c27' }, this.buttonText), h("span", { key: 'b6b98cbf6708cef4f4f1fa4f652ab2f680071a45' }, h("slot", { key: 'e2f919eaa52fab225fe625776f03abf526a784b9', name: "suffix" }, position === 'suffix' && icon && h("i", { key: '52b4885d3485aa282cbc1a48d773941d535e1c3c', class: ' leading-none ' + icon }))))));
|
|
291
|
+
}
|
|
292
|
+
static get style() { return BcmButtonStyle0; }
|
|
293
|
+
}, [1, "bcm-button", {
|
|
294
|
+
"kind": [1],
|
|
295
|
+
"size": [1],
|
|
296
|
+
"status": [1],
|
|
297
|
+
"variant": [1],
|
|
298
|
+
"icon": [1],
|
|
299
|
+
"iconPosition": [1, "icon-position"],
|
|
300
|
+
"iconOnly": [4, "icon-only"],
|
|
301
|
+
"fullWidth": [516, "full-width"],
|
|
302
|
+
"type": [1],
|
|
303
|
+
"loading": [4],
|
|
304
|
+
"disabled": [4],
|
|
305
|
+
"text": [1],
|
|
306
|
+
"active": [4],
|
|
307
|
+
"form": [1],
|
|
308
|
+
"value": [1],
|
|
309
|
+
"name": [1],
|
|
310
|
+
"label": [1],
|
|
311
|
+
"expanded": [1],
|
|
312
|
+
"controls": [1]
|
|
313
|
+
}]);
|
|
314
|
+
function defineCustomElement$1() {
|
|
315
|
+
if (typeof customElements === "undefined") {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const components = ["bcm-button"];
|
|
319
|
+
components.forEach(tagName => { switch (tagName) {
|
|
320
|
+
case "bcm-button":
|
|
321
|
+
if (!customElements.get(tagName)) {
|
|
322
|
+
customElements.define(tagName, BcmButton$1);
|
|
323
|
+
}
|
|
324
|
+
break;
|
|
325
|
+
} });
|
|
326
|
+
}
|
|
327
|
+
defineCustomElement$1();
|
|
328
|
+
|
|
329
|
+
const BcmButton = BcmButton$1;
|
|
330
|
+
const defineCustomElement = defineCustomElement$1;
|
|
331
|
+
|
|
332
|
+
export { BcmButton, defineCustomElement };
|
|
333
|
+
|
|
334
|
+
//# sourceMappingURL=bcm-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"bcm-button.js","mappings":";;;AAcO,MAAM,cAAc,GAAwC;IACjE,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,QAAQ;QACtB,IAAI,EAAE,SAAS;KAChB;IACD,EAAE,EAAE;QACF,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,cAAc;QACpB,YAAY,EAAE,QAAQ;KACvB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,mBAAmB;QACzB,YAAY,EAAE,QAAQ;KACvB;IACD,I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AQ,IAAI,IAAI,IAAI,0DAAG,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAM,CAAQ,CAChG,EACP,+DAAO,IAAI,CAAC,UAAU,CAAQ,EAC9B,+DACE,6DAAM,IAAI,EAAC,QAAQ,IAAE,QAAQ,KAAK,QAAQ,IAAI,IAAI,IAAI,0DAAG,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAM,CAAQ,CAChG,CACA,CACJ,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["BcmButton","tv"],"sources":["src/components/button/types.ts","src/components/button/button.css?tag=bcm-button&encapsulation=shadow","src/components/button/button.component.tsx"],"sourcesContent":["export type ButtonKind = 'primary' | 'ghost' | 'text' | 'outline';\nexport type ButtonSize = 'small' | 'medium' | 'large';\nexport type ButtonType = 'button' | 'reset' | 'submit';\nexport type ButtonStatus = 'default' | 'success' | 'error' | 'warning' | 'info';\nexport type IconPosition = 'prefix' | 'suffix';\n\ninterface ButtonVariantConfig {\n text: string;\n status: ButtonStatus;\n icon?: string;\n iconPosition?: IconPosition;\n kind?: ButtonKind;\n}\n\nexport const variantOptions: Record<string, ButtonVariantConfig> = {\n save: {\n text: 'Save',\n status: 'success',\n icon: 'far fa-save',\n iconPosition: 'prefix',\n kind: 'primary',\n },\n ok: {\n text: 'Ok',\n status: 'success',\n icon: 'far fa-check',\n iconPosition: 'prefix',\n },\n new: {\n text: 'New',\n status: 'success',\n icon: 'far fa-plus',\n iconPosition: 'prefix',\n },\n add: {\n text: 'Add',\n status: 'success',\n icon: 'far fa-plus',\n iconPosition: 'prefix',\n },\n create: {\n text: 'Create',\n status: 'success',\n icon: 'far fa-plus',\n iconPosition: 'prefix',\n },\n prev: {\n text: 'Prev',\n status: 'default',\n icon: 'far fa-arrow-left',\n iconPosition: 'prefix',\n },\n next: {\n text: 'Next',\n status: 'default',\n icon: 'far fa-arrow-right',\n iconPosition: 'suffix',\n },\n apply: {\n text: 'Apply',\n status: 'default',\n icon: 'far fa-check-circle',\n iconPosition: 'prefix',\n },\n submit: {\n text: 'Submit',\n status: 'default',\n icon: 'far fa-save',\n iconPosition: 'prefix',\n },\n send: {\n text: 'Send',\n status: 'success',\n icon: 'far fa-paper-plane',\n iconPosition: 'prefix',\n },\n delete: {\n text: 'Delete',\n status: 'error',\n icon: 'far fa-trash',\n iconPosition: 'prefix',\n },\n cancel: {\n text: 'Cancel',\n status: 'error',\n icon: 'far fa-times',\n iconPosition: 'prefix',\n },\n decline: {\n text: 'Decline',\n status: 'error',\n icon: 'far fa-ban',\n iconPosition: 'prefix',\n },\n close: {\n text: 'Close',\n status: 'error',\n icon: 'far fa-times-circle',\n iconPosition: 'prefix',\n },\n archive: {\n text: 'Archive',\n status: 'error',\n icon: 'far fa-folder-open',\n iconPosition: 'prefix',\n },\n remove: {\n text: 'Remove',\n status: 'error',\n icon: 'far fa-minus-circle',\n iconPosition: 'prefix',\n },\n edit: {\n text: 'Edit',\n status: 'default',\n icon: 'far fa-edit',\n iconPosition: 'prefix',\n },\n export: {\n text: 'Export',\n status: 'default',\n icon: 'far fa-sign-out',\n iconPosition: 'prefix',\n },\n import: {\n text: 'Import',\n status: 'default',\n icon: 'far fa-sign-in',\n iconPosition: 'prefix',\n },\n filter: {\n text: 'Filter',\n status: 'default',\n icon: 'far fa-filter',\n iconPosition: 'prefix',\n },\n update: {\n text: 'Update',\n status: 'default',\n icon: 'far fa-sync',\n iconPosition: 'prefix',\n },\n reset: {\n text: 'Reset',\n status: 'default',\n icon: 'far fa-sync',\n iconPosition: 'prefix',\n },\n download: {\n text: 'Download',\n status: 'default',\n icon: 'far fa-download',\n iconPosition: 'prefix',\n },\n};\n\nexport type ButtonVariant = keyof typeof variantOptions;\n",":host {\n display: inline-block;\n}\n\n:host([full-width]) {\n width: 100%;\n}\n","import { Component, Prop, h, Event, EventEmitter, Host } from '@stencil/core';\nimport { ButtonKind, ButtonSize, ButtonType, ButtonStatus, ButtonVariant, IconPosition, variantOptions } from './types';\nimport { tv } from 'tailwind-variants';\n\n@Component({\n tag: 'bcm-button',\n styleUrl: 'button.css',\n shadow: true,\n})\nexport class BcmButton {\n /** Defines the main visual style of the button */\n @Prop()\n kind: ButtonKind = 'primary';\n\n /** Controls the button size */\n @Prop()\n size: ButtonSize = 'medium';\n\n /** Defines the button's status/state color */\n @Prop()\n status: ButtonStatus = 'default';\n\n /** Predefined button variants */\n @Prop()\n variant?: ButtonVariant;\n\n /** Icon class name */\n @Prop()\n icon?: string;\n\n /** Icon placement (prefix/suffix) */\n @Prop()\n iconPosition: IconPosition = 'prefix';\n\n /** Icon-only button mode */\n @Prop()\n iconOnly = false;\n\n /** Full width button */\n @Prop({ attribute: 'full-width', reflect: true })\n fullWidth = false;\n\n /** HTML button type */\n @Prop()\n type: ButtonType = 'button';\n\n /** Loading state */\n @Prop()\n loading = false;\n\n /** Disabled state */\n @Prop()\n disabled = false;\n\n /** Button text content */\n @Prop()\n text?: string;\n\n /** Active state */\n @Prop()\n active = false;\n\n /** Form association */\n @Prop()\n form: string;\n\n @Prop()\n value: string;\n\n @Prop()\n name: string;\n\n /** Screen reader label */\n @Prop()\n label: string;\n\n /** Expanded state for expandable content */\n @Prop()\n expanded?: string;\n\n /** ID of controlled element */\n @Prop()\n controls: string;\n\n @Event({\n composed: false,\n bubbles: false,\n cancelable: true,\n })\n bcmClick: EventEmitter<MouseEvent>;\n\n @Event({\n composed: false,\n bubbles: false,\n cancelable: true,\n })\n bcmFocus: EventEmitter<FocusEvent>;\n\n @Event({\n composed: false,\n bubbles: false,\n cancelable: true,\n })\n bcmBlur: EventEmitter<FocusEvent>;\n\n private handleClick = (event: MouseEvent) => {\n if (!this.disabled && !this.loading) {\n this.bcmClick.emit(event);\n }\n };\n\n private handleFocus = (event: FocusEvent) => {\n this.bcmFocus.emit(event);\n };\n\n private handleBlur = (event: FocusEvent) => {\n this.bcmBlur.emit(event);\n };\n\n private get buttonText(): string {\n return this.text || (this.variant ? variantOptions[this.variant].text : '');\n }\n\n private get buttonIcon(): { icon?: string; position: IconPosition } {\n if (this.variant && variantOptions[this.variant].icon) {\n return {\n icon: variantOptions[this.variant].icon,\n position: variantOptions[this.variant].iconPosition || 'prefix',\n };\n }\n\n return {\n icon: this.icon,\n position: this.iconPosition,\n };\n }\n\n private get buttonStatus(): ButtonStatus {\n return this.variant ? variantOptions[this.variant].status : this.status;\n }\n\n private get buttonStyles() {\n const status = this.buttonStatus === 'default' ? 'primary' : this.buttonStatus;\n\n const kindStyleMap = {\n primary: {\n '--bcm-button-bg': `var(--bcm-ui-color-background-${status}-default)`,\n '--bcm-button-bg-hover': `var(--bcm-ui-color-background-${status}-hover)`,\n '--bcm-button-bg-active': `var(--bcm-ui-color-background-${status}-active)`,\n '--bcm-button-border': 'transparent',\n '--bcm-button-text': 'var(--bcm-ui-color-text-base)',\n },\n outline: {\n '--bcm-button-bg': 'var(--bcm-ui-color-background-default-default)',\n '--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',\n '--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',\n '--bcm-button-border': `var(--bcm-ui-color-border-${this.buttonStatus})`,\n '--bcm-button-text': `var(--bcm-ui-color-text-${this.buttonStatus})`,\n },\n ghost: {\n '--bcm-button-bg': 'transparent',\n '--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',\n '--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',\n '--bcm-button-border': 'transparent',\n '--bcm-button-text': `var(--bcm-ui-color-text-${this.buttonStatus})`,\n },\n text: {\n '--bcm-button-bg': 'transparent',\n '--bcm-button-bg-hover': 'var(--bcm-ui-color-background-default-hover)',\n '--bcm-button-bg-active': 'var(--bcm-ui-color-background-default-active)',\n '--bcm-button-border': 'transparent',\n '--bcm-button-text': `var(--bcm-ui-color-text-${status})`,\n },\n };\n\n return kindStyleMap[this.kind];\n }\n\n private buttonClass = tv(\n {\n base: 'bcm-button appearance-none inline-flex items-center justify-center border rounded',\n variants: {\n size: {\n small: 'text-size-4 py-px px-2 min-h-6',\n medium: 'text-size-5 py-0.5 px-3 min-h-8',\n large: 'text-size-6 py-1 px-3 min-h-10',\n },\n kind: {\n primary: 'kind-primary',\n ghost: 'kind-ghost',\n text: 'kind-text',\n outline: 'kind-outline',\n },\n fullWidth: {\n true: 'full-width w-full',\n },\n disabled: {\n true: 'disabled cursor-not-allowed bg-[--bcm-ui-color-background-disabled-default] text-color-disabled border-color-disabled',\n false: [\n 'cursor-pointer',\n 'bg-[--bcm-button-bg] text-[--bcm-button-text] border-[--bcm-button-border]',\n 'hover:bg-[--bcm-button-bg-hover]',\n 'active:bg-[--bcm-button-bg-active]',\n 'focus-visible:ring',\n ],\n },\n loading: {\n true: '',\n },\n },\n defaultVariants: {\n size: 'medium',\n kind: 'primary',\n fullWidth: false,\n disabled: false,\n loading: false,\n },\n },\n {\n twMerge: false,\n },\n );\n\n render() {\n const { icon, position } = this.buttonIcon;\n\n return (\n <Host>\n <button\n type={this.type}\n disabled={this.disabled || this.loading}\n aria-label={this.label}\n aria-expanded={this.expanded}\n aria-controls={this.controls}\n aria-disabled={this.disabled}\n onClick={this.handleClick}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n style={this.buttonStyles}\n class={this.buttonClass({\n size: this.size,\n kind: this.kind,\n fullWidth: this.fullWidth,\n disabled: this.disabled,\n loading: this.loading,\n })}\n >\n {this.loading && <slot name=\"loading\"></slot>}\n <span>\n <slot name=\"prefix\">{position === 'prefix' && icon && <i class={' leading-none ' + icon}></i>}</slot>\n </span>\n <slot>{this.buttonText}</slot>\n <span>\n <slot name=\"suffix\">{position === 'suffix' && icon && <i class={' leading-none ' + icon}></i>}</slot>\n </span>\n </button>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface BcmChip extends Components.BcmChip, HTMLElement {}
|
|
4
|
+
export const BcmChip: {
|
|
5
|
+
prototype: BcmChip;
|
|
6
|
+
new (): BcmChip;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|