@natachah/vanilla-frontend 0.1.5 → 0.1.6

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.
@@ -96,6 +96,10 @@
96
96
  --anchor-hover-color
97
97
  --anchor-active-color
98
98
  --anchor-disabled-opacity
99
+ --anchor-focus-size
100
+ --anchor-focus-style
101
+ --anchor-focus-color
102
+ --anchor-focus-offset
99
103
  </doc-code>
100
104
  </div>
101
105
 
@@ -151,7 +151,7 @@
151
151
  </doc-code>
152
152
  <doc-code id="scss" data-type="scss" role="tabpanel">
153
153
  $outline-variations: (
154
- card
154
+ card
155
155
  );
156
156
  </doc-code>
157
157
  </div>
@@ -176,7 +176,7 @@
176
176
  </doc-code>
177
177
  <doc-code id="scss" data-type="scss" role="tabpanel">
178
178
  $color-variations: (
179
- card: (primary)
179
+ card: (primary)
180
180
  );
181
181
  </doc-code>
182
182
  </div>
@@ -27,7 +27,7 @@
27
27
  <doc-demo>
28
28
  <button aria-controls="demoDialog">Open the dialog</button>
29
29
  <dialog id="demoDialog" class="demo-dialog">
30
- <h3>Hey this is a dialog as non-modal !</h3>
30
+ <h3 tabindex="0">Hey this is a dialog as non-modal !</h3>
31
31
  <p>Hello there !</p>
32
32
  <button data-dialog-close>Close the dialog</button>
33
33
  </dialog>
@@ -82,6 +82,8 @@
82
82
  </doc-code>
83
83
  </div>
84
84
 
85
+ <blockquote class="note">Add a <code>tabindex="0"</code> to the heading to focus on it when opened !</blockquote>
86
+
85
87
  <p>To work properly you must have a <code>&lt;button&gt;</code> in your page with the attribute <code>aria-controls=&quot;IdOfDialogToOpen&quot;</code> that will open the dialog.</p>
86
88
  <p>And inside your <code>&lt;dialog&gt;</code> you should have a <code>&lt;button&gt;</code> with the attribute <code>data-dialog-close</code> to close the dialog.</p>
87
89
 
@@ -92,7 +94,7 @@
92
94
  <doc-demo>
93
95
  <button aria-controls="demoDialogLayout">Open the dialog</button>
94
96
  <dialog id="demoDialogLayout" class="demo-dialog" aria-modal="true">
95
- <header>This is a header</header>
97
+ <header tabindex="0">This is a header</header>
96
98
  <div>
97
99
  <p>This is the content</p>
98
100
  <p>This dialog is a modal</p>
@@ -104,7 +106,7 @@
104
106
 
105
107
  <doc-code>
106
108
  <dialog id="myDialog" class="demo-dialog" aria-modal="true">
107
- <header>This is a header</header>
109
+ <header tabindex="0">This is a header</header>
108
110
  <div>
109
111
  <p>This is the content</p>
110
112
  <button data-dialog-close>Close</button>
@@ -182,11 +184,11 @@
182
184
  <doc-code id="js" data-type="js" role="tabpanel">
183
185
  const demoDialogFormJS = document.getElementById('myDialog')
184
186
  if (demoDialogFormJS) {
185
- new Dialog(demoDialogFormJS)
186
- demoDialogFormJS.addEventListener('dialog:submited', (e) => {
187
- const value = e.detail.form.querySelector('input').value
188
- document.getElementById('favorite').innerText = value
189
- })
187
+ new Dialog(demoDialogFormJS)
188
+ demoDialogFormJS.addEventListener('dialog:submited', (e) => {
189
+ const value = e.detail.form.querySelector('input').value
190
+ document.getElementById('favorite').innerText = value
191
+ })
190
192
  }
191
193
  </doc-code>
192
194
  </div>
@@ -316,13 +318,13 @@
316
318
  <doc-code data-type="js">
317
319
  // E.G. basic opening
318
320
  document.getElementById('myDialogID').addEventListener('dialog:opening', () => {
319
- console.log('The dialog is opening')
321
+ console.log('The dialog is opening')
320
322
  })
321
323
 
322
324
  // E.G. with form value
