compostrap 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- //
2
- // sidebar skeleton
3
- //
4
-
5
- @use 'body';
6
- @use 'wrapper';
7
- @use 'sidebar';
8
- @use 'theme';
1
+ //
2
+ // sidebar skeleton
3
+ //
4
+
5
+ @use 'body';
6
+ @use 'wrapper';
7
+ @use 'sidebar';
8
+ @use 'theme';
@@ -0,0 +1,158 @@
1
+ //
2
+ // sortable: items of a list moved by a handle of dots (the mouse, a finger or the keyboard), e.g. the order of the
3
+ // menu of the administration, of the photos of a product or of the rows of a list
4
+ //
5
+ // <ul class="list-group sortable" data-sortable-group="menu">
6
+ // <li class="list-group-item sortable-item" data-id="blog.articles">
7
+ // <button type="button" class="sortable-handle" aria-label="Move Articles"></button>
8
+ // …the content of the row
9
+ // </li>
10
+ // </ul>
11
+ //
12
+ // The handle draws its six dots itself (no icon font). The script SortableList moves the items: the item being
13
+ // dragged stays in the list as a tinted place (sortable-placeholder) and a copy follows the pointer
14
+ // (sortable-ghost); an item grabbed by the keyboard is tinted (sortable-grabbed). A list inside an item
15
+ // (sortable-nested) is one level deeper, e.g. the links of a group of the menu; an empty list shows its
16
+ // data-sortable-empty text, so there is a place to drop on.
17
+ //
18
+
19
+ // two columns of three dots
20
+ $-grip: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3e%3cg fill='black'%3e%3ccircle cx='2.5' cy='3' r='1.5'/%3e%3ccircle cx='7.5' cy='3' r='1.5'/%3e%3ccircle cx='2.5' cy='8' r='1.5'/%3e%3ccircle cx='7.5' cy='8' r='1.5'/%3e%3ccircle cx='2.5' cy='13' r='1.5'/%3e%3ccircle cx='7.5' cy='13' r='1.5'/%3e%3c/g%3e%3c/svg%3e");
21
+
22
+ .sortable {
23
+ --sortable-handle-size: 1.75rem;
24
+ --sortable-handle-color: color-mix(in srgb, var(--bs-secondary-color) 70%, transparent);
25
+ --sortable-place-bg: rgba(var(--bs-primary-rgb), .06);
26
+ --sortable-place-line: rgba(var(--bs-primary-rgb), .45);
27
+ --sortable-indent: 2.5rem;
28
+ }
29
+
30
+ .sortable-item {
31
+ display: flex;
32
+ gap: .75rem;
33
+ align-items: center;
34
+ }
35
+
36
+ // the handle: a button with the dots, the cursor of a hand that grabs
37
+ .sortable-handle {
38
+ display: inline-flex;
39
+ flex-shrink: 0;
40
+ align-items: center;
41
+ align-self: flex-start;
42
+ justify-content: center;
43
+ width: var(--sortable-handle-size, 1.75rem);
44
+ height: var(--sortable-handle-size, 1.75rem);
45
+ // the first row of an item is about as tall as the avatar or the icon next to the handle
46
+ margin-block: .125rem;
47
+ padding: 0;
48
+ cursor: grab;
49
+ touch-action: none;
50
+ background: none;
51
+ border: 0;
52
+ border-radius: var(--bs-border-radius-sm);
53
+
54
+ &::before {
55
+ width: .625rem;
56
+ height: 1rem;
57
+ content: '';
58
+ background-color: var(--sortable-handle-color, var(--bs-secondary-color));
59
+ mask: $-grip no-repeat center / contain;
60
+ }
61
+
62
+ &:hover::before,
63
+ &[aria-pressed='true']::before {
64
+ background-color: var(--bs-emphasis-color);
65
+ }
66
+
67
+ &:hover {
68
+ background-color: rgba(var(--bs-body-color-rgb), .05);
69
+ }
70
+
71
+ &:focus {
72
+ outline: 0;
73
+ }
74
+
75
+ &:focus-visible {
76
+ box-shadow: var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color);
77
+ }
78
+ }
79
+
80
+ // the place the dragged item will drop to: a tint and a dashed line, the content stays for its height only
81
+ .sortable-placeholder {
82
+ background-color: var(--sortable-place-bg) !important;
83
+ outline: 1px dashed var(--sortable-place-line);
84
+ outline-offset: -1px;
85
+
86
+ > * {
87
+ visibility: hidden;
88
+ }
89
+ }
90
+
91
+ // the item grabbed by the keyboard (Space): moved by the arrows
92
+ .sortable-grabbed {
93
+ position: relative;
94
+ z-index: 2;
95
+ background-color: var(--sortable-place-bg) !important;
96
+ outline: 1px solid var(--sortable-place-line);
97
+ outline-offset: -1px;
98
+ }
99
+
100
+ // the copy under the pointer: a floating part, so it keeps the shadow
101
+ .sortable-ghost {
102
+ position: fixed;
103
+ top: 0;
104
+ left: 0;
105
+ z-index: 1090;
106
+ margin: 0 !important;
107
+ pointer-events: none;
108
+ background-color: var(--bs-body-bg);
109
+ border-radius: var(--bs-border-radius) !important;
110
+ box-shadow: var(--bs-box-shadow);
111
+ opacity: .95;
112
+
113
+ .sortable-handle {
114
+ cursor: grabbing;
115
+ }
116
+ }
117
+
118
+ // while an item is dragged the whole page has the grabbing hand and no text gets selected
119
+ .sortable-active,
120
+ .sortable-active * {
121
+ cursor: grabbing !important;
122
+ user-select: none;
123
+ }
124
+
125
+ // a list inside an item, one level deeper, under the text of the item
126
+ .sortable-nested {
127
+ width: 100%;
128
+ margin-top: .5rem;
129
+ }
130
+
131
+ .sortable-item:has(> .sortable-nested) {
132
+ flex-wrap: wrap;
133
+
134
+ > .sortable-nested {
135
+ margin-left: var(--sortable-indent);
136
+ }
137
+ }
138
+
139
+ // an empty list is a place to drop on
140
+ .sortable:not(:has(> .sortable-item)) {
141
+ min-height: 2.75rem;
142
+ outline: 1px dashed rgba(var(--bs-body-color-rgb), .15);
143
+ outline-offset: -1px;
144
+ border-radius: var(--bs-border-radius);
145
+
146
+ &::before {
147
+ display: block;
148
+ padding: .625rem 1rem;
149
+ color: var(--bs-secondary-color);
150
+ content: attr(data-sortable-empty);
151
+ }
152
+ }
153
+
154
+ @media (prefers-reduced-motion: reduce) {
155
+ .sortable-ghost {
156
+ opacity: 1;
157
+ }
158
+ }
@@ -0,0 +1,5 @@
1
+ //
2
+ // sortable module of compostrap
3
+ //
4
+
5
+ @use 'sortable/index';
@@ -1,60 +1,60 @@
1
- //
2
- // theme: tables
3
- //
4
-
5
- // table headers like the section titles of the menu: small, uppercase, muted
6
- .table > thead th {
7
- font-size: .75rem;
8
- font-weight: 500;
9
- letter-spacing: .04em;
10
- text-transform: uppercase;
11
- color: rgba(var(--bs-body-color-rgb), .6);
12
- }
13
-
14
- // sorting links in a table header keep the header look (not a button, e.g. the cross of a datagrid filter)
15
- .table > thead th a:not(.btn) {
16
- color: inherit;
17
- text-decoration: none;
18
-
19
- &:hover {
20
- color: var(--bs-body-color);
21
- }
22
- }
23
-
24
- // icon-only links in a table row (row actions of a datagrid without buttons) are muted until hovered; not the items
25
- // of a menu of row actions (their text is not an element) and not badges (a badge with an icon and a number keeps
26
- // its own padding and color)
27
- .table td a:not(.btn, .dropdown-item, .badge):has(> i:only-child) {
28
- display: inline-block;
29
- padding: 0 .25rem;
30
- color: var(--bs-secondary-color);
31
- text-decoration: none;
32
-
33
- &:hover {
34
- color: var(--bs-body-color);
35
- }
36
- }
37
-
38
- // a table cell with icon buttons (also the button of a menu of row actions) keeps the height of the other cells of its row
39
- .table td:has(> .btn-icon, > .dropdown > .btn-icon) {
40
- padding-top: .375rem;
41
- padding-bottom: .375rem;
42
- white-space: nowrap;
43
- }
44
-
45
- // a table straight in a card lines its first and last column up with the card padding and has no line at its bottom
46
- .card > .table,
47
- .card > .table-responsive > .table {
48
- > :not(caption) > * > :first-child {
49
- padding-left: var(--bs-card-spacer-x);
50
- }
51
-
52
- > :not(caption) > * > :last-child {
53
- padding-right: var(--bs-card-spacer-x);
54
- }
55
-
56
- // no line under the last row, the card ends there
57
- > tbody > tr:last-child > * {
58
- border-bottom-width: 0;
59
- }
60
- }
1
+ //
2
+ // theme: tables
3
+ //
4
+
5
+ // table headers like the section titles of the menu: small, uppercase, muted
6
+ .table > thead th {
7
+ font-size: .75rem;
8
+ font-weight: 500;
9
+ letter-spacing: .04em;
10
+ text-transform: uppercase;
11
+ color: rgba(var(--bs-body-color-rgb), .6);
12
+ }
13
+
14
+ // sorting links in a table header keep the header look (not a button, e.g. the cross of a datagrid filter)
15
+ .table > thead th a:not(.btn) {
16
+ color: inherit;
17
+ text-decoration: none;
18
+
19
+ &:hover {
20
+ color: var(--bs-body-color);
21
+ }
22
+ }
23
+
24
+ // icon-only links in a table row (row actions of a datagrid without buttons) are muted until hovered; not the items
25
+ // of a menu of row actions (their text is not an element) and not badges (a badge with an icon and a number keeps
26
+ // its own padding and color)
27
+ .table td a:not(.btn, .dropdown-item, .badge):has(> i:only-child) {
28
+ display: inline-block;
29
+ padding: 0 .25rem;
30
+ color: var(--bs-secondary-color);
31
+ text-decoration: none;
32
+
33
+ &:hover {
34
+ color: var(--bs-body-color);
35
+ }
36
+ }
37
+
38
+ // a table cell with icon buttons (also the button of a menu of row actions) keeps the height of the other cells of its row
39
+ .table td:has(> .btn-icon, > .dropdown > .btn-icon) {
40
+ padding-top: .375rem;
41
+ padding-bottom: .375rem;
42
+ white-space: nowrap;
43
+ }
44
+
45
+ // a table straight in a card lines its first and last column up with the card padding and has no line at its bottom
46
+ .card > .table,
47
+ .card > .table-responsive > .table {
48
+ > :not(caption) > * > :first-child {
49
+ padding-left: var(--bs-card-spacer-x);
50
+ }
51
+
52
+ > :not(caption) > * > :last-child {
53
+ padding-right: var(--bs-card-spacer-x);
54
+ }
55
+
56
+ // no line under the last row, the card ends there
57
+ > tbody > tr:last-child > * {
58
+ border-bottom-width: 0;
59
+ }
60
+ }