scb-wc-test 0.1.69 → 0.1.71
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/all.js +2 -0
- package/index.d.ts +1 -0
- package/index.js +108 -106
- package/mvc/components/all.js +1 -0
- package/mvc/components/scb-app-bar/scb-app-bar.js +5 -1
- package/mvc/components/scb-badge/scb-badge.js +72 -0
- package/package.json +6 -2
- package/scb-app-bar/scb-app-bar.js +5 -1
- package/scb-badge/scb-badge.d.ts +24 -0
- package/scb-badge/scb-badge.js +143 -0
- package/scb-wc-test.bundle.js +392 -317
package/all.js
CHANGED
|
@@ -5,6 +5,7 @@ import './mvc/components/scb-accordion/scb-accordion-item.js';
|
|
|
5
5
|
import './mvc/components/scb-accordion/scb-accordion.js';
|
|
6
6
|
import './mvc/components/scb-app-bar/scb-app-bar.js';
|
|
7
7
|
import './mvc/components/scb-avatar/scb-avatar.js';
|
|
8
|
+
import './mvc/components/scb-badge/scb-badge.js';
|
|
8
9
|
import './mvc/components/scb-breadcrumb/scb-breadcrumb-item.js';
|
|
9
10
|
import './mvc/components/scb-breadcrumb/scb-breadcrumb.js';
|
|
10
11
|
import './mvc/components/scb-button/scb-button.js';
|
|
@@ -66,6 +67,7 @@ import './scb-accordion/scb-accordion-item.js';
|
|
|
66
67
|
import './scb-accordion/scb-accordion.js';
|
|
67
68
|
import './scb-app-bar/scb-app-bar.js';
|
|
68
69
|
import './scb-avatar/scb-avatar.js';
|
|
70
|
+
import './scb-badge/scb-badge.js';
|
|
69
71
|
import './scb-breadcrumb/scb-breadcrumb-item.js';
|
|
70
72
|
import './scb-breadcrumb/scb-breadcrumb.js';
|
|
71
73
|
import './scb-button/scb-button.js';
|
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './scb-accordion/scb-accordion-item';
|
|
|
2
2
|
export * from './scb-accordion/scb-accordion';
|
|
3
3
|
export * from './scb-app-bar/scb-app-bar';
|
|
4
4
|
export * from './scb-avatar/scb-avatar';
|
|
5
|
+
export * from './scb-badge/scb-badge';
|
|
5
6
|
export * from './scb-breadcrumb/scb-breadcrumb-item';
|
|
6
7
|
export * from './scb-breadcrumb/scb-breadcrumb';
|
|
7
8
|
export * from './scb-button/scb-button';
|
package/index.js
CHANGED
|
@@ -2,115 +2,117 @@ import { ScbAccordionItem as e } from "./scb-accordion/scb-accordion-item.js";
|
|
|
2
2
|
import { ScbAccordion as c } from "./scb-accordion/scb-accordion.js";
|
|
3
3
|
import { ScbAppBar as S } from "./scb-app-bar/scb-app-bar.js";
|
|
4
4
|
import { ScbAvatar as p } from "./scb-avatar/scb-avatar.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
5
|
+
import { ScbBadge as f } from "./scb-badge/scb-badge.js";
|
|
6
|
+
import { SCBBreadcrumbItem as i } from "./scb-breadcrumb/scb-breadcrumb-item.js";
|
|
7
|
+
import { SCBBreadcrumb as n } from "./scb-breadcrumb/scb-breadcrumb.js";
|
|
8
|
+
import { ScbButton as C } from "./scb-button/scb-button.js";
|
|
9
|
+
import { ScbCalendarCard as l } from "./scb-calendar-card/scb-calendar-card.js";
|
|
10
|
+
import { ScbCard as D } from "./scb-card/scb-card.js";
|
|
11
|
+
import { ScbCheckboxGroup as w } from "./scb-checkbox/scb-checkbox-group.js";
|
|
12
|
+
import { ScbCheckbox as s } from "./scb-checkbox/scb-checkbox.js";
|
|
13
|
+
import { ScbChip as H } from "./scb-chip/scb-chip.js";
|
|
14
|
+
import { ScbDialog as k } from "./scb-dialog/scb-dialog.js";
|
|
15
|
+
import { ScbDivider as y } from "./scb-divider/scb-divider.js";
|
|
16
|
+
import { ScbDrawerItem as L } from "./scb-drawer/scb-drawer-item.js";
|
|
17
|
+
import { ScbDrawerSection as P } from "./scb-drawer/scb-drawer-section.js";
|
|
18
|
+
import { ScbDrawer as N } from "./scb-drawer/scb-drawer.js";
|
|
19
|
+
import { ScbSubDrawer as z } from "./scb-drawer/scb-sub-drawer.js";
|
|
20
|
+
import { ScbFactCardContent as U } from "./scb-fact-card/scb-fact-card-content.js";
|
|
21
|
+
import { ScbFactCard as q } from "./scb-fact-card/scb-fact-card.js";
|
|
22
|
+
import { ScbFooterSection as J } from "./scb-footer/scb-footer-section.js";
|
|
23
|
+
import { ScbFooter as Q } from "./scb-footer/scb-footer.js";
|
|
24
|
+
import { ScbGridItem as W } from "./scb-grid/scb-grid-item.js";
|
|
25
|
+
import { ScbGrid as Y } from "./scb-grid/scb-grid.js";
|
|
26
|
+
import { ScbStack as _ } from "./scb-grid/scb-stack.js";
|
|
27
|
+
import { ScbHeaderDrawerGroup as rr } from "./scb-header/scb-header-drawer-group.js";
|
|
28
|
+
import { ScbHeaderDrawerItem as er } from "./scb-header/scb-header-drawer-item.js";
|
|
29
|
+
import { ScbHeaderTab as cr } from "./scb-header/scb-header-tab.js";
|
|
30
|
+
import { ScbHeaderUtility as Sr } from "./scb-header/scb-header-utility.js";
|
|
31
|
+
import { ScbHeader as pr } from "./scb-header/scb-header.js";
|
|
32
|
+
import { ScbHorizontalScroller as fr } from "./scb-horizontal-scroller/scb-horizontal-scroller.js";
|
|
33
|
+
import { ScbIconButton as ir } from "./scb-icon-button/scb-icon-button.js";
|
|
34
|
+
import { ScbKeyFigureCard as nr } from "./scb-keyfigure-card/scb-keyfigure-card.js";
|
|
35
|
+
import { ScbLink as Cr } from "./scb-link/scb-link.js";
|
|
36
|
+
import { ScbListItem as lr } from "./scb-list/scb-list-item.js";
|
|
37
|
+
import { ScbList as Dr } from "./scb-list/scb-list.js";
|
|
38
|
+
import { ScbMenuItem as wr } from "./scb-menu/scb-menu-item.js";
|
|
39
|
+
import { ScbMenu as sr } from "./scb-menu/scb-menu.js";
|
|
40
|
+
import { ScbSubMenu as Hr } from "./scb-menu/scb-sub-menu.js";
|
|
41
|
+
import { ScbNotification as kr } from "./scb-notification/scb-notification.js";
|
|
42
|
+
import { ScbNotificationCard as yr } from "./scb-notification-card/scb-notification-card.js";
|
|
43
|
+
import { ScbProgressIndicator as Lr } from "./scb-progress-indicator/scb-progress-indicator.js";
|
|
44
|
+
import { ScbRadioButton as Pr } from "./scb-radio-button/scb-radio-button.js";
|
|
45
|
+
import { ScbRadioGroup as Nr } from "./scb-radio-button/scb-radio-group.js";
|
|
46
|
+
import { ScbSearch as zr } from "./scb-search/scb-search.js";
|
|
47
|
+
import { ScbSegmentedButton as Ur } from "./scb-segmented-button/scb-segmented-button.js";
|
|
48
|
+
import { ScbSegmentedItem as qr } from "./scb-segmented-button/scb-segmented-item.js";
|
|
49
|
+
import { ScbSnackbar as Jr } from "./scb-snackbar/scb-snackbar.js";
|
|
50
|
+
import { ScbStatusPill as Qr } from "./scb-status-pill/scb-status-pill.js";
|
|
51
|
+
import { ScbSwitch as Wr } from "./scb-switch/scb-switch.js";
|
|
52
|
+
import { ScbPrimaryTab as Yr } from "./scb-tabs/scb-primary-tab.js";
|
|
53
|
+
import { ScbSecondaryTab as _r } from "./scb-tabs/scb-secondary-tab.js";
|
|
54
|
+
import { ScbTabs as ro } from "./scb-tabs/scb-tabs.js";
|
|
55
|
+
import { ScbTextField2 as eo } from "./scb-textfield/scb-textfield.js";
|
|
56
|
+
import { ScbTocItem as co } from "./scb-toc/scb-toc-item.js";
|
|
57
|
+
import { ScbToc as So } from "./scb-toc/scb-toc.js";
|
|
58
|
+
import { ScbTooltip as po } from "./scb-tooltip/scb-tooltip.js";
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
n as SCBBreadcrumb,
|
|
61
|
+
i as SCBBreadcrumbItem,
|
|
61
62
|
c as ScbAccordion,
|
|
62
63
|
e as ScbAccordionItem,
|
|
63
64
|
S as ScbAppBar,
|
|
64
65
|
p as ScbAvatar,
|
|
65
|
-
|
|
66
|
-
C as
|
|
67
|
-
l as
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
k as
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
L as
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
rr as
|
|
85
|
-
er as
|
|
86
|
-
cr as
|
|
87
|
-
|
|
88
|
-
fr as
|
|
89
|
-
ir as
|
|
90
|
-
nr as
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
kr as
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
Lr as
|
|
100
|
-
Pr as
|
|
101
|
-
Nr as
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
Ur as
|
|
105
|
-
qr as
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
ro as
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
66
|
+
f as ScbBadge,
|
|
67
|
+
C as ScbButton,
|
|
68
|
+
l as ScbCalendarCard,
|
|
69
|
+
D as ScbCard,
|
|
70
|
+
s as ScbCheckbox,
|
|
71
|
+
w as ScbCheckboxGroup,
|
|
72
|
+
H as ScbChip,
|
|
73
|
+
k as ScbDialog,
|
|
74
|
+
y as ScbDivider,
|
|
75
|
+
N as ScbDrawer,
|
|
76
|
+
L as ScbDrawerItem,
|
|
77
|
+
P as ScbDrawerSection,
|
|
78
|
+
q as ScbFactCard,
|
|
79
|
+
U as ScbFactCardContent,
|
|
80
|
+
Q as ScbFooter,
|
|
81
|
+
J as ScbFooterSection,
|
|
82
|
+
Y as ScbGrid,
|
|
83
|
+
W as ScbGridItem,
|
|
84
|
+
pr as ScbHeader,
|
|
85
|
+
rr as ScbHeaderDrawerGroup,
|
|
86
|
+
er as ScbHeaderDrawerItem,
|
|
87
|
+
cr as ScbHeaderTab,
|
|
88
|
+
Sr as ScbHeaderUtility,
|
|
89
|
+
fr as ScbHorizontalScroller,
|
|
90
|
+
ir as ScbIconButton,
|
|
91
|
+
nr as ScbKeyFigureCard,
|
|
92
|
+
Cr as ScbLink,
|
|
93
|
+
Dr as ScbList,
|
|
94
|
+
lr as ScbListItem,
|
|
95
|
+
sr as ScbMenu,
|
|
96
|
+
wr as ScbMenuItem,
|
|
97
|
+
kr as ScbNotification,
|
|
98
|
+
yr as ScbNotificationCard,
|
|
99
|
+
Yr as ScbPrimaryTab,
|
|
100
|
+
Lr as ScbProgressIndicator,
|
|
101
|
+
Pr as ScbRadioButton,
|
|
102
|
+
Nr as ScbRadioGroup,
|
|
103
|
+
zr as ScbSearch,
|
|
104
|
+
_r as ScbSecondaryTab,
|
|
105
|
+
Ur as ScbSegmentedButton,
|
|
106
|
+
qr as ScbSegmentedItem,
|
|
107
|
+
Jr as ScbSnackbar,
|
|
108
|
+
_ as ScbStack,
|
|
109
|
+
Qr as ScbStatusPill,
|
|
110
|
+
z as ScbSubDrawer,
|
|
111
|
+
Hr as ScbSubMenu,
|
|
112
|
+
Wr as ScbSwitch,
|
|
113
|
+
ro as ScbTabs,
|
|
114
|
+
eo as ScbTextField2,
|
|
115
|
+
So as ScbToc,
|
|
116
|
+
co as ScbTocItem,
|
|
117
|
+
po as ScbTooltip
|
|
116
118
|
};
|
package/mvc/components/all.js
CHANGED
|
@@ -2,6 +2,7 @@ import './scb-accordion/scb-accordion.js';
|
|
|
2
2
|
import './scb-accordion/scb-accordion-item.js';
|
|
3
3
|
import './scb-app-bar/scb-app-bar.js';
|
|
4
4
|
import './scb-avatar/scb-avatar.js';
|
|
5
|
+
import './scb-badge/scb-badge.js';
|
|
5
6
|
import './scb-breadcrumb/scb-breadcrumb.js';
|
|
6
7
|
import './scb-breadcrumb/scb-breadcrumb-item.js';
|
|
7
8
|
import './scb-button/scb-button.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,n as d,i as c,x as r,t as g}from"../../vendor/vendor.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-search/scb-search.js";import"../scb-avatar/scb-avatar.js";import"../../vendor/preload-helper.js";import"../../vendor/vendor-material.js";import"../scb-tooltip/scb-tooltip.js";import"../scb-button/scb-button.js";import"../scb-list/scb-list.js";import"../scb-list/scb-list-item.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(i,e,t){try{customElements.get(i)||s(i,e,t)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var m=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(a,s,i,e)=>{for(var t=e>1?void 0:e?f(s,i):s,n=a.length-1,o;n>=0;n--)(o=a[n])&&(t=(e?o(s,i,t):o(t))||t);return e&&t&&m(s,i,t),t};let l=class extends c{constructor(){super(...arguments),this.title="
|
|
1
|
+
import{a as h,n as d,i as c,x as r,t as g}from"../../vendor/vendor.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-search/scb-search.js";import"../scb-avatar/scb-avatar.js";import"../../vendor/preload-helper.js";import"../../vendor/vendor-material.js";import"../scb-tooltip/scb-tooltip.js";import"../scb-button/scb-button.js";import"../scb-list/scb-list.js";import"../scb-list/scb-list-item.js";(function(){try{var a=typeof globalThis<"u"?globalThis:window;if(!a.__scb_ce_guard_installed__){a.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(i,e,t){try{customElements.get(i)||s(i,e,t)}catch(o){var n=String(o||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw o}}}}catch{}})();var m=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=(a,s,i,e)=>{for(var t=e>1?void 0:e?f(s,i):s,n=a.length-1,o;n>=0;n--)(o=a[n])&&(t=(e?o(s,i,t):o(t))||t);return e&&t&&m(s,i,t),t};let l=class extends c{constructor(){super(...arguments),this.title="",this.type="default",this.position="default",this.searchSupportingText=""}handleAvatarSlotChange(a){a.target.assignedElements({flatten:!0}).forEach(e=>{e.tagName==="SCB-AVATAR"&&e.setAttribute("size","small")})}render(){switch(this.type){case"small-flexible":return r`
|
|
2
2
|
<header class="small-flexible ${this.position=="bottom"?"position-bottom":this.position=="top"?"position-top":""}" role="banner" aria-label="Small app bar">
|
|
3
3
|
<div class="leading">
|
|
4
4
|
<slot name="leading"></slot>
|
|
@@ -151,4 +151,8 @@ import{a as h,n as d,i as c,x as r,t as g}from"../../vendor/vendor.js";import"..
|
|
|
151
151
|
display: flex;
|
|
152
152
|
align-items: center;
|
|
153
153
|
}
|
|
154
|
+
.leading {
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
}
|
|
154
158
|
`];p([d({type:String})],l.prototype,"title",2);p([d({type:String})],l.prototype,"type",2);p([d({type:String,reflect:!0})],l.prototype,"position",2);p([d({type:String,attribute:"search-supporting-text"})],l.prototype,"searchSupportingText",2);l=p([g("scb-app-bar")],l);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import{a as c,n as l,i as b,x as h,t as p}from"../../vendor/vendor.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var s=customElements.define.bind(customElements);customElements.define=function(t,a,o){try{customElements.get(t)||s(t,a,o)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var g=Object.defineProperty,u=Object.getOwnPropertyDescriptor,r=(e,s,t,a)=>{for(var o=a>1?void 0:a?u(s,t):s,n=e.length-1,d;n>=0;n--)(d=e[n])&&(o=(a?d(s,t,o):d(o))||o);return a&&o&&g(s,t,o),o};let i=class extends b{constructor(){super(...arguments),this._slotClickHandler=e=>{const s=this.shadowRoot?.querySelector("slot"),t=e.target;t&&t!==s&&t.dispatchEvent(new CustomEvent("hide-badge",{bubbles:!0,composed:!0}))},this.autoHide=!1,this.position="relative",this.positionTop=0,this.positionRight=12,this.value="",this.label="",this.hidden=!1,this.variant="dot",this._badgeVisible=!0,this._onHideBadge=()=>{this._badgeVisible=!1,this.requestUpdate()}}firstUpdated(){const e=this.shadowRoot?.querySelector("slot");this.autoHide&&e&&e.addEventListener("click",this._slotClickHandler)}updated(){const e=this.shadowRoot?.querySelector("slot");e&&(this.autoHide?e.addEventListener("click",this._slotClickHandler):e.removeEventListener("click",this._slotClickHandler))}connectedCallback(){super.connectedCallback(),this.addEventListener("hide-badge",this._onHideBadge)}disconnectedCallback(){this.removeEventListener("hide-badge",this._onHideBadge),super.disconnectedCallback()}render(){this.style.setProperty("--scb-badge-absolute-top",this.positionTop+"px"),this.style.setProperty("--scb-badge-absolute-right",this.positionRight+"px");let e=this.value;!isNaN(Number(this.value))&&this.value.length>4&&(e=this.value.slice(0,4)+"+");const s=this.variant==="value"&&!this.value?"badge-value-empty":"",t=this._badgeVisible?"":"badge--hide",a=this.label||(this.variant==="dot"?"Indikator":`Märke: ${e}`);return h`
|
|
2
|
+
<div class="badge-content">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
<div
|
|
5
|
+
class="badge ${s} ${t}"
|
|
6
|
+
role="status"
|
|
7
|
+
aria-label="${this.variant==="dot",a}"
|
|
8
|
+
aria-hidden="${this.variant==="dot"&&!this.label?"true":"false"}">${this.variant==="dot"?"":e}</div>
|
|
9
|
+
</div>
|
|
10
|
+
`}};i.styles=c`
|
|
11
|
+
:host {
|
|
12
|
+
display: block;
|
|
13
|
+
position: relative;
|
|
14
|
+
width: fit-content;
|
|
15
|
+
--scb-badge-font-size: var(--scale-01);
|
|
16
|
+
--scb-badge-line-height: 100%;
|
|
17
|
+
--scb-badge-relative-gap: 0px;
|
|
18
|
+
--scb-badge-background-color: var(--md-sys-color-error);
|
|
19
|
+
--scb-badge-color: var(--md-sys-color-on-error);
|
|
20
|
+
--scb-badge-width: 8px;
|
|
21
|
+
--scb-badge-height: 8px;
|
|
22
|
+
}
|
|
23
|
+
:host([variant="value"]) .badge {
|
|
24
|
+
width: fit-content;
|
|
25
|
+
padding: 6px;
|
|
26
|
+
}
|
|
27
|
+
:host([variant="value"]) .badge.badge-value-empty{
|
|
28
|
+
width: var(--scb-badge-width);
|
|
29
|
+
padding: var(--spacing-2);
|
|
30
|
+
}
|
|
31
|
+
:host([hidden]) .badge {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
.badge {
|
|
35
|
+
transition: transform 0.25s cubic-bezier(.4,2,.6,1), opacity 0.18s linear;
|
|
36
|
+
will-change: transform, opacity;
|
|
37
|
+
}
|
|
38
|
+
.badge--hide {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transform: scale(1.3);
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
.badge{
|
|
44
|
+
background-color: var(--scb-badge-background-color);
|
|
45
|
+
color: var(--scb-badge-color);
|
|
46
|
+
font-size: var(--scb-badge-font-size);
|
|
47
|
+
font-weight: var(--weight-semibold);
|
|
48
|
+
line-height: var(--scb-badge-line-height);
|
|
49
|
+
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
|
|
50
|
+
border-radius: var(--md-sys-shape-corner-full);
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
width: var(--scb-badge-width);
|
|
55
|
+
height: var(--scb-badge-height);
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: var(--scb-badge-absolute-top);
|
|
58
|
+
left: calc(100% - var(--scb-badge-absolute-right));
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
}
|
|
61
|
+
:host([position="relative"]) .badge {
|
|
62
|
+
position: relative;
|
|
63
|
+
top: unset;
|
|
64
|
+
left: unset;
|
|
65
|
+
}
|
|
66
|
+
:host([position="relative"]) .badge-content {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
gap: var(--scb-badge-relative-gap);
|
|
71
|
+
}
|
|
72
|
+
`;r([l({type:Boolean,reflect:!0,attribute:"auto-hide"})],i.prototype,"autoHide",2);r([l({type:String,reflect:!0})],i.prototype,"position",2);r([l({type:Number,attribute:"position-top"})],i.prototype,"positionTop",2);r([l({type:Number,attribute:"position-right"})],i.prototype,"positionRight",2);r([l({type:String,reflect:!0})],i.prototype,"value",2);r([l({type:String,reflect:!0})],i.prototype,"label",2);r([l({type:Boolean,reflect:!0})],i.prototype,"hidden",2);r([l({type:String,reflect:!0})],i.prototype,"variant",2);i=r([p("scb-badge")],i);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.71",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -74,6 +74,10 @@
|
|
|
74
74
|
"import": "./scb-avatar/scb-avatar.js",
|
|
75
75
|
"require": "./scb-avatar/scb-avatar.js"
|
|
76
76
|
},
|
|
77
|
+
"./scb-badge": {
|
|
78
|
+
"import": "./scb-badge/scb-badge.js",
|
|
79
|
+
"require": "./scb-badge/scb-badge.js"
|
|
80
|
+
},
|
|
77
81
|
"./scb-breadcrumb": {
|
|
78
82
|
"import": "./scb-breadcrumb/scb-breadcrumb.js",
|
|
79
83
|
"require": "./scb-breadcrumb/scb-breadcrumb.js"
|
|
@@ -288,5 +292,5 @@
|
|
|
288
292
|
},
|
|
289
293
|
"./mvc/*": "./mvc/*"
|
|
290
294
|
},
|
|
291
|
-
"buildHash": "
|
|
295
|
+
"buildHash": "4AFCE4286FCF8A151F1ACB56B2D0ABAE1670938C70F8E5DADA1BEA57F7034084"
|
|
292
296
|
}
|
|
@@ -10,7 +10,7 @@ var m = Object.defineProperty, v = Object.getOwnPropertyDescriptor, l = (n, a, o
|
|
|
10
10
|
};
|
|
11
11
|
let i = class extends c {
|
|
12
12
|
constructor() {
|
|
13
|
-
super(...arguments), this.title = "
|
|
13
|
+
super(...arguments), this.title = "", this.type = "default", this.position = "default", this.searchSupportingText = "";
|
|
14
14
|
}
|
|
15
15
|
handleAvatarSlotChange(n) {
|
|
16
16
|
n.target.assignedElements({ flatten: !0 }).forEach((e) => {
|
|
@@ -186,6 +186,10 @@ i.styles = [
|
|
|
186
186
|
display: flex;
|
|
187
187
|
align-items: center;
|
|
188
188
|
}
|
|
189
|
+
.leading {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
}
|
|
189
193
|
`
|
|
190
194
|
];
|
|
191
195
|
l([
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* En badge-komponent baserad på Material 3 Web Component Badge.
|
|
4
|
+
* @slot - Innehåll som badgen placeras på (t.ex. ikon, text)
|
|
5
|
+
*/
|
|
6
|
+
export declare class ScbBadge extends LitElement {
|
|
7
|
+
private _slotClickHandler;
|
|
8
|
+
autoHide: boolean;
|
|
9
|
+
position: 'absolute' | 'relative';
|
|
10
|
+
positionTop: number;
|
|
11
|
+
positionRight: number;
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
hidden: boolean;
|
|
15
|
+
variant: 'dot' | 'value';
|
|
16
|
+
static styles: import('lit').CSSResult;
|
|
17
|
+
firstUpdated(): void;
|
|
18
|
+
private _badgeVisible;
|
|
19
|
+
updated(): void;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
private _onHideBadge;
|
|
23
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { css as c, LitElement as b, html as h } from "lit";
|
|
2
|
+
import { property as r, customElement as p } from "lit/decorators.js";
|
|
3
|
+
var g = Object.defineProperty, u = Object.getOwnPropertyDescriptor, o = (e, t, a, s) => {
|
|
4
|
+
for (var l = s > 1 ? void 0 : s ? u(t, a) : t, n = e.length - 1, d; n >= 0; n--)
|
|
5
|
+
(d = e[n]) && (l = (s ? d(t, a, l) : d(l)) || l);
|
|
6
|
+
return s && l && g(t, a, l), l;
|
|
7
|
+
};
|
|
8
|
+
let i = class extends b {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments), this._slotClickHandler = (e) => {
|
|
11
|
+
var s;
|
|
12
|
+
const t = (s = this.shadowRoot) == null ? void 0 : s.querySelector("slot"), a = e.target;
|
|
13
|
+
a && a !== t && a.dispatchEvent(new CustomEvent("hide-badge", { bubbles: !0, composed: !0 }));
|
|
14
|
+
}, this.autoHide = !1, this.position = "relative", this.positionTop = 0, this.positionRight = 12, this.value = "", this.label = "", this.hidden = !1, this.variant = "dot", this._badgeVisible = !0, this._onHideBadge = () => {
|
|
15
|
+
this._badgeVisible = !1, this.requestUpdate();
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
firstUpdated() {
|
|
19
|
+
var t;
|
|
20
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot");
|
|
21
|
+
this.autoHide && e && e.addEventListener("click", this._slotClickHandler);
|
|
22
|
+
}
|
|
23
|
+
updated() {
|
|
24
|
+
var t;
|
|
25
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("slot");
|
|
26
|
+
e && (this.autoHide ? e.addEventListener("click", this._slotClickHandler) : e.removeEventListener("click", this._slotClickHandler));
|
|
27
|
+
}
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback(), this.addEventListener("hide-badge", this._onHideBadge);
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
this.removeEventListener("hide-badge", this._onHideBadge), super.disconnectedCallback();
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
this.style.setProperty("--scb-badge-absolute-top", this.positionTop + "px"), this.style.setProperty("--scb-badge-absolute-right", this.positionRight + "px");
|
|
36
|
+
let e = this.value;
|
|
37
|
+
!isNaN(Number(this.value)) && this.value.length > 4 && (e = this.value.slice(0, 4) + "+");
|
|
38
|
+
const t = this.variant === "value" && !this.value ? "badge-value-empty" : "", a = this._badgeVisible ? "" : "badge--hide", s = this.label || (this.variant === "dot" ? "Indikator" : `Märke: ${e}`);
|
|
39
|
+
return h`
|
|
40
|
+
<div class="badge-content">
|
|
41
|
+
<slot></slot>
|
|
42
|
+
<div
|
|
43
|
+
class="badge ${t} ${a}"
|
|
44
|
+
role="status"
|
|
45
|
+
aria-label="${this.variant === "dot", s}"
|
|
46
|
+
aria-hidden="${this.variant === "dot" && !this.label ? "true" : "false"}">${this.variant === "dot" ? "" : e}</div>
|
|
47
|
+
</div>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
i.styles = c`
|
|
52
|
+
:host {
|
|
53
|
+
display: block;
|
|
54
|
+
position: relative;
|
|
55
|
+
width: fit-content;
|
|
56
|
+
--scb-badge-font-size: var(--scale-01);
|
|
57
|
+
--scb-badge-line-height: 100%;
|
|
58
|
+
--scb-badge-relative-gap: 0px;
|
|
59
|
+
--scb-badge-background-color: var(--md-sys-color-error);
|
|
60
|
+
--scb-badge-color: var(--md-sys-color-on-error);
|
|
61
|
+
--scb-badge-width: 8px;
|
|
62
|
+
--scb-badge-height: 8px;
|
|
63
|
+
}
|
|
64
|
+
:host([variant="value"]) .badge {
|
|
65
|
+
width: fit-content;
|
|
66
|
+
padding: 6px;
|
|
67
|
+
}
|
|
68
|
+
:host([variant="value"]) .badge.badge-value-empty{
|
|
69
|
+
width: var(--scb-badge-width);
|
|
70
|
+
padding: var(--spacing-2);
|
|
71
|
+
}
|
|
72
|
+
:host([hidden]) .badge {
|
|
73
|
+
display: none;
|
|
74
|
+
}
|
|
75
|
+
.badge {
|
|
76
|
+
transition: transform 0.25s cubic-bezier(.4,2,.6,1), opacity 0.18s linear;
|
|
77
|
+
will-change: transform, opacity;
|
|
78
|
+
}
|
|
79
|
+
.badge--hide {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transform: scale(1.3);
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
.badge{
|
|
85
|
+
background-color: var(--scb-badge-background-color);
|
|
86
|
+
color: var(--scb-badge-color);
|
|
87
|
+
font-size: var(--scb-badge-font-size);
|
|
88
|
+
font-weight: var(--weight-semibold);
|
|
89
|
+
line-height: var(--scb-badge-line-height);
|
|
90
|
+
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
|
|
91
|
+
border-radius: var(--md-sys-shape-corner-full);
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
width: var(--scb-badge-width);
|
|
96
|
+
height: var(--scb-badge-height);
|
|
97
|
+
position: absolute;
|
|
98
|
+
top: var(--scb-badge-absolute-top);
|
|
99
|
+
left: calc(100% - var(--scb-badge-absolute-right));
|
|
100
|
+
white-space: nowrap;
|
|
101
|
+
}
|
|
102
|
+
:host([position="relative"]) .badge {
|
|
103
|
+
position: relative;
|
|
104
|
+
top: unset;
|
|
105
|
+
left: unset;
|
|
106
|
+
}
|
|
107
|
+
:host([position="relative"]) .badge-content {
|
|
108
|
+
display: flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
justify-content: center;
|
|
111
|
+
gap: var(--scb-badge-relative-gap);
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
o([
|
|
115
|
+
r({ type: Boolean, reflect: !0, attribute: "auto-hide" })
|
|
116
|
+
], i.prototype, "autoHide", 2);
|
|
117
|
+
o([
|
|
118
|
+
r({ type: String, reflect: !0 })
|
|
119
|
+
], i.prototype, "position", 2);
|
|
120
|
+
o([
|
|
121
|
+
r({ type: Number, attribute: "position-top" })
|
|
122
|
+
], i.prototype, "positionTop", 2);
|
|
123
|
+
o([
|
|
124
|
+
r({ type: Number, attribute: "position-right" })
|
|
125
|
+
], i.prototype, "positionRight", 2);
|
|
126
|
+
o([
|
|
127
|
+
r({ type: String, reflect: !0 })
|
|
128
|
+
], i.prototype, "value", 2);
|
|
129
|
+
o([
|
|
130
|
+
r({ type: String, reflect: !0 })
|
|
131
|
+
], i.prototype, "label", 2);
|
|
132
|
+
o([
|
|
133
|
+
r({ type: Boolean, reflect: !0 })
|
|
134
|
+
], i.prototype, "hidden", 2);
|
|
135
|
+
o([
|
|
136
|
+
r({ type: String, reflect: !0 })
|
|
137
|
+
], i.prototype, "variant", 2);
|
|
138
|
+
i = o([
|
|
139
|
+
p("scb-badge")
|
|
140
|
+
], i);
|
|
141
|
+
export {
|
|
142
|
+
i as ScbBadge
|
|
143
|
+
};
|