323
325
  document.getElementById('myDialogID').addEventListener('dialog:submited', (e) => {
324
- const theHTMLForm = e.detail.form
325
- ...
326
+ const theHTMLForm = e.detail.form
327
+ ...
326
328
  })
327
329
  </doc-code>
328
330
 
@@ -126,7 +126,7 @@
126
126
  </doc-code>
127
127
  <doc-code id="scss" data-type="scss" role="tabpanel">
128
128
  $outline-variations: (
129
- list
129
+ list
130
130
  );
131
131
  </doc-code>
132
132
  </div>
@@ -161,7 +161,7 @@
161
161
  </doc-code>
162
162
  <doc-code id="scss" data-type="scss" role="tabpanel">
163
163
  $color-variations: (
164
- list: (primary)
164
+ list: (primary)
165
165
  );
166
166
  </doc-code>
167
167
  </div>
@@ -14,10 +14,10 @@
14
14
  <p>The scroll component make you able to add some <code>&lt;button&gt;</code> to go on the top or bottom of an element.</p>
15
15
  <doc-demo>
16
16
  <nav id="demoScrollNav">
17
- <ul>
18
- <li><a href="#target1" aria-current="location">One</a></li>
19
- <li><a href="#target2">Two</a></li>
20
- <li><a href="#target3">Three</a></li>
17
+ <ul class="list">
18
+ <li><a role="button" href="#target1" aria-current="location">One</a></li>
19
+ <li><a role="button" href="#target2">Two</a></li>
20
+ <li><a role="button" href="#target3">Three</a></li>
21
21
  <li><button data-scroll-bottom="demoScrollSpy">Scroll to the bottom</button></li>
22
22
  <li><button data-scroll-top="demoScrollSpy">Scroll to the top</button></li>
23
23
  </ul>
@@ -76,8 +76,8 @@
76
76
  <doc-code data-type="js">
77
77
  const myPanel = document.getElementById('myPanel')
78
78
  myPanel.addEventListener('tabpanel:changed', (e) => {
79
- const thecurrentButton = e.detail.current
80
- console.log('It has changed !')
79
+ const thecurrentButton = e.detail.current
80
+ console.log('It has changed !')
81
81
  })
82
82
  </doc-code>
83
83
 
@@ -15,7 +15,7 @@
15
15
  <p>The button must have an <code>aria-controls=&quot;IdOfElement&quot;</code>, an <code>aria-expanded</code> and a <code>aria-pressed</code> attributes.</p>
16
16
  <doc-demo>
17
17
  <button class="demo-toggle" aria-controls="collapse" aria-expanded="false" aria-pressed="false">Toggle</button>
18
- <div id="collapse" hidden>
18
+ <div id="collapse" tabindex="0" hidden>
19
19
  Hello there !
20
20
  </div>
21
21
  </doc-demo>
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
  <doc-code id="html" data-type="html" role="tabpanel">
29
29
  <button id="toggle" aria-controls="collapse" aria-expanded="false" aria-pressed="false">Toggle</button>
30
- <div id="collapse" hidden>
30
+ <div id="collapse" tabindex="0" hidden>
31
31
  Hello there !
32
32
  </div>
33
33
  </doc-code>
@@ -179,7 +179,7 @@
179
179
  <doc-code data-type="js">
180
180
  const myToggle = document.getElementById('myToggle')
181
181
  myToggle.addEventListener('toggle:changed', () => {
182
- console.log('It has changed !')
182
+ console.log('It has changed !')
183
183
  })
184
184
  </doc-code>
185
185
 
@@ -24,13 +24,13 @@
24
24
  <button role="link" aria-controls="treelist" aria-expanded="false">
25
25
  1: Inventore, perspiciatis (Open)
26
26
  </button>
27
- <ul id="treelist" hidden>
27
+ <ul id="treelist" tabindex="0" hidden>
28
28
  <li>2: Lorem</li>
29
29
  <li>
30
30
  <button role="link" aria-controls="subtreelist" aria-expanded="false">
31
31
  2: Adipisci (Open)
32
32
  </button>
33
- <ul id="subtreelist" hidden>
33
+ <ul id="subtreelist" tabindex="0" hidden>
34
34
  <li>3: Lorem</li>
