iconograph-ui 1.7.17 → 1.7.18
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.
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import Link from "$lib/iconograph-ui/display/Link.svelte";
|
|
15
15
|
import SelectUserInput from "$lib/iconograph-ui/user/SelectUserInput.svelte";
|
|
16
16
|
import MultiSelect from "$lib/iconograph-ui/form/MultiSelect.svelte";
|
|
17
|
+
import Checkbox from "$lib/iconograph-ui/form/Checkbox.svelte";
|
|
17
18
|
|
|
18
19
|
let options = [{ key: "Value" }]
|
|
19
20
|
let inputs = [
|
|
@@ -23,7 +24,8 @@
|
|
|
23
24
|
{ component: Input, props: { type: "email", name: "email", label: "Email"}, value: "test@example.com" },
|
|
24
25
|
{ component: SexeChoiceInput, props: { name: "sexe", label: "Sexe" } },
|
|
25
26
|
{ component: CustomInput, props: { name: "color", label: "Couleur" } },
|
|
26
|
-
{ component: MultiSelect, props: { name: "multiselect", label: "Fruits", options: { APPLE: 'Pomme', BANANA: 'Banane' } }, }
|
|
27
|
+
{ component: MultiSelect, props: { name: "multiselect", label: "Fruits", options: { APPLE: 'Pomme', BANANA: 'Banane' } }, },
|
|
28
|
+
{ component: Checkbox, props: { type: "checkbox", name: "fields[email_auto_sending]", label: "Envoi Automatique de l'email", options: ["Envoi par défaut à 19h le jour de la séance"], stringify: true } },
|
|
27
29
|
];
|
|
28
30
|
|
|
29
31
|
let button = {
|
package/lib/form/Checkbox.svelte
CHANGED
|
@@ -7,32 +7,21 @@
|
|
|
7
7
|
|
|
8
8
|
// label from options[0] or fallback
|
|
9
9
|
$: label = options?.[0] ?? "Checkbox";
|
|
10
|
-
|
|
11
|
-
function toggle() {
|
|
12
|
-
value = !value;
|
|
13
|
-
}
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
|
-
<!-- Hidden real input for forms -->
|
|
17
|
-
<input
|
|
18
|
-
class="hidden-input"
|
|
19
|
-
{name}
|
|
20
|
-
type="checkbox"
|
|
21
|
-
bind:checked={value}
|
|
22
|
-
{required}
|
|
23
|
-
/>
|
|
24
12
|
|
|
25
13
|
<!-- Styled wrapper -->
|
|
26
14
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
27
15
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
28
|
-
<div
|
|
29
|
-
class="
|
|
30
|
-
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
<div class="checkbox-container">
|
|
17
|
+
<div class="onoffswitch">
|
|
18
|
+
|
|
19
|
+
<input type="checkbox" {name} class="onoffswitch-checkbox" id="myonoffswitch" tabindex="0" bind:checked={value} {required}>
|
|
20
|
+
|
|
21
|
+
<label class="onoffswitch-label" for="myonoffswitch">
|
|
22
|
+
<span class="onoffswitch-inner"></span>
|
|
23
|
+
<span class="onoffswitch-switch"></span>
|
|
24
|
+
</label>
|
|
36
25
|
</div>
|
|
37
26
|
|
|
38
27
|
<div class="checkbox-label">
|
|
@@ -40,6 +29,7 @@
|
|
|
40
29
|
</div>
|
|
41
30
|
</div>
|
|
42
31
|
|
|
32
|
+
|
|
43
33
|
<style>
|
|
44
34
|
.hidden-input {
|
|
45
35
|
display: none;
|
|
@@ -49,58 +39,79 @@
|
|
|
49
39
|
display: inline-flex;
|
|
50
40
|
align-items: center;
|
|
51
41
|
gap: 10px;
|
|
52
|
-
|
|
53
|
-
background-color: var(--theme-input-bg-color, #ebebed);
|
|
54
|
-
height: var(--theme-input-height, 40px);
|
|
55
|
-
|
|
56
|
-
border: var(--theme-input-border, none);
|
|
57
|
-
border-radius: 50px;
|
|
58
|
-
|
|
59
|
-
padding: 0px 16px;
|
|
60
|
-
cursor: pointer;
|
|
61
|
-
|
|
62
|
-
transition: all 0.2s;
|
|
63
|
-
font-family: var(--theme-text-font);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* Checkbox square */
|
|
67
|
-
.box {
|
|
68
|
-
width: 18px;
|
|
69
|
-
height: 18px;
|
|
70
|
-
|
|
71
|
-
border-radius: 6px;
|
|
72
|
-
border: 2px solid var(--theme-main-color);
|
|
73
|
-
|
|
74
|
-
display: flex;
|
|
75
|
-
align-items: center;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
|
|
78
|
-
font-size: 13px;
|
|
79
|
-
font-weight: 700;
|
|
80
|
-
|
|
81
|
-
transition: all 0.2s;
|
|
82
|
-
color: white;
|
|
83
42
|
}
|
|
84
43
|
|
|
85
|
-
/* Label text */
|
|
86
44
|
.checkbox-label {
|
|
87
45
|
font-size: 14px;
|
|
88
46
|
line-height: 16px;
|
|
89
|
-
font-weight:
|
|
47
|
+
font-weight: 400;
|
|
90
48
|
color: var(--theme-input-text-font);
|
|
91
49
|
}
|
|
92
50
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
51
|
+
.onoffswitch {
|
|
52
|
+
position: relative;
|
|
53
|
+
width: 50px;
|
|
54
|
+
-webkit-user-select:none;
|
|
55
|
+
-moz-user-select:none;
|
|
56
|
+
-ms-user-select: none;
|
|
96
57
|
}
|
|
97
|
-
|
|
98
|
-
|
|
58
|
+
.onoffswitch-checkbox {
|
|
59
|
+
position: absolute;
|
|
60
|
+
opacity: 0;
|
|
61
|
+
pointer-events: none;
|
|
62
|
+
}
|
|
63
|
+
.onoffswitch-label {
|
|
64
|
+
display: block;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
border: 0px solid #999999;
|
|
68
|
+
border-radius: 20px;
|
|
69
|
+
}
|
|
70
|
+
.onoffswitch-inner {
|
|
71
|
+
display: block;
|
|
72
|
+
width: 200%;
|
|
73
|
+
margin-left: -100%;
|
|
74
|
+
transition: margin 0.3s ease-in 0s;
|
|
75
|
+
}
|
|
76
|
+
.onoffswitch-inner:before, .onoffswitch-inner:after {
|
|
77
|
+
display: block;
|
|
78
|
+
float: left;
|
|
79
|
+
width: 50%;
|
|
80
|
+
height: 28px;
|
|
81
|
+
padding: 0;
|
|
82
|
+
line-height: 28px;
|
|
83
|
+
font-size: 14px;
|
|
99
84
|
color: white;
|
|
85
|
+
font-family: Trebuchet, Arial, sans-serif;
|
|
86
|
+
font-weight: bold;
|
|
87
|
+
box-sizing: border-box;
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
color: var(--theme-main-color);
|
|
89
|
+
.onoffswitch-inner:before {
|
|
90
|
+
content: "";
|
|
91
|
+
padding-left: 10px;
|
|
92
|
+
background-color: var(--theme-main-color);
|
|
93
|
+
color: #FFFFFF;
|
|
94
|
+
}
|
|
95
|
+
.onoffswitch-inner:after {
|
|
96
|
+
content: "";
|
|
97
|
+
padding-right: 10px;
|
|
98
|
+
background-color: var(--theme-input-bg-color, #ebebed);
|
|
99
|
+
color: #999999;
|
|
100
|
+
text-align: right;
|
|
101
|
+
}
|
|
102
|
+
.onoffswitch-switch {
|
|
103
|
+
display: block; width: 18px; margin: 5px;
|
|
104
|
+
background: #FFFFFF;
|
|
105
|
+
position: absolute; top: 0; bottom: 0;
|
|
106
|
+
right: 18px;
|
|
107
|
+
border: 0px solid #999999;
|
|
108
|
+
border-radius: 20px;
|
|
109
|
+
transition: all 0.3s ease-in 0s;
|
|
110
|
+
}
|
|
111
|
+
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner {
|
|
112
|
+
margin-left: 0;
|
|
113
|
+
}
|
|
114
|
+
.onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch {
|
|
115
|
+
right: 0px;
|
|
105
116
|
}
|
|
106
117
|
</style>
|