@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.
Files changed (283) hide show
  1. package/.gitlab-ci.yml +22 -13
  2. package/LICENSE.md +1 -1
  3. package/docs/.vitepress/config.mts +101 -0
  4. package/docs/base/layout.md +77 -0
  5. package/docs/base/media.md +146 -0
  6. package/docs/base/reset.md +33 -0
  7. package/docs/base/typography.md +296 -0
  8. package/docs/classes/badge.md +146 -0
  9. package/docs/classes/breadcrumb.md +54 -0
  10. package/docs/classes/card.md +171 -0
  11. package/docs/classes/dropdown.md +180 -0
  12. package/docs/classes/grid.md +230 -0
  13. package/docs/classes/list.md +90 -0
  14. package/docs/components/button.md +254 -0
  15. package/docs/components/dialog.md +223 -0
  16. package/docs/components/disclosure.md +169 -0
  17. package/docs/components/form.md +514 -0
  18. package/docs/components/loading.md +53 -0
  19. package/docs/components/popover.md +270 -0
  20. package/docs/components/progress.md +33 -0
  21. package/docs/components/table.md +175 -0
  22. package/docs/index.md +27 -0
  23. package/docs/javascript/autofill.md +155 -0
  24. package/docs/javascript/check.md +53 -0
  25. package/docs/javascript/comfort.md +125 -0
  26. package/docs/javascript/consent.md +89 -0
  27. package/docs/javascript/cookie.md +33 -0
  28. package/docs/javascript/drawer.md +99 -0
  29. package/docs/javascript/form.md +130 -0
  30. package/docs/javascript/scroll.md +104 -0
  31. package/docs/javascript/slider.md +130 -0
  32. package/docs/javascript/sortable.md +127 -0
  33. package/docs/javascript/tabpanel.md +72 -0
  34. package/docs/javascript/toggle.md +182 -0
  35. package/docs/javascript/trap.md +33 -0
  36. package/docs/javascript/tree.md +220 -0
  37. package/docs/prologue/conventions.md +92 -0
  38. package/docs/prologue/release.md +44 -0
  39. package/docs/prologue/upgrade.md +21 -0
  40. package/docs/{pages/demo/layout.html → public/demo/demo.html} +1 -2
  41. package/docs/start/customization.md +184 -0
  42. package/docs/start/install.md +80 -0
  43. package/docs/start/mixin.md +203 -0
  44. package/docs/vuejs/ComponentPreview.vue +99 -0
  45. package/js/_slider.js +17 -1
  46. package/js/vanilla-frontend-doc.js +105 -0
  47. package/natachah-vanilla-frontend-1.0.0.tgz +0 -0
  48. package/package.json +11 -14
  49. package/public/404.html +22 -0
  50. package/public/assets/app.DsgDPRSA.js +1 -0
  51. package/public/assets/base_layout.md.CTGv6rTn.js +13 -0
  52. package/public/assets/base_layout.md.CTGv6rTn.lean.js +1 -0
  53. package/public/assets/base_media.md.CcuDUcF-.js +24 -0
  54. package/public/assets/base_media.md.CcuDUcF-.lean.js +1 -0
  55. package/public/assets/base_reset.md.DqIdqFRJ.js +3 -0
  56. package/public/assets/base_reset.md.DqIdqFRJ.lean.js +1 -0
  57. package/public/assets/base_typography.md.DV-ikqGZ.js +87 -0
  58. package/public/assets/base_typography.md.DV-ikqGZ.lean.js +1 -0
  59. package/public/assets/chunks/ComponentPreview.BW2s4ay5.js +27 -0
  60. package/public/assets/chunks/framework.CaiDwmc7.js +4 -0
  61. package/public/assets/chunks/theme.DL_11MHV.js +1 -0
  62. package/public/assets/classes_badge.md.BCGzPr6f.js +24 -0
  63. package/public/assets/classes_badge.md.BCGzPr6f.lean.js +1 -0
  64. package/public/assets/classes_breadcrumb.md.vU6jlo36.js +15 -0
  65. package/public/assets/classes_breadcrumb.md.vU6jlo36.lean.js +1 -0
  66. package/public/assets/classes_card.md.BZEh2l_B.js +41 -0
  67. package/public/assets/classes_card.md.BZEh2l_B.lean.js +1 -0
  68. package/public/assets/classes_dropdown.md.BLVw_xQY.js +70 -0
  69. package/public/assets/classes_dropdown.md.BLVw_xQY.lean.js +1 -0
  70. package/public/assets/classes_grid.md.47v-Ybqe.js +45 -0
  71. package/public/assets/classes_grid.md.47v-Ybqe.lean.js +1 -0
  72. package/public/assets/classes_list.md.BW9PWZV1.js +36 -0
  73. package/public/assets/classes_list.md.BW9PWZV1.lean.js +1 -0
  74. package/public/assets/components_button.md.vx3HzdpN.js +45 -0
  75. package/public/assets/components_button.md.vx3HzdpN.lean.js +1 -0
  76. package/public/assets/components_dialog.md.C-0gJGus.js +76 -0
  77. package/public/assets/components_dialog.md.C-0gJGus.lean.js +1 -0
  78. package/public/assets/components_disclosure.md.DeSRu9_P.js +53 -0
  79. package/public/assets/components_disclosure.md.DeSRu9_P.lean.js +1 -0
  80. package/public/assets/components_form.md.Be8d5WFv.js +122 -0
  81. package/public/assets/components_form.md.Be8d5WFv.lean.js +1 -0
  82. package/public/assets/components_loading.md.CKDG7z5x.js +4 -0
  83. package/public/assets/components_loading.md.CKDG7z5x.lean.js +1 -0
  84. package/public/assets/components_popover.md.CwgNttNc.js +102 -0
  85. package/public/assets/components_popover.md.CwgNttNc.lean.js +1 -0
  86. package/public/assets/components_progress.md.CNC7rJiC.js +6 -0
  87. package/public/assets/components_progress.md.CNC7rJiC.lean.js +1 -0
  88. package/public/assets/components_table.md.LyBkIDkF.js +75 -0
  89. package/public/assets/components_table.md.LyBkIDkF.lean.js +1 -0
  90. package/public/assets/index.md.CJiHmjB7.js +1 -0
  91. package/public/assets/index.md.CJiHmjB7.lean.js +1 -0
  92. package/public/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  93. package/public/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  94. package/public/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  95. package/public/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  96. package/public/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  97. package/public/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  98. package/public/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  99. package/public/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  100. package/public/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  101. package/public/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  102. package/public/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  103. package/public/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  104. package/public/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  105. package/public/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  106. package/public/assets/javascript_autofill.md.BewVUo4H.js +49 -0
  107. package/public/assets/javascript_autofill.md.BewVUo4H.lean.js +1 -0
  108. package/public/assets/javascript_check.md.B6ajE66i.js +13 -0
  109. package/public/assets/javascript_check.md.B6ajE66i.lean.js +1 -0
  110. package/public/assets/javascript_comfort.md.BRci3j7V.js +20 -0
  111. package/public/assets/javascript_comfort.md.BRci3j7V.lean.js +1 -0
  112. package/public/assets/javascript_consent.md.Bjv8ZDS6.js +29 -0
  113. package/public/assets/javascript_consent.md.Bjv8ZDS6.lean.js +1 -0
  114. package/public/assets/javascript_cookie.md.Dlhyk4Ha.js +2 -0
  115. package/public/assets/javascript_cookie.md.Dlhyk4Ha.lean.js +1 -0
  116. package/public/assets/javascript_drawer.md.BCJX3fL-.js +32 -0
  117. package/public/assets/javascript_drawer.md.BCJX3fL-.lean.js +1 -0
  118. package/public/assets/javascript_form.md.Cwf_gxLI.js +40 -0
  119. package/public/assets/javascript_form.md.Cwf_gxLI.lean.js +2 -0
  120. package/public/assets/javascript_scroll.md.BrJijWbF.js +30 -0
  121. package/public/assets/javascript_scroll.md.BrJijWbF.lean.js +1 -0
  122. package/public/assets/javascript_slider.md.DDO8wC4u.js +27 -0
  123. package/public/assets/javascript_slider.md.DDO8wC4u.lean.js +1 -0
  124. package/public/assets/javascript_sortable.md.BKyem7yw.js +35 -0
  125. package/public/assets/javascript_sortable.md.BKyem7yw.lean.js +1 -0
  126. package/public/assets/javascript_tabpanel.md.D9M-_xE0.js +19 -0
  127. package/public/assets/javascript_tabpanel.md.D9M-_xE0.lean.js +1 -0
  128. package/public/assets/javascript_toggle.md.C8582WNC.js +46 -0
  129. package/public/assets/javascript_toggle.md.C8582WNC.lean.js +1 -0
  130. package/public/assets/javascript_trap.md.Bc59YUng.js +2 -0
  131. package/public/assets/javascript_trap.md.Bc59YUng.lean.js +1 -0
  132. package/public/assets/javascript_tree.md.uc1UUsFV.js +72 -0
  133. package/public/assets/javascript_tree.md.uc1UUsFV.lean.js +1 -0
  134. package/public/assets/prologue_conventions.md.D8nVwlRS.js +34 -0
  135. package/public/assets/prologue_conventions.md.D8nVwlRS.lean.js +1 -0
  136. package/public/assets/prologue_release.md.CG6nuFnt.js +1 -0
  137. package/public/assets/prologue_release.md.CG6nuFnt.lean.js +1 -0
  138. package/public/assets/prologue_upgrade.md.CFxokaBG.js +1 -0
  139. package/public/assets/prologue_upgrade.md.CFxokaBG.lean.js +1 -0
  140. package/public/assets/start_customization.md.t-ze_NoQ.js +141 -0
  141. package/public/assets/start_customization.md.t-ze_NoQ.lean.js +1 -0
  142. package/public/assets/start_install.md.OluH7l11.js +46 -0
  143. package/public/assets/start_install.md.OluH7l11.lean.js +1 -0
  144. package/public/assets/start_mixin.md.D76cLRSX.js +85 -0
  145. package/public/assets/start_mixin.md.D76cLRSX.lean.js +1 -0
  146. package/public/assets/style.zIeGMibA.css +1 -0
  147. package/public/base/layout.html +37 -0
  148. package/public/base/media.html +179 -0
  149. package/public/base/reset.html +27 -0
  150. package/public/base/typography.html +320 -0
  151. package/public/bundles/vanilla-frontend-doc.css +1 -0
  152. package/public/bundles/vanilla-frontend-doc.js +1 -0
  153. package/public/bundles/vanilla-frontend.css +1 -0
  154. package/public/classes/badge.html +205 -0
  155. package/public/classes/breadcrumb.html +66 -0
  156. package/public/classes/card.html +222 -0
  157. package/public/classes/dropdown.html +147 -0
  158. package/public/classes/grid.html +278 -0
  159. package/public/classes/list.html +113 -0
  160. package/public/components/button.html +304 -0
  161. package/public/components/dialog.html +205 -0
  162. package/public/components/disclosure.html +130 -0
  163. package/public/components/form.html +589 -0
  164. package/public/components/loading.html +107 -0
  165. package/public/components/popover.html +257 -0
  166. package/public/components/progress.html +57 -0
  167. package/public/components/table.html +152 -0
  168. package/public/demo/demo.html +84 -0
  169. package/public/hashmap.json +1 -0
  170. package/public/index.html +25 -0
  171. package/public/javascript/autofill.html +152 -0
  172. package/public/javascript/check.html +64 -0
  173. package/public/javascript/comfort.html +123 -0
  174. package/public/javascript/consent.html +80 -0
  175. package/public/javascript/cookie.html +26 -0
  176. package/public/javascript/drawer.html +83 -0
  177. package/public/javascript/form.html +117 -0
  178. package/public/javascript/scroll.html +81 -0
  179. package/public/javascript/slider.html +78 -0
  180. package/public/javascript/sortable.html +112 -0
  181. package/public/javascript/tabpanel.html +70 -0
  182. package/public/javascript/toggle.html +201 -0
  183. package/public/javascript/trap.html +26 -0
  184. package/public/javascript/tree.html +175 -0
  185. package/public/prologue/conventions.html +58 -0
  186. package/public/prologue/release.html +25 -0
  187. package/public/prologue/upgrade.html +25 -0
  188. package/public/start/customization.html +165 -0
  189. package/public/start/install.html +70 -0
  190. package/public/start/mixin.html +109 -0
  191. package/public/vp-icons.css +0 -0
  192. package/sandbox/index.html +27 -0
  193. package/sandbox/js/sandbox-header.js +57 -0
  194. package/sandbox/js/sandbox-test.js +91 -0
  195. package/sandbox/pages/base/layout.html +80 -0
  196. package/sandbox/pages/base/media.html +52 -0
  197. package/sandbox/pages/base/typography.html +132 -0
  198. package/sandbox/pages/components/button.html +70 -0
  199. package/sandbox/pages/components/dialog.html +72 -0
  200. package/sandbox/pages/components/disclosure.html +77 -0
  201. package/sandbox/pages/components/form.html +164 -0
  202. package/sandbox/pages/components/loading.html +32 -0
  203. package/sandbox/pages/components/popover.html +119 -0
  204. package/sandbox/pages/components/progress.html +28 -0
  205. package/sandbox/pages/components/table.html +80 -0
  206. package/sandbox/pages/customs/badge.html +59 -0
  207. package/sandbox/pages/customs/breadcrumb.html +34 -0
  208. package/sandbox/pages/customs/card.html +71 -0
  209. package/sandbox/pages/customs/dropdown.html +70 -0
  210. package/sandbox/pages/customs/grid.html +109 -0
  211. package/sandbox/pages/customs/list.html +43 -0
  212. package/sandbox/pages/javascript/autofill.html +39 -0
  213. package/sandbox/pages/javascript/checkall.html +37 -0
  214. package/sandbox/pages/javascript/comfort.html +41 -0
  215. package/sandbox/pages/javascript/consent.html +45 -0
  216. package/sandbox/pages/javascript/form.html +50 -0
  217. package/sandbox/pages/javascript/scroll.html +44 -0
  218. package/sandbox/pages/javascript/slider.html +44 -0
  219. package/sandbox/pages/javascript/sortable.html +56 -0
  220. package/sandbox/pages/javascript/tabpanel.html +39 -0
  221. package/sandbox/pages/javascript/toggle.html +72 -0
  222. package/sandbox/pages/javascript/tree.html +96 -0
  223. package/sandbox/sandbox.js +26 -0
  224. package/sandbox/scss/sandbox-header.scss +93 -0
  225. package/scss/base/_reset.scss +2 -0
  226. package/scss/components/_badge.scss +2 -1
  227. package/scss/components/_dropdown.scss +2 -2
  228. package/scss/components/_group.scss +8 -4
  229. package/scss/components/_popover.scss +74 -0
  230. package/scss/components/index.scss +1 -0
  231. package/scss/themes/_root.scss +3 -0
  232. package/scss/vanilla-frontend-doc.scss +46 -1
  233. package/scss/vanilla-frontend-sandbox.scss +34 -0
  234. package/vite.config.js +30 -0
  235. package/docs/index.html +0 -36
  236. package/docs/main-demo.js +0 -2
  237. package/docs/main.js +0 -34
  238. package/docs/pages/base/layout.html +0 -131
  239. package/docs/pages/base/media.html +0 -142
  240. package/docs/pages/base/reset.html +0 -53
  241. package/docs/pages/base/typography.html +0 -334
  242. package/docs/pages/components/button.html +0 -202
  243. package/docs/pages/components/dialog.html +0 -336
  244. package/docs/pages/components/disclosure.html +0 -174
  245. package/docs/pages/components/form.html +0 -427
  246. package/docs/pages/components/loading.html +0 -58
  247. package/docs/pages/components/progress.html +0 -47
  248. package/docs/pages/components/table.html +0 -168
  249. package/docs/pages/customs/badge.html +0 -150
  250. package/docs/pages/customs/breadcrumb.html +0 -67
  251. package/docs/pages/customs/card.html +0 -185
  252. package/docs/pages/customs/drawer.html +0 -149
  253. package/docs/pages/customs/dropdown.html +0 -270
  254. package/docs/pages/customs/grid.html +0 -185
  255. package/docs/pages/customs/list.html +0 -112
  256. package/docs/pages/customs/slider.html +0 -273
  257. package/docs/pages/javascript/autofill.html +0 -170
  258. package/docs/pages/javascript/checkall.html +0 -59
  259. package/docs/pages/javascript/comfort.html +0 -146
  260. package/docs/pages/javascript/consent.html +0 -112
  261. package/docs/pages/javascript/cookie.html +0 -81
  262. package/docs/pages/javascript/form.html +0 -199
  263. package/docs/pages/javascript/scroll.html +0 -209
  264. package/docs/pages/javascript/sortable.html +0 -167
  265. package/docs/pages/javascript/tabpanel.html +0 -89
  266. package/docs/pages/javascript/toggle.html +0 -193
  267. package/docs/pages/javascript/trap.html +0 -89
  268. package/docs/pages/javascript/tree.html +0 -256
  269. package/docs/pages/quick-start/conventions.html +0 -112
  270. package/docs/pages/quick-start/customization.html +0 -184
  271. package/docs/pages/quick-start/installation.html +0 -97
  272. package/docs/pages/quick-start/mixins.html +0 -214
  273. package/docs/src/js/demo.js +0 -110
  274. package/docs/src/js/doc-code.js +0 -102
  275. package/docs/src/js/doc-demo.js +0 -14
  276. package/docs/src/js/doc-layout.js +0 -117
  277. package/docs/src/scss/demo.scss +0 -77
  278. package/docs/src/scss/layout.scss +0 -83
  279. package/docs/src/scss/style.scss +0 -278
  280. package/docs/vite.config.mjs +0 -23
  281. package/esbuild.mjs +0 -25
  282. package/natachah-vanilla-frontend-0.4.0.tgz +0 -0
  283. package/vitest.config.js +0 -8