35
35
  <li>3: Adipisci</li>
36
36
  <li>3: Facilis</li>
@@ -55,13 +55,13 @@
55
55
  <button role="link" aria-controls="treelist" aria-expanded="false">
56
56
  1: Inventore, perspiciatis (Open)
57
57
  </button>
58
- <ul id="treelist" hidden>
58
+ <ul id="treelist" tabindex="0" hidden>
59
59
  <li>2: Lorem</li>
60
60
  <li>
61
61
  <button role="link" aria-controls="subtreelist" aria-expanded="false">
62
62
  2: Adipisci (Open)
63
63
  </button>
64
- <ul id="subtreelist" hidden>
64
+ <ul id="subtreelist" tabindex="0" hidden>
65
65
  <li>3: Lorem</li>
66
66
  <li>3: Adipisci</li>
67
67
  <li>3: Facilis</li>
@@ -94,13 +94,13 @@
94
94
  <tr aria-level="1" aria-expanded="false" aria-controls="row1 row2 row3">
95
95
  <td>1: Cum, dolorum (open me)</td>
96
96
  </tr>
97
- <tr id="row1" aria-level="2" hidden>
97
+ <tr id="row1" aria-level="2" tabindex="0" hidden>
98
98
  <td>2: Lorem</td>
99
99
  </tr>
100
100
  <tr id="row2" aria-level="2" aria-expanded="false" aria-controls="row2-1 row2-2" hidden>
101
101
  <td>2: Quo (open me)</td>
102
102
  </tr>
103
- <tr id="row2-1" aria-level="3" hidden>
103
+ <tr id="row2-1" aria-level="3" tabindex="0" hidden>
104
104
  <td>2.1: Quo</td>
105
105
  </tr>
106
106
  <tr id="row2-2" aria-level="3" hidden>
@@ -125,13 +125,13 @@
125
125
  <tr aria-level="1" aria-expanded="false" aria-controls="row1 row2 row3">
126
126
  <td>1: Cum, dolorum (open me)</td>
127
127
  </tr>
128
- <tr id="row1" aria-level="2" hidden>
128
+ <tr id="row1" aria-level="2" tabindex="0" hidden>
129
129
  <td>2: Lorem</td>
130
130
  </tr>
131
131
  <tr id="row2" aria-level="2" aria-expanded="false" aria-controls="row2-1 row2-2" hidden>
132
132
  <td>2: Quo (open me)</td>
133
133
  </tr>
134
- <tr id="row2-1" aria-level="3" hidden>
134
+ <tr id="row2-1" aria-level="3" tabindex="0" hidden>
135
135
  <td>2.1: Quo</td>
136
136
  </tr>
137
137
  <tr id="row2-2" aria-level="3" hidden>
@@ -159,15 +159,12 @@
159
159
  <tr aria-level="1" aria-expanded="false" aria-controls="rowExpandable">
160
160
  <td>
161
161
  <span data-handle="tree">
162
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
163
- <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>
164
- </svg>
165
162
  (open me)
166
163
  </span>
167
164
  </td>
168
165
  <td>1: Cum, dolorum</td>
169
166
  </tr>
170
- <tr id="rowExpandable" aria-level="2" hidden>
167
+ <tr id="rowExpandable" aria-level="2" tabindex="0" hidden>
171
168
  <td></td>
172
169
  <td>1.1: Lorem</td>
173
170
  </tr>
@@ -188,7 +185,7 @@
188
185
  </td>
189
186
  <td>1: Cum, dolorum</td>
190
187
  </tr>
191
- <tr id="rowExpandable" aria-level="2" hidden>
188
+ <tr id="rowExpandable" aria-level="2" tabindex="0" hidden>
192
189
  <td></td>
193
190
  <td>1.1: Lorem</td>
194
191
  </tr>
@@ -28,60 +28,69 @@
28
28
  <doc-code data-type="scss">
