@likable-hair/svelte 0.0.37 → 0.0.40
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/forms/Checkbox.svelte +101 -0
- package/forms/Checkbox.svelte.d.ts +26 -0
- package/forms/Switch.svelte +3 -2
- package/forms/Switch.svelte.d.ts +2 -0
- package/forms/Textfield.svelte +12 -0
- package/forms/Textfield.svelte.d.ts +3 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script >export let value = false, id = undefined, disabled = false, activeColor = "#275efe", activeInnerColor = "#fff", focusShadow = "2px rgba(39, 94, 254, 0.3)", borderColor = "#bbc1e1", borderHoverColor = "#275efe", backgroundColor = "#fff", disabledColor = "#f6f8ff", disabledInnerColor = "#e1e6f9";
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<input
|
|
5
|
+
style:--checkbox-active-color={activeColor}
|
|
6
|
+
style:--checkbox-active-inner-color={activeInnerColor}
|
|
7
|
+
style:--checkbox-focus-shadow={focusShadow}
|
|
8
|
+
style:--checkbox-border-color={borderColor}
|
|
9
|
+
style:--checkbox-border-hover-color={borderHoverColor}
|
|
10
|
+
style:--checkbox-background-color={backgroundColor}
|
|
11
|
+
style:--checkbox-disabled-color={disabledColor}
|
|
12
|
+
style:--checkbox-disabled-inner-color={disabledInnerColor}
|
|
13
|
+
id={id}
|
|
14
|
+
type="checkbox"
|
|
15
|
+
checked={value}
|
|
16
|
+
disabled={disabled}
|
|
17
|
+
>
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
@supports (-webkit-appearance: none) or (-moz-appearance: none) {
|
|
21
|
+
input[type="checkbox"] {
|
|
22
|
+
-webkit-appearance: none;
|
|
23
|
+
-moz-appearance: none;
|
|
24
|
+
height: 21px;
|
|
25
|
+
outline: none;
|
|
26
|
+
display: inline-block;
|
|
27
|
+
vertical-align: top;
|
|
28
|
+
position: relative;
|
|
29
|
+
margin: 0;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
border: 1px solid var(--bc, var(--checkbox-border-color));
|
|
32
|
+
background: var(--b, var(--checkbox-background-color));
|
|
33
|
+
transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
|
|
34
|
+
width: 21px;
|
|
35
|
+
border-radius: 7px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
input[type="checkbox"]:after {
|
|
39
|
+
content: "";
|
|
40
|
+
display: block;
|
|
41
|
+
position: absolute;
|
|
42
|
+
opacity: var(--o, 0);
|
|
43
|
+
transition: transform var(--d-t, 0.3s) var(--d-t-e, ease),
|
|
44
|
+
opacity var(--d-o, 0.2s);
|
|
45
|
+
width: 5px;
|
|
46
|
+
height: 9px;
|
|
47
|
+
border: 2px solid var(--checkbox-active-inner-color);
|
|
48
|
+
border-top: 0;
|
|
49
|
+
border-left: 0;
|
|
50
|
+
left: 7px;
|
|
51
|
+
top: 4px;
|
|
52
|
+
transform: rotate(var(--r, 20deg));
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
input[type="checkbox"]:checked {
|
|
57
|
+
--b: var(--checkbox-active-color);
|
|
58
|
+
--bc: var(--checkbox-active-color);
|
|
59
|
+
--d-o: 0.3s;
|
|
60
|
+
--d-t: 0.6s;
|
|
61
|
+
--d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);
|
|
62
|
+
--o: 1;
|
|
63
|
+
--r: 43deg;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
input[type="checkbox"]:disabled {
|
|
67
|
+
--b: var(--checkbox-disabled-color);
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
opacity: 0.9;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
input[type="checkbox"]:disabled:checked {
|
|
73
|
+
--b: var(--checkbox-disabled-inner-color);
|
|
74
|
+
--bc: var(--checkbox-border-color);
|
|
75
|
+
--r: 43deg;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
input[type="checkbox"]:disabled + label {
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
input[type="checkbox"]:hover:not(:checked):not(:disabled) {
|
|
83
|
+
--bc: var(--checkbox-border-hover-color);
|
|
84
|
+
}
|
|
85
|
+
input[type="checkbox"]:focus {
|
|
86
|
+
box-shadow: 0 0 0 var(--checkbox-focus-shadow);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
input[type="checkbox"]:not(.switch):after {
|
|
90
|
+
width: 5px;
|
|
91
|
+
height: 9px;
|
|
92
|
+
border: 2px solid var(--checkbox-active-inner-color);
|
|
93
|
+
border-top: 0;
|
|
94
|
+
border-left: 0;
|
|
95
|
+
left: 7px;
|
|
96
|
+
top: 4px;
|
|
97
|
+
transform: rotate(var(--r, 20deg));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: boolean;
|
|
5
|
+
id?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
activeColor?: string;
|
|
8
|
+
activeInnerColor?: string;
|
|
9
|
+
focusShadow?: string;
|
|
10
|
+
borderColor?: string;
|
|
11
|
+
borderHoverColor?: string;
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
disabledColor?: string;
|
|
14
|
+
disabledInnerColor?: string;
|
|
15
|
+
};
|
|
16
|
+
events: {
|
|
17
|
+
[evt: string]: CustomEvent<any>;
|
|
18
|
+
};
|
|
19
|
+
slots: {};
|
|
20
|
+
};
|
|
21
|
+
export declare type CheckboxProps = typeof __propDef.props;
|
|
22
|
+
export declare type CheckboxEvents = typeof __propDef.events;
|
|
23
|
+
export declare type CheckboxSlots = typeof __propDef.slots;
|
|
24
|
+
export default class Checkbox extends SvelteComponentTyped<CheckboxProps, CheckboxEvents, CheckboxSlots> {
|
|
25
|
+
}
|
|
26
|
+
export {};
|
package/forms/Switch.svelte
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script >export let value = false, height = "20px", width = "40px", padding = "6px", borderRadius = "10px", toggleActiveColor = "#5c5c5c", toggleDeactiveColor = "#5c5c5c", backgroundActiveColor = "#e6e6e6", backgroundDeactiveColor = "#e6e6e6", animationDuration = "0.1s";
|
|
2
2
|
</script>
|
|
3
3
|
|
|
4
|
-
<
|
|
4
|
+
<div
|
|
5
5
|
style:--switch-toggle-active-color={toggleActiveColor}
|
|
6
6
|
style:--switch-toggle-deactive-color={toggleDeactiveColor}
|
|
7
7
|
style:--switch-animation-duration={animationDuration}
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
<input
|
|
20
20
|
bind:checked={value}
|
|
21
21
|
type="checkbox"
|
|
22
|
+
on:change
|
|
22
23
|
>
|
|
23
24
|
<span
|
|
24
25
|
class="slider"
|
|
25
26
|
></span>
|
|
26
27
|
</div>
|
|
27
|
-
</
|
|
28
|
+
</div>
|
|
28
29
|
|
|
29
30
|
<style>
|
|
30
31
|
.container {
|
package/forms/Switch.svelte.d.ts
CHANGED
package/forms/Textfield.svelte
CHANGED
|
@@ -168,6 +168,9 @@ $: if (!!labelElement) {
|
|
|
168
168
|
on:focus
|
|
169
169
|
on:blur={handleBlur}
|
|
170
170
|
on:blur
|
|
171
|
+
on:keydown
|
|
172
|
+
on:keypress
|
|
173
|
+
on:keyup
|
|
171
174
|
/>
|
|
172
175
|
{:else if type == 'text'}
|
|
173
176
|
<input
|
|
@@ -185,6 +188,9 @@ $: if (!!labelElement) {
|
|
|
185
188
|
on:focus
|
|
186
189
|
on:blur={handleBlur}
|
|
187
190
|
on:blur
|
|
191
|
+
on:keydown
|
|
192
|
+
on:keypress
|
|
193
|
+
on:keyup
|
|
188
194
|
/>
|
|
189
195
|
{/if}
|
|
190
196
|
<div>
|
|
@@ -214,6 +220,9 @@ $: if (!!labelElement) {
|
|
|
214
220
|
on:focus
|
|
215
221
|
on:blur={handleBlur}
|
|
216
222
|
on:blur
|
|
223
|
+
on:keydown
|
|
224
|
+
on:keypress
|
|
225
|
+
on:keyup
|
|
217
226
|
/>
|
|
218
227
|
{:else if type == 'text'}
|
|
219
228
|
<input
|
|
@@ -231,6 +240,9 @@ $: if (!!labelElement) {
|
|
|
231
240
|
on:focus
|
|
232
241
|
on:blur={handleBlur}
|
|
233
242
|
on:blur
|
|
243
|
+
on:keydown
|
|
244
|
+
on:keypress
|
|
245
|
+
on:keyup
|
|
234
246
|
/>
|
|
235
247
|
{/if}
|
|
236
248
|
<div>
|
package/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { default as MediaQuery } from './common/MediaQuery.svelte';
|
|
|
6
6
|
export { default as Dialog } from './dialogs/Dialog.svelte';
|
|
7
7
|
export { default as TextField } from './forms/Textfield.svelte';
|
|
8
8
|
export { default as Switch } from './forms/Switch.svelte';
|
|
9
|
+
export { default as Checkbox } from './forms/Checkbox.svelte';
|
|
9
10
|
export { default as Skeleton } from './loaders/Skeleton.svelte';
|
|
10
11
|
export { default as CircularLoader } from './loaders/CircularLoader.svelte';
|
|
11
12
|
export { default as AttachmentDownloader } from './media/AttachmentDownloader.svelte';
|
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Dialog } from './dialogs/Dialog.svelte';
|
|
|
10
10
|
// forms
|
|
11
11
|
export { default as TextField } from './forms/Textfield.svelte';
|
|
12
12
|
export { default as Switch } from './forms/Switch.svelte';
|
|
13
|
+
export { default as Checkbox } from './forms/Checkbox.svelte';
|
|
13
14
|
// loaders
|
|
14
15
|
export { default as Skeleton } from './loaders/Skeleton.svelte';
|
|
15
16
|
export { default as CircularLoader } from './loaders/CircularLoader.svelte';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@likable-hair/svelte",
|
|
3
3
|
"description": "A Svelte component for likablehair",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.40",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@sveltejs/adapter-auto": "next",
|
|
7
7
|
"@sveltejs/kit": "next",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"./dates/YearSelector.svelte": "./dates/YearSelector.svelte",
|
|
38
38
|
"./dates/utils": "./dates/utils.js",
|
|
39
39
|
"./dialogs/Dialog.svelte": "./dialogs/Dialog.svelte",
|
|
40
|
+
"./forms/Checkbox.svelte": "./forms/Checkbox.svelte",
|
|
40
41
|
"./forms/Switch.svelte": "./forms/Switch.svelte",
|
|
41
42
|
"./forms/Textfield.svelte": "./forms/Textfield.svelte",
|
|
42
43
|
".": "./index.js",
|