@allxsmith/bestax-bulma 5.33.0 → 5.34.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 (42) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/EmptyState.js +139 -0
  4. package/dist/esm/components/EmptyState.js.map +1 -0
  5. package/dist/esm/elements/Buttons.js.map +1 -1
  6. package/dist/esm/elements/SubTitle.js.map +1 -1
  7. package/dist/esm/elements/Title.js.map +1 -1
  8. package/dist/esm/form/Autocomplete.js +59 -14
  9. package/dist/esm/form/Autocomplete.js.map +1 -1
  10. package/dist/esm/helpers/statusRegion.js +19 -12
  11. package/dist/esm/helpers/statusRegion.js.map +1 -1
  12. package/dist/extras.css +1 -1
  13. package/dist/extras.css.map +1 -1
  14. package/dist/index.cjs +1188 -1006
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.esm.js +1 -0
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/types/components/EmptyState.d.ts +149 -0
  19. package/dist/types/elements/Buttons.d.ts +1 -1
  20. package/dist/types/elements/SubTitle.d.ts +13 -2
  21. package/dist/types/elements/Title.d.ts +11 -2
  22. package/dist/types/form/Autocomplete.d.ts +18 -3
  23. package/dist/types/helpers/statusRegion.d.ts +4 -4
  24. package/dist/types/index.d.ts +1 -0
  25. package/dist/types-cjs/components/EmptyState.d.ts +149 -0
  26. package/dist/types-cjs/elements/Buttons.d.ts +1 -1
  27. package/dist/types-cjs/elements/SubTitle.d.ts +13 -2
  28. package/dist/types-cjs/elements/Title.d.ts +11 -2
  29. package/dist/types-cjs/form/Autocomplete.d.ts +18 -3
  30. package/dist/types-cjs/helpers/statusRegion.d.ts +4 -4
  31. package/dist/types-cjs/index.d.ts +1 -0
  32. package/dist/versions/bestax-no-dark-mode.css +1 -1
  33. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  34. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  35. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  36. package/dist/versions/bestax-no-helpers.css +1 -1
  37. package/dist/versions/bestax-no-helpers.css.map +1 -1
  38. package/dist/versions/bestax-prefixed.css +1 -1
  39. package/dist/versions/bestax-prefixed.css.map +1 -1
  40. package/package.json +1 -1
  41. package/src/scss/components/_emptystate.scss +243 -0
  42. package/src/scss/components/_index.scss +1 -0