29
29
  :root {
30
30
 
31
- // Typography
32
- --font-size: 16px;
33
- --line-height: 1.5;
34
- --font-family: Arial;
35
- --font-weight: normal;
36
-
37
- --font-size-h1: 2.25em; // 36px
38
- --font-size-h2: 2.00em; // 32px
39
- --font-size-h3: 1.75em; // 28px
40
- --font-size-h4: 1.50em; // 24px
41
- --font-size-h5: 1.25em; // 20px
42
- --font-size-h6: 1.125em; // 18px
43
- --font-size-large: 1.125em; // 18px
44
- --font-size-small: .875em; // 14px
45
-
46
- // Anchor
47
- --decoration: none;
48
-
49
- // Layouts
50
- --padding-inline: .75em;
51
- --padding-block: .5em;
52
-
53
- // Border
54
- --border-size: 1px;
55
- --border-style: solid;
56
- --border-radius: .25rem;
57
-
58
- // Focus (outline)
59
- --focus-size: 3px;
60
- --focus-style: solid;
61
- --focus-offset: 0;
62
- --focus-opacity: 50%;
63
-
64
- // Hover (color-mix)
65
- --hover-color: black;
66
- --hover-percent: 5%;
67
-
68
- // Active (color-mix)
69
- --active-color: black;
70
- --active-percent: 10%;
71
-
72
- // Disabled
73
- --disabled-opacity: 50%;
74
-
75
- // Colors
76
- --color-body: white;
77
- --color-font: black;
78
- --color-primary: #B790E5;
79
- --color-error: #DC3030;
80
- --color-success: #008A00;
81
- --color-warning: #FFA500;
82
-
83
- // Contrasts
84
- --color-warning-contrast: black;
31
+ // Typography
32
+ --font-size: 16px;
33
+ --line-height: 1.5;
34
+ --font-family: Arial;
35
+ --font-weight: normal;
36
+
37
+ --font-size-h1: 2.25em; // 36px
38
+ --font-size-h2: 2.00em; // 32px
39
+ --font-size-h3: 1.75em; // 28px
40
+ --font-size-h4: 1.50em; // 24px
41
+ --font-size-h5: 1.25em; // 20px
42
+ --font-size-h6: 1.125em; // 18px
43
+ --font-size-large: 1.125em; // 18px
44
+ --font-size-small: .875em; // 14px
45
+
46
+ // Anchor
47
+ --decoration: none;
48
+
49
+ // Layouts
50
+ --padding-inline: .75em;
51
+ --padding-block: .5em;
52
+
53
+ // Border
54
+ --border-size: 1px;
55
+ --border-style: solid;
56
+ --border-radius: .25rem;
57
+
58
+ // Focus (outline)
59
+ --focus-size: 3px;
60
+ --focus-style: solid;
61
+ --focus-offset: 0;
62
+ --focus-opacity: 50%;
63
+
64
+ // Hover (color-mix)
65
+ --hover-color: black;
66
+ --hover-percent: 5%;
67
+
68
+ // Active (color-mix)
69
+ --active-color: black;
70
+ --active-percent: 10%;
71
+
72
+ // Disabled
73
+ --disabled-opacity: 50%;
74
+
75
+ // Colors
76
+ --color-body: white;
77
+ --color-font: black;
78
+ --color-primary: #B790E5;
79
+ --color-error: #DC3030;
80
+ --color-success: #008A00;
81
+ --color-warning: #FFA500;
82
+
83
+ // Contrasts
84
+ --color-warning-contrast: black;
85
+
86
+ // Icons
87
+ --icon-date: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" viewBox="0 0 16 16"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z" /></svg>');
88
+ --icon-time: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M8 3.5a.5.5 0 0 0-1 0V9a.5.5 0 0 0 .252.434l3.5 2a.5.5 0 0 0 .496-.868L8 8.71V3.5z" /><path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm7-8A7 7 0 1 1 1 8a7 7 0 0 1 14 0z" /></svg>');
89
+ --icon-file: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" /><path d="M7.646 1.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1-.708.708L8.5 2.707V11.5a.5.5 0 0 1-1 0V2.707L5.354 4.854a.5.5 0 1 1-.708-.708l3-3z" /></svg>');
90
+ --icon-select: url('data:image/svg+xml,<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" /></svg>');
91
+ --icon-radio: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="white" viewBox="0 0 16 16"><circle cx="8" cy="8" r="8" /></svg>');
92
+ --icon-check: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="white" viewBox="0 0 16 16"><path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z" /></svg>');
93
+ --icon-switch: var(--icon-radio);
85
94
 
86
95
  }
