@djcali570/component-lib 0.0.2 → 0.0.4
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/dist/DatePicker5.svelte +117 -30
- package/dist/DropDown5.svelte +329 -0
- package/dist/DropDown5.svelte.d.ts +26 -0
- package/dist/Input5.svelte +412 -0
- package/dist/Input5.svelte.d.ts +20 -0
- package/dist/TimePicker5.svelte +687 -0
- package/dist/TimePicker5.svelte.d.ts +14 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import { fly } from 'svelte/transition';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Time Picker 5 v.0.0.1
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
colorScheme = {
|
|
11
|
+
textColor: '#D6D6D6',
|
|
12
|
+
bgColor: '#121212',
|
|
13
|
+
borderColor: '#262626',
|
|
14
|
+
focusedColor: '#4787ac',
|
|
15
|
+
titleColor: '#989A9A',
|
|
16
|
+
clearColor: '#989A9A',
|
|
17
|
+
clearHoverColor: '#1F2023',
|
|
18
|
+
dropdownBgColor: '#141414'
|
|
19
|
+
},
|
|
20
|
+
timeText = '',
|
|
21
|
+
name = 'timePicker',
|
|
22
|
+
title = 'Title',
|
|
23
|
+
placeholder = '',
|
|
24
|
+
disabled = false,
|
|
25
|
+
position = 'left-0',
|
|
26
|
+
radius = 'full',
|
|
27
|
+
onTimePicked = (value) => {}
|
|
28
|
+
}: {
|
|
29
|
+
colorScheme?: any;
|
|
30
|
+
timeText?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
position?: 'left-0' | 'right-0';
|
|
36
|
+
radius?: 'right' | 'left' | 'full';
|
|
37
|
+
onTimePicked?: (value: string) => void;
|
|
38
|
+
} = $props();
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Variables, arrays
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
const hours = [12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
|
|
45
|
+
const minutes = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55];
|
|
46
|
+
|
|
47
|
+
let clockSystem: string = $state('AM');
|
|
48
|
+
let hour: number = $state(12);
|
|
49
|
+
let minute: number = $state(0);
|
|
50
|
+
let hourMenuOpen: boolean = $state(false);
|
|
51
|
+
let minuteMenuOpen: boolean = $state(false);
|
|
52
|
+
|
|
53
|
+
const id = generateRandomString();
|
|
54
|
+
|
|
55
|
+
let showDropdown = $state(false);
|
|
56
|
+
let dropdownRef: HTMLDivElement | null = $state(null);
|
|
57
|
+
let inputRef: HTMLDivElement | null = $state(null);
|
|
58
|
+
|
|
59
|
+
onMount(() => {
|
|
60
|
+
document.addEventListener('click', closeDropdown);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Generate a random string so that each
|
|
65
|
+
* picker will have a unique id in the dom
|
|
66
|
+
*/
|
|
67
|
+
function generateRandomString() {
|
|
68
|
+
const length = 6;
|
|
69
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
70
|
+
|
|
71
|
+
let result = '';
|
|
72
|
+
for (let i = 0; i < length; i++) {
|
|
73
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
|
74
|
+
result += characters.charAt(randomIndex);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function clear() {
|
|
81
|
+
timeText = '';
|
|
82
|
+
hour = 12;
|
|
83
|
+
minute = 0;
|
|
84
|
+
clockSystem = 'AM';
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
$effect(() => {
|
|
88
|
+
if (showDropdown) {
|
|
89
|
+
scrollToDropdown();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
function closeDropdown(event: Event) {
|
|
94
|
+
if (event.target) {
|
|
95
|
+
const e = event.target as HTMLElement;
|
|
96
|
+
|
|
97
|
+
if (
|
|
98
|
+
e.id !== `timer-dropdown-${id}` &&
|
|
99
|
+
!e.closest('#hour-btn') &&
|
|
100
|
+
!e.closest('#min-btn') &&
|
|
101
|
+
!e.closest('#up-btn') &&
|
|
102
|
+
!e.closest('#down-btn') &&
|
|
103
|
+
!e.closest('#clr-btn') &&
|
|
104
|
+
!e.closest('#clock') &&
|
|
105
|
+
!e.closest('[id^="hour-"]') &&
|
|
106
|
+
!e.closest('[id^="minute-"]')
|
|
107
|
+
) {
|
|
108
|
+
showDropdown = false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function toggleDropdown() {
|
|
114
|
+
showDropdown = !showDropdown;
|
|
115
|
+
hourMenuOpen = false;
|
|
116
|
+
minuteMenuOpen = false;
|
|
117
|
+
|
|
118
|
+
if (showDropdown) {
|
|
119
|
+
// If the dropdown is being opened, you may want to perform some additional actions.
|
|
120
|
+
scrollToDropdown();
|
|
121
|
+
} else {
|
|
122
|
+
scrollToInput();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
updatePickerValues();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function scrollToDropdown() {
|
|
129
|
+
if (dropdownRef) {
|
|
130
|
+
// Scroll to the dropdown element.
|
|
131
|
+
dropdownRef.scrollIntoView({
|
|
132
|
+
behavior: 'smooth',
|
|
133
|
+
block: 'center',
|
|
134
|
+
inline: 'nearest'
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function scrollToInput() {
|
|
140
|
+
if (inputRef) {
|
|
141
|
+
inputRef.scrollIntoView({
|
|
142
|
+
behavior: 'smooth',
|
|
143
|
+
block: 'center',
|
|
144
|
+
inline: 'nearest'
|
|
145
|
+
});
|
|
146
|
+
showDropdown = false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function updatePickerValues() {
|
|
151
|
+
if (timeText === '') return;
|
|
152
|
+
|
|
153
|
+
const hourVal = timeText.split(':')[0];
|
|
154
|
+
const minVal = timeText.split(':')[1];
|
|
155
|
+
clockSystem = timeText.split(' ')[1];
|
|
156
|
+
hour = parseInt(hourVal);
|
|
157
|
+
minute = parseInt(minVal);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function hourSelected(hourItem: number) {
|
|
161
|
+
hour = hourItem;
|
|
162
|
+
hourMenuOpen = false;
|
|
163
|
+
updateTime();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function minuteSelected(minuteItem: number): any {
|
|
167
|
+
minute = minuteItem;
|
|
168
|
+
minuteMenuOpen = false;
|
|
169
|
+
updateTime();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function updateTime() {
|
|
173
|
+
const formattedHour = hour < 10 ? `0${hour}` : `${hour}`;
|
|
174
|
+
const formattedMin = minute < 10 ? `0${minute}` : `${minute}`;
|
|
175
|
+
timeText = `${formattedHour}:${formattedMin} ${clockSystem}`;
|
|
176
|
+
onTimePicked(timeText);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function updateClockSystem() {
|
|
180
|
+
if (clockSystem === 'AM') {
|
|
181
|
+
clockSystem = 'PM';
|
|
182
|
+
} else {
|
|
183
|
+
clockSystem = 'AM';
|
|
184
|
+
}
|
|
185
|
+
updateTime();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function increaseMinute() {
|
|
189
|
+
minute += 1;
|
|
190
|
+
updateTime();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function decreaseMinute() {
|
|
194
|
+
if (minute > 0) {
|
|
195
|
+
minute -= 1;
|
|
196
|
+
updateTime();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</script>
|
|
200
|
+
|
|
201
|
+
<div
|
|
202
|
+
class="timer__container"
|
|
203
|
+
style="
|
|
204
|
+
--tp__textColor: {colorScheme.textColor};
|
|
205
|
+
--tp__bgColor: {colorScheme.bgColor};
|
|
206
|
+
--tp__borderColor: {colorScheme.borderColor};
|
|
207
|
+
--tp__focusedColor: {colorScheme.focusedColor};
|
|
208
|
+
--tp__titleColor: {colorScheme.titleColor};
|
|
209
|
+
--tp__clearColor: {colorScheme.clearColor};
|
|
210
|
+
--tp__clearHoverColor: {colorScheme.clearHoverColor};
|
|
211
|
+
--tp__dropdownBgColor: {colorScheme.dropdownBgColor};
|
|
212
|
+
"
|
|
213
|
+
>
|
|
214
|
+
<div
|
|
215
|
+
class="timer__dropdown"
|
|
216
|
+
class:radius--l--only={radius === 'left'}
|
|
217
|
+
class:radius--r--only={radius === 'right'}
|
|
218
|
+
class:radius--full={radius === 'full'}
|
|
219
|
+
bind:this={inputRef}
|
|
220
|
+
>
|
|
221
|
+
<label for="timer-dropdown-{id}"
|
|
222
|
+
><div class="timer__title">
|
|
223
|
+
<div>
|
|
224
|
+
{title}
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
|
|
228
|
+
<div class="timer__input">
|
|
229
|
+
<input
|
|
230
|
+
aria-label="Timer Input"
|
|
231
|
+
id="timer-dropdown-{id}"
|
|
232
|
+
autocomplete="off"
|
|
233
|
+
type="text"
|
|
234
|
+
readonly
|
|
235
|
+
{placeholder}
|
|
236
|
+
{name}
|
|
237
|
+
bind:value={timeText}
|
|
238
|
+
onclick={toggleDropdown}
|
|
239
|
+
/>
|
|
240
|
+
<div class="options__container">
|
|
241
|
+
{#if timeText}
|
|
242
|
+
<div class="clear__container">
|
|
243
|
+
<button aria-label="Time Picker Close Button" type="button" onclick={clear}
|
|
244
|
+
><div class="timer__close__btn">
|
|
245
|
+
<svg
|
|
246
|
+
version="1.1"
|
|
247
|
+
id="Layer_1"
|
|
248
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
249
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
250
|
+
x="0px"
|
|
251
|
+
y="0px"
|
|
252
|
+
viewBox="0 0 100 100"
|
|
253
|
+
style="enable-background:new 0 0 100 100;"
|
|
254
|
+
xml:space="preserve"
|
|
255
|
+
>
|
|
256
|
+
<path
|
|
257
|
+
fill="currentColor"
|
|
258
|
+
d="M87.8,87.4c-0.7,0.7-1.6,1.1-2.6,1.1c-0.9,0-1.8-0.4-2.5-1.1L50,55.1L17.8,87.8c-0.7,0.7-1.6,1.1-2.6,1.1
|
|
259
|
+
c-0.9,0-1.8-0.3-2.5-1.1c-1.4-1.4-1.4-3.7,0-5.1L44.9,50L12.2,17.8c-1.4-1.4-1.4-3.7,0-5.1c1.4-1.4,3.7-1.4,5.1,0L50,44.9l32.3-32.6
|
|
260
|
+
c1.4-1.4,3.7-1.4,5.1,0c1.4,1.4,1.4,3.7,0,5.1L55.1,50l32.6,32.3C89.2,83.7,89.2,86,87.8,87.4z"
|
|
261
|
+
/>
|
|
262
|
+
</svg>
|
|
263
|
+
</div></button
|
|
264
|
+
>
|
|
265
|
+
</div>
|
|
266
|
+
{/if}
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
</label>
|
|
270
|
+
</div>
|
|
271
|
+
{#if showDropdown && !disabled}
|
|
272
|
+
<div
|
|
273
|
+
class="timer__dropdown__menu time__flex__center {position}"
|
|
274
|
+
style="box-shadow: 0px 1px 16px 0px rgba(0,0,0,0.12);"
|
|
275
|
+
bind:this={dropdownRef}
|
|
276
|
+
transition:fly={{
|
|
277
|
+
y: 10
|
|
278
|
+
}}
|
|
279
|
+
>
|
|
280
|
+
<div class="time__flex__center" style="height: 100%; width: 80%; flex-direction:column;">
|
|
281
|
+
{#if !hourMenuOpen && !minuteMenuOpen}
|
|
282
|
+
<div class="time__flex__center" style="height:100%; width:100%;">
|
|
283
|
+
<div class="time__container">
|
|
284
|
+
<!-- Hour Button -->
|
|
285
|
+
<button
|
|
286
|
+
id="hour-btn"
|
|
287
|
+
class="flex__center time__border__hover"
|
|
288
|
+
type="button"
|
|
289
|
+
onclick={() => (hourMenuOpen = true)}
|
|
290
|
+
>
|
|
291
|
+
{#if hour < 10}
|
|
292
|
+
0{hour}
|
|
293
|
+
{:else}
|
|
294
|
+
{hour}
|
|
295
|
+
{/if}
|
|
296
|
+
</button>
|
|
297
|
+
<!-- Colon -->
|
|
298
|
+
<div class="time__flex__center">:</div>
|
|
299
|
+
<!-- Minute Button -->
|
|
300
|
+
<button
|
|
301
|
+
id="min-btn"
|
|
302
|
+
type="button"
|
|
303
|
+
class="time__flex__center time__border__hover"
|
|
304
|
+
onclick={() => (minuteMenuOpen = true)}
|
|
305
|
+
>
|
|
306
|
+
{#if minute < 10}
|
|
307
|
+
0{minute}
|
|
308
|
+
{:else}
|
|
309
|
+
{minute}
|
|
310
|
+
{/if}
|
|
311
|
+
</button>
|
|
312
|
+
<!-- Arrow Buttons -->
|
|
313
|
+
<div class="arrow__btn__container">
|
|
314
|
+
<div class="time__flex__center">
|
|
315
|
+
<button
|
|
316
|
+
aria-label="Time Picker Increase Minute Button"
|
|
317
|
+
id="up-btn"
|
|
318
|
+
type="button"
|
|
319
|
+
class="arrow__btn rounded-t"
|
|
320
|
+
onclick={increaseMinute}
|
|
321
|
+
>
|
|
322
|
+
<svg
|
|
323
|
+
version="1.1"
|
|
324
|
+
id="Layer_1"
|
|
325
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
326
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
327
|
+
x="0px"
|
|
328
|
+
y="0px"
|
|
329
|
+
viewBox="0 0 200 200"
|
|
330
|
+
style="enable-background:new 0 0 200 200;"
|
|
331
|
+
xml:space="preserve"
|
|
332
|
+
>
|
|
333
|
+
<path
|
|
334
|
+
fill="currentColor"
|
|
335
|
+
d="M96.5,63.4c1.9-1.9,5.1-1.9,7.1,0l65.8,65.8c1,1,1.5,2.2,1.5,3.5s-0.5,2.6-1.5,3.5c-1.9,1.9-5.1,1.9-7.1,0l-62.2-62.1
|
|
336
|
+
l-62.5,62.5c-1.9,1.9-5.1,1.9-7.1,0l-0.1-0.1c-0.9-1.1-1.4-2.3-1.4-3.6c0-1.3,0.5-2.6,1.5-3.5L96.5,63.4z"
|
|
337
|
+
/>
|
|
338
|
+
</svg>
|
|
339
|
+
</button>
|
|
340
|
+
</div>
|
|
341
|
+
<div class="time__flex__center">
|
|
342
|
+
<button
|
|
343
|
+
aria-label="Time Picker Decrease Minute Button"
|
|
344
|
+
id="down-btn"
|
|
345
|
+
type="button"
|
|
346
|
+
class="arrow__btn rounded-b"
|
|
347
|
+
onclick={decreaseMinute}
|
|
348
|
+
>
|
|
349
|
+
<svg
|
|
350
|
+
version="1.1"
|
|
351
|
+
id="Layer_1"
|
|
352
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
353
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
354
|
+
x="0px"
|
|
355
|
+
y="0px"
|
|
356
|
+
viewBox="0 0 200 200"
|
|
357
|
+
style="enable-background:new 0 0 200 200;"
|
|
358
|
+
xml:space="preserve"
|
|
359
|
+
>
|
|
360
|
+
<path
|
|
361
|
+
fill="currentColor"
|
|
362
|
+
d="M103.5,136.6c-1.9,1.9-5.1,1.9-7.1,0L30.5,70.8c-1-1-1.5-2.2-1.5-3.5s0.5-2.6,1.5-3.5c1.9-1.9,5.1-1.9,7.1,0l62.2,62.1
|
|
363
|
+
l62.5-62.5c1.9-1.9,5.1-1.9,7.1,0l0.1,0.1c0.9,1.1,1.4,2.3,1.4,3.6s-0.5,2.6-1.5,3.5L103.5,136.6z"
|
|
364
|
+
/>
|
|
365
|
+
</svg>
|
|
366
|
+
</button>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
<!-- AM/PM Button -->
|
|
370
|
+
<button
|
|
371
|
+
id="clock"
|
|
372
|
+
class="time__flex__center time__border__hover"
|
|
373
|
+
type="button"
|
|
374
|
+
onclick={updateClockSystem}>{clockSystem}</button
|
|
375
|
+
>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
{/if}
|
|
379
|
+
{#if hourMenuOpen}
|
|
380
|
+
<!-- Hour Grid -->
|
|
381
|
+
<div class="minute__hour__grid">
|
|
382
|
+
{#each hours as hourItem, index}
|
|
383
|
+
<button
|
|
384
|
+
id="hour-{index}"
|
|
385
|
+
type="button"
|
|
386
|
+
class="time__flex__center"
|
|
387
|
+
onclick={() => hourSelected(hourItem)}
|
|
388
|
+
>
|
|
389
|
+
<div
|
|
390
|
+
class="time__flex__center time__border__hover size-8 rounded-full {hour ===
|
|
391
|
+
hourItem
|
|
392
|
+
? 'bg-white text-black'
|
|
393
|
+
: ''}"
|
|
394
|
+
>
|
|
395
|
+
{#if hourItem < 10}
|
|
396
|
+
0{hourItem}
|
|
397
|
+
{:else}
|
|
398
|
+
{hourItem}
|
|
399
|
+
{/if}
|
|
400
|
+
</div>
|
|
401
|
+
</button>
|
|
402
|
+
{/each}
|
|
403
|
+
</div>
|
|
404
|
+
{/if}
|
|
405
|
+
{#if minuteMenuOpen}
|
|
406
|
+
<!-- Minute Grid -->
|
|
407
|
+
<div class="minute__hour__grid">
|
|
408
|
+
{#each minutes as minuteItem, index}
|
|
409
|
+
<button
|
|
410
|
+
id="minute-{index}"
|
|
411
|
+
type="button"
|
|
412
|
+
class="time__flex__center"
|
|
413
|
+
onclick={() => minuteSelected(minuteItem)}
|
|
414
|
+
>
|
|
415
|
+
<div
|
|
416
|
+
class="time__flex__center time__border__hover size-8 rounded-full {minute ===
|
|
417
|
+
minuteItem
|
|
418
|
+
? 'bg-white text-black'
|
|
419
|
+
: ''}"
|
|
420
|
+
>
|
|
421
|
+
{#if minuteItem < 10}
|
|
422
|
+
0{minuteItem}
|
|
423
|
+
{:else}
|
|
424
|
+
{minuteItem}
|
|
425
|
+
{/if}
|
|
426
|
+
</div>
|
|
427
|
+
</button>
|
|
428
|
+
{/each}
|
|
429
|
+
</div>
|
|
430
|
+
{/if}
|
|
431
|
+
<!-- Clear & Done buttons -->
|
|
432
|
+
{#if !hourMenuOpen && !minuteMenuOpen}
|
|
433
|
+
<div class="action__btn__container">
|
|
434
|
+
<button
|
|
435
|
+
id="clr-btn"
|
|
436
|
+
class="time__border__hover time__border__hover__btn"
|
|
437
|
+
type="button"
|
|
438
|
+
onclick={() => (timeText = '')}>Clear</button
|
|
439
|
+
>
|
|
440
|
+
<button class="time__border__hover time__border__hover__btn" type="button">Done</button>
|
|
441
|
+
</div>
|
|
442
|
+
{/if}
|
|
443
|
+
</div>
|
|
444
|
+
</div>
|
|
445
|
+
{/if}
|
|
446
|
+
</div>
|
|
447
|
+
|
|
448
|
+
<style>
|
|
449
|
+
.time__flex__center {
|
|
450
|
+
display: flex;
|
|
451
|
+
justify-content: center;
|
|
452
|
+
align-items: center;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.time__text__hover:hover {
|
|
456
|
+
color: var(--color-linkupTheme-primary-500);
|
|
457
|
+
transition-property:
|
|
458
|
+
color, background-color, border-color, outline-color, text-decoration-color, fill, stroke,
|
|
459
|
+
--tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
460
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
461
|
+
transition-duration: 300ms;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.time__border__hover {
|
|
465
|
+
background-color: transparent;
|
|
466
|
+
color: var(--tp__textColor);
|
|
467
|
+
border-radius: 0.5rem;
|
|
468
|
+
border: none;
|
|
469
|
+
cursor: pointer;
|
|
470
|
+
font-size: inherit;
|
|
471
|
+
}
|
|
472
|
+
.time__border__hover__btn {
|
|
473
|
+
height: 100%;
|
|
474
|
+
flex: 1;
|
|
475
|
+
}
|
|
476
|
+
.time__border__hover:hover {
|
|
477
|
+
border: 1px solid var(--tp__focusedColor);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.timer__input__close__btn {
|
|
481
|
+
display: none;
|
|
482
|
+
color: var(--air-timepicker-close-color);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.timer__input__close__btn:hover {
|
|
486
|
+
background-color: var(--air-timepicker-close-hover-color);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.timer__container {
|
|
490
|
+
position: relative;
|
|
491
|
+
display: inline-block;
|
|
492
|
+
width: 100%;
|
|
493
|
+
color: var(--tp__textColor);
|
|
494
|
+
font-family: Arial, sans-serif;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.timer__dropdown__menu {
|
|
498
|
+
position: absolute;
|
|
499
|
+
top: 110%;
|
|
500
|
+
display: flex;
|
|
501
|
+
flex-direction: column;
|
|
502
|
+
overflow-y: auto;
|
|
503
|
+
height: 130px;
|
|
504
|
+
width: 100%;
|
|
505
|
+
min-width: 300px;
|
|
506
|
+
background-color: var(--tp__dropdownBgColor);
|
|
507
|
+
border-radius: 0.5rem;
|
|
508
|
+
z-index: 20;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.timer__dropdown {
|
|
512
|
+
background-color: var(--tp__bgColor);
|
|
513
|
+
border: none;
|
|
514
|
+
line-height: 20px;
|
|
515
|
+
font-size: 16px;
|
|
516
|
+
margin: 0;
|
|
517
|
+
box-shadow: inset 0 0 0 1px var(--tp__borderColor);
|
|
518
|
+
width: 100%;
|
|
519
|
+
display: flex;
|
|
520
|
+
position: relative;
|
|
521
|
+
min-height: 64px;
|
|
522
|
+
text-size-adjust: 100%;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
input::placeholder {
|
|
526
|
+
color: var(--air-timepicker-placeholder-color);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.radius--full {
|
|
530
|
+
border-radius: 0.5rem;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.radius--l--only {
|
|
534
|
+
border-top-left-radius: var(--radius-lg);
|
|
535
|
+
border-bottom-left-radius: var(--radius-lg);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.radius--r--only {
|
|
539
|
+
border-top-right-radius: var(--radius-lg);
|
|
540
|
+
border-bottom-right-radius: var(--radius-lg);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
label {
|
|
544
|
+
line-height: 20px;
|
|
545
|
+
color: var(--air-timepicker-main-text-color);
|
|
546
|
+
flex-grow: 1;
|
|
547
|
+
flex-basis: 0%;
|
|
548
|
+
flex-shrink: 1;
|
|
549
|
+
position: relative;
|
|
550
|
+
box-sizing: border-box;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.timer__title {
|
|
554
|
+
font-size: 0.75rem;
|
|
555
|
+
font-family: inherit;
|
|
556
|
+
line-height: 20px;
|
|
557
|
+
color: var(--tp__titleColor);
|
|
558
|
+
padding-inline: 0.75rem;
|
|
559
|
+
padding-top: 0.5rem;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.timer__input {
|
|
563
|
+
display: grid;
|
|
564
|
+
grid-template-columns: 1fr min-content;
|
|
565
|
+
opacity: 1;
|
|
566
|
+
padding-inline: 0.75rem;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
input {
|
|
570
|
+
font-family: inherit;
|
|
571
|
+
height: 24px;
|
|
572
|
+
color: inherit;
|
|
573
|
+
background-color: var(--tp__bgColor);
|
|
574
|
+
border: none;
|
|
575
|
+
width: 100%;
|
|
576
|
+
outline: none;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.timer__dropdown:focus-within {
|
|
580
|
+
box-shadow: inset 0 0 0 2px var(--tp__focusedColor);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
.fca {
|
|
584
|
+
display: flex;
|
|
585
|
+
justify-content: center;
|
|
586
|
+
align-items: center;
|
|
587
|
+
}
|
|
588
|
+
.p3 {
|
|
589
|
+
padding: 0.75rem;
|
|
590
|
+
}
|
|
591
|
+
.rf {
|
|
592
|
+
border-radius: calc(infinity * 1px);
|
|
593
|
+
}
|
|
594
|
+
.options__container {
|
|
595
|
+
display: flex;
|
|
596
|
+
flex-direction: column;
|
|
597
|
+
min-width: 2rem;
|
|
598
|
+
}
|
|
599
|
+
.clear__container {
|
|
600
|
+
display: flex;
|
|
601
|
+
height: 100%;
|
|
602
|
+
width: 100%;
|
|
603
|
+
justify-content: flex-end;
|
|
604
|
+
align-items: flex-start;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.clear__container button {
|
|
608
|
+
display: none;
|
|
609
|
+
height: 24px;
|
|
610
|
+
width: 24px;
|
|
611
|
+
border-radius: calc(infinity * 1px);
|
|
612
|
+
border: none;
|
|
613
|
+
cursor: pointer;
|
|
614
|
+
background-color: transparent;
|
|
615
|
+
}
|
|
616
|
+
.clear__container button:hover {
|
|
617
|
+
background-color: var(--tp__clearHoverColor);
|
|
618
|
+
}
|
|
619
|
+
.timer__close__btn {
|
|
620
|
+
height: 14px;
|
|
621
|
+
width: 14px;
|
|
622
|
+
color: var(--tp__clearColor);
|
|
623
|
+
}
|
|
624
|
+
.timer__dropdown:focus-within .clear__container button {
|
|
625
|
+
display: flex;
|
|
626
|
+
align-items: center;
|
|
627
|
+
justify-content: center;
|
|
628
|
+
}
|
|
629
|
+
.time__container {
|
|
630
|
+
display: grid;
|
|
631
|
+
grid-template-columns: repeat(5, minmax(0, 1fr));
|
|
632
|
+
width: 100%;
|
|
633
|
+
font-size: 1.875rem;
|
|
634
|
+
}
|
|
635
|
+
.arrow__btn__container {
|
|
636
|
+
display: grid;
|
|
637
|
+
grid-template-rows: repeat(2, minmax(0, 1fr));
|
|
638
|
+
}
|
|
639
|
+
.arrow__btn {
|
|
640
|
+
display: flex;
|
|
641
|
+
justify-content: center;
|
|
642
|
+
align-items: center;
|
|
643
|
+
width: 1.8rem;
|
|
644
|
+
height: 1.8rem;
|
|
645
|
+
background-color: transparent;
|
|
646
|
+
border: none;
|
|
647
|
+
color: inherit;
|
|
648
|
+
cursor: pointer;
|
|
649
|
+
font-size: inherit;
|
|
650
|
+
}
|
|
651
|
+
.arrow__btn:hover {
|
|
652
|
+
border: 1px solid var(--tp__focusedColor);
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.rounded-t {
|
|
656
|
+
border-top-left-radius: 0.5rem;
|
|
657
|
+
border-top-right-radius: 0.5rem;
|
|
658
|
+
}
|
|
659
|
+
.rounded-b {
|
|
660
|
+
border-bottom-left-radius: 0.5rem;
|
|
661
|
+
border-bottom-right-radius: 0.5rem;
|
|
662
|
+
}
|
|
663
|
+
.action__btn__container {
|
|
664
|
+
display: flex;
|
|
665
|
+
width: 100%;
|
|
666
|
+
height: 4rem;
|
|
667
|
+
justify-content: space-between;
|
|
668
|
+
margin-bottom: 0.75rem;
|
|
669
|
+
}
|
|
670
|
+
.minute__hour__grid {
|
|
671
|
+
display: grid;
|
|
672
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
673
|
+
grid-template-rows: repeat(3, minmax(0, 1fr));
|
|
674
|
+
width: 100%;
|
|
675
|
+
}
|
|
676
|
+
.minute__hour__grid button {
|
|
677
|
+
height: 2.5rem;
|
|
678
|
+
background-color: transparent;
|
|
679
|
+
border: none;
|
|
680
|
+
font-size: 1.3rem;
|
|
681
|
+
}
|
|
682
|
+
.minute__hour__grid button div {
|
|
683
|
+
border-radius: calc(infinity * 1px);
|
|
684
|
+
width: 32px;
|
|
685
|
+
height: 32px;
|
|
686
|
+
}
|
|
687
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
colorScheme?: any;
|
|
3
|
+
timeText?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
position?: 'left-0' | 'right-0';
|
|
9
|
+
radius?: 'right' | 'left' | 'full';
|
|
10
|
+
onTimePicked?: (value: string) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const TimePicker5: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
|
+
type TimePicker5 = ReturnType<typeof TimePicker5>;
|
|
14
|
+
export default TimePicker5;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
// Reexport your entry components here
|
|
2
2
|
import DatePicker5 from "./DatePicker5.svelte";
|
|
3
|
-
|
|
3
|
+
import DropDown5 from "./DropDown5.svelte";
|
|
4
|
+
import Input5 from "./Input5.svelte";
|
|
5
|
+
import TimePicker5 from "./TimePicker5.svelte";
|
|
6
|
+
export { DatePicker5, Input5, DropDown5, TimePicker5 };
|