@allxsmith/bestax-bulma 5.42.0 → 5.43.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 (40) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Carousel.js.map +1 -1
  4. package/dist/esm/form/Checkbox.js.map +1 -1
  5. package/dist/esm/form/Field.js.map +1 -1
  6. package/dist/esm/form/PinInput.js +201 -0
  7. package/dist/esm/form/PinInput.js.map +1 -0
  8. package/dist/esm/form/Radio.js.map +1 -1
  9. package/dist/extras.css +1 -1
  10. package/dist/extras.css.map +1 -1
  11. package/dist/index.cjs +187 -0
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.esm.js +1 -0
  14. package/dist/index.esm.js.map +1 -1
  15. package/dist/types/components/Carousel.d.ts +7 -0
  16. package/dist/types/form/Checkbox.d.ts +9 -1
  17. package/dist/types/form/Field.d.ts +1 -1
  18. package/dist/types/form/PinInput.d.ts +103 -0
  19. package/dist/types/form/Radio.d.ts +10 -1
  20. package/dist/types/index.d.ts +1 -0
  21. package/dist/types-cjs/components/Carousel.d.ts +7 -0
  22. package/dist/types-cjs/form/Checkbox.d.ts +9 -1
  23. package/dist/types-cjs/form/Field.d.ts +1 -1
  24. package/dist/types-cjs/form/PinInput.d.ts +103 -0
  25. package/dist/types-cjs/form/Radio.d.ts +10 -1
  26. package/dist/types-cjs/index.d.ts +1 -0
  27. package/dist/versions/bestax-no-dark-mode.css +1 -1
  28. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  29. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  30. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  31. package/dist/versions/bestax-no-helpers.css +1 -1
  32. package/dist/versions/bestax-no-helpers.css.map +1 -1
  33. package/dist/versions/bestax-prefixed.css +1 -1
  34. package/dist/versions/bestax-prefixed.css.map +1 -1
  35. package/package.json +13 -13
  36. package/src/scss/components/_carousel.scss +7 -2
  37. package/src/scss/form/_checkbox.scss +23 -16
  38. package/src/scss/form/_index.scss +1 -0
  39. package/src/scss/form/_pininput.scss +175 -0
  40. package/src/scss/form/_radio.scss +4 -1
@@ -9,7 +9,10 @@
9
9
  $checkbox-size: 1.25em !default;
10
10
  $checkbox-border-width: 2px !default;
11
11
  $checkbox-radius: cv.getVar("radius-small") !default;
12
- $checkbox-border-color: cv.getVar("border") !default;
12
+ // The border is all that shows of an unchecked box, so it takes `text-weak`,
13
+ // which holds the 3:1 WCAG asks of a control's boundary (SC 1.4.11) on the
14
+ // scheme's surfaces in light and dark. `border` falls well short of it.
15
+ $checkbox-border-color: cv.getVar("text-weak") !default;
13
16
  $checkbox-background: transparent !default;
14
17
  $checkbox-check-color: cv.getVar("scheme-invert") !default;
15
18
  $checkbox-active-color: cv.getVar("primary") !default;
@@ -18,8 +21,10 @@ $checkbox-focus-shadow-size: 0 0 0 0.125em !default;
18
21
  $checkbox-transition-duration: cv.getVar("duration") !default;
19
22
  $checkbox-indeterminate-color: cv.getVar("primary") !default;
20
23
 
21
- // The check mark, drawn as an image normally and used as a mask in forced
22
- // colors. Private, since it's the shape rather than a themable value.
24
+ // The check mark's shape, used as a mask so the mark is painted with a
25
+ // background color: `checkbox-check-color`, or a system color in forced
26
+ // colors. Private, since it's the shape rather than a themable value; the
27
+ // stroke's color only marks what the mask keeps.
23
28
  $-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");
24
29
 
25
30
  // Register CSS custom properties
@@ -127,7 +132,8 @@ $-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
127
132
  transition-duration: cv.getVar("checkbox-transition-duration");
128
133
  transition-timing-function: ease;
129
134
 
130
- // Checkmark via SVG background-image
135
+ // The check mark: the mask cuts the shape, the background color paints
136
+ // it, in the same color as the mixed state's dash.
131
137
  &::after {
132
138
  content: "";
133
139
  position: absolute;
@@ -138,10 +144,15 @@ $-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
138
144
  transition-property: opacity, transform;
139
145
  transition-duration: cv.getVar("checkbox-transition-duration");
140
146
  transition-timing-function: ease;
141
- background-image: $-check-mark;
142
- background-size: contain;
143
- background-repeat: no-repeat;
144
- background-position: center;
147
+ background-color: cv.getVar("checkbox-check-color");
148
+ -webkit-mask-image: $-check-mark;
149
+ -webkit-mask-size: contain;
150
+ -webkit-mask-repeat: no-repeat;
151
+ -webkit-mask-position: center;
152
+ mask-image: $-check-mark;
153
+ mask-size: contain;
154
+ mask-repeat: no-repeat;
155
+ mask-position: center;
145
156
  }
