@qld-gov-au/qgds-bootstrap5 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/assets/components/bs5/head/head.hbs +1 -1
  2. package/dist/assets/components/bs5/searchInput/searchInput.hbs +34 -35
  3. package/dist/assets/css/qld.bootstrap.css +1 -1
  4. package/dist/assets/css/qld.bootstrap.css.map +3 -3
  5. package/dist/assets/js/handlebars.init.min.js +36 -38
  6. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  7. package/dist/assets/node/handlebars.init.min.js +2 -2
  8. package/dist/assets/node/handlebars.init.min.js.map +1 -1
  9. package/dist/components/bs5/head/head.hbs +1 -1
  10. package/dist/components/bs5/searchInput/searchInput.hbs +34 -35
  11. package/dist/package.json +1 -1
  12. package/dist/sample-data/searchInput/searchInput.data.json +0 -1
  13. package/package.json +1 -1
  14. package/src/components/bs5/header/header.scss +15 -27
  15. package/src/components/bs5/logo/Logo.mdx +1 -1
  16. package/src/components/bs5/navbar/navbar.scss +7 -5
  17. package/src/components/bs5/navbar/navbar.stories.js +1 -1
  18. package/src/components/bs5/searchInput/SearchInput.mdx +1 -1
  19. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +32 -34
  20. package/src/components/bs5/searchInput/searchInput.data.json +0 -1
  21. package/src/components/bs5/searchInput/searchInput.hbs +34 -35
  22. package/src/components/bs5/searchInput/searchInput.scss +216 -195
  23. package/src/components/bs5/searchInput/searchInput.stories.js +42 -26
  24. package/src/components/bs5/tabs/tabs.scss +47 -40
  25. package/src/css/mixins/focusable.scss +11 -3
  26. package/src/css/mixins/make-icon.scss +7 -1
  27. package/src/components/bs5/searchInput/_colours.scss +0 -63
@@ -1,31 +1,150 @@
1
- // ----------------------------------------------------------------------------------------------------------------------
2
- // Search input - palettes and second hand variables:
3
- @import "./colours";
1
+ @use "../../../css/mixins";
4
2
 