@@ -0,0 +1,243 @@
1
+ // Bestax Extras - EmptyState Styles
2
+ // The block an app shows where content would be: a circle with a picture in
3
+ // it, a heading, a line of text and some actions, in one column. Bulma has a
4
+ // class for every piece of that but the circle.
5
+ //
6
+ // A size is a handful of variables rather than a set of rules: the size
7
+ // classes change the `--bulma-empty-state-*` values and the rules read them.
8
+ // The colors work the same way, and every pairing is made from Bulma's scheme
9
+ // tokens, so dark mode needs no rules of its own.
10
+
11
+ @use "sass:map";
12
+ @use "bulma/sass/utilities/initial-variables" as iv;
13
+ @use "bulma/sass/utilities/css-variables" as cv;
14
+
15
+ $empty-state-gap: 1rem !default;
16
+ // Block padding only. Whatever holds the empty state pads its sides.
17
+ $empty-state-padding: 3rem !default;
18
+ $empty-state-indicator-size: 3rem !default;
19
+ $empty-state-indicator-radius: cv.getVar("radius-rounded") !default;
20
+ $empty-state-indicator-background: cv.getVar("background") !default;
21
+ $empty-state-indicator-color: cv.getVar("text-weak") !default;
22
+ $empty-state-icon-size: 1.5rem !default;
23
+ $empty-state-title-size: cv.getVar("size-5") !default;
24
+ $empty-state-description-size: cv.getVar("size-6") !default;
25
+ // The text around it, so the description keeps the contrast its container
26
+ // has, a colored Hero included.
27
+ $empty-state-description-color: currentColor !default;
28
+ // In em, so it's a readable line at every size.
29
+ $empty-state-description-max-width: 32em !default;
30
+
31
+ // The other sizes, each with the values it changes. The icon sizes are
32
+ // Bulma's `.icon` dimensions and the indicator is twice the icon.
33
+ $empty-state-sizes: (
34
+ "small": (
35
+ "gap": 0.75rem,
36
+ "padding": 1.5rem,
37
+ "indicator-size": 2rem,
38
+ "icon-size": 1rem,
39
+ "title-size": cv.getVar("size-6"),
40
+ "description-size": cv.getVar("size-7"),
41
+ ),
42
+ "medium": (
43
+ "gap": 1.25rem,
44
+ "padding": 4.5rem,
45
+ "indicator-size": 4rem,
46
+ "icon-size": 2rem,
47
+ "title-size": cv.getVar("size-4"),
48
+ "description-size": cv.getVar("size-6"),
49
+ ),
50
+ "large": (
51
+ "gap": 1.5rem,
52
+ "padding": 6rem,
53
+ "indicator-size": 6rem,
54
+ "icon-size": 3rem,
55
+ "title-size": cv.getVar("size-3"),
56
+ "description-size": cv.getVar("size-5"),
57
+ ),
58
+ ) !default;
59
+
60
+ .#{iv.$class-prefix}empty-state {
61
+ @include cv.register-vars(
62
+ (
63
+ "empty-state-gap": #{$empty-state-gap},
64
+ "empty-state-padding": #{$empty-state-padding},
65
+ "empty-state-indicator-size": #{$empty-state-indicator-size},
66
+ "empty-state-indicator-radius": #{$empty-state-indicator-radius},
67
+ "empty-state-indicator-background": #{$empty-state-indicator-background},
68
+ "empty-state-indicator-color": #{$empty-state-indicator-color},
69
+ "empty-state-icon-size": #{$empty-state-icon-size},
70
+ "empty-state-title-size": #{$empty-state-title-size},
71
+ "empty-state-description-size": #{$empty-state-description-size},
72
+ "empty-state-description-color": #{$empty-state-description-color},
73
+ "empty-state-description-max-width": #{$empty-state-description-max-width},
74
+ )
75
+ );
76
+ }
77
+
78
+ @each $size, $values in $empty-state-sizes {
79
+ .#{iv.$class-prefix}empty-state.#{iv.$class-prefix}is-#{$size} {
80
+ @include cv.register-vars(
81
+ (
82
+ "empty-state-gap": #{map.get($values, "gap")},
83
+ "empty-state-padding": #{map.get($values, "padding")},
84
+ "empty-state-indicator-size": #{map.get($values, "indicator-size")},
85
+ "empty-state-icon-size": #{map.get($values, "icon-size")},
86
+ "empty-state-title-size": #{map.get($values, "title-size")},
87
+ "empty-state-description-size": #{map.get($values, "description-size")},
88
+ )
89
+ );
90
+ }
91
+ }
92
+
93
+ // The neutral pair turned around: the text color behind an icon in the
94
+ // page's own background.
95
+ .#{iv.$class-prefix}empty-state.#{iv.$class-prefix}is-filled {
96
+ @include cv.register-vars(
97
+ (
98
+ "empty-state-indicator-background": #{cv.getVar("text")},
99
+ "empty-state-indicator-color": #{cv.getVar("scheme-main")},
100
+ )
101
+ );
102
+ }
103
+
104
+ // `light` is the pair Bulma's `.button.is-soft` uses, built here from the
105
+ // lightness the scheme sets, the way that button builds it, so a dark theme
106
+ // set on part of the page turns it too. `filled` is the color itself with the
107
+ // icon in its invert.
108
+ @each $name in "primary", "link", "info", "success", "warning", "danger" {
109
+ .#{iv.$class-prefix}empty-state.#{iv.$class-prefix}is-#{$name} {
110
+ @include cv.register-vars(
111
+ (
112
+ "empty-state-indicator-background":
113
+ hsl(
114
+ #{cv.getVar($name, "", "-h")},
115
+ #{cv.getVar($name, "", "-s")},
116
+ #{cv.getVar("soft-l")}
117
+ ),
118
+ "empty-state-indicator-color":
119
+ hsl(
120
+ #{cv.getVar($name, "", "-h")},
121
+ #{cv.getVar($name, "", "-s")},
122
+ #{cv.getVar("soft-invert-l")}
123
+ ),
124
+ )
125
+ );
126
+ }
127
+
128
+ .#{iv.$class-prefix}empty-state.#{iv.$class-prefix}is-#{$name}.#{iv.$class-prefix}is-filled {
129
+ @include cv.register-vars(
130
+ (
131
+ "empty-state-indicator-background": #{cv.getVar($name)},
132
+ "empty-state-indicator-color": #{cv.getVar($name, "", "-invert")},
133
+ )
134
+ );
135
+ }
136
+ }
137
+
138
+ // One column with the gap between its parts, so a part that isn't there
139
+ // leaves no space. A centered flex item keeps its own width, so a lone button
140
+ // sits centered under the text without being stretched across.
141
+ .#{iv.$class-prefix}empty-state {
142
+ align-items: center;
143
+ display: flex;
144
+ flex-direction: column;
145
+ gap: cv.getVar("empty-state-gap");
146
+ padding-block: cv.getVar("empty-state-padding");
147
+ text-align: center;
148
+ }
149
+
150
+ .#{iv.$class-prefix}empty-state-indicator {
151
+ align-items: center;
152
+ background-color: cv.getVar("empty-state-indicator-background");
153
+ border-radius: cv.getVar("empty-state-indicator-radius");
154
+ color: cv.getVar("empty-state-indicator-color");
155
+ display: flex;
156
+ flex-shrink: 0;
157
+ font-size: cv.getVar("empty-state-icon-size");
158
+ height: cv.getVar("empty-state-indicator-size");
159
+ justify-content: center;
160
+ line-height: 1;
161
+ width: cv.getVar("empty-state-indicator-size");
162
+
163
+ // Font Awesome, Material Design Icons and Ionicons draw at the font size
164
+ // already. An Icon's box is 1.5rem whatever the glyph is, so it's sized to
165
+ // the glyph here, and a bare SVG or image is drawn at it too.
166
+ > .#{iv.$class-prefix}icon,
167
+ > svg,
168
+ > img {
169
+ height: 1em;
170
+ width: 1em;
171
+ }
172
+
173
+ // Material Icons and Material Symbols set a fixed 24px on the glyph, so
174
+ // they're handed the indicator's size back.
175
+ .material-icons,
176
+ .material-icons-outlined,
177
+ .material-icons-round,
178
+ .material-icons-sharp,
179
+ .material-icons-two-tone,
180
+ .material-symbols-outlined,
181
+ .material-symbols-rounded,
182
+ .material-symbols-sharp {
183
+ font-size: inherit;
184
+ }
185
+ }
186
+
187
+ // The title keeps Bulma's title look at the EmptyState's size. Bulma's
188
+ // `.title:not(:last-child)` and `.buttons:not(:last-child)` margins are
189
+ // cleared by selectors that out-rank them, so the gap is the only space
190
+ // between the parts. Any other child keeps its margins, and a margin helper
191
+ // still wins, since the helpers are `!important`.
192
+ .#{iv.$class-prefix}empty-state .#{iv.$class-prefix}title.#{iv.$class-prefix}empty-state-title {
193
+ font-size: cv.getVar("empty-state-title-size");
194
+ margin-bottom: 0;
195
+ }
196
+
197
+ .#{iv.$class-prefix}empty-state .#{iv.$class-prefix}buttons.#{iv.$class-prefix}empty-state-actions {
198
+ justify-content: center;
199
+ margin-bottom: 0;
200
+ }
201
+
202
+ .#{iv.$class-prefix}empty-state-description {
203
+ color: cv.getVar("empty-state-description-color");
204
+ font-size: cv.getVar("empty-state-description-size");
205
+ max-width: cv.getVar("empty-state-description-max-width");
206
+ }
207
+
208
+ // `left` is the start of the line, so the right in a right-to-left page. The
209
+ // indicator comes out of the flow and sits there, level with the top of the
210
+ // first part, wherever it's written, and the column makes room for it. A grid
211
+ // can't do this, since the children are free-form and it can't span rows it
212
+ // can't count. With no indicator, `left` only puts the text at the start of
213
+ // the line, and no room is kept.
214
+ .#{iv.$class-prefix}empty-state.#{iv.$class-prefix}is-left {
215
+ align-items: flex-start;
216
+ position: relative;
217
+ text-align: start;
218
+
219
+ // The height is kept on the content box, so whatever padding is in effect,
220
+ // a `py` helper's included, the block is just tall enough for the circle.
221
+ // Bulma's reset has every element inherit its box-sizing, so the parts are
222
+ // handed border-box back.
223
+ &:has(> .#{iv.$class-prefix}empty-state-indicator) {
224
+ box-sizing: content-box;
225
+ min-height: cv.getVar("empty-state-indicator-size");
226
+ padding-inline-start: calc(
227
+ #{cv.getVar("empty-state-indicator-size")} + #{cv.getVar("empty-state-gap")}
228
+ );
229
+
230
+ > * {
231
+ box-sizing: border-box;
232
+ }
233
+ }
234
+
235
+ .#{iv.$class-prefix}empty-state-indicator {
236
+ inset-inline-start: 0;
237
+ position: absolute;
238
+ }
239
+
240
+ .#{iv.$class-prefix}buttons.#{iv.$class-prefix}empty-state-actions {
241
+ justify-content: flex-start;
242
+ }
243
+ }
@@ -18,3 +18,4 @@
18
18
  @use 'avatar';
19
19
  @use 'avatars';
20
20
  @use 'badge';
21
+ @use 'emptystate';