@allxsmith/bestax-bulma 5.50.0 → 5.52.0

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 (65) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Command.js +637 -0
  4. package/dist/esm/components/Command.js.map +1 -0
  5. package/dist/esm/components/EmptyState.js +2 -2
  6. package/dist/esm/components/Timeline.js +5 -5
  7. package/dist/esm/components/TreeView.js +3 -3
  8. package/dist/esm/components/TreeView.js.map +1 -1
  9. package/dist/esm/elements/DescriptionList.js +133 -0
  10. package/dist/esm/elements/DescriptionList.js.map +1 -0
  11. package/dist/esm/form/Autocomplete.js +2 -2
  12. package/dist/esm/form/CheckboxCard.js +118 -0
  13. package/dist/esm/form/CheckboxCard.js.map +1 -0
  14. package/dist/esm/form/Checkboxes.js +14 -3
  15. package/dist/esm/form/Checkboxes.js.map +1 -1
  16. package/dist/esm/form/RadioCard.js +85 -0
  17. package/dist/esm/form/RadioCard.js.map +1 -0
  18. package/dist/esm/form/Radios.js +14 -3
  19. package/dist/esm/form/Radios.js.map +1 -1
  20. package/dist/esm/form/groupFieldset.js +38 -0
  21. package/dist/esm/form/groupFieldset.js.map +1 -0
  22. package/dist/esm/form/useAutoLabelId.js +1 -1
  23. package/dist/esm/helpers/useComboboxEngine.js +3 -3
  24. package/dist/esm/helpers/useFocusTrap.js +2 -2
  25. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  26. package/dist/extras.css +1 -1
  27. package/dist/extras.css.map +1 -1
  28. package/dist/index.cjs +2685 -1694
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.esm.js +4 -0
  31. package/dist/index.esm.js.map +1 -1
  32. package/dist/types/components/Command.d.ts +318 -0
  33. package/dist/types/elements/DescriptionList.d.ts +185 -0
  34. package/dist/types/form/CheckboxCard.d.ts +94 -0
  35. package/dist/types/form/Checkboxes.d.ts +13 -0
  36. package/dist/types/form/RadioCard.d.ts +81 -0
  37. package/dist/types/form/Radios.d.ts +13 -0
  38. package/dist/types/form/groupFieldset.d.ts +32 -0
  39. package/dist/types/index.d.ts +4 -0
  40. package/dist/types-cjs/components/Command.d.ts +318 -0
  41. package/dist/types-cjs/elements/DescriptionList.d.ts +185 -0
  42. package/dist/types-cjs/form/CheckboxCard.d.ts +94 -0
  43. package/dist/types-cjs/form/Checkboxes.d.ts +13 -0
  44. package/dist/types-cjs/form/RadioCard.d.ts +81 -0
  45. package/dist/types-cjs/form/Radios.d.ts +13 -0
  46. package/dist/types-cjs/form/groupFieldset.d.ts +32 -0
  47. package/dist/types-cjs/index.d.ts +4 -0
  48. package/dist/versions/bestax-no-dark-mode.css +1 -1
  49. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  50. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  51. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  52. package/dist/versions/bestax-no-helpers.css +1 -1
  53. package/dist/versions/bestax-no-helpers.css.map +1 -1
  54. package/dist/versions/bestax-prefixed.css +1 -1
  55. package/dist/versions/bestax-prefixed.css.map +1 -1
  56. package/package.json +1 -1
  57. package/src/scss/components/_command.scss +259 -0
  58. package/src/scss/components/_index.scss +1 -0
  59. package/src/scss/elements/_descriptionlist.scss +153 -0
  60. package/src/scss/elements/_index.scss +1 -0
  61. package/src/scss/form/_checkbox.scss +44 -0
  62. package/src/scss/form/_checkboxcard.scss +355 -0
  63. package/src/scss/form/_index.scss +2 -0
  64. package/src/scss/form/_radio.scss +44 -0
  65. package/src/scss/form/_radiocard.scss +291 -0
