@parallelogram-js/dashboard 0.0.0-stage → 0.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +113 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1390 -2
  4. package/dist/parallelogram-dashboard.css +9401 -0
  5. package/dist/parallelogram-dashboard.css.map +1 -0
  6. package/dist/parallelogram-dashboard.min.css +1 -0
  7. package/package.json +72 -4
  8. package/scss/_base.scss +403 -0
  9. package/scss/_datetime.scss +50 -0
  10. package/scss/_icon.scss +40 -0
  11. package/scss/_index.scss +60 -0
  12. package/scss/_mixins.scss +396 -0
  13. package/scss/_tokens.scss +340 -0
  14. package/scss/_utilities.scss +464 -0
  15. package/scss/_variables.scss +219 -0
  16. package/scss/components/_accordion.scss +297 -0
  17. package/scss/components/_actionbar.scss +333 -0
  18. package/scss/components/_alert.scss +183 -0
  19. package/scss/components/_avatar.scss +203 -0
  20. package/scss/components/_badge.scss +176 -0
  21. package/scss/components/_banner.scss +344 -0
  22. package/scss/components/_breadcrumb.scss +220 -0
  23. package/scss/components/_button.scss +264 -0
  24. package/scss/components/_card.scss +256 -0
  25. package/scss/components/_chart.scss +246 -0
  26. package/scss/components/_command.scss +267 -0
  27. package/scss/components/_dashboard.scss +681 -0
  28. package/scss/components/_data-list.scss +280 -0
  29. package/scss/components/_dropdown.scss +318 -0
  30. package/scss/components/_empty.scss +226 -0
  31. package/scss/components/_filebrowser.scss +906 -0
  32. package/scss/components/_form-layout.scss +332 -0
  33. package/scss/components/_input.scss +310 -0
  34. package/scss/components/_list.scss +130 -0
  35. package/scss/components/_media.scss +239 -0
  36. package/scss/components/_modal.scss +298 -0
  37. package/scss/components/_navbar.scss +312 -0
  38. package/scss/components/_notification.scss +59 -0
  39. package/scss/components/_pageheader.scss +99 -0
  40. package/scss/components/_pagination.scss +165 -0
  41. package/scss/components/_progress.scss +333 -0
  42. package/scss/components/_separator.scss +129 -0
  43. package/scss/components/_sheet.scss +286 -0
  44. package/scss/components/_sidebar.scss +324 -0
  45. package/scss/components/_skeleton.scss +246 -0
  46. package/scss/components/_stat.scss +218 -0
  47. package/scss/components/_table.scss +589 -0
  48. package/scss/components/_tabs.scss +266 -0
  49. package/scss/components/_timeline.scss +339 -0
  50. package/scss/components/_toast.scss +259 -0
  51. package/scss/components/_toolbar.scss +301 -0
  52. package/scss/components/_tooltip.scss +250 -0
  53. package/scss/main.scss +6 -0
  54. package/src/js/behaviours/accordion.js +58 -0
  55. package/src/js/behaviours/action-bar-list.js +406 -0
  56. package/src/js/behaviours/action-bar.js +29 -0
  57. package/src/js/behaviours/chart.js +339 -0
  58. package/src/js/behaviours/collapsible.js +34 -0
  59. package/src/js/behaviours/editable-table.js +91 -0
  60. package/src/js/behaviours/expandable.js +80 -0
  61. package/src/js/behaviours/overflow-actions.js +137 -0
  62. package/src/js/behaviours/publish-schedule.js +91 -0
  63. package/src/js/behaviours/search-clear.js +19 -0
  64. package/src/js/behaviours/segmented-control.js +43 -0
  65. package/src/js/behaviours/submenu.js +73 -0
  66. package/src/js/behaviours/table-columns.js +77 -0
  67. package/src/js/behaviours/table-paste.js +305 -0
  68. package/src/js/behaviours/table-reorder.js +252 -0
  69. package/src/js/behaviours/table-sort.js +101 -0
  70. package/src/js/behaviours/tabs.js +148 -0
  71. package/src/js/behaviours/toast-manager.js +106 -0
  72. package/src/js/behaviours/toggle.js +186 -0
  73. package/src/js/behaviours/unsaved-guard.js +88 -0
  74. package/src/js/core-loader.js +26 -0
  75. package/src/js/index.js +85 -0
  76. package/src/js/polyfills/dialog-commands.js +20 -0
  77. package/src/js/util/dom.js +39 -0
