@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,246 @@
1
+ // ==========================================================================
2
+ // Chart Component
3
+ // A <figure class="chart" data-chart="line|area|bar|stacked-bar"> wrapping a data <table>.
4
+ // Without JavaScript the table is the chart; main.js renders the SVG plot, legend and
5
+ // tooltip from it and keeps the table available as the accessible table view.
6
+ // ==========================================================================
7
+
8
+ @use "../variables" as *;
9
+ @use "../mixins" as *;
10
+
11
+ .chart {
12
+ --chart-height: 15rem;
13
+
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: $spacing-xs;
17
+ margin: 0;
18
+ min-width: 0;
19
+
20
+ &--sm {
21
+ --chart-height: 10rem;
22
+ }
23
+
24
+ &--lg {
25
+ --chart-height: 20rem;
26
+ }
27
+
28
+ // --------------------------------------------------------------------------
29
+ // Header: title, description and the table-view toggle
30
+ // --------------------------------------------------------------------------
31
+
32
+ &__header {
33
+ display: flex;
34
+ align-items: flex-start;
35
+ justify-content: space-between;
36
+ gap: $spacing-sm;
37
+ }
38
+
39
+ &__title {
40
+ font-size: $font-size-sm;
41
+ font-weight: $font-weight-semibold;
42
+ color: var(--fg);
43
+ }
44
+
45
+ &__description {
46
+ margin-top: $spacing-3xs;
47
+ font-size: $font-size-xs;
48
+ color: var(--fg-muted);
49
+ }
50
+
51
+ &__value {
52
+ margin-top: $spacing-3xs;
53
+ font-size: $font-size-2xl;
54
+ font-weight: $font-weight-semibold;
55
+ letter-spacing: $letter-spacing-tight;
56
+ color: var(--fg);
57
+ }
58
+
59
+ // --------------------------------------------------------------------------
60
+ // Legend (always shown for two or more series)
61
+ // --------------------------------------------------------------------------
62
+
63
+ &__legend {
64
+ display: flex;
65
+ flex-wrap: wrap;
66
+ gap: $spacing-3xs $spacing-sm;
67
+ margin: 0;
68
+ padding: 0;
69
+ list-style: none;
70
+ font-size: $font-size-xs;
71
+ color: var(--fg-muted);
72
+ }
73
+
74
+ &__legend-item {
75
+ display: inline-flex;
76
+ align-items: center;
77
+ gap: $spacing-3xs;
78
+ }
79
+
80
+ // Mirrors the mark: a short line for line/area charts, a square for bars
81
+ &__key {
82
+ flex-shrink: 0;
83
+ width: 0.75rem;
84
+ height: 2px;
85
+ border-radius: 1px;
86
+ background-color: currentColor;
87
+
88
+ &--box {
89
+ height: 0.625rem;
90
+ width: 0.625rem;
91
+ border-radius: 2px;
92
+ }
93
+ }
94
+
95
+ // --------------------------------------------------------------------------
96
+ // Plot
97
+ // --------------------------------------------------------------------------
98
+
99
+ &__plot {
100
+ position: relative;
101
+ height: var(--chart-height);
102
+
103
+ &:focus-visible {
104
+ @include focus-ring;
105
+ border-radius: $radius-sm;
106
+ }
107
+
108
+ svg {
109
+ display: block;
110
+ width: 100%;
111
+ height: 100%;
112
+ overflow: visible;
113
+ }
114
+ }
115
+
116
+ &__grid {
117
+ stroke: var(--chart-grid);
118
+ stroke-width: 1;
119
+ shape-rendering: crispEdges;
120
+ }
121
+
122
+ &__baseline {
123
+ stroke: var(--chart-axis);
124
+ stroke-width: 1;
125
+ shape-rendering: crispEdges;
126
+ }
127
+
128
+ &__tick {
129
+ fill: var(--chart-muted);
130
+ font-size: 11px;
131
+ font-variant-numeric: tabular-nums;
132
+ }
133
+
134
+ &__line {
135
+ fill: none;
136
+ stroke-width: 2;
137
+ stroke-linejoin: round;
138
+ stroke-linecap: round;
139
+ }
140
+
141
+ &__area {
142
+ opacity: 0.1;
143
+ }
144
+
145
+ // Bars and end dots are separated by the surface colour, never by a border
146
+ &__bar {
147
+ stroke: var(--chart-surface);
148
+ stroke-width: 1;
149
+ @include transition-opacity;
150
+
151
+ .chart__plot:has(.chart__bar--active) &:not(.chart__bar--active) {
152
+ opacity: 0.55;
153
+ }
154
+ }
155
+
156
+ &__dot {
157
+ stroke: var(--chart-surface);
158
+ stroke-width: 2;
159
+ }
160
+
161
+ &__label {
162
+ fill: var(--fg);
163
+ font-size: 11px;
164
+ font-weight: $font-weight-medium;
165
+ }
166
+
167
+ &__crosshair {
168
+ stroke: var(--chart-axis);
169
+ stroke-width: 1;
170
+ shape-rendering: crispEdges;
171
+ pointer-events: none;
172
+ }
173
+
174
+ &__hit {
175
+ fill: transparent;
176
+ cursor: crosshair;
177
+ }
178
+
179
+ // --------------------------------------------------------------------------
180
+ // Tooltip: values lead, series names follow
181
+ // --------------------------------------------------------------------------
182
+
183
+ &__tooltip {
184
+ position: absolute;
185
+ z-index: $z-tooltip;
186
+ min-width: 8rem;
187
+ padding: $spacing-2xs $spacing-xs;
188
+ font-size: $font-size-xs;
189
+ color: var(--popover-fg);
190
+ background-color: var(--popover);
191
+ border: 1px solid var(--border);
192
+ border-radius: $radius-md;
193
+ box-shadow: $shadow-md;
194
+ pointer-events: none;
195
+ white-space: nowrap;
196
+ }
197
+
198
+ &__tooltip-title {
199
+ margin-bottom: $spacing-3xs;
200
+ color: var(--fg-muted);
201
+ }
202
+
203
+ &__tooltip-row {
204
+ display: flex;
205
+ align-items: center;
206
+ gap: $spacing-2xs;
207
+
208
+ strong {
209
+ font-weight: $font-weight-semibold;
210
+ font-variant-numeric: tabular-nums;
211
+ color: var(--fg);
212
+ }
213
+
214
+ span:last-child {
215
+ color: var(--fg-muted);
216
+ }
217
+ }
218
+
219
+ // --------------------------------------------------------------------------
220
+ // Table view: the chart's accessible twin
221
+ // --------------------------------------------------------------------------
222
+
223
+ &__table {
224
+ width: 100%;
225
+ font-size: $font-size-xs;
226
+ font-variant-numeric: tabular-nums;
227
+ border-collapse: collapse;
228
+
229
+ th,
230
+ td {
231
+ padding: $spacing-3xs $spacing-2xs;
232
+ text-align: right;
233
+ border-bottom: 1px solid var(--border);
234
+ }
235
+
236
+ th:first-child,
237
+ td:first-child {
238
+ text-align: left;
239
+ }
240
+
241
+ thead th {
242
+ font-weight: $font-weight-medium;
243
+ color: var(--fg-muted);
244
+ }
245
+ }
246
+ }
@@ -0,0 +1,267 @@
1
+ // ==========================================================================
2
+ // Command Palette Component
3
+ // ==========================================================================
4
+
5
+ @use "../variables" as *;
6
+ @use "../mixins" as *;
7
+
8
+ // --------------------------------------------------------------------------
9
+ // Command Palette (⌘K style)
10
+ // --------------------------------------------------------------------------
11
+
12
+ .command {
13
+ position: fixed;
14
+ inset: 0;
15
+ z-index: $z-modal;
16
+ display: flex;
17
+ align-items: flex-start;
18
+ justify-content: center;
19
+ padding-top: 10vh;
20
+ opacity: 0;
21
+ visibility: hidden;
22
+ @include transition-opacity;
23
+
24
+ &[open],
25
+ &--open {
26
+ opacity: 1;
27
+ visibility: visible;
28
+ }
29
+
30
+ // --------------------------------------------------------------------------
31
+ // Backdrop
32
+ // --------------------------------------------------------------------------
33
+
34
+ &__backdrop {
35
+ position: absolute;
36
+ inset: 0;
37
+ background-color: rgb(0 0 0 / 0.5);
38
+ backdrop-filter: blur(2px);
39
+ }
40
+
41
+ // --------------------------------------------------------------------------
42
+ // Dialog
43
+ // --------------------------------------------------------------------------
44
+
45
+ &__dialog {
46
+ position: relative;
47
+ width: 100%;
48
+ max-width: 32rem;
49
+ max-height: 24rem;
50
+ margin: 0 $spacing-sm;
51
+ background-color: var(--popover);
52
+ border: 1px solid var(--border);
53
+ border-radius: $radius;
54
+ box-shadow: $shadow-xl;
55
+ overflow: hidden;
56
+ display: flex;
57
+ flex-direction: column;
58
+ @include transition-default;
59
+
60
+ // Only shrunk while inside a closed overlay, so a standalone dialog draws at full size
61
+ .command:not([open], .command--open) & {
62
+ transform: scale(0.95) translateY(-0.5rem);
63
+ }
64
+ }
65
+
66
+ // --------------------------------------------------------------------------
67
+ // Search Input
68
+ // --------------------------------------------------------------------------
69
+
70
+ &__inputwrapper {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: $spacing-2xs;
74
+ padding: $spacing-xs $spacing-sm;
75
+ border-bottom: 1px solid var(--border);
76
+ }
77
+
78
+ &__icon {
79
+ width: $icon-size-md;
80
+ height: $icon-size-md;
81
+ color: var(--fg-muted);
82
+ flex-shrink: 0;
83
+ }
84
+
85
+ &__input {
86
+ flex: 1;
87
+ background: transparent;
88
+ border: none;
89
+ font-size: $font-size-base;
90
+ color: var(--fg);
91
+ outline: none;
92
+
93
+ &::placeholder {
94
+ color: var(--fg-muted);
95
+ }
96
+ }
97
+
98
+ &__shortcut {
99
+ display: inline-flex;
100
+ align-items: center;
101
+ gap: $spacing-3xs;
102
+ font-family: $font-mono;
103
+ font-size: $font-size-xs;
104
+ color: var(--fg-muted);
105
+ }
106
+
107
+ &__kbd {
108
+ display: inline-flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ min-width: 1.25rem;
112
+ height: 1.25rem;
113
+ padding: 0 $spacing-3xs;
114
+ background-color: var(--bg-muted);
115
+ border: 1px solid var(--border);
116
+ border-radius: $radius-sm;
117
+ font-size: $font-size-xs;
118
+ }
119
+
120
+ // --------------------------------------------------------------------------
121
+ // Results List
122
+ // --------------------------------------------------------------------------
123
+
124
+ &__list {
125
+ flex: 1;
126
+ overflow-y: auto;
127
+ padding: $spacing-2xs;
128
+ @include scrollbar-thin;
129
+ }
130
+
131
+ &__empty {
132
+ padding: $spacing-xl $spacing-sm;
133
+ text-align: center;
134
+ color: var(--fg-muted);
135
+ font-size: $font-size-sm;
136
+ }
137
+
138
+ &__group {
139
+ & + & {
140
+ margin-top: $spacing-2xs;
141
+ }
142
+ }
143
+
144
+ &__group-heading {
145
+ padding: $spacing-2xs;
146
+ font-size: $font-size-xs;
147
+ font-weight: $font-weight-medium;
148
+ color: var(--fg-muted);
149
+ text-transform: uppercase;
150
+ letter-spacing: $letter-spacing-wide;
151
+ }
152
+
153
+ &__item {
154
+ display: flex;
155
+ align-items: center;
156
+ gap: $spacing-xs;
157
+ padding: $spacing-2xs $spacing-xs;
158
+ font-size: $font-size-sm;
159
+ color: var(--fg);
160
+ border-radius: $radius-md;
161
+ cursor: pointer;
162
+ @include transition-colors;
163
+
164
+ &:hover,
165
+ &[aria-selected="true"],
166
+ &--selected {
167
+ background-color: var(--accent);
168
+ }
169
+
170
+ &:disabled,
171
+ &[aria-disabled="true"],
172
+ &--disabled {
173
+ @include disabled;
174
+ }
175
+ }
176
+
177
+ &__item-icon {
178
+ width: $icon-size-md;
179
+ height: $icon-size-md;
180
+ color: var(--fg-muted);
181
+ flex-shrink: 0;
182
+ }
183
+
184
+ &__item-content {
185
+ flex: 1;
186
+ display: flex;
187
+ flex-direction: column;
188
+ gap: 0.125rem;
189
+ min-width: 0;
190
+ }
191
+
192
+ &__item-title {
193
+ @include text-truncate;
194
+ }
195
+
196
+ &__item-description {
197
+ font-size: $font-size-xs;
198
+ color: var(--fg-muted);
199
+ @include text-truncate;
200
+ }
201
+
202
+ &__item-shortcut {
203
+ display: flex;
204
+ align-items: center;
205
+ gap: $spacing-3xs;
206
+ margin-left: auto;
207
+ flex-shrink: 0;
208
+ }
209
+
210
+ // --------------------------------------------------------------------------
211
+ // Footer
212
+ // --------------------------------------------------------------------------
213
+
214
+ &__footer {
215
+ display: flex;
216
+ align-items: center;
217
+ justify-content: space-between;
218
+ padding: $spacing-2xs $spacing-sm;
219
+ border-top: 1px solid var(--border);
220
+ font-size: $font-size-xs;
221
+ color: var(--fg-muted);
222
+ }
223
+
224
+ &__hint {
225
+ display: flex;
226
+ align-items: center;
227
+ gap: $spacing-xs;
228
+ }
229
+
230
+ &__hint-item {
231
+ display: flex;
232
+ align-items: center;
233
+ gap: $spacing-3xs;
234
+ }
235
+ }
236
+
237
+ // --------------------------------------------------------------------------
238
+ // Keyboard Shortcut Display
239
+ // --------------------------------------------------------------------------
240
+
241
+ .kbd {
242
+ display: inline-flex;
243
+ align-items: center;
244
+ justify-content: center;
245
+ min-width: 1.5rem;
246
+ height: 1.5rem;
247
+ padding: 0 $spacing-3xs;
248
+ font-family: $font-mono;
249
+ font-size: $font-size-xs;
250
+ color: var(--fg-muted);
251
+ background-color: var(--bg-muted);
252
+ border: 1px solid var(--border);
253
+ border-radius: $radius-sm;
254
+ box-shadow: inset 0 -1px 0 var(--border);
255
+
256
+ &--sm {
257
+ min-width: 1.25rem;
258
+ height: 1.25rem;
259
+ font-size: 0.625rem;
260
+ }
261
+
262
+ &--lg {
263
+ min-width: 2rem;
264
+ height: 2rem;
265
+ font-size: $font-size-sm;
266
+ }
267
+ }