@@ -0,0 +1,355 @@
1
+ // CheckboxCard styles
2
+ // A checkbox drawn as a card: a <label class="checkbox-card card"> holding the
3
+ // native input, then a .card-content span with the indicator and the text.
4
+ // Bulma's .card draws the surface. This partial adds the card's edge, which
5
+ // carries the checked state, the focus outline and the indicator.
6
+ //
7
+ // The edge is a pseudo-element of the content span, laid over the whole card,
8
+ // rather than a border on the label. The input comes before the content span,
9
+ // so `input:checked + …` reaches it without :has(), and a thicker edge when
10
+ // checked moves nothing inside the card. It's a real border, since Bulma's
11
+ // card draws its own edge with a box-shadow, which forced colors drops.
12
+
13
+ @use 'bulma/sass/utilities/initial-variables' as iv;
14
+ @use 'bulma/sass/utilities/css-variables' as cv;
15
+
16
+ $checkbox-card-border-width: 1px !default;
17
+ $checkbox-card-border-color: cv.getVar('border') !default;
18
+ $checkbox-card-hover-border-color: cv.getVar('border-hover') !default;
19
+ // Twice the edge, so a checked card differs from an unchecked one by more
20
+ // than its color (WCAG 1.4.1), with or without the indicator.
21
+ $checkbox-card-checked-border-width: 2px !default;
22
+ $checkbox-card-active-color: cv.getVar('primary') !default;
23
+ // Bulma's focus color and width, which every color of card shares, since
24
+ // some of the six fall short of 3:1 on a light page.
25
+ $checkbox-card-focus-color: hsl(
26
+ cv.getVar('focus-h'),
27
+ cv.getVar('focus-s'),
28
+ cv.getVar('focus-l')
29
+ ) !default;
30
+ $checkbox-card-focus-width: cv.getVar('focus-width') !default;
31
+ $checkbox-card-focus-offset: 2px !default;
32
+ $checkbox-card-gap: 0.75em !default;
33
+ $checkbox-card-min-width: 12rem !default;
34
+ $checkbox-card-title-weight: cv.getVar('weight-semibold') !default;
35
+ $checkbox-card-description-color: cv.getVar('text-weak') !default;
36
+ $checkbox-card-indicator-size: 1.25em !default;
37
+ $checkbox-card-indicator-border-width: 2px !default;
38
+ // The indicator's border is all that shows of an unchecked box, so it takes
39
+ // `text-weak`, as Checkbox's does, which holds 3:1 on the card's surface.
40
+ $checkbox-card-indicator-border-color: cv.getVar('text-weak') !default;
41
+ $checkbox-card-indicator-radius: cv.getVar('radius-small') !default;
42
+ $checkbox-card-check-color: cv.getVar('scheme-invert') !default;
43
+ $checkbox-card-disabled-opacity: 0.5 !default;
44
+ $checkbox-card-transition-duration: cv.getVar('duration') !default;
45
+
46
+ // The text's line height, which also places the indicator: it's centred on
47
+ // the title's first line while it's shorter than that line.
48
+ $-line-height: 1.5;
49
+
50
+ // The check mark's shape, used as a mask so it's painted with a background
51
+ // color: `checkbox-card-check-color`, or a system color in forced colors.
52
+ $-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
53
+
54
+ .#{iv.$class-prefix}checkbox-card {
55
+ @include cv.register-vars(
56
+ (
57
+ 'checkbox-card-border-width': #{$checkbox-card-border-width},
58
+ 'checkbox-card-border-color': #{$checkbox-card-border-color},
59
+ 'checkbox-card-hover-border-color': #{$checkbox-card-hover-border-color},
60
+ 'checkbox-card-checked-border-width':
61
+ #{$checkbox-card-checked-border-width},
62
+ 'checkbox-card-active-color': #{$checkbox-card-active-color},
63
+ 'checkbox-card-focus-color': #{$checkbox-card-focus-color},
64
+ 'checkbox-card-focus-width': #{$checkbox-card-focus-width},
65
+ 'checkbox-card-focus-offset': #{$checkbox-card-focus-offset},
66
+ 'checkbox-card-gap': #{$checkbox-card-gap},
67
+ 'checkbox-card-min-width': #{$checkbox-card-min-width},
68
+ 'checkbox-card-title-weight': #{$checkbox-card-title-weight},
69
+ 'checkbox-card-description-color': #{$checkbox-card-description-color},
70
+ 'checkbox-card-indicator-size': #{$checkbox-card-indicator-size},
71
+ 'checkbox-card-indicator-border-width':
72
+ #{$checkbox-card-indicator-border-width},
73
+ 'checkbox-card-indicator-border-color':
74
+ #{$checkbox-card-indicator-border-color},
75
+ 'checkbox-card-indicator-radius': #{$checkbox-card-indicator-radius},
76
+ 'checkbox-card-check-color': #{$checkbox-card-check-color},
77
+ 'checkbox-card-disabled-opacity': #{$checkbox-card-disabled-opacity},
78
+ 'checkbox-card-transition-duration': #{$checkbox-card-transition-duration},
79
+ )
80
+ );
81
+ }
82
+
83
+ .#{iv.$class-prefix}checkbox-card {
84
+ display: block;
85
+ position: relative;
86
+ cursor: pointer;
87
+
88
+ // The native input, hidden the way Checkbox hides it. It still takes focus
89
+ // and clicks through the label.
90
+ > input[type='checkbox'] {
91
+ position: absolute;
92
+ opacity: 0;
93
+ width: 0;
94
+ height: 0;
95
+ margin: 0;
96
+ }
97
+
98
+ // The edge, laid over the whole card.
99
+ > .#{iv.$class-prefix}checkbox-card-content::before {
100
+ content: '';
101
+ position: absolute;
102
+ inset: 0;
103
+ border: cv.getVar('checkbox-card-border-width') solid
104
+ cv.getVar('checkbox-card-border-color');
105
+ border-radius: cv.getVar('card-radius');
106
+ pointer-events: none;
107
+ transition-property: border-color, border-width;
108
+ transition-duration: cv.getVar('checkbox-card-transition-duration');
109
+ transition-timing-function: ease;
110
+ }
111
+
112
+ &:hover
113
+ > input[type='checkbox']:enabled:not(:checked, :indeterminate)
114
+ + .#{iv.$class-prefix}checkbox-card-content::before {
115
+ border-color: cv.getVar('checkbox-card-hover-border-color');
116
+ }
117
+
118
+ > input[type='checkbox']:checked
119
+ + .#{iv.$class-prefix}checkbox-card-content::before,
120
+ > input[type='checkbox']:indeterminate
121
+ + .#{iv.$class-prefix}checkbox-card-content::before {
122
+ border-color: cv.getVar('checkbox-card-active-color');
123
+ border-width: cv.getVar('checkbox-card-checked-border-width');
124
+ }
125
+
126
+ // Keyboard focus: an outline around the whole card.
127
+ > input[type='checkbox']:focus-visible
128
+ + .#{iv.$class-prefix}checkbox-card-content::before {
129
+ outline: cv.getVar('checkbox-card-focus-width') solid
130
+ cv.getVar('checkbox-card-focus-color');
131
+ outline-offset: cv.getVar('checkbox-card-focus-offset');
132
+ }
133
+
134
+ > input[type='checkbox']:disabled
135
+ + .#{iv.$class-prefix}checkbox-card-content {
136
+ opacity: cv.getVar('checkbox-card-disabled-opacity');
137
+ cursor: not-allowed;
138
+ }
139
+
140
+ // The indicator follows the input's state, as Checkbox's box does.
141
+ > input[type='checkbox']:checked
142
+ + .#{iv.$class-prefix}checkbox-card-content
143
+ > .#{iv.$class-prefix}checkbox-card-check {
144
+ background-color: cv.getVar('checkbox-card-active-color');
145
+ border-color: cv.getVar('checkbox-card-active-color');
146
+
147
+ &::after {
148
+ opacity: 1;
149
+ transform: scale(1);
150
+ }
151
+ }
152
+
153
+ > input[type='checkbox']:indeterminate
154
+ + .#{iv.$class-prefix}checkbox-card-content
155
+ > .#{iv.$class-prefix}checkbox-card-check {
156
+ background-color: cv.getVar('checkbox-card-active-color');
157
+ border-color: cv.getVar('checkbox-card-active-color');
158
+
159
+ &::after {
160
+ opacity: 0;
161
+ }
162
+
163
+ &::before {
164
+ content: '';
165
+ position: absolute;
166
+ top: 50%;
167
+ left: 50%;
168
+ transform: translate(-50%, -50%);
169
+ width: 60%;
170
+ height: cv.getVar('checkbox-card-indicator-border-width');
171
+ background-color: cv.getVar('checkbox-card-check-color');
172
+ border-radius: 1px;
173
+ }
174
+ }
175
+ }
176
+
177
+ // The content fills the card, the indicator beside the text. Bulma rounds a
178
+ // `.card-content` only as the card's first or last child, and the input comes
179
+ // first here, so the content takes the card's corners itself, or a themed
180
+ // `--bulma-card-content-background-color` would show square ones.
181
+ .#{iv.$class-prefix}checkbox-card-content {
182
+ display: flex;
183
+ align-items: flex-start;
184
+ gap: cv.getVar('checkbox-card-gap');
185
+ border-radius: inherit;
186
+ }
187
+
188
+ .#{iv.$class-prefix}checkbox-card-check {
189
+ display: inline-flex;
190
+ align-items: center;
191
+ justify-content: center;
192
+ flex-shrink: 0;
193
+ position: relative;
194
+ // Checkbox and Radio hold their box to 24px, the minimum target size. Here
195
+ // the whole card is the target, so the indicator has no floor and follows
196
+ // its size variable and the card's text size.
197
+ width: cv.getVar('checkbox-card-indicator-size');
198
+ height: cv.getVar('checkbox-card-indicator-size');
199
+ margin-top: max(
200
+ 0px,
201
+ calc(
202
+ (#{$-line-height}em - #{cv.getVar('checkbox-card-indicator-size')}) / 2
203
+ )
204
+ );
205
+ border: cv.getVar('checkbox-card-indicator-border-width') solid
206
+ cv.getVar('checkbox-card-indicator-border-color');
207
+ border-radius: cv.getVar('checkbox-card-indicator-radius');
208
+ transition-property: background-color, border-color;
209
+ transition-duration: cv.getVar('checkbox-card-transition-duration');
210
+ transition-timing-function: ease;
211
+
212
+ // The check mark: the mask cuts the shape, the background color paints it.
213
+ &::after {
214
+ content: '';
215
+ position: absolute;
216
+ width: 85%;
217
+ height: 85%;
218
+ opacity: 0;
219
+ transform: scale(0.5);
220
+ transition-property: opacity, transform;
221
+ transition-duration: cv.getVar('checkbox-card-transition-duration');
222
+ transition-timing-function: ease;
223
+ background-color: cv.getVar('checkbox-card-check-color');
224
+ -webkit-mask-image: $-check-mark;
225
+ -webkit-mask-size: contain;
226
+ -webkit-mask-repeat: no-repeat;
227
+ -webkit-mask-position: center;
228
+ mask-image: $-check-mark;
229
+ mask-size: contain;
230
+ mask-repeat: no-repeat;
231
+ mask-position: center;
232
+ }
233
+ }
234
+
235
+ // Block spans, since a label holds phrasing content only.
236
+ .#{iv.$class-prefix}checkbox-card-body {
237
+ display: block;
238
+ flex: 1 1 auto;
239
+ min-width: 0;
240
+ line-height: $-line-height;
241
+ }
242
+
243
+ // The title takes the card's own text color, so `textColor` reaches it too.
244
+ .#{iv.$class-prefix}checkbox-card-title {
245
+ display: block;
246
+ font-weight: cv.getVar('checkbox-card-title-weight');
247
+ }
248
+
249
+ .#{iv.$class-prefix}checkbox-card-description {
250
+ display: block;
251
+ color: cv.getVar('checkbox-card-description-color');
252
+ }
253
+
254
+ // Color variants
255
+ @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' {
256
+ .#{iv.$class-prefix}checkbox-card.#{iv.$class-prefix}is-#{$name} {
257
+ @include cv.register-vars(
258
+ (
259
+ 'checkbox-card-active-color': #{cv.getVar($name)},
260
+ )
261
+ );
262
+ }
263
+ }
264
+
265
+ // In a Checkboxes group, a wrapping row: the cards share it equally and wrap
266
+ // before they get narrower than the minimum width.
267
+ .#{iv.$class-prefix}checkboxes
268
+ > .#{iv.$class-prefix}checkbox-card.#{iv.$class-prefix}card {
269
+ flex: 1 1 0;
270
+ min-width: min(100%, #{cv.getVar('checkbox-card-min-width')});
271
+ }
272
+
273
+ // The group's gap, or a Bulma grid's, spaces the cards, so Bulma's margin
274
+ // under a card goes, or the last card would stand taller than the rest.
275
+ .#{iv.$class-prefix}checkboxes,
276
+ .#{iv.$class-prefix}grid {
277
+ > .#{iv.$class-prefix}checkbox-card.#{iv.$class-prefix}card {
278
+ margin-bottom: 0;
279
+ }
280
+ }
281
+
282
+ // Forced colors repaints the edge in the text color and drops Bulma's
283
+ // shadow, so a checked card names Highlight on an edge that stays thicker.
284
+ @media (forced-colors: active) {
285
+ .#{iv.$class-prefix}checkbox-card {
286
+ > .#{iv.$class-prefix}checkbox-card-content::before {
287
+ border-color: CanvasText;
288
+ }
289
+
290
+ > input[type='checkbox']:checked
291
+ + .#{iv.$class-prefix}checkbox-card-content::before,
292
+ > input[type='checkbox']:indeterminate
293
+ + .#{iv.$class-prefix}checkbox-card-content::before {
294
+ border-color: Highlight;
295
+ }
296
+
297
+ > input[type='checkbox']:focus-visible
298
+ + .#{iv.$class-prefix}checkbox-card-content::before {
299
+ outline-color: Highlight;
300
+ }
301
+
302
+ > input[type='checkbox']:disabled
303
+ + .#{iv.$class-prefix}checkbox-card-content {
304
+ color: GrayText;
305
+
306
+ &::before {
307
+ border-color: GrayText;
308
+ }
309
+ }
310
+
311
+ .#{iv.$class-prefix}checkbox-card-check {
312
+ border-color: ButtonText;
313
+ }
314
+
315
+ > input[type='checkbox']:checked
316
+ + .#{iv.$class-prefix}checkbox-card-content
317
+ > .#{iv.$class-prefix}checkbox-card-check {
318
+ background-color: Highlight;
319
+ border-color: Highlight;
320
+
321
+ &::after {
322
+ background-color: HighlightText;
323
+ }
324
+ }
325
+
326
+ // A mixed fill and its dash would be repainted in one color, leaving an
327
+ // empty box, so the dash takes a color of its own.
328
+ > input[type='checkbox']:indeterminate
329
+ + .#{iv.$class-prefix}checkbox-card-content
330
+ > .#{iv.$class-prefix}checkbox-card-check {
331
+ background-color: Canvas;
332
+ border-color: Highlight;
333
+
334
+ &::before {
335
+ background-color: CanvasText;
336
+ }
337
+ }
338
+
339
+ > input[type='checkbox']:disabled
340
+ + .#{iv.$class-prefix}checkbox-card-content
341
+ > .#{iv.$class-prefix}checkbox-card-check {
342
+ border-color: GrayText;
343
+ }
344
+ }
345
+ }
346
+
347
+ @media (prefers-reduced-motion: reduce) {
348
+ .#{iv.$class-prefix}checkbox-card {
349
+ > .#{iv.$class-prefix}checkbox-card-content::before,
350
+ .#{iv.$class-prefix}checkbox-card-check,
351
+ .#{iv.$class-prefix}checkbox-card-check::after {
352
+ transition: none;
353
+ }
354
+ }
355
+ }
@@ -3,7 +3,9 @@
3
3
 
