@allxsmith/bestax-bulma 5.51.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 (55) 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/form/Autocomplete.js +2 -2
  6. package/dist/esm/form/CheckboxCard.js +118 -0
  7. package/dist/esm/form/CheckboxCard.js.map +1 -0
  8. package/dist/esm/form/Checkboxes.js +14 -3
  9. package/dist/esm/form/Checkboxes.js.map +1 -1
  10. package/dist/esm/form/RadioCard.js +85 -0
  11. package/dist/esm/form/RadioCard.js.map +1 -0
  12. package/dist/esm/form/Radios.js +14 -3
  13. package/dist/esm/form/Radios.js.map +1 -1
  14. package/dist/esm/form/groupFieldset.js +38 -0
  15. package/dist/esm/form/groupFieldset.js.map +1 -0
  16. package/dist/esm/form/useAutoLabelId.js +1 -1
  17. package/dist/esm/helpers/useComboboxEngine.js +3 -3
  18. package/dist/esm/helpers/useFocusTrap.js +2 -2
  19. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  20. package/dist/extras.css +1 -1
  21. package/dist/extras.css.map +1 -1
  22. package/dist/index.cjs +2429 -1566
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.esm.js +3 -0
  25. package/dist/index.esm.js.map +1 -1
  26. package/dist/types/components/Command.d.ts +318 -0
  27. package/dist/types/form/CheckboxCard.d.ts +94 -0
  28. package/dist/types/form/Checkboxes.d.ts +13 -0
  29. package/dist/types/form/RadioCard.d.ts +81 -0
  30. package/dist/types/form/Radios.d.ts +13 -0
  31. package/dist/types/form/groupFieldset.d.ts +32 -0
  32. package/dist/types/index.d.ts +3 -0
  33. package/dist/types-cjs/components/Command.d.ts +318 -0
  34. package/dist/types-cjs/form/CheckboxCard.d.ts +94 -0
  35. package/dist/types-cjs/form/Checkboxes.d.ts +13 -0
  36. package/dist/types-cjs/form/RadioCard.d.ts +81 -0
  37. package/dist/types-cjs/form/Radios.d.ts +13 -0
  38. package/dist/types-cjs/form/groupFieldset.d.ts +32 -0
  39. package/dist/types-cjs/index.d.ts +3 -0
  40. package/dist/versions/bestax-no-dark-mode.css +1 -1
  41. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  42. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  43. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  44. package/dist/versions/bestax-no-helpers.css +1 -1
  45. package/dist/versions/bestax-no-helpers.css.map +1 -1
  46. package/dist/versions/bestax-prefixed.css +1 -1
  47. package/dist/versions/bestax-prefixed.css.map +1 -1
  48. package/package.json +1 -1
  49. package/src/scss/components/_command.scss +259 -0
  50. package/src/scss/components/_index.scss +1 -0
  51. package/src/scss/form/_checkbox.scss +44 -0
  52. package/src/scss/form/_checkboxcard.scss +355 -0
  53. package/src/scss/form/_index.scss +2 -0
  54. package/src/scss/form/_radio.scss +44 -0
  55. package/src/scss/form/_radiocard.scss +291 -0
