@parallelogram-js/dashboard 0.1.2 → 0.1.4
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/CHANGELOG.md +45 -1
- package/README.md +56 -1
- package/dist/parallelogram-dashboard.css +304 -6
- package/dist/parallelogram-dashboard.css.map +1 -1
- package/dist/parallelogram-dashboard.min.css +1 -1
- package/package.json +1 -1
- package/scss/_index.scss +2 -0
- package/scss/_tokens.scss +5 -2
- package/scss/_variables.scss +3 -0
- package/scss/components/_bulkactions.scss +129 -0
- package/scss/components/_button.scss +30 -0
- package/scss/components/_form-layout.scss +7 -1
- package/scss/components/_pageheader.scss +7 -2
- package/scss/components/_recordgrid.scss +181 -0
- package/src/js/behaviours/overflow-actions.js +1 -1
package/package.json
CHANGED
package/scss/_index.scss
CHANGED
package/scss/_tokens.scss
CHANGED
|
@@ -50,19 +50,22 @@ $theme-tokens: (
|
|
|
50
50
|
|
|
51
51
|
// Success
|
|
52
52
|
success: ($green-500, $green-500),
|
|
53
|
-
success-fg: ($zinc-
|
|
53
|
+
success-fg: ($zinc-950, $zinc-950),
|
|
54
|
+
success-hover: ($green-600, $green-400),
|
|
54
55
|
success-muted: ($green-50, $green-900),
|
|
55
56
|
success-muted-fg: ($green-900, $green-100),
|
|
56
57
|
|
|
57
58
|
// Warning
|
|
58
59
|
warning: ($amber-500, $amber-500),
|
|
59
60
|
warning-fg: ($zinc-950, $zinc-950),
|
|
61
|
+
warning-hover: ($amber-600, $amber-400),
|
|
60
62
|
warning-muted: ($amber-50, $amber-900),
|
|
61
63
|
warning-muted-fg: ($amber-900, $amber-100),
|
|
62
64
|
|
|
63
65
|
// Info
|
|
64
66
|
info: ($blue-500, $blue-500),
|
|
65
|
-
info-fg: ($zinc-
|
|
67
|
+
info-fg: ($zinc-950, $zinc-950),
|
|
68
|
+
info-hover: ($blue-400, $blue-400),
|
|
66
69
|
info-muted: ($blue-50, $blue-900),
|
|
67
70
|
info-muted-fg: ($blue-900, $blue-100),
|
|
68
71
|
|
package/scss/_variables.scss
CHANGED
|
@@ -29,18 +29,21 @@ $red-900: #7f1d1d !default;
|
|
|
29
29
|
|
|
30
30
|
$green-50: #f0fdf4 !default;
|
|
31
31
|
$green-100: #dcfce7 !default;
|
|
32
|
+
$green-400: #4ade80 !default;
|
|
32
33
|
$green-500: #22c55e !default;
|
|
33
34
|
$green-600: #16a34a !default;
|
|
34
35
|
$green-900: #14532d !default;
|
|
35
36
|
|
|
36
37
|
$blue-50: #eff6ff !default;
|
|
37
38
|
$blue-100: #dbeafe !default;
|
|
39
|
+
$blue-400: #60a5fa !default;
|
|
38
40
|
$blue-500: #3b82f6 !default;
|
|
39
41
|
$blue-600: #2563eb !default;
|
|
40
42
|
$blue-900: #1e3a8a !default;
|
|
41
43
|
|
|
42
44
|
$amber-50: #fffbeb !default;
|
|
43
45
|
$amber-100: #fef3c7 !default;
|
|
46
|
+
$amber-400: #fbbf24 !default;
|
|
44
47
|
$amber-500: #f59e0b !default;
|
|
45
48
|
$amber-600: #d97706 !default;
|
|
46
49
|
$amber-900: #78350f !default;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bulk actions bar
|
|
3
|
+
*
|
|
4
|
+
* Acts on the records selected in a table or record grid: a count of the selection
|
|
5
|
+
* (.bulkactions__count), then buttons and dropdowns (.bulkactions__actions), and optionally a
|
|
6
|
+
* button to clear the selection (.bulkactions__clear).
|
|
7
|
+
*
|
|
8
|
+
* The bar is markup on the page from the start, kept out of sight with the hidden attribute. The
|
|
9
|
+
* page's script updates the count and removes hidden once something is selected, and puts it back
|
|
10
|
+
* when the selection empties; the bar slides in each time it appears.
|
|
11
|
+
*
|
|
12
|
+
* By default it floats over the bottom of the viewport, so dropdowns inside it should open
|
|
13
|
+
* upwards (dropdown--top). .bulkactions--inline sits in the flow instead, such as above the table in
|
|
14
|
+
* place of its toolbar.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
@use "../variables" as *;
|
|
18
|
+
@use "../mixins" as *;
|
|
19
|
+
|
|
20
|
+
.bulkactions {
|
|
21
|
+
position: fixed;
|
|
22
|
+
bottom: $spacing-lg;
|
|
23
|
+
left: 50%;
|
|
24
|
+
z-index: $z-fixed;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-wrap: wrap;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: $spacing-2xs $spacing-xs;
|
|
29
|
+
width: max-content;
|
|
30
|
+
max-width: calc(100vw - #{$spacing-sm * 2});
|
|
31
|
+
padding: $spacing-2xs $spacing-xs;
|
|
32
|
+
color: var(--card-fg);
|
|
33
|
+
background-color: var(--card);
|
|
34
|
+
border: 1px solid var(--border);
|
|
35
|
+
border-radius: $radius;
|
|
36
|
+
box-shadow: $shadow-xl;
|
|
37
|
+
transform: translateX(-50%);
|
|
38
|
+
animation: bulkactions-float-in $transition-base $transition-easing;
|
|
39
|
+
|
|
40
|
+
// Full width on a phone, with the count and clear button on top and the actions below
|
|
41
|
+
@include max-sm {
|
|
42
|
+
right: $spacing-sm;
|
|
43
|
+
left: $spacing-sm;
|
|
44
|
+
width: auto;
|
|
45
|
+
max-width: none;
|
|
46
|
+
transform: none;
|
|
47
|
+
animation-name: bulkactions-in;
|
|
48
|
+
|
|
49
|
+
.bulkactions__count {
|
|
50
|
+
border-right: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.bulkactions__actions {
|
|
54
|
+
order: 1;
|
|
55
|
+
flex-basis: 100%;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The dashboard's navigation becomes a bar along the bottom of the screen at this width
|
|
60
|
+
.dashboard & {
|
|
61
|
+
@include max-md {
|
|
62
|
+
bottom: calc(4rem + #{$spacing-2xs});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&--inline {
|
|
67
|
+
position: static;
|
|
68
|
+
width: auto;
|
|
69
|
+
max-width: none;
|
|
70
|
+
background-color: color-mix(in srgb, var(--primary) 6%, var(--card));
|
|
71
|
+
box-shadow: none;
|
|
72
|
+
transform: none;
|
|
73
|
+
animation-name: bulkactions-in;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__count {
|
|
77
|
+
display: inline-flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
align-self: stretch;
|
|
80
|
+
padding-right: $spacing-xs;
|
|
81
|
+
font-size: $font-size-sm;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
border-right: 1px solid var(--border);
|
|
84
|
+
|
|
85
|
+
strong {
|
|
86
|
+
font-weight: $font-weight-semibold;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&__actions {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-wrap: wrap;
|
|
93
|
+
align-items: center;
|
|
94
|
+
gap: $spacing-3xs;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&__clear {
|
|
98
|
+
margin-left: auto;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@media (prefers-reduced-motion: reduce) {
|
|
102
|
+
animation: none;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@keyframes bulkactions-float-in {
|
|
107
|
+
from {
|
|
108
|
+
opacity: 0;
|
|
109
|
+
transform: translateX(-50%) translateY(#{$spacing-sm});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
to {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
transform: translateX(-50%) translateY(0);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// The narrow and inline bars aren't centred with a transform, so they slide without one
|
|
119
|
+
@keyframes bulkactions-in {
|
|
120
|
+
from {
|
|
121
|
+
opacity: 0;
|
|
122
|
+
translate: 0 #{$spacing-2xs};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
to {
|
|
126
|
+
opacity: 1;
|
|
127
|
+
translate: 0 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -110,6 +110,36 @@
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// Warning
|
|
114
|
+
&--warning {
|
|
115
|
+
background-color: var(--warning);
|
|
116
|
+
color: var(--warning-fg);
|
|
117
|
+
|
|
118
|
+
&:hover:not(:disabled) {
|
|
119
|
+
background-color: var(--warning-hover);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Success
|
|
124
|
+
&--success {
|
|
125
|
+
background-color: var(--success);
|
|
126
|
+
color: var(--success-fg);
|
|
127
|
+
|
|
128
|
+
&:hover:not(:disabled) {
|
|
129
|
+
background-color: var(--success-hover);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Info
|
|
134
|
+
&--info {
|
|
135
|
+
background-color: var(--info);
|
|
136
|
+
color: var(--info-fg);
|
|
137
|
+
|
|
138
|
+
&:hover:not(:disabled) {
|
|
139
|
+
background-color: var(--info-hover);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
113
143
|
// Link style
|
|
114
144
|
&--link {
|
|
115
145
|
background-color: transparent;
|
|
@@ -123,10 +123,15 @@
|
|
|
123
123
|
// Field (label, control(s), description, error and any extra markup)
|
|
124
124
|
// --------------------------------------------------------------------------
|
|
125
125
|
|
|
126
|
+
// Help text and errors sit 6px under the control; the label (or the row holding it) keeps 8px
|
|
126
127
|
&__field {
|
|
127
128
|
display: flex;
|
|
128
129
|
flex-direction: column;
|
|
129
|
-
gap:
|
|
130
|
+
gap: 0.375rem;
|
|
131
|
+
|
|
132
|
+
> :first-child {
|
|
133
|
+
margin-bottom: 0.125rem;
|
|
134
|
+
}
|
|
130
135
|
|
|
131
136
|
// Deprecated: set aria-invalid="true" on the control instead
|
|
132
137
|
&--error {
|
|
@@ -164,6 +169,7 @@
|
|
|
164
169
|
|
|
165
170
|
&__description {
|
|
166
171
|
font-size: $font-size-xs;
|
|
172
|
+
line-height: 1.25;
|
|
167
173
|
color: var(--fg-muted);
|
|
168
174
|
}
|
|
169
175
|
|
|
@@ -72,11 +72,16 @@
|
|
|
72
72
|
z-index: $z-sticky - 1;
|
|
73
73
|
margin-top: -$spacing-lg;
|
|
74
74
|
margin-inline: -$spacing-lg;
|
|
75
|
-
padding: $spacing-
|
|
75
|
+
padding: $spacing-sm $spacing-lg;
|
|
76
76
|
background-color: var(--bg);
|
|
77
77
|
|
|
78
|
+
// Longhands, not the animation shorthand: a minifier can sort the shorthand after
|
|
79
|
+
// animation-timeline, which resets the timeline to auto and shows the shadow at the top
|
|
78
80
|
@supports (animation-timeline: scroll()) {
|
|
79
|
-
animation: pageheader-pinned
|
|
81
|
+
animation-name: pageheader-pinned;
|
|
82
|
+
animation-duration: auto;
|
|
83
|
+
animation-timing-function: linear;
|
|
84
|
+
animation-fill-mode: both;
|
|
80
85
|
animation-timeline: scroll(root);
|
|
81
86
|
animation-range: 0 $spacing-lg;
|
|
82
87
|
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record grid
|
|
3
|
+
*
|
|
4
|
+
* The picture view of a record list: a responsive grid of tiles, each led by a thumbnail
|
|
5
|
+
* (.recordgrid__thumb, an image or a placeholder icon), with a title, a meta line and a footer
|
|
6
|
+
* holding the status badges and the record's action menu.
|
|
7
|
+
*
|
|
8
|
+
* A tile can carry a selection checkbox (.recordgrid__select) over its thumbnail, so the same
|
|
9
|
+
* bulk actions work as in the table view. It shows while the tile is hovered or focused, and on
|
|
10
|
+
* every tile once anything in the grid is selected. A checked tile is outlined; a tile with
|
|
11
|
+
* aria-disabled="true" (unpublished, locked) is dimmed but its controls stay usable.
|
|
12
|
+
*
|
|
13
|
+
* Tiles never clip their contents, so the action menu can open past the tile's edge.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
@use "../variables" as *;
|
|
17
|
+
@use "../mixins" as *;
|
|
18
|
+
|
|
19
|
+
.recordgrid {
|
|
20
|
+
--recordgrid-min: 14rem;
|
|
21
|
+
--recordgrid-ratio: 4 / 3;
|
|
22
|
+
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-template-columns: repeat(auto-fill, minmax(min(var(--recordgrid-min), 100%), 1fr));
|
|
25
|
+
gap: $spacing-sm;
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
list-style: none;
|
|
29
|
+
|
|
30
|
+
&--sm {
|
|
31
|
+
--recordgrid-min: 10rem;
|
|
32
|
+
|
|
33
|
+
gap: $spacing-xs;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--square {
|
|
37
|
+
--recordgrid-ratio: 1;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__item {
|
|
41
|
+
position: relative;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
color: var(--card-fg);
|
|
46
|
+
background-color: var(--card);
|
|
47
|
+
border: 1px solid var(--border);
|
|
48
|
+
border-radius: $radius;
|
|
49
|
+
@include transition-colors;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
border-color: var(--fg-subtle);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&:has(.recordgrid__select :checked) {
|
|
56
|
+
border-color: var(--primary);
|
|
57
|
+
box-shadow: 0 0 0 1px var(--primary);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&[aria-disabled="true"] :is(.recordgrid__thumb, .recordgrid__title) {
|
|
61
|
+
opacity: 0.55;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__thumb {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
aspect-ratio: var(--recordgrid-ratio);
|
|
71
|
+
margin: 0;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
color: var(--fg-subtle);
|
|
74
|
+
background-color: var(--bg-muted);
|
|
75
|
+
border-bottom: 1px solid var(--border);
|
|
76
|
+
border-radius: calc(#{$radius} - 1px) calc(#{$radius} - 1px) 0 0;
|
|
77
|
+
|
|
78
|
+
img,
|
|
79
|
+
picture {
|
|
80
|
+
display: block;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
img {
|
|
86
|
+
object-fit: cover;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// A record with no image shows an icon in its place
|
|
90
|
+
> .icon {
|
|
91
|
+
width: $icon-size-lg;
|
|
92
|
+
height: $icon-size-lg;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:is(a):focus-visible {
|
|
96
|
+
outline: 2px solid var(--ring);
|
|
97
|
+
outline-offset: -2px;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Logos and product shots sit whole on the muted ground instead of filling the frame
|
|
101
|
+
&--contain img {
|
|
102
|
+
padding: $spacing-xs;
|
|
103
|
+
object-fit: contain;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Lies on a chip over the thumbnail so it reads against any image
|
|
108
|
+
&__select {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: $spacing-2xs;
|
|
111
|
+
left: $spacing-2xs;
|
|
112
|
+
z-index: 1;
|
|
113
|
+
display: inline-flex;
|
|
114
|
+
padding: $spacing-3xs;
|
|
115
|
+
background-color: var(--card);
|
|
116
|
+
border-radius: $radius-sm;
|
|
117
|
+
box-shadow: $shadow-sm;
|
|
118
|
+
opacity: 0;
|
|
119
|
+
@include transition-opacity;
|
|
120
|
+
|
|
121
|
+
@media (hover: none) {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&__item:is(:hover, :focus-within) &__select,
|
|
127
|
+
&:has(.recordgrid__select :checked) &__select {
|
|
128
|
+
opacity: 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&__body {
|
|
132
|
+
display: flex;
|
|
133
|
+
flex: 1;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
gap: $spacing-3xs;
|
|
136
|
+
min-width: 0;
|
|
137
|
+
padding: $spacing-xs;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&__title {
|
|
141
|
+
margin: 0;
|
|
142
|
+
font-size: $font-size-sm;
|
|
143
|
+
font-weight: $font-weight-medium;
|
|
144
|
+
line-height: $line-height-snug;
|
|
145
|
+
color: inherit;
|
|
146
|
+
text-decoration: none;
|
|
147
|
+
@include text-clamp(2);
|
|
148
|
+
|
|
149
|
+
&:is(a):hover {
|
|
150
|
+
text-decoration: underline;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&:is(a):focus-visible {
|
|
154
|
+
@include focus-ring;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&__meta {
|
|
159
|
+
margin: 0;
|
|
160
|
+
font-size: $font-size-xs;
|
|
161
|
+
color: var(--fg-muted);
|
|
162
|
+
@include text-truncate;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Pushed to the bottom so footers line up across a row of tiles with different titles
|
|
166
|
+
&__footer {
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: space-between;
|
|
170
|
+
gap: $spacing-2xs;
|
|
171
|
+
margin-top: auto;
|
|
172
|
+
padding-top: $spacing-2xs;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__status {
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-wrap: wrap;
|
|
178
|
+
gap: $spacing-3xs;
|
|
179
|
+
min-width: 0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Toggle } from './toggle.js';
|
|
2
2
|
|
|
3
|
-
const ACTIONBAR_MORE_ICON = '<svg class="icon" viewBox="0 0 24 24"><path d="
|
|
3
|
+
const ACTIONBAR_MORE_ICON = '<svg class="icon" viewBox="0 0 24 24"><path d="M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/><path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/><path d="M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"/></svg>';
|
|
4
4
|
const OVERFLOW_RANK = { low: 1, medium: 2 };
|
|
5
5
|
let overflowMenuCount = 0;
|
|
6
6
|
|