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
package/package.json CHANGED
@@ -1,6 +1,106 @@
1
- {
2
- "name": "compostrap",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "compostrap",
3
+ "version": "1.0.1",
4
+ "description": "Bootstrap 5 for administrations and websites: a theme with the look and classes of Bootstrap 6, a layout with a sidebar, a multi-level menu and a navbar, and components Bootstrap does not have (datepicker, charts, gallery, lightbox, dropzone, sign-in pages, shop, blog).",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "Zdeněk Papučík",
8
+ "homepage": "https://github.com/compostrap/compostrap",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/compostrap/compostrap.git"
12
+ },
13
+ "keywords": [
14
+ "bootstrap",
15
+ "bootstrap5",
16
+ "theme",
17
+ "admin",
18
+ "dashboard",
19
+ "sidebar",
20
+ "menu",
21
+ "dark-mode",
22
+ "theme-switcher",
23
+ "scss",
24
+ "datepicker",
25
+ "charts",
26
+ "gallery",
27
+ "lightbox",
28
+ "dropzone",
29
+ "datagrid",
30
+ "e-commerce",
31
+ "blog"
32
+ ],
33
+ "files": [
34
+ "dist",
35
+ "src",
36
+ "docs"
37
+ ],
38
+ "sideEffects": [
39
+ "*.css",
40
+ "*.scss"
41
+ ],
42
+ "exports": {
43
+ ".": "./dist/js/index.js",
44
+ "./sidebar": "./dist/js/sidebar.js",
45
+ "./sidebar-menu": "./dist/js/sidebar-menu.js",
46
+ "./theme-switcher": "./dist/js/theme-switcher.js",
47
+ "./tooltip": "./dist/js/tooltip.js",
48
+ "./dropzone": "./dist/js/dropzone.js",
49
+ "./lightbox": "./dist/js/lightbox.js",
50
+ "./strength": "./dist/js/strength.js",
51
+ "./password-toggle": "./dist/js/password-toggle.js",
52
+ "./number-input": "./dist/js/number-input.js",
53
+ "./otp-input": "./dist/js/otp-input.js",
54
+ "./selection": "./dist/js/selection.js",
55
+ "./datepicker": "./dist/js/datepicker.js",
56
+ "./chart": "./dist/js/chart.js",
57
+ "./spinner": "./dist/js/spinner.js",
58
+ "./dialogs": "./dist/js/dialogs.js",
59
+ "./css/*": "./dist/css/*",
60
+ "./src/scss/*": "./src/scss/*",
61
+ "./illustrations/*": "./src/illustrations/*"
62
+ },
63
+ "peerDependencies": {
64
+ "bootstrap": "^5.3.0",
65
+ "bootstrap-icons": "^1.11.0",
66
+ "chart.js": "^4.6.0",
67
+ "nanobar": "^0.4.2",
68
+ "perfect-scrollbar": "^1.5.6",
69
+ "vanilla-calendar-pro": "^3.4.0"
70
+ },
71
+ "peerDependenciesMeta": {
72
+ "bootstrap-icons": {
73
+ "optional": true
74
+ },
75
+ "nanobar": {
76
+ "optional": true
77
+ },
78
+ "perfect-scrollbar": {
79
+ "optional": true
80
+ },
81
+ "vanilla-calendar-pro": {
82
+ "optional": true
83
+ },
84
+ "chart.js": {
85
+ "optional": true
86
+ }
87
+ },
88
+ "devDependencies": {
89
+ "@playwright/test": "^1.65.0",
90
+ "bootstrap": "^5.3.8",
91
+ "bootstrap-icons": "^1.13.2",
92
+ "chart.js": "^4.6.1",
93
+ "nanobar": "^0.4.2",
94
+ "perfect-scrollbar": "^1.5.6",
95
+ "sass": "^1.97.1",
96
+ "vanilla-calendar-pro": "^3.4.0",
97
+ "vite": "^8.0.16"
98
+ },
99
+ "scripts": {
100
+ "dev": "npm run demo && vite",
101
+ "build": "vite build && node scripts/build-css.js",
102
+ "demo": "node scripts/build-demo.js",
103
+ "test": "playwright test",
104
+ "prepublishOnly": "npm run build"
105
+ }
106
+ }
package/readme.md ADDED
@@ -0,0 +1,198 @@
1
+ ## Compostrap
2
+
3
+ Bootstrap 5 for administrations and websites in one package: a theme with the look, colors and classes of Bootstrap 6, a layout with a sidebar, a multi-level menu and a navbar, and components that Bootstrap does not have (gallery, dropzone, lightbox, password strength, empty states, sign-in pages…). Every part is a module that can be used alone, or all of them together.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/compostrap/compostrap/blob/main/license)
6
+ [![npm version](https://badge.fury.io/js/compostrap.svg)](https://badge.fury.io/js/compostrap)
7
+ [![Build status](https://github.com/compostrap/compostrap/actions/workflows/build.yml/badge.svg)](https://github.com/compostrap/compostrap/actions/workflows/build.yml)
8
+
9
+ ## Contents
10
+
11
+ - [Requirements](#requirements)
12
+ - [Installation](#installation)
13
+ - [Architecture](#architecture): the three layers and the table of the modules
14
+ - [Usage](#usage)
15
+ - [Light and dark theme](#light-and-dark-theme)
16
+ - [Documentation](#documentation): the theme, the layout and every component
17
+ - [Demo](#demo)
18
+ - [Tests](#tests)
19
+
20
+ ## Requirements
21
+
22
+ - [Bootstrap](https://getbootstrap.com) 5.3
23
+ - [Bootstrap Icons](https://icons.getbootstrap.com) 1.11 for the arrows of the menu and the breadcrumb separators (`sidebar-menu`, `dashboard`); another icon font can be set by the Sass variables `$icon-font`, `$icon-font-weight`, `$icon-chevron-right` and `$icon-chevron-down`
24
+ - [Perfect scrollbar](https://github.com/mdbootstrap/perfect-scrollbar) when the menu scrolls with it (`sidebar-menu` styles its rail)
25
+ - [Nanobar](https://github.com/jacoborus/nanobar) when the page shows a nanobar (`dashboard` styles it)
26
+ - [Vanilla Calendar Pro](https://vanilla-calendar.pro) 3.4 for the module `datepicker` (as in Bootstrap 6)
27
+ - [Chart.js](https://www.chartjs.org) 4.6 for the module `chart`
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ npm install compostrap bootstrap
33
+ ```
34
+
35
+ ## Architecture
36
+
37
+ The package has three layers:
38
+
39
+ | Layer | What it is | Classes |
40
+ |-------|------------|---------|
41
+ | **Theme** | Bootstrap itself, built with the variables of compostrap and finished by its CSS: the colors, buttons, badges, forms, tables, navs, overlays… in a calm, dense look | only the classes of Bootstrap 5 and of Bootstrap 6 (`btn-subtle`, `badge-subtle`, `theme-*`, `breadcrumb-link`, `avatar`…), so the markup stays valid after the upgrade to Bootstrap 6 |
42
+ | **Layout** | the frame of an administration: the sidebar, its menu, the navbar over the content and the boxes of the page | `sidebar-*`, `list-*` (menu), `navbar-*`, `content-box` |
43
+ | **Components** | what compostrap adds, each a module of its own | the name of the module as the prefix (`gallery-*`, `empty-*`, `auth-*`…) |
44
+
45
+ | Module | Layer | What it does | JavaScript |
46
+ |--------|-------|--------------|------------|
47
+ | [`theme`](docs/theme.md) | theme | Bootstrap in the look of compostrap: neutral grays, 14px text, quiet shadows, one size scale of buttons and form controls, the colors and variants of Bootstrap 6 | – |
48
+ | [`sidebar`](docs/layout.md#sidebar) | layout | the sidebar: fixed on large screens, an overlay with a backdrop on small | `Sidebar` |
49
+ | [`sidebar-menu`](docs/layout.md#sidebar-menu) | layout | a multi-level menu in the sidebar, links as pills, the current page on any level in a pill; a compact sidebar with the icons only | `SidebarMenu`, `Sidebar` (compact) |
50
+ | [`dashboard`](docs/layout.md) | layout | the page background, the navbar over the content with a breadcrumb, icons and the user, the content boxes, the nanobar | – |
51
+ | [`theme-switcher`](docs/theme-switcher.md) | component | switches the light and dark theme of Bootstrap and remembers the choice | `ThemeSwitcher` |
52
+ | [`tooltip`](docs/tooltip.md) | component | a tooltip of pure CSS for buttons and links with an icon only | `CssTooltip` (optional: Esc hides it) |
53
+ | [`elements`](docs/elements.md) | component | small pieces of a page: state dots, stat tiles, list rows, the loading state of a box | – |
54
+ | [`dialogs`](docs/dialogs.md) | component | a colored line and a confirmation of a modal, a bar of buttons at the bottom of an offcanvas, a toast with the message of a state, a search dialog; dialogs that stay open on a click outside | `Dialogs` |
55
+ | [`settings`](docs/settings.md) | component | a list of the sections of a page and rows of settings with their controls | – |
56
+ | [`datagrid`](docs/datagrid.md) | component | the table of a list: the row of filters, clickable rows and the column of row actions | – |
57
+ | [`selection`](docs/selection.md) | component | rows of a table chosen by checkboxes and a bar with the actions for them | `RowSelection` |
58
+ | [`number-input`](docs/number-input.md) | component | a number with minus and plus buttons, e.g. the quantity in a cart | `NumberInput` |
59
+ | [`otp-input`](docs/otp-input.md) | component | a one-time code typed into separate slots over one real input (the OTP input of Bootstrap 6) | `OtpInput` |
60
+ | [`datepicker`](docs/datepicker.md) | component | the calendar of Bootstrap 6 (Vanilla Calendar Pro) under a date input | `Datepicker` |
61
+ | [`chart`](docs/chart.md) | component | charts of Chart.js written as markup, in the colors and fonts of the theme | `Charts` |
62
+ | [`rating`](docs/rating.md) | component | stars to choose a rating in a form or to show one, halves too | – |
63
+ | [`gallery`](docs/gallery.md) | component | square tiles of images with buttons over the image on hover | – |
64
+ | [`dropzone`](docs/dropzone.md) | component | a large area to drop files on or to click, made of a plain file input | `DropzoneInput` |
65
+ | [`lightbox`](docs/lightbox.md) | component | a full-screen preview of images, browsed by arrows, keys and swipe | `Lightbox` |
66
+ | [`strength`](docs/strength.md) | component | a meter of the password strength under a password input (markup of Bootstrap 6) | `Strength` |
67
+ | [`password-toggle`](docs/password-toggle.md) | component | a button with an eye in a password input that shows and hides the password | `PasswordToggle` |
68
+ | [`empty`](docs/empty.md) | component | empty states in boxes and error pages (404, 403, 500, maintenance) with illustrations | – |
69
+ | [`spinner`](docs/spinner.md) | component | shows that a request runs: a line at the top of the window, or a dark overlay that stops clicks | `Spinner` |
70
+ | [`auth`](docs/auth.md) | component | pages outside the administration (sign in, sign up, recovery): a box in the middle of the page | – |
71
+ | [`shop`](docs/shop.md) | component | the storefront of an e-shop: header with the mini cart, product tiles and detail, cart, steps of the order, choice of the delivery, price summary | `number-input` (amount) |
72
+ | [`blog`](docs/blog.md) | component | a website with a blog: header with the links, list of articles with categories, an article with its text, comments | `avatar` of the theme |
73
+
74
+ The components and the layout work with plain Bootstrap too; the ones with colors (`theme-*` classes) take them from the theme.
75
+
76
+ ## Usage
77
+
78
+ The theme is Bootstrap built with the variables of compostrap, so it takes the place of Bootstrap's own styles:
79
+
80
+ ```javascript
81
+ import 'compostrap/css/theme.css'; // instead of 'bootstrap/dist/css/bootstrap.css'
82
+ ```
83
+
84
+ ```scss
85
+ // own Bootstrap variables before it, e.g. $primary: #066fd1;
86
+ @import 'compostrap/src/scss/theme'; // instead of @import 'bootstrap/scss/bootstrap';
87
+ ```
88
+
89
+ The other modules work with plain Bootstrap too. All of them at once:
90
+
91
+ ```javascript
92
+ import 'compostrap/css/compostrap.css';
93
+ import { Sidebar, SidebarMenuApp, ThemeSwitcher, DropzoneInput, Lightbox, Strength, NumberInput } from 'compostrap';
94
+ import { Datepicker } from 'compostrap/datepicker'; // only with vanilla-calendar-pro installed
95
+ import { Charts } from 'compostrap/chart'; // only with chart.js installed
96
+
97
+ document.addEventListener('DOMContentLoaded', () => {
98
+ Sidebar.init();
99
+ SidebarMenuApp.init();
100
+ new ThemeSwitcher().initialize();
101
+ });
102
+ ```
103
+
104
+ Or only the modules you need, each has its own CSS and JavaScript:
105
+
106
+ ```javascript
107
+ import 'compostrap/css/theme-switcher.css';
108
+ import { ThemeSwitcher } from 'compostrap/theme-switcher';
109
+
110
+ new ThemeSwitcher().initialize();
111
+ ```
112
+
113
+ The styles can also be imported as SCSS:
114
+
115
+ ```scss
116
+ @import 'compostrap/src/scss/compostrap';
117
+ // or a single module
118
+ @import 'compostrap/src/scss/sidebar-menu';
119
+ ```
120
+
121
+ When modules are loaded one by one, load them after the theme (or Bootstrap) in the order `theme-switcher`, `tooltip`, `elements`, `dialogs`, `settings`, `datagrid`, `selection`, `number-input`, `otp-input`, `datepicker`, `rating`, `chart`, `gallery`, `dropzone`, `lightbox`, `strength`, `password-toggle`, `empty`, `spinner`, `auth`, `shop`, `blog`, `sidebar`, `sidebar-menu`, `dashboard`: each later one finishes the layout of the earlier ones.
122
+
123
+ ## Light and dark theme
124
+
125
+ All modules follow the global theme of Bootstrap in `data-bs-theme`:
126
+
127
+ ```html
128
+ <html lang="en" data-bs-theme="light">
129
+ ```
130
+
131
+ The switcher stores the choice in `localStorage` under `bootstrap-theme`; without a stored choice the page follows the system. To avoid a light flash of a dark page, set the theme before the page is drawn:
132
+
133
+ ```html
134
+ <script>
135
+ try {
136
+ let theme = localStorage.getItem('bootstrap-theme') || 'auto';
137
+ if (theme === 'auto') {
138
+ theme = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
139
+ }
140
+ if (theme === 'light' || theme === 'dark') {
141
+ document.documentElement.setAttribute('data-bs-theme', theme);
142
+ }
143
+ } catch (e) { }
144
+ </script>
145
+ ```
146
+
147
+ The dashboard keeps the surface colors of Bootstrap:
148
+
149
+ | Theme | Page background | Sidebar and content |
150
+ |-------|----------------------------|---------------------|
151
+ | Light | `--bs-tertiary-bg` darkened by 1.6 % (`#f6f6f6` in the theme) | `var(--bs-body-bg)` |
152
+ | Dark | `--bs-body-bg` mixed 55 % with black | `var(--bs-body-bg)` |
153
+
154
+ ## Documentation
155
+
156
+ Every module is described in `docs/`, with its markup, classes, variables and JavaScript:
157
+
158
+ - **Theme**: [theme](docs/theme.md) (colors, buttons, alerts and badges, breadcrumb, tabs as a segmented control, forms, offcanvas and modals)
159
+ - **Layout**: [layout](docs/layout.md) ([page](docs/layout.md#page), [sidebar](docs/layout.md#sidebar), [sidebar menu](docs/layout.md#sidebar-menu) and its [compact form](docs/layout.md#compact-sidebar), [navbar](docs/layout.md#navbar), [content boxes](docs/layout.md#content-boxes-and-the-older-navbar))
160
+ - **Components**: [theme switcher](docs/theme-switcher.md), [tooltip](docs/tooltip.md), [elements](docs/elements.md), [dialogs](docs/dialogs.md), [settings](docs/settings.md), [datagrid](docs/datagrid.md), [selection](docs/selection.md), [number input](docs/number-input.md), [OTP input](docs/otp-input.md), [datepicker](docs/datepicker.md), [rating](docs/rating.md), [charts](docs/chart.md), [gallery](docs/gallery.md), [dropzone](docs/dropzone.md), [lightbox](docs/lightbox.md), [password strength](docs/strength.md), [password toggle](docs/password-toggle.md), [empty states and error pages](docs/empty.md), [spinner](docs/spinner.md), [sign-in pages](docs/auth.md), [shop](docs/shop.md), [blog](docs/blog.md)
161
+
162
+ ## Demo
163
+
164
+ The demo runs at [compostrap.github.io/demo](https://compostrap.github.io/demo/). To run it from the package:
165
+
166
+ ```bash
167
+ npm install
168
+ npm run dev
169
+ ```
170
+
171
+ The demo is an overview of the components, one page each, with a menu by kind:
172
+
173
+ - **Overview**: `index.html`, a dashboard (stat tiles, numbers with a trend, revenue, sales by category, orders per day, this year against the last, what waits, the latest articles).
174
+ - **Bootstrap**: typography, buttons, badges and alerts, forms, tables and cards, navigation, overlays (modals, offcanvas, toasts, accordion, progress), in the look of the theme.
175
+ - **Compostrap**: `elements.html`, what the package adds to Bootstrap (tooltips, avatars, state dots, stat tiles, list rows, theme switcher).
176
+ - **Modules**: `datagrid.html`, `gallery.html` and `commerce.html` (an e-shop administration with products, variants and photos).
177
+ - **Compostrap** also has `states.html` (empty states with an illustration and with an icon, a box that loads, both spinners) and `inputs.html` (number inputs and a cart that recounts, one-time codes, datepickers, ratings).
178
+ - **Pages**: `sign-in.html`, `sign-up.html` and `recovery.html` (module `auth`, the password strength of module `strength`, the eye in the password inputs of module `password-toggle`; recovery goes through its three steps, its code is typed into the slots of module `otp-input`), `account.html` (the account of the signed-in user: profile information and the change of the password next to each other) and `permissions.html` (role permissions: a section list and setting rows), and the error pages `error-404.html`, `error-403.html`, `error-500.html` and `maintenance.html` (module `empty`).
179
+ - **Blog** (module `blog`, a website without the sidebar): `blog-articles.html` (categories, the newest article, cards) and `blog-article.html` (an article with its text, comments and the comment form).
180
+ - **Shop** (module `shop`, a storefront without the sidebar): `shop-products.html`, `shop-product.html`, `shop-cart.html`, `shop-delivery.html`, `shop-customer.html`, `shop-summary.html`, `shop-confirmation.html` and `shop-states.html` (an empty cart, a product out of stock, a valid and an invalid discount code, a form with errors, a cart that recounts), the whole way from the list of products to the confirmation of an order.
181
+
182
+ ## Tests
183
+
184
+ ```bash
185
+ npx playwright install chromium # once
186
+ npm test
187
+ ```
188
+
189
+ Smoke tests in Playwright over the demo pages: every page loads without an error, and the JavaScript modules (sidebar and its compact form, menu, theme switcher, number input, OTP input, password toggle, strength, row selection, lightbox, dropzone, datepicker, charts, spinner) behave as described here.
190
+
191
+ ## Built on
192
+
193
+ - [Bootstrap 5](https://getbootstrap.com)
194
+ - [Bootstrap Icons](https://icons.getbootstrap.com)
195
+ - [Perfect scrollbar](https://github.com/mdbootstrap/perfect-scrollbar)
196
+ - [Nanobar](https://github.com/jacoborus/nanobar)
197
+ - [Vanilla Calendar Pro](https://vanilla-calendar.pro)
198
+ - [Chart.js](https://www.chartjs.org)
@@ -0,0 +1,15 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 180" fill="none" role="img" aria-label="No items">
2
+ <!-- soft background shape -->
3
+ <path style="fill: var(--cs-illustration-bg, #ededed)" d="M42 98c-6-32 20-58 52-64 24-5 40 6 62 4 28-3 50 12 52 38 2 30-20 56-50 62-26 5-44-4-68-2-26 2-42-10-48-38z"/>
4
+ <!-- shadow -->
5
+ <ellipse style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="120" cy="158" rx="64" ry="5"/>
6
+ <!-- open box -->
7
+ <path style="fill: var(--cs-illustration-muted, #d4d4d4)" d="M72 84l48-18 48 18-48 18z"/>
8
+ <path style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" stroke-width="2.5" stroke-linejoin="round" d="M72 84v52l48 18V102z"/>
9
+ <path style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" stroke-width="2.5" stroke-linejoin="round" d="M168 84v52l-48 18V102z"/>
10
+ <!-- flaps -->
11
+ <path style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" stroke-width="2.5" stroke-linejoin="round" d="M72 84l-14 18 48 18 14-18z"/>
12
+ <path style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" stroke-width="2.5" stroke-linejoin="round" d="M168 84l14 18-48 18-14-18z"/>
13
+ <!-- sparkles of emptiness -->
14
+ <path style="stroke: var(--cs-illustration-accent, #0089d7)" d="M120 36v14M113 43h14M86 52v8M82 56h8M156 50v10M151 55h10" stroke-width="3" stroke-linecap="round"/>
15
+ </svg>
@@ -0,0 +1,16 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 180" fill="none" role="img" aria-label="Access denied">
2
+ <!-- soft background shape -->
3
+ <path style="fill: var(--cs-illustration-bg, #ededed)" d="M44 96c-6-34 22-62 56-66 22-3 34 8 58 6 28-2 50 14 52 42 2 32-20 58-52 66-26 7-44-2-68 0-28 2-40-18-46-48z"/>
4
+ <!-- shadow -->
5
+ <ellipse style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="120" cy="160" rx="62" ry="5"/>
6
+ <!-- door -->
7
+ <rect style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" x="70" y="34" width="68" height="124" rx="6" stroke-width="2.5"/>
8
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="82" y="48" width="44" height="34" rx="4"/>
9
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="82" y="92" width="44" height="52" rx="4"/>
10
+ <circle style="fill: var(--cs-illustration-line, #525252)" cx="128" cy="100" r="3"/>
11
+ <!-- padlock -->
12
+ <path style="stroke: var(--cs-illustration-line, #525252)" d="M146 98v-12a16 16 0 0 1 32 0v12" stroke-width="5" stroke-linecap="round"/>
13
+ <rect style="fill: var(--cs-illustration-accent, #0089d7)" x="136" y="96" width="52" height="42" rx="8"/>
14
+ <circle style="fill: var(--cs-illustration-surface, #fff)" cx="162" cy="113" r="5"/>
15
+ <path style="stroke: var(--cs-illustration-surface, #fff)" d="M162 116v9" stroke-width="4" stroke-linecap="round"/>
16
+ </svg>
@@ -0,0 +1,14 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 180" fill="none" role="img" aria-label="Maintenance">
2
+ <!-- soft background shape -->
3
+ <path style="fill: var(--cs-illustration-bg, #ededed)" d="M40 100c-6-34 20-62 54-68 24-4 38 8 62 4 28-4 52 12 54 40 2 32-22 60-54 64-26 4-44-4-68-2-26 2-42-12-48-38z"/>
4
+ <!-- shadow -->
5
+ <ellipse style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="120" cy="160" rx="68" ry="5"/>
6
+ <!-- big gear -->
7
+ <path style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" stroke-width="2.5" stroke-linejoin="round" d="M106 52h16l3 12 9 4 11-6 11 11-6 11 4 9 12 3v16l-12 3-4 9 6 11-11 11-11-6-9 4-3 12h-16l-3-12-9-4-11 6-11-11 6-11-4-9-12-3V96l12-3 4-9-6-11 11-11 11 6 9-4z"/>
8
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="114" cy="104" r="16"/>
9
+ <!-- wrench -->
10
+ <path style="fill: var(--cs-illustration-accent, #0089d7)" d="M190 44a20 20 0 0 0-26 25l-46 46a7 7 0 0 0 10 10l46-46a20 20 0 0 0 25-26l-11 11-10-2-2-10z"/>
11
+ <!-- small gear -->
12
+ <path style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" stroke-width="2.5" stroke-linejoin="round" d="M170 112h8l1.5 6 4.5 2 5.5-3 5.5 5.5-3 5.5 2 4.5 6 1.5v8l-6 1.5-2 4.5 3 5.5-5.5 5.5-5.5-3-4.5 2-1.5 6h-8l-1.5-6-4.5-2-5.5 3-5.5-5.5 3-5.5-2-4.5-6-1.5v-8l6-1.5 2-4.5-3-5.5 5.5-5.5 5.5 3 4.5-2z"/>
13
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="174" cy="138" r="7"/>
14
+ </svg>
@@ -0,0 +1,22 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 180" fill="none" role="img" aria-label="Page not found">
2
+ <!-- soft background shape -->
3
+ <path style="fill: var(--cs-illustration-bg, #ededed)" d="M38 112c-14-30 4-66 38-78 26-9 44 4 70 0 28-4 54 6 62 32 9 30-6 62-36 74-28 11-52 2-78 6-26 4-44-6-56-34z"/>
4
+ <!-- shadow -->
5
+ <ellipse style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="120" cy="160" rx="70" ry="5"/>
6
+ <!-- browser window -->
7
+ <rect style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" x="52" y="40" width="124" height="96" rx="8" stroke-width="2.5"/>
8
+ <path style="stroke: var(--cs-illustration-line, #525252)" d="M52 58h124" stroke-width="2.5"/>
9
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="63" cy="49" r="3"/>
10
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="73" cy="49" r="3"/>
11
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="83" cy="49" r="3"/>
12
+ <!-- page skeleton with a broken part -->
13
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="66" y="72" width="54" height="7" rx="3.5"/>
14
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="66" y="87" width="38" height="7" rx="3.5"/>
15
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="66" y="102" width="46" height="7" rx="3.5"/>
16
+ <path style="stroke: var(--cs-illustration-muted, #d4d4d4)" d="M66 120h20m6 0h14" stroke-width="7" stroke-linecap="round" stroke-dasharray="0"/>
17
+ <!-- magnifier with a question mark -->
18
+ <circle style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-accent, #0089d7)" cx="150" cy="104" r="24" stroke-width="5"/>
19
+ <path style="stroke: var(--cs-illustration-accent, #0089d7)" d="M167 121l20 20" stroke-width="9" stroke-linecap="round"/>
20
+ <path style="stroke: var(--cs-illustration-line, #525252)" d="M143 97a7 7 0 1 1 10 6c-2 1-3 3-3 5v2" stroke-width="3.5" stroke-linecap="round"/>
21
+ <circle style="fill: var(--cs-illustration-line, #525252)" cx="150" cy="117" r="2.25"/>
22
+ </svg>
@@ -0,0 +1,21 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 240 180" fill="none" role="img" aria-label="Server error">
2
+ <!-- soft background shape -->
3
+ <path style="fill: var(--cs-illustration-bg, #ededed)" d="M36 104c-8-32 16-60 48-70 26-8 42 6 66 2 30-4 56 10 58 40 2 34-24 60-56 66-26 5-46-4-70-2-24 2-40-10-46-36z"/>
4
+ <!-- shadow -->
5
+ <ellipse style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="116" cy="160" rx="66" ry="5"/>
6
+ <!-- server rack -->
7
+ <rect style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" x="64" y="40" width="96" height="34" rx="6" stroke-width="2.5"/>
8
+ <rect style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" x="64" y="82" width="96" height="34" rx="6" stroke-width="2.5"/>
9
+ <rect style="fill: var(--cs-illustration-surface, #fff); stroke: var(--cs-illustration-line, #525252)" x="64" y="124" width="96" height="34" rx="6" stroke-width="2.5"/>
10
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="76" y="53" width="40" height="8" rx="4"/>
11
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="76" y="95" width="40" height="8" rx="4"/>
12
+ <rect style="fill: var(--cs-illustration-muted, #d4d4d4)" x="76" y="137" width="40" height="8" rx="4"/>
13
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="146" cy="57" r="4"/>
14
+ <circle style="fill: var(--cs-illustration-muted, #d4d4d4)" cx="146" cy="141" r="4"/>
15
+ <!-- the failing unit -->
16
+ <circle style="fill: var(--cs-illustration-danger, #e5484d)" cx="146" cy="99" r="4"/>
17
+ <!-- warning sign -->
18
+ <path style="fill: var(--cs-illustration-accent, #0089d7)" d="M176 66a6 6 0 0 1 10.4 0l22 38a6 6 0 0 1-5.2 9h-44a6 6 0 0 1-5.2-9z"/>
19
+ <path style="stroke: var(--cs-illustration-surface, #fff)" d="M181.2 80v14" stroke-width="5" stroke-linecap="round"/>
20
+ <circle style="fill: var(--cs-illustration-surface, #fff)" cx="181.2" cy="103" r="3"/>
21
+ </svg>