87
96
  </doc-code>
@@ -129,28 +138,28 @@
129
138
  <doc-code data-type="scss">
130
139
  @forward '@natachah/vanilla-frontend/scss/abstracts/_options.scss' with (
131
140
 
132
- $colors: (
133
- primary,
134
- success,
135
- error,
136
- warning
137
- );
138
-
139
- $color-variations: (
140
- badge: $colors,
141
- button: $colors,
142
- card: $colors,
143
- disclosure: $colors,
144
- list: $colors
145
- );
146
-
147
- $outline-variations: (
148
- badge,
149
- button,
150
- card,
151
- disclosure,
152
- list
153
- );
141
+ $colors: (
142
+ primary,
143
+ success,
144
+ error,
145
+ warning
146
+ );
147
+
148
+ $color-variations: (
149
+ badge: $colors,
150
+ button: $colors,
151
+ card: $colors,
152
+ disclosure: $colors,
153
+ list: $colors
154
+ );
155
+
156
+ $outline-variations: (
157
+ badge,
158
+ button,
159
+ card,
160
+ disclosure,
161
+ list
162
+ );
154
163
  );
155
164
  </doc-code>
156
165
 
@@ -164,16 +173,16 @@
164
173
 
165
174
  <doc-code data-type="scss">
166
175
  @use '@natachah/vanilla-frontend/scss/abstracts/_default.scss' with (
167
- $item-properties: (
168
- color: var(--color-font),
169
- background: transparent,
170
- border-size: var(--border-size),
171
- border-style: var(--border-style),
172
- border-color: transparent,
173
- border-radius: var(--border-radius),
174
- padding-inline: var(--padding-inline),
175
- padding-block: var(--padding-block)
176
- );
176
+ $item-properties: (
177
+ color: var(--color-font),
178
+ background: transparent,
179
+ border-size: var(--border-size),
180
+ border-style: var(--border-style),
181
+ border-color: transparent,
182
+ border-radius: var(--border-radius),
183
+ padding-inline: var(--padding-inline),
184
+ padding-block: var(--padding-block)
185
+ );
177
186
  );
178
187
  </doc-code>
179
188
 
@@ -80,6 +80,7 @@
80
80
  import Consent from "@natachah/vanilla-frontend/js/_consent"
81
81
  import Dialog from "@natachah/vanilla-frontend/js/_dialog"
82
82
  import Dropdown from "@natachah/vanilla-frontend/js/_dropdown"
83
+ import Drawer from "@natachah/vanilla-frontend/js/_drawer"
83
84
  import Scroll from "@natachah/vanilla-frontend/js/_scroll"
84
85
  import Slider from "@natachah/vanilla-frontend/js/_slider"
85
86
  import Sortable from "@natachah/vanilla-frontend/js/_sortable"
@@ -113,7 +113,7 @@
113
113
  </doc-code>
114
114
  <doc-code id="setting" data-type="scss" role="tabpanel">
115
115
  $outline-variations: (
116
- my-component-name
116
+ my-component-name
117
117
  );
118
118
  </doc-code>
119
119
  </div>
@@ -144,7 +144,7 @@
144
144
  </doc-code>
145
145
  <doc-code id="setting" data-type="scss" role="tabpanel">
146
146
  $color-variations: (
147
- my-component-name: (primary, other-color)
147
+ my-component-name: (primary, other-color)
148
148
  );
149
149
  </doc-code>
150
150
  </div>
@@ -185,9 +185,9 @@
185
185
  </doc-code>
186
186
  <doc-code id="scss" data-type="scss" role="tabpanel">
187
187
  @container (max-width:800px) {
188
- table {
189
- @include as-responsive-table()
190
- }
188
+ table {
189
+ @include as-responsive-table()
190
+ }
191
191
  }
192
192
  </doc-code>
193
193
  <doc-code id="css" data-type="css" role="tabpanel">
@@ -219,11 +219,11 @@
219
219
  </doc-code>
220
220
  <doc-code id="scss" data-type="scss" role="tabpanel">
221
221
  #wider {
222
- @include flex-grid-wider-column(3)
222
+ @include flex-grid-wider-column(3)
223
223
  }
