@natachah/vanilla-frontend 0.1.19 → 0.1.20
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/docs/pages/components/form.html +52 -31
- package/docs/pages/layouts/grid.html +21 -3
- package/docs/pages/quick-start/installation.html +1 -0
- package/docs/src/js/doc-code.js +1 -1
- package/docs/src/js/doc-layout.js +1 -1
- package/docs/src/scss/layout.scss +0 -4
- package/natachah-vanilla-frontend-0.1.20.tgz +0 -0
- package/package.json +1 -1
- package/scss/components/_form.scss +15 -0
- package/scss/layouts/_grid.scss +2 -5
- package/natachah-vanilla-frontend-0.1.19.tgz +0 -0
|
@@ -288,22 +288,38 @@
|
|
|
288
288
|
<h3>Validation</h3>
|
|
289
289
|
<p>Use the <code>aria-invalid</code> attribute to display the element as in/valid and use <code>aria-describedby</code> attribute with a <code><small></code> tag to display the information.</p>
|
|
290
290
|
<blockquote class="warning">
|
|
291
|
-
<p>As every design is different, there is
|
|
291
|
+
<p>As every design is different, there is not too much default style for in/valid elements. But for accessibility don't forget to add icons to show the errors.</p>
|
|
292
292
|
</blockquote>
|
|
293
293
|
|
|
294
294
|
<doc-demo>
|
|
295
|
-
<
|
|
296
|
-
<
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
<
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
295
|
+
<form action="#">
|
|
296
|
+
<div>
|
|
297
|
+
<label for="invalidInput">Invalid input</label>
|
|
298
|
+
<input id="invalidInput" type="text" aria-describedby="invalidMsg" aria-invalid="true" value="My bad value">
|
|
299
|
+
<small id="invalidMsg">
|
|
300
|
+
<span aria-live="assertive">
|
|
301
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
302
|
+
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
|
|
303
|
+
<path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z" />
|
|
304
|
+
</svg>
|
|
305
|
+
Incorrect value !
|
|
306
|
+
</span>
|
|
307
|
+
</small>
|
|
308
|
+
</div>
|
|
309
|
+
<div>
|
|
310
|
+
<label for="validInput">Valid input</label>
|
|
311
|
+
<input id="validInput" type="text" aria-describedby="validMsg" aria-invalid="false" value="My good value">
|
|
312
|
+
<small id="validMsg">
|
|
313
|
+
<span aria-live="assertive">
|
|
314
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
315
|
+
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16" />
|
|
316
|
+
<path d="m10.97 4.97-.02.022-3.473 4.425-2.093-2.094a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05" />
|
|
317
|
+
</svg>
|
|
318
|
+
All good !
|
|
319
|
+
</span>
|
|
320
|
+
</small>
|
|
321
|
+
</div>
|
|
322
|
+
</form>
|
|
307
323
|
</doc-demo>
|
|
308
324
|
|
|
309
325
|
<div class="code-group">
|
|
@@ -312,28 +328,33 @@
|
|
|
312
328
|
<button role="tab" aria-controls="scss">SCSS</button>
|
|
313
329
|
</div>
|
|
314
330
|
<doc-code id="html" data-type="html" role="tabpanel">
|
|
315
|
-
<
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
<
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
<
|
|
323
|
-
<
|
|
324
|
-
|
|
331
|
+
<div>
|
|
332
|
+
<label for="invalidInput">Invalid input</label>
|
|
333
|
+
<input id="invalidInput" type="text" aria-describedby="invalidMsg" aria-invalid="true" value="My bad value">
|
|
334
|
+
<small id="invalidMsg">
|
|
335
|
+
<span aria-live="assertive">Incorrect value !</span>
|
|
336
|
+
</small>
|
|
337
|
+
</div>
|
|
338
|
+
<div>
|
|
339
|
+
<label for="validInput">Valid input</label>
|
|
340
|
+
<input id="validInput" type="text" aria-describedby="validMsg" aria-invalid="false" value="My good value">
|
|
341
|
+
<small id="validMsg">
|
|
342
|
+
<span aria-live="assertive">All good !</span>
|
|
343
|
+
</small>
|
|
344
|
+
</div>
|
|
325
345
|
</doc-code>
|
|
326
|
-
<doc-code id="scss" data-type="
|
|
327
|
-
form {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
--form-border-color: var(--color-error);
|
|
331
|
-
|
|
332
|
-
> label,
|
|
333
|
-
> small {
|
|
346
|
+
<doc-code id="scss" data-type="scss" role="tabpanel">
|
|
347
|
+
form div {
|
|
348
|
+
&:has([aria-invalid=true]) {
|
|
349
|
+
[aria-live] {
|
|
334
350
|
color: var(--color-error);
|
|
335
351
|
}
|
|
352
|
+
}
|
|
336
353
|
|
|
354
|
+
&:has([aria-invalid=false]) {
|
|
355
|
+
[aria-live] {
|
|
356
|
+
color: var(--color-success);
|
|
357
|
+
}
|
|
337
358
|
}
|
|
338
359
|
}
|
|
339
360
|
</doc-code>
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
<h2 id="flex-grid">Flex grid</h2>
|
|
66
66
|
|
|
67
67
|
<p>You can create a flexible grid via the <code>.flex-grid</code> class.</p>
|
|
68
|
-
|
|
69
68
|
<p>This method is more for <b>flexible</b> layout with a random number of items to display.</p>
|
|
70
69
|
|
|
71
70
|
<doc-demo>
|
|
@@ -106,7 +105,26 @@
|
|
|
106
105
|
|
|
107
106
|
<p>Both of them can be responsive by changing the CSS custom property <code>--grid-columns</code> inside a <code>@media</code> or a <code>@container</code>.</p>
|
|
108
107
|
|
|
109
|
-
<
|
|
108
|
+
<h3>Auto-fill</h3>
|
|
109
|
+
|
|
110
|
+
<p>With <code>.grid</code> you can add an auto layout with a maximum column size by changing the CSS custom properties <code>--grid-columns:auto-fill</code> and <code>--grid-column-size</code> and .</p>
|
|
111
|
+
|
|
112
|
+
<doc-demo>
|
|
113
|
+
<div class="grid" style="--grid-columns: auto-fill; --grid-column-size: 270px">
|
|
114
|
+
<div>1</div>
|
|
115
|
+
<div>2</div>
|
|
116
|
+
<div>3</div>
|
|
117
|
+
<div>4</div>
|
|
118
|
+
<div>5</div>
|
|
119
|
+
<div>6</div>
|
|
120
|
+
<div>7</div>
|
|
121
|
+
<div>8</div>
|
|
122
|
+
<div>9</div>
|
|
123
|
+
<div>10</div>
|
|
124
|
+
<div>11</div>
|
|
125
|
+
<div>12</div>
|
|
126
|
+
</div>
|
|
127
|
+
</doc-demo>
|
|
110
128
|
|
|
111
129
|
<h2>Columns</h2>
|
|
112
130
|
|
|
@@ -191,7 +209,7 @@
|
|
|
191
209
|
--grid-align
|
|
192
210
|
--grid-columns
|
|
193
211
|
--grid-grow /* only for .flex-grid */
|
|
194
|
-
|
|
212
|
+
--grid-column-size /* only for .grid */
|
|
195
213
|
</doc-code>
|
|
196
214
|
|
|
197
215
|
</doc-layout>
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
@use '@natachah/vanilla-frontend/scss/components/_card';
|
|
47
47
|
@use '@natachah/vanilla-frontend/scss/components/_dialog';
|
|
48
48
|
@use '@natachah/vanilla-frontend/scss/components/_disclosure';
|
|
49
|
+
@use '@natachah/vanilla-frontend/scss/components/_drawer';
|
|
49
50
|
@use '@natachah/vanilla-frontend/scss/components/_dropdown';
|
|
50
51
|
@use '@natachah/vanilla-frontend/scss/components/_form';
|
|
51
52
|
@use '@natachah/vanilla-frontend/scss/components/_grid';
|
package/docs/src/js/doc-code.js
CHANGED
|
@@ -61,7 +61,7 @@ class DocCode extends HTMLElement {
|
|
|
61
61
|
const type = this.getAttribute('data-type') ?? 'html'
|
|
62
62
|
|
|
63
63
|
// Clean the code
|
|
64
|
-
let content = type === 'html'
|
|
64
|
+
let content = type === 'html' ? this.innerHTML : this.textContent
|
|
65
65
|
var pattern = content.match(/\s*\n[\t\s]*/)
|
|
66
66
|
content = content.replace(new RegExp(pattern, "g"), '\n').replaceAll('=""', '')
|
|
67
67
|
content = content.trim()
|
|
@@ -18,7 +18,7 @@ class DocLayout extends HTMLElement {
|
|
|
18
18
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-pin-angle" viewBox="0 0 16 16">
|
|
19
19
|
<path d="M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a6 6 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.902-1.414.707s.512-1.22.707-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a6 6 0 0 1 1.013.16l3.134-3.133a3 3 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146m.122 2.112v-.002zm0-.002v.002a.5.5 0 0 1-.122.51L6.293 6.878a.5.5 0 0 1-.511.12H5.78l-.014-.004a5 5 0 0 0-.288-.076 5 5 0 0 0-.765-.116c-.422-.028-.836.008-1.175.15l5.51 5.509c.141-.34.177-.753.149-1.175a5 5 0 0 0-.192-1.054l-.004-.013v-.001a.5.5 0 0 1 .12-.512l3.536-3.535a.5.5 0 0 1 .532-.115l.096.022c.087.017.208.034.344.034q.172.002.343-.04L9.927 2.028q-.042.172-.04.343a1.8 1.8 0 0 0 .062.46z"/>
|
|
20
20
|
</svg>
|
|
21
|
-
0.1.
|
|
21
|
+
0.1.20
|
|
22
22
|
</span>
|
|
23
23
|
</li>
|
|
24
24
|
<li>
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -195,4 +195,19 @@ select {
|
|
|
195
195
|
background-position: calc(100% - .125em) center;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
form div {
|
|
202
|
+
&:has([aria-invalid=true]) {
|
|
203
|
+
[aria-live] {
|
|
204
|
+
color: var(--color-error);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
&:has([aria-invalid=false]) {
|
|
209
|
+
[aria-live] {
|
|
210
|
+
color: var(--color-success);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
198
213
|
}
|
package/scss/layouts/_grid.scss
CHANGED
|
@@ -13,26 +13,23 @@
|
|
|
13
13
|
|
|
14
14
|
.grid,
|
|
15
15
|
.flex-grid {
|
|
16
|
-
|
|
17
16
|
gap: var(--grid-gap-block, 1rem) var(--grid-gap-inline, 1rem);
|
|
18
17
|
justify-content: var(--grid-justify, start);
|
|
19
18
|
align-items: var(--grid-align, initial);
|
|
20
|
-
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
.grid {
|
|
24
22
|
display: grid;
|
|
25
|
-
grid-template-columns: repeat(var(--grid-columns, 12), minmax(0
|
|
23
|
+
grid-template-columns: repeat(var(--grid-columns, 12), minmax(min(var(--grid-column-size, 0%), 100%), 1fr));
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
.flex-grid {
|
|
29
|
-
|
|
30
27
|
display: flex;
|
|
31
28
|
flex-wrap: wrap;
|
|
32
29
|
|
|
33
30
|
> * {
|
|
34
31
|
$column: var(--grid-columns, 12);
|
|
35
|
-
flex-basis: calc((1
|
|
32
|
+
flex-basis: calc((1 * 100% - (($column - 1) * var(--grid-gap-inline, 1rem))) / $column);
|
|
36
33
|
flex-grow: var(--grid-grow, 0);
|
|
37
34
|
}
|
|
38
35
|
|
|
Binary file
|