@natachah/vanilla-frontend 0.4.0 → 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-doc.js +105 -0
- 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/base/_reset.scss +2 -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/themes/_root.scss +3 -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 -184
- 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.0.tgz +0 -0
- package/vitest.config.js +0 -8
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ComponentPreview from '../vuejs/ComponentPreview.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
# Popover
|
|
6
|
+
|
|
7
|
+
This component make able to crate box on flyout as Tooltip or Dropdown menu.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
```scss
|
|
11
|
+
@use '@natachah/vanilla-frontend/scss/components/popover';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Syntax
|
|
15
|
+
|
|
16
|
+
The popover is using a `<div>` tag with the class `.popover`. Inside of the element you must add a `<button>` and another `<div>` or an `<ul/ol>` tag.
|
|
17
|
+
|
|
18
|
+
<ComponentPreview height="150px">
|
|
19
|
+
<div class="popover">
|
|
20
|
+
<button popovertarget="myPopover">⚓︎ Open the popover</button>
|
|
21
|
+
<div popover id="myPopover">
|
|
22
|
+
<p>Hello world</p>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</ComponentPreview>
|
|
26
|
+
|
|
27
|
+
::: code-group
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<div class="popover">
|
|
31
|
+
<button popovertarget="myPopover">⚓︎ Open the popover</button>
|
|
32
|
+
<div popover id="myPopover">
|
|
33
|
+
<p>Hello world</p>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```css [css properties]
|
|
39
|
+
--popover-color
|
|
40
|
+
--popover-background
|
|
41
|
+
--popover-border-size
|
|
42
|
+
--popover-border-style
|
|
43
|
+
--popover-border-color
|
|
44
|
+
--popover-border-radius
|
|
45
|
+
--popover-padding-inline
|
|
46
|
+
--popover-padding-block
|
|
47
|
+
--popover-transition
|
|
48
|
+
--popover-decoration
|
|
49
|
+
--popover-area
|
|
50
|
+
--popover-inset
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
To work properly the `<button>` of the dropdown must have an `popovertarget="IdOfTheContent"` attribute. And the target (=the flyout box) must have `popover` attribute.
|
|
56
|
+
|
|
57
|
+
## Tooltip
|
|
58
|
+
|
|
59
|
+
You can create basic tooltip in text, juste make sute to use valid HTML as `<span>`. To position the tooltip, use the CSS custom properties `--popover-area` and `--popover-inset`.
|
|
60
|
+
|
|
61
|
+
<ComponentPreview height="150px">
|
|
62
|
+
<p>
|
|
63
|
+
Anchor in a text
|
|
64
|
+
<span class="popover" style="--popover-area: center right;--popover-inset: auto;">
|
|
65
|
+
<button popovertarget="myTooltip">⚓︎</button>
|
|
66
|
+
<span popover id="myTooltip">
|
|
67
|
+
Hello world
|
|
68
|
+
</span>
|
|
69
|
+
</span>
|
|
70
|
+
</p>
|
|
71
|
+
</ComponentPreview>
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
<p>
|
|
75
|
+
Anchor in a text
|
|
76
|
+
<span class="popover" style="--popover-area: center right;--popover-inset: auto;">
|
|
77
|
+
<button popovertarget="myTooltip">⚓︎</button>
|
|
78
|
+
<span popover id="myTooltip" data-placement="left">
|
|
79
|
+
Hello world
|
|
80
|
+
</span>
|
|
81
|
+
</span>
|
|
82
|
+
</p>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Dropdown menu
|
|
86
|
+
|
|
87
|
+
The Popover component make it able to create some dropdown menu without Javascript !
|
|
88
|
+
You must add the class `.dropdown`and not `.popover`.
|
|
89
|
+
It use the mixin `as-list` to create a nice menu and add some CSS custom properties.
|
|
90
|
+
|
|
91
|
+
<ComponentPreview height="200px">
|
|
92
|
+
<div class="dropdown">
|
|
93
|
+
<button popovertarget="myDropdown">
|
|
94
|
+
Open my dropdown
|
|
95
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
96
|
+
</button>
|
|
97
|
+
<ul popover id="myDropdown">
|
|
98
|
+
<li><a href="#">Subitem</a></li>
|
|
99
|
+
<li><a href="#">Subitem</a></li>
|
|
100
|
+
<li><a href="#">Subitem</a></li>
|
|
101
|
+
</ul>
|
|
102
|
+
</div>
|
|
103
|
+
</ComponentPreview>
|
|
104
|
+
|
|
105
|
+
::: code-group
|
|
106
|
+
|
|
107
|
+
```html
|
|
108
|
+
<div class="dropdown">
|
|
109
|
+
<button popovertarget="myDropdown">
|
|
110
|
+
Open my dropdown
|
|
111
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
112
|
+
</button>
|
|
113
|
+
<ul popover id="myDropdown">
|
|
114
|
+
<li><a href="#">Subitem</a></li>
|
|
115
|
+
<li><a href="#">Subitem</a></li>
|
|
116
|
+
<li><a href="#">Subitem</a></li>
|
|
117
|
+
</ul>
|
|
118
|
+
</div>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```css [css properties]
|
|
122
|
+
--dropdown-color
|
|
123
|
+
--dropdown-background
|
|
124
|
+
--dropdown-border-size
|
|
125
|
+
--dropdown-border-style
|
|
126
|
+
--dropdown-border-color
|
|
127
|
+
--dropdown-border-radius
|
|
128
|
+
--dropdown-padding-inline
|
|
129
|
+
--dropdown-padding-block
|
|
130
|
+
--dropdown-transition
|
|
131
|
+
--dropdown-decoration
|
|
132
|
+
--dropdown-outline-size
|
|
133
|
+
--dropdown-outline-style
|
|
134
|
+
--dropdown-outline-color
|
|
135
|
+
--dropdown-outline-offset
|
|
136
|
+
--dropdown-hover-color
|
|
137
|
+
--dropdown-hover-background
|
|
138
|
+
--dropdown-hover-border-color
|
|
139
|
+
--dropdown-focus-color
|
|
140
|
+
--dropdown-focus-background
|
|
141
|
+
--dropdown-focus-border-color
|
|
142
|
+
--dropdown-active-color
|
|
143
|
+
--dropdown-active-background
|
|
144
|
+
--dropdown-active-border-color
|
|
145
|
+
--dropdown-disabled-opacity
|
|
146
|
+
--dropdown-transition
|
|
147
|
+
--dropdown-svg-transform
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
:::
|
|
151
|
+
|
|
152
|
+
## Variants
|
|
153
|
+
|
|
154
|
+
### Color
|
|
155
|
+
|
|
156
|
+
You can create some color variation by including the colors classes name into the import and then by adding the class as `.{COLOR}`.
|
|
157
|
+
|
|
158
|
+
<ComponentPreview height="200px">
|
|
159
|
+
<div class="popover">
|
|
160
|
+
<button popovertarget="myPopoverPrimary">⚓︎ Open the popover</button>
|
|
161
|
+
<div popover id="myPopoverPrimary" class="primary">
|
|
162
|
+
<p>Hello world</p>
|
|
163
|
+
<p>This is a primary popover !</p>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</ComponentPreview>
|
|
167
|
+
|
|
168
|
+
::: code-group
|
|
169
|
+
```html
|
|
170
|
+
<div class="popover">
|
|
171
|
+
<button popovertarget="myPopoverPrimary">⚓︎ Open the popover</button>
|
|
172
|
+
<div popover id="myPopoverPrimary" class="primary">
|
|
173
|
+
<p>Hello world</p>
|
|
174
|
+
<p>This is a primary popover !</p>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```scss {2}
|
|
180
|
+
@use "@natachah/vanilla-frontend/scss/components/popover" with (
|
|
181
|
+
$colors: ('primary')
|
|
182
|
+
);
|
|
183
|
+
```
|
|
184
|
+
:::
|
|
185
|
+
|
|
186
|
+
#### Group
|
|
187
|
+
|
|
188
|
+
You can group some dropdowns by putting them in a `<div>` with the class `.group`.
|
|
189
|
+
|
|
190
|
+
<ComponentPreview height="200px">
|
|
191
|
+
<div class="group">
|
|
192
|
+
<div class="dropdown">
|
|
193
|
+
<button popovertarget="dropdownA">
|
|
194
|
+
Dropdown A
|
|
195
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
196
|
+
</button>
|
|
197
|
+
<ul popover id="dropdownA">
|
|
198
|
+
<li><a href="#">Subitem A</a></li>
|
|
199
|
+
<li><a href="#">Subitem A</a></li>
|
|
200
|
+
<li><a href="#">Subitem A</a></li>
|
|
201
|
+
</ul>
|
|
202
|
+
</div>
|
|
203
|
+
<div class="dropdown">
|
|
204
|
+
<button popovertarget="dropdownB">
|
|
205
|
+
Dropdown B
|
|
206
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
207
|
+
</button>
|
|
208
|
+
<ul popover id="dropdownB">
|
|
209
|
+
<li><a href="#">Subitem B</a></li>
|
|
210
|
+
<li><a href="#">Subitem B</a></li>
|
|
211
|
+
<li><a href="#">Subitem B</a></li>
|
|
212
|
+
</ul>
|
|
213
|
+
</div>
|
|
214
|
+
<div class="dropdown">
|
|
215
|
+
<button popovertarget="dropdownC">
|
|
216
|
+
Dropdown C
|
|
217
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
218
|
+
</button>
|
|
219
|
+
<ul popover id="dropdownC">
|
|
220
|
+
<li><a href="#">Subitem C </a></li>
|
|
221
|
+
<li><a href="#">Subitem C </a></li>
|
|
222
|
+
<li><a href="#">Subitem C </a></li>
|
|
223
|
+
</ul>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
</ComponentPreview>
|
|
227
|
+
|
|
228
|
+
::: code-group
|
|
229
|
+
```html
|
|
230
|
+
<div class="group">
|
|
231
|
+
<div class="dropdown">
|
|
232
|
+
<button popovertarget="dropdownA">
|
|
233
|
+
Dropdown A
|
|
234
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
235
|
+
</button>
|
|
236
|
+
<ul popover id="dropdownA">
|
|
237
|
+
<li><a href="#">Subitem A</a></li>
|
|
238
|
+
<li><a href="#">Subitem A</a></li>
|
|
239
|
+
<li><a href="#">Subitem A</a></li>
|
|
240
|
+
</ul>
|
|
241
|
+
</div>
|
|
242
|
+
<div class="dropdown">
|
|
243
|
+
<button popovertarget="dropdownB">
|
|
244
|
+
Dropdown B
|
|
245
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
246
|
+
</button>
|
|
247
|
+
<ul popover id="dropdownB">
|
|
248
|
+
<li><a href="#">Subitem B</a></li>
|
|
249
|
+
<li><a href="#">Subitem B</a></li>
|
|
250
|
+
<li><a href="#">Subitem B</a></li>
|
|
251
|
+
</ul>
|
|
252
|
+
</div>
|
|
253
|
+
<div class="dropdown">
|
|
254
|
+
<button popovertarget="dropdownC">
|
|
255
|
+
Dropdown C
|
|
256
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z"></path></svg>
|
|
257
|
+
</button>
|
|
258
|
+
<ul popover id="dropdownC">
|
|
259
|
+
<li><a href="#">Subitem C </a></li>
|
|
260
|
+
<li><a href="#">Subitem C </a></li>
|
|
261
|
+
<li><a href="#">Subitem C </a></li>
|
|
262
|
+
</ul>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
```scss
|
|
268
|
+
@use '@natachah/vanilla-frontend/scss/components/group';
|
|
269
|
+
```
|
|
270
|
+
:::
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ComponentPreview from '../vuejs/ComponentPreview.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
# Progress
|
|
6
|
+
|
|
7
|
+
```scss
|
|
8
|
+
@use '@natachah/vanilla-frontend/scss/components/progress';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
The progress is using the native `<progress>` tag.
|
|
14
|
+
|
|
15
|
+
<ComponentPreview>
|
|
16
|
+
<label for="download">Download progress:</label>
|
|
17
|
+
<progress id="download" value="50" max="100">50%</progress>
|
|
18
|
+
</ComponentPreview>
|
|
19
|
+
|
|
20
|
+
::: code-group
|
|
21
|
+
```html
|
|
22
|
+
<label for="download">Download progress:</label>
|
|
23
|
+
<progress id="download" value="50" max="100">50%</progress>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```css [css properties]
|
|
27
|
+
--progress-width
|
|
28
|
+
--progress-height
|
|
29
|
+
--progress-background
|
|
30
|
+
--progress-color
|
|
31
|
+
--progress-border-radius
|
|
32
|
+
```
|
|
33
|
+
:::
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ComponentPreview from '../vuejs/ComponentPreview.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
# Table
|
|
6
|
+
|
|
7
|
+
```scss
|
|
8
|
+
@use '@natachah/vanilla-frontend/scss/components/table';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
The table is using the native `<table>` tag.
|
|
14
|
+
|
|
15
|
+
<ComponentPreview>
|
|
16
|
+
<table>
|
|
17
|
+
<caption>Caption of the table</caption>
|
|
18
|
+
<thead>
|
|
19
|
+
<tr>
|
|
20
|
+
<th>Head A</th>
|
|
21
|
+
<th>Head B</th>
|
|
22
|
+
<th>Head C</th>
|
|
23
|
+
</tr>
|
|
24
|
+
</thead>
|
|
25
|
+
<tbody>
|
|
26
|
+
<tr>
|
|
27
|
+
<td>Cell</td>
|
|
28
|
+
<td>Cell</td>
|
|
29
|
+
<td>Cell</td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td>Cell</td>
|
|
33
|
+
<td>Cell</td>
|
|
34
|
+
<td>Cell</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<tr>
|
|
37
|
+
<td>Cell</td>
|
|
38
|
+
<td>Cell</td>
|
|
39
|
+
<td>Cell</td>
|
|
40
|
+
</tr>
|
|
41
|
+
</tbody>
|
|
42
|
+
<tfoot>
|
|
43
|
+
<tr>
|
|
44
|
+
<th>Foot A</th>
|
|
45
|
+
<th>Foot B</th>
|
|
46
|
+
<th>Foot C</th>
|
|
47
|
+
</tr>
|
|
48
|
+
</tfoot>
|
|
49
|
+
</table>
|
|
50
|
+
</ComponentPreview>
|
|
51
|
+
|
|
52
|
+
::: code-group
|
|
53
|
+
```html
|
|
54
|
+
<table>
|
|
55
|
+
<caption>Caption of the table</caption>
|
|
56
|
+
<thead>
|
|
57
|
+
<tr>
|
|
58
|
+
<th>Head A</th>
|
|
59
|
+
<th>Head B</th>
|
|
60
|
+
<th>Head C</th>
|
|
61
|
+
</tr>
|
|
62
|
+
</thead>
|
|
63
|
+
<tbody>
|
|
64
|
+
<tr>
|
|
65
|
+
<td>Cell</td>
|
|
66
|
+
<td>Cell</td>
|
|
67
|
+
<td>Cell</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td>Cell</td>
|
|
71
|
+
<td>Cell</td>
|
|
72
|
+
<td>Cell</td>
|
|
73
|
+
</tr>
|
|
74
|
+
<tr>
|
|
75
|
+
<td>Cell</td>
|
|
76
|
+
<td>Cell</td>
|
|
77
|
+
<td>Cell</td>
|
|
78
|
+
</tr>
|
|
79
|
+
</tbody>
|
|
80
|
+
<tfoot>
|
|
81
|
+
<tr>
|
|
82
|
+
<th>Foot A</th>
|
|
83
|
+
<th>Foot B</th>
|
|
84
|
+
<th>Foot C</th>
|
|
85
|
+
</tr>
|
|
86
|
+
</tfoot>
|
|
87
|
+
</table>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```css [css properties]
|
|
91
|
+
--table-padding-inline
|
|
92
|
+
--table-padding-block
|
|
93
|
+
--table-align-inline
|
|
94
|
+
--table-align-block
|
|
95
|
+
--table-border-size
|
|
96
|
+
--table-border-style
|
|
97
|
+
--table-border-color
|
|
98
|
+
--table-divider-size
|
|
99
|
+
--table-divider-style
|
|
100
|
+
--table-divider-color
|
|
101
|
+
```
|
|
102
|
+
:::
|
|
103
|
+
|
|
104
|
+
## Responsive
|
|
105
|
+
|
|
106
|
+
To render a table responsive, you can use the SCSS mixin `as-responsive-table()` inside a `@media` or `@container`.
|
|
107
|
+
|
|
108
|
+
It require the attribute `data-label="Name of the column"` on each `<td>`.
|
|
109
|
+
|
|
110
|
+
<ComponentPreview>
|
|
111
|
+
<div class="as-container">
|
|
112
|
+
<table id="responsiveTable">
|
|
113
|
+
<thead>
|
|
114
|
+
<tr>
|
|
115
|
+
<th>Header A</th>
|
|
116
|
+
<th>Header B</th>
|
|
117
|
+
<th>Header C</th>
|
|
118
|
+
</tr>
|
|
119
|
+
</thead>
|
|
120
|
+
<tbody>
|
|
121
|
+
<tr>
|
|
122
|
+
<td data-label="Header A">Cell</td>
|
|
123
|
+
<td data-label="Header B">Cell</td>
|
|
124
|
+
<td data-label="Header C">Cell</td>
|
|
125
|
+
</tr>
|
|
126
|
+
</tbody>
|
|
127
|
+
</table>
|
|
128
|
+
</div>
|
|
129
|
+
</ComponentPreview>
|
|
130
|
+
|
|
131
|
+
::: code-group
|
|
132
|
+
```html
|
|
133
|
+
<div class="as-container">
|
|
134
|
+
<table id="responsiveTable">
|
|
135
|
+
<thead>
|
|
136
|
+
<tr>
|
|
137
|
+
<th>Header A</th>
|
|
138
|
+
<th>Header B</th>
|
|
139
|
+
<th>Header C</th>
|
|
140
|
+
</tr>
|
|
141
|
+
</thead>
|
|
142
|
+
<tbody>
|
|
143
|
+
<tr>
|
|
144
|
+
<td data-label="Header A">Cell</td>
|
|
145
|
+
<td data-label="Header B">Cell</td>
|
|
146
|
+
<td data-label="Header C">Cell</td>
|
|
147
|
+
</tr>
|
|
148
|
+
</tbody>
|
|
149
|
+
</table>
|
|
150
|
+
</div>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```scss
|
|
154
|
+
// Import the mixins
|
|
155
|
+
@use '@natachah/vanilla-frontend/scss/abstracts/mixins' as *;
|
|
156
|
+
|
|
157
|
+
// Create a container
|
|
158
|
+
.as-container {
|
|
159
|
+
container-type: inline-size;
|
|
160
|
+
min-height: 300px;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Demo for responsive table
|
|
165
|
+
@container (max-width:500px) {
|
|
166
|
+
#responsiveTable {
|
|
167
|
+
@include as-responsive-table()
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```css [css property]
|
|
173
|
+
--table-grid-template
|
|
174
|
+
```
|
|
175
|
+
:::
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://vitepress.dev/reference/default-theme-home-page
|
|
3
|
+
layout: home
|
|
4
|
+
|
|
5
|
+
hero:
|
|
6
|
+
name: "Vanilla Frontend"
|
|
7
|
+
text: "A simple framework"
|
|
8
|
+
tagline: For wild HTML, CSS and JS purists lover
|
|
9
|
+
actions:
|
|
10
|
+
- theme: brand
|
|
11
|
+
text: Let's start !
|
|
12
|
+
link: /start/install
|
|
13
|
+
- theme: alt
|
|
14
|
+
text: Upgrade Guide
|
|
15
|
+
link: /prologue/upgrade
|
|
16
|
+
|
|
17
|
+
features:
|
|
18
|
+
- title: Class-light and Semantic
|
|
19
|
+
details: Thriving on simplicity, directly styles your HTML tags, using fewer .classes as possible.
|
|
20
|
+
- title: Accessibility
|
|
21
|
+
details: Use pur HTML and make your frontend more accessible for everyone.
|
|
22
|
+
- title: Easy Customization
|
|
23
|
+
details: Customize the frontend with over CSS custom properties, or dive deeper by using SCSS.
|
|
24
|
+
- title: Vanilla JS
|
|
25
|
+
details: Libraries of tiny vanilla JS interaction to make your website more interactive.
|
|
26
|
+
---
|
|
27
|
+
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ComponentPreview from '../vuejs/ComponentPreview.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
# Autofill <Badge type="warning" text="JS" />
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import Autofill from "@natachah/vanilla-frontend/js/_autofill"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Syntax
|
|
12
|
+
|
|
13
|
+
The autofill component make you able to automaticaly fill some `<input>` fields by another.
|
|
14
|
+
|
|
15
|
+
You can use it with a `<select>` tag with the `aria-controls="IdOfTheOtherField"` attribute.
|
|
16
|
+
|
|
17
|
+
The other field must have a `data-autofill="NameOfTheValue"` attribute. The value must exist into the `<option>` tags as `data-NameOfTheValue="value"`.
|
|
18
|
+
|
|
19
|
+
<ComponentPreview>
|
|
20
|
+
<fieldset>
|
|
21
|
+
<legend>Favorite animal</legend>
|
|
22
|
+
<div class="group">
|
|
23
|
+
<select class="autofill-demo" id="autofillSelect" name="select" aria-controls="animalID">
|
|
24
|
+
<option>--</option>
|
|
25
|
+
<option data-id="1">Cat</option>
|
|
26
|
+
<option data-id="2">Dog</option>
|
|
27
|
+
<option data-id="3">Lizzard</option>
|
|
28
|
+
<option data-id="4">Bird</option>
|
|
29
|
+
</select>
|
|
30
|
+
<input id="animalID" type="text" placeholder="ID of the animal" data-autofill="id" readonly>
|
|
31
|
+
</div>
|
|
32
|
+
</fieldset>
|
|
33
|
+
</ComponentPreview>
|
|
34
|
+
|
|
35
|
+
::: code-group
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<fieldset>
|
|
39
|
+
<legend>Favorite animal</legend>
|
|
40
|
+
<div class="group">
|
|
41
|
+
<select id="autofillSelect" name="select" aria-controls="animalID">
|
|
42
|
+
<option>--</option>
|
|
43
|
+
<option data-id="1">Cat</option>
|
|
44
|
+
<option data-id="2">Dog</option>
|
|
45
|
+
<option data-id="3">Lizzard</option>
|
|
46
|
+
<option data-id="4">Bird</option>
|
|
47
|
+
</select>
|
|
48
|
+
<input id="animalID" type="text" placeholder="ID of the animal" data-autofill="id" readonly>
|
|
49
|
+
</div>
|
|
50
|
+
</fieldset>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import Autofill from "@natachah/vanilla-frontend/js/_autofill"
|
|
55
|
+
const autofillSelect = document.getElementById('autofillSelect')
|
|
56
|
+
if(autofillSelect) new Autofill(autofillSelect)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
:::
|
|
60
|
+
|
|
61
|
+
### Datalist / Autocomplete
|
|
62
|
+
|
|
63
|
+
<ComponentPreview>
|
|
64
|
+
<fieldset>
|
|
65
|
+
<legend>Favorite ice cream</legend>
|
|
66
|
+
<div class="group">
|
|
67
|
+
<input class="autofill-demo" id="autofillList" name="datalist" list="myDatalist" aria-controls="flavourID flavorColor" placeholder="Choose a flavor">
|
|
68
|
+
<input id="flavourID" type="text" placeholder="ID of the icecream" data-autofill="id" readonly>
|
|
69
|
+
<input id="flavorColor" type="text" placeholder="Color of the icecream" data-autofill="color" readonly>
|
|
70
|
+
</div>
|
|
71
|
+
</fieldset>
|
|
72
|
+
<datalist id="myDatalist">
|
|
73
|
+
<option data-id="1" data-color="Brown" value="Chocolate">
|
|
74
|
+
</option>
|
|
75
|
+
<option data-id="2" data-color="White" value="Coconut">
|
|
76
|
+
</option>
|
|
77
|
+
<option data-id="3" data-color="Green" value="Mint">
|
|
78
|
+
</option>
|
|
79
|
+
<option data-id="4" data-color="Red" value="Strawberry">
|
|
80
|
+
</option>
|
|
81
|
+
<option data-id="5" data-color="Yellow" value="Vanilla">
|
|
82
|
+
</option>
|
|
83
|
+
</datalist>
|
|
84
|
+
</ComponentPreview>
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<fieldset>
|
|
88
|
+
<legend>Favorite ice cream</legend>
|
|
89
|
+
<div class="group">
|
|
90
|
+
<input id="autofillList" name="datalist" list="myDatalist" aria-controls="flavourID flavorColor" placeholder="Choose a flavor">
|
|
91
|
+
<input id="flavourID" type="text" placeholder="ID of the icecream" data-autofill="id" readonly>
|
|
92
|
+
<input id="flavorColor" type="text" placeholder="Color of the icecream" data-autofill="color" readonly>
|
|
93
|
+
</div>
|
|
94
|
+
</fieldset>
|
|
95
|
+
<datalist id="myDatalist">
|
|
96
|
+
<option data-id="1" data-color="Brown" value="Chocolate">
|
|
97
|
+
</option>
|
|
98
|
+
<option data-id="2" data-color="White" value="Coconut">
|
|
99
|
+
</option>
|
|
100
|
+
<option data-id="3" data-color="Green" value="Mint">
|
|
101
|
+
</option>
|
|
102
|
+
<option data-id="4" data-color="Red" value="Strawberry">
|
|
103
|
+
</option>
|
|
104
|
+
<option data-id="5" data-color="Yellow" value="Vanilla">
|
|
105
|
+
</option>
|
|
106
|
+
</datalist>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### File upload
|
|
110
|
+
|
|
111
|
+
<ComponentPreview>
|
|
112
|
+
<label for="autofillList">Choose a file</label>
|
|
113
|
+
<input class="autofill-demo" id="autofillFile" type="file" name="file" aria-controls="fileName fileSize fileType fileCleanName fileExtension">
|
|
114
|
+
<fieldset>
|
|
115
|
+
<legend>File data</legend>
|
|
116
|
+
<div class="group">
|
|
117
|
+
<input id="fileName" type="text" placeholder="Name of the file" data-autofill="name" readonly>
|
|
118
|
+
<input id="fileSize" type="text" placeholder="Size of the file" data-autofill="size" readonly>
|
|
119
|
+
<input id="fileType" type="text" placeholder="Type of the file" data-autofill="type" readonly>
|
|
120
|
+
<input id="fileCleanName" type="text" placeholder="Clean name of the file" data-autofill="filename" readonly>
|
|
121
|
+
<input id="fileExtension" type="text" placeholder="Extension of the file" data-autofill="extension" readonly>
|
|
122
|
+
</div>
|
|
123
|
+
</fieldset>
|
|
124
|
+
</ComponentPreview>
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<label for="autofillList">Choose a file</label>
|
|
128
|
+
<input id="autofillFile" type="file" name="file" aria-controls="fileName fileSize fileType fileCleanName fileExtension">
|
|
129
|
+
<fieldset>
|
|
130
|
+
<legend>File data</legend>
|
|
131
|
+
<div class="group">
|
|
132
|
+
<input id="fileName" type="text" placeholder="Name of the file" data-autofill="name" readonly>
|
|
133
|
+
<input id="fileSize" type="text" placeholder="Size of the file" data-autofill="size" readonly>
|
|
134
|
+
<input id="fileType" type="text" placeholder="Type of the file" data-autofill="type" readonly>
|
|
135
|
+
<input id="fileCleanName" type="text" placeholder="Clean name of the file" data-autofill="filename" readonly>
|
|
136
|
+
<input id="fileExtension" type="text" placeholder="Extension of the file" data-autofill="extension" readonly>
|
|
137
|
+
</div>
|
|
138
|
+
</fieldset>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Javascript
|
|
142
|
+
|
|
143
|
+
### Events
|
|
144
|
+
|
|
145
|
+
| Event name | Description | Value |
|
|
146
|
+
|---|---|---|
|
|
147
|
+
| autofill:changed | This event is fired when the original element value has changed | `current` as HTMLElement *Could be an `<option>` or a `File` |
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
const myAutofill = document.getElementById('myAutofill')
|
|
151
|
+
myAutofill.addEventListener('autofill:changed', (e) => {
|
|
152
|
+
const theCurrentItem = e.detail.current
|
|
153
|
+
...
|
|
154
|
+
})
|
|
155
|
+
```
|