scb-wc-test 0.1.124 → 0.1.126
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 +114 -112
- package/mvc/components/all.js +1 -0
- package/mvc/components/scb-calendar/scb-calendar.js +35 -23
- package/mvc/components/scb-collapse/scb-collapse.js +59 -0
- package/package.json +6 -2
- package/scb-calendar/scb-calendar.d.ts +4 -1
- package/scb-calendar/scb-calendar.js +177 -143
- package/scb-collapse/scb-collapse.d.ts +18 -0
- package/scb-collapse/scb-collapse.js +152 -0
- package/scb-wc-test.bundle.js +479 -409
package/all.js
CHANGED
|
@@ -17,6 +17,7 @@ import './mvc/components/scb-card/scb-card.js';
|
|
|
17
17
|
import './mvc/components/scb-checkbox/scb-checkbox-group.js';
|
|
18
18
|
import './mvc/components/scb-checkbox/scb-checkbox.js';
|
|
19
19
|
import './mvc/components/scb-chip/scb-chip.js';
|
|
20
|
+
import './mvc/components/scb-collapse/scb-collapse.js';
|
|
20
21
|
import './mvc/components/scb-cookies-consent/scb-cookies-consent.js';
|
|
21
22
|
import './mvc/components/scb-datepicker/scb-datepicker.js';
|
|
22
23
|
import './mvc/components/scb-dialog/scb-dialog.js';
|
|
@@ -92,6 +93,7 @@ import './scb-card/scb-card.js';
|
|
|
92
93
|
import './scb-checkbox/scb-checkbox-group.js';
|
|
93
94
|
import './scb-checkbox/scb-checkbox.js';
|
|
94
95
|
import './scb-chip/scb-chip.js';
|
|
96
|
+
import './scb-collapse/scb-collapse.js';
|
|
95
97
|
import './scb-cookies-consent/scb-cookies-consent.js';
|
|
96
98
|
import './scb-datepicker/scb-datepicker.js';
|
|
97
99
|
import './scb-dialog/scb-dialog.js';
|
package/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from './scb-card/scb-card';
|
|
|
13
13
|
export * from './scb-checkbox/scb-checkbox-group';
|
|
14
14
|
export * from './scb-checkbox/scb-checkbox';
|
|
15
15
|
export * from './scb-chip/scb-chip';
|
|
16
|
+
export * from './scb-collapse/scb-collapse';
|
|
16
17
|
export * from './scb-cookies-consent/scb-cookies-consent';
|
|
17
18
|
export * from './scb-datepicker/scb-datepicker';
|
|
18
19
|
export * from './scb-dialog/scb-dialog';
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ScbAvatar as b } from "./scb-avatar/scb-avatar.js";
|
|
|
5
5
|
import { ScbBadge as f } from "./scb-badge/scb-badge.js";
|
|
6
6
|
import { SCBBreadcrumbItem as i } from "./scb-breadcrumb/scb-breadcrumb-item.js";
|
|
7
7
|
import { SCBBreadcrumb as d } from "./scb-breadcrumb/scb-breadcrumb.js";
|
|
8
|
-
import { ScbButton as
|
|
8
|
+
import { ScbButton as l } from "./scb-button/scb-button.js";
|
|
9
9
|
import { ScbCalendarEvent as s } from "./scb-calendar/scb-calendar-event.js";
|
|
10
10
|
import { ScbCalendar as B } from "./scb-calendar/scb-calendar.js";
|
|
11
11
|
import { ScbCalendarCard as D } from "./scb-calendar-card/scb-calendar-card.js";
|
|
@@ -13,61 +13,62 @@ import { ScbCard as T } from "./scb-card/scb-card.js";
|
|
|
13
13
|
import { ScbCheckboxGroup as F } from "./scb-checkbox/scb-checkbox-group.js";
|
|
14
14
|
import { ScbCheckbox as P } from "./scb-checkbox/scb-checkbox.js";
|
|
15
15
|
import { ScbChip as G } from "./scb-chip/scb-chip.js";
|
|
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 {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
16
|
+
import { ScbCollapse as A } from "./scb-collapse/scb-collapse.js";
|
|
17
|
+
import { ScbCookiesConsent as L } from "./scb-cookies-consent/scb-cookies-consent.js";
|
|
18
|
+
import { ScbDatepicker as z } from "./scb-datepicker/scb-datepicker.js";
|
|
19
|
+
import { ScbDialog as E } from "./scb-dialog/scb-dialog.js";
|
|
20
|
+
import { ScbDivider as N } from "./scb-divider/scb-divider.js";
|
|
21
|
+
import { ScbDrawerItem as U } from "./scb-drawer/scb-drawer-item.js";
|
|
22
|
+
import { ScbDrawerSection as j } from "./scb-drawer/scb-drawer-section.js";
|
|
23
|
+
import { ScbDrawer as J } from "./scb-drawer/scb-drawer.js";
|
|
24
|
+
import { ScbSubDrawer as W } from "./scb-drawer/scb-sub-drawer.js";
|
|
25
|
+
import { ScbFactCardContent as Y } from "./scb-fact-card/scb-fact-card-content.js";
|
|
26
|
+
import { ScbFactCard as _ } from "./scb-fact-card/scb-fact-card.js";
|
|
27
|
+
import { ScbFooterSection as rr } from "./scb-footer/scb-footer-section.js";
|
|
28
|
+
import { ScbFooter as er } from "./scb-footer/scb-footer.js";
|
|
29
|
+
import { ScbGridItem as cr } from "./scb-grid/scb-grid-item.js";
|
|
30
|
+
import { ScbGrid as pr } from "./scb-grid/scb-grid.js";
|
|
31
|
+
import { ScbStack as br } from "./scb-grid/scb-stack.js";
|
|
32
|
+
import { ScbHeaderDrawerGroup as fr } from "./scb-header/scb-header-drawer-group.js";
|
|
33
|
+
import { ScbHeaderDrawerItem as ir } from "./scb-header/scb-header-drawer-item.js";
|
|
34
|
+
import { ScbHeaderTab as dr } from "./scb-header/scb-header-tab.js";
|
|
35
|
+
import { ScbHeaderUtility as lr } from "./scb-header/scb-header-utility.js";
|
|
36
|
+
import { ScbHeader as sr } from "./scb-header/scb-header.js";
|
|
37
|
+
import { ScbHorizontalScroller as Br } from "./scb-horizontal-scroller/scb-horizontal-scroller.js";
|
|
38
|
+
import { ScbIconButton as Dr } from "./scb-icon-button/scb-icon-button.js";
|
|
39
|
+
import { ScbKeyFigureCard as Tr } from "./scb-keyfigure-card/scb-keyfigure-card.js";
|
|
40
|
+
import { ScbLink as Fr } from "./scb-link/scb-link.js";
|
|
41
|
+
import { ScbListItem as Pr } from "./scb-list/scb-list-item.js";
|
|
42
|
+
import { ScbList as Gr } from "./scb-list/scb-list.js";
|
|
43
|
+
import { ScbMenuItem as Ar } from "./scb-menu/scb-menu-item.js";
|
|
44
|
+
import { ScbMenu as Lr } from "./scb-menu/scb-menu.js";
|
|
45
|
+
import { ScbSubMenu as zr } from "./scb-menu/scb-sub-menu.js";
|
|
46
|
+
import { ScbNotificationCard as Er } from "./scb-notification-card/scb-notification-card.js";
|
|
47
|
+
import { ScbPagination as Nr } from "./scb-pagination/scb-pagination.js";
|
|
48
|
+
import { ScbProgressIndicator as Ur } from "./scb-progress-indicator/scb-progress-indicator.js";
|
|
49
|
+
import { ScbProgressStep as jr } from "./scb-progress-stepper/scb-progress-step.js";
|
|
50
|
+
import { ScbProgressStepper as Jr } from "./scb-progress-stepper/scb-progress-stepper.js";
|
|
51
|
+
import { ScbRadioButton as Wr } from "./scb-radio-button/scb-radio-button.js";
|
|
52
|
+
import { ScbRadioGroup as Yr } from "./scb-radio-button/scb-radio-group.js";
|
|
53
|
+
import { ScbSearch as _r } from "./scb-search/scb-search.js";
|
|
54
|
+
import { ScbSegmentedButton as ro } from "./scb-segmented-button/scb-segmented-button.js";
|
|
55
|
+
import { ScbSegmentedItem as eo } from "./scb-segmented-button/scb-segmented-item.js";
|
|
56
|
+
import { ScbSelectOption as co } from "./scb-select/scb-select-option.js";
|
|
57
|
+
import { ScbSelect as po } from "./scb-select/scb-select.js";
|
|
58
|
+
import { ScbSkeleton as bo } from "./scb-skeleton/scb-skeleton.js";
|
|
59
|
+
import { ScbSnackbar as fo } from "./scb-snackbar/scb-snackbar.js";
|
|
60
|
+
import { ScbStatusPill as io } from "./scb-status-pill/scb-status-pill.js";
|
|
61
|
+
import { ScbStep as Co } from "./scb-stepper/scb-step.js";
|
|
62
|
+
import { ScbStepper as uo } from "./scb-stepper/scb-stepper.js";
|
|
63
|
+
import { ScbSwitch as Io } from "./scb-switch/scb-switch.js";
|
|
64
|
+
import { ScbPrimaryTab as go } from "./scb-tabs/scb-primary-tab.js";
|
|
65
|
+
import { ScbSecondaryTab as ko } from "./scb-tabs/scb-secondary-tab.js";
|
|
66
|
+
import { ScbTabs as wo } from "./scb-tabs/scb-tabs.js";
|
|
67
|
+
import { ScbTextField as Ho } from "./scb-textfield/scb-textfield.js";
|
|
68
|
+
import { ScbTocItem as ho } from "./scb-toc/scb-toc-item.js";
|
|
69
|
+
import { ScbToc as yo } from "./scb-toc/scb-toc.js";
|
|
70
|
+
import { ScbTooltip as vo } from "./scb-tooltip/scb-tooltip.js";
|
|
71
|
+
import { ScbViz as Mo } from "./scb-viz/scb-viz.js";
|
|
71
72
|
export {
|
|
72
73
|
d as SCBBreadcrumb,
|
|
73
74
|
i as SCBBreadcrumbItem,
|
|
@@ -76,7 +77,7 @@ export {
|
|
|
76
77
|
p as ScbAppBar,
|
|
77
78
|
b as ScbAvatar,
|
|
78
79
|
f as ScbBadge,
|
|
79
|
-
|
|
80
|
+
l as ScbButton,
|
|
80
81
|
B as ScbCalendar,
|
|
81
82
|
D as ScbCalendarCard,
|
|
82
83
|
s as ScbCalendarEvent,
|
|
@@ -84,59 +85,60 @@ export {
|
|
|
84
85
|
P as ScbCheckbox,
|
|
85
86
|
F as ScbCheckboxGroup,
|
|
86
87
|
G as ScbChip,
|
|
87
|
-
A as
|
|
88
|
-
L as
|
|
89
|
-
z as
|
|
90
|
-
E as
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
U as
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
fr as
|
|
103
|
-
ir as
|
|
104
|
-
dr as
|
|
105
|
-
|
|
106
|
-
Br as
|
|
107
|
-
Dr as
|
|
108
|
-
Tr as
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
Er as
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Ur as
|
|
118
|
-
jr as
|
|
119
|
-
Jr as
|
|
120
|
-
Wr as
|
|
121
|
-
Yr as
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
ro as
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
bo as
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
io as
|
|
132
|
-
Co as
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
wo as
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
vo as
|
|
88
|
+
A as ScbCollapse,
|
|
89
|
+
L as ScbCookiesConsent,
|
|
90
|
+
z as ScbDatepicker,
|
|
91
|
+
E as ScbDialog,
|
|
92
|
+
N as ScbDivider,
|
|
93
|
+
J as ScbDrawer,
|
|
94
|
+
U as ScbDrawerItem,
|
|
95
|
+
j as ScbDrawerSection,
|
|
96
|
+
_ as ScbFactCard,
|
|
97
|
+
Y as ScbFactCardContent,
|
|
98
|
+
er as ScbFooter,
|
|
99
|
+
rr as ScbFooterSection,
|
|
100
|
+
pr as ScbGrid,
|
|
101
|
+
cr as ScbGridItem,
|
|
102
|
+
sr as ScbHeader,
|
|
103
|
+
fr as ScbHeaderDrawerGroup,
|
|
104
|
+
ir as ScbHeaderDrawerItem,
|
|
105
|
+
dr as ScbHeaderTab,
|
|
106
|
+
lr as ScbHeaderUtility,
|
|
107
|
+
Br as ScbHorizontalScroller,
|
|
108
|
+
Dr as ScbIconButton,
|
|
109
|
+
Tr as ScbKeyFigureCard,
|
|
110
|
+
Fr as ScbLink,
|
|
111
|
+
Gr as ScbList,
|
|
112
|
+
Pr as ScbListItem,
|
|
113
|
+
Lr as ScbMenu,
|
|
114
|
+
Ar as ScbMenuItem,
|
|
115
|
+
Er as ScbNotificationCard,
|
|
116
|
+
Nr as ScbPagination,
|
|
117
|
+
go as ScbPrimaryTab,
|
|
118
|
+
Ur as ScbProgressIndicator,
|
|
119
|
+
jr as ScbProgressStep,
|
|
120
|
+
Jr as ScbProgressStepper,
|
|
121
|
+
Wr as ScbRadioButton,
|
|
122
|
+
Yr as ScbRadioGroup,
|
|
123
|
+
_r as ScbSearch,
|
|
124
|
+
ko as ScbSecondaryTab,
|
|
125
|
+
ro as ScbSegmentedButton,
|
|
126
|
+
eo as ScbSegmentedItem,
|
|
127
|
+
po as ScbSelect,
|
|
128
|
+
co as ScbSelectOption,
|
|
129
|
+
bo as ScbSkeleton,
|
|
130
|
+
fo as ScbSnackbar,
|
|
131
|
+
br as ScbStack,
|
|
132
|
+
io as ScbStatusPill,
|
|
133
|
+
Co as ScbStep,
|
|
134
|
+
uo as ScbStepper,
|
|
135
|
+
W as ScbSubDrawer,
|
|
136
|
+
zr as ScbSubMenu,
|
|
137
|
+
Io as ScbSwitch,
|
|
138
|
+
wo as ScbTabs,
|
|
139
|
+
Ho as ScbTextField,
|
|
140
|
+
yo as ScbToc,
|
|
141
|
+
ho as ScbTocItem,
|
|
142
|
+
vo as ScbTooltip,
|
|
143
|
+
Mo as ScbViz
|
|
142
144
|
};
|
package/mvc/components/all.js
CHANGED
|
@@ -13,6 +13,7 @@ import './scb-card/scb-card.js';
|
|
|
13
13
|
import './scb-checkbox/scb-checkbox.js';
|
|
14
14
|
import './scb-checkbox/scb-checkbox-group.js';
|
|
15
15
|
import './scb-chip/scb-chip.js';
|
|
16
|
+
import './scb-collapse/scb-collapse.js';
|
|
16
17
|
import './scb-cookies-consent/scb-cookies-consent.js';
|
|
17
18
|
import './scb-datepicker/scb-datepicker.js';
|
|
18
19
|
import './scb-dialog/scb-dialog.js';
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as N,n as O,i as H,x as v,t as q}from"../../vendor/vendor.js";import"./scb-calendar-event.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-dialog/scb-dialog.js";import"../scb-list/scb-list.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";import"../scb-button/scb-button.js";import"../scb-textfield/scb-textfield.js";import"../scb-datepicker/scb-datepicker.js";import"../scb-divider/scb-divider.js";import"../scb-checkbox/scb-checkbox.js";import"../scb-checkbox/scb-checkbox-group.js";import"../scb-radio-button/scb-radio-button.js";import"../scb-radio-button/scb-radio-group.js";import"../scb-switch/scb-switch.js";import"../scb-chip/scb-chip.js";import"../scb-list/scb-list-item.js";(function(){try{var e=typeof globalThis<"u"?globalThis:window;if(!e.__scb_ce_guard_installed__){e.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(a,r,d){try{customElements.get(a)||t(a,r,d)}catch(c){var s=String(c||"");if(s.indexOf("already been used")===-1&&s.indexOf("NotSupportedError")===-1)throw c}}}}catch{}})();var L=Object.defineProperty,W=Object.getOwnPropertyDescriptor,S=(e,t,a,r)=>{for(var d=r>1?void 0:r?W(t,a):t,s=e.length-1,c;s>=0;s--)(c=e[s])&&(d=(r?c(t,a,d):c(d))||d);return r&&d&&L(t,a,d),d};let x=class extends H{constructor(){super(...arguments),this._lastActiveDay=null,this.lang="sv",this.disableWeekend=!1,this.publicHolidays=!0,this._mutationObserver=null,this._onCalendarKeyDown=e=>{const a=Array.from(this.shadowRoot?.querySelectorAll(".calendar-day.has-event")??[]),r=this.shadowRoot?.activeElement,d=r&&a.includes(r)?r:document.activeElement,s=a.indexOf(d);if(s===-1)return;let c=s;const p=this.disableWeekend?5:7;switch(e.key){case"ArrowRight":c=s+1<a.length?s+1:s;break;case"ArrowLeft":c=s-1>=0?s-1:s;break;case"ArrowDown":c=s+p<a.length?s+p:s;break;case"ArrowUp":c=s-p>=0?s-p:s;break;default:return}c!==s&&(e.preventDefault(),a[c].focus())},this._onEventChanged=()=>{this.requestUpdate()},this._today=new Date,this._current=new Date,this._popupEvent=null,this._restoreDayFocus=()=>{this._lastActiveDay&&setTimeout(()=>{this._lastActiveDay?.focus(),this._lastActiveDay=null},0)},this._easterDateCalculated={}}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this._onEventChanged),this._mutationObserver=new MutationObserver(()=>{this.requestUpdate()}),this._mutationObserver.observe(this,{childList:!0}),this.addEventListener("keydown",this._onCalendarKeyDown)}disconnectedCallback(){this.removeEventListener("change",this._onEventChanged),super.disconnectedCallback(),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null),this.removeEventListener("keydown",this._onCalendarKeyDown)}_daysInMonth(e,t){return new Date(e,t+1,0).getDate()}_firstDayOfWeek(e,t){const a=new Date(e,t,1).getDay();return a===0?6:a-1}_prevMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()-1,1),this.requestUpdate()}_nextMonth(){this._current=new Date(this._current.getFullYear(),this._current.getMonth()+1,1),this.requestUpdate()}_showEventPopup(e){this._popupEvent=e,this._lastActiveDay=this.shadowRoot?.activeElement||document.activeElement,this.requestUpdate(),setTimeout(()=>{const t=this.shadowRoot?.querySelector("scb-dialog");t&&(document.activeElement&&(t.__lastTriggerEl=document.activeElement),t.open=!0,t.addEventListener("close",this._restoreDayFocus,{once:!0}));const a=r=>{r.target?.closest(".event-popup")||this._closePopup()};window.addEventListener("mousedown",a,{once:!0})},0)}_closePopup(){const e=this.shadowRoot?.querySelector("scb-dialog");e&&e.removeAttribute("open"),this._popupEvent=null,this.requestUpdate()}_addDays(e,t){const a=new Date(e.valueOf());return a.setDate(a.getDate()+t),a}_easterDay(e){if(typeof this._easterDateCalculated["Ar"+e]<"u")return new Date(this._easterDateCalculated["Ar"+e]);let t=e;t<100&&(t=t+1900),t<1950&&(t=t+100);const a=t%19,r=t%4,d=t%7,s=(19*a+24)%30,c=(2*r+4*d+6*s+5)%7;let p=22+s+c,w=0;p==57&&(p-=7),p==56&&s==28&&c==6&&a>10&&(p-=7),p>31?(p-=31,w=4):w=3;const _=new Date(t,w-1,p);return this._easterDateCalculated["Ar"+e]=_,new Date(this._easterDateCalculated["Ar"+e])}_swedishHolidayName(e){const t=e.getMonth();if(t===1||t===6||t===7||t===8)return null;const a=e.getMonth()+1,r=e.getDate(),d=e.getFullYear(),s=this._easterDay(d),c=this.lang==="en",p=[["Nyårsdagen","New Year's Day",a===1&&r===1],["Trettondedag jul","Epiphany",a===1&&r===6],["Långfredag","Good Friday",+e==+this._addDays(s,-2)],["Påskdagen","Easter Sunday",+e==+s],["Annandag påsk","Easter Monday",+e==+this._addDays(s,1)],["Kristi himmelsfärdsdag","Ascension Day",+e==+this._addDays(s,39)],["Pingstdagen","Pentecost",+e==+this._addDays(s,50)&&d<2005],["Första maj","May Day",a===5&&r===1],["Nationaldagen","National Day",a===6&&r===6&&d>=2005],["Midsommarafton","Midsummer's Eve",a===6&&r>=19&&r<=25&&e.getDay()===5],["Midsommardagen","Midsummer's Day",a===6&&r>=20&&r<=26&&e.getDay()===6],["Julafton","Christmas Eve",a===12&&r===24],["Juldagen","Christmas Day",a===12&&r===25],["Annandag jul","Boxing Day",a===12&&r===26],["Alla helgons dag","All Saints' Day",a===10&&r>=31&&e.getDay()===6||a===11&&r<=6&&e.getDay()===6]];for(const w of p){const[_,A,$]=w;if($)return c?A:_}return null}render(){const e=this._current.getFullYear(),t=this._current.getMonth(),a=this._daysInMonth(e,t),r=this._firstDayOfWeek(e,t),d=this._today,s=this.lang==="en",c=s?["January","February","March","April","May","June","July","August","September","October","November","December"]:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"];let p=s?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]:["Mån","Tis","Ons","Tor","Fre","Lör","Sön"];this.disableWeekend&&(p=p.slice(0,5));const w=Array.from(this.querySelectorAll("scb-calendar-event")),_=new Map;for(const n of w){const o=n.getAttribute("start-date")||"",y=n.getAttribute("end-date")||"";if(o&&y){const l=new Date(o),g=new Date(y);for(let u=new Date(l);u<=g;u.setDate(u.getDate()+1)){const f=u.toISOString().split("T")[0],k=_.get(f)||[];k.push({title:n.title,description:n.description,start:o,end:y}),_.set(f,k)}}else if(o&&n.title){const l=o.split("T")[0],g=_.get(l)||[];g.push({title:n.title,description:n.description,start:o}),_.set(l,g)}}const A=[];let $=1;for(let n=0;n<6;n++){const o=[],y=this.disableWeekend?[0,1,2,3,4]:[0,1,2,3,4,5,6];let l=$;for(let g=0;g<y.length;g++){const u=y[g];if(n===0&&u<r){if(!this.disableWeekend||u<5){const f=t===0?11:t-1,k=t===0?e-1:e,C=this._daysInMonth(k,f)-(r-u-1);o.push(v`
|
|
2
2
|
<div class="calendar-day calendar-day--other">
|
|
3
|
-
<span class="calendar-day-number">${
|
|
3
|
+
<span class="calendar-day-number">${C}</span>
|
|
4
4
|
</div>
|
|
5
|
-
`)}}else if(l>
|
|
5
|
+
`)}}else if(l>a)o.push(v`<div></div>`);else{let f=new Date(e,t,l);if(this.disableWeekend)for(;f.getDay()===0||f.getDay()===6;)l++,f=new Date(e,t,l);if(l>a){o.push(v`<div></div>`);continue}const k=d.getFullYear()===e&&d.getMonth()===t&&d.getDate()===l,b=`${e}-${String(t+1).padStart(2,"0")}-${String(l).padStart(2,"0")}`,C=new Date(e,t,l);let F=!1,D=null;this.publicHolidays&&(D=this._swedishHolidayName(C),F=!!D);let h=_.get(b)||[];h=[...h].sort((i,m)=>{const T=i.start&&b===i.start.split("T")[0]?i.start:i.end&&b===i.end.split("T")[0]?i.end:"",E=m.start&&b===m.start.split("T")[0]?m.start:m.end&&m.end.split("T")[0]?m.end:"",M=T&&T.includes("T"),P=E&&E.includes("T");return M&&P?T.localeCompare(E):M?-1:P?1:i.title.localeCompare(m.title)});const j=[...h].map(i=>{let m="",T="";if(i.start&&i.end){const E=i.start.split("T")[0],M=i.end.split("T")[0];b===E&&b===M&&i.start.includes("T")&&i.end.includes("T")?m=i.start.split("T")[1].substring(0,5)+"–"+i.end.split("T")[1].substring(0,5):b===E&&i.start.includes("T")?m=i.start.split("T")[1].substring(0,5):b===M&&i.end.includes("T")?(m=i.end.split("T")[1].substring(0,5),T=s?"cont. ":"fort. "):b!==E&&(m="",T=s?"cont. ":"fort. ")}else i.start&&i.start.includes("T")&&(m=i.start.split("T")[1].substring(0,5));return{...i,time:m,prefix:T}});o.push(v`
|
|
6
6
|
<div
|
|
7
|
-
class="calendar-day${
|
|
8
|
-
tabindex=${
|
|
9
|
-
@click=${
|
|
10
|
-
@keydown=${
|
|
11
|
-
title=${
|
|
12
|
-
role=${
|
|
13
|
-
aria-label=${
|
|
7
|
+
class="calendar-day${k?" today":""}${h.length?" has-event":""}${F?" calendar-day--holiday":""}"
|
|
8
|
+
tabindex=${h.length?"0":void 0}
|
|
9
|
+
@click=${h.length?()=>this._showEventPopup({date:b,events:h}):null}
|
|
10
|
+
@keydown=${h.length?i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),this._showEventPopup({date:b,events:h}))}:null}
|
|
11
|
+
title=${D||(h.length===1?h[0].title:h.length>1?h.map(i=>i.title).join(", "):"")}
|
|
12
|
+
role=${h.length?"button":void 0}
|
|
13
|
+
aria-label=${D||(h.length?h.length===1?h[0].title:h.map(i=>i.title).join(", "):void 0)}
|
|
14
14
|
>
|
|
15
15
|
<md-focus-ring inward></md-focus-ring>
|
|
16
|
-
<span class="calendar-day-number">${l}</span>
|
|
16
|
+
<span class="calendar-day-number">${l} ${D?v`<span class="calendar-day-holiday-name">${D}</span>`:""}</span>
|
|
17
17
|
<div class="calendar-titles-wrapper">
|
|
18
|
-
|
|
18
|
+
${j.map(i=>v`<span class="calendar-day-event-title">${i.prefix||""}${i.title}</span>`)}
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
|
-
`),l++}}if(
|
|
21
|
+
`),l++}}if($=l,A.push(v`<div class="calendar-grid">${o}</div>`),$>a)break}return v`
|
|
22
22
|
<div class="calendar-header">
|
|
23
|
-
<scb-icon-button @click=${this._prevMonth} icon="chevron_left" aria-label="${
|
|
24
|
-
<span>${c[
|
|
25
|
-
<scb-icon-button @click=${this._nextMonth} icon="chevron_right" aria-label="${
|
|
23
|
+
<scb-icon-button @click=${this._prevMonth} icon="chevron_left" aria-label="${s?"Previous month":"Föregående månad"}"></scb-icon-button>
|
|
24
|
+
<span>${c[t]} ${e}</span>
|
|
25
|
+
<scb-icon-button @click=${this._nextMonth} icon="chevron_right" aria-label="${s?"Next month":"Nästa månad"}"></scb-icon-button>
|
|
26
26
|
</div>
|
|
27
27
|
<div class="calendar-grid calendar-grid-days">
|
|
28
|
-
${
|
|
28
|
+
${p.map(n=>v`<div>${n}</div>`)}
|
|
29
29
|
</div>
|
|
30
30
|
<div class="calendar-weeks">
|
|
31
|
-
${
|
|
31
|
+
${A}
|
|
32
32
|
</div>
|
|
33
33
|
${this._popupEvent&&Array.isArray(this._popupEvent.events)?v`
|
|
34
|
-
<scb-dialog variant="floating" open label="${
|
|
34
|
+
<scb-dialog variant="floating" open label="${s?"Events":"Händelser"} ${this._popupEvent.date}">
|
|
35
35
|
<scb-list>
|
|
36
|
-
${[...this._popupEvent.events].sort((
|
|
37
|
-
<scb-list-item label="${l}${
|
|
36
|
+
${[...this._popupEvent.events].sort((n,o)=>{const y=n.start&&n.start.includes("T")?n.start:n.end&&n.end.includes("T")?n.end:"",l=o.start&&o.start.includes("T")?o.start:o.end&&o.end.includes("T")?o.end:"",g=y&&y.includes("T"),u=l&&l.includes("T");return g&&u?y.localeCompare(l):g?-1:u?1:n.title.localeCompare(o.title)}).map(n=>{const o=this._popupEvent?.date??"";let y="",l="",g="";if(n.start&&n.end){const u=n.start.split("T")[0],f=n.end.split("T")[0];u===f&&n.start.includes("T")&&n.end.includes("T")?y=n.start.split("T")[1].substring(0,5)+" – "+n.end.split("T")[1].substring(0,5):o===u&&n.start.includes("T")&&(y="Start: "+n.start.split("T")[1].substring(0,5)+(s?" (Extended event) ":" (Flerdagsevenemang) ")),o===f&&n.end.includes("T")&&u!==f&&(g=(s?"End: ":"Slut: ")+n.end.split("T")[1].substring(0,5)),o!==u&&(l=s?"cont. ":"fort. ")}else n.start&&n.start.includes("T")&&(y=n.start.split("T")[1].substring(0,5));return v`
|
|
37
|
+
<scb-list-item label="${l}${n.title}" supporting-text="${n.description?n.description:""}" overline="${y||""}${g||""}">
|
|
38
38
|
</scb-list-item>`})}
|
|
39
39
|
</scb-list>
|
|
40
40
|
</scb-dialog>
|
|
41
41
|
`:""}
|
|
42
|
-
`}};
|
|
42
|
+
`}};x.styles=N`
|
|
43
43
|
:host {
|
|
44
44
|
display: block;
|
|
45
45
|
border: 1px solid var(--md-sys-color-outline-variant);
|
|
@@ -104,6 +104,8 @@ import{a as P,n as S,i as j,x as v,t as q}from"../../vendor/vendor.js";import"./
|
|
|
104
104
|
line-height: var(--md-sys-typescale-label-small-line-height); /* vissa tabeller i Figma visar 21 */
|
|
105
105
|
font-weight: var(--md-sys-typescale-label-small-weight);
|
|
106
106
|
letter-spacing: var(--md-sys-typescale-label-small-tracking);
|
|
107
|
+
display: flex;
|
|
108
|
+
gap: 8px;
|
|
107
109
|
}
|
|
108
110
|
.calendar-day-event-title {
|
|
109
111
|
font-size: 12px;
|
|
@@ -114,6 +116,16 @@ import{a as P,n as S,i as j,x as v,t as q}from"../../vendor/vendor.js";import"./
|
|
|
114
116
|
display: block;
|
|
115
117
|
width: 100%;
|
|
116
118
|
}
|
|
119
|
+
.calendar-day-holiday-name{
|
|
120
|
+
color: var(--md-sys-color-on-error-container);
|
|
121
|
+
font-weight: var(--md-sys-typescale-body-medium-weight);
|
|
122
|
+
font-size: 12px;
|
|
123
|
+
white-space: nowrap;
|
|
124
|
+
overflow: hidden;
|
|
125
|
+
text-overflow: ellipsis;
|
|
126
|
+
display: block;
|
|
127
|
+
width: 100%;
|
|
128
|
+
}
|
|
117
129
|
.calendar-day.today {
|
|
118
130
|
background: var(--md-sys-color-secondary-container);
|
|
119
131
|
|
|
@@ -130,4 +142,4 @@ import{a as P,n as S,i as j,x as v,t as q}from"../../vendor/vendor.js";import"./
|
|
|
130
142
|
gap: var(--spacing-4);
|
|
131
143
|
}
|
|
132
144
|
|
|
133
|
-
`;
|
|
145
|
+
`;S([O({type:String})],x.prototype,"lang",2);S([O({type:Boolean,attribute:"disable-weekend"})],x.prototype,"disableWeekend",2);S([O({type:Boolean,attribute:"public-holidays"})],x.prototype,"publicHolidays",2);x=S([q("scb-calendar")],x);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import{a as h,n as r,i as p,x as c,t as u}from"../../vendor/vendor.js";import"../scb-button/scb-button.js";import"../../vendor/vendor-material.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(i,o,s){try{customElements.get(i)||e(i,o,s)}catch(d){var n=String(d||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var m=Object.defineProperty,b=Object.getOwnPropertyDescriptor,l=(t,e,i,o)=>{for(var s=o>1?void 0:o?b(e,i):e,n=t.length-1,d;n>=0;n--)(d=t[n])&&(s=(o?d(e,i,s):d(s))||s);return o&&s&&m(e,i,s),s};let a=class extends p{constructor(){super(...arguments),this.variant="elements",this.collapsedHeight=40,this.visibleElements=1,this.expanded=!1,this._elementCount=0,this.expandButtonLabel="Visa fler",this.collapseButtonLabel="Stäng",this._contentHeight=0}toggle(){this.expanded=!this.expanded}firstUpdated(){this._measureContent(),this._countElements();const t=this.shadowRoot?.querySelector("slot");t&&t.addEventListener("slotchange",()=>{this._measureContent(),this._countElements()})}updated(t){(t.has("collapsedHeight")||t.has("expanded"))&&this._measureContent(),(t.has("visibleElements")||t.has("variant"))&&this._countElements()}_measureContent(){if(this.variant==="height"){const t=this.shadowRoot?.querySelector("slot");if(t){const e=t.assignedNodes({flatten:!0});let i=0;e.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE){const s=o;i+=s.offsetHeight||s.scrollHeight||0}}),this._contentHeight=i,this.requestUpdate()}}}_countElements(){if(this.variant==="elements"){const t=this.shadowRoot?.querySelector("slot");if(t){const e=t.assignedNodes({flatten:!0});this._elementCount=e.filter(i=>i.nodeType===Node.ELEMENT_NODE).length,this.requestUpdate()}}}render(){if(this.variant==="height"){const t=this.expanded?`${this._contentHeight}px`:`${this.collapsedHeight}px`,e=this._contentHeight>this.collapsedHeight;return c`
|
|
2
|
+
<div
|
|
3
|
+
class="collapse-content"
|
|
4
|
+
style="max-height: ${t};"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
${e&&!this.expanded?c`<div class="collapse-gradient-overlay"></div>`:""}
|
|
8
|
+
</div>
|
|
9
|
+
${e?c`
|
|
10
|
+
<scb-button @click="${this.toggle}" variant="text" label="${this.expanded?this.collapseButtonLabel:this.expandButtonLabel}" icon="${this.expanded?"expand_less":"expand_more"}">
|
|
11
|
+
</scb-button>
|
|
12
|
+
`:""}
|
|
13
|
+
`}else{const t=this._elementCount>this.visibleElements;return setTimeout(()=>{const e=this.shadowRoot?.querySelector("slot");e&&e.assignedNodes({flatten:!0}).filter(o=>o.nodeType===Node.ELEMENT_NODE).forEach((o,s)=>{const n=o;!this.expanded&&s>=this.visibleElements?n.classList.add("scb-collapsed-hidden"):n.classList.remove("scb-collapsed-hidden")})},0),c`
|
|
14
|
+
<div class="collapse-content">
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</div>
|
|
17
|
+
${t?c`
|
|
18
|
+
<scb-button @click="${this.toggle}" variant="text" label="${this.expanded?this.collapseButtonLabel:this.expandButtonLabel}" icon="${this.expanded?"expand_less":"expand_more"}">
|
|
19
|
+
</scb-button>
|
|
20
|
+
`:""}
|
|
21
|
+
`}}};a.styles=h`
|
|
22
|
+
.collapse-content {
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
padding: 16px;
|
|
25
|
+
transition: max-height var(--motion-duration-medium, 200ms) var(--motion-easing-standard, ease);
|
|
26
|
+
}
|
|
27
|
+
.collapse-gradient-overlay {
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
bottom: 0;
|
|
32
|
+
height: 48px;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #FFF 100%);
|
|
35
|
+
z-index: 1;
|
|
36
|
+
}
|
|
37
|
+
.collapse-content {
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
scb-button {
|
|
41
|
+
margin-top: 8px;
|
|
42
|
+
}
|
|
43
|
+
::slotted(.scb-collapsed-hidden) {
|
|
44
|
+
max-height: 0 !important;
|
|
45
|
+
display: block;
|
|
46
|
+
opacity: 0;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
transition: max-height 200ms ccubic-bezier(.3, 0, .8, .15), opacity 100ms cubic-bezier(0.4,0,0.2,1);
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
margin: 0 !important;
|
|
51
|
+
padding: 0 !important;
|
|
52
|
+
}
|
|
53
|
+
::slotted(*) {
|
|
54
|
+
max-height: 1000px;
|
|
55
|
+
transition: max-height 200ms cubic-bezier(.3, 0, .8, .15), opacity 100ms cubic-bezier(0.4,0,0.2,1);
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
`;l([r({type:String})],a.prototype,"variant",2);l([r({type:Number})],a.prototype,"collapsedHeight",2);l([r({type:Number})],a.prototype,"visibleElements",2);l([r({type:Boolean})],a.prototype,"expanded",2);l([r({type:String})],a.prototype,"expandButtonLabel",2);l([r({type:String})],a.prototype,"collapseButtonLabel",2);a=l([u("scb-collapse")],a);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.126",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -131,6 +131,10 @@
|
|
|
131
131
|
"import": "./scb-chip/scb-chip.js",
|
|
132
132
|
"require": "./scb-chip/scb-chip.js"
|
|
133
133
|
},
|
|
134
|
+
"./scb-collapse": {
|
|
135
|
+
"import": "./scb-collapse/scb-collapse.js",
|
|
136
|
+
"require": "./scb-collapse/scb-collapse.js"
|
|
137
|
+
},
|
|
134
138
|
"./scb-cookies-consent": {
|
|
135
139
|
"import": "./scb-cookies-consent/scb-cookies-consent.js",
|
|
136
140
|
"require": "./scb-cookies-consent/scb-cookies-consent.js"
|
|
@@ -353,5 +357,5 @@
|
|
|
353
357
|
},
|
|
354
358
|
"./mvc/*": "./mvc/*"
|
|
355
359
|
},
|
|
356
|
-
"buildHash": "
|
|
360
|
+
"buildHash": "FBE72A7891CF7FEA89791007A34B3A26F890F47089E6AA641A5735FBFDC268F8"
|
|
357
361
|
}
|
|
@@ -26,6 +26,9 @@ export declare class ScbCalendar extends LitElement {
|
|
|
26
26
|
private _easterDateCalculated;
|
|
27
27
|
private _addDays;
|
|
28
28
|
private _easterDay;
|
|
29
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Returnerar namnet på svensk helgdag eller null om det inte är en helgdag
|
|
31
|
+
*/
|
|
32
|
+
private _swedishHolidayName;
|
|
30
33
|
render(): import('lit-html').TemplateResult<1>;
|
|
31
34
|
}
|