146
157
  }
147
158
 
@@ -188,16 +199,12 @@ $-check-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'
188
199
  background-color: Highlight;
189
200
  border-color: Highlight;
190
201
 
191
- // The mark's image has a black stroke, which forced colors leaves as
192
- // it is, black on the Highlight fill. Use its shape as a mask instead
193
- // and paint it in HighlightText, the color made to read on Highlight.
202
+ // Forced colors replaces the check color the mark is painted with, as
203
+ // it does any color that isn't a system one. Name HighlightText, the
204
+ // color made to read on Highlight. The mask is untouched there, so the
205
+ // shape stays.
194
206
  &::after {
195
- background-image: none;
196
207
  background-color: HighlightText;
197
- mask-image: $-check-mark;
198
- mask-size: contain;
199
- mask-repeat: no-repeat;
200
- mask-position: center;
201
208
  }
202
209
  }
203
210
 
@@ -7,6 +7,7 @@
7
7
  @use 'switch';
8
8
  @use 'slider';
9
9
  @use 'numberinput';
10
+ @use 'pininput';
10
11
  @use 'rate';
11
12
  @use 'autocomplete';
12
13
  @use 'combobox';
@@ -0,0 +1,175 @@
1
+ // Bestax Extras - PinInput Styles
2
+ // A row of boxes for a short code, drawn under the one input that holds it.
3
+ // Each box is a Bulma `.input`, the way DateRangeInput's field is, so the
4
+ // boxes take Bulma's input colors, sizes, rounded corners, focus ring, dark
5
+ // mode and `--bulma-input-*` theme variables as they are, and this partial
6
+ // only lays them out. The input lies over the row with its text, caret and
7
+ // selection transparent, so a click or a tap lands on it and the boxes show
8
+ // what it holds.
9
+
10
+ @use 'bulma/sass/utilities/initial-variables' as iv;
11
+ @use 'bulma/sass/utilities/css-variables' as cv;
12
+
13
+ // In em, so it follows the size of the boxes.
14
+ $pin-input-gap: 0.5em !default;
15
+ // A Bulma control's height, in the box's own size, so a box is square.
16
+ $pin-input-box-width: cv.getVar('control-height') !default;
17
+ $pin-input-caret-width: max(1px, 0.0625em) !default;
18
+ $pin-input-caret-height: 1.25em !default;
19
+ // The box's text color, so the caret follows a color, dark mode and a theme.
20
+ $pin-input-caret-color: currentColor !default;
21
+ $pin-input-caret-blink-duration: 1s !default;
22
+
23
+ .#{iv.$class-prefix}pin-input {
24
+ @include cv.register-vars(
25
+ (
26
+ 'pin-input-gap': #{$pin-input-gap},
27
+ 'pin-input-box-width': #{$pin-input-box-width},
28
+ 'pin-input-caret-width': #{$pin-input-caret-width},
29
+ 'pin-input-caret-height': #{$pin-input-caret-height},
30
+ 'pin-input-caret-color': #{$pin-input-caret-color},
31
+ 'pin-input-caret-blink-duration': #{$pin-input-caret-blink-duration},
32
+ )
33
+ );
34
+ }
35
+
36
+ // The row is as wide as its boxes, so the input over it covers them and
37
+ // nothing more, and no wider than its container: in a narrow one the boxes
38
+ // give up some width rather than overflow.
39
+ .#{iv.$class-prefix}pin-input {
40
+ display: inline-flex;
41
+ max-width: 100%;
42
+ position: relative;
43
+ vertical-align: top;
44
+ }
45
+
46
+ // Three classes, because Bulma's `.input` sets the width and its
47
+ // `.input.is-rounded` the side padding, and these have to win whichever
48
+ // stylesheet loads first. The character sits in the middle either way.
49
+ .#{iv.$class-prefix}pin-input
50
+ > .#{iv.$class-prefix}input.#{iv.$class-prefix}pin-input-box {
51
+ flex: 0 1 auto;
52
+ font-variant-numeric: tabular-nums;
53
+ justify-content: center;
54
+ min-width: 0;
55
+ padding-left: 0;
56
+ padding-right: 0;
57
+ width: cv.getVar('pin-input-box-width');
58
+ }
59
+
60
+ .#{iv.$class-prefix}pin-input-box + .#{iv.$class-prefix}pin-input-box {
61
+ margin-inline-start: cv.getVar('pin-input-gap');
62
+ }
63
+
64
+ // A div takes no `disabled`, so a disabled box is marked by class and drawn
65
+ // the way Bulma draws a disabled input.
66
+ .#{iv.$class-prefix}pin-input-box.#{iv.$class-prefix}is-disabled {
67
+ background-color: cv.getVar('input-disabled-background-color');
68
+ border-color: cv.getVar('input-disabled-border-color');
69
+ box-shadow: none;
70
+ color: cv.getVar('input-disabled-color');
71
+ }
72
+
73
+ // The caret, in the empty box at the input's caret. The box lays out its
74
+ // content in a centered row, so the caret sits in the middle.
75
+ .#{iv.$class-prefix}pin-input-box.#{iv.$class-prefix}has-caret::after {
76
+ animation: #{iv.$class-prefix}pin-input-caret-blink
77
+ cv.getVar('pin-input-caret-blink-duration') step-end infinite;
78
+ background-color: cv.getVar('pin-input-caret-color');
79
+ content: '';
80
+ height: cv.getVar('pin-input-caret-height');
81
+ width: cv.getVar('pin-input-caret-width');
82
+ }
83
+
84
+ @keyframes #{iv.$class-prefix}pin-input-caret-blink {
85
+ 50% {
86
+ opacity: 0;
87
+ }
88
+ }
89
+
90
+ // The input that holds the code, over the whole row. Its text is squeezed
91
+ // to the row's start, so a click anywhere on the row puts the caret at the
92
+ // end of the code, and the arrow keys move it from there. Its font is never
93
+ // under 16px, since iOS zooms the page into a field with smaller text when
94
+ // it takes focus.
95
+ .#{iv.$class-prefix}pin-input-field {
96
+ appearance: none;
97
+ background: transparent;
98
+ border: 0;
99
+ box-shadow: none;
100
+ caret-color: transparent;
101
+ color: transparent;
102
+ cursor: text;
103
+ font-family: monospace;
104
+ font-size: max(1em, 16px);
105
+ height: 100%;
106
+ left: 0;
107
+ letter-spacing: -0.5em;
108
+ line-height: 1;
109
+ margin: 0;
110
+ outline: 0;
111
+ padding: 0;
112
+ position: absolute;
113
+ top: 0;
114
+ width: 100%;
115
+ z-index: 1;
116
+
117
+ &::selection {
118
+ background-color: transparent;
119
+ color: transparent;
120
+ }
121
+
122
+ &::placeholder {
123
+ color: transparent;
124
+ }
125
+
126
+ &:disabled {
127
+ cursor: not-allowed;
128
+ }
129
+ }
130
+
131
+ // Autofill paints a fill and text of its own on the input. The boxes show
132
+ // the code, so the input hides instead. One rule each, since a browser
133
+ // drops a whole rule over a selector it doesn't know.
134
+ .#{iv.$class-prefix}pin-input-field:-webkit-autofill {
135
+ opacity: 0;
136
+ }
137
+
138
+ .#{iv.$class-prefix}pin-input-field:autofill {
139
+ opacity: 0;
140
+ }
141
+
142
+ @media (prefers-reduced-motion: reduce) {
143
+ .#{iv.$class-prefix}pin-input-box.#{iv.$class-prefix}has-caret::after {
144
+ animation: none;
145
+ }
146
+ }
147
+
148
+ @media (forced-colors: active) {
149
+ // Forced colors would paint the input's transparent text and caret in the
150
+ // text color, over the boxes, so it keeps its own.
151
+ .#{iv.$class-prefix}pin-input-field {
152
+ forced-color-adjust: none;
153
+ }
154
+
155
+ // Forced colors drops Bulma's focus ring, which is a shadow, so the box
156
+ // at the caret, and each selected one, gets an outline in the system's
157
+ // Highlight color. Three classes, to outrank Bulma's `.input.is-focused`
158
+ // border whichever stylesheet loads first.
159
+ .#{iv.$class-prefix}pin-input
160
+ > .#{iv.$class-prefix}pin-input-box.#{iv.$class-prefix}is-focused {
161
+ border-color: Highlight;
162
+ outline: 2px solid Highlight;
163
+ }
164
+
165
+ // The caret is a fill, which forced colors would make the background.
166
+ .#{iv.$class-prefix}pin-input-box.#{iv.$class-prefix}has-caret::after {
167
+ background-color: CanvasText;
168
+ forced-color-adjust: none;
169
+ }
170
+
171
+ .#{iv.$class-prefix}pin-input-box.#{iv.$class-prefix}is-disabled {
172
+ border-color: GrayText;
173
+ color: GrayText;
174
+ }
175
+ }
@@ -8,7 +8,10 @@
8
8
  // Radio-specific SCSS variables
9
9
  $radio-size: 1.25em !default;
10
10
  $radio-border-width: 2px !default;
11
- $radio-border-color: cv.getVar("border") !default;
11
+ // The ring is all that shows of an unchecked radio, so it takes `text-weak`,
12
+ // which holds the 3:1 WCAG asks of a control's boundary (SC 1.4.11) on the
13
+ // scheme's surfaces in light and dark. `border` falls well short of it.
14
+ $radio-border-color: cv.getVar("text-weak") !default;
12
15
  $radio-background: transparent !default;
13
16
  $radio-dot-color: cv.getVar("scheme-main") !default;
14
17
  $radio-active-color: cv.getVar("primary") !default;