@@ -0,0 +1,259 @@
1
+ // ==========================================================================
2
+ // Toast/Notification Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ // --------------------------------------------------------------------------
9
+ // Toast Container (positioning)
10
+ // --------------------------------------------------------------------------
11
+
12
+ .toast__container {
13
+ // Where toasts slide in from and back out to; set per position below
14
+ --toast-offset-x: 100%;
15
+ --toast-offset-y: 0;
16
+ position: fixed;
17
+ z-index: $z-toast;
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: $spacing-xs;
21
+ padding: $spacing-sm;
22
+ pointer-events: none;
23
+ max-width: 24rem;
24
+ width: 100%;
25
+
26
+ // Positions
27
+ &--top-right {
28
+ top: 0;
29
+ right: 0;
30
+ }
31
+
32
+ &--top-left {
33
+ --toast-offset-x: -100%;
34
+ top: 0;
35
+ left: 0;
36
+ }
37
+
38
+ &--top-center {
39
+ --toast-offset-x: 0;
40
+ --toast-offset-y: -1rem;
41
+ top: 0;
42
+ left: 50%;
43
+ transform: translateX(-50%);
44
+ }
45
+
46
+ &--bottom-right {
47
+ bottom: 0;
48
+ right: 0;
49
+ }
50
+
51
+ &--bottom-left {
52
+ --toast-offset-x: -100%;
53
+ bottom: 0;
54
+ left: 0;
55
+ }
56
+
57
+ &--bottom-center {
58
+ --toast-offset-x: 0;
59
+ --toast-offset-y: 1rem;
60
+ bottom: 0;
61
+ left: 50%;
62
+ transform: translateX(-50%);
63
+ }
64
+ }
65
+
66
+ // --------------------------------------------------------------------------
67
+ // Toast
68
+ // --------------------------------------------------------------------------
69
+
70
+ .toast {
71
+ // Anchors the absolutely positioned progress bar
72
+ position: relative;
73
+ display: flex;
74
+ align-items: flex-start;
75
+ gap: $spacing-xs;
76
+ padding: $spacing-sm;
77
+ background-color: var(--popover);
78
+ border: 1px solid var(--border);
79
+ border-radius: $radius;
80
+ box-shadow: $shadow-lg;
81
+ pointer-events: auto;
82
+ animation: toast-slide-in 0.3s ease-out;
83
+
84
+ &__icon {
85
+ flex-shrink: 0;
86
+ width: $icon-size-md;
87
+ height: $icon-size-md;
88
+ margin-top: 0.125rem;
89
+ }
90
+
91
+ &__content {
92
+ flex: 1;
93
+ min-width: 0;
94
+ }
95
+
96
+ &__title {
97
+ font-size: $font-size-sm;
98
+ font-weight: $font-weight-semibold;
99
+ color: var(--fg);
100
+ margin-bottom: $spacing-3xs;
101
+ }
102
+
103
+ &__description {
104
+ font-size: $font-size-sm;
105
+ color: var(--fg-muted);
106
+ line-height: $line-height-relaxed;
107
+ }
108
+
109
+ &__actions {
110
+ display: flex;
111
+ align-items: center;
112
+ gap: $spacing-2xs;
113
+ margin-top: $spacing-xs;
114
+ }
115
+
116
+ &__close {
117
+ flex-shrink: 0;
118
+ @include flex-center;
119
+ width: 1.5rem;
120
+ height: 1.5rem;
121
+ padding: 0;
122
+ background: transparent;
123
+ border: none;
124
+ border-radius: $radius-sm;
125
+ color: var(--fg-muted);
126
+ cursor: pointer;
127
+ @include transition-colors;
128
+
129
+ &:hover {
130
+ color: var(--fg);
131
+ background-color: var(--bg-muted);
132
+ }
133
+
134
+ svg {
135
+ width: 1rem;
136
+ height: 1rem;
137
+ }
138
+ }
139
+
140
+ // --------------------------------------------------------------------------
141
+ // Variants
142
+ // --------------------------------------------------------------------------
143
+
144
+ &--success {
145
+ border-left: 4px solid var(--success);
146
+
147
+ .toast__icon {
148
+ color: var(--success);
149
+ }
150
+ }
151
+
152
+ &--error {
153
+ border-left: 4px solid var(--destructive);
154
+
155
+ .toast__icon {
156
+ color: var(--destructive);
157
+ }
158
+ }
159
+
160
+ &--warning {
161
+ border-left: 4px solid var(--warning);
162
+
163
+ .toast__icon {
164
+ color: var(--warning);
165
+ }
166
+ }
167
+
168
+ &--info {
169
+ border-left: 4px solid var(--info);
170
+
171
+ .toast__icon {
172
+ color: var(--info);
173
+ }
174
+ }
175
+
176
+ // Progress bar for auto-dismiss
177
+ &__progress {
178
+ position: absolute;
179
+ bottom: 0;
180
+ left: 0;
181
+ right: 0;
182
+ height: 3px;
183
+ background-color: var(--primary);
184
+ border-radius: 0 0 $radius $radius;
185
+ // ToastManager sets --toast-duration to the toast's auto-dismiss time
186
+ animation: toast-progress var(--toast-duration, 5s) linear forwards;
187
+ }
188
+
189
+ // Compact variant
190
+ &--compact {
191
+ padding: $spacing-xs;
192
+ gap: $spacing-2xs;
193
+
194
+ .toast__title {
195
+ margin-bottom: 0;
196
+ }
197
+
198
+ .toast__description {
199
+ font-size: $font-size-xs;
200
+ }
201
+ }
202
+
203
+ // With action inline
204
+ &--action {
205
+ .toast__content {
206
+ display: flex;
207
+ align-items: center;
208
+ justify-content: space-between;
209
+ gap: $spacing-sm;
210
+ }
211
+
212
+ .toast__actions {
213
+ margin-top: 0;
214
+ flex-shrink: 0;
215
+ }
216
+ }
217
+ }
218
+
219
+ // --------------------------------------------------------------------------
220
+ // Animations
221
+ // --------------------------------------------------------------------------
222
+
223
+ @keyframes toast-slide-in {
224
+ from {
225
+ opacity: 0;
226
+ transform: translate(var(--toast-offset-x, 100%), var(--toast-offset-y, 0));
227
+ }
228
+ to {
229
+ opacity: 1;
230
+ transform: none;
231
+ }
232
+ }
233
+
234
+ @keyframes toast-slide-out {
235
+ from {
236
+ opacity: 1;
237
+ transform: none;
238
+ }
239
+ to {
240
+ opacity: 0;
241
+ transform: translate(var(--toast-offset-x, 100%), var(--toast-offset-y, 0));
242
+ }
243
+ }
244
+
245
+ @keyframes toast-progress {
246
+ from {
247
+ width: 100%;
248
+ }
249
+ to {
250
+ width: 0%;
251
+ }
252
+ }
253
+
254
+ @media (prefers-reduced-motion: reduce) {
255
+ .toast {
256
+ --toast-offset-x: 0;
257
+ --toast-offset-y: 0;
258
+ }
259
+ }
@@ -0,0 +1,301 @@
1
+ // ==========================================================================
2
+ // Search Bar Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ // --------------------------------------------------------------------------
9
+ // Base Search Bar
10
+ // --------------------------------------------------------------------------
11
+
12
+ .toolbar {
13
+ display: flex;
14
+ align-items: center;
15
+ gap: $spacing-xs;
16
+ width: 100%;
17
+
18
+ // --------------------------------------------------------------------------
19
+ // Elements
20
+ // --------------------------------------------------------------------------
21
+
22
+ &__group {
23
+ position: relative;
24
+ flex: 1;
25
+ max-width: 24rem;
26
+ }
27
+
28
+ &__icon {
29
+ position: absolute;
30
+ left: $spacing-xs;
31
+ top: 50%;
32
+ transform: translateY(-50%);
33
+ width: $icon-size-md;
34
+ height: $icon-size-md;
35
+ color: var(--fg-muted);
36
+ pointer-events: none;
37
+ }
38
+
39
+ &__input {
40
+ width: 100%;
41
+ height: $input-height-md;
42
+ padding: 0 $spacing-xs 0 $spacing-2xl;
43
+ font-size: $font-size-sm;
44
+ background-color: var(--bg);
45
+ border: var(--control-border-width) solid var(--input);
46
+ border-radius: $radius-md;
47
+ color: var(--fg);
48
+ @include transition-colors;
49
+
50
+ &::placeholder {
51
+ color: var(--input-placeholder);
52
+ }
53
+
54
+ &:focus {
55
+ @include focus-ring;
56
+ border-color: var(--ring);
57
+ }
58
+
59
+ // A search input keeps its semantics (and Escape to clear) but not the browser's own
60
+ // clear button, which differs in every browser; .toolbar__clear takes its place
61
+ &[type="search"] {
62
+ appearance: none;
63
+
64
+ &::-webkit-search-cancel-button,
65
+ &::-webkit-search-decoration {
66
+ appearance: none;
67
+ display: none;
68
+ }
69
+ }
70
+ }
71
+
72
+ // Leave room for the clear button so a long query never runs under it
73
+ &__group:has(.toolbar__clear) &__input {
74
+ padding-right: $spacing-2xl;
75
+ }
76
+
77
+ &__clear {
78
+ position: absolute;
79
+ right: $spacing-2xs;
80
+ top: 50%;
81
+ transform: translateY(-50%);
82
+ @include flex-center;
83
+ width: 1.5rem;
84
+ height: 1.5rem;
85
+ padding: 0;
86
+ background: transparent;
87
+ border: none;
88
+ border-radius: $radius-sm;
89
+ color: var(--fg-muted);
90
+ cursor: pointer;
91
+ opacity: 0;
92
+ visibility: hidden;
93
+ @include transition-opacity;
94
+
95
+ &:hover {
96
+ color: var(--fg);
97
+ background-color: var(--bg-muted);
98
+ }
99
+
100
+ // Shown while the search input has a value; the input needs a placeholder for :placeholder-shown
101
+ .toolbar__input:not(:placeholder-shown) ~ &,
102
+ &--visible {
103
+ opacity: 1;
104
+ visibility: visible;
105
+ }
106
+ }
107
+
108
+ &__filters {
109
+ display: flex;
110
+ flex-wrap: wrap;
111
+ align-items: center;
112
+ gap: $spacing-2xs;
113
+ }
114
+
115
+ &__actions {
116
+ display: flex;
117
+ align-items: center;
118
+ gap: $spacing-2xs;
119
+ margin-left: auto;
120
+ }
121
+
122
+ // --------------------------------------------------------------------------
123
+ // Variants
124
+ // --------------------------------------------------------------------------
125
+
126
+ // Small controls at any width; --compact is a narrow search box at this size.
127
+ // Pair with .btn--sm and .input--sm on the controls placed inside.
128
+ &--sm,
129
+ &--compact {
130
+ gap: $spacing-2xs;
131
+
132
+ .toolbar__icon {
133
+ left: $spacing-2xs;
134
+ width: $icon-size-sm;
135
+ height: $icon-size-sm;
136
+ }
137
+
138
+ .toolbar__input {
139
+ height: $input-height-sm;
140
+ padding-left: $spacing-xl;
141
+ font-size: $font-size-xs;
142
+ }
143
+
144
+ .toolbar__clear {
145
+ width: 1.25rem;
146
+ height: 1.25rem;
147
+ }
148
+
149
+ .filter__label {
150
+ height: 1.75rem;
151
+ padding: 0 $spacing-2xs;
152
+ }
153
+ }
154
+
155
+ &--compact {
156
+ .toolbar__group {
157
+ max-width: 16rem;
158
+ }
159
+ }
160
+
161
+ &--full {
162
+ .toolbar__group {
163
+ max-width: none;
164
+ }
165
+ }
166
+ }
167
+
168
+ // --------------------------------------------------------------------------
169
+ // Filter Chip
170
+ // --------------------------------------------------------------------------
171
+
172
+ .filter__label {
173
+ display: inline-flex;
174
+ align-items: center;
175
+ gap: $spacing-3xs;
176
+ height: $btn-height-sm;
177
+ padding: 0 $spacing-xs;
178
+ font-size: $font-size-xs;
179
+ white-space: nowrap;
180
+ font-weight: $font-weight-medium;
181
+ background-color: var(--bg-muted);
182
+ border: 1px solid var(--border);
183
+ border-radius: $radius-full;
184
+ color: var(--fg);
185
+ @include interactive;
186
+
187
+ &:hover {
188
+ background-color: var(--bg-subtle);
189
+ }
190
+
191
+ &:disabled,
192
+ &[aria-disabled="true"] {
193
+ @include disabled;
194
+ }
195
+
196
+ &[aria-pressed="true"],
197
+ &--active {
198
+ background-color: var(--primary);
199
+ border-color: var(--primary);
200
+ color: var(--primary-fg);
201
+
202
+ &:hover {
203
+ background-color: var(--primary-hover);
204
+ }
205
+ }
206
+ }
207
+
208
+ // Remove button inside an applied-filter chip
209
+ .filter__remove {
210
+ @include flex-center;
211
+ width: 1rem;
212
+ height: 1rem;
213
+ margin-left: $spacing-3xs;
214
+ margin-right: -$spacing-3xs;
215
+ padding: 0;
216
+ background: transparent;
217
+ border: none;
218
+ border-radius: $radius-full;
219
+ color: inherit;
220
+ cursor: pointer;
221
+ opacity: 0.7;
222
+
223
+ &:hover {
224
+ opacity: 1;
225
+ background-color: rgba(0, 0, 0, 0.1);
226
+ }
227
+ }
228
+
229
+ // --------------------------------------------------------------------------
230
+ // Active Filters Bar
231
+ // --------------------------------------------------------------------------
232
+
233
+ .activefilters {
234
+ display: flex;
235
+ align-items: center;
236
+ flex-wrap: wrap;
237
+ gap: $spacing-2xs;
238
+ padding: $spacing-xs 0;
239
+
240
+ &__label {
241
+ font-size: $font-size-sm;
242
+ color: var(--fg-muted);
243
+ margin-right: $spacing-3xs;
244
+ }
245
+
246
+ &__clear {
247
+ font-size: $font-size-sm;
248
+ color: var(--fg-muted);
249
+ background: none;
250
+ border: none;
251
+ cursor: pointer;
252
+ text-decoration: underline;
253
+ margin-left: $spacing-2xs;
254
+
255
+ &:hover {
256
+ color: var(--fg);
257
+ }
258
+ }
259
+ }
260
+
261
+ // --------------------------------------------------------------------------
262
+ // Responsive
263
+ // --------------------------------------------------------------------------
264
+
265
+ @include max-md {
266
+ .toolbar {
267
+ flex-wrap: wrap;
268
+
269
+ &__group {
270
+ flex-basis: 100%;
271
+ max-width: none;
272
+ order: 1;
273
+ }
274
+
275
+ &__filters {
276
+ order: 2;
277
+ }
278
+
279
+ &__actions {
280
+ order: 3;
281
+ }
282
+ }
283
+ }
284
+
285
+ // On phones a joined filter group can't fit or wrap, and scrolling it would clip the dropdown
286
+ // menus that open beneath it, so its buttons part and wrap like any others
287
+ @include max-sm {
288
+ .toolbar__filters .btn__group {
289
+ flex-wrap: wrap;
290
+ gap: $spacing-2xs;
291
+
292
+ > :not(:first-child) {
293
+ margin-left: 0;
294
+ }
295
+
296
+ > .btn,
297
+ > * > .btn {
298
+ border-radius: $radius-md;
299
+ }
300
+ }
301
+ }