@allxsmith/bestax-bulma 2.6.2 → 3.0.2
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.
- package/README.md +2 -2
- package/dist/bestax.css +3 -0
- package/dist/bestax.css.map +1 -0
- package/dist/bestax.js +1 -0
- package/dist/extras.css +3 -0
- package/dist/extras.css.map +1 -0
- package/dist/extras.js +1 -0
- package/dist/index.cjs.js +6214 -647
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +6154 -649
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Card.d.ts +1 -1
- package/dist/types/components/Carousel.d.ts +34 -0
- package/dist/types/components/Collapse.d.ts +17 -0
- package/dist/types/components/Dialog.d.ts +47 -0
- package/dist/types/components/Loading.d.ts +18 -0
- package/dist/types/components/Navbar.d.ts +10 -0
- package/dist/types/components/Panel.d.ts +2 -4
- package/dist/types/components/Sidebar.d.ts +37 -0
- package/dist/types/components/Steps.d.ts +45 -0
- package/dist/types/components/Tabs.d.ts +42 -6
- package/dist/types/components/Toast.d.ts +46 -0
- package/dist/types/components/Tooltip.d.ts +22 -0
- package/dist/types/elements/Button.d.ts +1 -1
- package/dist/types/elements/Code.d.ts +9 -0
- package/dist/types/elements/Divider.d.ts +7 -0
- package/dist/types/elements/Emphasis.d.ts +9 -0
- package/dist/types/elements/Figure.d.ts +17 -0
- package/dist/types/elements/Icon.d.ts +2 -1
- package/dist/types/elements/Link.d.ts +10 -0
- package/dist/types/elements/LinkButton.d.ts +8 -0
- package/dist/types/elements/ListItem.d.ts +9 -0
- package/dist/types/elements/Notification.d.ts +31 -0
- package/dist/types/elements/OrderedList.d.ts +9 -0
- package/dist/types/elements/Paragraph.d.ts +9 -0
- package/dist/types/elements/Pre.d.ts +9 -0
- package/dist/types/elements/Span.d.ts +9 -0
- package/dist/types/elements/Strong.d.ts +9 -0
- package/dist/types/elements/UnorderedList.d.ts +9 -0
- package/dist/types/form/Autocomplete.d.ts +42 -0
- package/dist/types/form/Checkbox.d.ts +7 -2
- package/dist/types/form/Checkboxes.d.ts +6 -1
- package/dist/types/form/DateInput.d.ts +26 -0
- package/dist/types/form/DateInputBase.d.ts +42 -0
- package/dist/types/form/DateTimeInput.d.ts +26 -0
- package/dist/types/form/DateTimeInputBase.d.ts +50 -0
- package/dist/types/form/Field.d.ts +2 -1
- package/dist/types/form/File.d.ts +3 -2
- package/dist/types/form/FormContext.d.ts +22 -0
- package/dist/types/form/Input.d.ts +22 -11
- package/dist/types/form/InputBase.d.ts +16 -0
- package/dist/types/form/Numberinput.d.ts +30 -0
- package/dist/types/form/Radio.d.ts +7 -2
- package/dist/types/form/Radios.d.ts +6 -1
- package/dist/types/form/Rate.d.ts +38 -0
- package/dist/types/form/Select.d.ts +18 -11
- package/dist/types/form/SelectBase.d.ts +19 -0
- package/dist/types/form/Slider.d.ts +49 -0
- package/dist/types/form/Switch.d.ts +17 -0
- package/dist/types/form/Taginput.d.ts +54 -0
- package/dist/types/form/TextArea.d.ts +13 -14
- package/dist/types/form/TextAreaBase.d.ts +19 -0
- package/dist/types/form/TimeInput.d.ts +26 -0
- package/dist/types/form/TimeInputBase.d.ts +44 -0
- package/dist/types/form/_pickerInternals/Calendar.d.ts +26 -0
- package/dist/types/form/_pickerInternals/PickerPopover.d.ts +20 -0
- package/dist/types/form/_pickerInternals/TimeWheels.d.ts +29 -0
- package/dist/types/form/_pickerInternals/audioTick.d.ts +3 -0
- package/dist/types/form/_pickerInternals/dateUtils.d.ts +39 -0
- package/dist/types/form/_pickerInternals/formatters.d.ts +13 -0
- package/dist/types/form/_pickerInternals/haptics.d.ts +1 -0
- package/dist/types/form/_pickerInternals/pickerTypes.d.ts +31 -0
- package/dist/types/form/_pickerInternals/segmentMap.d.ts +20 -0
- package/dist/types/form/_pickerInternals/useFocusTrap.d.ts +7 -0
- package/dist/types/form/_pickerInternals/useNativeMobilePicker.d.ts +10 -0
- package/dist/types/form/_pickerInternals/useSegmentedEntry.d.ts +45 -0
- package/dist/types/form/fieldProps.d.ts +12 -0
- package/dist/types/helpers/bulmaClassHelpers.d.ts +35 -0
- package/dist/types/helpers/useBulmaClasses.d.ts +16 -83
- package/dist/types/helpers/useColorClasses.d.ts +8 -0
- package/dist/types/helpers/useFlexboxClasses.d.ts +12 -0
- package/dist/types/helpers/useOtherClasses.d.ts +15 -0
- package/dist/types/helpers/useSpacingClasses.d.ts +18 -0
- package/dist/types/helpers/useTypographyClasses.d.ts +19 -0
- package/dist/types/helpers/useVisibilityClasses.d.ts +10 -0
- package/dist/types/index.d.ts +53 -3
- package/dist/versions/bestax-bulma-prefixed.css +3 -0
- package/dist/versions/bestax-bulma-prefixed.css.map +1 -0
- package/dist/versions/bestax-bulma-prefixed.js +1 -0
- package/dist/versions/bestax-no-dark-mode.css +3 -0
- package/dist/versions/bestax-no-dark-mode.css.map +1 -0
- package/dist/versions/bestax-no-dark-mode.js +1 -0
- package/dist/versions/bestax-no-helpers-prefixed.css +3 -0
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -0
- package/dist/versions/bestax-no-helpers-prefixed.js +1 -0
- package/dist/versions/bestax-no-helpers.css +3 -0
- package/dist/versions/bestax-no-helpers.css.map +1 -0
- package/dist/versions/bestax-no-helpers.js +1 -0
- package/dist/versions/bestax-prefixed.css +3 -0
- package/dist/versions/bestax-prefixed.css.map +1 -0
- package/dist/versions/bestax-prefixed.js +1 -0
- package/package.json +109 -35
- package/src/scss/_mixins.scss +215 -0
- package/src/scss/_variables.scss +94 -0
- package/src/scss/bestax.scss +18 -0
- package/src/scss/components/_carousel.scss +580 -0
- package/src/scss/components/_collapse.scss +126 -0
- package/src/scss/components/_dialog.scss +134 -0
- package/src/scss/components/_index.scss +13 -0
- package/src/scss/components/_loading.scss +231 -0
- package/src/scss/components/_sidebar.scss +347 -0
- package/src/scss/components/_steps.scss +459 -0
- package/src/scss/components/_tabs.scss +147 -0
- package/src/scss/components/_toast.scss +244 -0
- package/src/scss/components/_tooltip.scss +250 -0
- package/src/scss/elements/_index.scss +5 -0
- package/src/scss/elements/_linkbutton.scss +77 -0
- package/src/scss/extras.scss +24 -0
- package/src/scss/form/_autocomplete.scss +261 -0
- package/src/scss/form/_checkbox.scss +217 -0
- package/src/scss/form/_dateinput.scss +292 -0
- package/src/scss/form/_datetimeinput.scss +191 -0
- package/src/scss/form/_index.scss +16 -0
- package/src/scss/form/_numberinput.scss +176 -0
- package/src/scss/form/_picker-popover.scss +185 -0
- package/src/scss/form/_radio.scss +196 -0
- package/src/scss/form/_rate.scss +307 -0
- package/src/scss/form/_slider.scss +630 -0
- package/src/scss/form/_switch.scss +314 -0
- package/src/scss/form/_taginput.scss +356 -0
- package/src/scss/form/_timeinput.scss +374 -0
- package/src/scss/helpers/_cursor.scss +5 -0
- package/src/scss/helpers/_index.scss +2 -0
- package/src/scss/helpers/_sizing.scss +5 -0
- package/src/scss/versions/bestax-bulma-prefixed.scss +15 -0
- package/src/scss/versions/bestax-no-dark-mode.scss +32 -0
- package/src/scss/versions/bestax-no-helpers-prefixed.scss +22 -0
- package/src/scss/versions/bestax-no-helpers.scss +23 -0
- package/src/scss/versions/bestax-prefixed.scss +15 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// Switch Component Styles
|
|
2
|
+
// A toggle switch control for on/off states
|
|
3
|
+
// Follows Bulma v1 CSS variable convention (see _checkbox.scss)
|
|
4
|
+
|
|
5
|
+
@use "bulma/sass/utilities/initial-variables" as iv;
|
|
6
|
+
@use "bulma/sass/utilities/css-variables" as cv;
|
|
7
|
+
|
|
8
|
+
// Switch-specific SCSS variables
|
|
9
|
+
$switch-width: 2.75em !default;
|
|
10
|
+
$switch-height: 1.5em !default;
|
|
11
|
+
$switch-padding: 0.1875em !default;
|
|
12
|
+
$switch-border-width: 1px !default;
|
|
13
|
+
$switch-background: cv.getVar("grey-light") !default;
|
|
14
|
+
$switch-circle-color: cv.getVar("scheme-main") !default;
|
|
15
|
+
$switch-circle-color-light: cv.getVar("white-ter") !default;
|
|
16
|
+
$switch-active-color: cv.getVar("primary") !default;
|
|
17
|
+
$switch-radius: cv.getVar("radius-rounded") !default;
|
|
18
|
+
$switch-label-gap: 0.5em !default;
|
|
19
|
+
$switch-transition-duration: cv.getVar("duration") !default;
|
|
20
|
+
$switch-circle-shadow: 0 2px 3px rgba(10, 10, 10, 0.1) !default;
|
|
21
|
+
$switch-focus-shadow: 0 0 0 0.125em rgba(0, 0, 0, 0.1) !default;
|
|
22
|
+
$switch-thin-height: 0.75em !default;
|
|
23
|
+
$switch-thin-circle-size: 1.25em !default;
|
|
24
|
+
|
|
25
|
+
// Register CSS custom properties
|
|
26
|
+
.#{iv.$class-prefix}switch {
|
|
27
|
+
@include cv.register-vars(
|
|
28
|
+
(
|
|
29
|
+
"switch-width": #{$switch-width},
|
|
30
|
+
"switch-height": #{$switch-height},
|
|
31
|
+
"switch-padding": #{$switch-padding},
|
|
32
|
+
"switch-border-width": #{$switch-border-width},
|
|
33
|
+
"switch-background": #{$switch-background},
|
|
34
|
+
"switch-circle-color": #{$switch-circle-color},
|
|
35
|
+
"switch-active-color": #{$switch-active-color},
|
|
36
|
+
"switch-radius": #{$switch-radius},
|
|
37
|
+
"switch-label-gap": #{$switch-label-gap},
|
|
38
|
+
"switch-transition-duration": #{$switch-transition-duration},
|
|
39
|
+
"switch-circle-shadow": #{$switch-circle-shadow},
|
|
40
|
+
"switch-focus-shadow": #{$switch-focus-shadow},
|
|
41
|
+
"switch-thin-height": #{$switch-thin-height},
|
|
42
|
+
"switch-thin-circle-size": #{$switch-thin-circle-size},
|
|
43
|
+
)
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Main switch label
|
|
48
|
+
.#{iv.$class-prefix}switch {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
position: relative;
|
|
53
|
+
user-select: none;
|
|
54
|
+
|
|
55
|
+
// Hidden native input
|
|
56
|
+
input[type="checkbox"] {
|
|
57
|
+
position: absolute;
|
|
58
|
+
opacity: 0;
|
|
59
|
+
width: 0;
|
|
60
|
+
height: 0;
|
|
61
|
+
|
|
62
|
+
// Checked state
|
|
63
|
+
&:checked + .check {
|
|
64
|
+
background-color: cv.getVar("switch-active-color");
|
|
65
|
+
border-color: cv.getVar("switch-active-color");
|
|
66
|
+
|
|
67
|
+
&::before {
|
|
68
|
+
transform: translateX(
|
|
69
|
+
calc(cv.getVar("switch-width") - cv.getVar("switch-height"))
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Focus-visible state (keyboard only)
|
|
75
|
+
&:focus-visible + .check {
|
|
76
|
+
outline: 2px solid cv.getVar("switch-active-color");
|
|
77
|
+
outline-offset: 2px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Legacy focus state for older browsers
|
|
81
|
+
&:focus + .check {
|
|
82
|
+
box-shadow: cv.getVar("switch-focus-shadow");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Disabled state
|
|
86
|
+
&:disabled + .check {
|
|
87
|
+
opacity: 0.5;
|
|
88
|
+
cursor: not-allowed;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:disabled ~ .control-label {
|
|
92
|
+
opacity: 0.5;
|
|
93
|
+
cursor: not-allowed;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Track (the pill-shaped background)
|
|
98
|
+
.check {
|
|
99
|
+
display: inline-block;
|
|
100
|
+
position: relative;
|
|
101
|
+
width: cv.getVar("switch-width");
|
|
102
|
+
height: cv.getVar("switch-height");
|
|
103
|
+
background-color: cv.getVar("switch-background");
|
|
104
|
+
border: cv.getVar("switch-border-width") solid transparent;
|
|
105
|
+
border-radius: cv.getVar("switch-radius");
|
|
106
|
+
flex-shrink: 0;
|
|
107
|
+
transition-property: background-color, border-color;
|
|
108
|
+
transition-duration: cv.getVar("switch-transition-duration");
|
|
109
|
+
transition-timing-function: ease;
|
|
110
|
+
|
|
111
|
+
// Circle knob
|
|
112
|
+
&::before {
|
|
113
|
+
content: "";
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: cv.getVar("switch-padding");
|
|
116
|
+
left: cv.getVar("switch-padding");
|
|
117
|
+
width: calc(
|
|
118
|
+
cv.getVar("switch-height") - cv.getVar("switch-padding") * 2 -
|
|
119
|
+
cv.getVar("switch-border-width") * 2
|
|
120
|
+
);
|
|
121
|
+
height: calc(
|
|
122
|
+
cv.getVar("switch-height") - cv.getVar("switch-padding") * 2 -
|
|
123
|
+
cv.getVar("switch-border-width") * 2
|
|
124
|
+
);
|
|
125
|
+
background-color: cv.getVar("switch-circle-color");
|
|
126
|
+
border-radius: 50%;
|
|
127
|
+
box-shadow: cv.getVar("switch-circle-shadow");
|
|
128
|
+
transition-property: transform;
|
|
129
|
+
transition-duration: cv.getVar("switch-transition-duration");
|
|
130
|
+
transition-timing-function: ease;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Label text
|
|
135
|
+
.control-label {
|
|
136
|
+
margin-left: cv.getVar("switch-label-gap");
|
|
137
|
+
line-height: cv.getVar("switch-height");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// RTL support
|
|
141
|
+
&.#{iv.$class-prefix}is-rtl {
|
|
142
|
+
flex-direction: row-reverse;
|
|
143
|
+
|
|
144
|
+
.control-label {
|
|
145
|
+
margin-left: 0;
|
|
146
|
+
margin-right: cv.getVar("switch-label-gap");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Size variants
|
|
152
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-small {
|
|
153
|
+
font-size: cv.getVar("size-small");
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-medium {
|
|
157
|
+
font-size: cv.getVar("size-medium");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-large {
|
|
161
|
+
font-size: cv.getVar("size-large");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Rounded variant (already rounded by default, but explicit class for consistency)
|
|
165
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-rounded {
|
|
166
|
+
.check {
|
|
167
|
+
border-radius: cv.getVar("switch-radius");
|
|
168
|
+
|
|
169
|
+
&::before {
|
|
170
|
+
border-radius: 50%;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Thin variant — MUI-style: colored circle, muted track
|
|
176
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-thin {
|
|
177
|
+
.check {
|
|
178
|
+
height: cv.getVar("switch-thin-height");
|
|
179
|
+
background-color: color-mix(
|
|
180
|
+
in srgb,
|
|
181
|
+
cv.getVar("switch-background") 50%,
|
|
182
|
+
transparent
|
|
183
|
+
);
|
|
184
|
+
border-color: transparent;
|
|
185
|
+
|
|
186
|
+
&::before {
|
|
187
|
+
top: calc(
|
|
188
|
+
(cv.getVar("switch-thin-height") - cv.getVar("switch-thin-circle-size")) /
|
|
189
|
+
2 - cv.getVar("switch-border-width")
|
|
190
|
+
);
|
|
191
|
+
width: cv.getVar("switch-thin-circle-size");
|
|
192
|
+
height: cv.getVar("switch-thin-circle-size");
|
|
193
|
+
background-color: cv.getVar("switch-background");
|
|
194
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Checked: circle becomes active color, track becomes muted active color
|
|
199
|
+
input[type="checkbox"]:checked + .check {
|
|
200
|
+
background-color: color-mix(
|
|
201
|
+
in srgb,
|
|
202
|
+
cv.getVar("switch-active-color") 50%,
|
|
203
|
+
transparent
|
|
204
|
+
);
|
|
205
|
+
border-color: transparent;
|
|
206
|
+
|
|
207
|
+
&::before {
|
|
208
|
+
background-color: cv.getVar("switch-active-color");
|
|
209
|
+
transform: translateX(
|
|
210
|
+
calc(
|
|
211
|
+
cv.getVar("switch-width") - cv.getVar("switch-thin-circle-size") -
|
|
212
|
+
cv.getVar("switch-padding") * 2
|
|
213
|
+
)
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Outlined variant
|
|
220
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-outlined {
|
|
221
|
+
.check {
|
|
222
|
+
background-color: transparent;
|
|
223
|
+
border-color: cv.getVar("switch-background");
|
|
224
|
+
|
|
225
|
+
&::before {
|
|
226
|
+
background-color: cv.getVar("switch-background");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
input[type="checkbox"]:checked + .check {
|
|
231
|
+
background-color: transparent;
|
|
232
|
+
border-color: cv.getVar("switch-active-color");
|
|
233
|
+
|
|
234
|
+
&::before {
|
|
235
|
+
background-color: cv.getVar("switch-active-color");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Color variants
|
|
241
|
+
@each $name in "primary", "link", "info", "success", "warning", "danger" {
|
|
242
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-#{$name} {
|
|
243
|
+
@include cv.register-vars(
|
|
244
|
+
(
|
|
245
|
+
"switch-active-color": #{cv.getVar($name)},
|
|
246
|
+
)
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Passive type variants (unchecked state color)
|
|
252
|
+
@each $name in "primary", "link", "info", "success", "warning", "danger" {
|
|
253
|
+
.#{iv.$class-prefix}switch.#{iv.$class-prefix}is-#{$name}-passive {
|
|
254
|
+
.check {
|
|
255
|
+
background-color: cv.getVar($name);
|
|
256
|
+
border-color: cv.getVar($name);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Outlined passive: transparent background, colored border and circle
|
|
260
|
+
&.#{iv.$class-prefix}is-outlined {
|
|
261
|
+
.check {
|
|
262
|
+
background-color: transparent;
|
|
263
|
+
border-color: cv.getVar($name);
|
|
264
|
+
|
|
265
|
+
&::before {
|
|
266
|
+
background-color: cv.getVar($name);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Light mode: use a soft grey circle instead of pure white
|
|
274
|
+
@media (prefers-color-scheme: light) {
|
|
275
|
+
.#{iv.$class-prefix}switch {
|
|
276
|
+
@include cv.register-vars(
|
|
277
|
+
(
|
|
278
|
+
"switch-circle-color": #{$switch-circle-color-light},
|
|
279
|
+
)
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// High Contrast Mode support
|
|
285
|
+
@media (forced-colors: active) {
|
|
286
|
+
.#{iv.$class-prefix}switch {
|
|
287
|
+
.check {
|
|
288
|
+
border-color: ButtonText;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
input[type="checkbox"]:checked + .check {
|
|
292
|
+
background-color: Highlight;
|
|
293
|
+
border-color: Highlight;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
input[type="checkbox"]:focus-visible + .check {
|
|
297
|
+
outline-color: Highlight;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
input[type="checkbox"]:disabled + .check {
|
|
301
|
+
border-color: GrayText;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Reduced motion
|
|
307
|
+
@media (prefers-reduced-motion: reduce) {
|
|
308
|
+
.#{iv.$class-prefix}switch {
|
|
309
|
+
.check,
|
|
310
|
+
.check::before {
|
|
311
|
+
transition: none;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
// Taginput Component Styles
|
|
2
|
+
// A tag input control for managing multiple tags with autocomplete
|
|
3
|
+
// Follows Bulma v1 CSS variable convention (see _switch.scss)
|
|
4
|
+
|
|
5
|
+
@use "bulma/sass/utilities/initial-variables" as iv;
|
|
6
|
+
@use "bulma/sass/utilities/css-variables" as cv;
|
|
7
|
+
|
|
8
|
+
// Taginput-specific SCSS variables
|
|
9
|
+
$taginput-height: auto !default;
|
|
10
|
+
$taginput-min-height: 2.5em !default;
|
|
11
|
+
$taginput-padding: 0.375rem 0.5rem !default;
|
|
12
|
+
$taginput-border-color: cv.getVar("border") !default;
|
|
13
|
+
$taginput-border-radius: cv.getVar("radius") !default;
|
|
14
|
+
$taginput-background: cv.getVar("scheme-main") !default;
|
|
15
|
+
$taginput-tag-gap: 0.25rem !default;
|
|
16
|
+
$taginput-dropdown-max-height: 200px !default;
|
|
17
|
+
$taginput-transition-duration: cv.getVar("duration") !default;
|
|
18
|
+
|
|
19
|
+
// Register CSS custom properties
|
|
20
|
+
.#{iv.$class-prefix}taginput {
|
|
21
|
+
@include cv.register-vars(
|
|
22
|
+
(
|
|
23
|
+
"taginput-height": #{$taginput-height},
|
|
24
|
+
"taginput-min-height": #{$taginput-min-height},
|
|
25
|
+
"taginput-padding": #{$taginput-padding},
|
|
26
|
+
"taginput-border-color": #{$taginput-border-color},
|
|
27
|
+
"taginput-border-radius": #{$taginput-border-radius},
|
|
28
|
+
"taginput-background": #{$taginput-background},
|
|
29
|
+
"taginput-tag-gap": #{$taginput-tag-gap},
|
|
30
|
+
"taginput-dropdown-max-height": #{$taginput-dropdown-max-height},
|
|
31
|
+
"taginput-transition-duration": #{$taginput-transition-duration},
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Main taginput wrapper
|
|
37
|
+
.#{iv.$class-prefix}taginput {
|
|
38
|
+
position: relative;
|
|
39
|
+
width: 100%;
|
|
40
|
+
|
|
41
|
+
// Container for tags and input
|
|
42
|
+
.#{iv.$class-prefix}taginput-container {
|
|
43
|
+
position: relative;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
align-items: center;
|
|
47
|
+
height: cv.getVar("taginput-height");
|
|
48
|
+
min-height: cv.getVar("taginput-min-height");
|
|
49
|
+
padding: cv.getVar("taginput-padding");
|
|
50
|
+
border: 1px solid cv.getVar("taginput-border-color");
|
|
51
|
+
border-radius: cv.getVar("taginput-border-radius");
|
|
52
|
+
background-color: cv.getVar("taginput-background");
|
|
53
|
+
cursor: text;
|
|
54
|
+
transition-property: border-color, box-shadow;
|
|
55
|
+
transition-duration: cv.getVar("taginput-transition-duration");
|
|
56
|
+
transition-timing-function: ease;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
border-color: cv.getVar("border-hover");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:focus-within {
|
|
63
|
+
border-color: hsl(cv.getVar("input-focus-h"), cv.getVar("input-focus-s"), cv.getVar("input-focus-l"));
|
|
64
|
+
box-shadow: cv.getVar("input-focus-shadow-size") hsla(cv.getVar("input-focus-h"), cv.getVar("input-focus-s"), cv.getVar("input-focus-l"), cv.getVar("input-focus-shadow-alpha"));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.#{iv.$class-prefix}is-attached {
|
|
68
|
+
.#{iv.$class-prefix}tags {
|
|
69
|
+
gap: 0;
|
|
70
|
+
|
|
71
|
+
.#{iv.$class-prefix}tag {
|
|
72
|
+
margin-right: 0;
|
|
73
|
+
border-radius: 0;
|
|
74
|
+
|
|
75
|
+
&:first-child {
|
|
76
|
+
border-top-left-radius: cv.getVar("taginput-border-radius");
|
|
77
|
+
border-bottom-left-radius: cv.getVar("taginput-border-radius");
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:last-of-type {
|
|
81
|
+
border-top-right-radius: cv.getVar("taginput-border-radius");
|
|
82
|
+
border-bottom-right-radius: cv.getVar("taginput-border-radius");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Loading spinner icon
|
|
89
|
+
> .#{iv.$class-prefix}icon.#{iv.$class-prefix}is-right {
|
|
90
|
+
position: absolute;
|
|
91
|
+
right: 0.625em;
|
|
92
|
+
top: 50%;
|
|
93
|
+
transform: translateY(-50%);
|
|
94
|
+
pointer-events: none;
|
|
95
|
+
z-index: 4;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Left icon support
|
|
99
|
+
&.#{iv.$class-prefix}has-icons-left {
|
|
100
|
+
> .#{iv.$class-prefix}tags {
|
|
101
|
+
padding-left: 2em;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
> .#{iv.$class-prefix}icon.#{iv.$class-prefix}is-left {
|
|
105
|
+
position: absolute;
|
|
106
|
+
left: 0.625em;
|
|
107
|
+
top: 50%;
|
|
108
|
+
transform: translateY(-50%);
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
z-index: 4;
|
|
111
|
+
color: cv.getVar("text-weak");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Tags wrapper
|
|
117
|
+
.#{iv.$class-prefix}tags {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex-wrap: wrap;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: cv.getVar("taginput-tag-gap");
|
|
122
|
+
margin: 0;
|
|
123
|
+
flex-grow: 1;
|
|
124
|
+
|
|
125
|
+
.#{iv.$class-prefix}tag {
|
|
126
|
+
margin-bottom: 0;
|
|
127
|
+
display: inline-flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: cv.getVar("taginput-tag-gap");
|
|
130
|
+
|
|
131
|
+
.#{iv.$class-prefix}delete {
|
|
132
|
+
margin-left: 0.25rem;
|
|
133
|
+
margin-right: -0.25rem;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Input field
|
|
139
|
+
.#{iv.$class-prefix}input {
|
|
140
|
+
flex: 1 1 auto;
|
|
141
|
+
min-width: 80px;
|
|
142
|
+
width: auto;
|
|
143
|
+
border: none;
|
|
144
|
+
box-shadow: none;
|
|
145
|
+
padding: 0;
|
|
146
|
+
height: auto;
|
|
147
|
+
background: transparent;
|
|
148
|
+
|
|
149
|
+
&:focus {
|
|
150
|
+
outline: none;
|
|
151
|
+
box-shadow: none;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&::placeholder {
|
|
155
|
+
color: cv.getVar("text-weak");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Dropdown menu
|
|
160
|
+
.#{iv.$class-prefix}dropdown-menu {
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 100%;
|
|
163
|
+
left: 0;
|
|
164
|
+
right: 0;
|
|
165
|
+
z-index: 20;
|
|
166
|
+
display: none;
|
|
167
|
+
padding-top: 4px;
|
|
168
|
+
|
|
169
|
+
&.#{iv.$class-prefix}is-active {
|
|
170
|
+
display: block;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Dropdown content
|
|
175
|
+
.#{iv.$class-prefix}dropdown-content {
|
|
176
|
+
background-color: cv.getVar("taginput-background");
|
|
177
|
+
border-radius: cv.getVar("taginput-border-radius");
|
|
178
|
+
box-shadow: cv.getVar("shadow");
|
|
179
|
+
padding-bottom: 0.5rem;
|
|
180
|
+
padding-top: 0.5rem;
|
|
181
|
+
max-height: cv.getVar("taginput-dropdown-max-height");
|
|
182
|
+
overflow-y: auto;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Dropdown items
|
|
186
|
+
.#{iv.$class-prefix}dropdown-item {
|
|
187
|
+
display: block;
|
|
188
|
+
padding: 0.375rem 1rem;
|
|
189
|
+
color: cv.getVar("text");
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
text-decoration: none;
|
|
192
|
+
|
|
193
|
+
&:hover {
|
|
194
|
+
background-color: cv.getVar("scheme-main-bis");
|
|
195
|
+
color: cv.getVar("text-strong");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&.#{iv.$class-prefix}is-active {
|
|
199
|
+
background-color: cv.getVar("scheme-main-bis");
|
|
200
|
+
color: cv.getVar("text-strong");
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Counter display
|
|
205
|
+
.#{iv.$class-prefix}help.#{iv.$class-prefix}counter {
|
|
206
|
+
float: right;
|
|
207
|
+
margin-left: auto;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Rounded modifier — makes tags rounded
|
|
211
|
+
&.#{iv.$class-prefix}is-rounded {
|
|
212
|
+
.#{iv.$class-prefix}tag {
|
|
213
|
+
border-radius: cv.getVar("radius-rounded");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Ellipsis modifier — truncate long tag text
|
|
218
|
+
&.#{iv.$class-prefix}is-ellipsis {
|
|
219
|
+
.#{iv.$class-prefix}tag {
|
|
220
|
+
max-width: 10em;
|
|
221
|
+
|
|
222
|
+
> span {
|
|
223
|
+
overflow: hidden;
|
|
224
|
+
text-overflow: ellipsis;
|
|
225
|
+
white-space: nowrap;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Size variants
|
|
232
|
+
.#{iv.$class-prefix}taginput.#{iv.$class-prefix}is-small {
|
|
233
|
+
.#{iv.$class-prefix}taginput-container {
|
|
234
|
+
min-height: 2em;
|
|
235
|
+
padding: 0.25rem 0.375rem;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.#{iv.$class-prefix}input {
|
|
239
|
+
font-size: cv.getVar("size-small");
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.#{iv.$class-prefix}tag {
|
|
243
|
+
font-size: cv.getVar("size-small");
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.#{iv.$class-prefix}dropdown-item {
|
|
247
|
+
font-size: cv.getVar("size-small");
|
|
248
|
+
padding: 0.25rem 0.75rem;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.#{iv.$class-prefix}taginput.#{iv.$class-prefix}is-medium {
|
|
253
|
+
.#{iv.$class-prefix}taginput-container {
|
|
254
|
+
min-height: 3em;
|
|
255
|
+
padding: 0.5rem 0.625rem;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.#{iv.$class-prefix}input {
|
|
259
|
+
font-size: cv.getVar("size-medium");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.#{iv.$class-prefix}tag {
|
|
263
|
+
font-size: cv.getVar("size-medium");
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.#{iv.$class-prefix}dropdown-item {
|
|
267
|
+
font-size: cv.getVar("size-medium");
|
|
268
|
+
padding: 0.5rem 1.25rem;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.#{iv.$class-prefix}taginput.#{iv.$class-prefix}is-large {
|
|
273
|
+
.#{iv.$class-prefix}taginput-container {
|
|
274
|
+
min-height: 3.5em;
|
|
275
|
+
padding: 0.625rem 0.75rem;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.#{iv.$class-prefix}input {
|
|
279
|
+
font-size: cv.getVar("size-large");
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.#{iv.$class-prefix}tag {
|
|
283
|
+
font-size: cv.getVar("size-large");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.#{iv.$class-prefix}dropdown-item {
|
|
287
|
+
font-size: cv.getVar("size-large");
|
|
288
|
+
padding: 0.625rem 1.5rem;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Disabled state
|
|
293
|
+
.#{iv.$class-prefix}taginput.#{iv.$class-prefix}is-disabled {
|
|
294
|
+
.#{iv.$class-prefix}taginput-container {
|
|
295
|
+
background-color: cv.getVar("scheme-main-bis");
|
|
296
|
+
cursor: not-allowed;
|
|
297
|
+
|
|
298
|
+
&:hover {
|
|
299
|
+
border-color: cv.getVar("taginput-border-color");
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.#{iv.$class-prefix}tag {
|
|
304
|
+
opacity: 0.7;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.#{iv.$class-prefix}input {
|
|
308
|
+
cursor: not-allowed;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Color variants (for input focus state)
|
|
313
|
+
@each $name in "primary", "link", "info", "success", "warning", "danger" {
|
|
314
|
+
.#{iv.$class-prefix}taginput.#{iv.$class-prefix}is-#{$name} {
|
|
315
|
+
.#{iv.$class-prefix}taginput-container:focus-within {
|
|
316
|
+
border-color: cv.getVar($name);
|
|
317
|
+
box-shadow: cv.getVar("input-focus-shadow-size") hsla(cv.getVar("#{$name}-h"), cv.getVar("#{$name}-s"), cv.getVar("#{$name}-l"), cv.getVar("input-focus-shadow-alpha"));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// High Contrast Mode support
|
|
323
|
+
@media (forced-colors: active) {
|
|
324
|
+
.#{iv.$class-prefix}taginput {
|
|
325
|
+
.#{iv.$class-prefix}taginput-container {
|
|
326
|
+
border-color: ButtonText;
|
|
327
|
+
|
|
328
|
+
&:focus-within {
|
|
329
|
+
border-color: Highlight;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.#{iv.$class-prefix}tag {
|
|
334
|
+
border: 1px solid ButtonText;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
&.#{iv.$class-prefix}is-disabled {
|
|
338
|
+
.#{iv.$class-prefix}taginput-container {
|
|
339
|
+
border-color: GrayText;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.#{iv.$class-prefix}tag {
|
|
343
|
+
border-color: GrayText;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Reduced motion
|
|
350
|
+
@media (prefers-reduced-motion: reduce) {
|
|
351
|
+
.#{iv.$class-prefix}taginput {
|
|
352
|
+
.#{iv.$class-prefix}taginput-container {
|
|
353
|
+
transition: none;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|