compostrap 1.0.2 → 1.0.3

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.
@@ -4513,7 +4513,7 @@ body {
4513
4513
  }
4514
4514
 
4515
4515
  .list .list-link {
4516
- margin: 0.375rem 0.5rem;
4516
+ margin: 0.375rem 0.5rem 0;
4517
4517
  padding: 0.5rem 0.75rem;
4518
4518
  border-radius: var(--sm-pill-border-radius);
4519
4519
  }
@@ -4522,15 +4522,15 @@ body {
4522
4522
  padding-bottom: 0.375rem;
4523
4523
  padding-left: 2.875rem;
4524
4524
  }
4525
+ .list .list-hidden {
4526
+ padding-top: 0.375rem;
4527
+ }
4525
4528
  .list .list-hidden > li:first-child > .list-link {
4526
4529
  margin-top: 0;
4527
4530
  }
4528
4531
  .list .list-title + .list-unstyled > li:first-child > .list-link {
4529
4532
  margin-top: 0.25rem;
4530
4533
  }
4531
- .list .list-hidden > li:last-child > .list-link {
4532
- margin-bottom: 0;
4533
- }
4534
4534
  .list .list-hidden .list-hidden .list-link {
4535
4535
  padding-left: 3.875rem;
4536
4536
  }
@@ -266,7 +266,7 @@
266
266
  }
267
267
 
268
268
  .list .list-link {
269
- margin: 0.375rem 0.5rem;
269
+ margin: 0.375rem 0.5rem 0;
270
270
  padding: 0.5rem 0.75rem;
271
271
  border-radius: var(--sm-pill-border-radius);
272
272
  }
@@ -275,15 +275,15 @@
275
275
  padding-bottom: 0.375rem;
276
276
  padding-left: 2.875rem;
277
277
  }
278
+ .list .list-hidden {
279
+ padding-top: 0.375rem;
280
+ }
278
281
  .list .list-hidden > li:first-child > .list-link {
279
282
  margin-top: 0;
280
283
  }
281
284
  .list .list-title + .list-unstyled > li:first-child > .list-link {
282
285
  margin-top: 0.25rem;
283
286
  }
284
- .list .list-hidden > li:last-child > .list-link {
285
- margin-bottom: 0;
286
- }
287
287
  .list .list-hidden .list-hidden .list-link {
288
288
  padding-left: 3.875rem;
289
289
  }
@@ -1,7 +1,7 @@
1
1
  @charset "UTF-8";
2
2
  /*!
3
- * Bootstrap v5.3.9 (https://getbootstrap.com/)
4
- * Copyright 2011-2026 The Bootstrap Authors
3
+ * Bootstrap v5.3.8 (https://getbootstrap.com/)
4
+ * Copyright 2011-2025 The Bootstrap Authors
5
5
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
6
6
  */
7
7
  :root,
