compostrap 1.1.0 → 1.1.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.
@@ -4389,13 +4389,6 @@ body {
4389
4389
  .list-link:hover {
4390
4390
  text-decoration: none;
4391
4391
  }
4392
- @media (prefers-reduced-motion: no-preference) {
4393
- .list-link:hover .bell {
4394
- animation: bell-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
4395
- backface-visibility: hidden;
4396
- transform-origin: top right;
4397
- }
4398
- }
4399
4392
  .list .list-hidden {
4400
4393
  display: none;
4401
4394
  overflow: hidden;
@@ -4409,35 +4402,6 @@ body {
4409
4402
  .list-hidden .list-hidden .list-link {
4410
4403
  padding-left: 4.375rem;
4411
4404
  }
4412
- @keyframes bell-shake {
4413
- 0% {
4414
- transform: rotate(0);
4415
- }
4416
- 15% {
4417
- transform: rotate(5deg);
4418
- }
4419
- 30% {
4420
- transform: rotate(-5deg);
4421
- }
4422
- 45% {
4423
- transform: rotate(4deg);
4424
- }
4425
- 60% {
4426
- transform: rotate(-4deg);
4427
- }
4428
- 75% {
4429
- transform: rotate(2deg);
4430
- }
4431
- 85% {
4432
- transform: rotate(-2deg);
4433
- }
4434
- 92% {
4435
- transform: rotate(1deg);
4436
- }
4437
- 100% {
4438
- transform: rotate(0);
4439
- }
4440
- }
4441
4405
  .list-icon {
4442
4406
  display: inline-block;
4443
4407
  width: 1.5rem;
@@ -23,13 +23,6 @@
23
23
  .list-link:hover {
24
24
  text-decoration: none;
25
25
  }
26
- @media (prefers-reduced-motion: no-preference) {
27
- .list-link:hover .bell {
28
- animation: bell-shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
29
- backface-visibility: hidden;
30
- transform-origin: top right;
31
- }
32
- }
33
26
  .list .list-hidden {
34
27
  display: none;
35
28
  overflow: hidden;
@@ -43,35 +36,6 @@
43
36
  .list-hidden .list-hidden .list-link {
44
37
  padding-left: 4.375rem;
45
38
  }
46
- @keyframes bell-shake {
47
- 0% {
48
- transform: rotate(0);
49
- }
50
- 15% {
51
- transform: rotate(5deg);
52
- }
53
- 30% {
54
- transform: rotate(-5deg);
55
- }
56
- 45% {
57
- transform: rotate(4deg);
58
- }
59
- 60% {
60
- transform: rotate(-4deg);
61
- }
62
- 75% {
63
- transform: rotate(2deg);
64
- }
65
- 85% {
66
- transform: rotate(-2deg);
67
- }
68
- 92% {
69
- transform: rotate(1deg);
70
- }
71
- 100% {
72
- transform: rotate(0);
73
- }
74
- }
75
39
  .list-icon {
76
40
  display: inline-block;
77
41
  width: 1.5rem;
@@ -5384,8 +5384,8 @@ textarea.form-control-lg {
5384
5384
  --bs-modal-title-line-height: 1.4285714286;
5385
5385
  --bs-modal-footer-gap: 0.5rem;
5386
5386
  --bs-modal-footer-bg: ;
5387
- --bs-modal-footer-border-color: var(--bs-border-color-translucent);
5388
- --bs-modal-footer-border-width: 1px;
5387
+ --bs-modal-footer-border-color: var(--bs-border-color);
5388
+ --bs-modal-footer-border-width: 0;
5389
5389
  position: fixed;
5390
5390
  top: 0;
5391
5391
  left: 0;
@@ -12943,8 +12943,22 @@ button.badge.badge-subtle.show {
12943
12943
  translate: none;
12944
12944
  }
12945
12945
  }
12946
+ .offcanvas-header,
12947
+ .modal-header {
12948
+ padding-inline: 0;
12949
+ border-bottom: var(--bs-border-width) solid var(--bs-border-color);
12950
+ }
12951
+ .offcanvas-header > .btn-close,
12952
+ .modal-header > .btn-close {
12953
+ margin-right: 0;
12954
+ }
12955
+
12946
12956
  .offcanvas-header {
12947
- border-bottom: 0;
12957
+ margin-inline: var(--bs-offcanvas-padding-x);
12958
+ }
12959
+
12960
+ .modal-header {
12961
+ margin-inline: var(--bs-modal-header-padding-x);
12948
12962
  }
12949
12963
 
12950
12964
  .modal-content {
package/docs/layout.md CHANGED
@@ -1,143 +1,142 @@
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
+
70
+ 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).
71
+
72
+ ### Compact sidebar
73
+
74
+ 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:
75
+
76
+ - 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);
77
+ - the name of a hovered or focused link is shown next to it in the colors of the tooltip;
78
+ - 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).
79
+
80
+ ```html
81
+ <html class="…">
82
+ <head>
83
+ <!-- the remembered compact sidebar before the page is drawn, so the menu does not jump -->
84
+ <script>try { if (localStorage.getItem('sidebar-compact') === '1') document.documentElement.classList.add('sidebar-compact'); } catch (e) { }</script>
85
+ </head>
86
+ …
87
+ <button type="button" class="navbar-icon" data-sidebar-compact aria-pressed="false" aria-label="Compact menu" data-tooltip="bottom">
88
+ <i class="bi bi-layout-sidebar" aria-hidden="true"></i>
89
+ </button>
90
+ ```
91
+
92
+ `Sidebar.setCompact(true|false)` sets it from a script, `Sidebar.isCompact()` tells whether the compact sidebar is shown.
93
+
94
+ ## Navbar
95
+
96
+ 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.
97
+
98
+ ```html
99
+ <button type="button" class="navbar-icon" aria-label="Toggle theme" data-tooltip="bottom" data-theme-switcher
100
+ 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>
101
+
102
+ <div class="dropdown">
103
+ <button type="button" class="navbar-icon" data-bs-toggle="dropdown" aria-label="Notifications">
104
+ <i class="bi bi-bell"></i><span class="status-dot status-dot-pulse theme-danger"></span>
105
+ <span class="navbar-icon-text d-none d-lg-inline">Notifications</span>
106
+ </button>
107
+ <ul class="dropdown-menu dropdown-menu-end">…</ul>
108
+ </div>
109
+
110
+ <div class="dropdown">
111
+ <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>
112
+ <ul class="dropdown-menu dropdown-menu-end">
113
+ <li><a class="dropdown-item" href="...">Čeština</a></li>
114
+ <li><a class="dropdown-item active" href="..." aria-current="true">English</a></li>
115
+ </ul>
116
+ </div>
117
+ ```
118
+
119
+ 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.
120
+
121
+ ## Content boxes and the older navbar
122
+
123
+ 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.
124
+
125
+ ## Datagrid tables
126
+
127
+ 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.
128
+
129
+ ```html
130
+ <td class="text-end">
131
+ <div class="dropdown">
132
+ <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>
133
+ <ul class="dropdown-menu dropdown-menu-end">
134
+ <li><a class="dropdown-item" href="..."><i class="bi bi-pencil me-2" aria-hidden="true"></i>Edit</a></li>
135
+ <li><hr class="dropdown-divider"></li>
136
+ <li><a class="dropdown-item text-danger" href="..."><i class="bi bi-trash me-2" aria-hidden="true"></i>Delete</a></li>
137
+ </ul>
138
+ </div>
139
+ </td>
140
+ ```
141
+
142
+ 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/docs/theme.md CHANGED
@@ -1,100 +1,100 @@
1
- # Theme
2
-
3
- [← Compostrap](../readme.md#documentation)
4
-
5
- The theme changes the components of Bootstrap and adds the classes of Bootstrap 6; there are no classes of its own besides the size modifiers `badge-sm` and `form-check-sm` and `btn-group-segmented`.
6
-
7
- ## Colors, buttons, alerts and badges
8
-
9
- The theme uses the colors of Bootstrap 6 (a lighter blue, livelier green, red and cyan). Badges look like in Bootstrap 6 and take its classes, so the markup stays valid after the upgrade: a `theme-*` class gives the color (`theme-primary`, `theme-success`, `theme-danger`, `theme-warning`, `theme-info`, `theme-secondary`…), `badge-subtle` and `badge-outline` the variant.
10
-
11
- ```html
12
- <span class="badge theme-primary">New</span>
13
- <span class="badge badge-subtle theme-primary">New</span>
14
- <span class="badge badge-outline theme-primary">New</span>
15
- <span class="badge badge-subtle">Draft</span> <!-- gray without a color -->
16
- ```
17
-
18
- Buttons and alerts take the colors of Bootstrap 6 too. Buttons darken a little on hover; outline buttons have a light border in the color, `btn-secondary` is a light gray button. The new variants of Bootstrap 6 work with a `theme-*` class:
19
-
20
- ```html
21
- <button class="btn btn-primary">Save</button> <!-- the same as btn-solid theme-primary -->
22
- <button class="btn btn-outline-primary">Preview</button>
23
- <button class="btn btn-subtle theme-primary">Duplicate</button>
24
- <button class="btn btn-text theme-danger">Delete</button>
25
- <a class="btn btn-xs btn-icon btn-outline-secondary" aria-label="Edit" data-tooltip><i class="bi bi-pencil"></i></a> <!-- 24px square icon button -->
26
- <div class="alert alert-success">The order was paid.</div> <!-- or alert theme-success -->
27
- ```
28
-
29
- Alerts are the text of the color on its light tint, without a border. A `theme-*` class (and `btn-primary`, `btn-outline-primary`, `alert-primary`…) sets the CSS variables `--theme-bg`, `--theme-contrast`, `--theme-fg`, `--theme-fg-emphasis`, `--theme-bg-subtle`, `--theme-bg-muted` and `--theme-border` of its color, also for the dark theme.
30
-
31
- ## Breadcrumb
32
-
33
- The theme has the breadcrumb of Bootstrap 6 with its markup: links with a quiet pill on hover, a thin chevron as a separate divider, the current page in the body color.
34
-
35
- ```html
36
- <ol class="breadcrumb">
37
- <li class="breadcrumb-item"><a class="breadcrumb-link" href="...">Dashboard</a></li>
38
- <li class="breadcrumb-divider" aria-hidden="true"></li>
39
- <li class="breadcrumb-item"><a class="breadcrumb-link active" aria-current="page">Blog articles</a></li>
40
- </ol>
41
- ```
42
-
43
- ## Tabs as a segmented control
44
-
45
- With the theme a button group with `role="tablist"` (or the class `btn-group-segmented`) looks like a segmented control: a quiet track with the active tab raised on it.
46
-
47
- ```html
48
- <div class="btn-group" role="tablist">
49
- <button class="btn btn-secondary btn-sm active" type="button" role="tab" data-bs-toggle="pill" data-bs-target="#tab-1">Product</button>
50
- <button class="btn btn-secondary btn-sm" type="button" role="tab" data-bs-toggle="pill" data-bs-target="#tab-2">Variants</button>
51
- </div>
52
- ```
53
-
54
- ## Forms
55
-
56
- An icon or a unit stands inside its field: the form adorn of Bootstrap 6. The wrapper is a `<label>` with `form-control form-adorn` (a click anywhere in it focuses the field), the field inside is a `form-ghost`; `form-adorn-end` moves the adornment to the end, `form-control-sm` and `form-control-lg` size it. Adornments are decorative (`aria-hidden`), and a button does not belong inside a label: a button or a select next to a field stays an `input-group`.
57
-
58
- ```html
59
- <label class="form-control form-adorn">
60
- <span class="form-adorn-icon" aria-hidden="true"><i class="bi bi-search"></i></span>
61
- <input type="search" class="form-ghost" placeholder="Search" aria-label="Search">
62
- </label>
63
-
64
- <label for="price" class="form-label">Price</label>
65
- <label class="form-control form-adorn">
66
- <span class="form-adorn-text" aria-hidden="true">$</span>
67
- <input type="number" class="form-ghost" id="price">
68
- </label>
69
-
70
- <label class="form-control form-adorn form-adorn-end">
71
- <span class="form-adorn-text" aria-hidden="true">%</span>
72
- <input type="number" class="form-ghost" aria-label="Discount">
73
- </label>
74
- ```
75
-
76
- The variables `--form-adorn-gap`, `--form-adorn-icon-size` and `--form-adorn-icon-color` tune it.
77
-
78
- Checks, radios and switches are 20px; `form-check-sm` makes them 16px (a 28 × 16px switch), on the wrapper or on a check without one:
79
-
80
- ```html
81
- <div class="form-check form-check-sm">
82
- <input class="form-check-input" type="checkbox" id="terms">
83
- <label class="form-check-label" for="terms">I agree</label>
84
- </div>
85
- <div class="form-check form-check-sm form-switch">…</div>
86
- <input class="form-check-input form-check-sm" type="checkbox" aria-label="Select the row">
87
- ```
88
-
89
- On an iPhone or an iPad the text of a field is 16px instead of 14px (12px in the small size): Safari of iOS zooms the page in when a field with a smaller text gets the focus. The rule is inside `@supports (-webkit-touch-callout: none)`, which only iOS matches; the line keeps its height, so the fields are as high as elsewhere. The number of `number-input` does the same.
90
-
91
- A field with an error of the server (`is-invalid`) also says it to a screen reader: `aria-invalid="true"` and `aria-describedby` with the `id` of its `invalid-feedback`.
92
-
93
- ```html
94
- <input type="email" class="form-control is-invalid" id="email" aria-invalid="true" aria-describedby="email-error">
95
- <div class="invalid-feedback" id="email-error">Please enter a valid e-mail.</div>
96
- ```
97
-
98
- ## Offcanvas and modals
99
-
100
- An offcanvas floats: it keeps a gap of 8px from the edges of the window, has rounded corners and a shadow instead of a border. `offcanvas-flush` keeps a panel stuck to the edge. A modal has no border, a shadow and a light line above the footer. Dropdowns have no border and a soft shadow, the chosen item is tinted instead of filled with the primary color. A toast follows the modals: no border, an opaque surface (a lighter one in the dark theme), larger corners and a shadow.
1
+ # Theme
2
+
3
+ [← Compostrap](../readme.md#documentation)
4
+
5
+ The theme changes the components of Bootstrap and adds the classes of Bootstrap 6; there are no classes of its own besides the size modifiers `badge-sm` and `form-check-sm` and `btn-group-segmented`.
6
+
7
+ ## Colors, buttons, alerts and badges
8
+
9
+ The theme uses the colors of Bootstrap 6 (a lighter blue, livelier green, red and cyan). Badges look like in Bootstrap 6 and take its classes, so the markup stays valid after the upgrade: a `theme-*` class gives the color (`theme-primary`, `theme-success`, `theme-danger`, `theme-warning`, `theme-info`, `theme-secondary`…), `badge-subtle` and `badge-outline` the variant.
10
+
11
+ ```html
12
+ <span class="badge theme-primary">New</span>
13
+ <span class="badge badge-subtle theme-primary">New</span>
14
+ <span class="badge badge-outline theme-primary">New</span>
15
+ <span class="badge badge-subtle">Draft</span> <!-- gray without a color -->
16
+ ```
17
+
18
+ Buttons and alerts take the colors of Bootstrap 6 too. Buttons darken a little on hover; outline buttons have a light border in the color, `btn-secondary` is a light gray button. The new variants of Bootstrap 6 work with a `theme-*` class:
19
+
20
+ ```html
21
+ <button class="btn btn-primary">Save</button> <!-- the same as btn-solid theme-primary -->
22
+ <button class="btn btn-outline-primary">Preview</button>
23
+ <button class="btn btn-subtle theme-primary">Duplicate</button>
24
+ <button class="btn btn-text theme-danger">Delete</button>
25
+ <a class="btn btn-xs btn-icon btn-outline-secondary" aria-label="Edit" data-tooltip><i class="bi bi-pencil"></i></a> <!-- 24px square icon button -->
26
+ <div class="alert alert-success">The order was paid.</div> <!-- or alert theme-success -->
27
+ ```
28
+
29
+ Alerts are the text of the color on its light tint, without a border. A `theme-*` class (and `btn-primary`, `btn-outline-primary`, `alert-primary`…) sets the CSS variables `--theme-bg`, `--theme-contrast`, `--theme-fg`, `--theme-fg-emphasis`, `--theme-bg-subtle`, `--theme-bg-muted` and `--theme-border` of its color, also for the dark theme.
30
+
31
+ ## Breadcrumb
32
+
33
+ The theme has the breadcrumb of Bootstrap 6 with its markup: links with a quiet pill on hover, a thin chevron as a separate divider, the current page in the body color.
34
+
35
+ ```html
36
+ <ol class="breadcrumb">
37
+ <li class="breadcrumb-item"><a class="breadcrumb-link" href="...">Dashboard</a></li>
38
+ <li class="breadcrumb-divider" aria-hidden="true"></li>
39
+ <li class="breadcrumb-item"><a class="breadcrumb-link active" aria-current="page">Blog articles</a></li>
40
+ </ol>
41
+ ```
42
+
43
+ ## Tabs as a segmented control
44
+
45
+ With the theme a button group with `role="tablist"` (or the class `btn-group-segmented`) looks like a segmented control: a quiet track with the active tab raised on it.
46
+
47
+ ```html
48
+ <div class="btn-group" role="tablist">
49
+ <button class="btn btn-secondary btn-sm active" type="button" role="tab" data-bs-toggle="pill" data-bs-target="#tab-1">Product</button>
50
+ <button class="btn btn-secondary btn-sm" type="button" role="tab" data-bs-toggle="pill" data-bs-target="#tab-2">Variants</button>
51
+ </div>
52
+ ```
53
+
54
+ ## Forms
55
+
56
+ An icon or a unit stands inside its field: the form adorn of Bootstrap 6. The wrapper is a `<label>` with `form-control form-adorn` (a click anywhere in it focuses the field), the field inside is a `form-ghost`; `form-adorn-end` moves the adornment to the end, `form-control-sm` and `form-control-lg` size it. Adornments are decorative (`aria-hidden`), and a button does not belong inside a label: a button or a select next to a field stays an `input-group`.
57
+
58
+ ```html
59
+ <label class="form-control form-adorn">
60
+ <span class="form-adorn-icon" aria-hidden="true"><i class="bi bi-search"></i></span>
61
+ <input type="search" class="form-ghost" placeholder="Search" aria-label="Search">
62
+ </label>
63
+
64
+ <label for="price" class="form-label">Price</label>
65
+ <label class="form-control form-adorn">
66
+ <span class="form-adorn-text" aria-hidden="true">$</span>
67
+ <input type="number" class="form-ghost" id="price">
68
+ </label>
69
+
70
+ <label class="form-control form-adorn form-adorn-end">
71
+ <span class="form-adorn-text" aria-hidden="true">%</span>
72
+ <input type="number" class="form-ghost" aria-label="Discount">
73
+ </label>
74
+ ```
75
+
76
+ The variables `--form-adorn-gap`, `--form-adorn-icon-size` and `--form-adorn-icon-color` tune it.
77
+
78
+ Checks, radios and switches are 20px; `form-check-sm` makes them 16px (a 28 × 16px switch), on the wrapper or on a check without one:
79
+
80
+ ```html
81
+ <div class="form-check form-check-sm">
82
+ <input class="form-check-input" type="checkbox" id="terms">
83
+ <label class="form-check-label" for="terms">I agree</label>
84
+ </div>
85
+ <div class="form-check form-check-sm form-switch">…</div>
86
+ <input class="form-check-input form-check-sm" type="checkbox" aria-label="Select the row">
87
+ ```
88
+
89
+ On an iPhone or an iPad the text of a field is 16px instead of 14px (12px in the small size): Safari of iOS zooms the page in when a field with a smaller text gets the focus. The rule is inside `@supports (-webkit-touch-callout: none)`, which only iOS matches; the line keeps its height, so the fields are as high as elsewhere. The number of `number-input` does the same.
90
+
91
+ A field with an error of the server (`is-invalid`) also says it to a screen reader: `aria-invalid="true"` and `aria-describedby` with the `id` of its `invalid-feedback`.
92
+
93
+ ```html
94
+ <input type="email" class="form-control is-invalid" id="email" aria-invalid="true" aria-describedby="email-error">
95
+ <div class="invalid-feedback" id="email-error">Please enter a valid e-mail.</div>
96
+ ```
97
+
98
+ ## Offcanvas and modals
99
+
100
+ An offcanvas floats: it keeps a gap of 8px from the edges of the window, has rounded corners and a shadow instead of a border; a light line under its header goes from the title to the close button only, like the header of a content box. `offcanvas-flush` keeps a panel stuck to the edge. A modal has no border and a shadow; its header has the same short line, the footer none. Dropdowns have no border and a soft shadow, the chosen item is tinted instead of filled with the primary color. A toast follows the modals: no border, an opaque surface (a lighter one in the dark theme), larger corners and a shadow.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compostrap",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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",
@@ -32,15 +32,6 @@
32
32
  // never underlined, also when the theme (or a project) underlines links on hover
33
33
  &:hover {
34
34
  text-decoration: none;
35
-
36
- // the bell shakes only for a user who has not asked the system for less motion
37
- @media (prefers-reduced-motion: no-preference) {
38
- .bell {
39
- animation: bell-shake .5s cubic-bezier(.36, .07, .19, .97) both;
40
- backface-visibility: hidden;
41
- transform-origin: top right;
42
- }
43
- }
44
35
  }
45
36
  }
46
37
 
@@ -62,18 +53,6 @@
62
53
  padding-left: var.$sm-link-padding-x + var.$sm-icon-width + var.$sm-icon-gap + var.$sm-sub-indent;
63
54
  }
64
55
 
65
- @keyframes bell-shake {
66
- 0% { transform: rotate(0); }
67
- 15% { transform: rotate(5deg); }
68
- 30% { transform: rotate(-5deg); }
69
- 45% { transform: rotate(4deg); }
70
- 60% { transform: rotate(-4deg); }
71
- 75% { transform: rotate(2deg); }
72
- 85% { transform: rotate(-2deg); }
73
- 92% { transform: rotate(1deg); }
74
- 100% { transform: rotate(0); }
75
- }
76
-
77
56
  &-icon {
78
57
  display: inline-block;
79
58
  width: var.$sm-icon-width;
@@ -2,8 +2,8 @@
2
2
  // theme: offcanvas, modals, dropdowns and toasts
3
3
  //
4
4
 
5
- // offcanvas floats: a gap from the edges of the window, rounded corners and a shadow instead of a border
6
- // (also the line under the header is left out); .offcanvas-flush keeps the panel stuck to the edge. The responsive
5
+ // offcanvas floats: a gap from the edges of the window, rounded corners and a shadow instead of a border;
6
+ // .offcanvas-flush keeps the panel stuck to the edge. The responsive
7
7
  // ones (.offcanvas-lg, …) float below their breakpoint, where they are a panel
8
8
  @mixin cs-offcanvas-float {
9
9
  --cs-offcanvas-margin: .5rem;
@@ -52,8 +52,24 @@
52
52
  }
53
53
  }
54
54
 
55
+ // the line under the header of an offcanvas or a modal goes from the title to the close button only, like the header
56
+ // of a content box; the close button keeps its edge, so the line ends at its cross
57
+ .offcanvas-header,
58
+ .modal-header {
59
+ padding-inline: 0;
60
+ border-bottom: var(--bs-border-width) solid var(--bs-border-color);
61
+
62
+ > .btn-close {
63
+ margin-right: 0;
64
+ }
65
+ }
66
+
55
67
  .offcanvas-header {
56
- border-bottom: 0;
68
+ margin-inline: var(--bs-offcanvas-padding-x);
69
+ }
70
+
71
+ .modal-header {
72
+ margin-inline: var(--bs-modal-header-padding-x);
57
73
  }
58
74
 
59
75
  // a modal lifts by a shadow (Bootstrap adds it only with $enable-shadows)
@@ -143,11 +143,10 @@ $accordion-icon-width: 1rem !default;
143
143
  $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;
144
144
  $accordion-button-active-icon-dark: $accordion-button-icon-dark !default;
145
145
 
146
- // modals: no border around the window and under the header, a light line above the footer
146
+ // modals: no border around the window and above the footer; the line under the header is in _overlays.scss
147
147
  $modal-content-border-width: 0 !default;
148
148
  $modal-header-border-width: 0 !default;
149
- $modal-footer-border-width: 1px !default;
150
- $modal-footer-border-color: var(--bs-border-color-translucent) !default;
149
+ $modal-footer-border-width: 0 !default;
151
150
 
152
151
  // tables: more air in the rows, also in the small table of a datagrid; a quiet hover
153
152
  $table-cell-padding-y: .625rem !default;