@@ -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
+ }
@@ -0,0 +1,291 @@
1
+ // RadioCard styles
2
+ // A radio button drawn as a card: a <label class="radio-card card"> holding
3
+ // the native input, then a .card-content span with the indicator and the
4
+ // text. Bulma's .card draws the surface. This partial adds the card's edge,
5
+ // which carries the picked 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
+ // picked 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
+ $radio-card-border-width: 1px !default;
17
+ $radio-card-border-color: cv.getVar('border') !default;
18
+ $radio-card-hover-border-color: cv.getVar('border-hover') !default;
19
+ // Twice the edge, so a picked card differs from the others by more than its
20
+ // color (WCAG 1.4.1), with or without the indicator.
21
+ $radio-card-checked-border-width: 2px !default;
22
+ $radio-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
+ $radio-card-focus-color: hsl(
26
+ cv.getVar('focus-h'),
27
+ cv.getVar('focus-s'),
28
+ cv.getVar('focus-l')
29
+ ) !default;
30
+ $radio-card-focus-width: cv.getVar('focus-width') !default;
31
+ $radio-card-focus-offset: 2px !default;
32
+ $radio-card-gap: 0.75em !default;
33
+ $radio-card-min-width: 12rem !default;
34
+ $radio-card-title-weight: cv.getVar('weight-semibold') !default;
35
+ $radio-card-description-color: cv.getVar('text-weak') !default;
36
+ $radio-card-indicator-size: 1.25em !default;
37
+ $radio-card-indicator-border-width: 2px !default;
38
+ // The ring is all that shows of an unpicked radio, so it takes `text-weak`,
39
+ // as Radio's does, which holds 3:1 on the card's surface.
40
+ $radio-card-indicator-border-color: cv.getVar('text-weak') !default;
41
+ $radio-card-disabled-opacity: 0.5 !default;
42
+ $radio-card-transition-duration: cv.getVar('duration') !default;
43
+
44
+ // The text's line height, which also places the indicator: it's centred on
45
+ // the title's first line while it's shorter than that line.
46
+ $-line-height: 1.5;
47
+
48
+ .#{iv.$class-prefix}radio-card {
49
+ @include cv.register-vars(
50
+ (
51
+ 'radio-card-border-width': #{$radio-card-border-width},
52
+ 'radio-card-border-color': #{$radio-card-border-color},
53
+ 'radio-card-hover-border-color': #{$radio-card-hover-border-color},
54
+ 'radio-card-checked-border-width': #{$radio-card-checked-border-width},
55
+ 'radio-card-active-color': #{$radio-card-active-color},
56
+ 'radio-card-focus-color': #{$radio-card-focus-color},
57
+ 'radio-card-focus-width': #{$radio-card-focus-width},
58
+ 'radio-card-focus-offset': #{$radio-card-focus-offset},
59
+ 'radio-card-gap': #{$radio-card-gap},
60
+ 'radio-card-min-width': #{$radio-card-min-width},
61
+ 'radio-card-title-weight': #{$radio-card-title-weight},
62
+ 'radio-card-description-color': #{$radio-card-description-color},
63
+ 'radio-card-indicator-size': #{$radio-card-indicator-size},
64
+ 'radio-card-indicator-border-width': #{$radio-card-indicator-border-width},
65
+ 'radio-card-indicator-border-color': #{$radio-card-indicator-border-color},
66
+ 'radio-card-disabled-opacity': #{$radio-card-disabled-opacity},
67
+ 'radio-card-transition-duration': #{$radio-card-transition-duration},
68
+ )
69
+ );
70
+ }
71
+
72
+ .#{iv.$class-prefix}radio-card {
73
+ display: block;
74
+ position: relative;
75
+ cursor: pointer;
76
+
77
+ // The native input, hidden the way Radio hides it. It still takes focus,
78
+ // clicks through the label and the arrow keys.
79
+ > input[type='radio'] {
80
+ position: absolute;
81
+ opacity: 0;
82
+ width: 0;
83
+ height: 0;
84
+ margin: 0;
85
+ }
86
+
87
+ // The edge, laid over the whole card.
88
+ > .#{iv.$class-prefix}radio-card-content::before {
89
+ content: '';
90
+ position: absolute;
91
+ inset: 0;
92
+ border: cv.getVar('radio-card-border-width') solid
93
+ cv.getVar('radio-card-border-color');
94
+ border-radius: cv.getVar('card-radius');
95
+ pointer-events: none;
96
+ transition-property: border-color, border-width;
97
+ transition-duration: cv.getVar('radio-card-transition-duration');
98
+ transition-timing-function: ease;
99
+ }
100
+
101
+ &:hover
102
+ > input[type='radio']:enabled:not(:checked)
103
+ + .#{iv.$class-prefix}radio-card-content::before {
104
+ border-color: cv.getVar('radio-card-hover-border-color');
105
+ }
106
+
107
+ > input[type='radio']:checked
108
+ + .#{iv.$class-prefix}radio-card-content::before {
109
+ border-color: cv.getVar('radio-card-active-color');
110
+ border-width: cv.getVar('radio-card-checked-border-width');
111
+ }
112
+
113
+ // Keyboard focus: an outline around the whole card.
114
+ > input[type='radio']:focus-visible
115
+ + .#{iv.$class-prefix}radio-card-content::before {
116
+ outline: cv.getVar('radio-card-focus-width') solid
117
+ cv.getVar('radio-card-focus-color');
118
+ outline-offset: cv.getVar('radio-card-focus-offset');
119
+ }
120
+
121
+ > input[type='radio']:disabled + .#{iv.$class-prefix}radio-card-content {
122
+ opacity: cv.getVar('radio-card-disabled-opacity');
123
+ cursor: not-allowed;
124
+ }
125
+
126
+ // The indicator follows the input's state, as Radio's ring does.
127
+ > input[type='radio']:checked
128
+ + .#{iv.$class-prefix}radio-card-content
129
+ > .#{iv.$class-prefix}radio-card-check {
130
+ border-color: cv.getVar('radio-card-active-color');
131
+
132
+ &::before {
133
+ opacity: 1;
134
+ transform: translate(-50%, -50%) scale(1);
135
+ }
136
+ }
137
+ }
138
+
139
+ // The content fills the card, the indicator beside the text. Bulma rounds a
140
+ // `.card-content` only as the card's first or last child, and the input comes
141
+ // first here, so the content takes the card's corners itself, or a themed
142
+ // `--bulma-card-content-background-color` would show square ones.
143
+ .#{iv.$class-prefix}radio-card-content {
144
+ display: flex;
145
+ align-items: flex-start;
146
+ gap: cv.getVar('radio-card-gap');
147
+ border-radius: inherit;
148
+ }
149
+
150
+ .#{iv.$class-prefix}radio-card-check {
151
+ display: inline-flex;
152
+ flex-shrink: 0;
153
+ position: relative;
154
+ // Checkbox and Radio hold their box to 24px, the minimum target size. Here
155
+ // the whole card is the target, so the indicator has no floor and follows
156
+ // its size variable and the card's text size.
157
+ width: cv.getVar('radio-card-indicator-size');
158
+ height: cv.getVar('radio-card-indicator-size');
159
+ margin-top: max(
160
+ 0px,
161
+ calc((#{$-line-height}em - #{cv.getVar('radio-card-indicator-size')}) / 2)
162
+ );
163
+ border: cv.getVar('radio-card-indicator-border-width') solid
164
+ cv.getVar('radio-card-indicator-border-color');
165
+ border-radius: 50%;
166
+ transition-property: border-color;
167
+ transition-duration: cv.getVar('radio-card-transition-duration');
168
+ transition-timing-function: ease;
169
+
170
+ // The dot.
171
+ &::before {
172
+ content: '';
173
+ position: absolute;
174
+ top: 50%;
175
+ left: 50%;
176
+ width: 50%;
177
+ height: 50%;
178
+ border-radius: 50%;
179
+ background-color: cv.getVar('radio-card-active-color');
180
+ opacity: 0;
181
+ transform: translate(-50%, -50%) scale(0.5);
182
+ transition-property: opacity, transform;
183
+ transition-duration: cv.getVar('radio-card-transition-duration');
184
+ transition-timing-function: ease;
185
+ }
186
+ }
187
+
188
+ // Block spans, since a label holds phrasing content only.
189
+ .#{iv.$class-prefix}radio-card-body {
190
+ display: block;
191
+ flex: 1 1 auto;
192
+ min-width: 0;
193
+ line-height: $-line-height;
194
+ }
195
+
196
+ // The title takes the card's own text color, so `textColor` reaches it too.
197
+ .#{iv.$class-prefix}radio-card-title {
198
+ display: block;
199
+ font-weight: cv.getVar('radio-card-title-weight');
200
+ }
201
+
202
+ .#{iv.$class-prefix}radio-card-description {
203
+ display: block;
204
+ color: cv.getVar('radio-card-description-color');
205
+ }
206
+
207
+ // Color variants
208
+ @each $name in 'primary', 'link', 'info', 'success', 'warning', 'danger' {
209
+ .#{iv.$class-prefix}radio-card.#{iv.$class-prefix}is-#{$name} {
210
+ @include cv.register-vars(
211
+ (
212
+ 'radio-card-active-color': #{cv.getVar($name)},
213
+ )
214
+ );
215
+ }
216
+ }
217
+
218
+ // In a Radios group, a wrapping row: the cards share it equally and wrap
219
+ // before they get narrower than the minimum width.
220
+ .#{iv.$class-prefix}radios
221
+ > .#{iv.$class-prefix}radio-card.#{iv.$class-prefix}card {
222
+ flex: 1 1 0;
223
+ min-width: min(100%, #{cv.getVar('radio-card-min-width')});
224
+ }
225
+
226
+ // The group's gap, or a Bulma grid's, spaces the cards, so Bulma's margin
227
+ // under a card goes, or the last card would stand taller than the rest.
228
+ .#{iv.$class-prefix}radios,
229
+ .#{iv.$class-prefix}grid {
230
+ > .#{iv.$class-prefix}radio-card.#{iv.$class-prefix}card {
231
+ margin-bottom: 0;
232
+ }
233
+ }
234
+
235
+ // Forced colors repaints the edge in the text color and drops Bulma's
236
+ // shadow, so a picked card names Highlight on an edge that stays thicker.
237
+ @media (forced-colors: active) {
238
+ .#{iv.$class-prefix}radio-card {
239
+ > .#{iv.$class-prefix}radio-card-content::before {
240
+ border-color: CanvasText;
241
+ }
242
+
243
+ > input[type='radio']:checked
244
+ + .#{iv.$class-prefix}radio-card-content::before {
245
+ border-color: Highlight;
246
+ }
247
+
248
+ > input[type='radio']:focus-visible
249
+ + .#{iv.$class-prefix}radio-card-content::before {
250
+ outline-color: Highlight;
251
+ }
252
+
253
+ > input[type='radio']:disabled + .#{iv.$class-prefix}radio-card-content {
254
+ color: GrayText;
255
+
256
+ &::before {
257
+ border-color: GrayText;
258
+ }
259
+ }
260
+
261
+ .#{iv.$class-prefix}radio-card-check {
262
+ border-color: ButtonText;
263
+ }
264
+
265
+ > input[type='radio']:checked
266
+ + .#{iv.$class-prefix}radio-card-content
267
+ > .#{iv.$class-prefix}radio-card-check {
268
+ border-color: Highlight;
269
+
270
+ &::before {
271
+ background-color: Highlight;
272
+ }
273
+ }
274
+
275
+ > input[type='radio']:disabled
276
+ + .#{iv.$class-prefix}radio-card-content
277
+ > .#{iv.$class-prefix}radio-card-check {
278
+ border-color: GrayText;
279
+ }
280
+ }
281
+ }
282
+
283
+ @media (prefers-reduced-motion: reduce) {
284
+ .#{iv.$class-prefix}radio-card {
285
+ > .#{iv.$class-prefix}radio-card-content::before,
286
+ .#{iv.$class-prefix}radio-card-check,
287
+ .#{iv.$class-prefix}radio-card-check::before {
288
+ transition: none;
289
+ }
290
+ }
291
+ }