@@ -526,7 +526,7 @@ legend + * {
526
526
 
527
527
  ::-webkit-datetime-edit-fields-wrapper,
528
528
  ::-webkit-datetime-edit-text,
529
- ::-webkit-datetime-edit-minute-field,
529
+ ::-webkit-datetime-edit-minute,
530
530
  ::-webkit-datetime-edit-hour-field,
531
531
  ::-webkit-datetime-edit-day-field,
532
532
  ::-webkit-datetime-edit-month-field,
@@ -5530,22 +5530,15 @@ textarea.form-control-lg {
5530
5530
  }
5531
5531
  @media (min-width: 992px) {
5532
5532
  .modal-lg,
5533
- .modal-xl,
5534
- .modal-xxl {
5533
+ .modal-xl {
5535
5534
  --bs-modal-width: 800px;
5536
5535
  }
5537
5536
  }
5538
5537
  @media (min-width: 1200px) {
5539
- .modal-xl,
5540
- .modal-xxl {
5538
+ .modal-xl {
5541
5539
  --bs-modal-width: 1140px;
5542
5540
  }
5543
5541
  }
5544
- @media (min-width: 1400px) {
5545
- .modal-xxl {
5546
- --bs-modal-width: 1320px;
5547
- }
5548
- }
5549
5542
  .modal-fullscreen {
5550
5543
  width: 100vw;
5551
5544
  max-width: none;
@@ -6720,11 +6713,6 @@ textarea.form-control-lg {
6720
6713
  .placeholder-glow .placeholder {
6721
6714
  animation: placeholder-glow 2s ease-in-out infinite;
6722
6715
  }
6723
- @media (prefers-reduced-motion: reduce) {
6724
- .placeholder-glow .placeholder {
6725
- animation: none;
6726
- }
6727
- }
6728
6716
 
6729
6717
  @keyframes placeholder-glow {
6730
6718
  50% {
@@ -6736,11 +6724,6 @@ textarea.form-control-lg {
6736
6724
  mask-size: 200% 100%;
6737
6725
  animation: placeholder-wave 2s linear infinite;
6738
6726
  }
6739
- @media (prefers-reduced-motion: reduce) {
6740
- .placeholder-wave {
6741
- animation: none;
6742
- }
6743
- }
6744
6727
 
6745
6728
  @keyframes placeholder-wave {
6746
6729
  100% {
package/docs/blog.md CHANGED
@@ -1,85 +1,85 @@
1
- # Blog
2
-
3
- [← Compostrap](../readme.md#documentation)
4
-
5
- The module `blog` styles a website with a blog, outside the administration: a header with the links of the website, the list of articles with its categories, an article with its text and the comments under it. The page is white, the header and the footer are tinted bars and the boxes (cards of articles, comments, the comment form) are tinted instead of framed (`--blog-page-bg`, `--blog-tint-bg`, `--blog-tint-hover-bg`). The header holds a navbar of Bootstrap, so the links fold into a menu on a phone.
6
-
7
- ```html
8
- <body class="blog-page">
9
- <header class="blog-header">
10
- <nav class="navbar navbar-expand-lg">
11
- <div class="container">
12
- <a class="blog-brand" href="/">Logo <span>Name</span></a>
13
- <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#blog-menu" aria-controls="blog-menu" aria-expanded="false" aria-label="Menu"><span class="navbar-toggler-icon"></span></button>
14
- <div class="collapse navbar-collapse" id="blog-menu">
15
- <ul class="navbar-nav ms-auto"><li class="nav-item"><a class="nav-link active" href="/blog">Blog</a></li></ul>
16
- <div class="blog-header-actions"><a class="btn btn-primary btn-sm" href="/sign-in">Sign in</a></div>
17
- </div>
18
- </div>
19
- </nav>
20
- </header>
21
- <main class="container">…</main>
22
- <footer class="blog-footer">
23
- <div class="container">
24
- <div class="row g-4">
25
- <div class="col-lg-4">…</div>
26
- <div class="col-6 col-md-4 col-lg-2"><h2 class="blog-footer-title">Links</h2><ul class="blog-footer-links"><li><a href="/blog">Blog</a></li></ul></div>
27
- </div>
28
- </div>
29
- </footer>
30
- </body>
31
- ```
32
-
33
- **List of articles.**
34
-
35
- - `.blog-title` is the heading of a page; `.blog-heading` puts a link on its right.
36
- - `nav.blog-pills` holds the categories as links `.blog-pill`, the chosen one with `active`.
37
- - `article.blog-featured` is the newest article over the whole row: a picture in `.blog-featured-image` next to `.blog-featured-body`.
38
- - `article.blog-card` are the other articles, in a Bootstrap grid (`row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4`).
39
- - `.blog-card-title` holds the link of the whole block (`stretched-link`); other links in the block get `.blog-over`.
40
- - `.blog-meta` is a line of date, category and comments parted by dots.
41
- - `.blog-author` is an `avatar` of the theme with the name (`.blog-author-name`).
42
-
43
- ```html
44
- <article class="blog-card">
45
- <div class="blog-card-image"><img src="…" alt="" loading="lazy"></div>
46
- <div class="blog-meta"><time datetime="2026-11-05">5 days ago</time><a class="blog-over" href="/blog/latte">Latte</a></div>
47
- <h2 class="blog-card-title"><a class="stretched-link" href="/blog/article">Title</a></h2>
48
- <p class="blog-card-text">Perex, cut after three lines.</p>
49
- <div class="blog-card-footer">
50
- <div class="blog-author"><span class="avatar avatar-sm theme-success">PK</span><span>Petra Králová</span></div>
51
- <a class="blog-over" href="/blog/article#comments">Comments: 5</a>
52
- </div>
53
- </article>
54
- ```
55
-
56
- **Article.** `article.blog-article` is a narrow column (`--blog-article-width`, 48rem) with:
57
-
58
- - `.blog-back`, a link back,
59
- - `.blog-article-title` and the perex `.blog-article-lead`,
60
- - `.blog-meta.blog-article-meta` with the author, the date and the category,
61
- - `.blog-article-image`, the cover (a 21 : 9 cut),
62
- - `.blog-content`, the text: 16px text with more room between lines, headings, lists, pictures as wide cuts, a quote with a line of the primary color and code blocks on the tint. Links in the text are underlined (the theme draws links without a line, and a color alone does not tell a link from the text); so are the links in `.blog-comment-content`.
63
-
64
- A highlighted code is written with the text classes of Bootstrap; in a code block they take the colors of the code on nette.org, which can be changed by a variable (each as `r, g, b`):
65
-
66
- | Class | Part of the code | Variable |
67
- |-------|------------------|----------|
68
- | `text-primary` | keyword and tag | `--blog-code-keyword` |
69
- | `text-primary-emphasis` | name of a function or method | `--blog-code-function` |
70
- | `text-success` | string | `--blog-code-string` |
71
- | `text-danger` | number | `--blog-code-number` |
72
- | `text-warning-emphasis` | variable | `--blog-code-variable` |
73
- | `text-info-emphasis` | attribute | `--blog-code-attribute` |
74
- | `text-danger-emphasis` | Latte tag | `--blog-code-macro` |
75
- | `text-body-secondary` | comment | `--blog-code-comment` |
76
-
77
- The box of a code is `--blog-code-bg`.
78
-
79
- **Comments.** `section.blog-comments` with `.blog-comments-title`; a comment is `article.blog-comment` with:
80
-
81
- - `.blog-comment-head`: the avatar, `.blog-comment-author`, the link of its number and the time,
82
- - `.blog-comment-content`: the text of a comment, which holds only the message;
83
- - `.blog-meta.blog-comment-foot`: Reply and, in a comment that answers another one, the link to it as "In reply to".
84
-
85
- A comment opened by its link (`#comment-2`) is stronger and stays under the sticky header. The form of a new comment stands in `.blog-comment-form` with its title `.blog-comment-form-title` over the box.
1
+ # Blog
2
+
3
+ [← Compostrap](../readme.md#documentation)
4
+
5
+ The module `blog` styles a website with a blog, outside the administration: a header with the links of the website, the list of articles with its categories, an article with its text and the comments under it. The page is white, the header and the footer are tinted bars and the boxes (cards of articles, comments, the comment form) are tinted instead of framed (`--blog-page-bg`, `--blog-tint-bg`, `--blog-tint-hover-bg`). The header holds a navbar of Bootstrap, so the links fold into a menu on a phone.
6
+
7
+ ```html
8
+ <body class="blog-page">
9
+ <header class="blog-header">
10
+ <nav class="navbar navbar-expand-lg">
11
+ <div class="container">
12
+ <a class="blog-brand" href="/">Logo <span>Name</span></a>
13
+ <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#blog-menu" aria-controls="blog-menu" aria-expanded="false" aria-label="Menu"><span class="navbar-toggler-icon"></span></button>
14
+ <div class="collapse navbar-collapse" id="blog-menu">
15
+ <ul class="navbar-nav ms-auto"><li class="nav-item"><a class="nav-link active" href="/blog">Blog</a></li></ul>
16
+ <div class="blog-header-actions"><a class="btn btn-primary btn-sm" href="/sign-in">Sign in</a></div>
17
+ </div>
18
+ </div>
19
+ </nav>
20
+ </header>
21
+ <main class="container">…</main>
22
+ <footer class="blog-footer">
23
+ <div class="container">
24
+ <div class="row g-4">
25
+ <div class="col-lg-4">…</div>
26
+ <div class="col-6 col-md-4 col-lg-2"><h2 class="blog-footer-title">Links</h2><ul class="blog-footer-links"><li><a href="/blog">Blog</a></li></ul></div>
27
+ </div>
28
+ </div>
29
+ </footer>
30
+ </body>
31
+ ```
32
+
33
+ **List of articles.**
34
+
35
+ - `.blog-title` is the heading of a page; `.blog-heading` puts a link on its right.
36
+ - `nav.blog-pills` holds the categories as links `.blog-pill`, the chosen one with `active`.
37
+ - `article.blog-featured` is the newest article over the whole row: a picture in `.blog-featured-image` next to `.blog-featured-body`.
38
+ - `article.blog-card` are the other articles, in a Bootstrap grid (`row row-cols-1 row-cols-md-2 row-cols-xl-3 g-4`).
39
+ - `.blog-card-title` holds the link of the whole block (`stretched-link`); other links in the block get `.blog-over`.
40
+ - `.blog-meta` is a line of date, category and comments parted by dots.
41
+ - `.blog-author` is an `avatar` of the theme with the name (`.blog-author-name`).
42
+
43
+ ```html
44
+ <article class="blog-card">
45
+ <div class="blog-card-image"><img src="…" alt="" loading="lazy"></div>
46
+ <div class="blog-meta"><time datetime="2026-11-05">5 days ago</time><a class="blog-over" href="/blog/latte">Latte</a></div>
47
+ <h2 class="blog-card-title"><a class="stretched-link" href="/blog/article">Title</a></h2>
48
+ <p class="blog-card-text">Perex, cut after three lines.</p>
49
+ <div class="blog-card-footer">
50
+ <div class="blog-author"><span class="avatar avatar-sm theme-success">PK</span><span>Petra Králová</span></div>
51
+ <a class="blog-over" href="/blog/article#comments">Comments: 5</a>
52
+ </div>
53
+ </article>
54
+ ```
55
+
56
+ **Article.** `article.blog-article` is a narrow column (`--blog-article-width`, 48rem) with:
57
+
58
+ - `.blog-back`, a link back,
59
+ - `.blog-article-title` and the perex `.blog-article-lead`,
60
+ - `.blog-meta.blog-article-meta` with the author, the date and the category,
61
+ - `.blog-article-image`, the cover (a 21 : 9 cut),
62
+ - `.blog-content`, the text: 16px text with more room between lines, headings, lists, pictures as wide cuts, a quote with a line of the primary color and code blocks on the tint. Links in the text are underlined (the theme draws links without a line, and a color alone does not tell a link from the text); so are the links in `.blog-comment-content`.
63
+
64
+ A highlighted code is written with the text classes of Bootstrap; in a code block they take the colors of the code on nette.org, which can be changed by a variable (each as `r, g, b`):
65
+
66
+ | Class | Part of the code | Variable |
67
+ |-------|------------------|----------|
68
+ | `text-primary` | keyword and tag | `--blog-code-keyword` |
69
+ | `text-primary-emphasis` | name of a function or method | `--blog-code-function` |
70
+ | `text-success` | string | `--blog-code-string` |
71
+ | `text-danger` | number | `--blog-code-number` |
72
+ | `text-warning-emphasis` | variable | `--blog-code-variable` |
73
+ | `text-info-emphasis` | attribute | `--blog-code-attribute` |
74
+ | `text-danger-emphasis` | Latte tag | `--blog-code-macro` |
75
+ | `text-body-secondary` | comment | `--blog-code-comment` |
76
+
77
+ The box of a code is `--blog-code-bg`.
78
+
79
+ **Comments.** `section.blog-comments` with `.blog-comments-title`; a comment is `article.blog-comment` with:
80
+
81
+ - `.blog-comment-head`: the avatar, `.blog-comment-author`, the link of its number and the time,
82
+ - `.blog-comment-content`: the text of a comment, which holds only the message;
83
+ - `.blog-meta.blog-comment-foot`: Reply and, in a comment that answers another one, the link to it as "In reply to".
84
+
85
+ A comment opened by its link (`#comment-2`) is stronger and stays under the sticky header. The form of a new comment stands in `.blog-comment-form` with its title `.blog-comment-form-title` over the box.
package/docs/layout.md CHANGED
@@ -1,143 +1,143 @@
1
- # Layout
2
-
3
- [← Compostrap](../readme.md#documentation)
4
-
5
- ## Page
6
-
7
- The sidebar runs over the whole height with the brand on top, the navbar sits over the content only, in the color of the page and stuck to the top:
8
-
9
- ```html
10
- <div class="d-flex wrapper">
11
- <nav class="sidebar" id="navigation">
12
- <div class="sidebar-menu"><div class="sidebar-menu-fixed">
13
- <a class="sidebar-brand" href="/"><svg>…</svg><span>Compostrap</span></a>
14
- <div class="scrollbar scrollbar-use-navbar">…menu…</div>
15
- </div></div>
16
- </nav>
17
- <div class="layout-content">
18
- <header class="navbar navbar-expand-md navbar-content navbar-bar sticky-top">…breadcrumb, icons, user…</header>
19
- <div class="container-fluid"><main>…</main></div>
20
- </div>
21
- </div>
22
- ```
23
-
24
-
25
- The layout comes in three combinations of the navbar and the brand of the sidebar, each with the navbar stuck to the top (`sticky-top`) or scrolling away with the page:
26
-
27
- | Combination | Navbar | Brand |
28
- |-------------|--------|-------|
29
- | On the page: the navbar and the brand on the background of the page, the white menu below the brand as a panel with a rounded corner, in line with the first box | `navbar-content` | `sidebar-brand sidebar-brand-page` |
30
- | The navbar on the page, a white sidebar | `navbar-content` | `sidebar-brand` |
31
- | A white navbar and a white sidebar; a soft shadow under the navbar when the content scrolls under it | `navbar-content navbar-bar` | `sidebar-brand` |
32
-
33
- The white navbar can take a color, together with the brand of the sidebar, so one colored strip runs over the top: `navbar-colored` and `sidebar-brand-colored` with a `theme-*` class (`theme-primary`, `theme-success`, `theme-danger`, `theme-info`, or `theme-gray`, a gray between the light secondary and dark). Its text and icons turn light, a status dot gets a light ring, and the nanobar takes the color of the navbar, lightened; the dropdowns in it keep the colors of the page.
34
-
35
- ```html
36
- <a class="sidebar-brand sidebar-brand-colored theme-primary" href="/">…</a>
37
- <header class="navbar navbar-expand-md navbar-content navbar-bar navbar-colored theme-primary sticky-top">…</header>
38
- ```
39
-
40
- The demo has a *Customize* panel to try them.
41
-
42
- Below `md`, where the sidebar is hidden, `navbar-brand-mobile` shows the brand in the navbar (as its first item; only the logo on phones under 360px); the open sidebar covers it with its own brand at the same place.
43
-
44
- The layout with a navbar over the whole width (`wrapper-navbar-used wrapper-navbar-fixed`, `navbar fixed-top`) works too.
45
-
46
- ## Sidebar
47
-
48
- The sidebar is the element `#navigation`, its toggle button is `#sidebar`. On small screens it opens as an overlay over the page and takes the focus; closed, it stands outside the window and is `inert`, so the keyboard and a screen reader skip its links. The backdrop, a click on it, Escape and the focus that leaves it (Tab after its last link) close it, and the toggle reports its state in `aria-expanded`. From the `md` breakpoint up it stays in the layout.
49
-
50
- | Description | Class |
51
- |----------------------------------------------------|-----------------------------|
52
- | Layout without a navbar | `wrapper` |
53
- | Layout with a navbar | `wrapper-navbar-used` |
54
- | Layout with a fixed navbar | `wrapper-navbar-fixed` |
55
- | Rounded top right corner of the sidebar | `sidebar-rounded-top-right` |
56
- | Fixed menu in the sidebar | `sidebar-menu-fixed` |
57
- | Toggle visible on small screens (used by `Sidebar`) | `sidebar-toggle` |
58
- | Toggle visible on all screens | `sidebar-toggle-visible` |
59
-
60
- ## Sidebar menu
61
-
62
- `SidebarMenuApp.init()` can be called again after menu items are added. It sets `aria-expanded` and `aria-controls` on submenu links, `aria-current="page"` on the current link, and opens a submenu at once; only its arrow rotates. Set `SidebarMenu.slideDuration = 200` (ms) before `init()` to slide submenus open instead; the slide is skipped when reduced motion is requested.
63
-
64
- | Description | Class |
65
- |-------------------------|----------------|
66
- | Current item | `link-current` |
67
- | Link with a submenu (without `href`, it becomes a button) | `link-arrow` |
68
- | Hidden submenu | `list-hidden` |
69
- | Shaking icon on hover | `bell` |
70
-
71
- The colors of the menu come from the body color of Bootstrap (titles at 60 %, icons at 60 %, arrows at 85 %), so both themes work without settings; they can be changed by the `--sm-*` CSS variables, the sizes by the Sass variables in `src/scss/_variables.scss`. The pills of the links have `--sm-pill-border-radius`, `--sm-pill-icon-color`, `--sm-pill-link-bg` (the current page) and `--sm-pill-hover-bg` (a hovered link, a bit weaker).
72
-
73
- ### Compact sidebar
74
-
75
- From the `md` breakpoint up the sidebar can be narrowed to the icons of the first level (`$sm-compact-width`, 72px); a phone keeps its sliding menu. A button with `data-sidebar-compact` switches the class `sidebar-compact` of `<html>`, keeps its `aria-pressed` in line and remembers the choice in `localStorage` (`sidebar-compact`); it is handled by `Sidebar.init()`. In the compact sidebar:
76
-
77
- - the brand shows only its logo, a section title becomes a short line, badges and submenus are hidden (a group holding the current page gets its pill);
78
- - the name of a hovered or focused link is shown next to it in the colors of the tooltip;
79
- - a link with a submenu opens its links in a menu of the theme next to the icon (the group name over them, the current page marked); it is closed by another click on the icon, a click outside, Esc or a scroll, and works by the keyboard like a dropdown (Enter or Space moves the focus into it, the arrows between the links, Tab leaves it to the next icon).
80
-
81
- ```html
82
- <html class="…">
83
- <head>
84
- <!-- the remembered compact sidebar before the page is drawn, so the menu does not jump -->
85
- <script>try { if (localStorage.getItem('sidebar-compact') === '1') document.documentElement.classList.add('sidebar-compact'); } catch (e) { }</script>
86
- </head>
87
- …
88
- <button type="button" class="navbar-icon" data-sidebar-compact aria-pressed="false" aria-label="Compact menu" data-tooltip="bottom">
89
- <i class="bi bi-layout-sidebar" aria-hidden="true"></i>
90
- </button>
91
- ```
92
-
93
- `Sidebar.setCompact(true|false)` sets it from a script, `Sidebar.isCompact()` tells whether the compact sidebar is shown.
94
-
95
- ## Navbar
96
-
97
- Icon buttons on the right of the navbar (module `dashboard`): `navbar-icon` is a quiet square for an icon, an icon with a short text (`navbar-icon-text`, e.g. the code of the language) widens it; tinted on hover and while its dropdown is open. A `status-dot` (module `elements`) marks that something waits; `status-dot-pulse` makes it pulse.
98
-
99
- ```html
100
- <button type="button" class="navbar-icon" aria-label="Toggle theme" data-tooltip="bottom" data-theme-switcher
101
- data-theme-light-icon="bi bi-sun" data-theme-dark-icon="bi bi-moon"><i data-theme-switcher-icon class="bi bi-moon"></i></button>
102
-
103
- <div class="dropdown">
104
- <button type="button" class="navbar-icon" data-bs-toggle="dropdown" aria-label="Notifications">
105
- <i class="bi bi-bell"></i><span class="status-dot status-dot-pulse theme-danger"></span>
106
- <span class="navbar-icon-text d-none d-lg-inline">Notifications</span>
107
- </button>
108
- <ul class="dropdown-menu dropdown-menu-end">…</ul>
109
- </div>
110
-
111
- <div class="dropdown">
112
- <button type="button" class="navbar-icon" data-bs-toggle="dropdown"><i class="bi bi-translate" aria-hidden="true"></i><span class="visually-hidden">Language: </span><span class="navbar-icon-text">EN</span></button>
113
- <ul class="dropdown-menu dropdown-menu-end">
114
- <li><a class="dropdown-item" href="...">Čeština</a></li>
115
- <li><a class="dropdown-item active" href="..." aria-current="true">English</a></li>
116
- </ul>
117
- </div>
118
- ```
119
-
120
- The user sits in the navbar as `navbar-user`: an `avatar` (initials or a photo in a circle, in a `theme-*` color; `avatar-sm`, `avatar-lg`) with the name and the role, the account in its dropdown.
121
-
122
- ## Content boxes and the older navbar
123
-
124
- The navbar `navbar fixed-top` gets the page background, `navbar-nav-breadcrumb` separates its items by an arrow, and `content-box` is a box of the page content on the surface color.
125
-
126
- ## Datagrid tables
127
-
128
- A table of a datagrid stands in a `table-responsive`, so it scrolls inside its box on a narrow screen. The wrapper is `<div class="table-responsive" tabindex="0" role="region" aria-label="Articles">` (the name of the table): with `tabindex` the keyboard can scroll it in every browser, the role and the name tell a screen reader what the focused box is. The actions of a row are a menu: three vertical dots open a dropdown with the items, delete last after a divider. The button needs `data-bs-popper-config='{"strategy":"fixed"}'`, or the scrolling wrapper cuts the menu off.
129
-
130
- ```html
131
- <td class="text-end">
132
- <div class="dropdown">
133
- <button type="button" class="btn btn-xs btn-icon btn-text" data-bs-toggle="dropdown" data-bs-popper-config='{"strategy":"fixed"}' aria-expanded="false" aria-label="Actions"><i class="bi bi-three-dots-vertical" aria-hidden="true"></i></button>
134
- <ul class="dropdown-menu dropdown-menu-end">
135
- <li><a class="dropdown-item" href="..."><i class="bi bi-pencil me-2" aria-hidden="true"></i>Edit</a></li>
136
- <li><hr class="dropdown-divider"></li>
137
- <li><a class="dropdown-item text-danger" href="..."><i class="bi bi-trash me-2" aria-hidden="true"></i>Delete</a></li>
138
- </ul>
139
- </div>
140
- </td>
141
- ```
142
-
143
- A datagrid can also open an item by a click on its row (`datagrid-row-clickable` on the `tr` and `row-click.js` of drago-ex/datagrid; compostrap has no script for it). Use it only with icon buttons as the row actions (`btn btn-xs btn-icon` with a `data-tooltip`), never with the menu of three dots: a click that misses the small button of the menu lands on the row and opens the item instead of the menu.
1
+ # Layout
2
+
3
+ [← Compostrap](../readme.md#documentation)
4
+
5
+ ## Page
6
+
7
+ The sidebar runs over the whole height with the brand on top, the navbar sits over the content only, in the color of the page and stuck to the top:
8
+
9
+ ```html
10
+ <div class="d-flex wrapper">
11
+ <nav class="sidebar" id="navigation">
12
+ <div class="sidebar-menu"><div class="sidebar-menu-fixed">
13
+ <a class="sidebar-brand" href="/"><svg>…</svg><span>Compostrap</span></a>
14
+ <div class="scrollbar scrollbar-use-navbar">…menu…</div>
15
+ </div></div>
16
+ </nav>
17
+ <div class="layout-content">
18
+ <header class="navbar navbar-expand-md navbar-content navbar-bar sticky-top">…breadcrumb, icons, user…</header>
19
+ <div class="container-fluid"><main>…</main></div>
20
+ </div>
21
+ </div>
22
+ ```
23
+
24
+
25
+ The layout comes in three combinations of the navbar and the brand of the sidebar, each with the navbar stuck to the top (`sticky-top`) or scrolling away with the page:
26
+
27
+ | Combination | Navbar | Brand |
28
+ |-------------|--------|-------|
29
+ | On the page: the navbar and the brand on the background of the page, the white menu below the brand as a panel with a rounded corner, in line with the first box | `navbar-content` | `sidebar-brand sidebar-brand-page` |
30
+ | The navbar on the page, a white sidebar | `navbar-content` | `sidebar-brand` |
31
+ | A white navbar and a white sidebar; a soft shadow under the navbar when the content scrolls under it | `navbar-content navbar-bar` | `sidebar-brand` |
32
+
33
+ The white navbar can take a color, together with the brand of the sidebar, so one colored strip runs over the top: `navbar-colored` and `sidebar-brand-colored` with a `theme-*` class (`theme-primary`, `theme-success`, `theme-danger`, `theme-info`, or `theme-gray`, a gray between the light secondary and dark). Its text and icons turn light, a status dot gets a light ring, and the nanobar takes the color of the navbar, lightened; the dropdowns in it keep the colors of the page.
34
+
35
+ ```html
36
+ <a class="sidebar-brand sidebar-brand-colored theme-primary" href="/">…</a>
37
+ <header class="navbar navbar-expand-md navbar-content navbar-bar navbar-colored theme-primary sticky-top">…</header>
38
+ ```
39
+
40
+ The demo has a *Customize* panel to try them.
41
+
42
+ Below `md`, where the sidebar is hidden, `navbar-brand-mobile` shows the brand in the navbar (as its first item; only the logo on phones under 360px); the open sidebar covers it with its own brand at the same place.
43
+
44
+ The layout with a navbar over the whole width (`wrapper-navbar-used wrapper-navbar-fixed`, `navbar fixed-top`) works too.
45
+
46
+ ## Sidebar
47
+
48
+ The sidebar is the element `#navigation`, its toggle button is `#sidebar`. On small screens it opens as an overlay over the page and takes the focus; closed, it stands outside the window and is `inert`, so the keyboard and a screen reader skip its links. The backdrop, a click on it, Escape and the focus that leaves it (Tab after its last link) close it, and the toggle reports its state in `aria-expanded`. From the `md` breakpoint up it stays in the layout.
49
+
50
+ | Description | Class |
51
+ |----------------------------------------------------|-----------------------------|
52
+ | Layout without a navbar | `wrapper` |
53
+ | Layout with a navbar | `wrapper-navbar-used` |
54
+ | Layout with a fixed navbar | `wrapper-navbar-fixed` |
55
+ | Rounded top right corner of the sidebar | `sidebar-rounded-top-right` |
56
+ | Fixed menu in the sidebar | `sidebar-menu-fixed` |
57
+ | Toggle visible on small screens (used by `Sidebar`) | `sidebar-toggle` |
58
+ | Toggle visible on all screens | `sidebar-toggle-visible` |
59
+
60
+ ## Sidebar menu
61
+
62
+ `SidebarMenuApp.init()` can be called again after menu items are added. It sets `aria-expanded` and `aria-controls` on submenu links, `aria-current="page"` on the current link, and opens a submenu at once; only its arrow rotates. Set `SidebarMenu.slideDuration = 200` (ms) before `init()` to slide submenus open instead; the slide is skipped when reduced motion is requested.
63
+
64
+ | Description | Class |
65
+ |-------------------------|----------------|
66
+ | Current item | `link-current` |
67
+ | Link with a submenu (without `href`, it becomes a button) | `link-arrow` |
68
+ | Hidden submenu | `list-hidden` |
69
+ | Shaking icon on hover | `bell` |
70
+
71
+ The colors of the menu come from the body color of Bootstrap (titles at 60 %, icons at 60 %, arrows at 85 %), so both themes work without settings; they can be changed by the `--sm-*` CSS variables, the sizes by the Sass variables in `src/scss/_variables.scss`. The pills of the links have `--sm-pill-border-radius`, `--sm-pill-icon-color`, `--sm-pill-link-bg` (the current page) and `--sm-pill-hover-bg` (a hovered link, a bit weaker).
72
+
73
+ ### Compact sidebar
74
+
75
+ From the `md` breakpoint up the sidebar can be narrowed to the icons of the first level (`$sm-compact-width`, 72px); a phone keeps its sliding menu. A button with `data-sidebar-compact` switches the class `sidebar-compact` of `<html>`, keeps its `aria-pressed` in line and remembers the choice in `localStorage` (`sidebar-compact`); it is handled by `Sidebar.init()`. In the compact sidebar:
76
+
77
+ - the brand shows only its logo, a section title becomes a short line, badges and submenus are hidden (a group holding the current page gets its pill);
78
+ - the name of a hovered or focused link is shown next to it in the colors of the tooltip;
79
+ - a link with a submenu opens its links in a menu of the theme next to the icon (the group name over them, the current page marked); it is closed by another click on the icon, a click outside, Esc or a scroll, and works by the keyboard like a dropdown (Enter or Space moves the focus into it, the arrows between the links, Tab leaves it to the next icon).
80
+
81
+ ```html
82
+ <html class="…">
83
+ <head>
84
+ <!-- the remembered compact sidebar before the page is drawn, so the menu does not jump -->
85
+ <script>try { if (localStorage.getItem('sidebar-compact') === '1') document.documentElement.classList.add('sidebar-compact'); } catch (e) { }</script>
86
+ </head>
87
+ …
88
+ <button type="button" class="navbar-icon" data-sidebar-compact aria-pressed="false" aria-label="Compact menu" data-tooltip="bottom">
89
+ <i class="bi bi-layout-sidebar" aria-hidden="true"></i>
90
+ </button>
91
+ ```
92
+
93
+ `Sidebar.setCompact(true|false)` sets it from a script, `Sidebar.isCompact()` tells whether the compact sidebar is shown.
94
+
95
+ ## Navbar
96
+
97
+ Icon buttons on the right of the navbar (module `dashboard`): `navbar-icon` is a quiet square for an icon, an icon with a short text (`navbar-icon-text`, e.g. the code of the language) widens it; tinted on hover and while its dropdown is open. A `status-dot` (module `elements`) marks that something waits; `status-dot-pulse` makes it pulse.
98
+
99
+ ```html
100
+ <button type="button" class="navbar-icon" aria-label="Toggle theme" data-tooltip="bottom" data-theme-switcher
101
+ data-theme-light-icon="bi bi-sun" data-theme-dark-icon="bi bi-moon"><i data-theme-switcher-icon class="bi bi-moon"></i></button>
102
+
103
+ <div class="dropdown">
104
+ <button type="button" class="navbar-icon" data-bs-toggle="dropdown" aria-label="Notifications">
105
+ <i class="bi bi-bell"></i><span class="status-dot status-dot-pulse theme-danger"></span>
106
+ <span class="navbar-icon-text d-none d-lg-inline">Notifications</span>
107
+ </button>
108
+ <ul class="dropdown-menu dropdown-menu-end">…</ul>
109
+ </div>
110
+
111
+ <div class="dropdown">
112
+ <button type="button" class="navbar-icon" data-bs-toggle="dropdown"><i class="bi bi-translate" aria-hidden="true"></i><span class="visually-hidden">Language: </span><span class="navbar-icon-text">EN</span></button>
113
+ <ul class="dropdown-menu dropdown-menu-end">
114
+ <li><a class="dropdown-item" href="...">Čeština</a></li>
115
+ <li><a class="dropdown-item active" href="..." aria-current="true">English</a></li>
116
+ </ul>
117
+ </div>
118
+ ```
119
+
120
+ The user sits in the navbar as `navbar-user`: an `avatar` (initials or a photo in a circle, in a `theme-*` color; `avatar-sm`, `avatar-lg`) with the name and the role, the account in its dropdown.
121
+
122
+ ## Content boxes and the older navbar
123
+
124
+ The navbar `navbar fixed-top` gets the page background, `navbar-nav-breadcrumb` separates its items by an arrow, and `content-box` is a box of the page content on the surface color.
125
+
126
+ ## Datagrid tables
127
+
128
+ A table of a datagrid stands in a `table-responsive`, so it scrolls inside its box on a narrow screen. The wrapper is `<div class="table-responsive" tabindex="0" role="region" aria-label="Articles">` (the name of the table): with `tabindex` the keyboard can scroll it in every browser, the role and the name tell a screen reader what the focused box is. The actions of a row are a menu: three vertical dots open a dropdown with the items, delete last after a divider. The button needs `data-bs-popper-config='{"strategy":"fixed"}'`, or the scrolling wrapper cuts the menu off.
129
+
130
+ ```html
131
+ <td class="text-end">
132
+ <div class="dropdown">
133
+ <button type="button" class="btn btn-xs btn-icon btn-text" data-bs-toggle="dropdown" data-bs-popper-config='{"strategy":"fixed"}' aria-expanded="false" aria-label="Actions"><i class="bi bi-three-dots-vertical" aria-hidden="true"></i></button>
134
+ <ul class="dropdown-menu dropdown-menu-end">
135
+ <li><a class="dropdown-item" href="..."><i class="bi bi-pencil me-2" aria-hidden="true"></i>Edit</a></li>
136
+ <li><hr class="dropdown-divider"></li>
137
+ <li><a class="dropdown-item text-danger" href="..."><i class="bi bi-trash me-2" aria-hidden="true"></i>Delete</a></li>
138
+ </ul>
139
+ </div>
140
+ </td>
141
+ ```
142
+
143
+ A datagrid can also open an item by a click on its row (`datagrid-row-clickable` on the `tr` and `row-click.js` of drago-ex/datagrid; compostrap has no script for it). Use it only with icon buttons as the row actions (`btn btn-xs btn-icon` with a `data-tooltip`), never with the menu of three dots: a click that misses the small button of the menu lands on the row and opens the item instead of the menu.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compostrap",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
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
5
  "type": "module",
6
6
  "license": "MIT",