224
224
 
225
225
  #offset {
226
- @include flex-grid-offset-column(2)
226
+ @include flex-grid-offset-column(2)
227
227
  }
228
228
  </doc-code>
229
229
  </div>
@@ -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' ? this.innerHTML : this.textContent
64
+ let content = type === 'html' || type === 'scss' ? 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.5
21
+ 0.1.6
22
22
  </span>
23
23
  </li>
24
24
  <li>
package/js/_toggle.js CHANGED
@@ -103,6 +103,8 @@ export default class Toggle extends BaseComponent {
103
103
  // Toggle the [hidden] attribute
104
104
  toggable.hidden = this.value !== toggleValue && groupValue !== toggleValue
105
105
 
106
+ if (!toggable.hidden && toggable.hasAttribute('tabindex')) toggable.focus()
107
+
106
108
  })
107
109
 
108
110
  // Update the [aria-expanded] attribute if there is any toggables visible
package/js/_tree.js CHANGED
@@ -72,6 +72,12 @@ export default class Tree extends BaseComponent {
72
72
  // Toggle the [hidden] attribute on the children
73
73
  children.forEach(child => child.hidden = isExpanded)
74
74
 
75
+ // Set the focus on the required child
76
+ if (!isExpanded) {
77
+ const childToFocus = children.find(el => el.hasAttribute('tabindex')) ?? null
78
+ if (childToFocus) childToFocus.focus()
79
+ }
80
+
75
81
  // If type grid, collapse the subchildren
76
82
  if (this._type === 'grid' && isExpanded) children.filter(child => child.hasAttribute('aria-expanded') && child.getAttribute('aria-expanded') === 'true').forEach(child => this.toggle(child))
77
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natachah/vanilla-frontend",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "A vanilla frontend framework",
5
5
  "keywords": [
6
6
  "html5",
@@ -65,45 +65,37 @@ summary {
65
65
  }
66
66
 
67
67
  // Force the hidden
68
- [hidden] {
68
+ [hidden=true],
69
+ [hidden=""] {
69
70
  display: none !important;
70
71
  }
71
72
 
73
+ // Change cursor for item with aria-control or data-handle
74
+ [aria-controls]:not(:has([data-handle])),
75
+ [data-handle] {
76
+ cursor: pointer;
77
+ }
78
+
72
79
  // Change cursor for draggable
73
80
  [draggable] {
74
81
 
75
- &:not(:has([data-handle])),
76
- [data-handle] {
82
+ &:not(:has([data-handle=sortable])),
83
+ [data-handle=sortable] {
77
84
  cursor: grab;
78
85
  }
79
86
 
80
87
  &[aria-grabbed=true],
81
- &[aria-grabbed=true] [data-handle] {
88
+ &[aria-grabbed=true] [data-handle=sortable] {
82
89
  cursor: grabbing;
83
90
  }
84
91
 
85
92
  }
86
93
 
87
- // Change cursor for tree + basic animation on svg
88
- [aria-controls],
89
- [data-handle] {
90
- cursor: pointer;
91
- }
92
-
93
- [aria-controls][aria-expanded=true] [data-handle] > svg {
94
- transform: rotate(90deg);
95
- }
96
-
97
- // Reduce animation on scroll for #target
94
+ // Reduce animation on scroll for #target + data-handle SVG
98
95
  @media screen and (prefers-reduced-motion: no-preference) {
99
96
  :has(:target) {
100
97
  scroll-behavior: smooth;
101
98
  }
102
-
103
- [data-handle] > svg {
104
- transition: all .25s ease-in-out;
105
- }
106
-
107
99
  }
108
100
 
109
101
  // Define the bases for the body
@@ -116,7 +116,7 @@ select {
116
116
  width: $size;
117
117
  border: none;
118
118
  border-radius: $size;
119
- box-shadow: calc(-400px - $size / 2) 0 0 400px color-mix(in srgb, var(--range-color, currentColor), transparent 75%);
119
+ box-shadow: calc(-1000px - $size / 2) 0 0 1000px color-mix(in srgb, var(--range-color, currentColor), transparent 75%);
120
120
  }
121
121
 
122
122
  padding: calc($size / 2) 0;
Binary file