@allxsmith/bestax-bulma 5.40.0 → 5.41.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.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/Menu.js +77 -2
- package/dist/esm/components/Menu.js.map +1 -1
- package/dist/esm/components/Modal.js +3 -3
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Popover.js +2 -2
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/Sidebar.js +2 -2
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/elements/Image.js +4 -12
- package/dist/esm/elements/Image.js.map +1 -1
- package/dist/esm/helpers/useFocusTrap.js +60 -41
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +162 -78
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/types/components/Menu.d.ts +49 -0
- package/dist/types/elements/Image.d.ts +6 -1
- package/dist/types/helpers/useFocusTrap.d.ts +16 -8
- package/dist/types-cjs/components/Menu.d.ts +49 -0
- package/dist/types-cjs/elements/Image.d.ts +6 -1
- package/dist/types-cjs/helpers/useFocusTrap.d.ts +16 -8
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/components/_menu.scss +130 -3
|
@@ -1,4 +1,128 @@
|
|
|
1
1
|
// Bestax Extras - Menu Styles
|
|
2
|
+
// Two additions to Bulma's menu: `Menu.Section`, a section that opens and
|
|
3
|
+
// closes, and a mark for the active item in forced colors.
|
|
4
|
+
|
|
5
|
+
@use "bulma/sass/utilities/initial-variables" as iv;
|
|
6
|
+
@use "bulma/sass/utilities/css-variables" as cv;
|
|
7
|
+
@use "../mixins" as *;
|
|
8
|
+
|
|
9
|
+
// Menu.Section's own. Its heading reads the menu label's variables, so a
|
|
10
|
+
// theme that restyles the labels restyles it too, and these cover what a
|
|
11
|
+
// label doesn't have: the room between its words and its chevron, and the
|
|
12
|
+
// chevron.
|
|
13
|
+
$menu-section-gap: 0.375em !default;
|
|
14
|
+
$menu-section-chevron-size: 1em !default;
|
|
15
|
+
$menu-section-chevron-color: currentColor !default;
|
|
16
|
+
$menu-section-chevron-duration: cv.getVar("duration") !default;
|
|
17
|
+
|
|
18
|
+
.#{iv.$class-prefix}menu {
|
|
19
|
+
@include cv.register-vars(
|
|
20
|
+
(
|
|
21
|
+
"menu-section-gap": #{$menu-section-gap},
|
|
22
|
+
"menu-section-chevron-size": #{$menu-section-chevron-size},
|
|
23
|
+
"menu-section-chevron-color": #{$menu-section-chevron-color},
|
|
24
|
+
"menu-section-chevron-duration": #{$menu-section-chevron-duration},
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The space Bulma puts around a label, which turns on where the label sits
|
|
30
|
+
// among the menu's children: above it unless it comes first, and below it
|
|
31
|
+
// unless it comes last. A heading takes the same two from where its section
|
|
32
|
+
// sits, plus the space between an open heading and its own list. Without
|
|
33
|
+
// the one below, a menu list right after a closed section would sit flush
|
|
34
|
+
// under its heading, as if it were the section's. Two sections in a row are
|
|
35
|
+
// still one space apart, since the margins collapse. They're on the heading,
|
|
36
|
+
// so the label's `em` measures them in the label's own small size, as
|
|
37
|
+
// Bulma's do. The heading doesn't carry `.menu-label` itself, because its
|
|
38
|
+
// own place inside its section never changes.
|
|
39
|
+
.#{iv.$class-prefix}menu-section:not(:first-child) > .#{iv.$class-prefix}menu-section-toggle {
|
|
40
|
+
margin-top: cv.getVar("menu-label-spacing");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.#{iv.$class-prefix}menu-section:not(:last-child) > .#{iv.$class-prefix}menu-section-toggle,
|
|
44
|
+
.#{iv.$class-prefix}menu-section-toggle[aria-expanded="true"] {
|
|
45
|
+
margin-bottom: cv.getVar("menu-label-spacing");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// The heading is a button drawn like Bulma's `.menu-label`: small, spaced
|
|
49
|
+
// and uppercase, in the label's weak text color.
|
|
50
|
+
.#{iv.$class-prefix}menu-section-toggle {
|
|
51
|
+
align-items: center;
|
|
52
|
+
appearance: none;
|
|
53
|
+
background: none;
|
|
54
|
+
border: none;
|
|
55
|
+
color: cv.getVar("menu-label-color");
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
display: flex;
|
|
58
|
+
font-family: inherit;
|
|
59
|
+
font-size: cv.getVar("menu-label-font-size");
|
|
60
|
+
font-weight: inherit;
|
|
61
|
+
gap: cv.getVar("menu-section-gap");
|
|
62
|
+
letter-spacing: cv.getVar("menu-label-letter-spacing");
|
|
63
|
+
line-height: inherit;
|
|
64
|
+
margin: 0;
|
|
65
|
+
padding: 0;
|
|
66
|
+
text-align: start;
|
|
67
|
+
text-transform: uppercase;
|
|
68
|
+
width: 100%;
|
|
69
|
+
|
|
70
|
+
&:focus {
|
|
71
|
+
outline: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:focus-visible {
|
|
75
|
+
@include extras-focus-outline;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.#{iv.$class-prefix}menu-section-label {
|
|
80
|
+
flex: 1 1 auto;
|
|
81
|
+
min-width: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// TreeView's chevron, drawn the same way: two sides of a square, turned, in
|
|
85
|
+
// a box of its own, the way Bulma's `%arrow` draws the `.select` arrow. It
|
|
86
|
+
// sits at the end of the heading, points to the end of the line while
|
|
87
|
+
// closed and down while open, and both follow a right-to-left page. It's a
|
|
88
|
+
// border in the heading's text color, so it stays in forced colors.
|
|
89
|
+
.#{iv.$class-prefix}menu-section-chevron {
|
|
90
|
+
align-items: center;
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
flex: none;
|
|
93
|
+
height: cv.getVar("menu-section-chevron-size");
|
|
94
|
+
justify-content: center;
|
|
95
|
+
width: cv.getVar("menu-section-chevron-size");
|
|
96
|
+
|
|
97
|
+
&::after {
|
|
98
|
+
// The square's bottom and left sides before it's turned, so physical
|
|
99
|
+
// sides, like the turn.
|
|
100
|
+
border-color: cv.getVar("menu-section-chevron-color");
|
|
101
|
+
border-style: solid;
|
|
102
|
+
border-width: 0 0 0.125em 0.125em;
|
|
103
|
+
content: "";
|
|
104
|
+
height: 0.5em;
|
|
105
|
+
transform: translateX(-15%) rotate(-135deg);
|
|
106
|
+
transition-duration: cv.getVar("menu-section-chevron-duration");
|
|
107
|
+
transition-property: transform;
|
|
108
|
+
width: 0.5em;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.#{iv.$class-prefix}menu-section-toggle[aria-expanded="false"]:dir(rtl) > .#{iv.$class-prefix}menu-section-chevron::after {
|
|
113
|
+
transform: translateX(15%) rotate(45deg);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.#{iv.$class-prefix}menu-section-toggle[aria-expanded="true"] > .#{iv.$class-prefix}menu-section-chevron::after {
|
|
117
|
+
transform: translateY(-15%) rotate(-45deg);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (prefers-reduced-motion: reduce) {
|
|
121
|
+
.#{iv.$class-prefix}menu-section-chevron::after {
|
|
122
|
+
transition: none;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
2
126
|
// Bulma draws a menu's active item with a fill and a text color and nothing
|
|
3
127
|
// else, and forced colors (Windows' contrast themes) replaces both, so the
|
|
4
128
|
// active item looks like every other item there. This marks it with a bar in
|
|
@@ -14,9 +138,6 @@
|
|
|
14
138
|
//
|
|
15
139
|
// It reads the classes Bulma highlights, on the elements Bulma styles as
|
|
16
140
|
// items, so a hand-written `.is-active` link gets it too.
|
|
17
|
-
|
|
18
|
-
@use "bulma/sass/utilities/initial-variables" as iv;
|
|
19
|
-
|
|
20
141
|
@media (forced-colors: active) {
|
|
21
142
|
.#{iv.$class-prefix}menu-list {
|
|
22
143
|
a,
|
|
@@ -34,4 +155,10 @@
|
|
|
34
155
|
}
|
|
35
156
|
}
|
|
36
157
|
}
|
|
158
|
+
|
|
159
|
+
// A section heading's focus ring in the system's text color, as
|
|
160
|
+
// TreeView's is.
|
|
161
|
+
.#{iv.$class-prefix}menu-section-toggle:focus-visible {
|
|
162
|
+
outline-color: CanvasText;
|
|
163
|
+
}
|
|
37
164
|
}
|