@qld-gov-au/qgds-bootstrap5 2.0.11 → 2.0.12

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 (78) hide show
  1. package/.storybook/preview.js +5 -2
  2. package/dist/assets/components/bs5/dateinput/dateinput.hbs +27 -27
  3. package/dist/assets/components/bs5/formcheck/formcheck.hbs +10 -2
  4. package/dist/assets/components/bs5/head/head.hbs +1 -1
  5. package/dist/assets/components/bs5/searchInput/searchInput.hbs +31 -29
  6. package/dist/assets/components/bs5/select/select.hbs +19 -19
  7. package/dist/assets/components/bs5/textarea/textarea.hbs +17 -17
  8. package/dist/assets/components/bs5/textbox/textbox.hbs +17 -18
  9. package/dist/assets/css/qld.bootstrap.css +2 -2
  10. package/dist/assets/css/qld.bootstrap.css.map +3 -3
  11. package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
  12. package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
  13. package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
  14. package/dist/assets/js/handlebars.init.min.js +134 -125
  15. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  16. package/dist/assets/js/handlebars.partials.js +134 -125
  17. package/dist/assets/js/handlebars.partials.js.map +2 -2
  18. package/dist/assets/js/qld.bootstrap.min.js +9 -10
  19. package/dist/assets/js/qld.bootstrap.min.js.map +3 -3
  20. package/dist/assets/node/handlebars.init.min.js +51 -7
  21. package/dist/assets/node/handlebars.init.min.js.map +2 -2
  22. package/dist/components/bs5/dateinput/dateinput.hbs +27 -27
  23. package/dist/components/bs5/formcheck/formcheck.hbs +10 -2
  24. package/dist/components/bs5/head/head.hbs +1 -1
  25. package/dist/components/bs5/searchInput/searchInput.hbs +31 -29
  26. package/dist/components/bs5/select/select.hbs +19 -19
  27. package/dist/components/bs5/textarea/textarea.hbs +17 -17
  28. package/dist/components/bs5/textbox/textbox.hbs +17 -18
  29. package/dist/package.json +1 -1
  30. package/dist/sample-data/dateinput/dateinput.data.json +14 -12
  31. package/dist/sample-data/formcheck/stories/checkbox/checkbox.data.json +4 -5
  32. package/dist/sample-data/formcheck/stories/radio/radio.data.json +4 -4
  33. package/dist/sample-data/searchInput/searchInput.data.json +19 -10
  34. package/dist/sample-data/select/select.data.json +12 -10
  35. package/dist/sample-data/textarea/textarea.data.json +14 -11
  36. package/dist/sample-data/textbox/textbox.data.json +13 -10
  37. package/package.json +1 -1
  38. package/src/components/bs5/dateinput/Dateinput.js +26 -11
  39. package/src/components/bs5/dateinput/dateinput.data.json +14 -12
  40. package/src/components/bs5/dateinput/dateinput.hbs +27 -27
  41. package/src/components/bs5/formcheck/Formcheck.js +57 -6
  42. package/src/components/bs5/formcheck/_form-variables.scss +131 -0
  43. package/src/components/bs5/formcheck/formcheck.hbs +10 -2
  44. package/src/components/bs5/formcheck/formcheck.scss +229 -66
  45. package/src/components/bs5/formcheck/stories/bootstrap-validation/bootstrap-validation.stories.js +304 -0
  46. package/src/components/bs5/formcheck/stories/checkbox/checkbox.data.json +4 -5
  47. package/src/components/bs5/formcheck/stories/checkbox/checkbox.stories.js +19 -111
  48. package/src/components/bs5/formcheck/stories/radio/radio.data.json +4 -4
  49. package/src/components/bs5/formcheck/stories/radio/radio.stories.js +30 -122
  50. package/src/components/bs5/inpageAlert/inpageAlert.scss +1 -1
  51. package/src/components/bs5/pageLayout/{ThemeShowcase.stories.js → PaletteShowcase.stories.js} +36 -35
  52. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +24 -28
  53. package/src/components/bs5/searchInput/search.functions.js +93 -76
  54. package/src/components/bs5/searchInput/searchInput.data.json +19 -10
  55. package/src/components/bs5/searchInput/searchInput.hbs +31 -29
  56. package/src/components/bs5/searchInput/searchInput.scss +140 -196
  57. package/src/components/bs5/searchInput/searchInput.stories.js +35 -13
  58. package/src/components/bs5/searchInput/searchInput.test.js +5 -1
  59. package/src/components/bs5/select/Select.js +13 -5
  60. package/src/components/bs5/select/Select.stories.js +27 -83
  61. package/src/components/bs5/select/select.data.json +12 -10
  62. package/src/components/bs5/select/select.hbs +19 -19
  63. package/src/components/bs5/textarea/Textarea.js +13 -5
  64. package/src/components/bs5/textarea/Textarea.stories.js +29 -55
  65. package/src/components/bs5/textarea/textarea.data.json +14 -11
  66. package/src/components/bs5/textarea/textarea.hbs +17 -17
  67. package/src/components/bs5/textbox/Textbox.js +16 -5
  68. package/src/components/bs5/textbox/Textbox.stories.js +26 -51
  69. package/src/components/bs5/textbox/textInput.scss +12 -232
  70. package/src/components/bs5/textbox/textbox.data.json +13 -10
  71. package/src/components/bs5/textbox/textbox.hbs +17 -18
  72. package/src/css/functions/_index.scss +2 -0
  73. package/src/css/functions/remify.scss +32 -0
  74. package/src/css/functions/snap-line-height.scss +7 -0
  75. package/src/css/main.scss +1 -1
  76. package/src/css/mixins/focusable.scss +3 -0
  77. package/src/css/{qld-theme.scss → qld-palettes.scss} +30 -23
  78. package/src/components/bs5/formcheck/_formcheck.stories.bak.js +0 -432
