@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,332 @@
1
+ // ==========================================================================
2
+ // Form Layout Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ // --------------------------------------------------------------------------
9
+ // Form Container
10
+ // --------------------------------------------------------------------------
11
+
12
+ .form {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: $spacing-lg;
16
+
17
+ // --------------------------------------------------------------------------
18
+ // Form Section
19
+ // --------------------------------------------------------------------------
20
+
21
+ &__section {
22
+ display: flex;
23
+ flex-direction: column;
24
+ gap: $spacing-sm;
25
+
26
+ &--bordered {
27
+ padding-bottom: $spacing-lg;
28
+ border-bottom: 1px solid var(--border);
29
+ }
30
+ }
31
+
32
+ &__section-header {
33
+ margin-bottom: $spacing-2xs;
34
+ }
35
+
36
+ &__section-title {
37
+ font-size: $font-size-base;
38
+ font-weight: $font-weight-semibold;
39
+ color: var(--fg);
40
+ margin-bottom: $spacing-3xs;
41
+ }
42
+
43
+ &__section-description {
44
+ font-size: $font-size-sm;
45
+ color: var(--fg-muted);
46
+ line-height: $line-height-relaxed;
47
+ }
48
+
49
+ // --------------------------------------------------------------------------
50
+ // Form Row (for side-by-side fields)
51
+ // --------------------------------------------------------------------------
52
+
53
+ &__row {
54
+ display: grid;
55
+ gap: $spacing-sm;
56
+
57
+ &--2 {
58
+ grid-template-columns: repeat(2, 1fr);
59
+ }
60
+
61
+ &--3 {
62
+ grid-template-columns: repeat(3, 1fr);
63
+ }
64
+
65
+ &--4 {
66
+ grid-template-columns: repeat(4, 1fr);
67
+ }
68
+
69
+ // Unequal columns
70
+ &--1-2 {
71
+ grid-template-columns: 1fr 2fr;
72
+ }
73
+
74
+ &--2-1 {
75
+ grid-template-columns: 2fr 1fr;
76
+ }
77
+
78
+ @include max-md {
79
+ &--2,
80
+ &--3,
81
+ &--4,
82
+ &--1-2,
83
+ &--2-1 {
84
+ grid-template-columns: 1fr;
85
+ }
86
+ }
87
+ }
88
+
89
+ // --------------------------------------------------------------------------
90
+ // Form Actions
91
+ // --------------------------------------------------------------------------
92
+
93
+ &__actions {
94
+ display: flex;
95
+ align-items: center;
96
+ gap: $spacing-xs;
97
+ padding-top: $spacing-sm;
98
+
99
+ &--border {
100
+ border-top: 1px solid var(--border);
101
+ padding-top: $spacing-lg;
102
+ }
103
+
104
+ &--end {
105
+ justify-content: flex-end;
106
+ }
107
+
108
+ &--between {
109
+ justify-content: space-between;
110
+ }
111
+
112
+ &--sticky {
113
+ position: sticky;
114
+ bottom: 0;
115
+ background-color: var(--bg);
116
+ padding: $spacing-sm;
117
+ margin: 0 (-$spacing-sm) (-$spacing-sm);
118
+ border-top: 1px solid var(--border);
119
+ }
120
+ }
121
+
122
+ // --------------------------------------------------------------------------
123
+ // Field (label, control(s), description, error and any extra markup)
124
+ // --------------------------------------------------------------------------
125
+
126
+ &__field {
127
+ display: flex;
128
+ flex-direction: column;
129
+ gap: $spacing-2xs;
130
+
131
+ // Deprecated: set aria-invalid="true" on the control instead
132
+ &--error {
133
+ .input,
134
+ .textarea,
135
+ .select,
136
+ .form__control {
137
+ border-color: var(--destructive);
138
+
139
+ &:focus {
140
+ outline-color: var(--destructive);
141
+ }
142
+ }
143
+ }
144
+ }
145
+
146
+ &__label {
147
+ display: flex;
148
+ align-items: center;
149
+ gap: $spacing-3xs;
150
+ font-size: $font-size-sm;
151
+ font-weight: $font-weight-medium;
152
+ color: var(--fg);
153
+ }
154
+
155
+ &__required {
156
+ color: var(--destructive);
157
+ }
158
+
159
+ &__optional {
160
+ font-size: $font-size-xs;
161
+ font-weight: $font-weight-normal;
162
+ color: var(--fg-muted);
163
+ }
164
+
165
+ &__description {
166
+ font-size: $font-size-xs;
167
+ color: var(--fg-muted);
168
+ }
169
+
170
+ &__error {
171
+ font-size: $font-size-xs;
172
+ color: var(--destructive);
173
+ }
174
+
175
+ &__counter {
176
+ display: flex;
177
+ justify-content: flex-end;
178
+ font-size: $font-size-xs;
179
+ color: var(--fg-muted);
180
+
181
+ &--warning {
182
+ color: var(--warning);
183
+ }
184
+
185
+ &--error {
186
+ color: var(--destructive);
187
+ }
188
+ }
189
+
190
+ // --------------------------------------------------------------------------
191
+ // Group (controls joined into one unit, like .btn__group)
192
+ // --------------------------------------------------------------------------
193
+
194
+ &__group {
195
+ display: flex;
196
+
197
+ > * {
198
+ border-radius: 0;
199
+ }
200
+
201
+ > :first-child {
202
+ border-top-left-radius: $radius-md;
203
+ border-bottom-left-radius: $radius-md;
204
+ }
205
+
206
+ > :last-child {
207
+ border-top-right-radius: $radius-md;
208
+ border-bottom-right-radius: $radius-md;
209
+ }
210
+
211
+ > :not(:first-child) {
212
+ margin-left: calc(var(--control-border-width) * -1);
213
+ }
214
+
215
+ > :focus,
216
+ > :focus-visible {
217
+ position: relative;
218
+ z-index: 1;
219
+ }
220
+
221
+ > .input,
222
+ > .select,
223
+ > .form__control {
224
+ flex: 1;
225
+ min-width: 0;
226
+ }
227
+
228
+ &--block {
229
+ flex-direction: column;
230
+
231
+ > .input,
232
+ > .select,
233
+ > .form__control {
234
+ flex: none;
235
+ }
236
+
237
+ > :first-child {
238
+ border-radius: $radius-md $radius-md 0 0;
239
+ }
240
+
241
+ > :last-child {
242
+ border-radius: 0 0 $radius-md $radius-md;
243
+ }
244
+
245
+ > :only-child {
246
+ border-radius: $radius-md;
247
+ }
248
+
249
+ > :not(:first-child) {
250
+ margin-left: 0;
251
+ margin-top: calc(var(--control-border-width) * -1);
252
+ }
253
+ }
254
+ }
255
+
256
+ &__addon {
257
+ @include flex-center;
258
+ flex-shrink: 0;
259
+ padding: 0 $spacing-xs;
260
+ font-size: $font-size-sm;
261
+ white-space: nowrap;
262
+ background-color: var(--bg-muted);
263
+ border: var(--control-border-width) solid var(--input);
264
+ color: var(--fg-muted);
265
+ }
266
+
267
+ // --------------------------------------------------------------------------
268
+ // Fieldset
269
+ // --------------------------------------------------------------------------
270
+
271
+ &__fieldset {
272
+ display: flex;
273
+ flex-direction: column;
274
+ gap: $spacing-sm;
275
+ min-width: 0;
276
+ margin: 0;
277
+ padding: $spacing-sm;
278
+ border: 1px solid var(--border);
279
+ border-radius: $radius;
280
+ }
281
+
282
+ &__legend {
283
+ padding: 0 $spacing-2xs;
284
+ font-size: $font-size-sm;
285
+ font-weight: $font-weight-medium;
286
+ color: var(--fg);
287
+ }
288
+
289
+ // --------------------------------------------------------------------------
290
+ // Variants
291
+ // --------------------------------------------------------------------------
292
+
293
+ // Label in the first column; every other part of the field sits in the second
294
+ &--horizontal {
295
+ .form__field {
296
+ display: grid;
297
+ grid-template-columns: 10rem minmax(0, 1fr);
298
+ column-gap: $spacing-sm;
299
+ row-gap: $spacing-2xs;
300
+ align-items: start;
301
+
302
+ > * {
303
+ grid-column: 2;
304
+ }
305
+
306
+ > .form__label {
307
+ grid-column: 1;
308
+ grid-row: 1;
309
+ padding-top: $spacing-2xs;
310
+ }
311
+ }
312
+
313
+ @include max-md {
314
+ .form__field {
315
+ display: flex;
316
+ flex-direction: column;
317
+
318
+ > .form__label {
319
+ padding-top: 0;
320
+ }
321
+ }
322
+ }
323
+ }
324
+
325
+ &--compact {
326
+ gap: $spacing-sm;
327
+
328
+ .form__section {
329
+ gap: $spacing-xs;
330
+ }
331
+ }
332
+ }
@@ -0,0 +1,310 @@
1
+ // ==========================================================================
2
+ // Input Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ // --------------------------------------------------------------------------
9
+ // Base Input
10
+ // --------------------------------------------------------------------------
11
+
12
+ .input {
13
+ display: flex;
14
+ width: 100%;
15
+ height: $input-height-md;
16
+ padding: 0 $spacing-xs;
17
+ font-size: $font-size-sm;
18
+ background-color: transparent;
19
+ border: var(--control-border-width) solid var(--input);
20
+ border-radius: $radius-md;
21
+ color: var(--fg);
22
+ @include transition-colors;
23
+
24
+ &::placeholder {
25
+ color: var(--input-placeholder);
26
+ }
27
+
28
+ &:focus {
29
+ @include focus-ring;
30
+ border-color: var(--ring);
31
+ }
32
+
33
+ &:disabled,
34
+ &--disabled {
35
+ @include disabled;
36
+ background-color: var(--bg-muted);
37
+ }
38
+
39
+ &[readonly] {
40
+ background-color: var(--bg-muted);
41
+ cursor: default;
42
+ }
43
+
44
+ // --------------------------------------------------------------------------
45
+ // Validation
46
+ // --------------------------------------------------------------------------
47
+
48
+ &[aria-invalid="true"],
49
+ &:user-invalid,
50
+ &--error {
51
+ border-color: var(--destructive);
52
+
53
+ &:focus {
54
+ outline-color: var(--destructive);
55
+ }
56
+ }
57
+
58
+ // --------------------------------------------------------------------------
59
+ // Sizes
60
+ // --------------------------------------------------------------------------
61
+
62
+ &--sm {
63
+ height: $input-height-sm;
64
+ padding: 0 $spacing-2xs;
65
+ font-size: $font-size-xs;
66
+ border-radius: $radius-sm;
67
+ }
68
+
69
+ &--lg {
70
+ height: $input-height-lg;
71
+ padding: 0 $spacing-sm;
72
+ font-size: $font-size-base;
73
+ }
74
+ }
75
+
76
+ // --------------------------------------------------------------------------
77
+ // Textarea
78
+ // --------------------------------------------------------------------------
79
+
80
+ .textarea {
81
+ @extend .input;
82
+ height: auto;
83
+ min-height: 5rem;
84
+ padding: $spacing-xs;
85
+ resize: vertical;
86
+ line-height: $line-height-normal;
87
+ }
88
+
89
+ // --------------------------------------------------------------------------
90
+ // Select
91
+ // --------------------------------------------------------------------------
92
+
93
+ .select {
94
+ @extend .input;
95
+ appearance: none;
96
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
97
+ background-repeat: no-repeat;
98
+ background-position: right $spacing-xs center;
99
+ padding-right: $spacing-2xl;
100
+ cursor: pointer;
101
+
102
+ &:disabled {
103
+ cursor: not-allowed;
104
+ }
105
+
106
+ // Auto-width modifier
107
+ &--auto {
108
+ width: auto;
109
+ }
110
+ }
111
+
112
+ // --------------------------------------------------------------------------
113
+ // Checkbox & Radio
114
+ // --------------------------------------------------------------------------
115
+
116
+ .checkbox,
117
+ .radio {
118
+ display: inline-flex;
119
+ align-items: center;
120
+ gap: $spacing-2xs;
121
+ cursor: pointer;
122
+ user-select: none;
123
+
124
+ &__input {
125
+ appearance: none;
126
+ width: 1rem;
127
+ height: 1rem;
128
+ border: var(--control-border-width) solid var(--input);
129
+ background-color: transparent;
130
+ @include transition-default;
131
+ cursor: pointer;
132
+
133
+ &:focus-visible {
134
+ @include focus-ring;
135
+ }
136
+
137
+ &:checked,
138
+ &:indeterminate {
139
+ background-color: var(--primary);
140
+ border-color: var(--primary);
141
+ }
142
+
143
+ &[aria-invalid="true"],
144
+ &:user-invalid {
145
+ border-color: var(--destructive);
146
+ }
147
+
148
+ &:disabled {
149
+ @include disabled;
150
+ cursor: not-allowed;
151
+ }
152
+ }
153
+
154
+ &__label {
155
+ font-size: $font-size-sm;
156
+ line-height: 1;
157
+ }
158
+
159
+ &:has(:disabled),
160
+ &--disabled {
161
+ @include disabled;
162
+ cursor: not-allowed;
163
+ }
164
+ }
165
+
166
+ .checkbox__input {
167
+ border-radius: $radius-sm;
168
+
169
+ &:checked {
170
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
171
+ background-repeat: no-repeat;
172
+ background-position: center;
173
+ }
174
+
175
+ &:indeterminate {
176
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E");
177
+ background-repeat: no-repeat;
178
+ background-position: center;
179
+ }
180
+ }
181
+
182
+ .radio__input {
183
+ border-radius: $radius-full;
184
+
185
+ &:checked {
186
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E");
187
+ background-repeat: no-repeat;
188
+ background-position: center;
189
+ }
190
+ }
191
+
192
+ // --------------------------------------------------------------------------
193
+ // Input with Icon
194
+ // --------------------------------------------------------------------------
195
+
196
+ .inputwrapper {
197
+ position: relative;
198
+ display: flex;
199
+ align-items: center;
200
+
201
+ &__icon {
202
+ position: absolute;
203
+ left: $spacing-xs;
204
+ width: $icon-size-md;
205
+ height: $icon-size-md;
206
+ color: var(--fg-muted);
207
+ pointer-events: none;
208
+
209
+ &--right {
210
+ left: auto;
211
+ right: $spacing-xs;
212
+ }
213
+ }
214
+
215
+ .input {
216
+ &--icon-left {
217
+ padding-left: $spacing-2xl;
218
+ }
219
+
220
+ &--icon-right {
221
+ padding-right: $spacing-2xl;
222
+ }
223
+ }
224
+ }
225
+
226
+ // --------------------------------------------------------------------------
227
+ // Switch / Toggle
228
+ // --------------------------------------------------------------------------
229
+
230
+ .switch {
231
+ // Track size; the thumb and its travel are derived from these
232
+ --switch-width: 2.25rem;
233
+ --switch-height: 1.25rem;
234
+ --switch-inset: 2px;
235
+
236
+ display: inline-flex;
237
+ align-items: center;
238
+ gap: $spacing-2xs;
239
+ // Keeps stacked switches from touching when their container has no gap
240
+ margin-block: $spacing-3xs;
241
+ cursor: pointer;
242
+
243
+ &__input {
244
+ appearance: none;
245
+ flex-shrink: 0;
246
+ width: var(--switch-width);
247
+ height: var(--switch-height);
248
+ background-color: var(--input);
249
+ border-radius: $radius-full;
250
+ position: relative;
251
+ cursor: pointer;
252
+ @include transition-default;
253
+
254
+ &::before {
255
+ content: "";
256
+ position: absolute;
257
+ top: var(--switch-inset);
258
+ left: var(--switch-inset);
259
+ width: calc(var(--switch-height) - 2 * var(--switch-inset));
260
+ height: calc(var(--switch-height) - 2 * var(--switch-inset));
261
+ background-color: var(--bg);
262
+ border-radius: $radius-full;
263
+ @include transition-transform;
264
+ }
265
+
266
+ &:checked {
267
+ background-color: var(--primary);
268
+
269
+ &::before {
270
+ transform: translateX(calc(var(--switch-width) - var(--switch-height)));
271
+ }
272
+ }
273
+
274
+ &:focus-visible {
275
+ @include focus-ring;
276
+ }
277
+
278
+ &:disabled {
279
+ @include disabled;
280
+ cursor: not-allowed;
281
+ }
282
+ }
283
+
284
+ &__label {
285
+ font-size: $font-size-sm;
286
+ user-select: none;
287
+ }
288
+
289
+ &--sm {
290
+ --switch-width: 1.75rem;
291
+ --switch-height: 1rem;
292
+
293
+ .switch__label {
294
+ font-size: $font-size-xs;
295
+ }
296
+ }
297
+
298
+ &--lg {
299
+ --switch-width: 2.75rem;
300
+ --switch-height: 1.5rem;
301
+
302
+ .switch__label {
303
+ font-size: $font-size-base;
304
+ }
305
+ }
306
+
307
+ &:has(:disabled) {
308
+ cursor: not-allowed;
309
+ }
310
+ }