@parallelogram-js/dashboard 0.0.0-stage → 0.1.2

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 (78) hide show
  1. package/CHANGELOG.md +124 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1391 -2
  4. package/dist/parallelogram-dashboard.css +9478 -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 +61 -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/_auth.scss +98 -0
  20. package/scss/components/_avatar.scss +203 -0
  21. package/scss/components/_badge.scss +176 -0
  22. package/scss/components/_banner.scss +344 -0
  23. package/scss/components/_breadcrumb.scss +220 -0
  24. package/scss/components/_button.scss +264 -0
  25. package/scss/components/_card.scss +256 -0
  26. package/scss/components/_chart.scss +246 -0
  27. package/scss/components/_command.scss +267 -0
  28. package/scss/components/_dashboard.scss +681 -0
  29. package/scss/components/_data-list.scss +280 -0
  30. package/scss/components/_dropdown.scss +318 -0
  31. package/scss/components/_empty.scss +226 -0
  32. package/scss/components/_filebrowser.scss +906 -0
  33. package/scss/components/_form-layout.scss +332 -0
  34. package/scss/components/_input.scss +310 -0
  35. package/scss/components/_list.scss +130 -0
  36. package/scss/components/_media.scss +239 -0
  37. package/scss/components/_modal.scss +298 -0
  38. package/scss/components/_navbar.scss +312 -0
  39. package/scss/components/_notification.scss +59 -0
  40. package/scss/components/_pageheader.scss +99 -0
  41. package/scss/components/_pagination.scss +165 -0
  42. package/scss/components/_progress.scss +333 -0
  43. package/scss/components/_separator.scss +129 -0
  44. package/scss/components/_sheet.scss +286 -0
  45. package/scss/components/_sidebar.scss +324 -0
  46. package/scss/components/_skeleton.scss +246 -0
  47. package/scss/components/_stat.scss +218 -0
  48. package/scss/components/_table.scss +589 -0
  49. package/scss/components/_tabs.scss +266 -0
  50. package/scss/components/_timeline.scss +339 -0
  51. package/scss/components/_toast.scss +259 -0
  52. package/scss/components/_toolbar.scss +301 -0
  53. package/scss/components/_tooltip.scss +250 -0
  54. package/scss/main.scss +6 -0
  55. package/src/js/behaviours/accordion.js +58 -0
  56. package/src/js/behaviours/action-bar-list.js +406 -0
  57. package/src/js/behaviours/action-bar.js +29 -0
  58. package/src/js/behaviours/chart.js +339 -0
  59. package/src/js/behaviours/collapsible.js +34 -0
  60. package/src/js/behaviours/editable-table.js +91 -0
  61. package/src/js/behaviours/expandable.js +80 -0
  62. package/src/js/behaviours/overflow-actions.js +137 -0
  63. package/src/js/behaviours/publish-schedule.js +91 -0
  64. package/src/js/behaviours/search-clear.js +19 -0
  65. package/src/js/behaviours/segmented-control.js +43 -0
  66. package/src/js/behaviours/submenu.js +73 -0
  67. package/src/js/behaviours/table-columns.js +77 -0
  68. package/src/js/behaviours/table-paste.js +305 -0
  69. package/src/js/behaviours/table-reorder.js +252 -0
  70. package/src/js/behaviours/table-sort.js +101 -0
  71. package/src/js/behaviours/tabs.js +148 -0
  72. package/src/js/behaviours/toast-manager.js +106 -0
  73. package/src/js/behaviours/toggle.js +186 -0
  74. package/src/js/behaviours/unsaved-guard.js +88 -0
  75. package/src/js/core-loader.js +26 -0
  76. package/src/js/index.js +85 -0
  77. package/src/js/polyfills/dialog-commands.js +20 -0
  78. package/src/js/util/dom.js +39 -0
