@djcali570/component-lib 0.1.8 → 0.1.91
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/Checkbox5.svelte +13 -5
- package/dist/Input5.svelte +28 -15
- package/dist/Input5.svelte.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/Checkbox5.svelte
CHANGED
|
@@ -34,10 +34,6 @@
|
|
|
34
34
|
// svelte-ignore state_referenced_locally
|
|
35
35
|
const colorScheme = { ...defaultColorScheme, ...partialColorScheme };
|
|
36
36
|
const id = `checkbox-${Math.random().toString(36).slice(2, 8)}`;
|
|
37
|
-
|
|
38
|
-
$effect(() => {
|
|
39
|
-
onChange(checked);
|
|
40
|
-
});
|
|
41
37
|
</script>
|
|
42
38
|
|
|
43
39
|
<div
|
|
@@ -51,7 +47,19 @@
|
|
|
51
47
|
"
|
|
52
48
|
>
|
|
53
49
|
<label for={id}>
|
|
54
|
-
<input
|
|
50
|
+
<input
|
|
51
|
+
type="checkbox"
|
|
52
|
+
{id}
|
|
53
|
+
{name}
|
|
54
|
+
{checked}
|
|
55
|
+
{disabled}
|
|
56
|
+
onchange={(e) => {
|
|
57
|
+
const value = (e.target as HTMLInputElement).checked;
|
|
58
|
+
checked = value;
|
|
59
|
+
onChange(value);
|
|
60
|
+
}}
|
|
61
|
+
/>
|
|
62
|
+
|
|
55
63
|
<span class="air5__checkbox__custom">
|
|
56
64
|
{#if checked}
|
|
57
65
|
<svg viewBox="0 0 24 24">
|
package/dist/Input5.svelte
CHANGED
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import type { Input5ColorScheme } from './types.js';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Input5 v0.0.2
|
|
7
|
-
*
|
|
8
|
-
* Added color scheme partials
|
|
9
|
-
* Added read only option
|
|
10
|
-
* Allow 4 digits after decimal for floats
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
5
|
let {
|
|
14
6
|
colorScheme: partialColorScheme = {},
|
|
15
7
|
name = 'input',
|
|
@@ -25,6 +17,8 @@
|
|
|
25
17
|
textArea = false,
|
|
26
18
|
textAreaHeight = 80,
|
|
27
19
|
readonly = false,
|
|
20
|
+
placeholder = '',
|
|
21
|
+
hideTitle = false,
|
|
28
22
|
onUpdate = (value) => {}
|
|
29
23
|
}: {
|
|
30
24
|
colorScheme?: Partial<Input5ColorScheme>;
|
|
@@ -41,6 +35,8 @@
|
|
|
41
35
|
textArea?: boolean;
|
|
42
36
|
textAreaHeight?: number;
|
|
43
37
|
readonly?: boolean | null | undefined;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
hideTitle?: boolean;
|
|
44
40
|
onUpdate?: (value: string) => void;
|
|
45
41
|
} = $props();
|
|
46
42
|
|
|
@@ -53,10 +49,12 @@
|
|
|
53
49
|
clearColor: '#989A9A',
|
|
54
50
|
clearHoverColor: '#1F2023',
|
|
55
51
|
counterTextColor: '#5ac1dd',
|
|
56
|
-
counterBgColor: '#1F2023'
|
|
52
|
+
counterBgColor: '#1F2023',
|
|
53
|
+
placeholderColor: '#989A9A'
|
|
57
54
|
};
|
|
58
55
|
|
|
59
56
|
// Merge partial colorScheme with defaults
|
|
57
|
+
// svelte-ignore state_referenced_locally
|
|
60
58
|
const colorScheme = { ...defaultColorScheme, ...partialColorScheme };
|
|
61
59
|
|
|
62
60
|
const id = generateRandomString();
|
|
@@ -161,6 +159,7 @@
|
|
|
161
159
|
* Assign function to validator
|
|
162
160
|
*/
|
|
163
161
|
if (
|
|
162
|
+
// svelte-ignore state_referenced_locally
|
|
164
163
|
validator === 'float' ||
|
|
165
164
|
validator === 'number' ||
|
|
166
165
|
validator === 'phone' ||
|
|
@@ -169,22 +168,23 @@
|
|
|
169
168
|
keydownHandler = mainKeyDownHandler;
|
|
170
169
|
}
|
|
171
170
|
|
|
171
|
+
// svelte-ignore state_referenced_locally
|
|
172
172
|
if (validator === 'float') {
|
|
173
173
|
inputHandler = (e: Event) => mainInputInputHandler(e, floatPattern);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
// svelte-ignore state_referenced_locally
|
|
176
176
|
if (validator === 'number') {
|
|
177
177
|
inputHandler = (e: Event) => mainInputInputHandler(e, numberOnlyPattern);
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
// svelte-ignore state_referenced_locally
|
|
180
180
|
if (validator === 'phone') {
|
|
181
181
|
inputHandler = (e: Event) => mainInputInputHandler(e, phoneNumberPattern);
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
// svelte-ignore state_referenced_locally
|
|
184
184
|
if (validator === 'phone') {
|
|
185
185
|
inputHandler = (e: Event) => mainInputInputHandler(e, phoneNumberPattern);
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
// svelte-ignore state_referenced_locally
|
|
188
188
|
if (validator === 'letter') {
|
|
189
189
|
inputHandler = (e: Event) => mainInputInputHandler(e, letterOnlyPattern);
|
|
190
190
|
}
|
|
@@ -225,11 +225,16 @@
|
|
|
225
225
|
--air5__counterTextColor: {colorScheme.counterTextColor};
|
|
226
226
|
--air5__counterBgColor: {colorScheme.counterBgColor};
|
|
227
227
|
--air5__textAreaHeight: {textAreaHeight}px;
|
|
228
|
+
--air5__placeholderColor: {colorScheme.placeholderColor};
|
|
228
229
|
"
|
|
229
230
|
>
|
|
230
231
|
<label for="input-{id}">
|
|
231
232
|
<div>
|
|
232
|
-
|
|
233
|
+
{#if !hideTitle}
|
|
234
|
+
<div class="air5__title">{title}</div>
|
|
235
|
+
{:else}
|
|
236
|
+
<div class="air5__title"> </div>
|
|
237
|
+
{/if}
|
|
233
238
|
<div class="air5__input">
|
|
234
239
|
{#if textArea}
|
|
235
240
|
<textarea
|
|
@@ -241,6 +246,7 @@
|
|
|
241
246
|
{maxlength}
|
|
242
247
|
{autocomplete}
|
|
243
248
|
{readonly}
|
|
249
|
+
{placeholder}
|
|
244
250
|
></textarea>
|
|
245
251
|
{:else}
|
|
246
252
|
<input
|
|
@@ -253,6 +259,7 @@
|
|
|
253
259
|
{autocomplete}
|
|
254
260
|
{type}
|
|
255
261
|
{readonly}
|
|
262
|
+
{placeholder}
|
|
256
263
|
/>
|
|
257
264
|
{/if}
|
|
258
265
|
<div class="air5__options__container">
|
|
@@ -327,7 +334,7 @@
|
|
|
327
334
|
|
|
328
335
|
.air5__input {
|
|
329
336
|
display: grid;
|
|
330
|
-
grid-template-columns: 1fr min-content;
|
|
337
|
+
grid-template-columns: 1fr min-content;
|
|
331
338
|
padding-inline: 0.75rem;
|
|
332
339
|
color: var(--air5__mainTextColor);
|
|
333
340
|
}
|
|
@@ -415,4 +422,10 @@
|
|
|
415
422
|
color: var(--air5__counterTextColor);
|
|
416
423
|
background-color: var(--air5__counterBgColor);
|
|
417
424
|
}
|
|
425
|
+
|
|
426
|
+
input::placeholder,
|
|
427
|
+
textarea::placeholder {
|
|
428
|
+
color: var(--air5__placeholderColor);
|
|
429
|
+
opacity: 1; /* ensures color is fully visible across browsers */
|
|
430
|
+
}
|
|
418
431
|
</style>
|
package/dist/Input5.svelte.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ type $$ComponentProps = {
|
|
|
14
14
|
textArea?: boolean;
|
|
15
15
|
textAreaHeight?: number;
|
|
16
16
|
readonly?: boolean | null | undefined;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
hideTitle?: boolean;
|
|
17
19
|
onUpdate?: (value: string) => void;
|
|
18
20
|
};
|
|
19
21
|
declare const Input5: import("svelte").Component<$$ComponentProps, {}, "value">;
|
package/dist/index.js
CHANGED
|
@@ -8,5 +8,5 @@ import Chart5 from "./Chart5.svelte";
|
|
|
8
8
|
import AdminPanel5 from "./AdminPanel5.svelte";
|
|
9
9
|
import BottomSheet5 from "./BottomSheet5.svelte";
|
|
10
10
|
import Dialog5 from "./Dialog5.svelte";
|
|
11
|
-
import
|
|
12
|
-
export { DatePicker5, Input5, DropDown5, TimePicker5, Accordion5, Chart5, AdminPanel5, BottomSheet5, Dialog5,
|
|
11
|
+
import Checkbox5 from "./Checkbox5.svelte";
|
|
12
|
+
export { DatePicker5, Input5, DropDown5, TimePicker5, Accordion5, Chart5, AdminPanel5, BottomSheet5, Dialog5, Checkbox5 };
|
package/dist/types.d.ts
CHANGED