compostrap 0.0.0-stage → 1.0.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 (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 +5047 -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 +140 -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 +438 -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 +13006 -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 +164 -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 +173 -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 +114 -0
  191. package/src/scss/theme/_tables.scss +59 -0
  192. package/src/scss/theme/_variables.scss +189 -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,189 @@
1
+ //
2
+ // theme: Bootstrap variables in the look of Bootstrap 6 (neutral grays, 14px text, quieter shadows and controls)
3
+ //
4
+ // Loaded before Bootstrap by @import, so every component of Bootstrap is built with them. All values are !default:
5
+ // a project can set its own before this file.
6
+ //
7
+
8
+ // neutral grays without the blue tint of Bootstrap
9
+ $gray-100: #f5f5f5 !default;
10
+ $gray-200: #e5e5e5 !default;
11
+ $gray-300: #d4d4d4 !default;
12
+ $gray-400: #a3a3a3 !default;
13
+ $gray-500: #737373 !default;
14
+ $gray-600: #525252 !default;
15
+ $gray-700: #404040 !default;
16
+ $gray-800: #262626 !default;
17
+ $gray-900: #171717 !default;
18
+
19
+ // colors of Bootstrap 6 (its oklch values converted to hex): a lighter, clearer blue and livelier status colors
20
+ $blue: #0089d7 !default;
21
+ $indigo: #7740ff !default;
22
+ $purple: #ae29c9 !default;
23
+ $pink: #e12871 !default;
24
+ $red: #e62845 !default;
25
+ $orange: #fb6f00 !default;
26
+ $yellow: #ffce00 !default;
27
+ $green: #00aa67 !default;
28
+ $teal: #00b2ab !default;
29
+ $cyan: #00afd9 !default;
30
+
31
+ // green as a text on a light surface (.text-success, the text of a valid field): the green darkened by 16 % in oklch,
32
+ // the least that reads 4.5:1 on white (the green itself has 3:1); the dark theme keeps the green
33
+ $success-text: #00874f !default;
34
+ $form-valid-color: $success-text !default;
35
+
36
+ // white text on blue, green, red and orange like in Bootstrap 6, dark text on yellow and cyan
37
+ $min-contrast-ratio: 2.7 !default;
38
+
39
+ // body: dark gray text, the page background just off white (the dashboard uses the tertiary background)
40
+ $body-color: $gray-800 !default;
41
+ $body-tertiary-bg: #fafafa !default;
42
+ $border-color: $gray-200 !default;
43
+
44
+ // typography: 14px text with 20px lines; headings semibold in a compact scale (h5 stays readable, it heads pages
45
+ // and boxes in administrations)
46
+ $font-size-base: .875rem !default;
47
+ $line-height-base: 1.4285714286 !default;
48
+ $headings-font-weight: 600 !default;
49
+ // small text (small, .small, form texts, feedback, the footer of a quote) in the size of the text: nothing readable is
50
+ // under 14px unless it is a -sm size, a badge or an uppercase label
51
+ $small-font-size: 1em !default;
52
+ // the footer of a quote in the secondary color of the theme: the fixed gray of Bootstrap was 2.3:1 on the dark surface
53
+ $blockquote-footer-color: var(--bs-secondary-color) !default;
54
+ $h1-font-size: 1.75rem !default;
55
+ $h2-font-size: 1.5rem !default;
56
+ $h3-font-size: 1.3125rem !default;
57
+ $h4-font-size: 1.1875rem !default;
58
+ $h5-font-size: 1.125rem !default;
59
+ $h6-font-size: .875rem !default;
60
+ $link-decoration: none !default;
61
+ $link-hover-decoration: underline !default;
62
+
63
+ // shadows: hardly visible, they only lift a surface from the page; the small one is the soft shadow of compostrap
64
+ // ($soft-shadow), which boxes and cards use instead of a border
65
+ $box-shadow-sm: none !default; // as $soft-shadow of the modules: no shadow for now
66
+
67
+ // a faint line around a card, as $surface-border of the modules: none for now
68
+ $surface-border: none !default;
69
+ $box-shadow: 0 2px 4px -1px rgba(18, 18, 23, .06), 0 4px 6px -1px rgba(18, 18, 23, .08) !default;
70
+ $box-shadow-lg: 0 4px 6px -2px rgba(18, 18, 23, .05), 0 10px 15px -3px rgba(18, 18, 23, .08) !default;
71
+
72
+ // buttons and form controls share one scale: 36px, small 30px, large 44px; buttons are medium
73
+ $input-btn-padding-y: .4375rem !default;
74
+ $input-btn-padding-x: .75rem !default;
75
+ $input-btn-padding-y-sm: .3125rem !default;
76
+ $input-btn-padding-x-sm: .625rem !default;
77
+ $input-btn-padding-y-lg: .5625rem !default;
78
+ $input-btn-padding-x-lg: 1.25rem !default;
79
+ $btn-font-weight: 500 !default;
80
+
81
+ // focus: no wide glow, the border turns into the primary color (tinted by 50 %) with a 1px ring of it around, so
82
+ // together a clean 2px line; buttons and checks get the same thin ring
83
+ $focus-ring-width: 1px !default;
84
+ $focus-ring-opacity: .6 !default;
85
+ // a text field and a select show their focus by the tinted border only, without the ring around it
86
+ $input-focus-box-shadow: none !default;
87
+ $form-select-focus-box-shadow: none !default;
88
+ $form-label-font-weight: 500 !default;
89
+ $form-label-margin-bottom: .375rem !default;
90
+
91
+ // checks, radios and switches of the size of Bootstrap 6: 20px boxes as high as a line of text, a 35 × 20px switch
92
+ // with a white knob on a gray track (the track color is in theme/_index.scss)
93
+ $form-check-input-width: 1.25rem !default;
94
+ $form-check-padding-start: 1.75rem !default;
95
+ $form-check-input-border-radius: .3125rem !default;
96
+ $form-check-input-checked-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='#fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5.5 10 3 3 6-6'/></svg>") !default;
97
+ $form-check-input-indeterminate-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='#fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 10h8'/></svg>") !default;
98
+ $form-switch-width: 2.1875rem !default;
99
+ $form-switch-padding-start: 2.6875rem !default;
100
+ $form-switch-color: #fff !default;
101
+ $form-switch-focus-color: #fff !default;
102
+ $form-switch-color-dark: #fff !default;
103
+ $form-switch-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3.2' fill='#fff'/></svg>") !default;
104
+ $form-switch-focus-bg-image: $form-switch-bg-image !default;
105
+ $form-switch-checked-bg-image: $form-switch-bg-image !default;
106
+ $form-switch-bg-image-dark: $form-switch-bg-image !default;
107
+
108
+ // cards: no border (the soft shadow lifts them), a larger radius, a calm header
109
+ $card-border-width: 0 !default;
110
+ $card-border-radius: .5rem !default;
111
+ $card-spacer-y: 1.25rem !default;
112
+ $card-spacer-x: 1.25rem !default;
113
+ $card-cap-padding-y: 1rem !default;
114
+ $card-cap-bg: transparent !default;
115
+
116
+ // dropdowns: no border (the shadow lifts them), a faint divider, the chosen item (e.g. the current language) is tinted, not filled with the primary color
117
+ $dropdown-border-width: 0 !default;
118
+ $dropdown-divider-bg: rgba(var(--bs-body-color-rgb), .08) !default;
119
+ $dropdown-link-active-color: var(--bs-body-color) !default;
120
+ $dropdown-link-active-bg: rgba(var(--bs-primary-rgb), .1) !default;
121
+
122
+ // toasts in the look of the modals: no border, an opaque surface, larger corners and the large shadow
123
+ $toast-padding-x: 1rem !default;
124
+ $toast-padding-y: .75rem !default;
125
+ $toast-background-color: var(--bs-body-bg) !default;
126
+ $toast-border-width: 0 !default;
127
+ $toast-border-radius: var(--bs-border-radius-lg) !default;
128
+ $toast-box-shadow: var(--bs-box-shadow-lg) !default;
129
+ $toast-header-background-color: transparent !default;
130
+
131
+ // accordion like in Bootstrap 6: the open item is a light gray (half the border color on the surface, so it sits with
132
+ // the lines in both themes), its text and arrow stay in the body color, the arrow is a thin chevron
133
+ $accordion-button-active-bg: color-mix(in srgb, var(--bs-border-color) 50%, var(--bs-body-bg)) !default;
134
+ $accordion-button-active-color: var(--bs-body-color) !default;
135
+ $accordion-icon-color: $body-color !default;
136
+ $accordion-icon-active-color: $body-color !default;
137
+ $accordion-icon-width: 1rem !default;
138
+ $accordion-button-icon-dark: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='#{$gray-300}' stroke-linecap='round' stroke-linejoin='round'><path d='m2 5 6 6 6-6'/></svg>") !default;
139
+ $accordion-button-active-icon-dark: $accordion-button-icon-dark !default;
140
+
141
+ // modals: no border around the window and under the header, a light line above the footer
142
+ $modal-content-border-width: 0 !default;
143
+ $modal-header-border-width: 0 !default;
144
+ $modal-footer-border-width: 1px !default;
145
+ $modal-footer-border-color: var(--bs-border-color-translucent) !default;
146
+
147
+ // tables: more air in the rows, also in the small table of a datagrid; a quiet hover
148
+ $table-cell-padding-y: .625rem !default;
149
+ $table-cell-padding-x: .75rem !default;
150
+ $table-cell-padding-y-sm: .5rem !default;
151
+ $table-cell-padding-x-sm: .625rem !default;
152
+ // (.035 was too strong for the user)
153
+ $table-hover-bg-factor: .02 !default;
154
+ $table-active-bg-factor: .04 !default;
155
+
156
+ // pagination: separate rounded buttons without borders, the current page in the primary color
157
+ $pagination-border-width: 0 !default;
158
+ $pagination-margin-start: .25rem !default;
159
+ $pagination-color: var(--bs-body-color) !default;
160
+ $pagination-bg: transparent !default;
161
+ $pagination-hover-color: var(--bs-body-color) !default;
162
+ $pagination-hover-bg: var(--bs-secondary-bg) !default;
163
+ $pagination-focus-bg: var(--bs-secondary-bg) !default;
164
+ // no ring around the focused page: the tint of the focus background shows it (a ring looked like a border)
165
+ $pagination-focus-box-shadow: none !default;
166
+ $pagination-disabled-color: var(--bs-tertiary-color) !default;
167
+ $pagination-disabled-bg: transparent !default;
168
+ $pagination-padding-x-sm: .625rem !default;
169
+
170
+ // badges like in Bootstrap 6: semibold, at least 22px high (the rest is in theme/_index.scss); the corners stay those
171
+ // of Bootstrap 5
172
+ $badge-font-size: .75rem !default; // 12px, the least of Bootstrap 6
173
+ $badge-font-weight: 600 !default;
174
+ $badge-padding-y: .25em !default;
175
+ $badge-padding-x: .625em !default;
176
+
177
+ // navs like in Bootstrap 6: gray links that darken on hover, a light background on hover; a hovered tab gets only a
178
+ // faint frame (the full frame of Bootstrap 5 stuck to the frame of the active tab), tabs keep a 2px gap (theme/_index)
179
+ $nav-link-color: var(--bs-secondary-color) !default;
180
+ $nav-link-hover-color: var(--bs-emphasis-color) !default;
181
+ $nav-link-disabled-color: var(--bs-tertiary-color) !default;
182
+ $nav-tabs-link-active-color: var(--bs-body-color) !default;
183
+ $nav-tabs-link-hover-border-color: color-mix(in srgb, var(--bs-border-color) 50%, transparent) color-mix(in srgb, var(--bs-border-color) 50%, transparent) var(--bs-border-color) !default;
184
+
185
+ // no animation on hover anywhere: buttons, nav links and pages change their colors at once
186
+ $btn-transition: none !default;
187
+ $nav-link-transition: none !default;
188
+ $pagination-transition: none !default;
189
+ $accordion-transition: border-radius .15s ease !default;
@@ -0,0 +1,9 @@
1
+ //
2
+ // theme switcher
3
+ //
4
+
5
+ .theme-switcher {
6
+ display: inline-flex;
7
+ align-items: center;
8
+ gap: 0.35rem;
9
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // theme-switcher module of compostrap
3
+ //
4
+
5
+ @use 'theme-switcher/index';
@@ -0,0 +1,9 @@
1
+ //
2
+ // theme module of compostrap: Bootstrap built with the theme variables, then the theme additions
3
+ //
4
+ // Use it instead of `@import 'bootstrap/scss/bootstrap'`; set own variables before it.
5
+ //
6
+
7
+ @import 'theme/variables';
8
+ @import 'bootstrap/scss/bootstrap';
9
+ @import 'theme/index';
@@ -0,0 +1,177 @@
1
+ //
2
+ // Tooltip of pure CSS, for buttons with an icon only: the text of aria-label shown on hover and keyboard focus,
3
+ // dark on a light page and light on a dark one (also for outline buttons, which have no background of their own),
4
+ // so it needs no JavaScript and survives Naja snippets (the optional script CssTooltip only adds Esc, which hides
5
+ // the shown tooltip).
6
+ // <a class="btn btn-sm btn-danger" aria-label="Delete" data-tooltip><i class="bi bi-trash"></i></a>
7
+ // data-tooltip="left" shows it on the left, e.g. at the right edge of a table, data-tooltip="end" above but aligned to
8
+ // the right edge, data-tooltip="bottom" under the element, e.g. in a navbar; data-tooltip-color="success" (any theme color of Bootstrap) colors it, with dark text on the light
9
+ // colors.
10
+ //
11
+
12
+ @use '../bootstrap' as bs;
13
+
14
+ // the default tooltip: a dark gray with white text in the light theme (the gray of the gray navbar, softer than the
15
+ // black of the text), the light text color with dark text in the dark theme, where a dark gray would sink into the page
16
+ :root,
17
+ [data-bs-theme='light'] {
18
+ --cs-tooltip-default-bg: #{bs.$gray-600};
19
+ --cs-tooltip-default-color: #fff;
20
+ }
21
+
22
+ [data-bs-theme='dark'] {
23
+ --cs-tooltip-default-bg: var(--bs-emphasis-color);
24
+ --cs-tooltip-default-color: var(--bs-body-bg);
25
+ }
26
+
27
+ // The tooltip exists only while it is shown: a hidden one (opacity 0) would still widen the scroll area of its
28
+ // container, e.g. a table-responsive with buttons in the last column would get a horizontal scrollbar. So it is
29
+ // created on hover or focus and fades in by an animation.
30
+ [data-tooltip] {
31
+ position: relative;
32
+
33
+ &::after {
34
+ position: absolute;
35
+ bottom: calc(100% + .375rem);
36
+ left: 50%;
37
+ z-index: 1080;
38
+ padding: .25rem .5rem;
39
+ border-radius: var(--bs-border-radius-sm);
40
+ background-color: var(--cs-tooltip-bg, var(--cs-tooltip-default-bg));
41
+ color: var(--cs-tooltip-color, var(--cs-tooltip-default-color));
42
+ font-size: .75rem;
43
+ font-weight: 400;
44
+ line-height: 1.2;
45
+ // its own text also where the element stands in uppercase or spaced text (a table head, a menu section)
46
+ text-transform: none;
47
+ letter-spacing: normal;
48
+ white-space: nowrap;
49
+ pointer-events: none;
50
+ transform: translate(-50%, 0);
51
+ animation: cs-tooltip-up .15s ease-out;
52
+ }
53
+
54
+ &:hover::after,
55
+ &:focus-visible::after {
56
+ content: attr(aria-label);
57
+ // the text is the aria-label of the element already: the empty alternative keeps a screen reader from
58
+ // reading it twice (a browser without this syntax keeps the line above)
59
+ content: attr(aria-label) / '';
60
+ }
61
+
62
+ // a button whose dropdown is open shows the dropdown, not its tooltip over it
63
+ &[aria-expanded='true']::after {
64
+ content: none;
65
+ }
66
+
67
+ // hidden by Esc (the script CssTooltip) until the mouse and the focus leave the element
68
+ &[data-tooltip-hidden]::after {
69
+ content: none;
70
+ }
71
+ }
72
+
73
+ [data-tooltip='left'] {
74
+ &::after {
75
+ top: 50%;
76
+ bottom: auto;
77
+ left: auto;
78
+ right: calc(100% + .375rem);
79
+ transform: translate(0, -50%);
80
+ animation-name: cs-tooltip-left;
81
+ }
82
+ }
83
+
84
+ // above the element, aligned to its right edge, so it does not reach out of its container (a button at the right
85
+ // edge of a card or an offcanvas)
86
+ [data-tooltip='end'] {
87
+ &::after {
88
+ right: 0;
89
+ left: auto;
90
+ transform: none;
91
+ animation-name: cs-tooltip-up-end;
92
+ }
93
+ }
94
+
95
+ // above the element, aligned to its left edge, so a wide tooltip of an element near the left edge of its container
96
+ // grows to the right
97
+ [data-tooltip='start'] {
98
+ &::after {
99
+ left: 0;
100
+ transform: none;
101
+ animation-name: cs-tooltip-up-end;
102
+ }
103
+ }
104
+
105
+ // a long text (e.g. a list): it wraps within a width instead of running out of the window, keeps the line breaks
106
+ // of its aria-label (one item per line) and is aligned to the left
107
+ [data-tooltip-wrap]::after {
108
+ width: max-content;
109
+ max-width: min(22rem, calc(100vw - 2rem));
110
+ white-space: pre-line;
111
+ overflow-wrap: anywhere;
112
+ text-align: start;
113
+ }
114
+
115
+ // under the element, e.g. in a navbar at the top of the window
116
+ [data-tooltip='bottom'] {
117
+ &::after {
118
+ top: calc(100% + .375rem);
119
+ bottom: auto;
120
+ animation-name: cs-tooltip-down;
121
+ }
122
+ }
123
+
124
+ @keyframes cs-tooltip-up {
125
+ from {
126
+ opacity: 0;
127
+ transform: translate(-50%, .25rem);
128
+ }
129
+ }
130
+
131
+ @keyframes cs-tooltip-up-end {
132
+ from {
133
+ opacity: 0;
134
+ transform: translateY(.25rem);
135
+ }
136
+ }
137
+
138
+ @keyframes cs-tooltip-down {
139
+ from {
140
+ opacity: 0;
141
+ transform: translate(-50%, -.25rem);
142
+ }
143
+ }
144
+
145
+ @keyframes cs-tooltip-left {
146
+ from {
147
+ opacity: 0;
148
+ transform: translate(-.25rem, -50%);
149
+ }
150
+ }
151
+
152
+ // colored tooltips: the color of Bootstrap at run time, the text color chosen for it when the styles are built
153
+ @each $name, $value in bs.$theme-colors {
154
+ [data-tooltip-color='#{$name}'] {
155
+ --cs-tooltip-bg: var(--bs-#{$name});
156
+ --cs-tooltip-color: #{bs.color-contrast($value)};
157
+ }
158
+ }
159
+
160
+ // info has white text like the info buttons and badges of the theme (the dark text of Bootstrap was too heavy on
161
+ // cyan), on the cyan darkened by 14 % as there, so the white reads
162
+ [data-tooltip-color='info'] {
163
+ --cs-tooltip-bg: color-mix(in oklch, var(--bs-info) 86%, #000);
164
+ --cs-tooltip-color: #fff;
165
+ }
166
+
167
+ // warning has the brown text of the solid warning button of the theme (the yellow mixed with 54 % black, see
168
+ // $theme-contrast-weights in theme/_colors.scss), not the near black of Bootstrap
169
+ [data-tooltip-color='warning'] {
170
+ --cs-tooltip-color: color-mix(in oklch, var(--bs-warning), #000 54%);
171
+ }
172
+
173
+ @media (prefers-reduced-motion: reduce) {
174
+ [data-tooltip]::after {
175
+ animation: none;
176
+ }
177
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // tooltip module of compostrap
3
+ //
4
+
5
+ @use 'tooltip/index';
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.