@@ -1,7 +1,7 @@
1
+ @use "../../../css/functions" as f;
2
+
1
3
  .qld-text-input {
2
- padding: 12px 16px;
3
- border-radius: 4px;
4
- border: 2px solid $qld-soft-grey;
4
+ @extend %form-control;
5
5
 
6
6
  @media (prefers-color-scheme: dark) {
7
7
  --table-row-border-color: var(--qld-white);
@@ -9,44 +9,18 @@
9
9
 
10
10
  //Table dark
11
11
  @include table-variant("dark", $qld-brand-primary);
12
-
13
- &:hover {
14
- background-color: $qld-extra-light-grey;
15
- border-color: $qld-textbox-border-color;
16
- }
17
-
18
- &:focus {
19
- outline: 3px solid $qld-light-blue;
20
- outline-offset: 2px;
21
- background-color: $qld-white !important;
22
- border: 2px solid $qld-light-grey !important;
23
- }
24
-
25
- &.form-style-filled {
26
- background-color: $qld-light-grey-alt;
27
- border-width: 0 0 2px 0;
28
- border-bottom-left-radius: 0;
29
- border-bottom-right-radius: 0;
30
-
31
- &:focus {
32
- border-radius: 4px;
33
- }
34
- }
35
-
36
- &:disabled {
37
- cursor: not-allowed;
38
- opacity: 0.5;
39
- }
40
12
  }
41
13
 
42
14
  .qld-text-input-label {
43
15
  color: var(--#{$prefix}text-grey);
44
16
  display: block;
17
+ font-size: 1rem;
45
18
  font-weight: 600;
46
- line-height: 1.5;
47
- margin-bottom: 0.5rem;
19
+ line-height: $input-line-height;
20
+ margin-bottom: f.remify(8px);
48
21
 
49
22
  .label-text-optional {
23
+ font-size: f.remify(14px);
50
24
  color: $qld-dark-grey-muted;
51
25
  font-weight: 400;
52
26
  }
@@ -64,146 +38,19 @@
64
38
  }
65
39
  }
66
40
 
67
- * + .qld-hint-text,
68
- * + .qld-input-error,
69
- * + .qld-input-success,
70
41
  * + .date-container {
71
- margin-top: 8px;
42
+ margin-top: f.remify(4px);
72
43
  }
73
44
 
74
45
  .qld-hint-text {
75
46
  color: $qld-hint-text-color;
76
47
  display: block;
77
- font-size: 1em;
78
- line-height: 1.5;
79
- margin-bottom: 0.5rem;
80
- }
81
-
82
- * + p.qld-input-error,
83
- * + span.qld-input-error,
84
- * + p.qld-input-success,
85
- * + span.qld-input-success {
86
- font-size: 1rem;
87
- line-height: 1.5;
88
- display: flex;
89
- flex-wrap: wrap;
90
- margin-left: -6px;
91
- align-items: center;
92
- }
93
-
94
- span.qld-input-success {
95
- &:before {
96
- content: "";
97
- height: 2rem;
98
- width: 2rem;
99
- transform: scale(0.6);
100
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' enable-background='new 0 0 64 64'%3E%3Cpath d='M32,2C15.431,2,2,15.432,2,32c0,16.568,13.432,30,30,30c16.568,0,30-13.432,30-30C62,15.432,48.568,2,32,2z M25.025,50 l-0.02-0.02L24.988,50L11,35.6l7.029-7.164l6.977,7.184l21-21.619L53,21.199L25.025,50z' fill='%2343a047'/%3E%3C/svg%3E");
101
- }
102
- }
103
-
104
- span.qld-input-error {
105
- color: $qld-notify-warning;
106
-
107
- &:before {
108
- content: "";
109
- height: 2rem;
110
- width: 2rem;
111
- //background-image: url('../../../img/icon-exclamation.svg');
112
- background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M24 12C24 18.6274 18.6274 24 12 24C5.37258 24 0 18.6274 0 12C0 5.37258 5.37258 0 12 0C18.6274 0 24 5.37258 24 12Z' fill='%23E22339'/%3E%3Cpath d='M11 18C11 17.4477 11.4477 17 12 17C12.5523 17 13 17.4477 13 18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18Z' fill='white'/%3E%3Cpath d='M11 5C11 4.44771 11.4477 4 12 4C12.5523 4 13 4.44772 13 5V14C13 14.5523 12.5523 15 12 15C11.4477 15 11 14.5523 11 14V5Z' fill='white'/%3E%3C/svg%3E");
113
- background-repeat: no-repeat;
114
- transform: scale(0.6);
115
- }
116
-
117
- .dark & {
118
- color: $qld-color-error-light;
119
- }
120
- }
121
-
122
- .qld-hint-text + select,
123
- .qld-hint-text + input,
124
- .qld-hint-text + textarea,
125
- .sq-form-question-note + select,
126
- .sq-form-question-note + input,
127
- .sq-form-question-note + textarea {
128
- margin-top: 0.5rem;
129
- }
130
-
131
- .qld-input-success + input[type="text"],
132
- .qld-input-error + input[type="text"],
133
- .qld-input-success + input[type="email"],
134
- .qld-input-error + input[type="email"],
135
- .qld-input-success + input[type="date"],
136
- .qld-input-error + input[type="date"],
137
- .qld-input-success + .qld-text-input,
138
- .qld-input-error + .qld-text-input,
139
- .qld-input-success + textarea,
140
- .qld-input-error + textarea {
141
- margin-top: 8px;
142
- margin-top: 0.5rem;
143
- }
144
-
145
- input.qld-text-input.qld-input-error:not(:focus),
146
- input.qld-text-input.qld-input-error.form-style-filled:not(:focus),
147
- textarea.qld-text-input.qld-input-error:not(:focus),
148
- select.qld-select.qld-input-error:not(:focus) {
149
- border-color: $qld-notify-warning;
150
- background-color: $qld-color-error-light;
151
- color: $qld-text-grey;
152
- }
153
-
154
- input.qld-text-input.qld-input-success:not(:focus),
155
- input.qld-text-input.qld-input-success.form-style-filled:not(:focus),
156
- textarea.qld-text-input.qld-input-success:not(:focus),
157
- select.qld-select.qld-input-success:not(:focus) {
158
- border-color: $qld-notify-success;
159
- background-color: $qld-color-success-light;
160
- color: $qld-text-grey;
161
- }
162
-
163
- .qld-select {
164
- padding: 12px 18px;
165
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23008635' d='M4.251 181.1C7.392 177.7 11.69 175.1 16 175.1c3.891 0 7.781 1.406 10.86 4.25l197.1 181.1l197.1-181.1c6.5-6 16.64-5.625 22.61 .9062c6 6.5 5.594 16.59-.8906 22.59l-208 192c-6.156 5.688-15.56 5.688-21.72 0l-208-192C-1.343 197.7-1.749 187.6 4.251 181.1z'/%3E%3C/svg%3E");
166
- background-repeat: no-repeat;
167
- appearance: none;
168
- background-position: right 11px center;
169
- background-size: 1rem auto;
170
- width: 100%;
171
- color: var(--#{$prefix}color-default-color-light-text-lighter);
172
-
173
- &.disabled,
174
- &:disabled {
175
- background-color: var(
176
- --#{$prefix}color-default-color-light-background-default-shade
177
- );
178
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23636363' d='M4.251 181.1C7.392 177.7 11.69 175.1 16 175.1c3.891 0 7.781 1.406 10.86 4.25l197.1 181.1l197.1-181.1c6.5-6 16.64-5.625 22.61 .9062c6 6.5 5.594 16.59-.8906 22.59l-208 192c-6.156 5.688-15.56 5.688-21.72 0l-208-192C-1.343 197.7-1.749 187.6 4.251 181.1z'/%3E%3C/svg%3E");
179
- }
180
-
181
- &.qld-input-error {
182
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23E22339' d='M4.251 181.1C7.392 177.7 11.69 175.1 16 175.1c3.891 0 7.781 1.406 10.86 4.25l197.1 181.1l197.1-181.1c6.5-6 16.64-5.625 22.61 .9062c6 6.5 5.594 16.59-.8906 22.59l-208 192c-6.156 5.688-15.56 5.688-21.72 0l-208-192C-1.343 197.7-1.749 187.6 4.251 181.1z'/%3E%3C/svg%3E");
183
-
184
- &:not([multiple]):not([size]),
185
- &:not([multiple])[size="1"] {
186
- background-size: 1rem auto;
187
- }
188
- }
189
-
190
- &.qld-input-success {
191
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23339d37' d='M4.251 181.1C7.392 177.7 11.69 175.1 16 175.1c3.891 0 7.781 1.406 10.86 4.25l197.1 181.1l197.1-181.1c6.5-6 16.64-5.625 22.61 .9062c6 6.5 5.594 16.59-.8906 22.59l-208 192c-6.156 5.688-15.56 5.688-21.72 0l-208-192C-1.343 197.7-1.749 187.6 4.251 181.1z'/%3E%3C/svg%3E");
192
-
193
- &:not([multiple]):not([size]),
194
- &:not([multiple])[size="1"] {
195
- background-size: 1rem auto;
196
- }
197
- }
48
+ font-size: f.remify(14px);
49
+ line-height: f.snap-line-height(1.5);
50
+ margin-block: f.remify(8px);
198
51
  }
199
52
 
200
- .qld-input-success {
201
- @extend .is-valid;
202
- }
203
-
204
- .qld-input-error {
205
- @extend .is-invalid;
206
- }
53
+ // .qld-select style moved to formcheck.scss
207
54
 
208
55
  @include media-breakpoint-up(md) {
209
56
  input.qld-field-width-1-quarter,
@@ -223,73 +70,6 @@ select.qld-select.qld-input-success:not(:focus) {
223
70
  }
224
71
 
225
72
  .dark {
226
- .form-control.qld-text-input:not(:hover):not(:focus):not(
227
- .qld-input-error
228
- ):not(.qld-input-success)::-webkit-input-placeholder {
229
- color: $qld-hint-text-color-muted;
230
- }
231
-
232
- .form-control.qld-text-input:not(:hover):not(:focus):not(
233
- .qld-input-error
234
- ):not(.qld-input-success)::-moz-placeholder {
235
- color: $qld-hint-text-color-muted;
236
- }
237
-
238
- .form-control.qld-text-input:not(:hover):not(:focus):not(
239
- .qld-input-error
240
- ):not(.qld-input-success)::-ms-placeholder {
241
- color: $qld-hint-text-color-muted;
242
- }
243
-
244
- .form-control.qld-text-input:not(:hover):not(:focus):not(
245
- .qld-input-error
246
- ):not(.qld-input-success)::placeholder {
247
- color: $qld-hint-text-color-muted;
248
- }
249
-
250
- .form-control.qld-text-input:hover:not(:focus):not(.qld-input-error):not(
251
- .qld-input-success
252
- )::-webkit-input-placeholder {
253
- color: $qld-white;
254
- }
255
-
256
- .form-control.qld-text-input:hover:not(:focus):not(.qld-input-error):not(
257
- .qld-input-success
258
- )::-moz-placeholder {
259
- color: $qld-white;
260
- }
261
-
262
- .form-control.qld-text-input:hover:not(:focus):not(.qld-input-error):not(
263
- .qld-input-success
264
- )::-ms-placeholder {
265
- color: $qld-white;
266
- }
267
-
268
- .form-control.qld-text-input:hover:not(:focus):not(.qld-input-error):not(
269
- .qld-input-success
270
- )::placeholder {
271
- color: $qld-white;
272
- }
273
- }
274
-
275
- .dark {
276
- .qld-text-input {
277
- border-color: $qld-dark-alt-border;
278
- background-color: var(--qld-dark-background);
279
- color: $qld-hint-text-color-muted;
280
-
281
- &:hover {
282
- color: $qld-white;
283
- background-color: $qld-color-dark-background--shade;
284
- border-color: $color-default-color-dark-action-primary-hover;
285
- }
286
-
287
- &:focus {
288
- outline: 3px solid $qld-dark-focus;
289
- color: $qld-text-grey;
290
- }
291
- }
292
-
293
73
  .qld-select {
294
74
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23FFEF60' d='M4.251 181.1C7.392 177.7 11.69 175.1 16 175.1c3.891 0 7.781 1.406 10.86 4.25l197.1 181.1l197.1-181.1c6.5-6 16.64-5.625 22.61 .9062c6 6.5 5.594 16.59-.8906 22.59l-208 192c-6.156 5.688-15.56 5.688-21.72 0l-208-192C-1.343 197.7-1.749 187.6 4.251 181.1z'/%3E%3C/svg%3E");
295
75
  }
@@ -1,12 +1,15 @@
1
1
  {
2
- "isDisabled": false,
3
- "isRequired": true,
4
- "isFilled": false,
5
- "customClass": "",
6
- "label-text": "Label",
7
- "placeholder": "Hello World",
8
- "optional-text": "optional",
9
- "hint-text": "Hint",
10
- "successMessageText": "Success message",
11
- "errorMessageText": "Error message"
2
+ "id": "example-1",
3
+ "value": "",
4
+ "isDisabled": false,
5
+ "isRequired": true,
6
+ "isValid": null,
7
+ "isFilled": false,
8
+ "customClass": "",
9
+ "label-text": "Label",
10
+ "placeholder": "",
11
+ "optional-text": "optional",
12
+ "hint-text": "Hint",
13
+ "successMessageText": "Success message",
14
+ "errorMessageText": "Error message"
12
15
  }
@@ -1,32 +1,31 @@
1
1
  <!-- QGDS Component: Textbox -->
2
2
 
3
- <!-- Label for the first input field -->
4
3
  <label class="qld-text-input-label {{#if isRequired}}field-required{{/if}} {{#if isDisabled}}field-disabled{{/if}}"
5
- for="example-1">
4
+ for="{{id}}">
6
5
  {{label-text}}
7
6
  {{#if optional-text}}
8
7
  <span class="label-text-optional">({{optional-text}})</span>
9
8
  {{/if}}
10
9
  </label>
11
10
 
12
- <!-- Hint text for the first input field -->
13
11
  {{#if hint-text}}
14
- <span class="qld-hint-text" id="example-1-hint">{{hint-text}}</span>
12
+ <span class="qld-hint-text" id="{{id}}-hint">{{hint-text}}</span>
15
13
  {{/if}}
16
14
 
17
- {{#contains "qld-input-success" customClass}}
18
- <span id="text-field-success" class="qld-input-success">
19
- {{successMessageText}}
20
- </span>
21
- {{/contains}}
15
+ {{#contains "qld-input-success" customClass}}{{! legacy support for feedback classes `qld-input-success`}}
16
+ <span class="qld-input-success">{{successMessageText}}</span>
17
+ {{else}}
18
+ {{#if successMessageText}}{{! updated bootstrap style classes - `valid-feedback`}}
19
+ <div class="valid-feedback">{{successMessageText}}</div>
20
+ {{/if}}{{/contains}}
22
21
 
23
- {{#contains "qld-input-error" customClass}}
24
- <span id="text-field-error" class="qld-input-error">
25
- {{errorMessageText}}
26
- </span>
27
- {{/contains}}
22
+ {{#contains "qld-input-error" customClass}}{{! legacy support for feedback classes `qld-input-error`}}
23
+ <span class="qld-input-error">{{errorMessageText}}</span>
24
+ {{else}}
25
+ {{#if errorMessageText}}{{! updated bootstrap style classes - `invalid-feedback`}}
26
+ <div class="invalid-feedback">{{errorMessageText}}</div>
27
+ {{/if}}{{/contains}}
28
28
 
29
- <!-- First text input field, described by the hint text above -->
30
- <input id="example-1" class="qld-text-input form-control {{customClass}} {{#if isFilled}}form-style-filled{{/if}}"
31
- type="text" placeholder="{{placeholder}}" aria-label="Text input example" {{#if isDisabled}}disabled{{/if}} {{#if
32
- isRequired}}required aria-required="true" {{/if}} />
29
+ <input id={{id}} {{#if value}}value="{{value}}"{{/if}} class="form-control {{customClass}} {{#if isFilled}}is-filled{{/if}} {{#if isValid}}is-valid{{else}}{{#ifCond isValid "===" false}}is-invalid{{/ifCond}}{{/if}}"
30
+ type="text" placeholder="{{placeholder}}" {{#if isDisabled}}disabled{{/if}} {{#if
31
+ isRequired}}required{{/if}} {{#if hint-text}}aria-describedby="{{id}}-hint"{{/if}} />
@@ -1 +1,3 @@
1
1
  @forward "in-list";
2
+ @forward "remify";
3
+ @forward "snap-line-height";
@@ -0,0 +1,32 @@
1
+ @use "sass:math";
2
+ @use "sass:meta";
3
+ @use "sass:list";
4
+
5
+ ///
6
+ /// Easily convert px to rems
7
+ /// @param {Number} $value The px value to convert to rem. May be unitless or supplied as px units.
8
+ /// @param {Number} $baseline [16px] The assumed px value of 1rem.
9
+ /// @todo support complex property values eg: `border: remify(4px 8px 12px 2rem)`;
10
+ @function remify($value, $baseline: 16px) {
11
+ @if (math.is-unitless($baseline)) {
12
+ $baseline-px: $baseline * 1px;
13
+ }
14
+
15
+ @if (math.unit($baseline) != "px") {
16
+ @error "parameter $baseline may only use px units";
17
+ }
18
+
19
+ @if (meta.type-of($value) == "list") {
20
+ $result: ();
21
+ @each $item in $value {
22
+ $result: list.append($result, remify($item));
23
+ }
24
+ @return $result;
25
+ }
26
+
27
+ @if (math.is-unitless($value)) {
28
+ $value: $value * 1px;
29
+ }
30
+
31
+ @return (math.div($value, $baseline) * 1rem);
32
+ }
@@ -0,0 +1,7 @@
1
+ @use "remify" as *;
2
+ ///
3
+ /// Calculate a lineheight snapped to nearest 4px value, based on current font size
4
+ /// The returned value is absolute, so only use on leaf nodes where relative line-height value doesn't need to cascade.
5
+ @function snap-line-height($ideal-line-height: 1.4, $grid-size: 4px) {
6
+ @return round(nearest, calc(1em * $ideal-line-height), remify($grid-size));
7
+ }
package/src/css/main.scss CHANGED
@@ -100,7 +100,7 @@ $enable-dark-mode: true;
100
100
  @import "../../node_modules/bootstrap/scss/utilities/api";
101
101
 
102
102
  // Themes
103
- @import "qld-theme";
103
+ @import "qld-palettes";
104
104
 
105
105
  //8. QLD Design System typography (bootstrap overrides and custom). Please maintain naming consistency.
106
106
  @import "./qld-type";
@@ -4,6 +4,7 @@
4
4
  /// @param {Boolean} $isFocusWithin [false] - Optionally apply styles via :focus-within rather than :focus-visible
5
5
  /// @param {String} $outlineWidth: [3px] The width of the outline.
6
6
  /// @param {String} $customSelector [null] - If passed, will override $isFocusWithin and apply focus styles instead to a custom selector string. @see SearchInput
7
+ /// @content
7
8
 
8
9
  @mixin focusable(
9
10
  $offsetOutline: true,
@@ -39,5 +40,7 @@
39
40
  ); // --qld-focus-color defined in qld-type.scss
40
41
  offset: $offsetOutline;
41
42
  }
43
+
44
+ @content;
42
45
  }
43
46
  }
@@ -2,7 +2,7 @@
2
2
  // Provides complete theme styling including color, background-color, and CSS variables
3
3
 
4
4
  // Theme properties mixins to avoid duplication
5
- @mixin light-theme-properties {
5
+ %qld-palette-default {
6
6
  background-color: var(--qld-body-bg);
7
7
  color: var(--qld-body-color);
8
8
  --qld-action-icon-color: var(--qld-light-action-secondary);
@@ -15,7 +15,6 @@
15
15
  --qld-headings-color: #{$headings-color};
16
16
  --qld-link-color: #{$link-color};
17
17
  --qld-link-color-rgb: #{to-rgb($link-color)};
18
- --qld-link-font-weight: 400;
19
18
  --qld-link-hover-color: var(--qld-link-color);
20
19
  --qld-link-visited-color: #{$color-default-color-light-link-visited};
21
20
  --qld-link-hover-color-rgb: var(--qld-link-color-rgb);
@@ -30,12 +29,26 @@
30
29
  --qld-selection-color: var(--qld-white);
31
30
  }
32
31
 
33
- @mixin dark-theme-properties {
32
+ %qld-palette-light {
33
+ @extend %qld-palette-default;
34
+ --qld-body-bg: var(--qld-light-background);
35
+ --qld-border-color: var(--#{$prefix}color-default-color-light-border-light);
36
+ }
37
+
38
+ %qld-palette-alt {
39
+ @extend %qld-palette-default;
40
+ --qld-body-bg: var(--qld-light-alt-background);
41
+ --qld-border-color: var(--qld-soft-grey);
42
+ }
43
+
44
+ %qld-palette-dark {
34
45
  background-color: var(--qld-body-bg);
35
46
  color: var(--qld-body-color);
36
47
  --qld-action-icon-color: var(--qld-dark-action-secondary);
37
48
  --qld-action-icon-hover-color: var(--qld-dark-action-secondary-hover);
49
+ --qld-body-bg: var(--qld-dark-background);
38
50
  --qld-body-color: #fff;
51
+ --qld-border-color: var(--qld-dark-border);
39
52
  --qld-focus-color: var(--qld-dark-focus);
40
53
  --qld-headings-color: #{$color-default-color-dark-text-heading};
41
54
  --qld-link-color: #{$color-default-color-dark-link-default};
@@ -54,42 +67,36 @@
54
67
  --qld-selection-color: var(--qld-brand-primary);
55
68
  }
56
69
 
70
+ %qld-palette-dark-alt {
71
+ @extend %qld-palette-dark;
72
+ --qld-body-bg: var(--qld-dark-alt-background);
73
+ --qld-border-color: var(--qld-dark-alt-border);
74
+ }
75
+
57
76
  // Default theme (inherits :root variables) and root variables
58
77
  :root,
59
78
  .default {
60
- @include light-theme-properties;
79
+ @extend %qld-palette-default;
61
80
  }
62
81
 
63
82
  // Light theme
64
83
  .light {
65
- @include light-theme-properties;
66
- --qld-body-bg: var(--qld-light-background);
67
- --qld-border-color: var(--#{$prefix}color-default-color-light-border-light);
84
+ @extend %qld-palette-light;
68
85
  }
69
86
 
70
87
  // Alt theme (light alternative)
71
88
  .alt {
72
- @include light-theme-properties;
73
- --qld-body-bg: var(--qld-light-alt-background);
74
- --qld-border-color: var(--qld-soft-grey);
89
+ @extend %qld-palette-alt;
75
90
  }
76
91
 
77
92
  // Dark theme
78
- .dark {
79
- @include dark-theme-properties;
80
- --qld-body-bg: var(--qld-dark-background);
81
- --qld-border-color: var(--qld-dark-border);
93
+ // Bootstrap dark mode support
94
+ .dark,
95
+ :root[data-bs-theme="dark"] {
96
+ @extend %qld-palette-dark;
82
97
  }
83
98
 
84
99
  // Dark alt theme
85
100
  .dark-alt {
86
- @include dark-theme-properties;
87
- --qld-body-bg: var(--qld-dark-alt-background);
88
- --qld-border-color: var(--qld-dark-alt-border);
89
- }
90
-
91
- // Bootstrap dark mode support
92
- :root[data-bs-theme="dark"] {
93
- @include dark-theme-properties;
94
- --qld-body-bg: var(--qld-brand-primary);
101
+ @extend %qld-palette-dark-alt;
95
102
  }