@@ -0,0 +1,340 @@
1
+ // ==========================================================================
2
+ // Custom Properties
3
+ // The theme tokens and the @parallelogram-js/core tokens they feed. Kept apart from
4
+ // _variables.scss so stylesheets that only need the Sass values emit no CSS from it.
5
+ // ==========================================================================
6
+
7
+ @use "sass:list";
8
+ @use "sass:map";
9
+ @use "variables" as *;
10
+
11
+ // --------------------------------------------------------------------------
12
+ // Theme Tokens
13
+ //
14
+ // Each token holds its light and dark value in one light-dark() pair, so the theme follows the
15
+ // operating system without a second block of declarations. data-theme="light" or "dark" on any
16
+ // element pins that subtree to one theme.
17
+ // --------------------------------------------------------------------------
18
+
19
+ $theme-tokens: (
20
+ // Background
21
+ bg: ($zinc-50, $zinc-950),
22
+ bg-muted: ($zinc-100, $zinc-900),
23
+ bg-subtle: ($zinc-200, $zinc-800),
24
+
25
+ // Foreground
26
+ fg: ($zinc-950, $zinc-50),
27
+ fg-muted: ($zinc-500, $zinc-400),
28
+ fg-subtle: ($zinc-400, $zinc-500),
29
+
30
+ // Border
31
+ border: ($zinc-200, $zinc-800),
32
+ border-muted: ($zinc-100, $zinc-900),
33
+
34
+ // Primary (dark on light, light on dark)
35
+ primary: ($zinc-900, $zinc-50),
36
+ primary-fg: ($zinc-50, $zinc-900),
37
+ primary-hover: ($zinc-800, $zinc-200),
38
+
39
+ // Secondary
40
+ secondary: ($zinc-100, $zinc-800),
41
+ secondary-fg: ($zinc-900, $zinc-50),
42
+ secondary-hover: ($zinc-200, $zinc-700),
43
+
44
+ // Destructive
45
+ destructive: ($red-500, $red-600),
46
+ destructive-fg: ($zinc-50, $zinc-50),
47
+ destructive-hover: ($red-600, $red-500),
48
+ destructive-muted: ($red-50, $red-900),
49
+ destructive-muted-fg: ($red-900, $red-100),
50
+
51
+ // Success
52
+ success: ($green-500, $green-500),
53
+ success-fg: ($zinc-50, $zinc-950),
54
+ success-muted: ($green-50, $green-900),
55
+ success-muted-fg: ($green-900, $green-100),
56
+
57
+ // Warning
58
+ warning: ($amber-500, $amber-500),
59
+ warning-fg: ($zinc-950, $zinc-950),
60
+ warning-muted: ($amber-50, $amber-900),
61
+ warning-muted-fg: ($amber-900, $amber-100),
62
+
63
+ // Info
64
+ info: ($blue-500, $blue-500),
65
+ info-fg: ($zinc-50, $zinc-50),
66
+ info-muted: ($blue-50, $blue-900),
67
+ info-muted-fg: ($blue-900, $blue-100),
68
+
69
+ // Accent (used for highlights, selections)
70
+ accent: ($zinc-100, $zinc-800),
71
+ accent-fg: ($zinc-900, $zinc-50),
72
+
73
+ // Focus ring
74
+ ring: ($zinc-400, $zinc-500),
75
+ ring-offset: ($zinc-50, $zinc-950),
76
+
77
+ // Card
78
+ card: ($zinc-50, $zinc-900),
79
+ card-fg: ($zinc-950, $zinc-50),
80
+
81
+ // Popover/Dropdown
82
+ popover: ($zinc-50, $zinc-900),
83
+ popover-fg: ($zinc-950, $zinc-50),
84
+
85
+ // Input
86
+ input: ($zinc-200, $zinc-700),
87
+ input-placeholder: ($zinc-400, $zinc-500),
88
+
89
+ // Sidebar
90
+ sidebar: ($zinc-50, $zinc-950),
91
+ sidebar-fg: ($zinc-950, $zinc-50),
92
+ sidebar-muted: ($zinc-500, $zinc-400),
93
+ sidebar-border: ($zinc-200, $zinc-800),
94
+ sidebar-accent: ($zinc-100, $zinc-800),
95
+ sidebar-accent-fg: ($zinc-900, $zinc-50),
96
+
97
+ // Chart series, in fixed order (never cycled). Validated for colour-vision deficiency against
98
+ // each theme's card surface; light slots 3–5 sit below 3:1, so charts always offer a table view
99
+ chart-1: (#2a78d6, #3987e5),
100
+ chart-2: (#eb6834, #d95926),
101
+ chart-3: (#1baf7a, #199e70),
102
+ chart-4: (#eda100, #c98500),
103
+ chart-5: (#e87ba4, #d55181),
104
+ chart-6: (#008300, #008300),
105
+ chart-7: (#4a3aa7, #9085e9),
106
+ chart-8: (#e34948, #e66767),
107
+ chart-grid: ($zinc-100, $zinc-800),
108
+ chart-axis: ($zinc-300, $zinc-700),
109
+ chart-muted: ($zinc-500, $zinc-400),
110
+ ) !default;
111
+
112
+ // --------------------------------------------------------------------------
113
+ // Chrome Tokens
114
+ //
115
+ // The rail (navmenu), section menu (subnav) and page header each read their own set, so a theme
116
+ // can colour them apart from the page, such as a dark rail beside a light page. Inside a region
117
+ // the component points the general tokens ($chrome-remapped) at its own, so everything in it
118
+ // follows. Each value defaults to the general token, which keeps the standard look.
119
+ // --------------------------------------------------------------------------
120
+
121
+ $chrome-defaults: (
122
+ bg: var(--bg),
123
+ fg: var(--fg),
124
+ fg-muted: var(--fg-muted),
125
+ fg-subtle: var(--fg-subtle),
126
+ bg-muted: var(--bg-muted),
127
+ bg-subtle: var(--bg-subtle),
128
+ accent: var(--accent),
129
+ accent-fg: var(--accent-fg),
130
+ border: var(--border),
131
+ input: var(--input),
132
+ input-placeholder: var(--input-placeholder),
133
+ icon-stroke-width: var(--icon-stroke-width),
134
+ );
135
+
136
+ // A region's head (the logo cell, the section menu's title bar) can be coloured apart from its body
137
+ @function _head-defaults($region) {
138
+ $head: ();
139
+ @each $name in (bg, fg, fg-muted, accent, accent-fg, border) {
140
+ $head: map.set($head, head-#{$name}, var(--#{$region}-#{$name}));
141
+ }
142
+ @return $head;
143
+ }
144
+
145
+ $chrome-tokens: (
146
+ navmenu: map.merge(map.merge($chrome-defaults, (bg: var(--bg-muted), indicator: var(--primary))), _head-defaults(navmenu)),
147
+ subnav: map.merge($chrome-defaults, _head-defaults(subnav)),
148
+ header: $chrome-defaults,
149
+ ) !default;
150
+
151
+ :root {
152
+ color-scheme: light dark;
153
+
154
+ @each $name, $pair in $theme-tokens {
155
+ $light: list.nth($pair, 1);
156
+ $dark: list.nth($pair, 2);
157
+ @if $light == $dark {
158
+ --#{$name}: #{$light};
159
+ } @else {
160
+ --#{$name}: light-dark(#{$light}, #{$dark});
161
+ }
162
+ }
163
+
164
+ --ring-alpha: color-mix(in srgb, var(--ring) 25%, transparent);
165
+ --chart-surface: var(--card);
166
+
167
+ // Shape
168
+ @each $name, $size in $radius-sizes {
169
+ --radius-#{$name}: #{$size};
170
+ }
171
+ --radius: var(--radius-lg);
172
+ --control-border-width: #{$control-border-width};
173
+ --icon-stroke-width: #{$icon-stroke-width};
174
+
175
+ // Chrome regions
176
+ @each $region, $tokens in $chrome-tokens {
177
+ @each $name, $value in $tokens {
178
+ --#{$region}-#{$name}: #{$value};
179
+ }
180
+ }
181
+
182
+ // The page's own values, kept for popovers that open inside a chrome region
183
+ @each $name in $chrome-remapped {
184
+ --page-#{$name}: var(--#{$name});
185
+ }
186
+ }
187
+
188
+ [data-theme="light"] {
189
+ color-scheme: light;
190
+ }
191
+
192
+ [data-theme="dark"] {
193
+ color-scheme: dark;
194
+ }
195
+
196
+
197
+ @function _transition-list($properties, $timing) {
198
+ $list: ();
199
+ @each $property in $properties {
200
+ $list: list.append($list, $property $timing, $separator: comma);
201
+ }
202
+ @return $list;
203
+ }
204
+
205
+ // --------------------------------------------------------------------------
206
+ // @parallelogram-js/core Tokens
207
+ //
208
+ // Feeds the dashboard theme into core's role and surface tokens, so core's web components and
209
+ // per-component stylesheets match it in both themes. Every value is a reference to a theme
210
+ // token, so one declaration serves light and dark. Load this instead of core's index.css, whose
211
+ // own :root palette would compete with it.
212
+ // --------------------------------------------------------------------------
213
+
214
+ :root {
215
+ // Brand layer and the accent role every core component reads
216
+ --brand-primary: var(--primary);
217
+ --brand-primary-hover: var(--primary-hover);
218
+ --brand-primary-contrast: var(--primary-fg);
219
+ --color-accent: var(--primary);
220
+ --color-accent-hover: var(--primary-hover);
221
+ --color-accent-contrast: var(--primary-fg);
222
+
223
+ // Neutral roles
224
+ --color-text: var(--fg);
225
+ --color-text-muted: var(--fg-muted);
226
+ --color-surface: var(--bg);
227
+ --color-surface-muted: var(--bg-muted);
228
+ --color-hover: var(--accent);
229
+ --color-border: var(--border);
230
+ --color-border-strong: var(--input);
231
+ --color-control-border: var(--input);
232
+ --color-overlay: rgb(0 0 0 / 0.5);
233
+ --color-shadow: rgb(0 0 0 / 0.1);
234
+ --color-inverse-surface: var(--fg);
235
+ --color-inverse-text: var(--bg);
236
+
237
+ // Status roles
238
+ --color-danger: var(--destructive);
239
+ --color-danger-contrast: var(--destructive-fg);
240
+ --color-danger-tint: var(--destructive-muted);
241
+ --color-danger-text: var(--destructive-muted-fg);
242
+ --color-danger-strong: var(--destructive-muted-fg);
243
+ --color-success: var(--success);
244
+ --color-success-contrast: var(--success-fg);
245
+ --color-success-tint: var(--success-muted);
246
+ --color-success-text: var(--success-muted-fg);
247
+ --color-success-strong: var(--success-muted-fg);
248
+ --color-warning: var(--warning);
249
+ --color-warning-contrast: var(--warning-fg);
250
+ --color-warning-tint: var(--warning-muted);
251
+ --color-warning-text: var(--warning-muted-fg);
252
+ --color-warning-strong: var(--warning-muted-fg);
253
+
254
+ // Surfaces
255
+ --surface-control-radius: #{$radius-md};
256
+ --surface-control-border-color: var(--input);
257
+ --surface-button-radius: #{$radius-md};
258
+ --surface-panel-radius: #{$radius-md};
259
+ --surface-panel-color-bg: var(--popover);
260
+ --surface-panel-color-text: var(--popover-fg);
261
+ --surface-panel-shadow: #{$shadow-lg};
262
+ --surface-dropdown-radius: #{$radius-md};
263
+ --surface-dropdown-color-bg: var(--popover);
264
+ --surface-dropdown-shadow: #{$shadow-lg};
265
+ --surface-dropdown-item-hover-bg: var(--accent);
266
+ --surface-dropdown-item-selected-bg: var(--accent);
267
+ --surface-dialog-radius: #{$radius-md};
268
+ --surface-dialog-color-bg: var(--bg);
269
+ --surface-dialog-color-text: var(--fg);
270
+ --surface-dialog-shadow: #{$shadow-xl};
271
+ --panel-bg: var(--surface-panel-color-bg);
272
+ --panel-border-radius: var(--surface-panel-radius);
273
+ --panel-shadow: var(--surface-panel-shadow);
274
+ --surface-card-radius: #{$radius-lg};
275
+ --surface-card-color-bg: var(--card);
276
+ --surface-card-color-text: var(--card-fg);
277
+
278
+ // Buttons rendered inside core components
279
+ --button-primary-bg: var(--primary);
280
+ --button-primary-color: var(--primary-fg);
281
+ --button-primary-border: var(--primary);
282
+ --button-primary-hover-bg: var(--primary-hover);
283
+ --button-primary-hover-border: var(--primary-hover);
284
+ --button-secondary-bg: var(--secondary);
285
+ --button-secondary-color: var(--secondary-fg);
286
+ --button-secondary-border: var(--border);
287
+ --button-secondary-hover-bg: var(--secondary-hover);
288
+ --button-secondary-hover-border: var(--border);
289
+ --button-danger-bg: var(--destructive);
290
+ --button-danger-color: var(--destructive-fg);
291
+ --button-danger-border: var(--destructive);
292
+ --button-danger-hover-bg: var(--destructive-hover);
293
+ --button-danger-hover-border: var(--destructive-hover);
294
+
295
+ // Form controls rendered inside core components
296
+ --form-control-placeholder-color: var(--input-placeholder);
297
+ --form-control-focus-ring-color: var(--ring);
298
+ --form-control-focus-border-color: var(--ring);
299
+ --form-control-hover-border-color: var(--fg-subtle);
300
+
301
+ // Focus and motion, shared with the dashboard's own components
302
+ --framework-focus-color: var(--ring);
303
+ --framework-focus-width: 2px;
304
+ --framework-focus-offset: 2px;
305
+ --framework-transition-duration: #{$transition-fast};
306
+ --framework-transition-easing: #{$transition-easing};
307
+
308
+ $timing: var(--framework-transition-duration) var(--framework-transition-easing);
309
+ --transition-default: #{_transition-list((color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform), $timing)};
310
+ --transition-colors: #{_transition-list((color, background-color, border-color), $timing)};
311
+ --transition-transform: transform #{$timing};
312
+ --transition-opacity: opacity #{$timing};
313
+ }
314
+
315
+ @media (prefers-reduced-motion: reduce) {
316
+ :root {
317
+ --framework-transition-duration: 0s;
318
+ }
319
+ }
320
+
321
+ // --------------------------------------------------------------------------
322
+ // Typography Tokens
323
+ //
324
+ // Read by the base element styles and the .heading and .text classes, so a page can change its
325
+ // fonts or heading sizes at runtime without recompiling.
326
+ // --------------------------------------------------------------------------
327
+
328
+ :root {
329
+ --font-sans: #{$font-sans};
330
+ --font-mono: #{$font-mono};
331
+
332
+ @each $level, $sizes in $heading-sizes {
333
+ --heading-#{$level}: #{fluid(list.nth($sizes, 1), list.nth($sizes, 2))};
334
+ }
335
+
336
+ --leading-tight: #{$line-height-tight};
337
+ --leading-normal: #{$line-height-normal};
338
+ --leading-relaxed: #{$line-height-relaxed};
339
+ --tracking-tight: #{$letter-spacing-tight};
340
+ }