5
- // ----------------------------------------------------------------------------------------------------------------------
6
3
  .qld-search-input {
7
- //Default state - unfocused, unhovered
8
- --text-color: var(--qld-dark-grey-muted);
9
- --placeholder-color: var(--qld-dark-grey-muted);
10
- --border-color: var(--qld-soft-grey);
11
- --background-color: var(--qld-white);
12
- --outline-color: var(--qld-light-blue);
13
- --icon-color: var(--qld-dark-grey-muted);
14
- --icon-color-on-btn: var(--qld-white);
15
- --icon: var(--qgds-icon-search);
4
+ // Input variables
5
+ --background-color: var(--#{$prefix}white);
6
+ --border-color: var(--#{$prefix}light-border-alt);
7
+ --placeholder-color: var(--#{$prefix}light-text-lighter);
8
+ --qld-icon-color: var(--#{$prefix}light-text-lighter);
9
+ --text-color: var(--#{$prefix}light-text-text);
10
+ --text-heading: var(--#{$prefix}color-default-color-light-text-heading);
11
+
12
+ .dark &, .dark-alt & {
13
+ --text-heading: var(--#{$prefix}dark-text-lighter);
14
+ --qld-focus-color: var(--#{$prefix}dark-focus);
15
+ }
16
+
17
+ // Suggestions variables
18
+ --suggestions-shadow:
19
+ 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 3px 1px rgba(0, 0, 0, 0.1);
20
+ --suggestions-bg: var(
21
+ --#{$prefix}color-default-color-light-background-default-shade
22
+ );
23
+ --suggestions-hover: var(
24
+ --#{$prefix}color-default-color-light-border-default
25
+ );
26
+ --suggestions-hover-border-color: var(
27
+ --#{$prefix}color-default-color-light-accent-design-accent
28
+ );
29
+ --suggestions-feature-bg: var(
30
+ --#{$prefix}color-default-color-dark-background-default
31
+ );
32
+ --suggestions-feature-hover: var(
33
+ --#{$prefix}color-default-color-dark-background-default-shade
34
+ );
35
+ --suggestions-feature-text-color: var(
36
+ --#{$prefix}color-default-color-dark-text-default
37
+ );
38
+
39
+ // local variables
40
+ $border-radius: 0.25rem;
41
+ --_size: 3rem;
42
+
43
+
44
+ display: flex;
16
45
  position: relative;
17
- width: 100%;
46
+ border-radius: $border-radius;
47
+
48
+ @include mixins.focusable($customSelector: ":has(.form-control:focus)");
49
+
50
+ &:has(.form-control:focus) {
51
+ > button {
52
+ border-bottom-right-radius: $border-radius;
53
+ }
54
+ }
18
55
 
19
56
  .form-control {
20
- min-height: 52px;
57
+ min-height: var(--_size);
58
+ padding: 0 4rem 0 1rem;
59
+ border: {
60
+ color: var(--border-color);
61
+ style: solid;
62
+ top-width: 0.125rem;
63
+ right-width: 0;
64
+ bottom-width: 0.125rem;
65
+ left-width: 0.125rem;
66
+ radius: $border-radius 0 0 $border-radius;
67
+ }
68
+ background: var(--background-color);
69
+ padding-right: 7.5rem;
70
+ color: var(--text-color);
71
+ transition: {
72
+ property: border-color, background-color, color;
73
+ timing-function: ease-out;
74
+ duration: 0.2s;
75
+ }
76
+
77
+ &::placeholder {
78
+ color: var(--placeholder-color);
79
+ }
80
+
81
+ &:hover {
82
+ --background-color: var(--#{$prefix}neutral-lightest);
83
+ --border-color: var(--#{$prefix}light-action-primary-hover);
84
+ }
85
+
86
+ &:active,
87
+ &:focus {
88
+ --border-color: var(--#{$prefix}light-border-alt);
89
+ --background-color: var(--#{$prefix}white);
90
+ outline: none;
91
+ }
21
92
  }
22
93
 
23
- @include media-breakpoint-up(lg) {
24
- min-width: 22.5rem;
94
+ > button {
95
+ border-radius: 0 $border-radius $border-radius 0;
96
+ padding: 0;
97
+ margin: 0;
98
+ width: var(--_size);
99
+ box-shadow: none;
100
+ min-width: auto;
101
+ min-height: auto;
102
+ flex-shrink: 0;
103
+
104
+ &:hover,
105
+ &:focus {
106
+ box-shadow: none;
107
+ }
108
+
109
+ .btn-label {
110
+ display: none;
111
+ }
112
+
113
+ //prep a button "search-icon" which is invoked at smaller screeen sizes below
114
+ .btn-icon {
115
+ @include mixins.make-icon($name: "search", $size: "md");
116
+ --qld-icon-color: currentColor;
117
+ }
25
118
  }
26
119
 
27
- @include media-breakpoint-up(xl) {
28
- min-width: 26rem;
120
+ @include media-breakpoint-up(md) {
121
+ --_size: 3.25rem;
122
+
123
+ > button {
124
+ padding: calc(0.75rem - 0.125rem) var(--qld-btn-padding-x);
125
+ margin: 0;
126
+ width: auto;
127
+
128
+ .btn-label {
129
+ display: block;
130
+ }
131
+
132
+ .btn-icon {
133
+ display: none;
134
+ margin-left: 0;
135
+ }
136
+ }
137
+
138
+ .form-control {
139
+ padding: 0.75rem 1rem 0.75rem 2.5rem;
140
+ }
141
+
142
+ @include mixins.make-icon($name: "search", $size: "xs", $pseudo: "before") {
143
+ position: absolute;
144
+ top: 50%;
145
+ transform: translateY(-50%);
146
+ left: calc(1rem - 0.125rem);
147
+ }
29
148
  }
30
149
 
31
150
  //Search dropdown
@@ -36,10 +155,9 @@
36
155
  width: 100%;
37
156
  z-index: 1;
38
157
  border-radius: 0.5rem;
39
- background: var(--#{$prefix}site-search-suggestions-bg);
40
- box-shadow: var(--#{$prefix}site-search_boxshadow);
41
- border-bottom: solid 0.25rem
42
- var(--#{$prefix}site-search-suggestions-hover__border_color);
158
+ background: var(--suggestions-bg);
159
+ box-shadow: var(--suggestions-shadow);
160
+ border-bottom: solid 0.25rem var(--suggestions-hover-border-color);
43
161
 
44
162
  .suggestions-category {
45
163
  &-view-more {
@@ -50,7 +168,7 @@
50
168
  0.5
51
169
  );
52
170
  &:hover {
53
- background-color: var(--#{$prefix}site-search-suggestions-hover);
171
+ background-color: var(--suggestions-hover);
54
172
  text-decoration-color: rgba(
55
173
  $color-default-color-light-text-default,
56
174
  1
@@ -82,22 +200,20 @@
82
200
 
83
201
  // Featured search result styles
84
202
  .feature {
85
- background-color: var(--#{$prefix}site-search-suggestions-feature_bg);
203
+ background-color: var(--suggestions-feature-bg);
86
204
 
87
205
  strong {
88
- color: var(--#{$prefix}site-search-suggestions-feature_text-color);
206
+ color: var(--suggestions-feature-text-color);
89
207
  }
90
208
 
91
209
  ul {
92
210
  li {
93
211
  &:hover {
94
- background-color: var(
95
- --#{$prefix}site-search-suggestions-feature_hover
96
- );
212
+ background-color: var(--suggestions-feature-hover);
97
213
  }
98
214
 
99
215
  a {
100
- color: var(--#{$prefix}site-search-suggestions-feature_text-color);
216
+ color: var(--suggestions-feature-text-color);
101
217
  }
102
218
  }
103
219
  }
@@ -113,15 +229,13 @@
113
229
 
114
230
  a,
115
231
  strong {
116
- color: var(--site-search-input-color);
117
- font-weight: 400;
118
232
  font-size: 1rem;
119
233
  text-decoration: none;
120
234
  }
121
235
 
122
236
  strong {
123
237
  font-weight: 600;
124
- color: var(--#{$prefix}color-default-color-light-text-heading);
238
+ color: var(--text-heading);
125
239
  }
126
240
 
127
241
  ul {
@@ -143,7 +257,7 @@
143
257
  }
144
258
 
145
259
  &:hover {
146
- background-color: var(--#{$prefix}site-search-suggestions-hover);
260
+ background-color: var(--suggestions-hover);
147
261
 
148
262
  a {
149
263
  text-decoration: underline;
@@ -161,186 +275,93 @@
161
275
  max-width: 100%;
162
276
  }
163
277
 
164
- //SVG Search Icon
165
- &::before {
166
- content: "";
167
- position: absolute;
168
- top: 50%;
169
- transform: translateY(-50%);
170
- left: calc(1rem - 0.125rem);
171
- width: 1rem;
172
- height: 1rem;
173
- background-color: var(--icon-color);
174
- mask: var(--icon) center center / 1rem no-repeat;
175
- mask-size: contain;
176
- -webkit-mask-size: contain;
177
- -webkit-mask: var(--icon) center center / 1rem no-repeat;
178
- }
179
-
180
- //Icon color is scoped against the parent container, not the input :(
181
- &:has(.form-control:hover) {
182
- --icon-color: var(--qld-dark-grey-muted);
183
- }
184
-
185
- &:has(.form-control:focus) {
186
- --icon-color: var(--qld-text-grey);
187
- }
188
-
189
- .btn {
190
- box-shadow: none;
191
- min-width: auto;
192
- }
193
-
194
- .form-control {
195
- padding: 0.75rem 1rem 0.75rem 2.5rem;
196
- border-radius: 0.25rem;
197
- border: 0.125rem solid var(--border-color);
198
- background: var(--background-color);
199
- padding-right: 7.5rem;
200
- color: var(--text-color);
201
-
202
- &::placeholder {
203
- color: var(--placeholder-color);
204
- }
205
-
206
- &:hover {
207
- //Rescope hover state
208
- --icon-color: var(--qld-dark-grey-muted);
209
- --text-color: var(--qld-text-grey);
210
- --placeholder-color: var(--qld-text-grey);
211
- --border-color: var(--qld-light-action-primary);
212
- --background-color: var(--qld-default-background-shade);
213
- }
214
-
215
- &:focus {
216
- //Rescope focus state
217
- --icon-color: var(--qld-text-grey);
218
- --text-color: var(--qld-text-grey);
219
- --placeholder-color: var(--qld-text-grey);
220
- --border-color: var(--qld-soft-grey);
221
- --background-color: var(--qld-white);
222
-
223
- outline: 0.188rem solid var(--outline-color);
224
- outline-offset: 0.125rem;
225
- }
226
- }
227
-
228
- button {
229
- position: absolute;
230
- top: 0;
231
- bottom: 0;
232
- right: 0;
233
- border-radius: 0 0.25rem 0.25rem 0;
234
-
235
- // Adjust button padding to allow for input borders of 2px top and bottom
236
- padding-top: calc(0.75rem - 0.125rem);
237
- padding-bottom: calc(0.75rem - 0.125rem);
238
-
239
- //prep a button "search-icon" which is invoked at smaller screeen sizes below
240
- span.btn-icon {
241
- display: none;
242
- width: 1.5rem;
243
- height: 1.5rem;
244
- height: 1.5rem;
245
- margin-right: 0;
246
- background-color: var(--icon-color-on-btn);
247
- mask: var(--icon) center center / 1.25rem no-repeat;
248
- }
249
- }
250
- }
251
-
252
- @include media-breakpoint-up(md) {
253
- .qld-search-input {
254
- button {
255
- span.btn-label {
256
- display: block;
257
- }
258
-
259
- span.btn-icon {
260
- display: none;
261
- }
262
- }
263
- }
264
- }
265
-
266
- //Adjustments for 991px and below
267
- // Apply styles for medium screens and down
268
- @include media-breakpoint-down(md) {
269
- .qld-search-input {
270
- button {
271
- span.btn-label {
272
- display: none;
273
- }
274
-
275
- //Show the search icon (on button) on small screens
276
- span.btn-icon {
277
- display: block;
278
- }
279
- }
278
+ &.is-filled {
279
+ --background-color: var(--#{$prefix}neutral-lightest);
280
280
 
281
281
  .form-control {
282
- padding-left: 1rem;
283
- padding-right: 4rem;
284
- }
285
-
286
- #search-button {
287
- &.btn {
288
- padding: 0;
289
- margin: 0;
290
- width: 3rem;
282
+ border: {
283
+ top-width: 0;
284
+ right-width: 0;
285
+ bottom-width: 0.125rem;
286
+ left-width: 0;
287
+ radius: $border-radius 0 0 0;
288
+ }
291
289
 
292
- .btn-icon {
293
- margin-left: 0.65rem;
294
- }
290
+ &:active,
291
+ &:focus {
292
+ --border-color: var(--#{$prefix}neutral-lighter);
293
+ border-bottom-left-radius: $border-radius;
295
294
  }
296
295
  }
297
296
 
298
- //Hide the search icon (input field) on small screens
299
- &::before {
300
- content: none;
297
+ > button {
298
+ border-radius: 0 $border-radius 0 0;
301
299
  }
302
300
  }
303
- }
304
-
305
- .dark {
306
- .qld-search-input {
307
- // Rescope colours inside a dark container
308
-
309
- // Default state - unfocused, unhovered
310
- --icon-color: #deebf9;
311
- --icon-color-on-btn: var(--qld-dark-action-text);
312
301
 
313
- --text-color: #deebf9;
314
- --placeholder-color: #deebf9;
315
- --border-color: var(--qld-dark-alt-border);
316
- --background-color: var(--qld-dark-background);
317
-
318
- //Icon color is scoped against the parent container, not the input :(
319
- &:has(.form-control:hover) {
320
- --icon-color: var(--qld-white);
321
- }
302
+ .dark &,
303
+ .dark-alt & {
304
+ --background-color: var(--#{$prefix}dark-background-background);
305
+ --border-color: var(--#{$prefix}dark-alt-border);
306
+ --placeholder-color: var(--${prefix}dark-text-lighter);
307
+ --qld-icon-color: var(--#{$prefix}white);
308
+ --text-color: var(--#{$prefix}dark-text-text);
309
+
310
+ // Suggestions variables
311
+ --suggestions-bg: var(
312
+ --#{$prefix}color-default-color-dark-background-default-shade
313
+ );
314
+ --suggestions-hover: var(
315
+ --#{$prefix}color-default-color-dark-background-default
316
+ );
317
+ --suggestions-hover-border-color: var(
318
+ --#{$prefix}color-default-color-dark-accent-design-accent
319
+ );
320
+ --suggestions-feature-bg: var(
321
+ --#{$prefix}color-default-color-dark-background-alt
322
+ );
323
+ --suggestions-feature-hover: var(
324
+ --#{$prefix}color-default-color-dark-background-alt-shade
325
+ );
326
+ --suggestions-feature-text-color: var(
327
+ --#{$prefix}color-default-color-dark-text-default
328
+ );
322
329
 
323
330
  &:has(.form-control:focus) {
324
- --icon-color: var(--qld-text-grey);
325
- --text-color: var(--qld-text-grey);
331
+ --qld-icon-color: var(--#{$prefix}light-text-lighter);
332
+ --text-color: var(--#{$prefix}light-text-text);
326
333
  }
327
334
 
328
335
  .form-control {
329
336
  &:hover {
330
- //Dark - Hover state
331
- --text-color: var(--qld-white);
332
- --placeholder-color: var(--qld-white);
333
- --background-color: var(--qld-dark-background-shade);
334
- --border-color: var(--qld-dark-action-primary-hover);
337
+ --background-color: var(--#{$prefix}dark-background-shade);
338
+ --border-color: var(--#{$prefix}dark-action-primary-hover);
335
339
  }
336
340
 
341
+ &:active,
337
342
  &:focus {
338
- //Dark - Focus state
339
- --text-color: var(--qld-text-grey);
340
- --placeholder-color: var(--qld-text-grey);
341
- --border-color: var(--qld-light-grey);
342
- --background-color: var(--qld-white);
343
+ --text-color: var(--#{$prefix}light-text-text);
344
+ --border-color: var(--#{$prefix}neutral-lighter);
345
+ --background-color: var(--#{$prefix}white);
346
+ }
347
+ }
348
+
349
+ &.is-filled {
350
+ --background-color: var(--#{$prefix}dark-background-shade);
351
+
352
+ .form-control {
353
+ &:hover {
354
+ --background-color: var(--#{$prefix}dark-background-shade);
355
+ --border-color: var(--#{$prefix}dark-action-primary-hover);
356
+ }
357
+
358
+ &:active,
359
+ &:focus {
360
+ --background-color: var(--#{$prefix}white);
361
+ --border-color: var(--#{$prefix}neutral-lighter);
362
+ }
343
363
  }
344
364
  }
345
365
  }
366
+
346
367
  }
@@ -6,66 +6,82 @@ export default {
6
6
  tags: ["autodocs"],
7
7
  title: "3. Components/Search Input",
8
8
  render: (args) => {
9
- return `<form action="https://uat.forgov.qld.gov.au/search" class="site-search">${new SearchInput(args).html}</form>`;
10
- },
11
-
12
- argTypes: {
9
+ return `<form action="https://uat.forgov.qld.gov.au/search" class="site-search p-3">${new SearchInput(args).html}</form>`;
13
10
  },
14
11
 
12
+ argTypes: {},
15
13
  parameters: {
16
14
  docs: {
17
15
  controls: {
18
- exclude: ["variantClass", "customClass", "inputID", "inputName", "buttonID", "buttonType", "ariaLabel"],
16
+ include: ["buttonLabel", "suggestions"],
19
17
  },
18
+ story: { height: "400px" },
20
19
  },
21
20
  },
22
-
23
21
  };
24
22
 
25
-
26
-
27
-
28
- /**
29
- * Default Search Input
30
- */
31
23
  export const Default = {
32
24
  args: defaultdata,
25
+ name: "Default - Outline Variant",
33
26
  };
34
27
 
35
28
  /**
36
- * Full width Search Input
29
+ * With `customClass: is-filled`
37
30
  */
31
+ export const FilledVariant = {
32
+ args: { ...defaultdata, customClass: "is-filled" },
33
+ };
34
+
38
35
  export const FullWidth = {
39
36
  args: {
40
37
  ...defaultdata,
41
38
  customClass: "full-width",
42
39
  },
43
- }
44
-
40
+ };
45
41
 
46
42
  /**
47
43
  * Dark themed Search Input
48
- *
49
- * Apply a class <code>.dark</code> to the parent container of the <code>.qld-search-input</code> element.
44
+ *
45
+ * Apply a class <code>.dark</code> to the parent container of the <code>.qld-search-input</code> element.
50
46
  */
51
-
52
47
  export const Dark = {
53
- args: {
54
- ...defaultdata,
55
- variantClass: "dark",
48
+ args: {
49
+ ...defaultdata,
50
+ },
51
+ parameters: {
52
+ backgrounds: {
53
+ default: "Dark",
54
+ values: [{ name: "Dark", value: "var(--qld-dark-background)" }],
55
+ },
56
56
  },
57
+ decorators: [
58
+ (Story) => {
59
+ return `
60
+ <div class="dark">
61
+ ${Story()}
62
+ </div>
63
+ `;
64
+ },
65
+ ],
66
+ };
67
+
68
+ /**
69
+ * Dark themed Search Input
70
+ *
71
+ * Apply a class <code>.dark</code> to the parent container of the <code>.qld-search-input</code> element.
72
+ */
73
+ export const DarkFilled = {
74
+ args: { ...defaultdata, customClass: "is-filled" },
57
75
  parameters: {
58
76
  backgrounds: {
59
- default: 'Dark',
60
- values: [
61
- { name: 'Dark', value: 'var(--qld-brand-primary)' },
62
- ],
77
+ default: "Dark",
78
+ values: [{ name: "Dark", value: "var(--qld-dark-background)" }],
63
79
  },
64
80
  },
65
81
  decorators: [
66
82
  (Story) => {
67
83
  return `
68
- <div class="dark p-5">
84
+ <div class="dark">
69
85
  ${Story()}
70
86
  </div>
71
87
  `;