@sbb-esta/lyne-elements 5.1.0 → 5.2.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/action-group.pure.js +1 -1
- package/alert.pure.js +14 -14
- package/breadcrumb.pure.js +3 -3
- package/calendar.pure.js +67 -67
- package/carousel/_carousel.global.scss +6 -0
- package/carousel.pure.js +1 -1
- package/clock.pure.js +1 -1
- package/core/styles/_theme.scss +1 -0
- package/core.js +2 -2
- package/custom-elements.json +99 -67
- package/date-input.pure.js +1 -1
- package/development/action-group.pure.js +1 -1
- package/development/alert.pure.js +14 -14
- package/development/breadcrumb.pure.js +3 -3
- package/development/calendar.pure.js +67 -67
- package/development/carousel.pure.js +1 -1
- package/development/clock.pure.js +15 -17
- package/development/core.js +2 -2
- package/development/date-input.pure.js +15 -7
- package/development/expansion-panel.pure.js +6 -6
- package/development/file-selector.pure.js +7 -3
- package/development/image.pure.js +8 -8
- package/development/map-container.pure.js +8 -8
- package/development/mini-calendar.pure.js +1 -1
- package/development/notification.pure.js +12 -9
- package/development/option.pure.js +11 -11
- package/development/paginator.pure.js +18 -18
- package/development/signet.pure.js +17 -17
- package/development/stepper/step/step.component.d.ts +0 -2
- package/development/stepper/stepper/stepper.component.d.ts +2 -2
- package/development/stepper.pure.js +24 -17
- package/development/tabs.pure.js +4 -4
- package/development/teaser.pure.js +1 -1
- package/development/time-input.pure.js +10 -6
- package/development/timetable-form.pure.js +3 -3
- package/development/timetable-occupancy.pure.js +22 -22
- package/development/toast.pure.js +6 -6
- package/development/tooltip.pure.js +4 -2
- package/development/train.pure.js +29 -29
- package/development/visual-checkbox.pure.js +13 -13
- package/expansion-panel.pure.js +6 -6
- package/file-selector.pure.js +2 -2
- package/image.pure.js +8 -8
- package/lean-off-brand-theme.css +39 -1
- package/lean-safety-theme.css +39 -1
- package/lean-theme.css +39 -1
- package/map-container.pure.js +8 -8
- package/mini-calendar.pure.js +1 -1
- package/notification.pure.js +12 -9
- package/off-brand-theme.css +39 -1
- package/option.pure.js +11 -11
- package/package.json +1 -1
- package/paginator.pure.js +18 -18
- package/safety-theme.css +39 -1
- package/signet.pure.js +17 -17
- package/standard-theme.css +39 -1
- package/stepper.pure.js +3 -3
- package/table/_table.global.scss +46 -1
- package/tabs.pure.js +4 -4
- package/teaser/_teaser.global.scss +4 -0
- package/teaser.pure.js +1 -1
- package/time-input.pure.js +1 -1
- package/timetable-form.pure.js +3 -3
- package/timetable-occupancy.pure.js +22 -22
- package/toast.pure.js +6 -6
- package/tooltip.pure.js +3 -3
- package/train.pure.js +29 -29
- package/visual-checkbox.pure.js +13 -13
package/action-group.pure.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{html as e,unsafeCSS as t}from"lit";import{SbbElement as n}from"./core.js";var r=`:host{justify-content:start;align-items:center;gap:var(--sbb-action-group-gap);display:flex}:host(.sbb-orientation-vertical-full-width){flex-direction:column;align-items:stretch}:host(:where(.sbb-orientation-vertical,.sbb-orientation-horizontal-from-small,.sbb-orientation-horizontal-from-large,.sbb-orientation-horizontal-from-ultra)){align-items:start}@media (width>=37.5rem){:host(.sbb-orientation-horizontal-from-small){align-items:center}}@media (width>=64rem){:host(.sbb-orientation-horizontal-from-large){align-items:center}}@media (width>=90rem){:host(.sbb-orientation-horizontal-from-ultra){align-items:center}}
|
|
1
|
+
import{html as e,unsafeCSS as t}from"lit";import{SbbElement as n}from"./core.js";var r=`:host{justify-content:start;align-items:center;gap:var(--sbb-action-group-gap);flex-wrap:wrap;display:flex}:host(.sbb-orientation-vertical-full-width){flex-direction:column;align-items:stretch}:host(:where(.sbb-orientation-vertical,.sbb-orientation-horizontal-from-small,.sbb-orientation-horizontal-from-large,.sbb-orientation-horizontal-from-ultra)){align-items:start}@media (width>=37.5rem){:host(.sbb-orientation-horizontal-from-small){align-items:center}}@media (width>=64rem){:host(.sbb-orientation-horizontal-from-large){align-items:center}}@media (width>=90rem){:host(.sbb-orientation-horizontal-from-ultra){align-items:center}}
|
|
2
2
|
`,i=class extends n{static{this.elementName=`sbb-action-group`}static{this.styles=[t(r)]}render(){return e`<slot></slot>`}};export{i as SbbActionGroupElement};
|
package/alert.pure.js
CHANGED
|
@@ -17,20 +17,20 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,not
|
|
|
17
17
|
</p>
|
|
18
18
|
</span>
|
|
19
19
|
${this.readOnly?r:n`<span class="sbb-alert__close-button-wrapper">
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
<sbb-divider
|
|
21
|
+
orientation="vertical"
|
|
22
|
+
?negative=${this._isLightMode()}
|
|
23
|
+
class="sbb-alert__close-button-divider"
|
|
24
|
+
></sbb-divider>
|
|
25
|
+
<sbb-transparent-button
|
|
26
|
+
?negative=${this._isLightMode()}
|
|
27
|
+
size=${this.size===`l`?`m`:this.size||r}
|
|
28
|
+
icon-name="cross-small"
|
|
29
|
+
@click=${()=>this.close()}
|
|
30
|
+
aria-label=${h[this._language.current]}
|
|
31
|
+
class="sbb-alert__close-button"
|
|
32
|
+
></sbb-transparent-button>
|
|
33
|
+
</span>`}
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
36
36
|
`}}})();export{T as SbbAlertElement,C as SbbAlertGroupElement};
|
package/breadcrumb.pure.js
CHANGED
|
@@ -29,9 +29,9 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{ResizeControl
|
|
|
29
29
|
<li class="sbb-breadcrumb-group__item">
|
|
30
30
|
<slot name=${e.name}></slot>
|
|
31
31
|
${t===n.length-1?i:r`<sbb-icon
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
name="chevron-small-right-small"
|
|
33
|
+
class="sbb-breadcrumb-group__divider-icon"
|
|
34
|
+
></sbb-icon>`}
|
|
35
35
|
</li>
|
|
36
36
|
`)}render(){return r`
|
|
37
37
|
<ol class="sbb-breadcrumb-group">
|
package/calendar.pure.js
CHANGED
|
@@ -21,14 +21,14 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,isS
|
|
|
21
21
|
${this._weekdays.map((e,t)=>n`
|
|
22
22
|
<th class="sbb-calendar__table-header-cell">
|
|
23
23
|
${this.multiple?n`
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
<sbb-calendar-weekday
|
|
25
|
+
.value=${e}
|
|
26
|
+
@click=${()=>{let e=c.filter(e=>e.weekDayValue===(t+1)%7);this._selectMultipleDates(e)}}
|
|
27
|
+
></sbb-calendar-weekday>
|
|
28
|
+
`:n`
|
|
29
|
+
<span class="sbb-screen-reader-only">${e.long}</span>
|
|
30
|
+
<span aria-hidden="true">${e.narrow}</span>
|
|
31
|
+
`}
|
|
32
32
|
</th>
|
|
33
33
|
`)}
|
|
34
34
|
</tr>
|
|
@@ -37,40 +37,40 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,isS
|
|
|
37
37
|
${e.map((e,r)=>{let a=7-e.length;return r===0&&a?n`
|
|
38
38
|
<tr>
|
|
39
39
|
${this.weekNumbers?n`
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
<td class="sbb-calendar__table-header-cell-vertical">
|
|
41
|
+
${this.multiple?n`
|
|
42
|
+
<sbb-calendar-weeknumber
|
|
43
|
+
.value=${t[0]}
|
|
44
|
+
@click=${()=>{let e=s.filter(e=>e.weekValue===t[0]);this._selectMultipleDates(e)}}
|
|
45
|
+
></sbb-calendar-weeknumber>
|
|
46
|
+
`:n`
|
|
47
|
+
<span class="sbb-screen-reader-only"
|
|
48
|
+
>${`${g[this._language.current]} ${t[0]}`}</span
|
|
49
|
+
>
|
|
50
|
+
<span aria-hidden="true">${t[0]}</span>
|
|
51
|
+
`}
|
|
52
|
+
</td>
|
|
53
|
+
`:i}
|
|
54
54
|
${[...Array(a).keys()].map(()=>n`<td class="sbb-calendar__table-data"></td>`)}
|
|
55
55
|
${this._createDayCells(e)}
|
|
56
56
|
</tr>
|
|
57
57
|
`:n`
|
|
58
58
|
<tr>
|
|
59
59
|
${this.weekNumbers?n`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
<td class="sbb-calendar__table-header-cell-vertical">
|
|
61
|
+
${this.multiple?n`
|
|
62
|
+
<sbb-calendar-weeknumber
|
|
63
|
+
.value=${t[r]}
|
|
64
|
+
@click=${()=>{let e=s.filter(e=>e.weekValue===t[r]);this._selectMultipleDates(e)}}
|
|
65
|
+
></sbb-calendar-weeknumber>
|
|
66
|
+
`:n`
|
|
67
|
+
<span class="sbb-screen-reader-only"
|
|
68
|
+
>${`${g[this._language.current]} ${t[r]}`}</span
|
|
69
|
+
>
|
|
70
|
+
<span aria-hidden="true">${t[r]}</span>
|
|
71
|
+
`}
|
|
72
|
+
</td>
|
|
73
|
+
`:i}
|
|
74
74
|
${this._createDayCells(e)}
|
|
75
75
|
</tr>
|
|
76
76
|
`})}
|
|
@@ -87,42 +87,42 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,isS
|
|
|
87
87
|
@focusout=${e=>this._handleTableBlur(e.relatedTarget)}
|
|
88
88
|
>
|
|
89
89
|
${this.weekNumbers?n`
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
90
|
+
<thead>
|
|
91
|
+
<tr>
|
|
92
|
+
<th class="sbb-calendar__table-data"></th>
|
|
93
|
+
${t.map(e=>n`
|
|
94
|
+
<th class="sbb-calendar__table-header-cell">
|
|
95
|
+
${this.multiple?n`
|
|
96
|
+
<sbb-calendar-weeknumber
|
|
97
|
+
.value=${e}
|
|
98
|
+
@click=${()=>{let t=l.filter(t=>t.weekValue===e);this._selectMultipleDates(t)}}
|
|
99
|
+
></sbb-calendar-weeknumber>
|
|
100
|
+
`:n`
|
|
101
|
+
<span class="sbb-screen-reader-only"
|
|
102
|
+
>${`${g[this._language.current]} ${e}`}</span
|
|
103
|
+
>
|
|
104
|
+
<span aria-hidden="true">${e}</span>
|
|
105
|
+
`}
|
|
106
|
+
</th>
|
|
107
|
+
`)}
|
|
108
|
+
</tr>
|
|
109
|
+
</thead>
|
|
110
|
+
`:i}
|
|
111
111
|
<tbody>
|
|
112
112
|
${e.map((e,t)=>{let r=this._weekdays[t];return n`
|
|
113
113
|
<tr>
|
|
114
114
|
<td class="sbb-calendar__table-header-cell-vertical">
|
|
115
115
|
${this.multiple?n`
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
<sbb-calendar-weekday
|
|
117
|
+
.value=${r}
|
|
118
|
+
@click=${()=>this._selectMultipleDates(e)}
|
|
119
|
+
>
|
|
120
|
+
${r.narrow}
|
|
121
|
+
</sbb-calendar-weekday>
|
|
122
|
+
`:n`
|
|
123
|
+
<span class="sbb-screen-reader-only">${r.long}</span>
|
|
124
|
+
<span aria-hidden="true">${r.narrow}</span>
|
|
125
|
+
`}
|
|
126
126
|
</td>
|
|
127
127
|
${t<c?n`<td class="sbb-calendar__table-data"></td>`:i}
|
|
128
128
|
${this._createDayCells(e)}
|
package/carousel.pure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{html as e,unsafeCSS as t}from"lit";import{SbbElement as n,SbbLanguageController as r,forceType as i,i18nCarouselArrowsNavigationHint as a,i18nCarouselItemAriaLabel as o,i18nNextSlide as s,i18nPreviousSlide as c,i18nSlide as l,isArrowKeyPressed as u,screenReaderOnlyStyles as d}from"./core.js";import{IntersectionController as f}from"@lit-labs/observers/intersection-controller.js";import{ResizeController as p}from"@lit-labs/observers/resize-controller.js";import{__esDecorate as m,__runInitializers as h}from"tslib";import{property as g}from"lit/decorators.js";var _=`:host{scroll-snap-align:start;flex-shrink:0;display:flex}
|
|
1
|
+
import{html as e,unsafeCSS as t}from"lit";import{SbbElement as n,SbbLanguageController as r,forceType as i,i18nCarouselArrowsNavigationHint as a,i18nCarouselItemAriaLabel as o,i18nNextSlide as s,i18nPreviousSlide as c,i18nSlide as l,isArrowKeyPressed as u,screenReaderOnlyStyles as d}from"./core.js";import{IntersectionController as f}from"@lit-labs/observers/intersection-controller.js";import{ResizeController as p}from"@lit-labs/observers/resize-controller.js";import{__esDecorate as m,__runInitializers as h}from"tslib";import{property as g}from"lit/decorators.js";var _=`:host{scroll-snap-align:start;flex-shrink:0;display:flex}
|
|
2
2
|
`,v=class extends Event{get index(){return this._index}constructor(e,{index:t}){super(e,{bubbles:!0,composed:!0}),this._index=t}},y=class extends n{static{this.elementName=`sbb-carousel-item`}static{this.styles=[t(_)]}static{this.events={beforeshow:`beforeshow`,show:`show`}}connectedCallback(){super.connectedCallback(),this.internals.role=`group`,this.internals.ariaRoleDescription=`slide`}render(){return e`<slot></slot>`}},b=`:host{height:var(--sbb-carousel-list-height);width:var(--sbb-carousel-list-width,0);scroll-snap-type:x mandatory;scroll-behavior:smooth;scrollbar-width:none;border-radius:var(--sbb-carousel-inherit-border-radius);outline:none;display:flex;overflow-x:auto}:host(:focus-visible):before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style,solid) var(--sbb-focus-outline-width);content:"";height:inherit;width:inherit;border-start-start-radius:var(--sbb-carousel-list-border-radius);border-start-end-radius:var(--sbb-carousel-list-border-radius);border-end-end-radius:var(--sbb-carousel-inherit-border-radius);border-end-start-radius:var(--sbb-carousel-inherit-border-radius);position:absolute}
|
|
3
3
|
`,x=class extends n{static{this.elementName=`sbb-carousel-list`}static{this.styles=[t(b)]}constructor(){super(),this._currentIndex=0,this._language=new r(this),this._observedCarouselItems=[],this._beforeShowObserver=new f(this,{target:null,callback:e=>{e.filter(e=>e.isIntersecting&&e.target!==this).forEach(e=>{let t=e.target;t.dispatchEvent(new v(`beforeshow`,{index:this._carouselItems().findIndex(e=>e===t)}))})},config:{threshold:.01,root:this,rootMargin:`100% 0% 100% 0%`}}),this._showObserver=new f(this,{target:null,callback:e=>{for(let t of e){if(t.target===this)continue;let e=t.target;t.isIntersecting?(e.ariaHidden=null,this._currentIndex=this._carouselItems().findIndex(t=>t===e),e.dispatchEvent(new v(`show`,{index:this._currentIndex}))):e.ariaHidden=`true`}},config:{threshold:.99,root:this,rootMargin:`100% 0% 100% 0%`}}),this._resizeObserverController=new p(this,{skipInitial:!0,callback:()=>this._readDimensions()}),this.addEventListener?.(`keydown`,e=>this._onKeyDown(e))}_carouselItems(){return Array.from(this.querySelectorAll?.(`sbb-carousel-item`)??[])}_handleSlotchange(){this._observedCarouselItems.forEach(e=>{this._beforeShowObserver.unobserve(e),this._showObserver.unobserve(e)});let e=this._carouselItems();e.forEach((t,n)=>{t.ariaLabel||=o(n+1,e.length)[this._language.current],t.ariaHidden=n===this._currentIndex?null:`true`}),this._readDimensions()}_readDimensions(){let e=this._carouselItems();if(e.length===0)return;let t=e[0];t.clientHeight>0&&this.style.setProperty(`--sbb-carousel-list-height`,`${t.clientHeight}px`),t.clientWidth>0&&(this.style.setProperty(`--sbb-carousel-list-width`,`${t.clientWidth}px`),e.forEach(e=>{this._beforeShowObserver.observe(e),this._showObserver.observe(e)}),this._observedCarouselItems=e,this._resizeObserverController.unobserve(this))}_onKeyDown(e){if(!u(e))return;e.preventDefault();let t=this._currentIndex,n=e.key===`ArrowUp`||e.key===`ArrowLeft`,r=e.key===`ArrowDown`||e.key===`ArrowRight`;n?t=Math.max(0,this._currentIndex-1):r&&(t=Math.min(this._carouselItems().length-1,this._currentIndex+1)),t!==this._currentIndex&&(this._currentIndex=t,this.scrollTo({left:this._carouselItems()[this._currentIndex].offsetLeft-this.offsetLeft}))}connectedCallback(){super.connectedCallback(),this.internals.ariaLive=`polite`,this.internals.ariaAtomic=`true`}render(){return e`<slot @slotchange=${this._handleSlotchange}></slot>`}},S=`:host{border-radius:var(--sbb-carousel-border-radius) var(--sbb-carousel-border-radius) 0 0;display:inline-block;overflow:hidden}:host([shadow]){box-shadow:var(--sbb-carousel-box-shadow);border-radius:var(--sbb-carousel-border-radius)}:host(:not([shadow])) ::slotted(sbb-carousel-list){--sbb-carousel-inherit-border-radius:var(--sbb-carousel-border-radius)}.sbb-carousel{background-color:var(--sbb-carousel-background-color);flex-direction:column;justify-content:center;align-items:center;display:flex}::slotted(sbb-compact-paginator){padding:var(--sbb-carousel-paginator-padding)}
|
|
4
4
|
`;let C=(()=>{let o=n,u,f=[],p=[];return class extends o{static{let e=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;u=[i(),g({reflect:!0,type:Boolean})],m(this,null,u,{kind:`accessor`,name:`shadow`,static:!1,private:!1,access:{has:e=>`shadow`in e,get:e=>e.shadow,set:(e,t)=>{e.shadow=t}},metadata:e},f,p),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}static{this.elementName=`sbb-carousel`}static{this.styles=[d,t(S)]}#e;get shadow(){return this.#e}set shadow(e){this.#e=e}constructor(){super(),this.#e=h(this,f,!1),this._paginator=(h(this,p),null),this._abortController=null,this._language=new r(this),this._requestedPageIndexByPaginator=-1,this.addEventListener?.(`show`,e=>{this._requestedPageIndexByPaginator!==-1&&this._requestedPageIndexByPaginator!==e.index||(this._paginator&&e.index!==this._paginator.pageIndex&&(this._paginator.pageIndex=e.index),this._requestedPageIndexByPaginator=-1)})}connectedCallback(){super.connectedCallback(),this.internals.role=`region`,this.internals.ariaLabel=`carousel`,this._setupPaginator()}firstUpdated(e){super.firstUpdated(e),this.internals.ariaDescribedByElements=[this.shadowRoot.querySelector(`#sbb-carousel-arrows-navigation-hint`)]}disconnectedCallback(){super.disconnectedCallback(),this._abortController?.abort()}_handleSlotchange(){let e=Array.from(this.children).find(e=>e.localName===`sbb-compact-paginator`),t=Array.from(this.children).find(e=>e.localName===`sbb-carousel-list`);if(!e||!t)return;let n=t.querySelectorAll(`sbb-carousel-item`);n&&n.length>0&&(e.length=n.length,e.pageSize=1),e.accessibilityNextPageLabel||=s[this._language.current],e.accessibilityPreviousPageLabel||=c[this._language.current],e.accessibilityPageLabel||=l[this._language.current],e!==this._paginator&&(this._paginator=e,this._setupPaginator())}_setupPaginator(){this._abortController?.abort(),this._paginator&&(this._abortController=new AbortController,this._paginator.addEventListener(`click`,()=>this._scrollAtPaginatorChange(),{signal:this._abortController.signal}))}_scrollAtPaginatorChange(){if(!this._paginator)return;this._requestedPageIndexByPaginator=this._paginator.pageIndex;let e=this.querySelector(`sbb-carousel-list`);if(e){let t=e.querySelectorAll(`sbb-carousel-item`)[this._paginator.pageIndex].offsetLeft-this.offsetLeft;(e.clientWidth<=100||Math.abs(e.scrollLeft-t)>50)&&e.scrollTo({left:t})}}render(){return e`
|
package/clock.pure.js
CHANGED
|
@@ -3,7 +3,7 @@ import{__esDecorate as e,__runInitializers as t}from"tslib";import{html as n,isS
|
|
|
3
3
|
`,u=`<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M55.1,64.5h-5.2l0.8-58h3.6L55.1,64.5z"/></svg>
|
|
4
4
|
`,d=`<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 105 105"><path d="M57.8,21.3c0-2.9-2.4-5.2-5.2-5.2s-5.3,2.3-5.3,5.2c0,2.7,2,4.8,4.5,5.2V69h1.5V26.5C55.8,26.2,57.8,24,57.8,21.3z"/></svg>
|
|
5
5
|
`,f=`:host{aspect-ratio:1;contain:content;display:block;position:relative;overflow:hidden}.sbb-clock__face,.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds{transform-origin:50%;transform-style:preserve-3d;backface-visibility:hidden;position:absolute;inset:0;transform:rotate(0)}.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__face{fill:var(--sbb-clock-face-color)}.sbb-clock__hand-minutes{transition:transform var(--sbb-disable-animation-duration,.2s) cubic-bezier(.4, 2.08, .55, .44)}@supports not (aspect-ratio:1/1){.sbb-clock__hand-minutes{transform-origin:50% 49.625%}}.sbb-clock__hand-hours{animation-name:rotate;animation-duration:43200s;animation-timing-function:linear;animation-iteration-count:infinite;animation-play-state:var(--sbb-clock-animation-play-state,"paused")}.sbb-clock__hand-hours--initial-hour{animation-name:hand-hours-animation-initial-hour;animation-duration:var(--sbb-clock-hours-animation-duration,0s);animation-play-state:var(--sbb-clock-animation-play-state,"paused");animation-iteration-count:1}.sbb-clock__hand-minutes--no-transition{transition:none}.sbb-clock__hand-seconds{animation-name:hand-seconds-animation;animation-duration:60s;animation-timing-function:linear;animation-play-state:var(--sbb-clock-animation-play-state,"paused");fill:var(--sbb-clock-seconds-hand-color);animation-iteration-count:infinite}.sbb-clock__hand-seconds--initial-minute{animation-name:hand-seconds-animation-initial-minute;animation-duration:var(--sbb-clock-seconds-animation-duration,0s);animation-play-state:var(--sbb-clock-animation-play-state,"paused");animation-iteration-count:1}:host(:not(:is(:state(initialized),[state--initialized]))) :is(.sbb-clock__hand-hours,.sbb-clock__hand-minutes,.sbb-clock__hand-seconds){display:none}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes hand-hours-animation-initial-hour{0%{transform:rotateZ(var(--sbb-clock-hours-animation-start-angle,0deg))}to{transform:rotate(360deg)}}@keyframes hand-seconds-animation{0%{transform:rotate(0)}97.5%,to{transform:rotate(360deg)}}@keyframes hand-seconds-animation-initial-minute{0%{transform:rotateZ(var(--sbb-clock-seconds-animation-start-angle,0deg))}97.5%,to{transform:rotate(360deg)}}
|
|
6
|
-
`;const p={once:!0,passive:!0};let m=(()=>{let m=s,h,g=[],_=[];return class extends m{constructor(){super(...arguments),this.#e=t(this,g,null),this._state=(t(this,_),`paused`),this._moveHoursHandFn=()=>this._moveHoursHand(),this._moveMinutesHandFn=()=>this._moveMinutesHand(),this._handlePageVisibilityChange=
|
|
6
|
+
`;const p={once:!0,passive:!0};let m=(()=>{let m=s,h,g=[],_=[];return class extends m{constructor(){super(...arguments),this.#e=t(this,g,null),this._state=(t(this,_),`paused`),this._moveHoursHandFn=()=>this._moveHoursHand(),this._moveMinutesHandFn=()=>this._moveMinutesHand(),this._handlePageVisibilityChange=()=>{this.now||(document.visibilityState===`hidden`?this._stopClock():this._startClock())}}static{let t=typeof Symbol==`function`&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;h=[a()],e(this,null,h,{kind:`accessor`,name:`now`,static:!1,private:!1,access:{has:e=>`now`in e,get:e=>e.now,set:(e,t)=>{e.now=t}},metadata:t},g,_),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}static{this.elementName=`sbb-clock`}static{this.styles=[i(f)]}#e;get now(){return this.#e}set now(e){this.#e=e}connectedCallback(){super.connectedCallback(),this._resetIntervalId=setInterval(()=>this._resetClock(),1800*1e3)}willUpdate(e){super.willUpdate(e),!(r||!this.hasUpdated)&&e.has(`now`)&&this._startOrConfigureClock()}firstUpdated(e){super.firstUpdated(e),r||(document.addEventListener(`visibilitychange`,this._handlePageVisibilityChange,!1),this._startOrConfigureClock())}disconnectedCallback(){super.disconnectedCallback(),this._removeEventListeners(),clearInterval(this._resetIntervalId)}_startOrConfigureClock(){this.now?(this._stopClock(),this._resetSecondsHandAnimation(),this._setHandsStartingPosition()):this._startClock()}_startClock(){this._clockHandHours?.addEventListener(`animationend`,this._moveHoursHandFn,p),this._clockHandSeconds?.addEventListener(`animationend`,this._moveMinutesHandFn,p),this._setHandsStartingPosition(),this.style?.setProperty(`--sbb-clock-animation-play-state`,`running`),this._state=`running`}_stopClock(){clearInterval(this._handMovement),this._removeSecondsAnimationStyles(),this._removeHoursAnimationStyles(),this._clockHandHours?.removeEventListener(`animationend`,this._moveHoursHandFn),this._clockHandSeconds?.removeEventListener(`animationend`,this._moveMinutesHandFn),this._clockHandMinutes?.classList.add(`sbb-clock__hand-minutes--no-transition`),this.style?.setProperty(`--sbb-clock-animation-play-state`,`paused`),this._state=`paused`}async _resetClock(){this._state===`running`&&(this._stopClock(),setTimeout(()=>this._startClock(),50))}_setHandsStartingPosition(){this._assignCurrentTime();let e=60-this._seconds,t=60-this._minutes,n=12-this._hours,r=0,i=0;e>0&&(r+=e,i=1),t>0&&(r+=(t-i)*60,i=1),n>0&&(r+=(n-i)*3600),this.style?.setProperty(`--sbb-clock-hours-animation-start-angle`,`${Math.ceil(this._hours*30+this._minutes/2)}deg`),this.style?.setProperty(`--sbb-clock-hours-animation-duration`,`${r}s`),this.style?.setProperty(`--sbb-clock-seconds-animation-start-angle`,`${Math.ceil(this._seconds*6.153846153846154)}deg`),this.style?.setProperty(`--sbb-clock-seconds-animation-duration`,`${e}s`),this._setMinutesHand(),this._clockHandSeconds?.classList.add(`sbb-clock__hand-seconds--initial-minute`),this._clockHandHours?.classList.add(`sbb-clock__hand-hours--initial-hour`),this.internals.states.add(`initialized`)}_assignCurrentTime(){let e=this.now?null:new Date,[t,n,r]=e?[e.getHours(),e.getMinutes(),e.getSeconds()]:this.now.split(`:`).map(e=>+e);this._hours=t%12,this._minutes=n,this._seconds=r}_setMinutesHand(){this._clockHandMinutes?.style.setProperty(`transform`,`rotateZ(${Math.ceil(this._minutes*6)}deg)`)}_moveHoursHand(){this._removeHoursAnimationStyles();let e=Math.ceil(this._hours*30+this._minutes/2);e>=360&&(e-=360),this._clockHandHours?.style.setProperty(`transform`,`rotateZ(${e}deg)`)}_moveMinutesHand(){this._clockHandSeconds?.removeEventListener(`animationend`,this._moveMinutesHandFn),this._removeSecondsAnimationStyles(),this._addMinutesAndSetHands(),this._handMovement=setInterval(()=>this._addMinutesAndSetHands(),60*1e3)}_addMinutesAndSetHands(){this._minutes++,this._setMinutesHand()}_resetSecondsHandAnimation(){this._clockHandSeconds&&(this._clockHandSeconds.style.animation=``,this._clockHandSeconds.offsetHeight,this._clockHandSeconds.style.removeProperty(`animation`))}_removeEventListeners(){document?.removeEventListener(`visibilitychange`,this._handlePageVisibilityChange),this._clockHandHours?.removeEventListener(`animationend`,this._moveHoursHandFn),this._clockHandSeconds?.removeEventListener(`animationend`,this._moveMinutesHandFn),clearInterval(this._handMovement)}_removeHoursAnimationStyles(){this._clockHandHours?.classList.remove(`sbb-clock__hand-hours--initial-hour`),this.style.removeProperty(`--sbb-clock-hours-animation-start-angle`),this.style.removeProperty(`--sbb-clock-hours-animation-duration`)}_removeSecondsAnimationStyles(){this._clockHandSeconds?.classList.remove(`sbb-clock__hand-seconds--initial-minute`),this._clockHandMinutes?.classList.remove(`sbb-clock__hand-minutes--no-transition`),this.style.removeProperty(`--sbb-clock-seconds-animation-start-angle`),this.style.removeProperty(`--sbb-clock-seconds-animation-duration`)}render(){return n`
|
|
7
7
|
<span class="sbb-clock__face" .innerHTML=${c}></span>
|
|
8
8
|
<span
|
|
9
9
|
class="sbb-clock__hand-hours"
|
package/core/styles/_theme.scss
CHANGED
package/core.js
CHANGED
|
@@ -34,8 +34,8 @@ let xe=0;var Se=class{constructor(){r||(document.body?this._liveElement=this._cr
|
|
|
34
34
|
${e}
|
|
35
35
|
</a>
|
|
36
36
|
${t?n`<span id="sbb-link-new-window" hidden
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
>${mt[this.language.current]}</span
|
|
38
|
+
>`:i}
|
|
39
39
|
`}}})();var jn=class extends P{static{this.events={beforeopen:`beforeopen`,open:`open`,beforeclose:`beforeclose`,close:`close`}}set state(e){this._state&&this.internals.states.delete(`state-${this._state}`),this._state=e,this._state&&this.internals.states.add(`state-${this._state}`)}get state(){return this._state}get isOpen(){return this.state===`opened`}constructor(){super(),this.state=`closed`}escapeStrategy(){this.close()}dispatchBeforeOpenEvent(){return this.dispatchEvent(new Event(`beforeopen`,{cancelable:!0}))}dispatchOpenEvent(){return this.dispatchEvent(new Event(`open`))}dispatchBeforeCloseEvent(){return this.dispatchEvent(new Event(`beforeclose`,{cancelable:!0}))}dispatchCloseEvent(){return this.dispatchEvent(new Event(`close`))}};const V=e=>(()=>{let t=e,n=[],r;return class extends t{static{let e=typeof Symbol==`function`&&Symbol.metadata?Object.create(t[Symbol.metadata]??null):void 0;r=[l({type:Boolean,reflect:!0})],o(this,null,r,{kind:`setter`,name:`disabled`,static:!1,private:!1,access:{has:e=>`disabled`in e,set:(e,t)=>{e.disabled=t}},metadata:e},null,n),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}set disabled(e){this.#e=!!e,this.toggleAttribute(`disabled`,this.disabled)}get disabled(){return this.#e||this.isDisabledExternally()}#e=(s(this,n),!1);isDisabledExternally(){return!1}}})(),Mn=e=>(()=>{let t=e,n,r=[],i=[];return class extends t{static{let e=typeof Symbol==`function`&&Symbol.metadata?Object.create(t[Symbol.metadata]??null):void 0;n=[I(),l({attribute:`disabled-interactive`,type:Boolean,reflect:!0})],o(this,null,n,{kind:`accessor`,name:`disabledInteractive`,static:!1,private:!1,access:{has:e=>`disabledInteractive`in e,get:e=>e.disabledInteractive,set:(e,t)=>{e.disabledInteractive=t}},metadata:e},r,i),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#e=s(this,r,!1);get disabledInteractive(){return this.#e}set disabledInteractive(e){this.#e=e}constructor(){super(...arguments),s(this,i)}}})(),Nn=e=>{class t extends Mn(V(e)){willUpdate(e){super.willUpdate(e),e.has(`disabledInteractive`)&&(this.internals.ariaDisabled=this.disabledInteractive?`true`:null),e.has(`disabled`)&&(this.disabled?this.removeAttribute(`tabindex`):this.setAttribute(`tabindex`,`0`))}}return t},H=e=>(()=>{let t=e,n=[],r;return class extends t{constructor(){super(...arguments),this._required=(s(this,n),!1)}static{let e=typeof Symbol==`function`&&Symbol.metadata?Object.create(t[Symbol.metadata]??null):void 0;r=[l({reflect:!0,type:Boolean})],o(this,null,r,{kind:`setter`,name:`required`,static:!1,private:!1,access:{has:e=>`required`in e,set:(e,t)=>{e.required=t}},metadata:e},null,n),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}set required(e){this._required=!!e}get required(){return this._required||this.isRequiredExternally()}willUpdate(e){super.willUpdate(e),e.has(`required`)&&(this.internals.ariaRequired=`${this.required}`)}isRequiredExternally(){return!1}}})();var Pn=`:host{flex-flow:var(--sbb-selection-group-orientation) wrap;gap:var(--sbb-selection-group-gap);width:var(--sbb-selection-group-width);align-items:flex-start;display:flex}:host([orientation=vertical]){--sbb-selection-group-orientation:column;--sbb-selection-group-width:100%;--sbb-selection-group-elements-width:100%}:host(:is(:state(has-panel),[state--has-panel])){--sbb-selection-group-width:100%;--sbb-selection-group-gap:var(--sbb-spacing-fixed-2x) var(--sbb-spacing-fixed-4x);--sbb-selection-group-elements-flex:auto}@media (width>=0){:host([orientation=vertical][horizontal-from=zero]){--sbb-selection-group-orientation:row;--sbb-selection-group-elements-width:auto}:host([orientation=vertical][horizontal-from=zero]:not(:is(:state(has-panel),[state--has-panel]))){--sbb-selection-group-width:auto}}@media (width>=37.5rem){:host([orientation=vertical][horizontal-from=small]){--sbb-selection-group-orientation:row;--sbb-selection-group-elements-width:auto}:host([orientation=vertical][horizontal-from=small]:not(:is(:state(has-panel),[state--has-panel]))){--sbb-selection-group-width:auto}}@media (width>=64rem){:host([orientation=vertical][horizontal-from=large]){--sbb-selection-group-orientation:row;--sbb-selection-group-elements-width:auto}:host([orientation=vertical][horizontal-from=large]:not(:is(:state(has-panel),[state--has-panel]))){--sbb-selection-group-width:auto}}@media (width>=90rem){:host([orientation=vertical][horizontal-from=ultra]){--sbb-selection-group-orientation:row;--sbb-selection-group-elements-width:auto}:host([orientation=vertical][horizontal-from=ultra]:not(:is(:state(has-panel),[state--has-panel]))){--sbb-selection-group-width:auto}}slot[name=error]::slotted(*){flex-basis:100%}::slotted(:is(sbb-checkbox-panel,sbb-radio-button-panel)){flex:var(--sbb-selection-group-elements-flex)}::slotted(:is(sbb-checkbox,sbb-checkbox-panel,sbb-radio-button-panel)){width:var(--sbb-selection-group-elements-width)}
|
|
40
40
|
`;let Fn=(()=>{let e=V(H(P)),t,r=[],i=[],c,u=[],f=[],p,m=[],h=[];return class extends e{static{let n=typeof Symbol==`function`&&Symbol.metadata?Object.create(e[Symbol.metadata]??null):void 0;t=[l()],c=[l({attribute:`horizontal-from`,reflect:!0})],p=[l({reflect:!0})],o(this,null,t,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:n},r,i),o(this,null,c,{kind:`accessor`,name:`horizontalFrom`,static:!1,private:!1,access:{has:e=>`horizontalFrom`in e,get:e=>e.horizontalFrom,set:(e,t)=>{e.horizontalFrom=t}},metadata:n},u,f),o(this,null,p,{kind:`accessor`,name:`orientation`,static:!1,private:!1,access:{has:e=>`orientation`in e,get:e=>e.orientation,set:(e,t)=>{e.orientation=t}},metadata:n},m,h),n&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=[a(Pn)]}#e=s(this,r,null);get size(){return this.#e}set size(e){this.#e=e}#t=(s(this,i),s(this,u,null));get horizontalFrom(){return this.#t}set horizontalFrom(e){this.#t=e}#n=(s(this,f),s(this,m,`horizontal`));get orientation(){return this.#n}set orientation(e){this.#n=e}get selectionElements(){return Array.from(this.querySelectorAll?.(this.selectionElementSelectors)??[]).filter(e=>e.closest?.(this.localName)===this)}constructor(){super(),s(this,h),this.addController(new d(this,{config:{childList:!0,subtree:!0},callback:()=>this.toggleState(`has-panel`,!!this.querySelector?.(this.panelElementSelector))}))}onSlotChange(){}render(){return n`
|
|
41
41
|
<slot @slotchange=${()=>this.onSlotChange()}></slot>
|