@@ -0,0 +1,254 @@
1
+ <script setup>
2
+ import ComponentPreview from '../vuejs/ComponentPreview.vue'
3
+ </script>
4
+
5
+ # Button
6
+
7
+ ```scss
8
+ @use '@natachah/vanilla-frontend/scss/components/button'
9
+ ```
10
+
11
+ ## Syntax
12
+
13
+ The button is using the native `<button>` tag, or an `<a>` tag with the attribute `role="button"`.
14
+
15
+ <ComponentPreview>
16
+ <button>Button</button>&nbsp;
17
+ <a href="#" role="button">Link as button</a>
18
+ </ComponentPreview>
19
+
20
+ ::: code-group
21
+
22
+ ```html
23
+ <button>Button</button>
24
+ <a href="#" role="button">Link as button</a>
25
+ ```
26
+
27
+ ```css [css properties]
28
+ --button-color
29
+ --button-background
30
+ --button-border-size
31
+ --button-border-style
32
+ --button-border-color
33
+ --button-border-radius
34
+ --button-padding-inline
35
+ --button-padding-block
36
+ --button-transition
37
+ --button-decoration
38
+ ```
39
+
40
+ :::
41
+
42
+ ## States
43
+
44
+ The button can have multiple states as `:hover`, `:focus`, `:active` and `:disabled`.
45
+
46
+ ### Hover
47
+
48
+ The button use a default focus style, but you can customize it with :
49
+
50
+ ```css
51
+ --button-hover-color
52
+ --button-hover-background
53
+ --button-hover-border-color
54
+ ```
55
+
56
+ ### Focus
57
+
58
+ The button use a default focus style, but you can customize it with :
59
+
60
+ ```css
61
+ --button-focus-color
62
+ --button-focus-background
63
+ --button-focus-border-color
64
+ ```
65
+
66
+ You can also customize the outline :
67
+
68
+ ```css
69
+ --button-outline-size
70
+ --button-outline-style
71
+ --button-outline-color
72
+ --button-outline-offset
73
+ ```
74
+
75
+ ### Active
76
+
77
+ Apply the `aria-pressed`, `aria-current`, or `aria-selected` attribute on the `<button>` or `<a>` tag to display the active style.
78
+
79
+ <ComponentPreview>
80
+ <button aria-pressed="true">Button pressed</button>&nbsp;
81
+ <button aria-selected="true">Button selected</button>&nbsp;
82
+ <a href="#" role="button" aria-current="true">Link as button with current</a>
83
+ </ComponentPreview>
84
+
85
+ ::: code-group
86
+
87
+ ```html
88
+ <button aria-pressed="true">Button pressed</button>
89
+ <button aria-selected="true">Button selected</button>
90
+ <a href="#" role="button" aria-current="true">Link as button with current</a>
91
+ ```
92
+
93
+ ```css [css properties]
94
+ --button-active-color
95
+ --button-active-background
96
+ --button-active-border-color
97
+ ```
98
+
99
+ :::
100
+
101
+ ### Disabled
102
+
103
+ Apply the `disabled` attribute on `<button>` or remove the `href` attribute on `<a>` to display the disabled style.
104
+
105
+ <ComponentPreview>
106
+ <button disabled>Button disabled</button>&nbsp;
107
+ <a role="button" >Link as button disabled</a>
108
+ </ComponentPreview>
109
+
110
+ ::: code-group
111
+
112
+ ```html
113
+ <button disabled>Button disabled</button>
114
+ <a role="button" >Link as button disabled</a>
115
+ ```
116
+
117
+ ```css [css property]
118
+ --button-disabled-opacity
119
+ ```
120
+
121
+ :::
122
+
123
+ ## Variants
124
+
125
+ The button have multiple variations to play with.
126
+
127
+ ### As Link
128
+
129
+ You can create a button that look as a simple link with the attribute `role="link"`.
130
+
131
+ <ComponentPreview>
132
+ <button role="link">As link</button>&nbsp;
133
+ <button role="link" disabled>As disabled link</button>
134
+ </ComponentPreview>
135
+
136
+ ```html
137
+ <button role="link">As link</button>
138
+ <button role="link" disabled>As disabled link</button>
139
+ ```
140
+
141
+ ### Icon
142
+
143
+ You can add an `<svg>` icon inside the button.
144
+
145
+ <ComponentPreview>
146
+ <button>
147
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 8c.828 0 1.5-.895 1.5-2S8.828 4 8 4s-1.5.895-1.5 2S7.172 8 8 8Z" /><path d="M11.953 8.81c-.195-3.388-.968-5.507-1.777-6.819C9.707 1.233 9.23.751 8.857.454a3.495 3.495 0 0 0-.463-.315A2.19 2.19 0 0 0 8.25.064.546.546 0 0 0 8 0a.549.549 0 0 0-.266.073 2.312 2.312 0 0 0-.142.08 3.67 3.67 0 0 0-.459.33c-.37.308-.844.803-1.31 1.57-.805 1.322-1.577 3.433-1.774 6.756l-1.497 1.826-.004.005A2.5 2.5 0 0 0 2 12.202V15.5a.5.5 0 0 0 .9.3l1.125-1.5c.166-.222.42-.4.752-.57.214-.108.414-.192.625-.281l.198-.084c.7.428 1.55.635 2.4.635.85 0 1.7-.207 2.4-.635.067.03.132.056.196.083.213.09.413.174.627.282.332.17.586.348.752.57l1.125 1.5a.5.5 0 0 0 .9-.3v-3.298a2.5 2.5 0 0 0-.548-1.562l-1.499-1.83ZM12 10.445v.055c0 .866-.284 1.585-.75 2.14.146.064.292.13.425.199.39.197.8.46 1.1.86L13 14v-1.798a1.5 1.5 0 0 0-.327-.935L12 10.445ZM4.75 12.64C4.284 12.085 4 11.366 4 10.5v-.054l-.673.82a1.5 1.5 0 0 0-.327.936V14l.225-.3c.3-.4.71-.664 1.1-.861.133-.068.279-.135.425-.199ZM8.009 1.073c.063.04.14.094.226.163.284.226.683.621 1.09 1.28C10.137 3.836 11 6.237 11 10.5c0 .858-.374 1.48-.943 1.893C9.517 12.786 8.781 13 8 13c-.781 0-1.517-.214-2.057-.607C5.373 11.979 5 11.358 5 10.5c0-4.182.86-6.586 1.677-7.928.409-.67.81-1.082 1.096-1.32.09-.076.17-.135.236-.18Z" /><path d="M9.479 14.361c-.48.093-.98.139-1.479.139-.5 0-.999-.046-1.479-.139L7.6 15.8a.5.5 0 0 0 .8 0l1.079-1.439Z" /></svg>
148
+ Button
149
+ </button>
150
+ </ComponentPreview>
151
+
152
+ ```html
153
+ <button>
154
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 8c.828 0 1.5-.895 1.5-2S8.828 4 8 4s-1.5.895-1.5 2S7.172 8 8 8Z" /><path d="M11.953 8.81c-.195-3.388-.968-5.507-1.777-6.819C9.707 1.233 9.23.751 8.857.454a3.495 3.495 0 0 0-.463-.315A2.19 2.19 0 0 0 8.25.064.546.546 0 0 0 8 0a.549.549 0 0 0-.266.073 2.312 2.312 0 0 0-.142.08 3.67 3.67 0 0 0-.459.33c-.37.308-.844.803-1.31 1.57-.805 1.322-1.577 3.433-1.774 6.756l-1.497 1.826-.004.005A2.5 2.5 0 0 0 2 12.202V15.5a.5.5 0 0 0 .9.3l1.125-1.5c.166-.222.42-.4.752-.57.214-.108.414-.192.625-.281l.198-.084c.7.428 1.55.635 2.4.635.85 0 1.7-.207 2.4-.635.067.03.132.056.196.083.213.09.413.174.627.282.332.17.586.348.752.57l1.125 1.5a.5.5 0 0 0 .9-.3v-3.298a2.5 2.5 0 0 0-.548-1.562l-1.499-1.83ZM12 10.445v.055c0 .866-.284 1.585-.75 2.14.146.064.292.13.425.199.39.197.8.46 1.1.86L13 14v-1.798a1.5 1.5 0 0 0-.327-.935L12 10.445ZM4.75 12.64C4.284 12.085 4 11.366 4 10.5v-.054l-.673.82a1.5 1.5 0 0 0-.327.936V14l.225-.3c.3-.4.71-.664 1.1-.861.133-.068.279-.135.425-.199ZM8.009 1.073c.063.04.14.094.226.163.284.226.683.621 1.09 1.28C10.137 3.836 11 6.237 11 10.5c0 .858-.374 1.48-.943 1.893C9.517 12.786 8.781 13 8 13c-.781 0-1.517-.214-2.057-.607C5.373 11.979 5 11.358 5 10.5c0-4.182.86-6.586 1.677-7.928.409-.67.81-1.082 1.096-1.32.09-.076.17-.135.236-.18Z" /><path d="M9.479 14.361c-.48.093-.98.139-1.479.139-.5 0-.999-.046-1.479-.139L7.6 15.8a.5.5 0 0 0 .8 0l1.079-1.439Z" /></svg>
155
+ Button
156
+ </button>
157
+ ```
158
+
159
+ ### Size
160
+
161
+ You can adapte the size of the button by changing their `font-size`.
162
+
163
+ <ComponentPreview>
164
+ <button style="font-size: var(--font-size-small)">Small</button>&nbsp;
165
+ <button>Normal</button>&nbsp;
166
+ <button style="font-size: var(--font-size-large)">Large</button>
167
+ </ComponentPreview>
168
+
169
+ ```html
170
+ <button style="font-size: var(--font-size-small)">Small</button>
171
+ <button>Normal</button>
172
+ <button style="font-size: var(--font-size-large)">Large</button>
173
+ ```
174
+
175
+ ### Outline
176
+
177
+ You can create an outline variation by enable the option and adding the class `.outline`.
178
+
179
+ <ComponentPreview>
180
+ <button class="outline">Button</button>&nbsp;
181
+ <button class="outline" disabled>Disabled</button>&nbsp;
182
+ <button class="outline" aria-pressed="true">Active</button>
183
+ </ComponentPreview>
184
+
185
+ ::: code-group
186
+ ```html
187
+ <button class="outline">Button</button>
188
+ <button class="outline" disabled>Disabled</button>
189
+ <button class="outline" aria-pressed="true">Active</button>
190
+ ```
191
+
192
+ ```scss {2}
193
+ @use "@natachah/vanilla-frontend/scss/components/button" with (
194
+ $outline: true
195
+ );
196
+ ```
197
+ :::
198
+
199
+ ### Color
200
+
201
+ You can create some color variation by including the colors classes name into the import and then by adding the class as `.{COLOR}`.
202
+
203
+ <ComponentPreview>
204
+ <button class="primary">Primary</button>&nbsp;
205
+ <button class="primary" disabled>Disabled</button>&nbsp;
206
+ <button class="primary" aria-pressed="true">Active</button>&nbsp;
207
+ <button class="primary outline">Primary</button>&nbsp;
208
+ <button class="primary outline" disabled>Disabled</button>&nbsp;
209
+ <button class="primary outline" aria-pressed="true">Active</button>
210
+ </ComponentPreview>
211
+
212
+ ::: code-group
213
+ ```html
214
+ <button class="primary">Primary</button>
215
+ <button class="primary" disabled>Disabled</button>
216
+ <button class="primary" aria-pressed="true">Active</button>
217
+ <button class="primary outline">Primary</button>
218
+ <button class="primary outline" disabled>Disabled</button>
219
+ <button class="primary outline" aria-pressed="true">Active</button>
220
+ ```
221
+
222
+ ```scss {2}
223
+ @use "@natachah/vanilla-frontend/scss/components/button" with (
224
+ $colors: ('primary'),
225
+ $outline: true
226
+ );
227
+ ```
228
+ :::
229
+
230
+ ### Group
231
+
232
+ You can group some buttons by putting them in a `<div>` with the class `.group`.
233
+
234
+ <ComponentPreview>
235
+ <div class="group">
236
+ <button class="outline">Button A</button>
237
+ <button class="outline">Button B</button>
238
+ <button class="outline">Button C</button>
239
+ </div>
240
+ </ComponentPreview>
241
+
242
+ ::: code-group
243
+ ```html
244
+ <div class="group">
245
+ <button class="outline">Button A</button>
246
+ <button class="outline">Button B</button>
247
+ <button class="outline">Button C</button>
248
+ </div>
249
+ ```
250
+
251
+ ```scss
252
+ @use '@natachah/vanilla-frontend/scss/components/group';
253
+ ```
254
+ :::
@@ -0,0 +1,223 @@
1
+ <script setup>
2
+ import ComponentPreview from '../vuejs/ComponentPreview.vue'
3
+ </script>
4
+
5
+ # Dialog <Badge type="warning" text="JS" />
6
+
7
+ ```scss
8
+ @use '@natachah/vanilla-frontend/scss/components/dialog';
9
+ ```
10
+
11
+ ::: tip Difference between modal and non-modal:
12
+
13
+ The key difference is the level interaction and interaction restriction. A modal will block interaction with the main content, and they have their own context focus (use of a backdrop). But a non-modal don't impose context and restriction.
14
+ :::
15
+
16
+ ## Syntax
17
+
18
+ The dialog is using the native `<dialog>` tag.
19
+
20
+ You can define if the dialog is a modal with the `aria-modal` attribute.
21
+
22
+ <ComponentPreview height="200px">
23
+ <button aria-controls="myDialog">Open the dialog</button>
24
+ <dialog id="myDialog" aria-label="demo">
25
+ Content of the dialog
26
+ <button data-dialog-close>Close the dialog</button>
27
+ </dialog>
28
+ </ComponentPreview>
29
+
30
+ ::: code-group
31
+
32
+ ```html
33
+ <button aria-controls="myDialog">Open the dialog</button>
34
+ <dialog id="myDialog" aria-modal="true" aria-label="demo">
35
+ Content of the dialog
36
+ <button data-dialog-close>Close the dialog</button>
37
+ </dialog>
38
+ ```
39
+
40
+ ```css [css properties]
41
+ --dialog-color
42
+ --dialog-background
43
+ --dialog-border-size
44
+ --dialog-border-style
45
+ --dialog-border-color
46
+ --dialog-border-radius
47
+ --dialog-padding-inline
48
+ --dialog-padding-block
49
+ --dialog-position
50
+ --dialog-width
51
+ --dialog-height
52
+ --dialog-max-width
53
+ --dialog-max-height
54
+ --dialog-index
55
+ --dialog-backdrop-background
56
+ --dialog-backdrop-filter
57
+ --dialog-open-animation
58
+ --dialog-open-transform
59
+ --dialog-close-animation
60
+ --dialog-close-transform
61
+ --dialog-divider-size
62
+ --dialog-divider-style
63
+ --dialog-divider-color
64
+ ```
65
+
66
+ ```js
67
+ import Dialog from "@natachah/vanilla-frontend/js/_dialog"
68
+ const myDialog = document.getElementById('myDialog')
69
+ if (myDialog) new Dialog(myDialog)
70
+ ```
71
+
72
+ :::
73
+
74
+ To work properly you must have a `<button>` in your page with the attribute `aria-controls="IdOfDialogToOpen"` that will open the dialog.
75
+
76
+ And inside your `<dialog>` you should have a `<button>` with the attribute `data-dialog-close` to close the dialog.
77
+
78
+ For accessibility, don't forget to add a `aria-labelledby` into the `<dialog>` to set a title.
79
+
80
+ ## Layout
81
+
82
+ The dialog can have a `<header>` and/or `<footer>` inside to create a more complexe layout.
83
+
84
+ <ComponentPreview height="400px">
85
+ <button aria-controls="layoutDialog">Open the dialog</button>
86
+ <dialog id="layoutDialog" aria-labelledby="layoutDialogTitle" aria-modal="true">
87
+ <header id="layoutDialogTitle">This is a header</header>
88
+ <div>
89
+ <p>This is the content</p>
90
+ <button data-dialog-close>Close</button>
91
+ </div>
92
+ <footer>This is a footer</footer>
93
+ </dialog>
94
+ </ComponentPreview>
95
+
96
+ ```html
97
+ <dialog id="layoutDialog" aria-labelledby="layoutDialogTitle" aria-modal="true">
98
+ <header id="layoutDialogTitle">This is a header</header>
99
+ <div>
100
+ <p>This is the content</p>
101
+ <button data-dialog-close>Close</button>
102
+ </div>
103
+ <footer>This is a footer</footer>
104
+ </dialog>
105
+ ```
106
+
107
+ ## Form
108
+
109
+ You can submit a `<form>` inside the `<dialog>`.
110
+
111
+ <ComponentPreview height="400px">
112
+ <button aria-controls="formDialog">Open the dialog</button>
113
+ <dialog id="formDialog" aria-labelledby="formDialogTitle" aria-modal="true">
114
+ <h3 id="formDialogTitle">Dialog with form</h3>
115
+ <form method="POST">
116
+ <label for="animal">What is your favorite animal</label>
117
+ <input id="animal" type="text" name="animal" required>
118
+ <button type="reset" data-dialog-close>Cancel</button>
119
+ <button type="submit">Default submit</button>
120
+ </form>
121
+ </dialog>
122
+ </ComponentPreview>
123
+
124
+ ```html
125
+ <dialog id="formDialog" aria-labelledby="formDialogTitle" aria-modal="true">
126
+ <h3 id="formDialogTitle">Dialog with form</h3>
127
+ <form method="POST">
128
+ <label for="animal">What is your favorite animal</label>
129
+ <input id="animal" type="text" name="animal" required>
130
+ <button type="reset" data-dialog-close>Cancel</button>
131
+ <button type="submit">Default submit</button>
132
+ </form>
133
+ </dialog>
134
+ ```
135
+
136
+ If you want to submit via javascript add the `method="dialog"` attribute on the `<form>` or the `formmethod="dialog"` attribute on the `<button>`.
137
+
138
+ Then you should use the event `dialog:submited` to catch the values.
139
+
140
+ <ComponentPreview height="400px">
141
+ <button aria-controls="jsDialog">Open the dialog</button>
142
+ <dialog id="jsDialog" aria-labelledby="jsDialogTitle" aria-modal="true">
143
+ <h3 id="jsDialogTitle">Dialog with form</h3>
144
+ <form method="dialog">
145
+ <label for="animal">What is your favorite animal</label>
146
+ <input id="animal" type="text" name="animal" required>
147
+ <button type="reset" data-dialog-close>Cancel</button>
148
+ <button type="submit">Javascript submit</button>
149
+ </form>
150
+ </dialog>
151
+ <p>Your favorite animal is: <b id="favorite">--</b></p>
152
+ </ComponentPreview>
153
+
154
+ ::: code-group
155
+
156
+ ```html
157
+ <button aria-controls="jsDialog">Open the dialog</button>
158
+ <dialog id="jsDialog" aria-labelledby="jsDialogTitle" aria-modal="true">
159
+ <h3 id="jsDialogTitle">Dialog with form</h3>
160
+ <form method="dialog">
161
+ <label for="animal">What is your favorite animal</label>
162
+ <input id="animal" type="text" name="animal" required>
163
+ <button type="reset" data-dialog-close>Cancel</button>
164
+ <button type="submit">Javascript submit</button>
165
+ </form>
166
+ </dialog>
167
+ <p>Your favorite animal is: <span id="favorite">--</span></p>
168
+ ```
169
+
170
+ ```js {8-12}
171
+ const demoDialogFormJS = document.getElementById('jsDialog')
172
+
173
+ if (demoDialogFormJS) {
174
+
175
+ // Init the dialog
176
+ new Dialog(demoDialogFormJS)
177
+
178
+ // Check for the dialog:submited event
179
+ demoDialogFormJS.addEventListener('dialog:submited', (e) => {
180
+ const value = e.detail.form.querySelector('input').value
181
+ document.getElementById('favorite').innerText = value
182
+ })
183
+
184
+ }
185
+ ```
186
+
187
+ :::
188
+
189
+ ## Javascript
190
+
191
+ To work properly the dialog required some javascript.
192
+
193
+ ### Methods
194
+
195
+ | Method | Description |
196
+ | --- | --- |
197
+ | open(e) | This method will open the dialog |
198
+ | close() | This method will close the dialog |
199
+ | submit() | This method will submit the dialog |
200
+
201
+ ### Events
202
+
203
+ | Event name | Description | Value |
204
+ |---|---|---|
205
+ | dialog:opening | When the method `open()` is called | – |
206
+ | dialog:opened | After the method `open()` is called | – |
207
+ | dialog:closing | When the method `close()` is called | – |
208
+ | dialog:closed | After the method `close()` is called | – |
209
+ | dialog:submiting | When the method `submit()` is called | form as an HTMLElement |
210
+ | dialog:submited | After the method `submit()` is called | form as an HTMLElement |
211
+
212
+ ```js
213
+ // E.G. basic opening
214
+ document.getElementById('myDialogID').addEventListener('dialog:opening', () => {
215
+ console.log('The dialog is opening')
216
+ })
217
+
218
+ // E.G. with form value
219
+ document.getElementById('myDialogID').addEventListener('dialog:submited', (e) => {
220
+ const theHTMLForm = e.detail.form
221
+ console.log('The dialog is submited')
222
+ })
223
+ ```
@@ -0,0 +1,169 @@
1
+ <script setup>
2
+ import ComponentPreview from '../vuejs/ComponentPreview.vue'
3
+ </script>
4
+
5
+ # Disclosure
6
+
7
+ ```scss
8
+ @use '@natachah/vanilla-frontend/scss/components/disclosure';
9
+ ```
10
+
11
+ ## Syntax
12
+
13
+ The disclosure is using the native `<details>` and `<summary>` tags.
14
+
15
+ <ComponentPreview height="200">
16
+ <details>
17
+ <summary>
18
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"></path>
19
+ </svg>
20
+ Title
21
+ </summary>
22
+ <div>
23
+ Content
24
+ </div>
25
+ </details>
26
+ </ComponentPreview>
27
+
28
+ ::: code-group
29
+
30
+ ```html
31
+ <details>
32
+ <summary>
33
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z"></path></svg>
34
+ Title
35
+ </summary>
36
+ <div>
37
+ Content
38
+ </div>
39
+ </details>
40
+ ```
41
+
42
+ ```css [css properties]
43
+ --disclosure-color
44
+ --disclosure-background
45
+ --disclosure-border-size
46
+ --disclosure-border-style
47
+ --disclosure-border-color
48
+ --disclosure-border-radius
49
+ --disclosure-padding-inline
50
+ --disclosure-padding-block
51
+ --disclosure-transition
52
+ --disclosure-decoration
53
+ --disclosure-svg-transform
54
+ ```
55
+
56
+ :::
57
+
58
+ ::: tip
59
+ It's recommended to add a `<div>` around the inside content for better design.
60
+ :::
61
+
62
+ ## States
63
+
64
+ The `<summary>` can have multiple states as `:hover`, `:focus`, and`:active`.
65
+
66
+ ### Hover
67
+
68
+ The `<summary>` use a default focus style, but you can customize it with :
69
+
70
+ ```css
71
+ --disclosure-hover-color
72
+ --disclosure-hover-background
73
+ --disclosure-hover-border-color
74
+ ```
75
+
76
+ ### Focus
77
+
78
+ The `<summary>` use a default focus style, but you can customize it with :
79
+
80
+ ```css
81
+ --disclosure-focus-color
82
+ --disclosure-focus-background
83
+ --disclosure-focus-border-color
84
+ ```
85
+
86
+ You can also customize the outline :
87
+
88
+ ```css
89
+ --disclosure-outline-size
90
+ --disclosure-outline-style
91
+ --disclosure-outline-color
92
+ --disclosure-outline-offset
93
+ ```
94
+
95
+ ### Active
96
+
97
+ The active state is automatically displayed when the disclosure is `open`.
98
+
99
+ ```css
100
+ --disclosure-active-color
101
+ --disclosure-active-background
102
+ --disclosure-active-border-color
103
+ ```
104
+
105
+ ## Variants
106
+
107
+ The disclosure has a variation to play with.
108
+
109
+ ### Accordion
110
+
111
+ You can group some disclosures by putting them in a `<div>` with the class `.accordion`.
112
+
113
+ <ComponentPreview height="250px">
114
+ <div class="accordion" style="--disclosure-border-color:black">
115
+ <details>
116
+ <summary >
117
+ Disclosure A
118
+ </summary>
119
+ <div>
120
+ AAA
121
+ </div>
122
+ </details>
123
+ <details>
124
+ <summary>
125
+ Disclosure B
126
+ </summary>
127
+ <div>
128
+ BBB
129
+ </div>
130
+ </details>
131
+ <details>
132
+ <summary>
133
+ Disclosure C
134
+ </summary>
135
+ <div>
136
+ CCC
137
+ </div>
138
+ </details>
139
+ </div>
140
+ </ComponentPreview>
141
+
142
+ ```html
143
+ <div class="accordion" style="--disclosure-border-color:black">
144
+ <details>
145
+ <summary>
146
+ Disclosure A
147
+ </summary>
148
+ <div>
149
+ AAA
150
+ </div>
151
+ </details>
152
+ <details>
153
+ <summary>
154
+ Disclosure B
155
+ </summary>
156
+ <div>
157
+ BBB
158
+ </div>
159
+ </details>
160
+ <details>
161
+ <summary>
162
+ Disclosure C
163
+ </summary>
164
+ <div>
165
+ CCC
166
+ </div>
167
+ </details>
168
+ </div>
169
+ ```