@natachah/vanilla-frontend 0.4.1 → 1.0.0
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/.gitlab-ci.yml +22 -13
- package/LICENSE.md +1 -1
- package/docs/.vitepress/config.mts +101 -0
- package/docs/base/layout.md +77 -0
- package/docs/base/media.md +146 -0
- package/docs/base/reset.md +33 -0
- package/docs/base/typography.md +296 -0
- package/docs/classes/badge.md +146 -0
- package/docs/classes/breadcrumb.md +54 -0
- package/docs/classes/card.md +171 -0
- package/docs/classes/dropdown.md +180 -0
- package/docs/classes/grid.md +230 -0
- package/docs/classes/list.md +90 -0
- package/docs/components/button.md +254 -0
- package/docs/components/dialog.md +223 -0
- package/docs/components/disclosure.md +169 -0
- package/docs/components/form.md +514 -0
- package/docs/components/loading.md +53 -0
- package/docs/components/popover.md +270 -0
- package/docs/components/progress.md +33 -0
- package/docs/components/table.md +175 -0
- package/docs/index.md +27 -0
- package/docs/javascript/autofill.md +155 -0
- package/docs/javascript/check.md +53 -0
- package/docs/javascript/comfort.md +125 -0
- package/docs/javascript/consent.md +89 -0
- package/docs/javascript/cookie.md +33 -0
- package/docs/javascript/drawer.md +99 -0
- package/docs/javascript/form.md +130 -0
- package/docs/javascript/scroll.md +104 -0
- package/docs/javascript/slider.md +130 -0
- package/docs/javascript/sortable.md +127 -0
- package/docs/javascript/tabpanel.md +72 -0
- package/docs/javascript/toggle.md +182 -0
- package/docs/javascript/trap.md +33 -0
- package/docs/javascript/tree.md +220 -0
- package/docs/prologue/conventions.md +92 -0
- package/docs/prologue/release.md +44 -0
- package/docs/prologue/upgrade.md +21 -0
- package/docs/{pages/demo/layout.html → public/demo/demo.html} +1 -2
- package/docs/start/customization.md +184 -0
- package/docs/start/install.md +80 -0
- package/docs/start/mixin.md +203 -0
- package/docs/vuejs/ComponentPreview.vue +99 -0
- package/js/_slider.js +17 -1
- package/js/{vanilla-frontend.js → vanilla-frontend-doc.js} +30 -33
- package/natachah-vanilla-frontend-1.0.0.tgz +0 -0
- package/package.json +11 -14
- package/public/404.html +22 -0
- package/public/assets/app.DsgDPRSA.js +1 -0
- package/public/assets/base_layout.md.CTGv6rTn.js +13 -0
- package/public/assets/base_layout.md.CTGv6rTn.lean.js +1 -0
- package/public/assets/base_media.md.CcuDUcF-.js +24 -0
- package/public/assets/base_media.md.CcuDUcF-.lean.js +1 -0
- package/public/assets/base_reset.md.DqIdqFRJ.js +3 -0
- package/public/assets/base_reset.md.DqIdqFRJ.lean.js +1 -0
- package/public/assets/base_typography.md.DV-ikqGZ.js +87 -0
- package/public/assets/base_typography.md.DV-ikqGZ.lean.js +1 -0
- package/public/assets/chunks/ComponentPreview.BW2s4ay5.js +27 -0
- package/public/assets/chunks/framework.CaiDwmc7.js +4 -0
- package/public/assets/chunks/theme.DL_11MHV.js +1 -0
- package/public/assets/classes_badge.md.BCGzPr6f.js +24 -0
- package/public/assets/classes_badge.md.BCGzPr6f.lean.js +1 -0
- package/public/assets/classes_breadcrumb.md.vU6jlo36.js +15 -0
- package/public/assets/classes_breadcrumb.md.vU6jlo36.lean.js +1 -0
- package/public/assets/classes_card.md.BZEh2l_B.js +41 -0
- package/public/assets/classes_card.md.BZEh2l_B.lean.js +1 -0
- package/public/assets/classes_dropdown.md.BLVw_xQY.js +70 -0
- package/public/assets/classes_dropdown.md.BLVw_xQY.lean.js +1 -0
- package/public/assets/classes_grid.md.47v-Ybqe.js +45 -0
- package/public/assets/classes_grid.md.47v-Ybqe.lean.js +1 -0
- package/public/assets/classes_list.md.BW9PWZV1.js +36 -0
- package/public/assets/classes_list.md.BW9PWZV1.lean.js +1 -0
- package/public/assets/components_button.md.vx3HzdpN.js +45 -0
- package/public/assets/components_button.md.vx3HzdpN.lean.js +1 -0
- package/public/assets/components_dialog.md.C-0gJGus.js +76 -0
- package/public/assets/components_dialog.md.C-0gJGus.lean.js +1 -0
- package/public/assets/components_disclosure.md.DeSRu9_P.js +53 -0
- package/public/assets/components_disclosure.md.DeSRu9_P.lean.js +1 -0
- package/public/assets/components_form.md.Be8d5WFv.js +122 -0
- package/public/assets/components_form.md.Be8d5WFv.lean.js +1 -0
- package/public/assets/components_loading.md.CKDG7z5x.js +4 -0
- package/public/assets/components_loading.md.CKDG7z5x.lean.js +1 -0
- package/public/assets/components_popover.md.CwgNttNc.js +102 -0
- package/public/assets/components_popover.md.CwgNttNc.lean.js +1 -0
- package/public/assets/components_progress.md.CNC7rJiC.js +6 -0
- package/public/assets/components_progress.md.CNC7rJiC.lean.js +1 -0
- package/public/assets/components_table.md.LyBkIDkF.js +75 -0
- package/public/assets/components_table.md.LyBkIDkF.lean.js +1 -0
- package/public/assets/index.md.CJiHmjB7.js +1 -0
- package/public/assets/index.md.CJiHmjB7.lean.js +1 -0
- package/public/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/public/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/public/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/public/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/public/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/public/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/public/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/public/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/public/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/public/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/public/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/public/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/public/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/public/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/public/assets/javascript_autofill.md.BewVUo4H.js +49 -0
- package/public/assets/javascript_autofill.md.BewVUo4H.lean.js +1 -0
- package/public/assets/javascript_check.md.B6ajE66i.js +13 -0
- package/public/assets/javascript_check.md.B6ajE66i.lean.js +1 -0
- package/public/assets/javascript_comfort.md.BRci3j7V.js +20 -0
- package/public/assets/javascript_comfort.md.BRci3j7V.lean.js +1 -0
- package/public/assets/javascript_consent.md.Bjv8ZDS6.js +29 -0
- package/public/assets/javascript_consent.md.Bjv8ZDS6.lean.js +1 -0
- package/public/assets/javascript_cookie.md.Dlhyk4Ha.js +2 -0
- package/public/assets/javascript_cookie.md.Dlhyk4Ha.lean.js +1 -0
- package/public/assets/javascript_drawer.md.BCJX3fL-.js +32 -0
- package/public/assets/javascript_drawer.md.BCJX3fL-.lean.js +1 -0
- package/public/assets/javascript_form.md.Cwf_gxLI.js +40 -0
- package/public/assets/javascript_form.md.Cwf_gxLI.lean.js +2 -0
- package/public/assets/javascript_scroll.md.BrJijWbF.js +30 -0
- package/public/assets/javascript_scroll.md.BrJijWbF.lean.js +1 -0
- package/public/assets/javascript_slider.md.DDO8wC4u.js +27 -0
- package/public/assets/javascript_slider.md.DDO8wC4u.lean.js +1 -0
- package/public/assets/javascript_sortable.md.BKyem7yw.js +35 -0
- package/public/assets/javascript_sortable.md.BKyem7yw.lean.js +1 -0
- package/public/assets/javascript_tabpanel.md.D9M-_xE0.js +19 -0
- package/public/assets/javascript_tabpanel.md.D9M-_xE0.lean.js +1 -0
- package/public/assets/javascript_toggle.md.C8582WNC.js +46 -0
- package/public/assets/javascript_toggle.md.C8582WNC.lean.js +1 -0
- package/public/assets/javascript_trap.md.Bc59YUng.js +2 -0
- package/public/assets/javascript_trap.md.Bc59YUng.lean.js +1 -0
- package/public/assets/javascript_tree.md.uc1UUsFV.js +72 -0
- package/public/assets/javascript_tree.md.uc1UUsFV.lean.js +1 -0
- package/public/assets/prologue_conventions.md.D8nVwlRS.js +34 -0
- package/public/assets/prologue_conventions.md.D8nVwlRS.lean.js +1 -0
- package/public/assets/prologue_release.md.CG6nuFnt.js +1 -0
- package/public/assets/prologue_release.md.CG6nuFnt.lean.js +1 -0
- package/public/assets/prologue_upgrade.md.CFxokaBG.js +1 -0
- package/public/assets/prologue_upgrade.md.CFxokaBG.lean.js +1 -0
- package/public/assets/start_customization.md.t-ze_NoQ.js +141 -0
- package/public/assets/start_customization.md.t-ze_NoQ.lean.js +1 -0
- package/public/assets/start_install.md.OluH7l11.js +46 -0
- package/public/assets/start_install.md.OluH7l11.lean.js +1 -0
- package/public/assets/start_mixin.md.D76cLRSX.js +85 -0
- package/public/assets/start_mixin.md.D76cLRSX.lean.js +1 -0
- package/public/assets/style.zIeGMibA.css +1 -0
- package/public/base/layout.html +37 -0
- package/public/base/media.html +179 -0
- package/public/base/reset.html +27 -0
- package/public/base/typography.html +320 -0
- package/public/bundles/vanilla-frontend-doc.css +1 -0
- package/public/bundles/vanilla-frontend-doc.js +1 -0
- package/public/bundles/vanilla-frontend.css +1 -0
- package/public/classes/badge.html +205 -0
- package/public/classes/breadcrumb.html +66 -0
- package/public/classes/card.html +222 -0
- package/public/classes/dropdown.html +147 -0
- package/public/classes/grid.html +278 -0
- package/public/classes/list.html +113 -0
- package/public/components/button.html +304 -0
- package/public/components/dialog.html +205 -0
- package/public/components/disclosure.html +130 -0
- package/public/components/form.html +589 -0
- package/public/components/loading.html +107 -0
- package/public/components/popover.html +257 -0
- package/public/components/progress.html +57 -0
- package/public/components/table.html +152 -0
- package/public/demo/demo.html +84 -0
- package/public/hashmap.json +1 -0
- package/public/index.html +25 -0
- package/public/javascript/autofill.html +152 -0
- package/public/javascript/check.html +64 -0
- package/public/javascript/comfort.html +123 -0
- package/public/javascript/consent.html +80 -0
- package/public/javascript/cookie.html +26 -0
- package/public/javascript/drawer.html +83 -0
- package/public/javascript/form.html +117 -0
- package/public/javascript/scroll.html +81 -0
- package/public/javascript/slider.html +78 -0
- package/public/javascript/sortable.html +112 -0
- package/public/javascript/tabpanel.html +70 -0
- package/public/javascript/toggle.html +201 -0
- package/public/javascript/trap.html +26 -0
- package/public/javascript/tree.html +175 -0
- package/public/prologue/conventions.html +58 -0
- package/public/prologue/release.html +25 -0
- package/public/prologue/upgrade.html +25 -0
- package/public/start/customization.html +165 -0
- package/public/start/install.html +70 -0
- package/public/start/mixin.html +109 -0
- package/public/vp-icons.css +0 -0
- package/sandbox/index.html +27 -0
- package/sandbox/js/sandbox-header.js +57 -0
- package/sandbox/js/sandbox-test.js +91 -0
- package/sandbox/pages/base/layout.html +80 -0
- package/sandbox/pages/base/media.html +52 -0
- package/sandbox/pages/base/typography.html +132 -0
- package/sandbox/pages/components/button.html +70 -0
- package/sandbox/pages/components/dialog.html +72 -0
- package/sandbox/pages/components/disclosure.html +77 -0
- package/sandbox/pages/components/form.html +164 -0
- package/sandbox/pages/components/loading.html +32 -0
- package/sandbox/pages/components/popover.html +119 -0
- package/sandbox/pages/components/progress.html +28 -0
- package/sandbox/pages/components/table.html +80 -0
- package/sandbox/pages/customs/badge.html +59 -0
- package/sandbox/pages/customs/breadcrumb.html +34 -0
- package/sandbox/pages/customs/card.html +71 -0
- package/sandbox/pages/customs/dropdown.html +70 -0
- package/sandbox/pages/customs/grid.html +109 -0
- package/sandbox/pages/customs/list.html +43 -0
- package/sandbox/pages/javascript/autofill.html +39 -0
- package/sandbox/pages/javascript/checkall.html +37 -0
- package/sandbox/pages/javascript/comfort.html +41 -0
- package/sandbox/pages/javascript/consent.html +45 -0
- package/sandbox/pages/javascript/form.html +50 -0
- package/sandbox/pages/javascript/scroll.html +44 -0
- package/sandbox/pages/javascript/slider.html +44 -0
- package/sandbox/pages/javascript/sortable.html +56 -0
- package/sandbox/pages/javascript/tabpanel.html +39 -0
- package/sandbox/pages/javascript/toggle.html +72 -0
- package/sandbox/pages/javascript/tree.html +96 -0
- package/sandbox/sandbox.js +26 -0
- package/sandbox/scss/sandbox-header.scss +93 -0
- package/scss/components/_badge.scss +2 -1
- package/scss/components/_dropdown.scss +2 -2
- package/scss/components/_group.scss +8 -4
- package/scss/components/_popover.scss +74 -0
- package/scss/components/index.scss +1 -0
- package/scss/vanilla-frontend-doc.scss +46 -1
- package/scss/vanilla-frontend-sandbox.scss +34 -0
- package/vite.config.js +30 -0
- package/docs/index.html +0 -36
- package/docs/main-demo.js +0 -2
- package/docs/main.js +0 -34
- package/docs/pages/base/layout.html +0 -131
- package/docs/pages/base/media.html +0 -142
- package/docs/pages/base/reset.html +0 -53
- package/docs/pages/base/typography.html +0 -334
- package/docs/pages/components/button.html +0 -202
- package/docs/pages/components/dialog.html +0 -336
- package/docs/pages/components/disclosure.html +0 -174
- package/docs/pages/components/form.html +0 -427
- package/docs/pages/components/loading.html +0 -58
- package/docs/pages/components/progress.html +0 -47
- package/docs/pages/components/table.html +0 -168
- package/docs/pages/customs/badge.html +0 -150
- package/docs/pages/customs/breadcrumb.html +0 -67
- package/docs/pages/customs/card.html +0 -185
- package/docs/pages/customs/drawer.html +0 -149
- package/docs/pages/customs/dropdown.html +0 -270
- package/docs/pages/customs/grid.html +0 -185
- package/docs/pages/customs/list.html +0 -112
- package/docs/pages/customs/slider.html +0 -273
- package/docs/pages/javascript/autofill.html +0 -170
- package/docs/pages/javascript/checkall.html +0 -59
- package/docs/pages/javascript/comfort.html +0 -146
- package/docs/pages/javascript/consent.html +0 -112
- package/docs/pages/javascript/cookie.html +0 -81
- package/docs/pages/javascript/form.html +0 -199
- package/docs/pages/javascript/scroll.html +0 -209
- package/docs/pages/javascript/sortable.html +0 -167
- package/docs/pages/javascript/tabpanel.html +0 -89
- package/docs/pages/javascript/toggle.html +0 -193
- package/docs/pages/javascript/trap.html +0 -89
- package/docs/pages/javascript/tree.html +0 -256
- package/docs/pages/quick-start/conventions.html +0 -112
- package/docs/pages/quick-start/customization.html +0 -187
- package/docs/pages/quick-start/installation.html +0 -97
- package/docs/pages/quick-start/mixins.html +0 -214
- package/docs/src/js/demo.js +0 -110
- package/docs/src/js/doc-code.js +0 -102
- package/docs/src/js/doc-demo.js +0 -14
- package/docs/src/js/doc-layout.js +0 -117
- package/docs/src/scss/demo.scss +0 -77
- package/docs/src/scss/layout.scss +0 -83
- package/docs/src/scss/style.scss +0 -278
- package/docs/vite.config.mjs +0 -23
- package/esbuild.mjs +0 -25
- package/natachah-vanilla-frontend-0.4.1.tgz +0 -0
- package/vitest.config.js +0 -8
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ComponentPreview from '../vuejs/ComponentPreview.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
# Form
|
|
6
|
+
|
|
7
|
+
All form elements are fully responsive with pure semantic HTML, enabling forms to scale gracefully across devices and viewports.
|
|
8
|
+
|
|
9
|
+
```scss
|
|
10
|
+
@use '@natachah/vanilla-frontend/scss/components/form'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Syntax
|
|
14
|
+
|
|
15
|
+
The form is using the native `<label>`, `<input>` and co. tags.
|
|
16
|
+
|
|
17
|
+
<ComponentPreview>
|
|
18
|
+
<label for="demoInput">Input</label>
|
|
19
|
+
<input type="text" id="demoInput" name="input" placeholder="My input" aria-describedby="demoInputDescription">
|
|
20
|
+
<small id="demoInputDescription">
|
|
21
|
+
Must be at least 8 characters.
|
|
22
|
+
</small>
|
|
23
|
+
</ComponentPreview>
|
|
24
|
+
|
|
25
|
+
::: code-group
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<label for="demoInput">Input</label>
|
|
29
|
+
<input type="text" id="demoInput" name="input" placeholder="My input" aria-describedby="demoInputDescription">
|
|
30
|
+
<small id="demoInputDescription">
|
|
31
|
+
Must be at least 8 characters.
|
|
32
|
+
</small>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```css [css properties]
|
|
36
|
+
--form-color
|
|
37
|
+
--form-background
|
|
38
|
+
--form-border-size
|
|
39
|
+
--form-border-style
|
|
40
|
+
--form-border-color
|
|
41
|
+
--form-border-radius
|
|
42
|
+
--form-padding-inline
|
|
43
|
+
--form-padding-block
|
|
44
|
+
--form-transition
|
|
45
|
+
--form-decoration
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
:::
|
|
51
|
+
|
|
52
|
+
### Inputs
|
|
53
|
+
|
|
54
|
+
<ComponentPreview>
|
|
55
|
+
<input type="text" name="text" placeholder="Some text">
|
|
56
|
+
<input type="search" name="search" placeholder="Enter some keyword">
|
|
57
|
+
<input type="email" name="email" placeholder="info@something.com">
|
|
58
|
+
<input type="url" name="url" placeholder="http://www.google.com">
|
|
59
|
+
<input type="tel" name="tel" placeholder="021 922 00 00">
|
|
60
|
+
<input type="number" name="number" placeholder="42">
|
|
61
|
+
<input type="password" name="password" placeholder="123456">
|
|
62
|
+
</ComponentPreview>
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<input type="text" name="text" placeholder="Some text">
|
|
66
|
+
<input type="search" name="search" placeholder="Enter some keyword">
|
|
67
|
+
<input type="email" name="email" placeholder="info@something.com">
|
|
68
|
+
<input type="url" name="url" placeholder="http://www.google.com">
|
|
69
|
+
<input type="tel" name="tel" placeholder="021 922 00 00">
|
|
70
|
+
<input type="number" name="number" placeholder="42">
|
|
71
|
+
<input type="password" name="password" placeholder="123456">
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The type **file** come with a default icon and no button.
|
|
75
|
+
|
|
76
|
+
<ComponentPreview>
|
|
77
|
+
<input type="file" name="file" accept="image/png, image/jpeg">
|
|
78
|
+
</ComponentPreview>
|
|
79
|
+
|
|
80
|
+
::: code-group
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<input type="file" name="file" accept="image/png, image/jpeg">
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```css [css property]
|
|
87
|
+
--icon-file
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
:::
|
|
91
|
+
|
|
92
|
+
The type **date**, **time** and **datetime-local** come with default icon.
|
|
93
|
+
|
|
94
|
+
<ComponentPreview>
|
|
95
|
+
<input type="date" name="date">
|
|
96
|
+
<input type="time" name="time">
|
|
97
|
+
<input type="datetime-local" name="datetime">
|
|
98
|
+
</ComponentPreview>
|
|
99
|
+
|
|
100
|
+
::: code-group
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<input type="date" name="date">
|
|
104
|
+
<input type="time" name="time">
|
|
105
|
+
<input type="datetime-local" name="datetime">
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```css [css properties]
|
|
109
|
+
--icon-date
|
|
110
|
+
--icon-time
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
:::
|
|
114
|
+
|
|
115
|
+
The type **color** is also consistent with the other input types.
|
|
116
|
+
|
|
117
|
+
<ComponentPreview>
|
|
118
|
+
<input type="color" name="color">
|
|
119
|
+
</ComponentPreview>
|
|
120
|
+
|
|
121
|
+
```html
|
|
122
|
+
<input type="color" name="color">
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The **range** field look more like a progress bar.
|
|
126
|
+
|
|
127
|
+
<ComponentPreview>
|
|
128
|
+
<input type="range" name="range" min="0" max="10">
|
|
129
|
+
</ComponentPreview>
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<input type="range" name="range" min="0" max="10">
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Textarea
|
|
136
|
+
|
|
137
|
+
The native `<textarea>` is styled like the input for consistency.
|
|
138
|
+
|
|
139
|
+
By default you only can resize the height.
|
|
140
|
+
|
|
141
|
+
<ComponentPreview>
|
|
142
|
+
<textarea name="textarea" rows="5" cols="33">It was a dark and stormy night...</textarea>
|
|
143
|
+
</ComponentPreview>
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<textarea name="textarea" rows="5" cols="33">It was a dark and stormy night...</textarea>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Select
|
|
150
|
+
|
|
151
|
+
The native `<select>` is styled like the input for consistency.
|
|
152
|
+
|
|
153
|
+
<ComponentPreview>
|
|
154
|
+
<select name="select">
|
|
155
|
+
<option value="1">One</option>
|
|
156
|
+
<option value="2">Two</option>
|
|
157
|
+
<option value="3">Three</option>
|
|
158
|
+
<option value="4">Four</option>
|
|
159
|
+
</select>
|
|
160
|
+
</ComponentPreview>
|
|
161
|
+
|
|
162
|
+
::: code-group
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<select name="select">
|
|
166
|
+
<option value="1">One</option>
|
|
167
|
+
<option value="2">Two</option>
|
|
168
|
+
<option value="3">Three</option>
|
|
169
|
+
<option value="4">Four</option>
|
|
170
|
+
</select>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```css [css property]
|
|
174
|
+
--icon-select
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
:::
|
|
178
|
+
|
|
179
|
+
### Radio
|
|
180
|
+
|
|
181
|
+
The radio field must be inside a `<fieldset>`.
|
|
182
|
+
|
|
183
|
+
<ComponentPreview>
|
|
184
|
+
<fieldset>
|
|
185
|
+
<legend>Radio</legend>
|
|
186
|
+
<input type="radio" id="radioA" name="radio" checked> <label for="radioA">Option A</label>
|
|
187
|
+
<input type="radio" id="radioB" name="radio"> <label for="radioB">Option B</label>
|
|
188
|
+
<input type="radio" id="radioC" name="radio"> <label for="radioC">Option C</label>
|
|
189
|
+
</fieldset>
|
|
190
|
+
</ComponentPreview>
|
|
191
|
+
|
|
192
|
+
::: code-group
|
|
193
|
+
|
|
194
|
+
```html
|
|
195
|
+
<fieldset>
|
|
196
|
+
<legend>Radio</legend>
|
|
197
|
+
<input type="radio" id="radioA" name="radio" checked> <label for="radioA">Option A</label>
|
|
198
|
+
<input type="radio" id="radioB" name="radio"> <label for="radioB">Option B</label>
|
|
199
|
+
<input type="radio" id="radioC" name="radio"> <label for="radioC">Option C</label>
|
|
200
|
+
</fieldset>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```css [css property]
|
|
204
|
+
--icon-radio
|
|
205
|
+
--form-active-background
|
|
206
|
+
--form-active-border-color
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
:::
|
|
210
|
+
|
|
211
|
+
To display the element into the vertical, surround the `<input>` and the `<label>` by a `<div>` tag.
|
|
212
|
+
|
|
213
|
+
<ComponentPreview>
|
|
214
|
+
<fieldset>
|
|
215
|
+
<legend>Radio</legend>
|
|
216
|
+
<div>
|
|
217
|
+
<input type="radio" id="radioD" name="radio" checked> <label for="radioD">Option D</label>
|
|
218
|
+
</div>
|
|
219
|
+
<div>
|
|
220
|
+
<input type="radio" id="radioE" name="radio"> <label for="radioE">Option E</label>
|
|
221
|
+
</div>
|
|
222
|
+
<div>
|
|
223
|
+
<input type="radio" id="radioF" name="radio"> <label for="radioF">Option F</label>
|
|
224
|
+
</div>
|
|
225
|
+
</fieldset>
|
|
226
|
+
</ComponentPreview>
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
```html
|
|
230
|
+
<fieldset>
|
|
231
|
+
<legend>Radio</legend>
|
|
232
|
+
<div>
|
|
233
|
+
<input type="radio" id="radioD" name="radio" checked> <label for="radioD">Option D</label>
|
|
234
|
+
</div>
|
|
235
|
+
<div>
|
|
236
|
+
<input type="radio" id="radioE" name="radio"> <label for="radioE">Option E</label>
|
|
237
|
+
</div>
|
|
238
|
+
<div>
|
|
239
|
+
<input type="radio" id="radioF" name="radio"> <label for="radioF">Option F</label>
|
|
240
|
+
</div>
|
|
241
|
+
</fieldset>
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Checkbox
|
|
245
|
+
|
|
246
|
+
The checkbox field must be inside a `<fieldset>`.
|
|
247
|
+
|
|
248
|
+
<ComponentPreview>
|
|
249
|
+
<fieldset>
|
|
250
|
+
<legend>Checkbox</legend>
|
|
251
|
+
<input type="checkbox" id="checkboxA" name="checkboxA" checked> <label for="checkboxA">Option A</label>
|
|
252
|
+
<input type="checkbox" id="checkboxB" name="checkboxB"> <label for="checkboxB">Option B</label>
|
|
253
|
+
<input type="checkbox" id="checkboxC" name="checkboxC"> <label for="checkboxC">Option C</label>
|
|
254
|
+
</fieldset>
|
|
255
|
+
</ComponentPreview>
|
|
256
|
+
|
|
257
|
+
::: code-group
|
|
258
|
+
|
|
259
|
+
```html
|
|
260
|
+
<fieldset>
|
|
261
|
+
<legend>Checkbox</legend>
|
|
262
|
+
<input type="checkbox" id="checkboxA" name="checkboxA" checked> <label for="checkboxA">Option A</label>
|
|
263
|
+
<input type="checkbox" id="checkboxB" name="checkboxB"> <label for="checkboxB">Option B</label>
|
|
264
|
+
<input type="checkbox" id="checkboxC" name="checkboxC"> <label for="checkboxC">Option C</label>
|
|
265
|
+
</fieldset>
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```css [css property]
|
|
269
|
+
--icon-check
|
|
270
|
+
--form-active-background
|
|
271
|
+
--form-active-border-color
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
:::
|
|
275
|
+
|
|
276
|
+
To display the element into the vertical, surround the `<input>` and the `<label>` by a `<div>` tag.
|
|
277
|
+
|
|
278
|
+
<ComponentPreview>
|
|
279
|
+
<fieldset>
|
|
280
|
+
<legend>Radio</legend>
|
|
281
|
+
<div>
|
|
282
|
+
<input type="checkbox" id="checkboxD" name="checkbox" checked> <label for="checkboxD">Option D</label>
|
|
283
|
+
</div>
|
|
284
|
+
<div>
|
|
285
|
+
<input type="checkbox" id="checkboxE" name="checkbox"> <label for="checkboxE">Option E</label>
|
|
286
|
+
</div>
|
|
287
|
+
<div>
|
|
288
|
+
<input type="checkbox" id="checkboxF" name="checkbox"> <label for="checkboxF">Option F</label>
|
|
289
|
+
</div>
|
|
290
|
+
</fieldset>
|
|
291
|
+
</ComponentPreview>
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
```html
|
|
295
|
+
<fieldset>
|
|
296
|
+
<legend>Radio</legend>
|
|
297
|
+
<div>
|
|
298
|
+
<input type="checkbox" id="checkboxD" name="checkbox" checked> <label for="checkboxD">Option D</label>
|
|
299
|
+
</div>
|
|
300
|
+
<div>
|
|
301
|
+
<input type="checkbox" id="checkboxE" name="checkbox"> <label for="checkboxE">Option E</label>
|
|
302
|
+
</div>
|
|
303
|
+
<div>
|
|
304
|
+
<input type="checkbox" id="checkboxF" name="checkbox"> <label for="checkboxF">Option F</label>
|
|
305
|
+
</div>
|
|
306
|
+
</fieldset>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Switch
|
|
310
|
+
|
|
311
|
+
The checkbox with the `role="switch"` attribute will render a switch component.
|
|
312
|
+
|
|
313
|
+
<ComponentPreview>
|
|
314
|
+
<input type="checkbox" role="switch" id="switch" name="switch" value="true"> <label for="switch">I agree to the terms</label>
|
|
315
|
+
</ComponentPreview>
|
|
316
|
+
|
|
317
|
+
::: code-group
|
|
318
|
+
|
|
319
|
+
```html
|
|
320
|
+
<input type="checkbox" role="switch" id="switch" name="switch" value="true">
|
|
321
|
+
<label for="switch">I agree to the terms</label>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
```css [css property]
|
|
325
|
+
--icon-switch
|
|
326
|
+
--form-active-background
|
|
327
|
+
--form-active-border-color
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
:::
|
|
331
|
+
|
|
332
|
+
## States
|
|
333
|
+
|
|
334
|
+
The form can have the `:focus`, `:disabled`, `:readonly` and `:validation` states.
|
|
335
|
+
|
|
336
|
+
### Focus
|
|
337
|
+
|
|
338
|
+
The form use a default focus style, but you can customize it with :
|
|
339
|
+
|
|
340
|
+
```css
|
|
341
|
+
--form-focus-color
|
|
342
|
+
--form-focus-background
|
|
343
|
+
--form-focus-border-color
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
You can also customize the outline :
|
|
347
|
+
|
|
348
|
+
```css
|
|
349
|
+
--form-outline-size
|
|
350
|
+
--form-outline-style
|
|
351
|
+
--form-outline-color
|
|
352
|
+
--form-outline-offset
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Disabled
|
|
356
|
+
|
|
357
|
+
Apply the `disabled` attribute on `<input>`, `<textarea>` or `<select>` tags to display the disabled style.
|
|
358
|
+
|
|
359
|
+
<ComponentPreview>
|
|
360
|
+
<input type="text" value="My value" disabled>
|
|
361
|
+
<select type="text" disabled>
|
|
362
|
+
<option value="--">--</option>
|
|
363
|
+
</select>
|
|
364
|
+
<textarea disabled>It was a dark and stormy night...</textarea>
|
|
365
|
+
<input type="checkbox" disabled> <input type="checkbox" disabled checked> <input type="radio" disabled> <input type="radio" disabled checked> <input type="checkbox" role="switch" disabled> <input type="checkbox" role="switch" disabled checked>
|
|
366
|
+
</ComponentPreview>
|
|
367
|
+
|
|
368
|
+
::: code-group
|
|
369
|
+
|
|
370
|
+
```html
|
|
371
|
+
<input type="text" value="My value" disabled>
|
|
372
|
+
<select type="text" disabled>
|
|
373
|
+
<option value="--">--</option>
|
|
374
|
+
</select>
|
|
375
|
+
<textarea disabled>It was a dark and stormy night...</textarea>
|
|
376
|
+
<input type="checkbox" disabled> <input type="checkbox" disabled checked> <input type="radio" disabled> <input type="radio" disabled checked> <input type="checkbox" role="switch" disabled> <input type="checkbox" role="switch" disabled checked>
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```css [css property]
|
|
380
|
+
--form-disabled-opacity
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
:::
|
|
384
|
+
|
|
385
|
+
### Readonly
|
|
386
|
+
|
|
387
|
+
Apply the `readonly` attribute on `<input>` or `<textarea>` tags to display the readonly style.
|
|
388
|
+
|
|
389
|
+
<ComponentPreview>
|
|
390
|
+
<input type="text" value="My value" readonly>
|
|
391
|
+
<textarea readonly>It was a dark and stormy night...</textarea>
|
|
392
|
+
</ComponentPreview>
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
```html
|
|
396
|
+
<input type="text" value="My value" readonly>
|
|
397
|
+
<textarea readonly>It was a dark and stormy night...</textarea>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Validation
|
|
401
|
+
|
|
402
|
+
Use the `aria-invalid` attribute to display the element as in/valid and use `aria-describedby` attribute with a `<small>` tag to display the information.
|
|
403
|
+
|
|
404
|
+
As every design is different, there is not too much default style for in/valid elements. But for accessibility don't forget to add icons to show the errors.
|
|
405
|
+
|
|
406
|
+
<ComponentPreview>
|
|
407
|
+
<div>
|
|
408
|
+
<label for="invalidInput">Invalid input</label>
|
|
409
|
+
<input id="invalidInput" type="text" aria-describedby="invalidMsg" aria-invalid="true" value="My bad value">
|
|
410
|
+
<small id="invalidMsg" style="color: var(--color-error);">
|
|
411
|
+
<span aria-live="assertive">
|
|
412
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"></path><path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"></path></svg>
|
|
413
|
+
Incorrect value !
|
|
414
|
+
</span>
|
|
415
|
+
</small>
|
|
416
|
+
</div>
|
|
417
|
+
<div>
|
|
418
|
+
<label for="validInput">Valid input</label>
|
|
419
|
+
<input id="validInput" type="text" aria-describedby="validMsg" aria-invalid="false" value="My good value">
|
|
420
|
+
<small id="validMsg" style="color: var(--color-success);">
|
|
421
|
+
<span aria-live="assertive">
|
|
422
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"></path><path d="m10.97 4.97-.02.022-3.473 4.425-2.093-2.094a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05"></path></svg>
|
|
423
|
+
All good !
|
|
424
|
+
</span>
|
|
425
|
+
</small>
|
|
426
|
+
</div>
|
|
427
|
+
</ComponentPreview>
|
|
428
|
+
|
|
429
|
+
::: code-group
|
|
430
|
+
```html
|
|
431
|
+
<div>
|
|
432
|
+
<label for="invalidInput">Invalid input</label>
|
|
433
|
+
<input id="invalidInput" type="text" aria-describedby="invalidMsg" aria-invalid="true" value="My bad value">
|
|
434
|
+
<small id="invalidMsg" >
|
|
435
|
+
<span aria-live="assertive">
|
|
436
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"></path><path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"></path></svg>
|
|
437
|
+
Incorrect value !
|
|
438
|
+
</span>
|
|
439
|
+
</small>
|
|
440
|
+
</div>
|
|
441
|
+
<div>
|
|
442
|
+
<label for="validInput">Valid input</label>
|
|
443
|
+
<input id="validInput" type="text" aria-describedby="validMsg" aria-invalid="false" value="My good value">
|
|
444
|
+
<small id="validMsg">
|
|
445
|
+
<span aria-live="assertive">
|
|
446
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"></path><path d="m10.97 4.97-.02.022-3.473 4.425-2.093-2.094a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05"></path></svg>
|
|
447
|
+
All good !
|
|
448
|
+
</span>
|
|
449
|
+
</small>
|
|
450
|
+
</div>
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
```scss
|
|
454
|
+
form div {
|
|
455
|
+
&:has([aria-invalid=true]) {
|
|
456
|
+
[aria-live] {
|
|
457
|
+
color: var(--color-error);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
&:has([aria-invalid=false]) {
|
|
462
|
+
[aria-live] {
|
|
463
|
+
color: var(--color-success);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
:::
|
|
469
|
+
|
|
470
|
+
## Variants
|
|
471
|
+
|
|
472
|
+
### Group
|
|
473
|
+
|
|
474
|
+
You can group some fields by putting them in a `<div>` with the class `.group`.
|
|
475
|
+
|
|
476
|
+
<ComponentPreview>
|
|
477
|
+
<fieldset>
|
|
478
|
+
<legend>Price</legend>
|
|
479
|
+
<div class="group">
|
|
480
|
+
<label>Before</label>
|
|
481
|
+
<select>
|
|
482
|
+
<option value="A">CHF</option>
|
|
483
|
+
<option value="B">€</option>
|
|
484
|
+
<option value="C">$</option>
|
|
485
|
+
</select>
|
|
486
|
+
<input type="number" value="110">
|
|
487
|
+
<label>After</label>
|
|
488
|
+
<button>Send</button>
|
|
489
|
+
</div>
|
|
490
|
+
</fieldset>
|
|
491
|
+
</ComponentPreview>
|
|
492
|
+
|
|
493
|
+
::: code-group
|
|
494
|
+
```html
|
|
495
|
+
<fieldset>
|
|
496
|
+
<legend>Price</legend>
|
|
497
|
+
<div class="group">
|
|
498
|
+
<label>Before</label>
|
|
499
|
+
<select>
|
|
500
|
+
<option value="A">CHF</option>
|
|
501
|
+
<option value="B">€</option>
|
|
502
|
+
<option value="C">$</option>
|
|
503
|
+
</select>
|
|
504
|
+
<input type="number" value="110">
|
|
505
|
+
<label>After</label>
|
|
506
|
+
<button>Send</button>
|
|
507
|
+
</div>
|
|
508
|
+
</fieldset>
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
```scss
|
|
512
|
+
@use '@natachah/vanilla-frontend/scss/components/group';
|
|
513
|
+
```
|
|
514
|
+
:::
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ComponentPreview from '../vuejs/ComponentPreview.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
# Loading
|
|
6
|
+
|
|
7
|
+
```scss
|
|
8
|
+
@use '@natachah/vanilla-frontend/scss/components/loading';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
The loading is using the native `aria-busy` attribute.
|
|
14
|
+
|
|
15
|
+
<ComponentPreview>
|
|
16
|
+
<div aria-busy="true"></div>
|
|
17
|
+
</ComponentPreview>
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<div aria-busy="true"></div>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Variants
|
|
24
|
+
|
|
25
|
+
### Link
|
|
26
|
+
|
|
27
|
+
The loading is available for links:
|
|
28
|
+
|
|
29
|
+
<ComponentPreview>
|
|
30
|
+
<a href="#" aria-busy="true">My link</a>
|
|
31
|
+
</ComponentPreview>
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<a href="#" aria-busy="true">My link</a>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Button
|
|
38
|
+
|
|
39
|
+
The loading is available for buttons:
|
|
40
|
+
|
|
41
|
+
<ComponentPreview>
|
|
42
|
+
<button aria-busy="true"></button>
|
|
43
|
+
<button class="outline" aria-busy="true">Button</button>
|
|
44
|
+
<button class="primary" aria-busy="true">Button</button>
|
|
45
|
+
<button class="primary outline" aria-busy="true">Button</button>
|
|
46
|
+
</ComponentPreview>
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<button aria-busy="true"></button>
|
|
50
|
+
<button class="outline" aria-busy="true">Button</button>
|
|
51
|
+
<button class="primary" aria-busy="true">Button</button>
|
|
52
|
+
<button class="primary outline" aria-busy="true">Button</button>
|
|
53
|
+
```
|