@natachah/vanilla-frontend 0.0.2
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 +40 -0
- package/LICENSE.md +7 -0
- package/README.md +11 -0
- package/docs/index.html +36 -0
- package/docs/main.js +32 -0
- package/docs/pages/components/badge.html +154 -0
- package/docs/pages/components/button.html +186 -0
- package/docs/pages/components/card.html +184 -0
- package/docs/pages/components/dialog.html +334 -0
- package/docs/pages/components/disclosure.html +310 -0
- package/docs/pages/components/dropdown.html +255 -0
- package/docs/pages/components/form.html +331 -0
- package/docs/pages/components/list.html +140 -0
- package/docs/pages/components/loading.html +58 -0
- package/docs/pages/components/media.html +130 -0
- package/docs/pages/components/nav.html +119 -0
- package/docs/pages/components/progress.html +47 -0
- package/docs/pages/components/slider.html +311 -0
- package/docs/pages/components/table.html +168 -0
- package/docs/pages/javascript/autofill.html +170 -0
- package/docs/pages/javascript/checkall.html +59 -0
- package/docs/pages/javascript/comfort.html +134 -0
- package/docs/pages/javascript/consent.html +112 -0
- package/docs/pages/javascript/cookie.html +81 -0
- package/docs/pages/javascript/form.html +199 -0
- package/docs/pages/javascript/scroll.html +209 -0
- package/docs/pages/javascript/sidebar.html +53 -0
- package/docs/pages/javascript/sortable.html +148 -0
- package/docs/pages/javascript/toggle.html +191 -0
- package/docs/pages/javascript/tree.html +221 -0
- package/docs/pages/layout/grid.html +201 -0
- package/docs/pages/layout/reset.html +53 -0
- package/docs/pages/layout/typography.html +324 -0
- package/docs/pages/quick-start/conventions.html +112 -0
- package/docs/pages/quick-start/customization.html +187 -0
- package/docs/pages/quick-start/installation.html +95 -0
- package/docs/pages/quick-start/mixins.html +228 -0
- package/docs/pages/test.html +15 -0
- package/docs/src/js/demo.js +98 -0
- package/docs/src/js/doc-code.js +102 -0
- package/docs/src/js/doc-demo.js +14 -0
- package/docs/src/js/doc-layout.js +108 -0
- package/docs/src/scss/demo.scss +77 -0
- package/docs/src/scss/layout.scss +160 -0
- package/docs/src/scss/style.scss +278 -0
- package/docs/vite.config.mjs +23 -0
- package/esbuild.mjs +25 -0
- package/js/_autofill.js +131 -0
- package/js/_check-all.js +77 -0
- package/js/_comfort.js +174 -0
- package/js/_consent.js +84 -0
- package/js/_dialog.js +164 -0
- package/js/_dropdown.js +101 -0
- package/js/_scroll.js +184 -0
- package/js/_sidebar.js +97 -0
- package/js/_slider.js +249 -0
- package/js/_sortable.js +143 -0
- package/js/_tabpanel.js +88 -0
- package/js/_toggle.js +123 -0
- package/js/_tree.js +85 -0
- package/js/tests/autofill.test.js +157 -0
- package/js/tests/base-component.test.js +108 -0
- package/js/tests/check-all.test.js +88 -0
- package/js/tests/comfort.test.js +219 -0
- package/js/tests/consent.test.js +84 -0
- package/js/tests/cookie.test.js +102 -0
- package/js/tests/dialog.test.js +189 -0
- package/js/tests/dropdown.test.js +115 -0
- package/js/tests/form-helper.test.js +155 -0
- package/js/tests/scroll.test.js +203 -0
- package/js/tests/sidebar.test.js +99 -0
- package/js/tests/slider.test.js +307 -0
- package/js/tests/sortable.test.js +124 -0
- package/js/tests/tabpanel.test.js +114 -0
- package/js/tests/toggle.test.js +190 -0
- package/js/tests/tree.test.js +165 -0
- package/js/utilities/_base-component.js +101 -0
- package/js/utilities/_cookie.js +98 -0
- package/js/utilities/_error.js +80 -0
- package/js/utilities/_form-helper.js +101 -0
- package/package.json +42 -0
- package/scss/_badge.scss +37 -0
- package/scss/_button.scss +34 -0
- package/scss/_card.scss +122 -0
- package/scss/_dialog.scss +116 -0
- package/scss/_disclosure.scss +101 -0
- package/scss/_dropdown.scss +68 -0
- package/scss/_form.scss +197 -0
- package/scss/_grid.scss +40 -0
- package/scss/_group.scss +57 -0
- package/scss/_list.scss +18 -0
- package/scss/_loading.scss +49 -0
- package/scss/_media.scss +37 -0
- package/scss/_nav.scss +72 -0
- package/scss/_progress.scss +40 -0
- package/scss/_slider.scss +35 -0
- package/scss/_table.scss +36 -0
- package/scss/utilities/_mixin.scss +322 -0
- package/scss/utilities/_reset.scss +145 -0
- package/scss/utilities/_typography.scss +107 -0
- package/scss/vanilla-frontend.scss +23 -0
- package/scss/variables/_root.scss +70 -0
- package/scss/variables/_setting.scss +63 -0
- package/vitest.config.js +7 -0
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
image: node:latest
|
|
2
|
+
|
|
3
|
+
before_script:
|
|
4
|
+
- npm install
|
|
5
|
+
- npm ci
|
|
6
|
+
|
|
7
|
+
stages:
|
|
8
|
+
- test
|
|
9
|
+
- build
|
|
10
|
+
- deploy
|
|
11
|
+
|
|
12
|
+
unit-test-job:
|
|
13
|
+
stage: test
|
|
14
|
+
rules:
|
|
15
|
+
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
|
16
|
+
script:
|
|
17
|
+
- npm test
|
|
18
|
+
|
|
19
|
+
pages:
|
|
20
|
+
stage: build
|
|
21
|
+
script:
|
|
22
|
+
- npm run docs:build
|
|
23
|
+
- rm -rf public
|
|
24
|
+
- mkdir public
|
|
25
|
+
- cp -a docs/dist/* public/
|
|
26
|
+
artifacts:
|
|
27
|
+
paths:
|
|
28
|
+
# The folder that contains the files to be exposed at the Page URL
|
|
29
|
+
- public
|
|
30
|
+
rules:
|
|
31
|
+
- if: $CI_COMMIT_REF_NAME == "production"
|
|
32
|
+
|
|
33
|
+
publish-job:
|
|
34
|
+
stage: deploy
|
|
35
|
+
environment: production
|
|
36
|
+
rules:
|
|
37
|
+
- if: $CI_COMMIT_REF_NAME == "production"
|
|
38
|
+
script:
|
|
39
|
+
- echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
|
|
40
|
+
- npm publish --access public
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2024 Natacha Herth
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Vanilla Frontend
|
|
2
|
+
|
|
3
|
+
A simple and minimal framework that prioritize semantic HTML and accessibility.
|
|
4
|
+
|
|
5
|
+
Quickly start a new project with a clean design and a minimal override for customization.
|
|
6
|
+
|
|
7
|
+
More info on the(https://vanilla-frontend-packages4913705-8c38a44c52586aedf08b2939a0529c.gitlab.io/)[DOC]
|
|
8
|
+
|
|
9
|
+
## Bug or suggestion
|
|
10
|
+
|
|
11
|
+
Please report any bug of issues on (https://gitlab.com/packages4913705/vanilla-frontend/-/issues)[Gitlab] or send me an email !
|
package/docs/index.html
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Documentations: Components ></title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body data-preload>
|
|
11
|
+
|
|
12
|
+
<doc-layout>
|
|
13
|
+
|
|
14
|
+
<h1>A simple <span style="color: var(--color-primary)">Vanilla Frontend</span> framework</h1>
|
|
15
|
+
|
|
16
|
+
<p>Here let me explain a little more about my framework and how to use it :-)</p>
|
|
17
|
+
|
|
18
|
+
<h2>Why a new framework</h2>
|
|
19
|
+
|
|
20
|
+
<p>A lot or framework are too heavy or too minimal, and more important a lot of them don't prioritize semantic HTML.</p>
|
|
21
|
+
|
|
22
|
+
<p>I wanted to be able to quickly start a new project with a clean design and a minimal override for customization.</p>
|
|
23
|
+
|
|
24
|
+
<blockquote>
|
|
25
|
+
<p>And must important to keep it accessible and Vanilla !</p>
|
|
26
|
+
</blockquote>
|
|
27
|
+
|
|
28
|
+
<p>As a visual imparaired person, I know how much it can be difficult to find a good website with good semantic and/or with the ability to change some basic styling as the font size.</p>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
</doc-layout>
|
|
32
|
+
|
|
33
|
+
<script type="module" src="/main.js"></script>
|
|
34
|
+
</body>
|
|
35
|
+
|
|
36
|
+
</html>
|
package/docs/main.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Import main css
|
|
2
|
+
import './../scss/vanilla-frontend.scss'
|
|
3
|
+
|
|
4
|
+
// HERE go the code
|
|
5
|
+
import './src/js/doc-layout.js'
|
|
6
|
+
import './src/js/doc-demo.js'
|
|
7
|
+
import './src/js/doc-code.js'
|
|
8
|
+
import './src/js/demo.js'
|
|
9
|
+
|
|
10
|
+
import './src/scss/layout.scss'
|
|
11
|
+
import './src/scss/style.scss'
|
|
12
|
+
import './src/scss/demo.scss'
|
|
13
|
+
|
|
14
|
+
// Prevent first animation
|
|
15
|
+
setTimeout(() => { document.body.removeAttribute('data-preload') }, 10)
|
|
16
|
+
|
|
17
|
+
// Set the current navigation
|
|
18
|
+
const current = window.location.pathname
|
|
19
|
+
|
|
20
|
+
if (current.startsWith('/pages/')) document.querySelectorAll(`#sidebar a[href*="${current}"]`).forEach(elem => {
|
|
21
|
+
elem.setAttribute('aria-current', 'page')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// My awsome sidebar !!!
|
|
25
|
+
import Sidebar from './../js/_sidebar.js'
|
|
26
|
+
const sidebar = document.getElementById('sidebar')
|
|
27
|
+
if (sidebar) new Sidebar(sidebar)
|
|
28
|
+
|
|
29
|
+
// Code group
|
|
30
|
+
import Tabpanel from './../js/_tabpanel.js'
|
|
31
|
+
const tabpanels = document.querySelectorAll('.code-group')
|
|
32
|
+
if (tabpanels) tabpanels.forEach(tabpanel => new Tabpanel(tabpanel))
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Documentations: Components > Badge</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body data-preload>
|
|
11
|
+
<doc-layout>
|
|
12
|
+
|
|
13
|
+
<h1>Badge</h1>
|
|
14
|
+
|
|
15
|
+
<p>The badge is using a <code><span></code> tag with the class <code>.badge</code>.</p>
|
|
16
|
+
|
|
17
|
+
<doc-demo>
|
|
18
|
+
<span class="badge">Badge</span>
|
|
19
|
+
</doc-demo>
|
|
20
|
+
|
|
21
|
+
<div class="code-group">
|
|
22
|
+
<div role="tablist">
|
|
23
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
24
|
+
<button role="tab" aria-controls="scss">SCSS</button>
|
|
25
|
+
<button role="tab" aria-controls="css">CSS</button>
|
|
26
|
+
</div>
|
|
27
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
28
|
+
<span class="badge">Badge</span>
|
|
29
|
+
</doc-code>
|
|
30
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
31
|
+
@import '@natachah/vanilla-frontend/scss/_badge';
|
|
32
|
+
</doc-code>
|
|
33
|
+
<doc-code id="css" data-type="css" role="tabpanel">
|
|
34
|
+
--badge-color
|
|
35
|
+
--badge-background
|
|
36
|
+
--badge-border-size
|
|
37
|
+
--badge-border-style
|
|
38
|
+
--badge-border-color
|
|
39
|
+
--badge-border-radius
|
|
40
|
+
--badge-padding-inline
|
|
41
|
+
--badge-padding-block
|
|
42
|
+
--badge-font-size
|
|
43
|
+
</doc-code>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<h2>Icon and size</h2>
|
|
47
|
+
|
|
48
|
+
<p>You can add an <code><svg></code> icon inside the badge.</p>
|
|
49
|
+
|
|
50
|
+
<doc-demo>
|
|
51
|
+
<span class="badge">
|
|
52
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
53
|
+
<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" />
|
|
54
|
+
<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" />
|
|
55
|
+
<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" />
|
|
56
|
+
</svg>
|
|
57
|
+
Badge
|
|
58
|
+
</span>
|
|
59
|
+
</doc-demo>
|
|
60
|
+
|
|
61
|
+
<p>You can adapte the size of the badge by changing their <code>font-size</code>.</p>
|
|
62
|
+
|
|
63
|
+
<doc-demo>
|
|
64
|
+
<span class="badge" style="font-size: .75em">Small</span>
|
|
65
|
+
<span class="badge">Normal</span>
|
|
66
|
+
<span class="badge" style="font-size: var(--font-size-large)">Large</span>
|
|
67
|
+
</doc-demo>
|
|
68
|
+
|
|
69
|
+
<blockquote>
|
|
70
|
+
<p>By default the badge have a font-size set at <code>.875em</code>.</p>
|
|
71
|
+
</blockquote>
|
|
72
|
+
|
|
73
|
+
<h2>Variants</h2>
|
|
74
|
+
|
|
75
|
+
<h3>Outline</h3>
|
|
76
|
+
|
|
77
|
+
<p>You can create an outline variation by adding the class <code>.outline</code>.</p>
|
|
78
|
+
|
|
79
|
+
<doc-demo>
|
|
80
|
+
<span class="badge outline">Badge</span>
|
|
81
|
+
</doc-demo>
|
|
82
|
+
|
|
83
|
+
<div class="code-group">
|
|
84
|
+
<div role="tablist">
|
|
85
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
86
|
+
<button role="tab" aria-controls="scss">setting.scss</button>
|
|
87
|
+
</div>
|
|
88
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
89
|
+
<span class="badge outline">Badge</span>
|
|
90
|
+
</doc-code>
|
|
91
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
92
|
+
$outline-variations: (
|
|
93
|
+
badge
|
|
94
|
+
);
|
|
95
|
+
</doc-code>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<h3>Color</h3>
|
|
99
|
+
|
|
100
|
+
<p>You can create a color variation by adding the class <code>.{COLOR}</code>.</p>
|
|
101
|
+
|
|
102
|
+
<doc-demo>
|
|
103
|
+
<span class="badge primary">Primary</span> <span class="badge outline primary">Outline</span>
|
|
104
|
+
</doc-demo>
|
|
105
|
+
|
|
106
|
+
<div class="code-group">
|
|
107
|
+
<div role="tablist">
|
|
108
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
109
|
+
<button role="tab" aria-controls="scss">setting.scss</button>
|
|
110
|
+
</div>
|
|
111
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
112
|
+
<span class="badge primary">Primary</span>
|
|
113
|
+
<span class="badge outline primary">Outline</span>
|
|
114
|
+
</doc-code>
|
|
115
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
116
|
+
$color-variations: (
|
|
117
|
+
badge: (primary)
|
|
118
|
+
);
|
|
119
|
+
</doc-code>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<h3>Group</h3>
|
|
123
|
+
<p>You can group some badges by putting them in a <code><div></code> with the class <code>.group</code>.</p>
|
|
124
|
+
|
|
125
|
+
<doc-demo>
|
|
126
|
+
<div class="group">
|
|
127
|
+
<span class="badge">Badge A</span>
|
|
128
|
+
<span class="badge">Badge B</span>
|
|
129
|
+
<span class="badge">Badge C</span>
|
|
130
|
+
</div>
|
|
131
|
+
</doc-demo>
|
|
132
|
+
|
|
133
|
+
<div class="code-group">
|
|
134
|
+
<div role="tablist">
|
|
135
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
136
|
+
<button role="tab" aria-controls="scss">SCSS</button>
|
|
137
|
+
</div>
|
|
138
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
139
|
+
<div class="group">
|
|
140
|
+
<span class="badge">Badge A</span>
|
|
141
|
+
<span class="badge">Badge B</span>
|
|
142
|
+
<span class="badge">Badge C</span>
|
|
143
|
+
</div>
|
|
144
|
+
</doc-code>
|
|
145
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
146
|
+
@import '@natachah/vanilla-frontend/scss/_group';
|
|
147
|
+
</doc-code>
|
|
148
|
+
</div>
|
|
149
|
+
|
|
150
|
+
</doc-layout>
|
|
151
|
+
<script type="module" src="/main.js"></script>
|
|
152
|
+
</body>
|
|
153
|
+
|
|
154
|
+
</html>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Documentations: Components > Button</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body data-preload>
|
|
11
|
+
<doc-layout>
|
|
12
|
+
|
|
13
|
+
<h1>Button</h1>
|
|
14
|
+
<p>The button is using the native <code><button></code> tag, or an <code><a></code> tag with the attribute <code>role="button"</code>.</p>
|
|
15
|
+
|
|
16
|
+
<doc-demo>
|
|
17
|
+
<button>Button</button>
|
|
18
|
+
<a href="#" role="button">Link as button</a>
|
|
19
|
+
</doc-demo>
|
|
20
|
+
|
|
21
|
+
<div class="code-group">
|
|
22
|
+
<div role="tablist">
|
|
23
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
24
|
+
<button role="tab" aria-controls="scss">SCSS</button>
|
|
25
|
+
<button role="tab" aria-controls="css">CSS</button>
|
|
26
|
+
</div>
|
|
27
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
28
|
+
<button>Button</button>
|
|
29
|
+
<a href="#" role="button">Link as button</a>
|
|
30
|
+
</doc-code>
|
|
31
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
32
|
+
@import '@natachah/vanilla-frontend/scss/_button';
|
|
33
|
+
</doc-code>
|
|
34
|
+
<doc-code id="css" data-type="css" role="tabpanel">
|
|
35
|
+
--button-color
|
|
36
|
+
--button-background
|
|
37
|
+
--button-border-size
|
|
38
|
+
--button-border-style
|
|
39
|
+
--button-border-color
|
|
40
|
+
--button-border-radius
|
|
41
|
+
--button-padding-inline
|
|
42
|
+
--button-padding-block
|
|
43
|
+
--button-transition
|
|
44
|
+
--button-decoration
|
|
45
|
+
--button-focus-size
|
|
46
|
+
--button-focus-style
|
|
47
|
+
--button-focus-color
|
|
48
|
+
--button-focus-offset
|
|
49
|
+
--button-hover-color
|
|
50
|
+
--button-hover-background
|
|
51
|
+
--button-hover-border-color
|
|
52
|
+
--button-active-color
|
|
53
|
+
--button-active-background
|
|
54
|
+
--button-active-border-color
|
|
55
|
+
--button-disabled-opacity
|
|
56
|
+
</doc-code>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<h2>Icon and size</h2>
|
|
60
|
+
<p>You can add an <code><svg></code> icon inside the button.</p>
|
|
61
|
+
|
|
62
|
+
<doc-demo>
|
|
63
|
+
<button>
|
|
64
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
65
|
+
<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" />
|
|
66
|
+
<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" />
|
|
67
|
+
<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" />
|
|
68
|
+
</svg>
|
|
69
|
+
Button
|
|
70
|
+
</button>
|
|
71
|
+
</doc-demo>
|
|
72
|
+
|
|
73
|
+
<p>You can adapte the size of the button by changing their <code>font-size</code>.</p>
|
|
74
|
+
|
|
75
|
+
<doc-demo>
|
|
76
|
+
<button style="font-size: var(--font-size-small)">Small</button>
|
|
77
|
+
<button>Normal</button>
|
|
78
|
+
<button style="font-size: var(--font-size-large)">Large</button>
|
|
79
|
+
</doc-demo>
|
|
80
|
+
|
|
81
|
+
<h2>States</h2>
|
|
82
|
+
<p>The button can have multiple states as <code>:focus</code>, <code>:hover</code>, <code>:active</code> and <code>:disabled</code></p>
|
|
83
|
+
|
|
84
|
+
<h3>Active</h3>
|
|
85
|
+
<p>Apply the <code>aria-pressed</code>, <code>aria-current</code>, or <code>aria-selected</code> attribute on the <code><button></code> or <code><a></code> tag to display the active style.</p>
|
|
86
|
+
<doc-demo>
|
|
87
|
+
<button aria-pressed="true">Button</button>
|
|
88
|
+
<a href="#" role="button" aria-current="true">Link as button</a>
|
|
89
|
+
</doc-demo>
|
|
90
|
+
|
|
91
|
+
<h3>Disabled</h3>
|
|
92
|
+
<p>Apply the <code>disabled</code> attribute on <code><button></code> or remove the <code>href</code> attribute on <code><a></code> to display the disabled style.</p>
|
|
93
|
+
<doc-demo>
|
|
94
|
+
<button disabled>Button</button>
|
|
95
|
+
<a role="button">Link as button</a>
|
|
96
|
+
</doc-demo>
|
|
97
|
+
|
|
98
|
+
<h2>Variants</h2>
|
|
99
|
+
|
|
100
|
+
<h3>Outline</h3>
|
|
101
|
+
|
|
102
|
+
<p>You can create an outline variation by adding the class <code>.outline</code>.</p>
|
|
103
|
+
|
|
104
|
+
<doc-demo>
|
|
105
|
+
<button class="outline">Button</button>
|
|
106
|
+
<button class="outline" disabled>Disabled</button>
|
|
107
|
+
<button class="outline" aria-pressed="true">Active</button>
|
|
108
|
+
</doc-demo>
|
|
109
|
+
|
|
110
|
+
<div class="code-group">
|
|
111
|
+
<div role="tablist">
|
|
112
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
113
|
+
<button role="tab" aria-controls="scss">setting.scss</button>
|
|
114
|
+
</div>
|
|
115
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
116
|
+
<button class="outline">Button</button>
|
|
117
|
+
<button class="outline" disabled>Disabled</button>
|
|
118
|
+
<button class="outline" aria-pressed="true">Active</button>
|
|
119
|
+
</doc-code>
|
|
120
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
121
|
+
$outline-variations: (
|
|
122
|
+
button
|
|
123
|
+
);
|
|
124
|
+
</doc-code>
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<h3>Color</h3>
|
|
128
|
+
|
|
129
|
+
<p>You can create a color variation by adding the class <code>.{COLOR}</code>.</p>
|
|
130
|
+
|
|
131
|
+
<doc-demo>
|
|
132
|
+
<button class="primary">Primary</button> <button class="outline primary">Outline</button> <button class="primary" disabled>Disabled</button> <button class="primary" aria-pressed="true">Active</button>
|
|
133
|
+
</doc-demo>
|
|
134
|
+
|
|
135
|
+
<div class="code-group">
|
|
136
|
+
<div role="tablist">
|
|
137
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
138
|
+
<button role="tab" aria-controls="scss">setting.scss</button>
|
|
139
|
+
</div>
|
|
140
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
141
|
+
<button class="primary">Primary</button>
|
|
142
|
+
<button class="outline primary">Outline</button>
|
|
143
|
+
<button class="primary" disabled>Disabled</button>
|
|
144
|
+
<button class="primary" aria-pressed="true">Active</button>
|
|
145
|
+
</doc-code>
|
|
146
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
147
|
+
$color-variations: (
|
|
148
|
+
button: (primary)
|
|
149
|
+
);
|
|
150
|
+
</doc-code>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<h3>Group</h3>
|
|
154
|
+
<p>You can group some badge by putting them in a <code><div></code> with the class <code>.group</code>.</p>
|
|
155
|
+
|
|
156
|
+
<doc-demo>
|
|
157
|
+
<div class="group">
|
|
158
|
+
<button>Button A</button>
|
|
159
|
+
<button>Button B</button>
|
|
160
|
+
<button>Button C</button>
|
|
161
|
+
</div>
|
|
162
|
+
</doc-demo>
|
|
163
|
+
|
|
164
|
+
<div class="code-group">
|
|
165
|
+
<div role="tablist">
|
|
166
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
167
|
+
<button role="tab" aria-controls="scss">SCSS</button>
|
|
168
|
+
</div>
|
|
169
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
170
|
+
<div class="group">
|
|
171
|
+
<button>Button A</button>
|
|
172
|
+
<button>Button B</button>
|
|
173
|
+
<button>Button C</button>
|
|
174
|
+
</div>
|
|
175
|
+
</doc-code>
|
|
176
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
177
|
+
@import '@natachah/vanilla-frontend/scss/_group';
|
|
178
|
+
</doc-code>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
</doc-layout>
|
|
183
|
+
<script type="module" src="/main.js"></script>
|
|
184
|
+
</body>
|
|
185
|
+
|
|
186
|
+
</html>
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Documentations: Components > Card</title>
|
|
8
|
+
</head>
|
|
9
|
+
|
|
10
|
+
<body data-preload>
|
|
11
|
+
<doc-layout>
|
|
12
|
+
|
|
13
|
+
<h1>Card</h1>
|
|
14
|
+
|
|
15
|
+
<p>The card is using a <code><div></code> or an <code><article></code> tag with the class <code>.card</code>.</p>
|
|
16
|
+
|
|
17
|
+
<doc-demo>
|
|
18
|
+
<div class="card">Hello there !</div>
|
|
19
|
+
</doc-demo>
|
|
20
|
+
|
|
21
|
+
<div class="code-group">
|
|
22
|
+
<div role="tablist">
|
|
23
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
24
|
+
<button role="tab" aria-controls="scss">SCSS</button>
|
|
25
|
+
<button role="tab" aria-controls="css">CSS</button>
|
|
26
|
+
</div>
|
|
27
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
28
|
+
<div class="card">Hello there !</div>
|
|
29
|
+
</doc-code>
|
|
30
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
31
|
+
@import '@natachah/vanilla-frontend/scss/_card';
|
|
32
|
+
</doc-code>
|
|
33
|
+
<doc-code id="css" data-type="css" role="tabpanel">
|
|
34
|
+
--card-color
|
|
35
|
+
--card-background
|
|
36
|
+
--card-border-size
|
|
37
|
+
--card-border-style
|
|
38
|
+
--card-border-color
|
|
39
|
+
--card-border-radius
|
|
40
|
+
--card-padding-inline
|
|
41
|
+
--card-padding-block
|
|
42
|
+
--card-divider-size
|
|
43
|
+
--card-divider-style
|
|
44
|
+
--card-divider-color
|
|
45
|
+
</doc-code>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<h2>Layout</h2>
|
|
49
|
+
|
|
50
|
+
<p>The card can have a <code><header></code> and/or <code><footer></code> inside to create a more complexe layout.</p>
|
|
51
|
+
|
|
52
|
+
<doc-demo>
|
|
53
|
+
<article class="card">
|
|
54
|
+
<header>Header</header>
|
|
55
|
+
<p>Content</p>
|
|
56
|
+
<footer>Footer</footer>
|
|
57
|
+
</article>
|
|
58
|
+
</doc-demo>
|
|
59
|
+
|
|
60
|
+
<doc-code>
|
|
61
|
+
<article class="card">
|
|
62
|
+
<header>Header</header>
|
|
63
|
+
<p>Content</p>
|
|
64
|
+
<footer>Footer</footer>
|
|
65
|
+
</article>
|
|
66
|
+
</doc-code>
|
|
67
|
+
|
|
68
|
+
<p>You also can add a <code><picture></code> on the top, center or bottom of a card.</p>
|
|
69
|
+
|
|
70
|
+
<doc-demo>
|
|
71
|
+
<div class="card">
|
|
72
|
+
<picture>
|
|
73
|
+
<img src="https://picsum.photos/400/200" srcset="https://picsum.photos/800/400 2x" alt="My random image from lorem picsum">
|
|
74
|
+
</picture>
|
|
75
|
+
<h3>Title of the card</h3>
|
|
76
|
+
<p>Content of the card</p>
|
|
77
|
+
</div>
|
|
78
|
+
</doc-demo>
|
|
79
|
+
|
|
80
|
+
<doc-code>
|
|
81
|
+
<div class="card">
|
|
82
|
+
<picture>
|
|
83
|
+
<img src="https://picsum.photos/400/200" srcset="https://picsum.photos/800/400 2x" alt="My random image from lorem picsum">
|
|
84
|
+
</picture>
|
|
85
|
+
<h3>Title of the card</h3>
|
|
86
|
+
<p>Content of the card</p>
|
|
87
|
+
</div>
|
|
88
|
+
</doc-code>
|
|
89
|
+
|
|
90
|
+
<blockquote class="warning">
|
|
91
|
+
<p>You can't use directly <code><img></code> tag because of CSS bug.</p>
|
|
92
|
+
</blockquote>
|
|
93
|
+
|
|
94
|
+
<p>The card is compatible with the components <b>group</b> and <b>list</b></p>
|
|
95
|
+
|
|
96
|
+
<doc-demo>
|
|
97
|
+
<div class="card">
|
|
98
|
+
<h3>Mycard</h3>
|
|
99
|
+
<p>Content of the card</p>
|
|
100
|
+
<div class="group">
|
|
101
|
+
<button>Button A</button>
|
|
102
|
+
<button>Button B</button>
|
|
103
|
+
</div>
|
|
104
|
+
<p>Content of the card</p>
|
|
105
|
+
<ul class="list">
|
|
106
|
+
<li>List D</li>
|
|
107
|
+
<li><a>List E</a></li>
|
|
108
|
+
<li><a href="#">List F</a></li>
|
|
109
|
+
</ul>
|
|
110
|
+
</div>
|
|
111
|
+
</doc-demo>
|
|
112
|
+
|
|
113
|
+
<doc-code>
|
|
114
|
+
<div class="card">
|
|
115
|
+
<h3>Mycard</h3>
|
|
116
|
+
<p>Content of the card</p>
|
|
117
|
+
<div class="group">
|
|
118
|
+
<button>Button A</button>
|
|
119
|
+
<button>Button B</button>
|
|
120
|
+
</div>
|
|
121
|
+
<p>Content of the card</p>
|
|
122
|
+
<ul class="list">
|
|
123
|
+
<li>List D</li>
|
|
124
|
+
<li><a>List E</a></li>
|
|
125
|
+
<li><a href="#">List F</a></li>
|
|
126
|
+
</ul>
|
|
127
|
+
</div>
|
|
128
|
+
</doc-code>
|
|
129
|
+
|
|
130
|
+
<h2 id="variants">Variants</h2>
|
|
131
|
+
|
|
132
|
+
<h3>Outline</h3>
|
|
133
|
+
|
|
134
|
+
<p>You can create an outline variation by adding the class <code>.outline</code>.</p>
|
|
135
|
+
|
|
136
|
+
<doc-demo>
|
|
137
|
+
<div class="card outline">Hello there !</div>
|
|
138
|
+
</doc-demo>
|
|
139
|
+
|
|
140
|
+
<div class="code-group">
|
|
141
|
+
<div role="tablist">
|
|
142
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
143
|
+
<button role="tab" aria-controls="scss">setting.scss</button>
|
|
144
|
+
</div>
|
|
145
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
146
|
+
<div class="card outline">Hello there !</div>
|
|
147
|
+
</doc-code>
|
|
148
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
149
|
+
$outline-variations: (
|
|
150
|
+
card
|
|
151
|
+
);
|
|
152
|
+
</doc-code>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
<h3>Color</h3>
|
|
156
|
+
|
|
157
|
+
<p>You can create a color variation by adding the class <code>.{COLOR}</code>.</p>
|
|
158
|
+
|
|
159
|
+
<doc-demo>
|
|
160
|
+
<div class="card primary">Hello there !</div>
|
|
161
|
+
<div class="card outline primary" style="margin-top:1rem">Hello there !</div>
|
|
162
|
+
</doc-demo>
|
|
163
|
+
|
|
164
|
+
<div class="code-group">
|
|
165
|
+
<div role="tablist">
|
|
166
|
+
<button role="tab" aria-controls="html">HTML</button>
|
|
167
|
+
<button role="tab" aria-controls="scss">setting.scss</button>
|
|
168
|
+
</div>
|
|
169
|
+
<doc-code id="html" data-type="html" role="tabpanel">
|
|
170
|
+
<div class="card primary">Hello there !</div>
|
|
171
|
+
<div class="card outline primary">Hello there !</div>
|
|
172
|
+
</doc-code>
|
|
173
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
174
|
+
$color-variations: (
|
|
175
|
+
card: (primary)
|
|
176
|
+
);
|
|
177
|
+
</doc-code>
|
|
178
|
+
</div>
|
|
179
|
+
|
|
180
|
+
</doc-layout>
|
|
181
|
+
<script type="module" src="/main.js"></script>
|
|
182
|
+
</body>
|
|
183
|
+
|
|
184
|
+
</html>
|