compostrap 0.0.0-stage → 1.0.1

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 (198) hide show
  1. package/dist/css/auth.css +166 -0
  2. package/dist/css/blog.css +512 -0
  3. package/dist/css/chart.css +99 -0
  4. package/dist/css/compostrap.css +5052 -0
  5. package/dist/css/dashboard.css +360 -0
  6. package/dist/css/datagrid.css +64 -0
  7. package/dist/css/datepicker.css +514 -0
  8. package/dist/css/dialogs.css +185 -0
  9. package/dist/css/dropzone.css +86 -0
  10. package/dist/css/elements.css +181 -0
  11. package/dist/css/empty.css +94 -0
  12. package/dist/css/gallery.css +122 -0
  13. package/dist/css/lightbox.css +144 -0
  14. package/dist/css/number-input.css +100 -0
  15. package/dist/css/otp-input.css +177 -0
  16. package/dist/css/password-toggle.css +52 -0
  17. package/dist/css/rating.css +95 -0
  18. package/dist/css/selection.css +59 -0
  19. package/dist/css/settings.css +85 -0
  20. package/dist/css/shop.css +1026 -0
  21. package/dist/css/sidebar-menu.css +439 -0
  22. package/dist/css/sidebar.css +95 -0
  23. package/dist/css/spinner.css +102 -0
  24. package/dist/css/strength.css +118 -0
  25. package/dist/css/theme-switcher.css +5 -0
  26. package/dist/css/theme.css +13034 -0
  27. package/dist/css/tooltip.css +158 -0
  28. package/dist/js/chart.js +257 -0
  29. package/dist/js/datepicker.js +82 -0
  30. package/dist/js/dialogs.js +7 -0
  31. package/dist/js/dropzone.js +15 -0
  32. package/dist/js/index.js +24 -0
  33. package/dist/js/lightbox.js +77 -0
  34. package/dist/js/number-input.js +44 -0
  35. package/dist/js/otp-input.js +182 -0
  36. package/dist/js/password-toggle.js +16 -0
  37. package/dist/js/selection.js +32 -0
  38. package/dist/js/sidebar-menu.js +76 -0
  39. package/dist/js/sidebar.js +120 -0
  40. package/dist/js/spinner.js +27 -0
  41. package/dist/js/strength.js +87 -0
  42. package/dist/js/theme-switcher.js +98 -0
  43. package/dist/js/tooltip.js +17 -0
  44. package/docs/auth.md +25 -0
  45. package/docs/blog.md +85 -0
  46. package/docs/chart.md +39 -0
  47. package/docs/datagrid.md +64 -0
  48. package/docs/datepicker.md +35 -0
  49. package/docs/dialogs.md +81 -0
  50. package/docs/dropzone.md +23 -0
  51. package/docs/elements.md +38 -0
  52. package/docs/empty.md +25 -0
  53. package/docs/gallery.md +23 -0
  54. package/docs/layout.md +143 -0
  55. package/docs/lightbox.md +18 -0
  56. package/docs/number-input.md +19 -0
  57. package/docs/otp-input.md +52 -0
  58. package/docs/password-toggle.md +21 -0
  59. package/docs/rating.md +15 -0
  60. package/docs/selection.md +52 -0
  61. package/docs/settings.md +25 -0
  62. package/docs/shop.md +140 -0
  63. package/docs/spinner.md +51 -0
  64. package/docs/strength.md +26 -0
  65. package/docs/theme-switcher.md +60 -0
  66. package/docs/theme.md +100 -0
  67. package/docs/tooltip.md +30 -0
  68. package/license +21 -0
  69. package/package.json +106 -6
  70. package/readme.md +198 -0
  71. package/src/illustrations/empty.svg +15 -0
  72. package/src/illustrations/forbidden.svg +16 -0
  73. package/src/illustrations/maintenance.svg +14 -0
  74. package/src/illustrations/not-found.svg +22 -0
  75. package/src/illustrations/server-error.svg +21 -0
  76. package/src/js/chart.js +359 -0
  77. package/src/js/datepicker.js +154 -0
  78. package/src/js/dialogs.js +25 -0
  79. package/src/js/dropzone.js +35 -0
  80. package/src/js/index.js +29 -0
  81. package/src/js/lightbox.js +165 -0
  82. package/src/js/number-input.js +87 -0
  83. package/src/js/otp-input.js +401 -0
  84. package/src/js/password-toggle.js +45 -0
  85. package/src/js/selection.js +114 -0
  86. package/src/js/sidebar-menu.js +178 -0
  87. package/src/js/sidebar.js +326 -0
  88. package/src/js/spinner.js +76 -0
  89. package/src/js/strength.js +115 -0
  90. package/src/js/theme-switcher.js +197 -0
  91. package/src/js/tooltip.js +46 -0
  92. package/src/scss/_bootstrap.scss +9 -0
  93. package/src/scss/_variables.scss +58 -0
  94. package/src/scss/auth/_index.scss +210 -0
  95. package/src/scss/auth.scss +5 -0
  96. package/src/scss/blog/_article.scss +181 -0
  97. package/src/scss/blog/_comments.scss +108 -0
  98. package/src/scss/blog/_index.scss +18 -0
  99. package/src/scss/blog/_list.scss +246 -0
  100. package/src/scss/blog/_page.scss +138 -0
  101. package/src/scss/blog.scss +5 -0
  102. package/src/scss/chart/_index.scss +114 -0
  103. package/src/scss/chart.scss +5 -0
  104. package/src/scss/compostrap.scss +29 -0
  105. package/src/scss/dashboard/_content.scss +25 -0
  106. package/src/scss/dashboard/_dropdown.scss +71 -0
  107. package/src/scss/dashboard/_index.scss +9 -0
  108. package/src/scss/dashboard/_nanobar.scss +34 -0
  109. package/src/scss/dashboard/_navbar.scss +314 -0
  110. package/src/scss/dashboard/_theme.scss +27 -0
  111. package/src/scss/dashboard.scss +5 -0
  112. package/src/scss/datagrid/_index.scss +111 -0
  113. package/src/scss/datagrid.scss +5 -0
  114. package/src/scss/datepicker/_index.scss +557 -0
  115. package/src/scss/datepicker.scss +5 -0
  116. package/src/scss/dialogs/_index.scss +8 -0
  117. package/src/scss/dialogs/_modal.scss +82 -0
  118. package/src/scss/dialogs/_offcanvas.scss +13 -0
  119. package/src/scss/dialogs/_search.scss +79 -0
  120. package/src/scss/dialogs/_toast.scss +61 -0
  121. package/src/scss/dialogs.scss +5 -0
  122. package/src/scss/dropzone/_index.scss +111 -0
  123. package/src/scss/dropzone.scss +5 -0
  124. package/src/scss/elements/_datagrid-filter.scss +21 -0
  125. package/src/scss/elements/_index.scss +9 -0
  126. package/src/scss/elements/_list-row.scss +40 -0
  127. package/src/scss/elements/_loading.scss +47 -0
  128. package/src/scss/elements/_stat.scss +73 -0
  129. package/src/scss/elements/_status-dot.scss +38 -0
  130. package/src/scss/elements.scss +5 -0
  131. package/src/scss/empty/_index.scss +117 -0
  132. package/src/scss/empty.scss +5 -0
  133. package/src/scss/gallery/_index.scss +162 -0
  134. package/src/scss/gallery.scss +5 -0
  135. package/src/scss/lightbox/_index.scss +171 -0
  136. package/src/scss/lightbox.scss +5 -0
  137. package/src/scss/number-input/_index.scss +143 -0
  138. package/src/scss/number-input.scss +5 -0
  139. package/src/scss/otp-input/_index.scss +214 -0
  140. package/src/scss/otp-input.scss +5 -0
  141. package/src/scss/password-toggle/_index.scss +82 -0
  142. package/src/scss/password-toggle.scss +5 -0
  143. package/src/scss/rating/_index.scss +121 -0
  144. package/src/scss/rating.scss +5 -0
  145. package/src/scss/selection/_index.scss +84 -0
  146. package/src/scss/selection.scss +5 -0
  147. package/src/scss/settings/_index.scss +6 -0
  148. package/src/scss/settings/_nav-list.scss +52 -0
  149. package/src/scss/settings/_setting-row.scss +50 -0
  150. package/src/scss/settings.scss +5 -0
  151. package/src/scss/shop/_bar.scss +64 -0
  152. package/src/scss/shop/_catalog.scss +308 -0
  153. package/src/scss/shop/_checkout.scss +204 -0
  154. package/src/scss/shop/_filters.scss +116 -0
  155. package/src/scss/shop/_hero.scss +130 -0
  156. package/src/scss/shop/_index.scss +22 -0
  157. package/src/scss/shop/_page.scss +154 -0
  158. package/src/scss/shop/_reviews.scss +165 -0
  159. package/src/scss/shop/_stepper.scss +159 -0
  160. package/src/scss/shop.scss +5 -0
  161. package/src/scss/sidebar/_body.scss +8 -0
  162. package/src/scss/sidebar/_index.scss +8 -0
  163. package/src/scss/sidebar/_sidebar.scss +89 -0
  164. package/src/scss/sidebar/_theme.scss +7 -0
  165. package/src/scss/sidebar/_wrapper.scss +17 -0
  166. package/src/scss/sidebar-menu/_compact.scss +174 -0
  167. package/src/scss/sidebar-menu/_index.scss +9 -0
  168. package/src/scss/sidebar-menu/_list.scss +131 -0
  169. package/src/scss/sidebar-menu/_pills.scss +82 -0
  170. package/src/scss/sidebar-menu/_scrollbar.scss +53 -0
  171. package/src/scss/sidebar-menu/_theme.scss +109 -0
  172. package/src/scss/sidebar-menu.scss +5 -0
  173. package/src/scss/sidebar.scss +5 -0
  174. package/src/scss/spinner/_index.scss +130 -0
  175. package/src/scss/spinner.scss +5 -0
  176. package/src/scss/strength/_index.scss +118 -0
  177. package/src/scss/strength.scss +5 -0
  178. package/src/scss/theme/_accordion.scss +20 -0
  179. package/src/scss/theme/_alerts.scss +24 -0
  180. package/src/scss/theme/_avatar.scss +37 -0
  181. package/src/scss/theme/_badges.scss +53 -0
  182. package/src/scss/theme/_base.scss +9 -0
  183. package/src/scss/theme/_breadcrumb.scss +64 -0
  184. package/src/scss/theme/_buttons.scss +200 -0
  185. package/src/scss/theme/_cards.scss +17 -0
  186. package/src/scss/theme/_colors.scss +139 -0
  187. package/src/scss/theme/_forms.scss +175 -0
  188. package/src/scss/theme/_index.scss +18 -0
  189. package/src/scss/theme/_navs.scss +15 -0
  190. package/src/scss/theme/_overlays.scss +128 -0
  191. package/src/scss/theme/_tables.scss +59 -0
  192. package/src/scss/theme/_variables.scss +194 -0
  193. package/src/scss/theme-switcher/_index.scss +9 -0
  194. package/src/scss/theme-switcher.scss +5 -0
  195. package/src/scss/theme.scss +9 -0
  196. package/src/scss/tooltip/_index.scss +177 -0
  197. package/src/scss/tooltip.scss +5 -0
  198. package/README.md +0 -3
