@moni-labs/moni-ui 0.4.1 → 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 +28 -3
- package/custom-elements.json +6 -6
- 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 +3 -1
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import{a as e,d as t,i as n,m as r,o as i,r as a,s as o,t as s}from"../chunks/decorate-DxX3e27g.js";import{t as c}from"../chunks/query-SWT-tzvq.js";import"./moni-icon.js";import"./moni-button.js";var l=class extends n{constructor(...e){super(...e),this.value=`00:00`,this.use24Hour=!1,this.mode=`dial`,this.orientation=`auto`,this.hideModeToggle=!1,this.hideHeadline=!1,this.hourLabel=`Hora`,this.minuteLabel=`Minuto`,this.activeSelection=`hour`,this.period=`AM`,this.currentHour=0,this.currentMinute=0,this.isDragging=!1}willUpdate(e){(e.has(`value`)||e.has(`use24Hour`))&&this.parseValue()}parseValue(){let e=this.value.split(`:`),t=parseInt(e[0],10),n=parseInt(e[1],10);(isNaN(t)||t<0||t>23)&&(t=0),(isNaN(n)||n<0||n>59)&&(n=0),this.currentHour=t,this.currentMinute=n,this.use24Hour||(this.period=t>=12?`PM`:`AM`)}updateValue(){let e=this.currentHour,t=this.currentMinute;this.use24Hour||(this.period===`PM`?e<12&&(e+=12):e===12?e=0:e>12&&(e-=12));let n=String(e).padStart(2,`0`),r=String(t).padStart(2,`0`);this.value=`${n}:${r}`,this.dispatchEvent(new CustomEvent(`change`,{detail:{value:this.value},bubbles:!0,composed:!0}))}toggleMode(){this.mode=this.mode===`dial`?`input`:`dial`}setSelection(e){this.activeSelection=e}setPeriod(e){this.period=e,this.updateValue()}handleClockPointerDown(e){this.clockFaceEl&&(this.isDragging=!0,this.clockFaceEl.classList.add(`dragging`),this.clockFaceEl.setPointerCapture(e.pointerId),this.handleClockPointerMove(e))}handleClockPointerMove(e){if(!this.isDragging||!this.clockFaceEl)return;let t=this.clockFaceEl.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i=e.clientX-n,a=e.clientY-r,o=Math.sqrt(i*i+a*a),s=180/Math.PI*Math.atan2(a,i)+90;if(s<0&&(s+=360),this.activeSelection===`hour`){if(this.use24Hour){let e=o<t.width*.32,n=Math.round(s/30)%12;n===0&&(n=12),this.currentHour=e?n:n===12?0:n+12}else{let e=Math.round(s/30)%12;e===0&&(e=12),this.currentHour=e}}else{let e=Math.round(s/6)%60;this.currentMinute=e}this.updateValue()}handleClockPointerUp(){this.isDragging&&(this.isDragging=!1,this.clockFaceEl?.classList.remove(`dragging`),this.activeSelection===`hour`&&setTimeout(()=>{this.activeSelection=`minute`},300))}handleHourInputChange(e){let t=e.target,n=parseInt(t.value,10);isNaN(n)&&(n=0),this.use24Hour?(n<0&&(n=0),n>23&&(n=23),this.currentHour=n):(n<1&&(n=1),n>12&&(n=12),this.currentHour=n),this.updateValue()}handleMinuteInputChange(e){let t=e.target,n=parseInt(t.value,10);isNaN(n)&&(n=0),n<0&&(n=0),n>59&&(n=59),this.currentMinute=n,this.updateValue()}static{this.styles=[a,r`
|
|
2
|
+
:host {
|
|
3
|
+
--_display-size: 6rem;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
background-color: transparent;
|
|
7
|
+
inline-size: min(20.5rem, 100%);
|
|
8
|
+
max-inline-size: 100%;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
container-type: inline-size;
|
|
11
|
+
color: var(--on-surface);
|
|
12
|
+
font-family: var(--font);
|
|
13
|
+
user-select: none;
|
|
14
|
+
}
|
|
15
|
+
:host([use-24-hour]) { --_display-size: 7.125rem; }
|
|
16
|
+
|
|
17
|
+
/* Forced orientations */
|
|
18
|
+
:host([orientation="vertical"]) {
|
|
19
|
+
inline-size: min(20.5rem, 100%);
|
|
20
|
+
}
|
|
21
|
+
:host([orientation="vertical"]) .main-content {
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([orientation="horizontal"]) {
|
|
26
|
+
inline-size: auto;
|
|
27
|
+
}
|
|
28
|
+
:host([orientation="horizontal"]) .main-content {
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 2rem;
|
|
32
|
+
}
|
|
33
|
+
:host([orientation="horizontal"]) .left-pane {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* Main Content (Default vertical) */
|
|
40
|
+
.main-content {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 1rem;
|
|
44
|
+
min-inline-size: 0;
|
|
45
|
+
}
|
|
46
|
+
:host([mode='input']) .main-content {
|
|
47
|
+
margin-block: auto;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
.main-content > * { min-inline-size: 0; }
|
|
52
|
+
.clock-container { flex: none; }
|
|
53
|
+
|
|
54
|
+
/* Auto stays vertical because the component can live inside a narrow
|
|
55
|
+
dialog even when the browser viewport itself is wide. Consumers that
|
|
56
|
+
reserve enough inline space can opt into horizontal explicitly. */
|
|
57
|
+
@media (min-width: 48rem) {
|
|
58
|
+
:host([orientation='auto']),
|
|
59
|
+
:host(:not([orientation])) {
|
|
60
|
+
inline-size: min(40rem, 100%);
|
|
61
|
+
}
|
|
62
|
+
:host([orientation='auto']) .main-content,
|
|
63
|
+
:host(:not([orientation])) .main-content {
|
|
64
|
+
flex-direction: row;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: 2rem;
|
|
67
|
+
}
|
|
68
|
+
:host([orientation='auto']) .left-pane,
|
|
69
|
+
:host(:not([orientation])) .left-pane {
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@keyframes fadeInScale {
|
|
77
|
+
from {
|
|
78
|
+
opacity: 0;
|
|
79
|
+
transform: scale(0.92);
|
|
80
|
+
}
|
|
81
|
+
to {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
transform: scale(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.clock-container,
|
|
88
|
+
.time-display-container,
|
|
89
|
+
.input-labels,
|
|
90
|
+
.display-box {
|
|
91
|
+
animation: fadeInScale var(--speed3) var(--ease-standard) forwards;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.picker-header {
|
|
95
|
+
font-size: 0.75rem;
|
|
96
|
+
font-weight: 500;
|
|
97
|
+
margin-bottom: 1.25rem;
|
|
98
|
+
color: var(--on-surface-variant);
|
|
99
|
+
text-transform: uppercase;
|
|
100
|
+
letter-spacing: 0.1em;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Display Panel (Time box inputs/views) */
|
|
104
|
+
.time-display-container {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
margin-bottom: 1.5rem;
|
|
109
|
+
gap: 0.75rem;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.time-display {
|
|
113
|
+
display: grid;
|
|
114
|
+
grid-template-columns: var(--_display-size) 1.5rem var(--_display-size);
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
flex: none;
|
|
118
|
+
background-color: transparent;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.display-box {
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
width: 100%;
|
|
126
|
+
height: 5rem;
|
|
127
|
+
border-radius: 0.5rem;
|
|
128
|
+
background-color: var(--surface-container-highest);
|
|
129
|
+
font-size: 3.5rem;
|
|
130
|
+
font-weight: 400;
|
|
131
|
+
color: var(--on-surface);
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
transition: background-color var(--speed2);
|
|
134
|
+
border: 0.125rem solid transparent;
|
|
135
|
+
text-align: center;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host([use-24-hour]) .display-box { width: 100%; }
|
|
139
|
+
|
|
140
|
+
.display-box:hover:not(.active) {
|
|
141
|
+
background-color: var(--active);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.display-box.active {
|
|
145
|
+
background-color: var(--primary-container);
|
|
146
|
+
color: var(--on-primary-container);
|
|
147
|
+
border-color: var(--primary);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.display-box input {
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 100%;
|
|
153
|
+
border: none;
|
|
154
|
+
background: transparent;
|
|
155
|
+
text-align: center;
|
|
156
|
+
font-size: inherit;
|
|
157
|
+
font-family: inherit;
|
|
158
|
+
color: inherit;
|
|
159
|
+
outline: none;
|
|
160
|
+
padding: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* Remove input spinners */
|
|
164
|
+
.display-box input::-webkit-outer-spin-button,
|
|
165
|
+
.display-box input::-webkit-inner-spin-button {
|
|
166
|
+
-webkit-appearance: none;
|
|
167
|
+
margin: 0;
|
|
168
|
+
}
|
|
169
|
+
.display-box input[type=number] {
|
|
170
|
+
-moz-appearance: textfield;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.separator {
|
|
174
|
+
font-size: 3rem;
|
|
175
|
+
font-weight: 400;
|
|
176
|
+
color: var(--on-surface);
|
|
177
|
+
width: 1.5rem;
|
|
178
|
+
text-align: center;
|
|
179
|
+
line-height: 5rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* AM/PM Toggle */
|
|
183
|
+
.ampm-toggle {
|
|
184
|
+
display: flex;
|
|
185
|
+
flex-direction: column;
|
|
186
|
+
flex: 0 0 3.25rem;
|
|
187
|
+
border: 0.0625rem solid var(--outline);
|
|
188
|
+
border-radius: 0.5rem;
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
height: 5rem;
|
|
191
|
+
width: 3.25rem;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.ampm-btn {
|
|
195
|
+
flex: 1;
|
|
196
|
+
background-color: transparent;
|
|
197
|
+
border: none;
|
|
198
|
+
font-size: 0.875rem;
|
|
199
|
+
font-weight: 500;
|
|
200
|
+
color: var(--on-surface-variant);
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
transition: background-color var(--speed1), color var(--speed1);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.ampm-btn.active {
|
|
206
|
+
background-color: var(--tertiary-container);
|
|
207
|
+
color: var(--on-tertiary-container);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.ampm-btn:first-child {
|
|
211
|
+
border-bottom: 0.0625rem solid var(--outline);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Clock Face */
|
|
215
|
+
.clock-container {
|
|
216
|
+
display: flex;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
align-items: center;
|
|
219
|
+
margin-block: 0.5rem 1.5rem;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.clock-face {
|
|
223
|
+
position: relative;
|
|
224
|
+
width: 16rem;
|
|
225
|
+
height: 16rem;
|
|
226
|
+
border-radius: 50%;
|
|
227
|
+
background-color: var(--surface-container-highest);
|
|
228
|
+
touch-action: none;
|
|
229
|
+
cursor: pointer;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@container (max-width: 18rem) {
|
|
233
|
+
:host { --_display-size: clamp(4.5rem, 35cqi, 6rem); }
|
|
234
|
+
:host([use-24-hour]) { --_display-size: clamp(4.75rem, 38cqi, 7.125rem); }
|
|
235
|
+
.time-display-container { gap: .375rem; margin-block-end: 1rem; }
|
|
236
|
+
.display-box { block-size: 4rem; font-size: 2.75rem; }
|
|
237
|
+
.separator { inline-size: 1rem; font-size: 2.25rem; line-height: 4rem; }
|
|
238
|
+
.clock-container { margin-block: .25rem 1rem; }
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* Center dot */
|
|
242
|
+
.clock-center {
|
|
243
|
+
position: absolute;
|
|
244
|
+
left: calc(50% - 0.25rem);
|
|
245
|
+
top: calc(50% - 0.25rem);
|
|
246
|
+
width: 0.5rem;
|
|
247
|
+
height: 0.5rem;
|
|
248
|
+
border-radius: 50%;
|
|
249
|
+
background-color: var(--primary);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* Clock hand line */
|
|
253
|
+
.clock-hand {
|
|
254
|
+
position: absolute;
|
|
255
|
+
left: calc(50% - 0.0625rem);
|
|
256
|
+
bottom: 50%;
|
|
257
|
+
width: 0.125rem;
|
|
258
|
+
background-color: var(--primary);
|
|
259
|
+
transform-origin: bottom center;
|
|
260
|
+
z-index: 1;
|
|
261
|
+
pointer-events: none;
|
|
262
|
+
transition: transform var(--speed3) var(--ease-standard), height var(--speed3) var(--ease-standard);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/* Hand tip circle selection inside the hand */
|
|
266
|
+
.clock-hand-selector {
|
|
267
|
+
position: absolute;
|
|
268
|
+
top: 0;
|
|
269
|
+
left: 50%;
|
|
270
|
+
width: 3rem;
|
|
271
|
+
height: 3rem;
|
|
272
|
+
border-radius: 50%;
|
|
273
|
+
background-color: var(--primary);
|
|
274
|
+
opacity: 0.3;
|
|
275
|
+
transform: translate(-50%, -50%) scale(1);
|
|
276
|
+
z-index: 1;
|
|
277
|
+
pointer-events: none;
|
|
278
|
+
transition: transform var(--speed2) var(--ease-standard);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/* Disable transition during active drag but keep scale transform animation */
|
|
282
|
+
.clock-face.dragging .clock-hand,
|
|
283
|
+
.clock-face:active .clock-hand {
|
|
284
|
+
transition: none !important;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* Selector handle expands/grows when pressed or dragging */
|
|
288
|
+
.clock-face.dragging .clock-hand-selector,
|
|
289
|
+
.clock-face:active .clock-hand-selector {
|
|
290
|
+
transform: translate(-50%, -50%) scale(1.2);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.clock-hand-dot {
|
|
294
|
+
position: absolute;
|
|
295
|
+
left: calc(50% - 0.25rem);
|
|
296
|
+
top: -2rem;
|
|
297
|
+
width: 0.5rem;
|
|
298
|
+
height: 0.5rem;
|
|
299
|
+
border-radius: 50%;
|
|
300
|
+
background-color: var(--on-primary);
|
|
301
|
+
z-index: 2;
|
|
302
|
+
pointer-events: none;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@keyframes numberEntrance {
|
|
306
|
+
from {
|
|
307
|
+
opacity: 0;
|
|
308
|
+
transform: translate(-50%, -50%) scale(0.85);
|
|
309
|
+
}
|
|
310
|
+
to {
|
|
311
|
+
opacity: 1;
|
|
312
|
+
transform: translate(-50%, -50%) scale(1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/* Clock dial numbers */
|
|
317
|
+
.clock-number {
|
|
318
|
+
position: absolute;
|
|
319
|
+
width: 2.25rem;
|
|
320
|
+
height: 2.25rem;
|
|
321
|
+
display: flex;
|
|
322
|
+
align-items: center;
|
|
323
|
+
justify-content: center;
|
|
324
|
+
font-size: 0.875rem;
|
|
325
|
+
font-weight: 500;
|
|
326
|
+
color: var(--on-surface);
|
|
327
|
+
border-radius: 50%;
|
|
328
|
+
transform: translate(-50%, -50%);
|
|
329
|
+
transition: background-color var(--speed2), color var(--speed2);
|
|
330
|
+
z-index: 2;
|
|
331
|
+
pointer-events: auto;
|
|
332
|
+
cursor: pointer;
|
|
333
|
+
animation: numberEntrance var(--speed3) var(--ease-standard) forwards;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.clock-number:hover {
|
|
337
|
+
background-color: var(--active);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.clock-number.selected {
|
|
341
|
+
background-color: var(--primary);
|
|
342
|
+
color: var(--on-primary);
|
|
343
|
+
font-weight: bold;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.clock-number.selected:hover {
|
|
347
|
+
background-color: var(--primary);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* Manual Input Mode specific styling */
|
|
351
|
+
.input-labels {
|
|
352
|
+
display: grid;
|
|
353
|
+
grid-template-columns: var(--_display-size) 1.5rem var(--_display-size);
|
|
354
|
+
justify-content: center;
|
|
355
|
+
margin-top: -1rem;
|
|
356
|
+
margin-bottom: 1.5rem;
|
|
357
|
+
color: var(--on-surface-variant);
|
|
358
|
+
font-size: 0.75rem;
|
|
359
|
+
font-weight: 400;
|
|
360
|
+
padding: 0;
|
|
361
|
+
inline-size: 100%;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.input-labels > span {
|
|
365
|
+
text-align: center;
|
|
366
|
+
}
|
|
367
|
+
.input-labels > span:first-child { grid-column: 1; }
|
|
368
|
+
.input-labels > span:last-child { grid-column: 3; }
|
|
369
|
+
:host([mode='input']) .input-labels { margin-block-end: 0; }
|
|
370
|
+
|
|
371
|
+
/* Bottom bar */
|
|
372
|
+
.bottom-actions {
|
|
373
|
+
display: flex;
|
|
374
|
+
justify-content: space-between;
|
|
375
|
+
align-items: center;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.mode-toggle-btn {
|
|
379
|
+
background: none;
|
|
380
|
+
border: none;
|
|
381
|
+
color: var(--primary);
|
|
382
|
+
cursor: pointer;
|
|
383
|
+
padding: 0.5rem;
|
|
384
|
+
display: flex;
|
|
385
|
+
align-items: center;
|
|
386
|
+
justify-content: center;
|
|
387
|
+
border-radius: 50%;
|
|
388
|
+
transition: background-color var(--speed1);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.mode-toggle-btn:hover {
|
|
392
|
+
background-color: var(--active);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.action-buttons {
|
|
396
|
+
display: flex;
|
|
397
|
+
gap: 0.5rem;
|
|
398
|
+
}
|
|
399
|
+
`]}renderDialClockFace(){let e=this.activeSelection===`hour`,n=0,r=`6.25rem`;if(e){let e=this.currentHour;this.use24Hour?e>12||e===0?(n=(e===0?12:e>12?e-12:e)*30,r=`6.5rem`):(n=e*30,r=`4.5rem`):(e>12&&(e-=12),e===0&&(e=12),n=e*30)}else n=this.currentMinute*6;let i=[];if(e){if(this.use24Hour){for(let e=1;e<=12;e++){let t=e===12?0:e+12,n=(e*30-90)*(Math.PI/180),r=128+104*Math.cos(n),a=128+104*Math.sin(n);i.push({val:t,label:String(t===0?`00`:t),x:`${r/16}rem`,y:`${a/16}rem`,selected:this.currentHour===t})}for(let e=1;e<=12;e++){let t=(e*30-90)*(Math.PI/180),n=128+72*Math.cos(t),r=128+72*Math.sin(t);i.push({val:e,label:String(e),x:`${n/16}rem`,y:`${r/16}rem`,selected:this.currentHour===e})}}else for(let e=1;e<=12;e++){let t=(e*30-90)*(Math.PI/180),n=128+100*Math.cos(t),r=128+100*Math.sin(t),a=this.currentHour;a>12&&(a-=12),a===0&&(a=12),i.push({val:e,label:String(e),x:`${n/16}rem`,y:`${r/16}rem`,selected:a===e})}}else for(let e=0;e<12;e++){let t=e*5,n=(e*30-90)*(Math.PI/180),r=128+100*Math.cos(n),a=128+100*Math.sin(n);i.push({val:t,label:String(t).padStart(2,`0`),x:`${r/16}rem`,y:`${a/16}rem`,selected:this.currentMinute===t})}return t`
|
|
400
|
+
<div class="clock-container">
|
|
401
|
+
<div
|
|
402
|
+
class="clock-face"
|
|
403
|
+
@pointerdown=${this.handleClockPointerDown}
|
|
404
|
+
@pointermove=${this.handleClockPointerMove}
|
|
405
|
+
@pointerup=${this.handleClockPointerUp}
|
|
406
|
+
@pointercancel=${this.handleClockPointerUp}
|
|
407
|
+
>
|
|
408
|
+
<div class="clock-center"></div>
|
|
409
|
+
<div
|
|
410
|
+
class="clock-hand"
|
|
411
|
+
style="transform: rotate(${n}deg); height: ${r};"
|
|
412
|
+
>
|
|
413
|
+
<div class="clock-hand-selector"></div>
|
|
414
|
+
${e&&this.use24Hour&&this.currentHour<=12&&this.currentHour>0?t`<div class="clock-hand-dot"></div>`:``}
|
|
415
|
+
</div>
|
|
416
|
+
${i.map(e=>t`
|
|
417
|
+
<div
|
|
418
|
+
class="clock-number ${e.selected?`selected`:``}"
|
|
419
|
+
style="left: ${e.x}; top: ${e.y};"
|
|
420
|
+
>
|
|
421
|
+
${e.label}
|
|
422
|
+
</div>
|
|
423
|
+
`)}
|
|
424
|
+
</div>
|
|
425
|
+
</div>
|
|
426
|
+
`}render(){let e=this.use24Hour?String(this.currentHour).padStart(2,`0`):String(this.currentHour>12?this.currentHour-12:this.currentHour===0?12:this.currentHour).padStart(2,`0`),n=String(this.currentMinute).padStart(2,`0`);return t`
|
|
427
|
+
<div class="main-content">
|
|
428
|
+
<div class="left-pane">
|
|
429
|
+
${this.hideHeadline?``:t`<div class="picker-header">
|
|
430
|
+
${this.mode===`dial`?`Select time`:`Enter time`}
|
|
431
|
+
</div>`}
|
|
432
|
+
|
|
433
|
+
<div class="time-display-container">
|
|
434
|
+
<div class="time-display">
|
|
435
|
+
<div
|
|
436
|
+
class="display-box ${this.activeSelection===`hour`?`active`:``}"
|
|
437
|
+
@click=${()=>this.setSelection(`hour`)}
|
|
438
|
+
>
|
|
439
|
+
${this.mode===`input`?t`<input
|
|
440
|
+
type="number"
|
|
441
|
+
.value=${e}
|
|
442
|
+
@change=${this.handleHourInputChange}
|
|
443
|
+
min=${+!this.use24Hour}
|
|
444
|
+
max=${this.use24Hour?23:12}
|
|
445
|
+
/>`:e}
|
|
446
|
+
</div>
|
|
447
|
+
<div class="separator">:</div>
|
|
448
|
+
<div
|
|
449
|
+
class="display-box ${this.activeSelection===`minute`?`active`:``}"
|
|
450
|
+
@click=${()=>this.setSelection(`minute`)}
|
|
451
|
+
>
|
|
452
|
+
${this.mode===`input`?t`<input
|
|
453
|
+
type="number"
|
|
454
|
+
.value=${n}
|
|
455
|
+
@change=${this.handleMinuteInputChange}
|
|
456
|
+
min="0"
|
|
457
|
+
max="59"
|
|
458
|
+
/>`:n}
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
|
|
462
|
+
${this.use24Hour?``:t`
|
|
463
|
+
<div class="ampm-toggle">
|
|
464
|
+
<button
|
|
465
|
+
class="ampm-btn ${this.period===`AM`?`active`:``}"
|
|
466
|
+
@click=${()=>this.setPeriod(`AM`)}
|
|
467
|
+
>
|
|
468
|
+
AM
|
|
469
|
+
</button>
|
|
470
|
+
<button
|
|
471
|
+
class="ampm-btn ${this.period===`PM`?`active`:``}"
|
|
472
|
+
@click=${()=>this.setPeriod(`PM`)}
|
|
473
|
+
>
|
|
474
|
+
PM
|
|
475
|
+
</button>
|
|
476
|
+
</div>
|
|
477
|
+
`}
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
${this.mode===`input`?t`
|
|
481
|
+
<div class="input-labels">
|
|
482
|
+
<span>${this.hourLabel}</span>
|
|
483
|
+
<span>${this.minuteLabel}</span>
|
|
484
|
+
</div>
|
|
485
|
+
`:``}
|
|
486
|
+
</div>
|
|
487
|
+
|
|
488
|
+
${this.mode===`dial`?this.renderDialClockFace():``}
|
|
489
|
+
</div>
|
|
490
|
+
|
|
491
|
+
${this.hideModeToggle?``:t`<div class="bottom-actions">
|
|
492
|
+
<button class="mode-toggle-btn" @click=${this.toggleMode} aria-label="Toggle input mode">
|
|
493
|
+
<moni-icon name=${this.mode===`dial`?`keyboard`:`schedule`}></moni-icon>
|
|
494
|
+
</button>
|
|
495
|
+
</div>`}
|
|
496
|
+
`}};s([i({reflect:!0})],l.prototype,`value`,void 0),s([i({type:Boolean,reflect:!0,attribute:`use-24-hour`})],l.prototype,`use24Hour`,void 0),s([i({reflect:!0})],l.prototype,`mode`,void 0),s([i({reflect:!0})],l.prototype,`orientation`,void 0),s([i({type:Boolean,reflect:!0,attribute:`hide-mode-toggle`})],l.prototype,`hideModeToggle`,void 0),s([i({type:Boolean,reflect:!0,attribute:`hide-headline`})],l.prototype,`hideHeadline`,void 0),s([i({reflect:!0,attribute:`hour-label`})],l.prototype,`hourLabel`,void 0),s([i({reflect:!0,attribute:`minute-label`})],l.prototype,`minuteLabel`,void 0),s([e()],l.prototype,`activeSelection`,void 0),s([e()],l.prototype,`period`,void 0),s([e()],l.prototype,`currentHour`,void 0),s([e()],l.prototype,`currentMinute`,void 0),s([c(`.clock-face`)],l.prototype,`clockFaceEl`,void 0),l=s([o(`moni-time-picker`)],l);
|
|
@@ -0,0 +1,71 @@
|
|
|
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";var s=class extends t{constructor(...e){super(...e),this.type=`standard`,this.scrolled=!1,this.title=``}static{this.styles=[i,n`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: var(--z-index-toolbar, 1000);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.container {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 1rem;
|
|
12
|
+
block-size: 4rem;
|
|
13
|
+
padding-inline: 0.25rem;
|
|
14
|
+
padding-block: 0.5rem;
|
|
15
|
+
background-color: var(--surface-container);
|
|
16
|
+
color: var(--on-surface);
|
|
17
|
+
font-family: var(--font);
|
|
18
|
+
transition: box-shadow var(--speed2), background-color var(--speed2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([type='standard']) .container {
|
|
22
|
+
box-shadow: var(--shadow1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host([type='floating']) .container {
|
|
26
|
+
margin: 0.25rem;
|
|
27
|
+
border-radius: 0.5rem;
|
|
28
|
+
box-shadow: var(--shadow2);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([type='standard'][scroll]) .container {
|
|
32
|
+
box-shadow: var(--shadow3);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.leading,
|
|
36
|
+
.trailing {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 0.25rem;
|
|
40
|
+
flex: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.title {
|
|
44
|
+
flex: auto;
|
|
45
|
+
font-size: 1.375rem;
|
|
46
|
+
line-height: 1.75rem;
|
|
47
|
+
font-weight: 400;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
text-overflow: ellipsis;
|
|
51
|
+
padding-inline-start: 0.75rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
::slotted([slot='action-button']) {
|
|
55
|
+
position: absolute;
|
|
56
|
+
inset-block-end: -1.75rem;
|
|
57
|
+
inset-inline-end: 1rem;
|
|
58
|
+
z-index: 1;
|
|
59
|
+
}
|
|
60
|
+
`]}render(){return e`
|
|
61
|
+
<header class="container" part="container">
|
|
62
|
+
<span class="leading" part="leading"><slot name="leading"></slot></span>
|
|
63
|
+
<span class="title" part="title">
|
|
64
|
+
${this.title||e`<slot></slot>`}
|
|
65
|
+
</span>
|
|
66
|
+
<span class="trailing" part="trailing">
|
|
67
|
+
<slot name="trailing"></slot>
|
|
68
|
+
</span>
|
|
69
|
+
</header>
|
|
70
|
+
<slot name="action-button"></slot>
|
|
71
|
+
`}};o([r({reflect:!0})],s.prototype,`type`,void 0),o([r({type:Boolean,reflect:!0,attribute:`scroll`})],s.prototype,`scrolled`,void 0),o([r({reflect:!0})],s.prototype,`title`,void 0),s=o([a(`moni-toolbar`)],s);
|