@moni-labs/moni-ui 0.4.0 → 0.4.2
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/README.md +49 -0
- package/custom-elements.json +36 -0
- package/dist/browser/moni-ui.iife.min.js +7118 -0
- package/dist/browser/moni-ui.iife.min.js.br +0 -0
- package/dist/browser/moni-ui.iife.min.js.gz +0 -0
- package/dist/browser/moni-ui.iife.min.js.map +1 -0
- package/dist/browser/moni-ui.min.css +1 -0
- package/dist/browser/moni-ui.min.css.br +0 -0
- package/dist/browser/moni-ui.min.css.gz +0 -0
- package/dist/browser/moni-ui.min.css.map +1 -0
- package/dist/browser/moni-ui.min.js +16903 -0
- package/dist/browser/moni-ui.min.js.br +0 -0
- package/dist/browser/moni-ui.min.js.gz +0 -0
- package/dist/browser/moni-ui.min.js.map +1 -0
- package/dist/browser.d.ts +7 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +6 -0
- package/dist/cdn/chunks/base-BIpe3L86.js +1 -0
- package/dist/cdn/chunks/class-map-DBljv-_e.js +1 -0
- package/dist/cdn/chunks/decorate-DxX3e27g.js +738 -0
- package/dist/cdn/chunks/directive-BSZPiF1A.js +1 -0
- package/dist/cdn/chunks/event-emitter-CGhsijUg.js +1 -0
- package/dist/cdn/chunks/gsap-DWxn8li7.js +1 -0
- package/dist/cdn/chunks/if-defined-CuEAJKpp.js +1 -0
- package/dist/cdn/chunks/live-B7Rjg1kt.js +1 -0
- package/dist/cdn/chunks/query-SWT-tzvq.js +1 -0
- package/dist/cdn/chunks/query-assigned-elements-BBHe1xEY.js +1 -0
- package/dist/cdn/components/moni-app-bar.js +118 -0
- package/dist/cdn/components/moni-badge.js +69 -0
- package/dist/cdn/components/moni-bottom-sheet.js +143 -0
- package/dist/cdn/components/moni-button-group.js +56 -0
- package/dist/cdn/components/moni-button-segment.js +272 -0
- package/dist/cdn/components/moni-button.js +602 -0
- package/dist/cdn/components/moni-card.js +143 -0
- package/dist/cdn/components/moni-carousel.js +311 -0
- package/dist/cdn/components/moni-checkbox.js +137 -0
- package/dist/cdn/components/moni-chip.js +218 -0
- package/dist/cdn/components/moni-color-field.js +54 -0
- package/dist/cdn/components/moni-context-menu.js +24 -0
- package/dist/cdn/components/moni-dialog.js +191 -0
- package/dist/cdn/components/moni-divider.js +32 -0
- package/dist/cdn/components/moni-expansion.js +50 -0
- package/dist/cdn/components/moni-fab-menu.js +57 -0
- package/dist/cdn/components/moni-fab.js +103 -0
- package/dist/cdn/components/moni-file-field.js +45 -0
- package/dist/cdn/components/moni-icon.js +55 -0
- package/dist/cdn/components/moni-list-item.js +144 -0
- package/dist/cdn/components/moni-list.js +16 -0
- package/dist/cdn/components/moni-loading-indicator.js +134 -0
- package/dist/cdn/components/moni-menu-item.js +45 -0
- package/dist/cdn/components/moni-menu.js +165 -0
- package/dist/cdn/components/moni-morph-modal.js +157 -0
- package/dist/cdn/components/moni-nav-item.js +153 -0
- package/dist/cdn/components/moni-nav.js +161 -0
- package/dist/cdn/components/moni-progress.js +420 -0
- package/dist/cdn/components/moni-radio.js +154 -0
- package/dist/cdn/components/moni-ripple.js +55 -0
- package/dist/cdn/components/moni-segmented-button.js +32 -0
- package/dist/cdn/components/moni-select-option.js +47 -0
- package/dist/cdn/components/moni-select.js +503 -0
- package/dist/cdn/components/moni-shape.js +99 -0
- package/dist/cdn/components/moni-side-sheet.js +234 -0
- package/dist/cdn/components/moni-slider.js +252 -0
- package/dist/cdn/components/moni-snackbar.js +91 -0
- package/dist/cdn/components/moni-split-button.js +110 -0
- package/dist/cdn/components/moni-step.js +111 -0
- package/dist/cdn/components/moni-stepper.js +25 -0
- package/dist/cdn/components/moni-switch.js +169 -0
- package/dist/cdn/components/moni-tab.js +93 -0
- package/dist/cdn/components/moni-tabs.js +38 -0
- package/dist/cdn/components/moni-text-field.js +83 -0
- package/dist/cdn/components/moni-textarea.js +46 -0
- package/dist/cdn/components/moni-time-picker.js +496 -0
- package/dist/cdn/components/moni-toolbar.js +71 -0
- package/dist/cdn/components/moni-tooltip.js +161 -0
- package/dist/cdn/components/moni-typography.js +117 -0
- package/dist/cdn/importmap.json +102 -0
- package/dist/cdn/moni-ui.min.css +1 -0
- package/package.json +8 -1
- package/src/browser.ts +6 -0
- package/src/types/css.d.ts +4 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import{d as e,i as t,m as n,o as r,r as i,s as a,t as o}from"../chunks/decorate-DxX3e27g.js";import{t as s}from"../chunks/query-SWT-tzvq.js";import"./moni-icon.js";import"./moni-button.js";var c=class extends t{constructor(...e){super(...e),this.open=!1,this.modal=!1,this.side=`right`,this.title=``,this.detached=!1,this.showBack=!1,this.noBorder=!1,this.withHandle=!1,this.hideClose=!1,this.expandedWidth=`600px`,this.maxWidth=``,this._isDragging=!1,this._startX=0,this._currentTranslationX=0,this._sheetWidth=0,this._defaultWidth=0,this._justDragged=!1}_getMaxWidthPx(){let e=this.expandedWidth||`600px`;return e.endsWith(`%`)||e.endsWith(`vw`)?window.innerWidth*(parseFloat(e)/100):e.endsWith(`px`)?parseFloat(e):600}updated(e){if(super.updated(e),e.has(`expandedWidth`)&&this.style.setProperty(`--moni-side-sheet-expanded-width`,this.expandedWidth),e.has(`maxWidth`)&&this.style.setProperty(`--moni-side-sheet-max-width`,this.maxWidth||`400px`),e.has(`open`)&&this._dialog){if(this.open)this.modal?this._dialog.open||(typeof this._dialog.showModal==`function`?this._dialog.showModal():this._dialog.open=!0):this._dialog.open||(typeof this._dialog.show==`function`?this._dialog.show():this._dialog.open=!0),this._dialog.getBoundingClientRect(),this._dialog.classList.add(`opened`);else if(this._dialog.open){this._dialog.classList.remove(`opened`);let e=t=>{t.target===this._dialog&&(t.propertyName===`transform`||t.propertyName===`opacity`)&&(this._dialog.removeEventListener(`transitionend`,e),!this.open&&this._dialog.open&&(this._dialog.classList.remove(`expanded`),this._dialog.close()))};this._dialog.addEventListener(`transitionend`,e),setTimeout(()=>{!this.open&&this._dialog.open&&(this._dialog.classList.remove(`expanded`),this._dialog.close())},350)}}}_onPointerDown(e){if(!this.withHandle)return;let t=e.target;!t.closest(`.handle`)&&!t.closest(`header`)||(this._isDragging=!0,this._startX=e.clientX,this._sheetWidth=this._dialog.getBoundingClientRect().width,this._currentTranslationX=0,this._dialog.classList.contains(`expanded`)||(this._defaultWidth=this._sheetWidth),t.setPointerCapture(e.pointerId),this._dialog.classList.add(`dragging`))}_onPointerMove(e){if(!this._isDragging)return;let t=e.clientX-this._startX,n=this._dialog.classList.contains(`expanded`),r=this._getMaxWidthPx(),i=this.side===`right`?t:-t;if(n){if(i>0){let e=this._sheetWidth-i;this._dialog.style.transform=``,this._dialog.style.width=`${Math.max(0,e)}px`}else{let e=this._sheetWidth-i*.2;this._dialog.style.width=`${Math.min(r,e)}px`}}else if(i>0)this._currentTranslationX=i,this._dialog.style.transform=`translateX(${this.side===`right`?i:-i}px)`,this._dialog.style.width=``;else{let e=this._sheetWidth-i;this._dialog.style.transform=``,this._dialog.style.width=`${Math.min(r,e)}px`}}_onPointerUp(e){if(!this._isDragging)return;e.target.releasePointerCapture(e.pointerId),this._isDragging=!1,this._dialog.classList.remove(`dragging`);let t=e.clientX-this._startX;Math.abs(t)>5&&(this._justDragged=!0,setTimeout(()=>{this._justDragged=!1},50));let n=this._dialog.classList.contains(`expanded`),r=this._getMaxWidthPx(),i=this.side===`right`?t:-t;if(n){let e=this._sheetWidth-i;if(e<this._defaultWidth-80){this._dialog.classList.remove(`expanded`),this._dialog.classList.remove(`opened`),this._dialog.style.transform=this.side===`right`?`translateX(100%)`:`translateX(-100%)`,this._dialog.style.width=``;let e=()=>{this._dialog.removeEventListener(`transitionend`,e),this._dialog.style.transform=``,this._dialog.style.width=``,this.open=!1,this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0}))};this._dialog.addEventListener(`transitionend`,e),setTimeout(()=>{this.open&&e()},300)}else e<(r+this._defaultWidth)/2?(this._dialog.classList.remove(`expanded`),this._dialog.style.transform=``,this._dialog.style.width=``):(this._dialog.style.transform=``,this._dialog.style.width=``)}else if(i<0)this._sheetWidth-i>(r+this._sheetWidth)/2||-i>80?(this._dialog.classList.add(`expanded`),this._dialog.style.transform=``,this._dialog.style.width=``):(this._dialog.style.transform=``,this._dialog.style.width=``);else{let e=Math.min(150,this._sheetWidth*.4);if(Math.abs(this._currentTranslationX)>e){this._dialog.classList.remove(`opened`),this._dialog.style.transform=this.side===`right`?`translateX(100%)`:`translateX(-100%)`,this._dialog.style.width=``;let e=()=>{this._dialog.removeEventListener(`transitionend`,e),this._dialog.style.transform=``,this._dialog.style.width=``,this.open=!1,this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0}))};this._dialog.addEventListener(`transitionend`,e),setTimeout(()=>{this.open&&e()},300)}else this._dialog.style.transform=``,this._dialog.style.width=``}}_onPointerCancel(e){this._isDragging&&(e.target.releasePointerCapture(e.pointerId),this._isDragging=!1,this._dialog.classList.remove(`dragging`),this._dialog.style.transform=``,this._dialog.style.width=``)}_onCloseClick(){this.open=!1,this.dispatchEvent(new CustomEvent(`close`,{bubbles:!0,composed:!0}))}_onBackClick(){this.dispatchEvent(new CustomEvent(`back`,{bubbles:!0,composed:!0}))}_onDialogClick(e){if(this._justDragged){this._justDragged=!1;return}this.modal&&e.target===this._dialog&&this._onCloseClick()}static{this.styles=[i,n`
|
|
2
|
+
:host {
|
|
3
|
+
display: contents;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
dialog {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
border: none;
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 0;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
block-size: 100vh;
|
|
14
|
+
inline-size: 100%;
|
|
15
|
+
max-inline-size: var(--moni-side-sheet-max-width, 400px);
|
|
16
|
+
background-color: var(--surface);
|
|
17
|
+
color: var(--on-surface);
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
padding: 0;
|
|
20
|
+
margin: 0;
|
|
21
|
+
z-index: 90;
|
|
22
|
+
outline: none;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
transition:
|
|
25
|
+
transform var(--speed3) cubic-bezier(0.2, 0, 0, 1),
|
|
26
|
+
width var(--speed3) cubic-bezier(0.2, 0, 0, 1),
|
|
27
|
+
max-width var(--speed3) cubic-bezier(0.2, 0, 0, 1),
|
|
28
|
+
opacity var(--speed3),
|
|
29
|
+
visibility var(--speed3);
|
|
30
|
+
opacity: 0;
|
|
31
|
+
visibility: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
dialog.dragging {
|
|
35
|
+
transition: none !important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
dialog.expanded {
|
|
39
|
+
max-inline-size: var(--moni-side-sheet-expanded-width, 600px) !important;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Alignments */
|
|
43
|
+
dialog.right {
|
|
44
|
+
right: 0;
|
|
45
|
+
left: auto;
|
|
46
|
+
transform: translateX(100%);
|
|
47
|
+
border-left: 1px solid var(--outline-variant);
|
|
48
|
+
border-radius: 1.75rem 0 0 1.75rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
dialog.left {
|
|
52
|
+
left: 0;
|
|
53
|
+
right: auto;
|
|
54
|
+
transform: translateX(-100%);
|
|
55
|
+
border-right: 1px solid var(--outline-variant);
|
|
56
|
+
border-radius: 0 1.75rem 1.75rem 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Detached alignment */
|
|
60
|
+
dialog.detached {
|
|
61
|
+
top: 16px;
|
|
62
|
+
bottom: 16px;
|
|
63
|
+
block-size: calc(100vh - 32px);
|
|
64
|
+
border-radius: 1.75rem !important;
|
|
65
|
+
border: 1px solid var(--outline-variant);
|
|
66
|
+
box-shadow: var(--elevate1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
dialog.detached.right {
|
|
70
|
+
right: 16px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
dialog.detached.left {
|
|
74
|
+
left: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Borders overrides */
|
|
78
|
+
dialog.no-border {
|
|
79
|
+
border: none !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Modal Styles */
|
|
83
|
+
dialog.modal {
|
|
84
|
+
background-color: var(--surface-container-low);
|
|
85
|
+
box-shadow: var(--elevate3);
|
|
86
|
+
z-index: 100;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Backdrop for Modal */
|
|
90
|
+
dialog::backdrop {
|
|
91
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
92
|
+
opacity: 0;
|
|
93
|
+
transition: opacity var(--speed3);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Opened State */
|
|
97
|
+
dialog.opened {
|
|
98
|
+
opacity: 1;
|
|
99
|
+
visibility: visible;
|
|
100
|
+
transform: translateX(0);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
dialog.opened::backdrop {
|
|
104
|
+
opacity: 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Drag handle */
|
|
108
|
+
.handle {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 50%;
|
|
111
|
+
width: 4px;
|
|
112
|
+
height: 48px;
|
|
113
|
+
background: var(--outline-variant);
|
|
114
|
+
border-radius: 999px;
|
|
115
|
+
cursor: grab;
|
|
116
|
+
transform: translateY(-50%);
|
|
117
|
+
touch-action: none;
|
|
118
|
+
z-index: 10;
|
|
119
|
+
opacity: 0.8;
|
|
120
|
+
transition: background-color var(--speed1);
|
|
121
|
+
}
|
|
122
|
+
.handle:hover {
|
|
123
|
+
background: var(--on-surface-variant);
|
|
124
|
+
}
|
|
125
|
+
.handle:active {
|
|
126
|
+
background: var(--on-surface-variant);
|
|
127
|
+
cursor: grabbing;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
dialog.right .handle {
|
|
131
|
+
left: 6px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
dialog.left .handle {
|
|
135
|
+
right: 6px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/* Header & Spacing */
|
|
139
|
+
header {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: space-between;
|
|
143
|
+
padding: 1.25rem 1.5rem 0.75rem;
|
|
144
|
+
gap: 0.5rem;
|
|
145
|
+
cursor: grab;
|
|
146
|
+
touch-action: none;
|
|
147
|
+
user-select: none;
|
|
148
|
+
}
|
|
149
|
+
header:active {
|
|
150
|
+
cursor: grabbing;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.header-start {
|
|
154
|
+
display: flex;
|
|
155
|
+
align-items: center;
|
|
156
|
+
gap: 0.75rem;
|
|
157
|
+
flex: 1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.headline {
|
|
161
|
+
font-size: 1.5rem;
|
|
162
|
+
font-weight: 400;
|
|
163
|
+
margin: 0;
|
|
164
|
+
color: var(--on-surface);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.content {
|
|
168
|
+
flex: 1;
|
|
169
|
+
overflow-y: auto;
|
|
170
|
+
padding: 0 1.5rem 1.5rem;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
footer {
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: flex-start;
|
|
177
|
+
padding: 1rem 1.5rem 1.5rem;
|
|
178
|
+
gap: 0.5rem;
|
|
179
|
+
border-top: 1px solid var(--outline-variant);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
footer.no-border {
|
|
183
|
+
border-top: none !important;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/* If no footer slot is passed, hide it */
|
|
187
|
+
footer:not(:has(slot[name="footer"])) {
|
|
188
|
+
display: none;
|
|
189
|
+
}
|
|
190
|
+
`]}render(){let t=[this.side,this.modal?`modal`:`standard`,this.detached?`detached`:``,this.noBorder?`no-border`:``].filter(Boolean).join(` `);return e`
|
|
191
|
+
<dialog
|
|
192
|
+
part="dialog"
|
|
193
|
+
?open=${this.open}
|
|
194
|
+
class=${t}
|
|
195
|
+
@click=${this._onDialogClick}
|
|
196
|
+
@pointerdown=${this._onPointerDown}
|
|
197
|
+
@pointermove=${this._onPointerMove}
|
|
198
|
+
@pointerup=${this._onPointerUp}
|
|
199
|
+
@pointercancel=${this._onPointerCancel}
|
|
200
|
+
>
|
|
201
|
+
${this.withHandle?e`<div class="handle" aria-hidden="true"></div>`:``}
|
|
202
|
+
<header part="header">
|
|
203
|
+
<div class="header-start">
|
|
204
|
+
${this.showBack?e`
|
|
205
|
+
<moni-button
|
|
206
|
+
variant="icon"
|
|
207
|
+
@click=${this._onBackClick}
|
|
208
|
+
aria-label="Volver"
|
|
209
|
+
>
|
|
210
|
+
<moni-icon>arrow_back</moni-icon>
|
|
211
|
+
</moni-button>
|
|
212
|
+
`:``}
|
|
213
|
+
<slot name="header">
|
|
214
|
+
<h2 class="headline">${this.title}</h2>
|
|
215
|
+
</slot>
|
|
216
|
+
</div>
|
|
217
|
+
${this.hideClose?``:e`
|
|
218
|
+
<moni-button
|
|
219
|
+
variant="icon"
|
|
220
|
+
@click=${this._onCloseClick}
|
|
221
|
+
aria-label="Cerrar"
|
|
222
|
+
>
|
|
223
|
+
<moni-icon>close</moni-icon>
|
|
224
|
+
</moni-button>
|
|
225
|
+
`}
|
|
226
|
+
</header>
|
|
227
|
+
<div class="content" part="content">
|
|
228
|
+
<slot></slot>
|
|
229
|
+
</div>
|
|
230
|
+
<footer class=${this.noBorder?`no-border`:``} part="footer">
|
|
231
|
+
<slot name="footer"></slot>
|
|
232
|
+
</footer>
|
|
233
|
+
</dialog>
|
|
234
|
+
`}};o([r({type:Boolean,reflect:!0})],c.prototype,`open`,void 0),o([r({type:Boolean,reflect:!0})],c.prototype,`modal`,void 0),o([r({reflect:!0})],c.prototype,`side`,void 0),o([r({reflect:!0})],c.prototype,`title`,void 0),o([r({type:Boolean,reflect:!0})],c.prototype,`detached`,void 0),o([r({type:Boolean,reflect:!0,attribute:`show-back`})],c.prototype,`showBack`,void 0),o([r({type:Boolean,reflect:!0,attribute:`no-border`})],c.prototype,`noBorder`,void 0),o([r({type:Boolean,reflect:!0,attribute:`with-handle`})],c.prototype,`withHandle`,void 0),o([r({type:Boolean,reflect:!0,attribute:`hide-close`})],c.prototype,`hideClose`,void 0),o([r({reflect:!0,attribute:`expanded-width`})],c.prototype,`expandedWidth`,void 0),o([r({reflect:!0,attribute:`max-width`})],c.prototype,`maxWidth`,void 0),o([s(`dialog`)],c.prototype,`_dialog`,void 0),c=o([a(`moni-side-sheet`)],c);
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import{a as e,c as t,d as n,i as r,m as i,o as a,r as o,s,t as c}from"../chunks/decorate-DxX3e27g.js";import"./moni-icon.js";import{t as l}from"../chunks/if-defined-CuEAJKpp.js";var u=class extends r{constructor(...e){super(...e),this.name=``,this.min=`0`,this.max=`100`,this.step=``,this.tickInterval=null,this.insetIcon=``,this.indicatorPlacement=`top`,this.size=`medium`,this.range=!1,this.disabled=!1,this.ticks=!1,this.indicator=!1,this.isVertical=!1,this._value=`50`,this._valueEnd=`75`}get value(){return this._value}set value(e){this._value=e}get valueEnd(){return this._valueEnd}set valueEnd(e){this._valueEnd=e}_pct(e){let t=parseFloat(this.min)||0,n=parseFloat(this.max)||100;return Math.max(0,Math.min(100,((parseFloat(e)||0)-t)/(n-t)*100))}_onInput(e,t){let n=e.target;t===0?this._value=n.value:this._valueEnd=n.value,this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0}))}_onChange(e,t){let n=e.target;t===0?this._value=n.value:this._valueEnd=n.value,this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))}_renderDatalist(){if(this.tickInterval!=null&&this.tickInterval>0){let e=parseFloat(this.min)||0,t=parseFloat(this.max)||100,r=this.tickInterval,i=[];for(let n=e;n<=t;n+=r)i.push(Math.round(n*1e3)/1e3);return n`<datalist id="ticks">
|
|
2
|
+
${i.map(e=>n`<option value=${e}></option>`)}
|
|
3
|
+
</datalist>`}return this.ticks?n`<datalist id="ticks">
|
|
4
|
+
<option value=${this.min}></option>
|
|
5
|
+
<option value=${this.max}></option>
|
|
6
|
+
</datalist>`:t}static{this.styles=[o,i`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
font-family: var(--font);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* BeerCSS .slider.vertical */
|
|
13
|
+
:host([vertical]) {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
inline-size: var(--_thumb, 2.5rem);
|
|
16
|
+
block-size: var(--moni-slider-height, 150px);
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([vertical]) .slider {
|
|
22
|
+
margin: 0.5rem auto !important;
|
|
23
|
+
padding: 50% 0;
|
|
24
|
+
transform: rotate(-90deg);
|
|
25
|
+
inline-size: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* BeerCSS .slider */
|
|
29
|
+
.slider {
|
|
30
|
+
--_start: 0%;
|
|
31
|
+
--_end: 0%;
|
|
32
|
+
--_track: 1rem;
|
|
33
|
+
--_thumb: max(2.5rem, calc(var(--_track, 0) + 0.5rem));
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center !important;
|
|
36
|
+
inline-size: auto;
|
|
37
|
+
block-size: var(--_thumb);
|
|
38
|
+
flex: none;
|
|
39
|
+
direction: ltr;
|
|
40
|
+
margin: 0 1.25rem;
|
|
41
|
+
color: var(--primary);
|
|
42
|
+
position: relative;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.slider.tiny { --_track: 1rem; }
|
|
46
|
+
.slider.small { --_track: 1.5rem; }
|
|
47
|
+
.slider.medium { --_track: 2.5rem; }
|
|
48
|
+
.slider.large { --_track: 3.5rem; }
|
|
49
|
+
.slider.extra { --_track: 6rem; }
|
|
50
|
+
|
|
51
|
+
/* BeerCSS: track background via ::before */
|
|
52
|
+
.slider::before {
|
|
53
|
+
content: "";
|
|
54
|
+
position: absolute;
|
|
55
|
+
inline-size: 100%;
|
|
56
|
+
block-size: var(--_track);
|
|
57
|
+
border-radius: 1rem;
|
|
58
|
+
background: var(--active);
|
|
59
|
+
clip-path: polygon(
|
|
60
|
+
calc(var(--_start, 0) - 0.5rem) 0, 0 0, 0 100%,
|
|
61
|
+
calc(var(--_start, 0) - 0.5rem) 100%, calc(var(--_start, 0) - 0.5rem) 0,
|
|
62
|
+
calc(100% - var(--_end, 0) + 0.5rem) 0, 100% 0, 100% 100%,
|
|
63
|
+
calc(100% - var(--_end, 0) + 0.5rem) 100%, calc(100% - var(--_end, 0) + 0.5rem) 0
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* BeerCSS: colored fill span */
|
|
68
|
+
.slider > span:not([class]) {
|
|
69
|
+
position: absolute;
|
|
70
|
+
block-size: var(--_track);
|
|
71
|
+
border-radius: 1rem 0 0 1rem;
|
|
72
|
+
background: currentColor;
|
|
73
|
+
color: currentColor;
|
|
74
|
+
z-index: 0;
|
|
75
|
+
inset: calc(50% - (var(--_track, 0) / 2))
|
|
76
|
+
calc(var(--_end) + 0.5rem) auto var(--_start);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.slider > input[type='range'] + input[type='range'] ~ span:not([class]) {
|
|
80
|
+
border-radius: 0;
|
|
81
|
+
inset: calc(50% - (var(--_track, 0) / 2))
|
|
82
|
+
calc(var(--_end) + 0.5rem) auto
|
|
83
|
+
calc(var(--_start) + 0.5rem);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* BeerCSS slider inputs */
|
|
87
|
+
.slider > input {
|
|
88
|
+
appearance: none;
|
|
89
|
+
box-shadow: none;
|
|
90
|
+
border: none;
|
|
91
|
+
outline: none;
|
|
92
|
+
pointer-events: none;
|
|
93
|
+
inline-size: 100%;
|
|
94
|
+
block-size: var(--_track);
|
|
95
|
+
background: none;
|
|
96
|
+
z-index: 1;
|
|
97
|
+
padding: 0;
|
|
98
|
+
margin: 0;
|
|
99
|
+
touch-action: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.slider > input:only-of-type {
|
|
103
|
+
pointer-events: all;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.slider > input ~ input {
|
|
107
|
+
position: absolute;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* BeerCSS thumb styles */
|
|
111
|
+
.slider > input::-webkit-slider-thumb {
|
|
112
|
+
appearance: none;
|
|
113
|
+
box-shadow: none;
|
|
114
|
+
border: none;
|
|
115
|
+
outline: none;
|
|
116
|
+
pointer-events: all;
|
|
117
|
+
block-size: var(--_thumb);
|
|
118
|
+
inline-size: 0.25rem;
|
|
119
|
+
border-radius: 0.25rem;
|
|
120
|
+
background: currentColor;
|
|
121
|
+
cursor: grab;
|
|
122
|
+
margin: 0;
|
|
123
|
+
z-index: 1;
|
|
124
|
+
transform: scaleX(1);
|
|
125
|
+
transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), border-radius 180ms cubic-bezier(0.2, 0, 0, 1);
|
|
126
|
+
}
|
|
127
|
+
.slider > input::-webkit-slider-thumb:active { cursor: grabbing; }
|
|
128
|
+
|
|
129
|
+
.slider > input::-moz-range-thumb {
|
|
130
|
+
appearance: none;
|
|
131
|
+
box-shadow: none;
|
|
132
|
+
border: none;
|
|
133
|
+
outline: none;
|
|
134
|
+
pointer-events: all;
|
|
135
|
+
block-size: 2.75rem;
|
|
136
|
+
inline-size: 0.25rem;
|
|
137
|
+
border-radius: 0.25rem;
|
|
138
|
+
background: var(--primary);
|
|
139
|
+
cursor: grab;
|
|
140
|
+
margin: 0;
|
|
141
|
+
transform: scaleX(1);
|
|
142
|
+
transition: transform 180ms cubic-bezier(0.2, 0, 0, 1), border-radius 180ms cubic-bezier(0.2, 0, 0, 1);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.slider > input:not(:disabled):is(:focus, :active)::-webkit-slider-thumb,
|
|
146
|
+
.slider > input:not(:disabled):is(:focus, :active)::-moz-range-thumb {
|
|
147
|
+
transform: scaleX(0.6);
|
|
148
|
+
border-radius: 0.375rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.slider > input:disabled { cursor: not-allowed; }
|
|
152
|
+
.slider > input:disabled::-webkit-slider-thumb { background: var(--outline); cursor: not-allowed; }
|
|
153
|
+
.slider > input:disabled::-moz-range-thumb { background: var(--outline); cursor: not-allowed; }
|
|
154
|
+
.slider > input:disabled ~ span:not([class]) { background: var(--outline); }
|
|
155
|
+
|
|
156
|
+
.slider:has(> [disabled]) { opacity: 0.62; }
|
|
157
|
+
|
|
158
|
+
/* Focus visible outline */
|
|
159
|
+
.slider > input:focus-visible::-webkit-slider-thumb {
|
|
160
|
+
outline: 0.1875rem solid var(--primary);
|
|
161
|
+
outline-offset: 0.25rem;
|
|
162
|
+
}
|
|
163
|
+
.slider > input:focus-visible::-moz-range-thumb {
|
|
164
|
+
outline: 0.1875rem solid var(--primary);
|
|
165
|
+
outline-offset: 0.25rem;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Inset icon */
|
|
169
|
+
.slider > span > i {
|
|
170
|
+
position: absolute;
|
|
171
|
+
block-size: auto;
|
|
172
|
+
inset: 0 auto 0 0.5rem;
|
|
173
|
+
color: var(--inverse-primary);
|
|
174
|
+
z-index: 1;
|
|
175
|
+
}
|
|
176
|
+
.slider:not(.medium, .large, .extra) > span > i { display: none; }
|
|
177
|
+
|
|
178
|
+
/* Value indicator tooltip */
|
|
179
|
+
.slider > .tooltip {
|
|
180
|
+
--_indicator-gap: 0.5rem;
|
|
181
|
+
visibility: hidden;
|
|
182
|
+
opacity: 0;
|
|
183
|
+
border-radius: 2rem;
|
|
184
|
+
transform-origin: 50% 100%;
|
|
185
|
+
transform: translate(-50%, calc(-100% + 0.25rem)) scale(0.82);
|
|
186
|
+
transition:
|
|
187
|
+
opacity 150ms cubic-bezier(0.2, 0, 0, 1),
|
|
188
|
+
transform 200ms cubic-bezier(0.2, 0, 0, 1),
|
|
189
|
+
visibility 0s linear 200ms;
|
|
190
|
+
inset-block-start: calc(50% - (var(--_thumb) / 2) - var(--_indicator-gap));
|
|
191
|
+
padding: 0.75rem 1rem;
|
|
192
|
+
position: absolute;
|
|
193
|
+
background-color: var(--inverse-surface);
|
|
194
|
+
color: var(--inverse-on-surface);
|
|
195
|
+
font-size: 0.75rem;
|
|
196
|
+
font-weight: 500;
|
|
197
|
+
z-index: 2;
|
|
198
|
+
white-space: nowrap;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.slider > .tooltip.bottom {
|
|
202
|
+
transform-origin: 50% 0;
|
|
203
|
+
transform: translate(-50%, calc(100% - 0.25rem)) scale(0.82);
|
|
204
|
+
inset-block: auto calc(50% - (var(--_thumb) / 2) - var(--_indicator-gap));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* BeerCSS: tooltip shows on :focus of the input */
|
|
208
|
+
.slider > input:first-of-type:focus ~ .tooltip-1,
|
|
209
|
+
.slider > input:nth-of-type(2):focus ~ .tooltip-2 {
|
|
210
|
+
opacity: 1;
|
|
211
|
+
visibility: visible;
|
|
212
|
+
transform: translate(-50%, -100%) scale(1);
|
|
213
|
+
transition-delay: 0s;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.slider > input:first-of-type:focus ~ .tooltip-1.bottom,
|
|
217
|
+
.slider > input:nth-of-type(2):focus ~ .tooltip-2.bottom {
|
|
218
|
+
transform: translate(-50%, 100%) scale(1);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@media (prefers-reduced-motion: reduce) {
|
|
222
|
+
.slider > input::-webkit-slider-thumb,
|
|
223
|
+
.slider > input::-moz-range-thumb,
|
|
224
|
+
.slider > .tooltip {
|
|
225
|
+
transition-duration: 0.01ms;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
`]}render(){let e=this._pct(this._value),r=this._pct(this._valueEnd),i=this.range?e:0,a=this.range?100-r:100-e,o=(e,r)=>n`
|
|
229
|
+
<input
|
|
230
|
+
part="control"
|
|
231
|
+
type="range"
|
|
232
|
+
min=${this.min}
|
|
233
|
+
max=${this.max}
|
|
234
|
+
step=${l(this.step||void 0)}
|
|
235
|
+
list=${l(this.ticks?`ticks`:void 0)}
|
|
236
|
+
?disabled=${this.disabled}
|
|
237
|
+
.value=${r}
|
|
238
|
+
name=${e===0?l(this.name||void 0):t}
|
|
239
|
+
@input=${t=>this._onInput(t,e)}
|
|
240
|
+
@change=${t=>this._onChange(t,e)}
|
|
241
|
+
/>
|
|
242
|
+
`,s=this.insetIcon&&[`medium`,`large`,`extra`].includes(this.size)?n`<i><moni-icon name="${this.insetIcon}"></moni-icon></i>`:``,c=this.indicator?n`<div class="tooltip tooltip-1 ${this.indicatorPlacement}" style="inset-inline-start: ${e}%;">${this._value}</div>`:t,u=this.indicator&&this.range?n`<div class="tooltip tooltip-2 ${this.indicatorPlacement}" style="inset-inline-start: ${r}%;">${this._valueEnd}</div>`:t;return n`<div
|
|
243
|
+
class="slider ${this.size}${this.isVertical?` vertical`:``}"
|
|
244
|
+
part="root"
|
|
245
|
+
style="--_start: ${i}%; --_end: ${a}%;"
|
|
246
|
+
>
|
|
247
|
+
${this._renderDatalist()}
|
|
248
|
+
${this.range?n`${o(0,this._value)}${o(1,this._valueEnd)}`:o(0,this._value)}
|
|
249
|
+
<span>${s}</span>
|
|
250
|
+
${c}
|
|
251
|
+
${u}
|
|
252
|
+
</div>`}};c([a({reflect:!0})],u.prototype,`name`,void 0),c([a({reflect:!0})],u.prototype,`min`,void 0),c([a({reflect:!0})],u.prototype,`max`,void 0),c([a({reflect:!0})],u.prototype,`step`,void 0),c([a({type:Number,reflect:!0,attribute:`tick-interval`})],u.prototype,`tickInterval`,void 0),c([a({reflect:!0,attribute:`inset-icon`})],u.prototype,`insetIcon`,void 0),c([a({reflect:!0,attribute:`indicator-placement`})],u.prototype,`indicatorPlacement`,void 0),c([a({reflect:!0})],u.prototype,`size`,void 0),c([a({type:Boolean,reflect:!0})],u.prototype,`range`,void 0),c([a({type:Boolean,reflect:!0})],u.prototype,`disabled`,void 0),c([a({type:Boolean,reflect:!0})],u.prototype,`ticks`,void 0),c([a({type:Boolean,reflect:!0})],u.prototype,`indicator`,void 0),c([a({type:Boolean,reflect:!0,attribute:`vertical`})],u.prototype,`isVertical`,void 0),c([e()],u.prototype,`_value`,void 0),c([e()],u.prototype,`_valueEnd`,void 0),c([a({reflect:!0})],u.prototype,`value`,null),c([a({reflect:!0,attribute:`value-end`})],u.prototype,`valueEnd`,null),u=c([s(`moni-slider`)],u);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import{d as e,i as t,m as n,o as r,r as i,s as a,t as o}from"../chunks/decorate-DxX3e27g.js";import"./moni-icon.js";var s=class extends t{constructor(...e){super(...e),this.text=``,this.action=``,this.placement=`bottom`,this.active=!1,this.maxLines=2}static{this.styles=[i,n`
|
|
2
|
+
:host {
|
|
3
|
+
/* Use block instead of contents so position:fixed inside
|
|
4
|
+
works relative to the viewport (its containing block). */
|
|
5
|
+
display: block;
|
|
6
|
+
font-family: var(--font);
|
|
7
|
+
/* Host itself takes no space */
|
|
8
|
+
position: fixed;
|
|
9
|
+
inset: 0;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
z-index: 200;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* BeerCSS .snackbar */
|
|
15
|
+
.snackbar {
|
|
16
|
+
position: fixed;
|
|
17
|
+
/* BeerCSS: inset: auto auto 6rem 50% for bottom placement */
|
|
18
|
+
inset-block-end: 6rem;
|
|
19
|
+
inset-block-start: auto;
|
|
20
|
+
inset-inline: 50% auto;
|
|
21
|
+
inline-size: 80%;
|
|
22
|
+
block-size: auto;
|
|
23
|
+
z-index: 200;
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
display: flex;
|
|
26
|
+
box-shadow: var(--elevate2);
|
|
27
|
+
color: var(--inverse-on-surface);
|
|
28
|
+
background-color: var(--inverse-surface);
|
|
29
|
+
padding: 1rem;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
text-align: start;
|
|
32
|
+
align-items: center;
|
|
33
|
+
border-radius: 0.25rem;
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
transition: all var(--speed2);
|
|
36
|
+
transform: translate(-50%, 1rem);
|
|
37
|
+
opacity: 0;
|
|
38
|
+
pointer-events: auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* BeerCSS .snackbar.top */
|
|
42
|
+
.snackbar.top {
|
|
43
|
+
inset-block-start: 6rem;
|
|
44
|
+
inset-block-end: auto;
|
|
45
|
+
transform: translate(-50%, -1rem);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* BeerCSS .snackbar.active */
|
|
49
|
+
:host([active]) .snackbar {
|
|
50
|
+
visibility: visible;
|
|
51
|
+
transform: translate(-50%, 0);
|
|
52
|
+
opacity: 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.snackbar > .max {
|
|
56
|
+
flex: auto;
|
|
57
|
+
/* M3 spec § Message: clamp at 2 lines (configurable via
|
|
58
|
+
max-lines attribute). */
|
|
59
|
+
display: -webkit-box;
|
|
60
|
+
-webkit-box-orient: vertical;
|
|
61
|
+
-webkit-line-clamp: var(--_max-lines, 2);
|
|
62
|
+
line-clamp: var(--_max-lines, 2);
|
|
63
|
+
overflow: hidden;
|
|
64
|
+
text-overflow: ellipsis;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.action {
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
text-transform: uppercase;
|
|
70
|
+
font-size: 0.875rem;
|
|
71
|
+
letter-spacing: 0.05em;
|
|
72
|
+
color: var(--inverse-primary);
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media only screen and (min-width: 993px) {
|
|
77
|
+
.snackbar {
|
|
78
|
+
inline-size: 40%;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`]}render(){return e`<div
|
|
82
|
+
class="snackbar ${this.placement}"
|
|
83
|
+
part="snackbar"
|
|
84
|
+
role="status"
|
|
85
|
+
aria-live="polite"
|
|
86
|
+
style="--_max-lines: ${this.maxLines}"
|
|
87
|
+
>
|
|
88
|
+
<slot name="icon"></slot>
|
|
89
|
+
<span class="max" part="text"><slot>${this.text}</slot></span>
|
|
90
|
+
${this.action?e`<span class="action" part="action">${this.action}</span>`:``}
|
|
91
|
+
</div>`}};o([r({reflect:!0})],s.prototype,`text`,void 0),o([r({reflect:!0})],s.prototype,`action`,void 0),o([r({reflect:!0})],s.prototype,`placement`,void 0),o([r({type:Boolean,reflect:!0})],s.prototype,`active`,void 0),o([r({type:Number,reflect:!0,attribute:`max-lines`})],s.prototype,`maxLines`,void 0),s=o([a(`moni-snackbar`)],s);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import{d as e,i as t,m as n,o as r,r as i,s as a,t as o}from"../chunks/decorate-DxX3e27g.js";import{t as s}from"../chunks/query-assigned-elements-BBHe1xEY.js";var c=class extends t{constructor(...e){super(...e),this.variant=`filled`,this.size=`small`,this.gap=``}static{this.styles=[i,n`
|
|
2
|
+
:host {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
vertical-align: middle;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.wrapper {
|
|
9
|
+
--_split-button-gap: 0.125rem;
|
|
10
|
+
--_split-height: 3.5rem;
|
|
11
|
+
--_split-leading-start: 1.5rem;
|
|
12
|
+
--_split-leading-end: 1.5rem;
|
|
13
|
+
--_split-content-gap: 0.5rem;
|
|
14
|
+
--_split-leading-icon: 1.5rem;
|
|
15
|
+
--_split-trailing-icon: 1.625rem;
|
|
16
|
+
--_split-trailing-width: 3.5rem;
|
|
17
|
+
--_split-label-size: 1rem;
|
|
18
|
+
--_split-inner-radius: 0.25rem;
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: var(--_split-button-gap);
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
slot {
|
|
26
|
+
display: contents;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
::slotted(*) {
|
|
30
|
+
margin-inline: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
::slotted([slot='leading-button']) {
|
|
34
|
+
--moni-button-box-sizing: border-box;
|
|
35
|
+
--moni-button-height: var(--_split-height);
|
|
36
|
+
--moni-button-min-inline-size: 0px;
|
|
37
|
+
--moni-button-padding: 0 var(--_split-leading-end) 0 var(--_split-leading-start);
|
|
38
|
+
--moni-button-gap: var(--_split-content-gap);
|
|
39
|
+
--moni-button-font-size: var(--_split-label-size);
|
|
40
|
+
--moni-button-icon-size: var(--_split-leading-icon);
|
|
41
|
+
--moni-button-border-radius: calc(var(--_split-height) / 2) var(--_split-inner-radius) var(--_split-inner-radius) calc(var(--_split-height) / 2);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
::slotted([slot='trailing-button']) {
|
|
45
|
+
--moni-button-box-sizing: border-box;
|
|
46
|
+
--moni-button-height: var(--_split-height);
|
|
47
|
+
--moni-button-inline-size: var(--_split-trailing-width);
|
|
48
|
+
--moni-button-min-inline-size: var(--_split-trailing-width);
|
|
49
|
+
--moni-button-padding: 0;
|
|
50
|
+
--moni-button-gap: 0;
|
|
51
|
+
--moni-button-font-size: var(--_split-label-size);
|
|
52
|
+
--moni-button-icon-size: var(--_split-trailing-icon);
|
|
53
|
+
--moni-button-icon-offset: -0.0625rem;
|
|
54
|
+
--moni-button-border-radius: var(--_split-inner-radius) calc(var(--_split-height) / 2) calc(var(--_split-height) / 2) var(--_split-inner-radius);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
::slotted([slot='trailing-button'][active]) {
|
|
58
|
+
--moni-button-icon-offset: 0px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([size='xsmall']) .wrapper {
|
|
62
|
+
--_split-height: 2rem;
|
|
63
|
+
--_split-leading-start: 0.75rem;
|
|
64
|
+
--_split-leading-end: 0.625rem;
|
|
65
|
+
--_split-content-gap: 0.25rem;
|
|
66
|
+
--_split-leading-icon: 1.25rem;
|
|
67
|
+
--_split-trailing-icon: 1.375rem;
|
|
68
|
+
--_split-trailing-width: 3rem;
|
|
69
|
+
--_split-label-size: 0.875rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host([size='small']) .wrapper {
|
|
73
|
+
--_split-height: 2.5rem;
|
|
74
|
+
--_split-leading-start: 1rem;
|
|
75
|
+
--_split-leading-end: 0.75rem;
|
|
76
|
+
--_split-content-gap: 0.5rem;
|
|
77
|
+
--_split-leading-icon: 1.25rem;
|
|
78
|
+
--_split-trailing-icon: 1.375rem;
|
|
79
|
+
--_split-trailing-width: 3rem;
|
|
80
|
+
--_split-label-size: 0.875rem;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([size='large']) .wrapper {
|
|
84
|
+
--_split-height: 6rem;
|
|
85
|
+
--_split-leading-start: 3rem;
|
|
86
|
+
--_split-leading-end: 3rem;
|
|
87
|
+
--_split-content-gap: 0.75rem;
|
|
88
|
+
--_split-leading-icon: 2rem;
|
|
89
|
+
--_split-trailing-icon: 2.375rem;
|
|
90
|
+
--_split-trailing-width: 6rem;
|
|
91
|
+
--_split-label-size: 1.5rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:host([size='xlarge']) .wrapper,
|
|
95
|
+
:host([size='extra']) .wrapper {
|
|
96
|
+
--_split-height: 8.5rem;
|
|
97
|
+
--_split-leading-start: 4rem;
|
|
98
|
+
--_split-leading-end: 4rem;
|
|
99
|
+
--_split-content-gap: 1rem;
|
|
100
|
+
--_split-leading-icon: 2.5rem;
|
|
101
|
+
--_split-trailing-icon: 3.125rem;
|
|
102
|
+
--_split-trailing-width: 8.5rem;
|
|
103
|
+
--_split-label-size: 2rem;
|
|
104
|
+
}
|
|
105
|
+
`]}updated(e){super.updated(e),(e.has(`variant`)||e.has(`size`)||e.has(`gap`))&&this.updateChildren()}handleSlotChange(){this.updateChildren()}getGapValue(e){if(!e)return``;let t=e.toLowerCase();return t===`xs`||t===`xsmall`?`1.125rem`:t===`s`||t===`small`?`0.75rem`:t===`m`||t===`medium`||t===`l`||t===`large`||t===`xl`||t===`xlarge`?`0.5rem`:e}updateChildren(){let e=this.leadingElements.find(e=>e.tagName.toLowerCase()===`moni-button`||e.tagName.toLowerCase()===`moni-icon-button`),t=this.trailingElements.find(e=>e.tagName.toLowerCase()===`moni-button`||e.tagName.toLowerCase()===`moni-icon-button`),n=this.gap.trim().toLowerCase(),r=![`0`,`0px`,`0rem`,`0em`].includes(n);e&&(e.setAttribute(`split-position`,`leading`),e.setAttribute(`shape`,r?`left-round`:`left-round-flat`),e.setAttribute(`size`,this.size),e.setAttribute(`variant`,this.variant)),t&&(t.setAttribute(`split-position`,`trailing`),t.setAttribute(`shape`,r?`right-round`:`right-round-flat`),t.setAttribute(`size`,this.size),t.setAttribute(`variant`,this.variant))}render(){let t=this.getGapValue(this.gap),n=this.gap.trim().toLowerCase(),r=[`0`,`0px`,`0rem`,`0em`].includes(n),i=`${t?`--_split-button-gap: ${t};`:``}${r?`--_split-inner-radius: 0;`:``}`;return e`
|
|
106
|
+
<div class="wrapper" style=${i} part="wrapper">
|
|
107
|
+
<slot name="leading-button" @slotchange=${this.handleSlotChange}></slot>
|
|
108
|
+
<slot name="trailing-button" @slotchange=${this.handleSlotChange}></slot>
|
|
109
|
+
</div>
|
|
110
|
+
`}};o([r({reflect:!0})],c.prototype,`variant`,void 0),o([r({reflect:!0})],c.prototype,`size`,void 0),o([r()],c.prototype,`gap`,void 0),o([s({slot:`leading-button`,flatten:!0})],c.prototype,`leadingElements`,void 0),o([s({slot:`trailing-button`,flatten:!0})],c.prototype,`trailingElements`,void 0),c=o([a(`moni-split-button`)],c);
|