compostrap 1.0.4 → 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.
- package/dist/css/compostrap.css +119 -36
- package/dist/css/sidebar-menu.css +0 -36
- package/dist/css/sortable.css +119 -0
- package/dist/css/theme.css +39 -8
- package/dist/js/index.js +7 -6
- package/dist/js/sortable.js +181 -0
- package/docs/blog.md +85 -85
- package/docs/layout.md +0 -1
- package/docs/sortable.md +59 -0
- package/docs/theme.md +100 -100
- package/package.json +2 -1
- package/readme.md +199 -198
- package/src/js/datepicker.js +154 -154
- package/src/js/index.js +2 -1
- package/src/js/sortable.js +408 -0
- package/src/scss/compostrap.scss +1 -0
- package/src/scss/datagrid.scss +5 -5
- package/src/scss/datepicker/_index.scss +557 -557
- package/src/scss/sidebar/_index.scss +8 -8
- package/src/scss/sidebar-menu/_list.scss +0 -21
- package/src/scss/sortable/_index.scss +158 -0
- package/src/scss/sortable.scss +5 -0
- package/src/scss/theme/_overlays.scss +19 -3
- package/src/scss/theme/_tables.scss +60 -60
- package/src/scss/theme/_variables.scss +2 -3
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
|
@@ -66,7 +66,6 @@ The sidebar is the element `#navigation`, its toggle button is `#sidebar`. On sm
|
|
|
66
66
|
| Current item | `link-current` |
|
|
67
67
|
| Link with a submenu (without `href`, it becomes a button) | `link-arrow` |
|
|
68
68
|
| Hidden submenu | `list-hidden` |
|
|
69
|
-
| Shaking icon on hover | `bell` |
|
|
70
69
|
|
|
71
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).
|
|
72
71
|
|
package/docs/sortable.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Sortable
|
|
2
|
+
|
|
3
|
+
[← Compostrap](../readme.md#documentation)
|
|
4
|
+
|
|
5
|
+
Items of a list moved by a handle of dots: by the mouse, a finger or the keyboard. Made for the order of the menu of the administration (the links the packages add, put in order by the user), the photos of a product or any rows of a list.
|
|
6
|
+
|
|
7
|
+
- `sortable` is the list, its direct children `sortable-item` are the items. A `list-group` of Bootstrap gives the rows their look; the module only lays out an item as a row (the handle, then the content).
|
|
8
|
+
- `sortable-handle` is a button with six dots, drawn by the module (no icon font). Only the handle starts a move, so the rest of an item stays a link, a text to select or a form.
|
|
9
|
+
- `data-sortable-group` lets the items move between all lists of the same group (the sections of the menu). A list without a group keeps its items.
|
|
10
|
+
- `sortable-nested` is a list inside an item, one level deeper (the links of a group of the menu). An item that holds a nested list is not dropped into another nested list, so there are at most two levels.
|
|
11
|
+
- `data-sortable-empty` is the text of an empty list, which stays a place to drop on.
|
|
12
|
+
- `data-id` of an item is what `SortableList.serialize()` returns.
|
|
13
|
+
|
|
14
|
+
While moving, the item stays in the list as a tinted place with a dashed line (`sortable-placeholder`) and a copy follows the pointer (`sortable-ghost`); the other items slide to their new places. An item grabbed by the keyboard is `sortable-grabbed` and its handle `aria-pressed="true"`.
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<ul class="list-group sortable" data-sortable-group="menu" data-sortable-empty="Drop a link here">
|
|
18
|
+
<li class="list-group-item sortable-item" data-id="blog">
|
|
19
|
+
<button type="button" class="sortable-handle" aria-label="Move Blog"></button>
|
|
20
|
+
<i class="bi bi-journal-text" aria-hidden="true"></i>
|
|
21
|
+
<span class="list-row-text">Blog</span>
|
|
22
|
+
<ul class="list-group sortable sortable-nested" data-sortable-group="menu" data-sortable-empty="Drop a link here">
|
|
23
|
+
<li class="list-group-item sortable-item" data-id="blog.articles">
|
|
24
|
+
<button type="button" class="sortable-handle" aria-label="Move Articles"></button>
|
|
25
|
+
<span class="list-row-text">Articles</span>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</li>
|
|
29
|
+
<li class="list-group-item sortable-item" data-id="pages">
|
|
30
|
+
<button type="button" class="sortable-handle" aria-label="Move Pages"></button>
|
|
31
|
+
<i class="bi bi-file-earmark-text" aria-hidden="true"></i>
|
|
32
|
+
<span class="list-row-text">Pages</span>
|
|
33
|
+
</li>
|
|
34
|
+
</ul>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## JavaScript
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import { SortableList } from 'compostrap'; // or 'compostrap/sortable'
|
|
41
|
+
|
|
42
|
+
SortableList.init();
|
|
43
|
+
|
|
44
|
+
document.addEventListener('change.bs.sortable', (event) => {
|
|
45
|
+
const { item, from, to, oldIndex, newIndex } = event.detail;
|
|
46
|
+
// e.g. send the new order: SortableList.serialize(list)
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- `SortableList.init()` once; it listens on the document, so lists drawn later (an AJAX snippet) need nothing more.
|
|
51
|
+
- `change.bs.sortable` bubbles from the moved item after a drop that changed the order (not after a drop at the same place or a cancel).
|
|
52
|
+
- `SortableList.serialize(list)` gives the order as `[{ id: 'blog', children: [{ id: 'blog.articles' }] }, { id: 'pages' }]`.
|
|
53
|
+
- Keyboard: Space or Enter on a handle grabs the item, the arrows move it (at the end of a list into the next or the previous list of its group), Space or Enter drops it, Escape puts it back, Tab away drops it where it is. Escape also cancels a drag of the mouse.
|
|
54
|
+
- Screen readers hear every step from a live region (`sortable-live`). The texts are in `SortableList.messages` (`{item}`, `{position}`, `{count}`); the name of an item is its `data-sortable-label`, or the `aria-label` of its handle without the word Move, or its text.
|
|
55
|
+
- `SortableList.duration` is the time of the sliding of the other items (150 ms, 0 turns it off; nothing slides with reduced motion), `SortableList.scrollEdge` the distance from the edge of the window where it scrolls while dragging (48 px).
|
|
56
|
+
|
|
57
|
+
## Variables
|
|
58
|
+
|
|
59
|
+
`--sortable-handle-size`, `--sortable-handle-color`, `--sortable-place-bg`, `--sortable-place-line` (the tint and the line of the place and of a grabbed item) and `--sortable-indent` (the indent of a nested list) are set on `.sortable`.
|
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
|
|
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.
|
|
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",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"./number-input": "./dist/js/number-input.js",
|
|
53
53
|
"./otp-input": "./dist/js/otp-input.js",
|
|
54
54
|
"./selection": "./dist/js/selection.js",
|
|
55
|
+
"./sortable": "./dist/js/sortable.js",
|
|
55
56
|
"./datepicker": "./dist/js/datepicker.js",
|
|
56
57
|
"./chart": "./dist/js/chart.js",
|
|
57
58
|
"./spinner": "./dist/js/spinner.js",
|