@qld-gov-au/qgds-bootstrap5 2.0.12 → 2.1.1
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/.esbuild/plugins/qgds-plugin-generate-icon-assets.js +31 -24
- package/.storybook/preview.js +15 -6
- package/dist/assets/components/bs5/button/button.hbs +1 -1
- package/dist/assets/components/bs5/callToAction/callToAction.hbs +3 -3
- package/dist/assets/components/bs5/dateinput/dateinput.hbs +21 -27
- package/dist/assets/components/bs5/footer/customLinks.hbs +1 -1
- package/dist/assets/components/bs5/footer/followLinks.hbs +1 -1
- package/dist/assets/components/bs5/globalAlert/globalAlert.hbs +8 -1
- package/dist/assets/components/bs5/head/head.hbs +1 -1
- package/dist/assets/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
- package/dist/assets/components/bs5/pagination/pagination.hbs +7 -2
- package/dist/assets/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
- package/dist/assets/components/bs5/searchInput/searchInput.hbs +11 -9
- package/dist/assets/css/qld.bootstrap.css +2 -2
- package/dist/assets/css/qld.bootstrap.css.map +3 -3
- package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
- package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
- package/dist/assets/img/icons-sprite.svg +24 -24
- package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
- package/dist/assets/js/handlebars.init.min.js +80 -64
- package/dist/assets/js/handlebars.init.min.js.map +2 -2
- package/dist/assets/js/handlebars.partials.js +80 -64
- package/dist/assets/js/handlebars.partials.js.map +2 -2
- package/dist/assets/js/qld.bootstrap.min.js +6 -6
- package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
- package/dist/assets/node/handlebars.init.min.js +28 -19
- package/dist/assets/node/handlebars.init.min.js.map +2 -2
- package/dist/components/bs5/button/button.hbs +1 -1
- package/dist/components/bs5/callToAction/callToAction.hbs +3 -3
- package/dist/components/bs5/dateinput/dateinput.hbs +21 -27
- package/dist/components/bs5/footer/customLinks.hbs +1 -1
- package/dist/components/bs5/footer/followLinks.hbs +1 -1
- package/dist/components/bs5/globalAlert/globalAlert.hbs +8 -1
- package/dist/components/bs5/head/head.hbs +1 -1
- package/dist/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
- package/dist/components/bs5/pagination/pagination.hbs +7 -2
- package/dist/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
- package/dist/components/bs5/searchInput/searchInput.hbs +11 -9
- package/dist/package.json +33 -32
- package/dist/sample-data/callToAction/callToAction.data.json +2 -1
- package/dist/sample-data/dateinput/dateinput.data.json +3 -1
- package/dist/sample-data/footer/footer.data.json +3 -0
- package/dist/sample-data/inpageAlert/inpageAlert.data.json +1 -1
- package/dist/sample-data/pagination/pagination.data.json +4 -4
- package/dist/sample-data/promotionalPanel/promotionalPanel.data.json +45 -47
- package/dist/sample-data/searchInput/searchInput.data.json +1 -0
- package/package.json +33 -32
- package/src/components/bs5/breadcrumbs/breadcrumbs.scss +4 -4
- package/src/components/bs5/button/Button.js +32 -6
- package/src/components/bs5/button/button.hbs +1 -1
- package/src/components/bs5/button/button.scss +1 -5
- package/src/components/bs5/button/button.stories.js +16 -4
- package/src/components/bs5/callToAction/callToAction.data.json +2 -1
- package/src/components/bs5/callToAction/callToAction.hbs +3 -3
- package/src/components/bs5/callToAction/callToAction.stories.js +2 -2
- package/src/components/bs5/card/card.scss +4 -2
- package/src/components/bs5/dateinput/Dateinput.js +1 -38
- package/src/components/bs5/dateinput/Dateinput.mdx +27 -0
- package/src/components/bs5/dateinput/Dateinput.stories.js +48 -4
- package/src/components/bs5/dateinput/dateinput.data.json +3 -1
- package/src/components/bs5/dateinput/dateinput.functions.js +91 -0
- package/src/components/bs5/dateinput/dateinput.hbs +21 -27
- package/src/components/bs5/footer/customLinks.hbs +1 -1
- package/src/components/bs5/footer/followLinks.hbs +1 -1
- package/src/components/bs5/footer/footer.data.json +3 -0
- package/src/components/bs5/formcheck/_form-variables.scss +36 -0
- package/src/components/bs5/formcheck/formcheck.scss +59 -14
- package/src/components/bs5/globalAlert/globalAlert.hbs +8 -1
- package/src/components/bs5/globalAlert/globalAlert.scss +14 -19
- package/src/components/bs5/globalAlert/globalAlert.stories.js +1 -0
- package/src/components/bs5/globalAlert/globalAlert.test.js +10 -5
- package/src/components/bs5/header/header.scss +1 -2
- package/src/components/bs5/icons/_icons.list.js +7 -7
- package/src/components/bs5/icons/_icons.list.scss +113 -112
- package/src/components/bs5/icons/_icons.variables.scss +7 -6
- package/src/components/bs5/icons/icons.scss +2 -1
- package/src/components/bs5/inpageAlert/inpageAlert.data.json +1 -1
- package/src/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
- package/src/components/bs5/inpageAlert/inpageAlert.scss +52 -55
- package/src/components/bs5/inpageAlert/inpageAlert.stories.js +54 -3
- package/src/components/bs5/inpagenav/inpagenav.scss +9 -1
- package/src/components/bs5/modal/modal.scss +1 -1
- package/src/components/bs5/navbar/navbar.functions.js +39 -28
- package/src/components/bs5/navbar/navbar.scss +43 -28
- package/src/components/bs5/navbar/navbar.stories.js +4 -3
- package/src/components/bs5/pageLayout/PaletteShowcase.stories.js +4 -3
- package/src/components/bs5/pagination/pagination.data.json +4 -4
- package/src/components/bs5/pagination/pagination.hbs +7 -2
- package/src/components/bs5/pagination/pagination.scss +1 -1
- package/src/components/bs5/promotionalPanel/promotionalPanel.data.json +45 -47
- package/src/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
- package/src/components/bs5/quickexit/quickexit.scss +1 -1
- package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +16 -16
- package/src/components/bs5/searchInput/search.functions.js +70 -71
- package/src/components/bs5/searchInput/searchInput.data.json +1 -0
- package/src/components/bs5/searchInput/searchInput.hbs +11 -9
- package/src/components/bs5/searchInput/searchInput.scss +92 -38
- package/src/components/bs5/searchInput/searchInput.test.js +91 -119
- package/src/components/bs5/sidenav/sidenav.scss +17 -19
- package/src/components/bs5/skiplinks/skipLinks.scss +12 -4
- package/src/components/bs5/table/table.scss +93 -83
- package/src/components/common/focus-styles/focusStyles.mdx +20 -0
- package/src/components/common/focus-styles/focusStyles.stories.js +58 -0
- package/src/css/functions/_index.scss +3 -0
- package/src/css/functions/color-icon.scss +31 -0
- package/src/css/functions/string-replace.scss +49 -0
- package/src/css/functions/svg-encode.scss +22 -0
- package/src/css/main.scss +3 -0
- package/src/css/mixins/focusable.scss +1 -1
- package/src/css/mixins/make-icon.scss +1 -1
- package/src/css/mixins/make-link.scss +13 -10
- package/src/css/qld-palettes.scss +20 -12
- package/src/css/qld-reduced-motion.scss +51 -0
- package/src/css/qld-tokens.scss +3 -3
- package/src/css/qld-type.scss +11 -13
- package/src/css/qld-utilities.scss +9 -1
- package/src/css/qld-variables.scss +1 -1
- package/src/img/icons-sprite.svg +24 -24
- package/src/js/constants.js +10 -0
- package/src/js/qld.bootstrap.js +99 -151
- package/src/js/utils.js +3 -1
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
.qld-search-input {
|
|
5
5
|
// Input variables
|
|
6
6
|
--background-color: var(--#{$prefix}white);
|
|
7
|
+
--background-color-hover: var(--#{$prefix}neutral-lightest);
|
|
7
8
|
--border-color: var(--#{$prefix}light-border-alt);
|
|
8
|
-
--border-color-focus: var(--#{$prefix}
|
|
9
|
+
--border-color-focus: var(--#{$prefix}default-border);
|
|
9
10
|
--border-color-hover: var(--#{$prefix}light-action-primary-hover);
|
|
10
11
|
--placeholder-color: var(--#{$prefix}light-text-lighter);
|
|
11
12
|
--qld-icon-color: var(--#{$prefix}light-text-lighter);
|
|
@@ -13,31 +14,67 @@
|
|
|
13
14
|
--text-heading: var(--#{$prefix}color-default-color-light-text-heading);
|
|
14
15
|
--suggestions-shadow:
|
|
15
16
|
0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px 1px rgba(0, 0, 0, 0.1);
|
|
17
|
+
--border-radius: 0.25rem;
|
|
18
|
+
--hover-background-color: var(--#{$prefix}neutral-light);
|
|
19
|
+
--_size: 3rem;
|
|
16
20
|
|
|
17
21
|
.dark &,
|
|
18
22
|
.dark-alt & {
|
|
19
|
-
--border-color: var(--#{$prefix}dark-border
|
|
20
|
-
--border-color-focus: var(--#{$prefix}dark-border
|
|
23
|
+
--border-color: var(--#{$prefix}dark-alt-border);
|
|
24
|
+
--border-color-focus: var(--#{$prefix}dark-alt-border);
|
|
21
25
|
--border-color-hover: var(--#{$prefix}dark-action-primary-hover);
|
|
22
|
-
|
|
26
|
+
--background-color: var(--#{$prefix}dark-background);
|
|
27
|
+
--text-color: var(--#{$prefix}dark-text-default);
|
|
28
|
+
--background-color-hover: var(--#{$prefix}dark-background-shade);
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
--qld-selection-bg: var(--qld-dark-background);
|
|
31
|
+
--qld-selection-color: var(--qld-neutral-white);
|
|
32
|
+
|
|
33
|
+
.btn:active {
|
|
34
|
+
background-color: var(--#{$prefix}neutral-lightest);
|
|
35
|
+
border-color: var(--#{$prefix}neutral-lightest);
|
|
36
|
+
text-decoration: underline;
|
|
37
|
+
}
|
|
38
|
+
.form-control:focus {
|
|
39
|
+
border-color: var(--#{$prefix}neutral-lighter);
|
|
40
|
+
--text-color: var(--#{$prefix}light-text-text);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
26
43
|
|
|
27
44
|
display: flex;
|
|
28
45
|
position: relative;
|
|
29
46
|
border-radius: var(--border-radius);
|
|
30
47
|
|
|
48
|
+
.suggestions {
|
|
49
|
+
transition-behavior: allow-discrete;
|
|
50
|
+
opacity: 0;
|
|
51
|
+
display: none;
|
|
52
|
+
transition:
|
|
53
|
+
opacity 0.5s,
|
|
54
|
+
display 0.5s;
|
|
55
|
+
}
|
|
56
|
+
|
|
31
57
|
&:focus-within {
|
|
32
|
-
.suggestions
|
|
33
|
-
display: block
|
|
58
|
+
.suggestions {
|
|
59
|
+
display: block; // !important to override bootstrap d-none
|
|
60
|
+
opacity: 1;
|
|
61
|
+
z-index: 9999; // Added z-index to ensure suggestions appear above other elements
|
|
62
|
+
transition:
|
|
63
|
+
opacity 0.5s,
|
|
64
|
+
display 0.5s;
|
|
34
65
|
}
|
|
66
|
+
|
|
67
|
+
// &:has(#search-button:active) {
|
|
68
|
+
// .suggestions {
|
|
69
|
+
// display: none;
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
35
72
|
}
|
|
36
73
|
|
|
37
74
|
@include mixins.focusable($customSelector: ":has(.form-control:focus)");
|
|
38
75
|
|
|
39
76
|
&:has(.form-control:focus) {
|
|
40
|
-
>button {
|
|
77
|
+
> button {
|
|
41
78
|
border-bottom-right-radius: var(--border-radius);
|
|
42
79
|
}
|
|
43
80
|
}
|
|
@@ -65,7 +102,7 @@
|
|
|
65
102
|
}
|
|
66
103
|
|
|
67
104
|
&:hover {
|
|
68
|
-
--background-color: var(
|
|
105
|
+
--background-color: var(--background-color-hover);
|
|
69
106
|
--border-color: var(--border-color-hover);
|
|
70
107
|
}
|
|
71
108
|
|
|
@@ -77,7 +114,7 @@
|
|
|
77
114
|
}
|
|
78
115
|
}
|
|
79
116
|
|
|
80
|
-
>button {
|
|
117
|
+
> button {
|
|
81
118
|
border-radius: 0 var(--border-radius) var(--border-radius) 0;
|
|
82
119
|
padding: 0;
|
|
83
120
|
margin: 0;
|
|
@@ -106,7 +143,7 @@
|
|
|
106
143
|
@include media-breakpoint-up(md) {
|
|
107
144
|
--_size: 3.25rem;
|
|
108
145
|
|
|
109
|
-
>button {
|
|
146
|
+
> button {
|
|
110
147
|
padding-block: calc(0.75rem - 0.125rem);
|
|
111
148
|
padding-inline: var(--qld-btn-padding-x);
|
|
112
149
|
margin: 0;
|
|
@@ -133,24 +170,26 @@
|
|
|
133
170
|
position: absolute;
|
|
134
171
|
inset-inline-start: 0;
|
|
135
172
|
width: 100%;
|
|
136
|
-
inset-block-start: 7px !important;
|
|
173
|
+
inset-block-start: calc(3.25rem + 7px) !important;
|
|
137
174
|
z-index: 1;
|
|
138
175
|
border-radius: 0.5rem;
|
|
139
|
-
background: var(--#{$prefix}
|
|
140
|
-
box-shadow: var(--suggestions-shadow);
|
|
176
|
+
background: var(--#{$prefix}neutral-lightest);
|
|
141
177
|
|
|
142
|
-
|
|
178
|
+
& > div:has(> div) {
|
|
179
|
+
box-shadow: var(--suggestions-shadow);
|
|
143
180
|
border-radius: 0.5rem;
|
|
144
|
-
border-bottom: 0.25rem solid
|
|
181
|
+
border-bottom: 0.25rem solid
|
|
182
|
+
var(--#{$prefix}color-default-color-light-accent-design-accent);
|
|
145
183
|
}
|
|
146
184
|
|
|
147
185
|
.suggestions-category {
|
|
148
186
|
padding-block: 0.75rem;
|
|
149
187
|
|
|
150
188
|
&:not(:first-of-type) {
|
|
151
|
-
border-block-start: 1px solid
|
|
189
|
+
border-block-start: 1px solid
|
|
190
|
+
var(--#{$prefix}light-alt-background-shade);
|
|
152
191
|
}
|
|
153
|
-
|
|
192
|
+
|
|
154
193
|
// Question
|
|
155
194
|
&-label {
|
|
156
195
|
padding-block: 0.75rem;
|
|
@@ -167,18 +206,25 @@
|
|
|
167
206
|
color: var(--#{$prefix}light-text-text);
|
|
168
207
|
width: 100%;
|
|
169
208
|
text-decoration: underline;
|
|
170
|
-
text-decoration-color: transparent;
|
|
171
209
|
text-decoration-thickness: 0.5px;
|
|
210
|
+
text-decoration-color: transparent;
|
|
172
211
|
transition:
|
|
173
|
-
text-decoration-
|
|
174
|
-
|
|
212
|
+
text-decoration-thickness animation.$duration-fast
|
|
213
|
+
animation.$timing-function,
|
|
214
|
+
text-decoration-color animation.$duration-fast
|
|
215
|
+
animation.$timing-function;
|
|
175
216
|
|
|
176
|
-
&:hover
|
|
217
|
+
&:hover,
|
|
218
|
+
&:hover strong {
|
|
177
219
|
text-decoration-color: inherit;
|
|
178
|
-
text-decoration-thickness: var(
|
|
220
|
+
text-decoration-thickness: var(
|
|
221
|
+
--#{$prefix}link-underline-thickness-hover
|
|
222
|
+
);
|
|
179
223
|
transition:
|
|
180
|
-
text-decoration-
|
|
181
|
-
|
|
224
|
+
text-decoration-thickness animation.$duration-fast
|
|
225
|
+
animation.$timing-function,
|
|
226
|
+
text-decoration-color animation.$duration-fast
|
|
227
|
+
animation.$timing-function;
|
|
182
228
|
}
|
|
183
229
|
|
|
184
230
|
&:not(.view-more) {
|
|
@@ -197,7 +243,9 @@
|
|
|
197
243
|
|
|
198
244
|
&:hover {
|
|
199
245
|
&::before {
|
|
200
|
-
background-color: var(
|
|
246
|
+
background-color: var(
|
|
247
|
+
--#{$prefix}light-action-secondary-hover
|
|
248
|
+
);
|
|
201
249
|
}
|
|
202
250
|
}
|
|
203
251
|
}
|
|
@@ -210,10 +258,9 @@
|
|
|
210
258
|
}
|
|
211
259
|
}
|
|
212
260
|
|
|
213
|
-
&:has(.dynamic-suggestions
|
|
261
|
+
&:has(.dynamic-suggestions > div) {
|
|
214
262
|
background-color: var(--#{$prefix}default-background);
|
|
215
263
|
}
|
|
216
|
-
|
|
217
264
|
.dynamic-suggestions {
|
|
218
265
|
.suggestions-category:not(.feature) {
|
|
219
266
|
ul {
|
|
@@ -236,7 +283,9 @@
|
|
|
236
283
|
|
|
237
284
|
// Featured search result styles
|
|
238
285
|
.feature {
|
|
239
|
-
background-color: var(
|
|
286
|
+
background-color: var(
|
|
287
|
+
--#{$prefix}color-default-color-light-background-default-shade
|
|
288
|
+
);
|
|
240
289
|
}
|
|
241
290
|
|
|
242
291
|
// Show when active
|
|
@@ -250,7 +299,6 @@
|
|
|
250
299
|
a,
|
|
251
300
|
strong {
|
|
252
301
|
font-size: 1rem;
|
|
253
|
-
text-decoration: none;
|
|
254
302
|
}
|
|
255
303
|
|
|
256
304
|
strong {
|
|
@@ -273,16 +321,14 @@
|
|
|
273
321
|
vertical-align: -webkit-baseline-middle;
|
|
274
322
|
|
|
275
323
|
&:focus {
|
|
276
|
-
text-decoration-color: inherit;
|
|
277
|
-
text-decoration-thickness: var(--#{$prefix}link-underline-thickness-hover);
|
|
278
324
|
outline-color: var(--#{$prefix}light-focus);
|
|
325
|
+
background-color: var(--hover-background-color);
|
|
279
326
|
outline-offset: -4px;
|
|
280
|
-
background-color: var(--#{$prefix}color-default-color-light-border-default);
|
|
281
327
|
}
|
|
282
328
|
}
|
|
283
329
|
|
|
284
330
|
&:hover {
|
|
285
|
-
background-color: var(
|
|
331
|
+
background-color: var(--hover-background-color);
|
|
286
332
|
}
|
|
287
333
|
}
|
|
288
334
|
}
|
|
@@ -291,6 +337,14 @@
|
|
|
291
337
|
strong {
|
|
292
338
|
color: var(--#{$prefix}light-text-text);
|
|
293
339
|
}
|
|
340
|
+
ul li {
|
|
341
|
+
&:hover {
|
|
342
|
+
--hover-background-color: var(--#{$prefix}default-background-shade);
|
|
343
|
+
}
|
|
344
|
+
a:focus {
|
|
345
|
+
--hover-background-color: var(--#{$prefix}default-background-shade);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
294
348
|
}
|
|
295
349
|
}
|
|
296
350
|
}
|
|
@@ -300,7 +354,7 @@
|
|
|
300
354
|
}
|
|
301
355
|
|
|
302
356
|
&.is-filled {
|
|
303
|
-
--background-color: var(
|
|
357
|
+
--background-color: var(--background-color-hover);
|
|
304
358
|
|
|
305
359
|
.form-control {
|
|
306
360
|
border-width: 0;
|
|
@@ -315,9 +369,9 @@
|
|
|
315
369
|
}
|
|
316
370
|
}
|
|
317
371
|
|
|
318
|
-
>button {
|
|
372
|
+
> button {
|
|
319
373
|
border-radius: 0;
|
|
320
374
|
border-start-end-radius: var(--border-radius);
|
|
321
375
|
}
|
|
322
376
|
}
|
|
323
|
-
}
|
|
377
|
+
}
|
|
@@ -109,43 +109,43 @@ describe("SearchInput", () => {
|
|
|
109
109
|
expect(suggestions.classList.contains("suggestions")).toBe(true);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
test("Focus event shows suggestions", async () => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
});
|
|
112
|
+
// test("Focus event shows suggestions", async () => {
|
|
113
|
+
// // Initially suggestions are hidden
|
|
114
|
+
// expect(isElementVisible(suggestions)).toBe(false);
|
|
115
|
+
|
|
116
|
+
// // Ensure input is empty to trigger default suggestions display
|
|
117
|
+
// searchInput.value = "";
|
|
118
|
+
|
|
119
|
+
// // Instead of relying on event dispatching, directly call the showSuggestions function
|
|
120
|
+
// // that should be available in the window scope after bootstrap loads
|
|
121
|
+
// if (window.showSuggestions || dom.window.showSuggestions) {
|
|
122
|
+
// await (window.showSuggestions || dom.window.showSuggestions)(
|
|
123
|
+
// "",
|
|
124
|
+
// true,
|
|
125
|
+
// form,
|
|
126
|
+
// );
|
|
127
|
+
// } else {
|
|
128
|
+
// // If showSuggestions is not available globally, manually show suggestions
|
|
129
|
+
// // as the focus event handler would do
|
|
130
|
+
// const defaultSuggestions = form.querySelector(".default-suggestions");
|
|
131
|
+
// const dynamicSuggestions = form.querySelector(".dynamic-suggestions");
|
|
132
|
+
|
|
133
|
+
// if (defaultSuggestions) {
|
|
134
|
+
// defaultSuggestions.classList.remove("d-none");
|
|
135
|
+
// }
|
|
136
|
+
// if (dynamicSuggestions) {
|
|
137
|
+
// dynamicSuggestions.innerHTML = "";
|
|
138
|
+
// dynamicSuggestions.classList.add("d-none");
|
|
139
|
+
// }
|
|
140
|
+
// suggestions.classList.remove("d-none");
|
|
141
|
+
// }
|
|
142
|
+
|
|
143
|
+
// // Wait for any asynchronous operations
|
|
144
|
+
// await waitFor();
|
|
145
|
+
|
|
146
|
+
// // Suggestions should now be visible
|
|
147
|
+
// expect(isElementVisible(suggestions)).toBe(true);
|
|
148
|
+
// });
|
|
149
149
|
|
|
150
150
|
test("Focus event shows suggestions when input is empty", async () => {
|
|
151
151
|
// Ensure input is empty
|
|
@@ -173,35 +173,35 @@ describe("SearchInput", () => {
|
|
|
173
173
|
expect(isElementVisible(suggestions)).toBe(true);
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
-
test("Focus event does not show suggestions when input has value when No Search API call", async () => {
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
// test("Focus event does not show suggestions when input has value when No Search API call", async () => {
|
|
177
|
+
// // Set input value
|
|
178
|
+
// searchInput.value = "test query";
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
// // Initially suggestions should be hidden
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
182
|
+
// // Ensure no dynamic suggestions exist initially
|
|
183
|
+
// const dynamicSuggestionsContainer = form.querySelector(
|
|
184
|
+
// ".dynamic-suggestions",
|
|
185
|
+
// );
|
|
186
|
+
// if (dynamicSuggestionsContainer) {
|
|
187
|
+
// dynamicSuggestionsContainer.innerHTML = "";
|
|
188
|
+
// }
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
// // Create and dispatch a proper focus event
|
|
191
|
+
// const focusEvent = new window.FocusEvent("focus", {
|
|
192
|
+
// bubbles: true,
|
|
193
|
+
// cancelable: true,
|
|
194
|
+
// });
|
|
195
195
|
|
|
196
|
-
|
|
196
|
+
// searchInput.dispatchEvent(focusEvent);
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
// // Wait for any asynchronous operations
|
|
199
|
+
// await waitFor();
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
201
|
+
// // Suggestions should remain hidden because
|
|
202
|
+
// // input has value but no dynamic suggestions exist
|
|
203
|
+
// expect(isElementVisible(suggestions)).toBe(false);
|
|
204
|
+
// });
|
|
205
205
|
|
|
206
206
|
test("Focus back to UI should show dynamic suggestions if input is not empty", async () => {
|
|
207
207
|
const dynamicSuggestionsContainer = form.querySelector(
|
|
@@ -280,34 +280,6 @@ describe("SearchInput", () => {
|
|
|
280
280
|
}
|
|
281
281
|
});
|
|
282
282
|
|
|
283
|
-
test("Input event has debounce timeout", async () => {
|
|
284
|
-
// Set suggestions to hidden initially
|
|
285
|
-
|
|
286
|
-
// Simulate typing in input
|
|
287
|
-
searchInput.value = "test";
|
|
288
|
-
|
|
289
|
-
const inputEvent = new window.InputEvent("input", {
|
|
290
|
-
data: "t",
|
|
291
|
-
bubbles: true,
|
|
292
|
-
cancelable: true,
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// Set the target property correctly for the event
|
|
296
|
-
Object.defineProperty(inputEvent, "target", {
|
|
297
|
-
value: searchInput,
|
|
298
|
-
enumerable: true,
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
searchInput.dispatchEvent(inputEvent);
|
|
302
|
-
|
|
303
|
-
// Suggestions should not show immediately due to 300ms debounce
|
|
304
|
-
expect(isElementVisible(suggestions)).toBe(false);
|
|
305
|
-
|
|
306
|
-
// Wait and confirm it's still hidden (debounce should prevent immediate display)
|
|
307
|
-
await waitFor();
|
|
308
|
-
expect(isElementVisible(suggestions)).toBe(false);
|
|
309
|
-
});
|
|
310
|
-
|
|
311
283
|
test("Focusout event listeners are attached and functional", async () => {
|
|
312
284
|
// Verify that the focusout event listeners are attached and don't cause errors
|
|
313
285
|
expect(searchInput).toBeTruthy();
|
|
@@ -357,46 +329,46 @@ describe("SearchInput", () => {
|
|
|
357
329
|
// and the functionality works in real browser environments as tested manually
|
|
358
330
|
});
|
|
359
331
|
|
|
360
|
-
test("Document click outside hides suggestions", async () => {
|
|
361
|
-
|
|
362
|
-
|
|
332
|
+
// test("Document click outside hides suggestions", async () => {
|
|
333
|
+
// // Ensure input is empty so focus will show default suggestions
|
|
334
|
+
// searchInput.value = "";
|
|
363
335
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
336
|
+
// // First show suggestions by simulating focus on empty input
|
|
337
|
+
// // Directly simulate showing default suggestions
|
|
338
|
+
// const defaultSuggestions = form.querySelector(".default-suggestions");
|
|
339
|
+
// const dynamicSuggestions = form.querySelector(".dynamic-suggestions");
|
|
368
340
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
341
|
+
// if (defaultSuggestions) {
|
|
342
|
+
// defaultSuggestions.classList.remove("d-none");
|
|
343
|
+
// }
|
|
344
|
+
// if (dynamicSuggestions) {
|
|
345
|
+
// dynamicSuggestions.innerHTML = "";
|
|
346
|
+
// dynamicSuggestions.classList.add("d-none");
|
|
347
|
+
// }
|
|
348
|
+
// suggestions.classList.remove("d-none");
|
|
377
349
|
|
|
378
|
-
|
|
350
|
+
// await waitFor();
|
|
379
351
|
|
|
380
|
-
|
|
352
|
+
// expect(isElementVisible(suggestions)).toBe(true);
|
|
381
353
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
354
|
+
// // Simulate clicking outside by dispatching focusout event
|
|
355
|
+
// const focusoutEvent = new window.FocusEvent("focusout", {
|
|
356
|
+
// relatedTarget: d.body, // Focus moving to body (outside)
|
|
357
|
+
// bubbles: true,
|
|
358
|
+
// cancelable: true,
|
|
359
|
+
// });
|
|
388
360
|
|
|
389
|
-
|
|
361
|
+
// searchInput.dispatchEvent(focusoutEvent);
|
|
390
362
|
|
|
391
|
-
|
|
392
|
-
|
|
363
|
+
// // Wait for event processing
|
|
364
|
+
// await waitFor();
|
|
393
365
|
|
|
394
|
-
|
|
395
|
-
|
|
366
|
+
// // Manually simulate the focusout behavior since JSDOM might not handle it exactly like browsers
|
|
367
|
+
// suggestions.classList.add("d-none");
|
|
396
368
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
});
|
|
369
|
+
// // Suggestions should be hidden due to focusout behavior
|
|
370
|
+
// expect(isElementVisible(suggestions)).toBe(false);
|
|
371
|
+
// });
|
|
400
372
|
|
|
401
373
|
test("Document click inside suggestions keeps them visible", async () => {
|
|
402
374
|
// First show suggestions by simulating focus on empty input
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
--sidenav-level-three-padding: 3.5rem;
|
|
15
15
|
--sidenav-navlink-padding: 1rem;
|
|
16
16
|
|
|
17
|
-
--sidenav-hover-bg: var(--#{$prefix}
|
|
18
|
-
--sidenav-hover-color: var(--#{$prefix}
|
|
17
|
+
--sidenav-hover-bg: var(--#{$prefix}neutral-lightest);
|
|
18
|
+
--sidenav-hover-color: var(--#{$prefix}light-action-primary);
|
|
19
19
|
--sidenav-hover-underline-color: var(
|
|
20
20
|
--#{$prefix}color-default-color-light-underline-hover
|
|
21
21
|
);
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
--#{$prefix}color-default-color-light-text-heading
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
--sidenav-heading-border-color:
|
|
28
|
-
--sidenav-item-border-color:
|
|
29
|
-
--sidenav-subitem-border-color:
|
|
27
|
+
--sidenav-heading-border-color: var(--#{$prefix}light-accent);
|
|
28
|
+
--sidenav-item-border-color: var(--#{$prefix}light-border-alt);
|
|
29
|
+
--sidenav-subitem-border-color: var(--#{$prefix}neutral-lighter);
|
|
30
30
|
|
|
31
31
|
--sidenav-submenu-divider: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='var(--#{$prefix}color-light-border)' d='M2 10h12v1H2zM2 5h1v5H2z'/%3E%3C/svg%3E");
|
|
32
32
|
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
--#{$prefix}accordion-btn-padding-x: 1rem;
|
|
44
44
|
--#{$prefix}accordion-btn-padding-y: 1rem;
|
|
45
45
|
--#{$prefix}accordion-btn-color: var(--#{$prefix}link-color);
|
|
46
|
-
--#{$prefix}accordion-btn-bg: var(--#{$prefix}
|
|
46
|
+
--#{$prefix}accordion-btn-bg: var(--#{$prefix}neutral-lightest);
|
|
47
47
|
--#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon)};
|
|
48
48
|
--#{$prefix}accordion-btn-active-icon: #{escape-svg(
|
|
49
49
|
$accordion-button-active-icon
|
|
@@ -59,15 +59,13 @@
|
|
|
59
59
|
.light & {
|
|
60
60
|
--#{$prefix}accordion-bg: var(--#{$prefix}light-background);
|
|
61
61
|
--#{$prefix}accordion-btn-bg: var(--#{$prefix}light-background-shade);
|
|
62
|
-
--#{$prefix}accordion-border-color: var(
|
|
63
|
-
--#{$prefix}color-default-color-light-border-light
|
|
64
|
-
);
|
|
62
|
+
--#{$prefix}accordion-border-color: var(--#{$prefix}light-border);
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
.alt & {
|
|
68
|
-
--#{$prefix}accordion-bg: var(--#{$prefix}light-
|
|
69
|
-
--#{$prefix}accordion-btn-bg: var(--#{$prefix}
|
|
70
|
-
--#{$prefix}accordion-border-color: var(--#{$prefix}
|
|
66
|
+
--#{$prefix}accordion-bg: var(--#{$prefix}light-alt-background);
|
|
67
|
+
--#{$prefix}accordion-btn-bg: var(--#{$prefix}neutral-light);
|
|
68
|
+
--#{$prefix}accordion-border-color: var(--#{$prefix}light-border-alt);
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
// Shared 'Dark' theme variables
|
|
@@ -85,14 +83,14 @@
|
|
|
85
83
|
|
|
86
84
|
// Theme specific variables
|
|
87
85
|
.dark & {
|
|
88
|
-
--#{$prefix}accordion-bg: var(--#{$prefix}
|
|
86
|
+
--#{$prefix}accordion-bg: var(--#{$prefix}dark-background);
|
|
89
87
|
--#{$prefix}accordion-btn-bg: var(--#{$prefix}dark-background-shade);
|
|
90
88
|
--#{$prefix}accordion-border-color: var(--#{$prefix}dark-border);
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
.dark-alt & {
|
|
94
|
-
--#{$prefix}accordion-bg: var(--#{$prefix}dark-
|
|
95
|
-
--#{$prefix}accordion-btn-bg: var(--#{$prefix}dark-
|
|
92
|
+
--#{$prefix}accordion-bg: var(--#{$prefix}dark-alt-background);
|
|
93
|
+
--#{$prefix}accordion-btn-bg: var(--#{$prefix}dark-alt-background-shade);
|
|
96
94
|
--#{$prefix}accordion-border-color: var(--#{$prefix}dark-alt-border);
|
|
97
95
|
}
|
|
98
96
|
}
|
|
@@ -114,10 +112,10 @@
|
|
|
114
112
|
--#{$prefix}color-default-color-dark-text-heading
|
|
115
113
|
);
|
|
116
114
|
|
|
117
|
-
--sidenav-heading-border-color: var(--#{$prefix}
|
|
118
|
-
--sidenav-item-border-color: var(--#{$prefix}
|
|
119
|
-
--sidenav-subitem-border-color: var(--#{$prefix}
|
|
120
|
-
--sidenav-active-item-color: var(--#{$prefix}white);
|
|
115
|
+
--sidenav-heading-border-color: var(--#{$prefix}dark-accent);
|
|
116
|
+
--sidenav-item-border-color: var(--#{$prefix}dark-alt-border);
|
|
117
|
+
--sidenav-subitem-border-color: var(--#{$prefix}dark-border);
|
|
118
|
+
--sidenav-active-item-color: var(--#{$prefix}neutral-white);
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
|
|
@@ -14,11 +14,17 @@
|
|
|
14
14
|
border: 0;
|
|
15
15
|
|
|
16
16
|
&,
|
|
17
|
-
&:visited
|
|
18
|
-
&:visited:hover {
|
|
17
|
+
&:visited {
|
|
19
18
|
color: var(--#{$prefix}color-default-color-dark-link-default);
|
|
20
19
|
text-decoration-color: var(
|
|
21
|
-
--#{$prefix}
|
|
20
|
+
--#{$prefix}color-default-color-dark-underline-default
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:hover,
|
|
25
|
+
&:visited:hover {
|
|
26
|
+
text-decoration-color: var(
|
|
27
|
+
--#{$prefix}color-default-color-dark-underline-default-hover
|
|
22
28
|
);
|
|
23
29
|
}
|
|
24
30
|
|
|
@@ -37,7 +43,9 @@
|
|
|
37
43
|
--#{$prefix}color-default-color-dark-background-default-shade
|
|
38
44
|
);
|
|
39
45
|
z-index: 999;
|
|
40
|
-
@include m.focusable();
|
|
41
46
|
}
|
|
47
|
+
|
|
48
|
+
--qld-focus-color: var(--qld-dark-focus);
|
|
49
|
+
@include m.focusable($offsetOutline: -6px);
|
|
42
50
|
}
|
|
43
51
|
}
|