@@ -0,0 +1,214 @@
1
+ //
2
+ // otp input: a one-time code typed into separate slots, with the classes, attributes and variables of the OTP input
3
+ // of Bootstrap 6, so the markup stays when the package moves to it
4
+ //
5
+ // <div class="otp" data-bs-otp>
6
+ // <input type="text" class="otp-input" maxlength="6" aria-label="Verification code">
7
+ // </div>
8
+ //
9
+ // One real input holds the value. The script draws the slots (`.otp-slots` with an `.otp-slot` per character) and
10
+ // marks the wrapper `otp-rendered`; the input then lies over them, transparent, and takes every click and key.
11
+ // `otp-connected` joins the slots into one field, `otp-sm` and `otp-lg` size them, `is-valid` and `is-invalid` on the
12
+ // wrapper color them, `otp-fill` (not in Bootstrap 6) spreads the slots over the whole width. A slot has the look of
13
+ // a form control and the current one its focus.
14
+ //
15
+
16
+ @use '../bootstrap' as bs;
17
+
18
+ .otp {
19
+ --otp-size: 2.75rem;
20
+ --otp-font-size: 1.125rem;
21
+ --otp-gap: .5rem;
22
+ --otp-slot-fg: var(--bs-body-color);
23
+ --otp-slot-bg: var(--bs-body-bg);
24
+ --otp-slot-border-width: var(--bs-border-width);
25
+ --otp-slot-border-color: var(--bs-border-color);
26
+ --otp-slot-border-radius: var(--bs-border-radius);
27
+
28
+ position: relative;
29
+ display: flex;
30
+ min-height: var(--otp-size);
31
+ }
32
+
33
+ // before the script draws the slots the input is a plain field of their height, so the page does not jump
34
+ .otp-input {
35
+ min-width: 0;
36
+ height: var(--otp-size);
37
+ padding: 0 .75rem;
38
+ font-size: var(--otp-font-size);
39
+ font-weight: 500;
40
+ color: var(--otp-slot-fg);
41
+ letter-spacing: .5em;
42
+ background-color: var(--otp-slot-bg);
43
+ border: var(--otp-slot-border-width) solid var(--otp-slot-border-color);
44
+ border-radius: var(--otp-slot-border-radius);
45
+ }
46
+
47
+ .otp-rendered .otp-input {
48
+ position: absolute;
49
+ inset: 0;
50
+ width: 100%;
51
+ height: 100%;
52
+ padding: 0;
53
+ color: transparent;
54
+ cursor: default;
55
+ caret-color: transparent;
56
+ background-color: transparent;
57
+ border: 0;
58
+ outline: 0;
59
+ box-shadow: none;
60
+
61
+ // the characters under the slots never show, not even selected
62
+ &::selection {
63
+ color: transparent;
64
+ background-color: transparent;
65
+ }
66
+ }
67
+
68
+ // only drawn; the input over them handles the clicks. The slots shrink together when the row is too narrow.
69
+ .otp-slots {
70
+ display: inline-flex;
71
+ gap: var(--otp-gap);
72
+ min-width: 0;
73
+ max-width: 100%;
74
+ pointer-events: none;
75
+ }
76
+
77
+ .otp-slot {
78
+ display: flex;
79
+ flex: 0 1 var(--otp-size);
80
+ align-items: center;
81
+ justify-content: center;
82
+ width: var(--otp-size);
83
+ min-width: 0;
84
+ min-height: var(--otp-size);
85
+ font-size: var(--otp-font-size);
86
+ font-weight: 500;
87
+ font-variant-numeric: tabular-nums;
88
+ line-height: 1;
89
+ color: var(--otp-slot-fg);
90
+ user-select: none;
91
+ background-color: var(--otp-slot-bg);
92
+ border: var(--otp-slot-border-width) solid var(--otp-slot-border-color);
93
+ border-radius: var(--otp-slot-border-radius);
94
+ }
95
+
96
+ // the slot at the caret has the focus of a text field; an empty one shows a blinking caret
97
+ .otp-slot-active {
98
+ z-index: 1;
99
+ border-color: bs.$input-focus-border-color;
100
+ box-shadow: bs.$input-focus-box-shadow;
101
+
102
+ &:not(.otp-slot-filled)::after {
103
+ width: 1px;
104
+ height: 50%;
105
+ content: '';
106
+ background-color: var(--otp-slot-fg);
107
+ animation: otp-caret-blink 1s step-end infinite;
108
+ }
109
+ }
110
+
111
+ .otp-input:disabled ~ .otp-slots .otp-slot {
112
+ color: var(--bs-secondary-color);
113
+ background-color: bs.$input-disabled-bg;
114
+ }
115
+
116
+ // the states of the validation, on the wrapper (Bootstrap 6) or on the input (a form renderer)
117
+ .otp.is-valid,
118
+ .otp:has(> .otp-input.is-valid) {
119
+ --otp-slot-border-color: var(--bs-form-valid-border-color);
120
+ }
121
+
122
+ .otp.is-invalid,
123
+ .otp:has(> .otp-input.is-invalid) {
124
+ --otp-slot-border-color: var(--bs-form-invalid-border-color);
125
+ }
126
+
127
+ .otp:has(> .otp-input.is-invalid) ~ .invalid-feedback,
128
+ .otp:has(> .otp-input.is-valid) ~ .valid-feedback {
129
+ display: block;
130
+ }
131
+
132
+ // slots that share their borders, one field
133
+ .otp-connected .otp-slots {
134
+ gap: 0;
135
+ }
136
+
137
+ .otp-connected .otp-slot {
138
+ border-radius: 0;
139
+
140
+ &:not(:first-child) {
141
+ margin-inline-start: calc(var(--otp-slot-border-width) * -1);
142
+ }
143
+
144
+ &:first-child,
145
+ .otp-separator + & {
146
+ border-start-start-radius: var(--otp-slot-border-radius);
147
+ border-end-start-radius: var(--otp-slot-border-radius);
148
+ }
149
+
150
+ &:last-child,
151
+ &:has(+ .otp-separator) {
152
+ border-start-end-radius: var(--otp-slot-border-radius);
153
+ border-end-end-radius: var(--otp-slot-border-radius);
154
+ }
155
+
156
+ .otp-separator + & {
157
+ margin-inline-start: 0;
158
+ }
159
+ }
160
+
161
+ .otp-separator {
162
+ display: flex;
163
+ align-items: center;
164
+ padding-inline: var(--otp-gap);
165
+ font-size: var(--otp-font-size);
166
+ color: var(--bs-secondary-color);
167
+ user-select: none;
168
+ }
169
+
170
+ // the gaps of the separate slots already stand around a separator
171
+ .otp:not(.otp-connected) .otp-separator {
172
+ padding-inline: 0;
173
+ }
174
+
175
+ // own addition to Bootstrap 6: the slots share the whole width of the wrapper, like the other fields of a narrow form
176
+ .otp-fill .otp-slots {
177
+ display: flex;
178
+ flex: 1;
179
+ }
180
+
181
+ .otp-fill .otp-slot {
182
+ flex: 1 1 0;
183
+ width: auto;
184
+ }
185
+
186
+ .otp-sm {
187
+ --otp-size: 2.25rem;
188
+ --otp-font-size: 1rem;
189
+ --otp-gap: .375rem;
190
+ --otp-slot-border-radius: var(--bs-border-radius-sm);
191
+ }
192
+
193
+ .otp-lg {
194
+ --otp-size: 3.25rem;
195
+ --otp-font-size: 1.375rem;
196
+ --otp-slot-border-radius: var(--bs-border-radius-lg);
197
+ }
198
+
199
+ @keyframes otp-caret-blink {
200
+ 0%,
201
+ 100% {
202
+ opacity: 1;
203
+ }
204
+
205
+ 50% {
206
+ opacity: 0;
207
+ }
208
+ }
209
+
210
+ @media (prefers-reduced-motion: reduce) {
211
+ .otp-slot-active::after {
212
+ animation: none;
213
+ }
214
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // otp-input module of compostrap
3
+ //
4
+
5
+ @use 'otp-input/index';
@@ -0,0 +1,82 @@
1
+ //
2
+ // password-toggle: a button with an eye in a password input that shows the typed password and hides it again (the
3
+ // password toggle of drago-ex/form, without Naja)
4
+ //
5
+ // <div class="password-toggle">
6
+ // <input type="password" class="form-control" id="password">
7
+ // <button type="button" class="password-toggle-btn" data-password-toggle aria-label="Show password" aria-pressed="false"></button>
8
+ // </div>
9
+ //
10
+ // The script switches the type of the input between password and text; the icon follows the type (an eye for a
11
+ // hidden password, a crossed eye for a shown one). The button is shown only once the script runs (it sets
12
+ // data-password-toggle on <html>), so a page without JavaScript has no dead button. The icons are glyphs of the icon
13
+ // font ($icon-eye and $icon-eye-slash in _variables.scss, Bootstrap Icons by default) in the color of the text; drawn
14
+ // as masks they were blurred wherever the input stood between two pixels (a page centered in the window).
15
+ //
16
+
17
+ @use '../variables' as var;
18
+
19
+ .password-toggle {
20
+ --password-toggle-width: 2.5rem;
21
+ --password-toggle-icon: 1.125rem;
22
+
23
+ position: relative;
24
+
25
+ // the eye of Edge inside a password input would stand next to ours
26
+ input::-ms-reveal {
27
+ display: none;
28
+ }
29
+ }
30
+
31
+ .password-toggle-btn {
32
+ position: absolute;
33
+ top: 0;
34
+ right: 0;
35
+ display: none;
36
+ align-items: center;
37
+ justify-content: center;
38
+ width: var(--password-toggle-width);
39
+ height: 100%;
40
+ padding: 0;
41
+ color: var(--bs-secondary-color);
42
+ cursor: pointer;
43
+ background: none;
44
+ border: 0;
45
+ border-radius: var(--bs-border-radius);
46
+
47
+ &::before {
48
+ font-family: var.$icon-font, sans-serif;
49
+ font-size: var(--password-toggle-icon);
50
+ font-weight: var.$icon-font-weight;
51
+ line-height: 1;
52
+ content: var.$icon-eye;
53
+ -webkit-font-smoothing: antialiased;
54
+ }
55
+
56
+ &:hover {
57
+ color: var(--bs-body-color);
58
+ }
59
+
60
+ // the ring is only for the keyboard
61
+ &:focus-visible {
62
+ outline: 0;
63
+ box-shadow: inset 0 0 0 1px rgba(var(--bs-primary-rgb), .6);
64
+ }
65
+ }
66
+
67
+ // a shown password: the crossed eye
68
+ .password-toggle > input[type='text'] ~ .password-toggle-btn::before {
69
+ content: var.$icon-eye-slash;
70
+ }
71
+
72
+ :root[data-password-toggle] {
73
+ .password-toggle-btn {
74
+ display: flex;
75
+ }
76
+
77
+ // room for the button; the icon of a validation state of Bootstrap would lie under it
78
+ .password-toggle > .form-control {
79
+ padding-right: var(--password-toggle-width);
80
+ background-image: none;
81
+ }
82
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // password-toggle module of compostrap
3
+ //
4
+
5
+ @use 'password-toggle/index';
@@ -0,0 +1,121 @@
1
+ //
2
+ // rating: stars to choose a rating in a form (radio inputs, no JavaScript) or to show one (also halves)
3
+ //
4
+ // <div class="rating" role="radiogroup" aria-label="Rating">
5
+ // <input type="radio" class="rating-input" name="rating" id="rating-1" value="1">
6
+ // <label class="rating-star" for="rating-1"><span class="visually-hidden">1 star</span></label>
7
+ // …up to 5
8
+ // </div>
9
+ //
10
+ // <span class="rating-static" style="--rating-value: 4.5" role="img" aria-label="4.5 of 5"></span>
11
+ //
12
+ // The stars up to the checked one are filled; on hover they show the rating the click would give. rating-sm and
13
+ // rating-lg change the size (also of rating-static), --rating-color the color of the filled stars.
14
+ //
15
+
16
+ $-star: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M12 2.6l2.83 5.97 6.5.82-4.8 4.5 1.25 6.45L12 17.2l-5.78 3.14 1.25-6.45-4.8-4.5 6.5-.82z' stroke='black' stroke-width='1.5' stroke-linejoin='round'/%3e%3c/svg%3e");
17
+
18
+ :root {
19
+ --rating-color: #ffb800;
20
+ --rating-empty: color-mix(in srgb, var(--bs-body-color) 16%, var(--bs-body-bg));
21
+ }
22
+
23
+ .rating,
24
+ .rating-static {
25
+ --rating-size: 1.25rem;
26
+ --rating-gap: .125rem;
27
+ }
28
+
29
+ .rating {
30
+ display: inline-flex;
31
+ gap: var(--rating-gap);
32
+ align-items: center;
33
+ vertical-align: middle;
34
+ }
35
+
36
+ .rating-input {
37
+ position: absolute;
38
+ width: 1px;
39
+ height: 1px;
40
+ overflow: hidden;
41
+ clip-path: inset(50%);
42
+ white-space: nowrap;
43
+ }
44
+
45
+ .rating-star {
46
+ display: block;
47
+ width: var(--rating-size);
48
+ height: var(--rating-size);
49
+ margin: 0;
50
+ cursor: pointer;
51
+ background-color: var(--rating-empty);
52
+ border-radius: 2px;
53
+ mask: $-star no-repeat center / contain;
54
+ }
55
+
56
+ // the checked star and the stars before it
57
+ .rating-input:checked + .rating-star,
58
+ .rating-star:has(~ .rating-input:checked) {
59
+ background-color: var(--rating-color);
60
+ }
61
+
62
+ // on hover: the hovered star and the stars before it, nothing after it
63
+ .rating:not(:has(.rating-input:disabled)):has(.rating-star:hover) {
64
+ .rating-star {
65
+ background-color: var(--rating-empty);
66
+ }
67
+
68
+ .rating-star:hover,
69
+ .rating-star:has(~ .rating-star:hover) {
70
+ background-color: var(--rating-color);
71
+ }
72
+ }
73
+
74
+ // the focus ring of the keyboard around the star of the focused input (a mask would cut a box-shadow off)
75
+ .rating-input:focus-visible + .rating-star {
76
+ outline: var(--bs-focus-ring-width) solid var(--bs-focus-ring-color);
77
+ outline-offset: 2px;
78
+ mask: none;
79
+ background: none;
80
+ position: relative;
81
+
82
+ &::before {
83
+ position: absolute;
84
+ inset: 0;
85
+ content: '';
86
+ background-color: var(--rating-empty);
87
+ mask: $-star no-repeat center / contain;
88
+ }
89
+ }
90
+
91
+ .rating-input:focus-visible:checked + .rating-star::before,
92
+ .rating-star:has(~ .rating-input:checked) + .rating-input:focus-visible + .rating-star::before {
93
+ background-color: var(--rating-color);
94
+ }
95
+
96
+ .rating-input:disabled + .rating-star {
97
+ cursor: default;
98
+ }
99
+
100
+ // a rating shown only: five stars filled to --rating-value (0 to 5, halves and tenths too)
101
+ .rating-static {
102
+ --rating-value: 0;
103
+
104
+ display: inline-block;
105
+ width: calc(5 * var(--rating-size) + 4 * var(--rating-gap));
106
+ height: var(--rating-size);
107
+ vertical-align: middle;
108
+ background: linear-gradient(90deg, var(--rating-color) calc(var(--rating-value) / 5 * 100%), var(--rating-empty) 0);
109
+ mask: $-star repeat-x left center / calc(var(--rating-size) + var(--rating-gap)) var(--rating-size);
110
+ mask-size: var(--rating-size) var(--rating-size);
111
+ mask-repeat: space no-repeat;
112
+ }
113
+
114
+ .rating-sm {
115
+ --rating-size: 1rem;
116
+ }
117
+
118
+ .rating-lg {
119
+ --rating-size: 1.75rem;
120
+ --rating-gap: .25rem;
121
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // rating module of compostrap
3
+ //
4
+
5
+ @use 'rating/index';
@@ -0,0 +1,84 @@
1
+ //
2
+ // selection: rows of a table chosen by checkboxes and a bar with the actions for them (the bulk actions of a datagrid)
3
+ //
4
+ // <div data-selection>
5
+ // <table class="table">
6
+ // <thead><tr><th class="selection-cell"><input type="checkbox" class="form-check-input" data-selection-all aria-label="Select all"></th>…</tr></thead>
7
+ // <tbody><tr><td class="selection-cell"><input type="checkbox" class="form-check-input" data-selection-item name="ids[]" value="1" aria-label="Select the row"></td>…</tr></tbody>
8
+ // </table>
9
+ // <div class="selection-bar" data-selection-bar hidden>
10
+ // <span class="selection-count"><strong data-selection-count>0</strong> selected</span>
11
+ // <div class="selection-actions"><button type="submit" class="btn btn-sm btn-secondary">Publish</button>…</div>
12
+ // <button type="button" class="btn-close" data-selection-clear aria-label="Clear the selection"></button>
13
+ // </div>
14
+ // </div>
15
+ //
16
+
17
+ :root {
18
+ --selection-bar-bg: var(--bs-body-bg);
19
+ --selection-bar-box-shadow: var(--bs-box-shadow-lg);
20
+ --selection-bar-border-radius: var(--bs-border-radius-lg);
21
+ --selection-bar-offset: 1rem;
22
+ }
23
+
24
+ // in the dark theme a shadow is not seen, the bar gets a lighter surface like the dropdowns
25
+ [data-bs-theme='dark'] {
26
+ --selection-bar-bg: var(--bs-secondary-bg);
27
+ }
28
+
29
+ // the column of the checkboxes: as narrow as the checkbox, which stands in the middle of the row
30
+ .selection-cell {
31
+ width: 1%;
32
+ white-space: nowrap;
33
+ vertical-align: middle;
34
+
35
+ .form-check-input {
36
+ display: block;
37
+ margin: 0;
38
+ }
39
+ }
40
+
41
+ // a click anywhere on a row chooses it (data-selection-rows on the wrapper)
42
+ [data-selection-rows] tbody tr {
43
+ cursor: pointer;
44
+ }
45
+
46
+ // the bar floats over the bottom of its table while the table is on the screen (it stays in the box, so it never
47
+ // covers another part of the page); it is as wide as its content and wraps on a phone
48
+ .selection-bar {
49
+ position: sticky;
50
+ bottom: var(--selection-bar-offset);
51
+ z-index: 3;
52
+ display: flex;
53
+ flex-wrap: wrap;
54
+ gap: .5rem 1rem;
55
+ align-items: center;
56
+ width: fit-content;
57
+ max-width: 100%;
58
+ padding: .5rem .75rem .5rem 1rem;
59
+ margin: 1rem auto;
60
+ background-color: var(--selection-bar-bg);
61
+ border-radius: var(--selection-bar-border-radius);
62
+ box-shadow: var(--selection-bar-box-shadow);
63
+
64
+ // display: flex would show a bar that is hidden until a row is chosen
65
+ &[hidden] {
66
+ display: none;
67
+ }
68
+ }
69
+
70
+ .selection-count {
71
+ white-space: nowrap;
72
+ color: var(--bs-secondary-color);
73
+
74
+ strong {
75
+ color: var(--bs-body-color);
76
+ }
77
+ }
78
+
79
+ .selection-actions {
80
+ display: flex;
81
+ flex-wrap: wrap;
82
+ gap: .5rem;
83
+ align-items: center;
84
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // selection module of compostrap
3
+ //
4
+
5
+ @use 'selection/index';
@@ -0,0 +1,6 @@
1
+ //
2
+ // settings: a list of the sections of a page and rows of settings with their controls (e.g. the permissions of a role)
3
+ //
4
+
5
+ @use 'nav-list';
6
+ @use 'setting-row';
@@ -0,0 +1,52 @@
1
+ // a vertical list of links with a count on the right, the current one in a pill (sections of a page, such as the
2
+ // presenters on the permissions page)
3
+ // <nav class="nav-list"> (`nav-list nav-list-box` in a box) <a class="nav-list-link active" aria-current="true" href="...">Blog<span class="nav-list-count">3/5</span></a></nav>
4
+ .nav-list {
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: .125rem;
8
+ }
9
+
10
+ .nav-list-link {
11
+ display: flex;
12
+ gap: .5rem;
13
+ align-items: center;
14
+ justify-content: space-between;
15
+ padding: .375rem .625rem;
16
+ color: var(--bs-secondary-color);
17
+ text-decoration: none;
18
+ border-radius: var(--bs-border-radius);
19
+
20
+ // like the menu: hover shows the pill of the current link
21
+ &:hover,
22
+ &.active {
23
+ color: var(--bs-emphasis-color);
24
+ text-decoration: none;
25
+ background-color: var(--ds-body-bg, var(--bs-tertiary-bg));
26
+ }
27
+
28
+ &.active {
29
+ font-weight: 500;
30
+ }
31
+ }
32
+
33
+ // the list in a box of the section color (like the cards of a form in an offcanvas), the current link in the plain
34
+ // surface color, no shadow or border
35
+ .nav-list-box {
36
+ padding: .375rem;
37
+ background-color: var(--bs-tertiary-bg);
38
+ border-radius: var(--bs-border-radius-lg);
39
+
40
+ .nav-list-link:hover,
41
+ .nav-list-link.active {
42
+ background-color: var(--bs-body-bg);
43
+ }
44
+ }
45
+
46
+ .nav-list-count {
47
+ flex-shrink: 0;
48
+ font-size: 1em;
49
+ font-weight: 400;
50
+ font-variant-numeric: tabular-nums;
51
+ color: var(--bs-secondary-color);
52
+ }
@@ -0,0 +1,50 @@
1
+ // a row of settings: text on the left, a control (switch, button) on the right, hover like a list row
2
+ // <div class="setting-row"><div class="setting-row-text">...</div><div class="setting-row-control">switch</div></div>
3
+ // The control has a fixed least width, so the texts of all rows line up even when the labels of the controls differ.
4
+ .setting-row {
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+ gap: .5rem 1rem;
8
+ align-items: center;
9
+ padding: .5rem .75rem;
10
+ margin-inline: -.75rem;
11
+ border-radius: var(--bs-border-radius);
12
+
13
+ &:hover {
14
+ background-color: rgba(var(--bs-body-color-rgb), .04);
15
+ }
16
+
17
+ + .setting-row {
18
+ margin-top: .125rem;
19
+ }
20
+ }
21
+
22
+ .setting-row-text {
23
+ flex: 1 1 16rem;
24
+ min-width: 0;
25
+ }
26
+
27
+ // a list of setting rows keeps a readable width, so on a wide screen the controls stay near their texts
28
+ .setting-list {
29
+ max-width: var(--setting-list-max-width, 60rem);
30
+ }
31
+
32
+ // a setting that cannot be changed here (inherited, set elsewhere): a lock and a short text in the body color
33
+ .setting-row-locked {
34
+ display: inline-flex;
35
+ gap: .375rem;
36
+ align-items: center;
37
+ font-size: .875rem;
38
+ color: var(--bs-body-color);
39
+ cursor: default;
40
+
41
+ > .bi {
42
+ color: var(--bs-secondary-color);
43
+ }
44
+ }
45
+
46
+ .setting-row-control {
47
+ flex-shrink: 0;
48
+ min-width: var(--setting-row-control-width, 7rem);
49
+ margin-bottom: 0;
50
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // settings module of compostrap
3
+ //
4
+
5
+ @use 'settings/index';