@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,264 @@
1
+ // ==========================================================================
2
+ // Button Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ // --------------------------------------------------------------------------
9
+ // Base Button
10
+ // --------------------------------------------------------------------------
11
+
12
+ .btn {
13
+ display: inline-flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ gap: $spacing-2xs;
17
+ white-space: nowrap;
18
+ font-size: $font-size-sm;
19
+ font-weight: $font-weight-medium;
20
+ height: $btn-height-md;
21
+ padding: 0 $spacing-sm;
22
+ border-radius: $radius-md;
23
+ @include interactive;
24
+
25
+ &:disabled,
26
+ &[aria-disabled="true"],
27
+ &--disabled {
28
+ @include disabled;
29
+ }
30
+
31
+ &[aria-busy="true"] {
32
+ cursor: progress;
33
+ }
34
+
35
+ // Icons are drawn with space inside their box, so a button with an icon beside its label looks
36
+ // heavier on the icon's side. Pulling a leading or trailing icon towards the edge evens it out
37
+ // to the eye. Icon-only buttons are centred and left alone.
38
+ &:not(.btn--icon) > .icon:first-child {
39
+ margin-left: -$spacing-3xs;
40
+ }
41
+
42
+ &:not(.btn--icon) > * + .icon:last-child {
43
+ margin-right: -$spacing-3xs;
44
+ }
45
+
46
+ // Toggle buttons, and radio buttons in a group (role="radio"): only the neutral variants have
47
+ // a distinct "on" look
48
+ &--outline:is([aria-pressed="true"], [aria-checked="true"]),
49
+ &--ghost:is([aria-pressed="true"], [aria-checked="true"]) {
50
+ background-color: var(--accent);
51
+ color: var(--accent-fg);
52
+ }
53
+
54
+ // --------------------------------------------------------------------------
55
+ // Variants
56
+ // --------------------------------------------------------------------------
57
+
58
+ // Primary (default): the bare block carries primary styling so size and
59
+ // layout modifiers keep it; colour variants below override it by source order
60
+ &,
61
+ &--primary {
62
+ background-color: var(--primary);
63
+ color: var(--primary-fg);
64
+
65
+ &:hover:not(:disabled) {
66
+ background-color: var(--primary-hover);
67
+ }
68
+ }
69
+
70
+ // Secondary
71
+ &--secondary {
72
+ background-color: var(--secondary);
73
+ color: var(--secondary-fg);
74
+
75
+ &:hover:not(:disabled) {
76
+ background-color: var(--secondary-hover);
77
+ }
78
+ }
79
+
80
+ // Outline
81
+ &--outline {
82
+ background-color: transparent;
83
+ border: var(--control-border-width) solid var(--border);
84
+ color: var(--fg);
85
+
86
+ &:hover:not(:disabled) {
87
+ background-color: var(--accent);
88
+ color: var(--accent-fg);
89
+ }
90
+ }
91
+
92
+ // Ghost
93
+ &--ghost {
94
+ background-color: transparent;
95
+ color: var(--fg);
96
+
97
+ &:hover:not(:disabled) {
98
+ background-color: var(--accent);
99
+ color: var(--accent-fg);
100
+ }
101
+ }
102
+
103
+ // Destructive
104
+ &--destructive {
105
+ background-color: var(--destructive);
106
+ color: var(--destructive-fg);
107
+
108
+ &:hover:not(:disabled) {
109
+ background-color: var(--destructive-hover);
110
+ }
111
+ }
112
+
113
+ // Link style
114
+ &--link {
115
+ background-color: transparent;
116
+ color: var(--primary);
117
+ text-decoration: underline;
118
+ text-underline-offset: 4px;
119
+ height: auto;
120
+ padding: 0;
121
+
122
+ &:hover:not(:disabled) {
123
+ background-color: transparent;
124
+ text-decoration-thickness: 2px;
125
+ }
126
+ }
127
+
128
+ // --------------------------------------------------------------------------
129
+ // Sizes
130
+ // --------------------------------------------------------------------------
131
+
132
+ &--sm {
133
+ height: $btn-height-sm;
134
+ padding: 0 $spacing-xs;
135
+ font-size: $font-size-xs;
136
+ border-radius: $radius-sm;
137
+ }
138
+
139
+ &--lg {
140
+ height: $btn-height-lg;
141
+ padding: 0 $spacing-lg;
142
+ font-size: $font-size-base;
143
+ }
144
+
145
+ // Icon-only button (square)
146
+ &--icon {
147
+ width: $btn-height-md;
148
+ padding: 0;
149
+
150
+ &.btn--sm {
151
+ width: $btn-height-sm;
152
+ }
153
+
154
+ &.btn--lg {
155
+ width: $btn-height-lg;
156
+ }
157
+ }
158
+
159
+ // Full width
160
+ &--full {
161
+ width: 100%;
162
+ }
163
+
164
+ // Justify start (for full-width buttons with icon)
165
+ &--start {
166
+ justify-content: flex-start;
167
+ }
168
+
169
+ // --------------------------------------------------------------------------
170
+ // Elements
171
+ // --------------------------------------------------------------------------
172
+
173
+ &__icon {
174
+ flex-shrink: 0;
175
+ width: $icon-size-md;
176
+ height: $icon-size-md;
177
+
178
+ .btn--sm & {
179
+ width: $icon-size-sm;
180
+ height: $icon-size-sm;
181
+ }
182
+
183
+ .btn--lg & {
184
+ width: $icon-size-lg;
185
+ height: $icon-size-lg;
186
+ }
187
+ }
188
+
189
+ &__spinner {
190
+ animation: spin 1s linear infinite;
191
+ }
192
+ }
193
+
194
+ // --------------------------------------------------------------------------
195
+ // Button Group
196
+ // --------------------------------------------------------------------------
197
+
198
+ .btn__group {
199
+ display: inline-flex;
200
+
201
+ // Buttons may sit directly in the group or one level down, e.g. a .dropdown trigger
202
+ > .btn,
203
+ > * > .btn {
204
+ position: relative;
205
+ border-radius: 0;
206
+
207
+ // The raised button's border covers the shared keyline, so the focus colour shows on both edges
208
+ &:hover,
209
+ &:focus-visible,
210
+ &[aria-expanded="true"] {
211
+ z-index: 1;
212
+ }
213
+
214
+ &:focus-visible,
215
+ &[aria-expanded="true"] {
216
+ border-color: var(--primary);
217
+ }
218
+ }
219
+
220
+ > :not(:first-child) {
221
+ margin-left: calc(var(--control-border-width) * -1);
222
+ }
223
+
224
+ // A group of mutually exclusive choices (role="radiogroup") fills the chosen one, so it reads
225
+ // at a glance
226
+ &[role="radiogroup"] > .btn[aria-checked="true"] {
227
+ z-index: 1;
228
+ color: var(--primary-fg);
229
+ background-color: var(--primary);
230
+ border-color: var(--primary);
231
+ }
232
+
233
+ > .btn:first-child,
234
+ > :first-child > .btn {
235
+ border-top-left-radius: $radius-md;
236
+ border-bottom-left-radius: $radius-md;
237
+ }
238
+
239
+ > .btn:last-child,
240
+ > :last-child > .btn {
241
+ border-top-right-radius: $radius-md;
242
+ border-bottom-right-radius: $radius-md;
243
+ }
244
+
245
+ // Vertical group
246
+ &--vertical {
247
+ flex-direction: column;
248
+
249
+ > :not(:first-child) {
250
+ margin-left: 0;
251
+ margin-top: calc(var(--control-border-width) * -1);
252
+ }
253
+
254
+ > .btn:first-child,
255
+ > :first-child > .btn {
256
+ border-radius: $radius-md $radius-md 0 0;
257
+ }
258
+
259
+ > .btn:last-child,
260
+ > :last-child > .btn {
261
+ border-radius: 0 0 $radius-md $radius-md;
262
+ }
263
+ }
264
+ }
@@ -0,0 +1,256 @@
1
+ // ==========================================================================
2
+ // Card Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ $card-inner-radius: calc(#{$radius} - 1px);
9
+
10
+ // --------------------------------------------------------------------------
11
+ // Base Card
12
+ // --------------------------------------------------------------------------
13
+
14
+ .card {
15
+ display: flex;
16
+ flex-direction: column;
17
+ background-color: var(--card);
18
+ color: var(--card-fg);
19
+ border: 1px solid var(--border);
20
+ border-radius: $radius;
21
+
22
+ // --------------------------------------------------------------------------
23
+ // Variants
24
+ // --------------------------------------------------------------------------
25
+
26
+ &--elevated {
27
+ border: none;
28
+ box-shadow: $shadow-md;
29
+ }
30
+
31
+ &--ghost {
32
+ border: none;
33
+ background-color: transparent;
34
+ }
35
+
36
+ &--interactive {
37
+ @include transition-default;
38
+ cursor: pointer;
39
+
40
+ &:hover {
41
+ border-color: var(--fg-subtle);
42
+ }
43
+
44
+ &:focus-visible {
45
+ @include focus-ring;
46
+ }
47
+ }
48
+
49
+ &--destructive {
50
+ border-color: var(--destructive-muted);
51
+ background-color: var(--destructive-muted);
52
+ }
53
+
54
+ // --------------------------------------------------------------------------
55
+ // Elements
56
+ // --------------------------------------------------------------------------
57
+
58
+ &__header {
59
+ display: flex;
60
+ flex-direction: column;
61
+ gap: $spacing-3xs;
62
+ padding: $spacing-sm;
63
+
64
+ &--row {
65
+ flex-direction: row;
66
+ align-items: baseline;
67
+ justify-content: space-between;
68
+
69
+ > svg,
70
+ > .btn--icon {
71
+ align-self: center;
72
+ flex-shrink: 0;
73
+ }
74
+
75
+ // The title side shrinks and wraps rather than pushing what follows out of the card
76
+ > :first-child {
77
+ min-width: 0;
78
+ }
79
+
80
+ // Header actions hold their line; the title and description wrap instead. Only a trailing
81
+ // cluster is actions: a leading one is the title side (an icon beside the title)
82
+ > .cluster:last-child:not(:first-child) {
83
+ flex-shrink: 0;
84
+ margin-left: $spacing-sm;
85
+ }
86
+ }
87
+
88
+ &--center {
89
+ text-align: center;
90
+ align-items: center;
91
+ }
92
+ }
93
+
94
+ &__title {
95
+ font-size: $font-size-lg;
96
+ font-weight: $font-weight-semibold;
97
+ line-height: $line-height-tight;
98
+ letter-spacing: $letter-spacing-tight;
99
+ }
100
+
101
+ &__description {
102
+ font-size: $font-size-sm;
103
+ color: var(--fg-muted);
104
+ }
105
+
106
+ &__content {
107
+ padding: $spacing-sm;
108
+ padding-top: 0;
109
+ flex: 1;
110
+
111
+ // Add top padding when needed
112
+ &--pt {
113
+ padding-top: $spacing-sm;
114
+ }
115
+
116
+ // No padding (flush content)
117
+ &--flush {
118
+ padding: 0;
119
+
120
+ &:first-child {
121
+ border-top-left-radius: $card-inner-radius;
122
+ border-top-right-radius: $card-inner-radius;
123
+ }
124
+
125
+ &:last-child {
126
+ border-bottom-left-radius: $card-inner-radius;
127
+ border-bottom-right-radius: $card-inner-radius;
128
+ }
129
+
130
+ > .table__wrapper {
131
+ border-radius: inherit;
132
+ }
133
+ }
134
+
135
+ &:first-child {
136
+ padding-top: $spacing-sm;
137
+ }
138
+ }
139
+
140
+ &__footer {
141
+ display: flex;
142
+ align-items: center;
143
+ gap: $spacing-2xs;
144
+ padding: $spacing-sm;
145
+ padding-top: 0;
146
+
147
+ &--border {
148
+ padding-top: $spacing-sm;
149
+ border-top: 1px solid var(--border);
150
+ }
151
+
152
+ &--end {
153
+ justify-content: flex-end;
154
+ }
155
+
156
+ &--between {
157
+ justify-content: space-between;
158
+ }
159
+ }
160
+
161
+ &__image {
162
+ width: 100%;
163
+ height: auto;
164
+ object-fit: cover;
165
+
166
+ &:first-child {
167
+ border-top-left-radius: $card-inner-radius;
168
+ border-top-right-radius: $card-inner-radius;
169
+ }
170
+
171
+ &:last-child {
172
+ border-bottom-left-radius: $card-inner-radius;
173
+ border-bottom-right-radius: $card-inner-radius;
174
+ }
175
+
176
+ &--top {
177
+ border-bottom: 1px solid var(--border);
178
+ }
179
+ }
180
+
181
+ // --------------------------------------------------------------------------
182
+ // Padding Variants
183
+ // --------------------------------------------------------------------------
184
+
185
+ &--sm {
186
+ .card__header,
187
+ .card__content,
188
+ .card__footer {
189
+ padding: $spacing-xs;
190
+ }
191
+
192
+ .card__content:first-child {
193
+ padding-top: $spacing-xs;
194
+ }
195
+
196
+ .card__content,
197
+ .card__footer {
198
+ padding-top: 0;
199
+ }
200
+
201
+ .card__footer--border {
202
+ padding-top: $spacing-xs;
203
+ }
204
+ }
205
+
206
+ &--lg {
207
+ .card__header,
208
+ .card__content,
209
+ .card__footer {
210
+ padding: $spacing-lg;
211
+ }
212
+
213
+ .card__content:first-child {
214
+ padding-top: $spacing-lg;
215
+ }
216
+
217
+ .card__content,
218
+ .card__footer {
219
+ padding-top: 0;
220
+ }
221
+
222
+ .card__footer--border {
223
+ padding-top: $spacing-lg;
224
+ }
225
+ }
226
+ }
227
+
228
+ // --------------------------------------------------------------------------
229
+ // Card Grid
230
+ // --------------------------------------------------------------------------
231
+
232
+ .card__grid {
233
+ display: grid;
234
+ gap: $spacing-lg;
235
+ grid-template-columns: repeat(1, 1fr);
236
+
237
+ @include sm {
238
+ grid-template-columns: repeat(2, 1fr);
239
+ }
240
+
241
+ @include lg {
242
+ grid-template-columns: repeat(3, 1fr);
243
+ }
244
+
245
+ &--2 {
246
+ @include sm {
247
+ grid-template-columns: repeat(2, 1fr);
248
+ }
249
+ }
250
+
251
+ &--4 {
252
+ @include lg {
253
+ grid-template-columns: repeat(4, 1fr);
254
+ }
255
+ }
256
+ }