4
4
  // Form Components
5
5
  @use 'checkbox';
6
+ @use 'checkboxcard';
6
7
  @use 'radio';
8
+ @use 'radiocard';
7
9
  @use 'switch';
8
10
  @use 'slider';
9
11
  @use 'numberinput';
@@ -4,6 +4,13 @@
4
4
 
5
5
  @use "bulma/sass/utilities/initial-variables" as iv;
6
6
  @use "bulma/sass/utilities/css-variables" as cv;
7
+ @use "bulma/sass/utilities/mixins" as mx;
8
+
9
+ // Bulma's horizontal field: `.field-label` takes one part of the row and
10
+ // `.field-body` five, after the label's `margin-inline-end`. Private, since
11
+ // they restate Bulma's layout rather than set a look of their own.
12
+ $-field-label-gap: 1.5rem;
13
+ $-field-label-parts: 6;
7
14
 
8
15
  // Radio-specific SCSS variables
9
16
  $radio-size: 1.25em !default;
@@ -197,3 +204,40 @@ $radio-transition-duration: cv.getVar("duration") !default;
197
204
  }
198
205
  }
199
206
  }
207
+
208
+ // `<Radios as="fieldset">` renders a native fieldset: the group's own
209
+ // `.field`, with its label as the legend, or the `.radios` box itself inside
210
+ // an outer `Field`. Bulma resets a fieldset's margin, border and padding but
211
+ // keeps the browser's `min-inline-size: min-content`, which lets a long row
212
+ // of choices push it out of its column.
213
+ fieldset.#{iv.$class-prefix}radios,
214
+ fieldset.#{iv.$class-prefix}field:has(.#{iv.$class-prefix}radios) {
215
+ min-inline-size: 0;
216
+ }
217
+
218
+ // Horizontal, the legend is the label column. The browser draws a
219
+ // fieldset's legend above the content rather than beside it. A floated
220
+ // legend escapes that, though not in a flex fieldset in every engine, so the
221
+ // fieldset is a block here and the legend floats, taking the share of the
222
+ // row Bulma's `.field-label` takes beside `.field-body` (one part in six of
223
+ // what's left after its margin), and growing as that does for a word too
224
+ // long to wrap. `.field-body`, a flex box, sits beside it. Below tablet the
225
+ // row stacks, and the legend sits on top as it is. It applies only where the
226
+ // fieldset's own legend is the label column and the body after it holds the
227
+ // group, so a fieldset you lay out with a `div.field-label` keeps Bulma's
228
+ // flex row whatever its body holds.
229
+ @include mx.tablet {
230
+ fieldset.#{iv.$class-prefix}field.#{iv.$class-prefix}is-horizontal:has(
231
+ > legend.#{iv.$class-prefix}field-label
232
+ + .#{iv.$class-prefix}field-body
233
+ .#{iv.$class-prefix}radios
234
+ ) {
235
+ display: flow-root;
236
+
237
+ > legend.#{iv.$class-prefix}field-label {
238
+ float: inline-start;
239
+ inline-size: calc((100% - #{$-field-label-gap}) / #{$-field-label-parts});
240
+ min-inline-size: min-content;
241
+ }
242
+ }
243
+ }