@smwb/ui-styles 1.5.1 → 2.0.0

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 (54) hide show
  1. package/README.md +210 -12
  2. package/less/components/appBar/appBar.less +108 -0
  3. package/less/components/avatar/avatar.less +22 -0
  4. package/less/components/button/button.less +7 -1
  5. package/less/components/card/card.less +15 -4
  6. package/less/components/chart/chart.less +16 -15
  7. package/less/components/checkbox/checkbox.less +55 -4
  8. package/less/components/chip/chip.less +48 -3
  9. package/less/components/commandPalette/commandPalette.entry.less +2 -0
  10. package/less/components/commandPalette/commandPalette.less +233 -0
  11. package/less/components/composer/composer.entry.less +2 -0
  12. package/less/components/composer/composer.less +294 -0
  13. package/less/components/composer/composer.variables.less +10 -0
  14. package/less/components/dagView/dagView.entry.less +2 -0
  15. package/less/components/dagView/dagView.less +280 -0
  16. package/less/components/descriptionList/descriptionList.less +7 -1
  17. package/less/components/diffStat/diffStat.entry.less +2 -0
  18. package/less/components/diffStat/diffStat.less +76 -0
  19. package/less/components/kbd/kbd.entry.less +2 -0
  20. package/less/components/kbd/kbd.less +55 -0
  21. package/less/components/list/list.less +39 -0
  22. package/less/components/menu/menu.less +25 -1
  23. package/less/components/personChip/personChip.less +4 -2
  24. package/less/components/qrCode/qrCode.entry.less +2 -0
  25. package/less/components/qrCode/qrCode.less +35 -0
  26. package/less/components/radioButton/radioButton.less +46 -1
  27. package/less/components/rating/rating.less +15 -2
  28. package/less/components/selectField/selectField.less +87 -5
  29. package/less/components/sidebar/sidebar.less +26 -0
  30. package/less/components/statusDot/statusDot.entry.less +2 -0
  31. package/less/components/statusDot/statusDot.less +118 -0
  32. package/less/components/swimlanes/swimlanes.entry.less +2 -0
  33. package/less/components/swimlanes/swimlanes.less +126 -0
  34. package/less/components/tabGroups/tabGroups.entry.less +2 -0
  35. package/less/components/tabGroups/tabGroups.less +219 -0
  36. package/less/components/table/table.less +12 -0
  37. package/less/components/tabs/tab/tab.less +128 -0
  38. package/less/components/tabs/tabPanel/tabPanel.entry.less +2 -0
  39. package/less/components/tabs/tabPanel/tabPanel.less +8 -0
  40. package/less/components/tabs/tabs.less +26 -0
  41. package/less/components/textField/textField.less +34 -9
  42. package/less/components/thumbCard/thumbCard.less +12 -2
  43. package/less/components/toggle/toggle.less +42 -2
  44. package/less/components/treeView/treeView.less +40 -2
  45. package/less/components/typography/typography.less +13 -6
  46. package/less/components.less +10 -0
  47. package/less/connects/rt/table.less +7 -0
  48. package/less/default/globals/default.variables.less +152 -1
  49. package/less/foundation/sizing.less +41 -5
  50. package/less/foundation/typography.less +21 -0
  51. package/less/themes/material/variables.less +1 -0
  52. package/less/themes/summer/variables.less +1 -0
  53. package/less/variables.less +5 -0
  54. package/package.json +5 -2
@@ -94,6 +94,7 @@
94
94
  @avatarSizeLarge: 56px;
95
95
  @avatarGroupOverlap: @smui-space-sm;
96
96
  @avatarGroupBorder: 2px;
97
+ @avatarGroupMaxStacked: 12; // children laid each over the next; any past these overlap the other way
97
98
 
98
99
  @breadcrumbsGap: @smui-space-sm;
99
100
 
@@ -119,6 +120,11 @@
119
120
  @appBarPaddingX: @smui-space-lg;
120
121
  @appBarActionPadding: @smui-space-md;
121
122
  @appBarActionsGap: 10px; // off-grid
123
+ // Width reserved for the OS window buttons in `AppBar variant="window"`: the macOS traffic lights of Electron's
124
+ // `hiddenInset` end around 70-78px, so with @appBarPaddingX the content starts at 80px; Windows/Linux draw three
125
+ // 46px caption buttons. Not theme tokens — an app overrides both sides with --smui-appBarWindowControlsWidth.
126
+ @appBarWindowControlsLeft: 64px;
127
+ @appBarWindowControlsRight: 138px;
122
128
 
123
129
  @badgePaddingX: 6px; // off-grid
124
130
 
@@ -167,6 +173,33 @@
167
173
  @progressDotMargin: @smui-space-xs;
168
174
  @meterHeight: 6px;
169
175
  @meterMinBarWidth: 3.5rem; // the bar keeps at least this much beside its text
176
+ @statusDotSizeSm: 8px; // @smui-space-2
177
+ @statusDotSizeMd: 12px; // @smui-space-3
178
+ @statusDotRing: 2px; // the unknown status is a ring this thick
179
+
180
+ // A QR code is always dark modules on a white square — never theme tokens, so no
181
+ // theme (or forced-colours mode, see the component's print/forced-color-adjust) can
182
+ // invert it.
183
+ @qrCodeDarkColor: rgb(0 0 0);
184
+ @qrCodeLightColor: rgb(255 255 255);
185
+ @qrCodeRadius: @smui-radius-sm;
186
+
187
+ @kbdGap: @smui-space-xxs;
188
+ @kbdKeyMinSize: 1.5em; // a key cap is square at one character
189
+ @kbdKeyPaddingX: 0.375em;
190
+ @kbdKeyRadius: @smui-radius-sm;
191
+ // ---- DiffStat ----
192
+ @diffStatFontSize: 0.875rem;
193
+ @diffStatCompactFontSize: 0.75rem; // a tab label
194
+ @diffStatGap: @smui-space-xs; // the figures to the bar
195
+ @diffStatSignGap: @smui-space-xxs; // "+N" to "−M"
196
+ @diffStatCellWidth: 5px;
197
+ @diffStatCellHeight: 10px;
198
+ @diffStatCompactCellHeight: 8px;
199
+ @diffStatCellGap: @smui-space-xxs;
200
+ @diffStatCellRadius: 2px;
201
+ @diffStatColorMix: 55%; // how much of the success/error token survives against the surface ink
202
+ @diffStatNeutralMix: 60%; // how much surface ink an unowned cell's outline keeps (3:1 or better against the page)
170
203
 
171
204
  @screenDividerLabelMargin: 5px; // off-grid
172
205
 
@@ -223,8 +256,18 @@
223
256
  @tabIconPaddingBottom: @smui-space-xs;
224
257
  @tabLabelPaddingLeft: @smui-space-sm;
225
258
  @tabDensePaddingX: @smui-space-md;
259
+ @tabCloseSize: @smui-space-6; // the close button of a closable tab
260
+ @tabControlsGap: @smui-space-xs; // between a tab's close button, its actions and the row's next tab
226
261
  @tabsFadeWidth: 2.5rem; // scrollable row: the fading edge beyond which tabs are hidden
227
262
  @tabsScrollButtonWidth: 40px;
263
+ @tabsOverflowTriggerWidth: @tabsScrollButtonWidth; // the "more tabs" trigger beside the scroller (Tabs `overflowMenu`)
264
+ @tabsDragIndicatorSize: 2px; // off-grid; the drop-target line of a drag-to-reorder
265
+
266
+ // ---- TabGroups ----
267
+ @tabGroupsSeparatorSize: 4px; // off-grid; the grid track a separator between two groups sits in
268
+ @tabGroupsSeparatorHitArea: 8px; // off-grid; the invisible grip around that track
269
+ @tabGroupsDropTintOpacity: 0.16; // how much primary the zone a dragged tab would land in shows
270
+ @tabGroupsActiveLineWidth: 2px; // off-grid; the line over the header of the group in use
228
271
 
229
272
  @tableCellPaddingX: @smui-space-lg;
230
273
  @tableToolbarMarginBottom: 10px; // off-grid
@@ -373,7 +416,8 @@
373
416
  @menuDisabledTextColor: @disabledTextColor;
374
417
  @menuOpacityHover: 0.08;
375
418
  @menuOpacityActive: 0.12;
376
- @menuOpacity-focus: 0.12;
419
+ @menuOpacityFocus: 0.12;
420
+ @menuOpacity-focus: @menuOpacityFocus; // former name, kept so Less that reads it still compiles
377
421
  @menuOpacitySelected: 0.08;
378
422
  @menuDividerColor: @dividerColor;
379
423
 
@@ -456,6 +500,83 @@
456
500
  @messageBgLight: ~"color-mix(in srgb, @{primaryColor} 10%, transparent)";
457
501
  @messageBorderRadius: @smui-radius-xs;
458
502
 
503
+ // ---- Chart ----
504
+ // Series colours in order, up to 12 (--smwb-chart-series-N). `false` = not set:
505
+ // the token is not emitted, and the chart draws only the colours that are set.
506
+ // Fill slots in order: an unset slot is skipped, so later colours shift up
507
+ // (slot 9 without slot 8 is drawn for the 8th series).
508
+ // Okabe-Ito, apart under colour-vision deficiencies.
509
+ @chartSeries1: #0072b2;
510
+ @chartSeries2: #e69f00;
511
+ @chartSeries3: #009e73;
512
+ @chartSeries4: #cc79a7;
513
+ @chartSeries5: #56b4e9;
514
+ @chartSeries6: #d55e00;
515
+ @chartSeries7: #7a7a7a;
516
+ @chartSeries8: false;
517
+ @chartSeries9: false;
518
+ @chartSeries10: false;
519
+ @chartSeries11: false;
520
+ @chartSeries12: false;
521
+
522
+ // ---- DagView ----
523
+ // The graph's colours, as --smwb-dag-view-* on .smwb-dag-view. The defaults
524
+ // are the theme's runtime tokens, so the dark theme follows on its own.
525
+ @dagViewNodeBg: ~"var(--smui-surfaceBackground)";
526
+ @dagViewNodeBorder: ~"var(--smui-outlineColor)";
527
+ @dagViewEdgeColor: ~"var(--smui-outlineColor)";
528
+ @dagViewEdgeActiveColor: ~"var(--smui-primaryColor)";
529
+ @dagViewSelectedRing: ~"var(--smui-primaryColor)";
530
+ // A node's accent (its stripe and dot) by status; any other status is drawn as idle.
531
+ @dagViewStatusIdle: ~"var(--smui-outlineColor)";
532
+ @dagViewStatusPending: ~"var(--smui-onSurfaceVariant)";
533
+ @dagViewStatusRunning: ~"var(--smui-infoColor)";
534
+ @dagViewStatusSuccess: ~"var(--smui-successColor)";
535
+ @dagViewStatusWarning: ~"var(--smui-warningColor)";
536
+ @dagViewStatusError: ~"var(--smui-errorColor)";
537
+ @dagViewStatusSkipped: ~"var(--smui-disabledTextColor)";
538
+ // How far the nodes and edges away from the selection fade, with dimUnrelated.
539
+ @dagViewDimOpacity: 0.35;
540
+ // The graph's height when the app sets none (its `height` prop or `style`).
541
+ @dagViewHeight: 480px;
542
+
543
+ // ---- Swimlanes ----
544
+ // The fixed header column's width when the app sets none (its `headerWidth`
545
+ // prop writes --smwb-swimlanes-header-width, which these fallbacks read).
546
+ @swimlanesHeaderWidth: 240px;
547
+ // The grid's height when the app sets none (its `height` prop or `style`).
548
+ @swimlanesHeight: 480px;
549
+
550
+ // ---- CommandPalette ----
551
+ // Escaped: Less would otherwise try to compute the mixed-unit min()/calc().
552
+ @commandPaletteWidth: ~"min(640px, calc(100vw - 32px))";
553
+ // The palette hangs near the top of the overlay, not centred, so that its
554
+ // bottom edge - and the row the keys are on - does not move as results arrive.
555
+ @commandPaletteTopOffset: ~"min(12vh, 96px)";
556
+ @commandPaletteMaxHeight: ~"min(560px, calc(100vh - 2 * min(12vh, 96px)))";
557
+ @commandPaletteItemMinHeight: 44px; // a pointer target, WCAG 2.5.5
558
+ @commandPaletteItemRadius: @smui-radius-sm;
559
+ @commandPaletteIconSize: 20px;
560
+ @commandPaletteActiveLayerOpacity: 0.12; // focus state layer, as menu items
561
+ @commandPaletteHoverLayerOpacity: 0.08;
562
+ // ---- Composer ----
563
+ // The task input's colours, as theme variables. The defaults are the theme's
564
+ // runtime tokens, so the dark theme follows without extra settings.
565
+ @composerBg: ~"var(--smui-surfaceBackground)";
566
+ @composerBorder: ~"var(--smui-outlineColor)";
567
+ @composerBorderFocus: ~"var(--smui-primaryColor)";
568
+ @composerText: ~"var(--smui-onSurfaceColor)";
569
+ @composerPlaceholder: ~"var(--smui-onSurfaceVariant)";
570
+ @composerCounter: ~"var(--smui-onSurfaceVariant)";
571
+ @composerCounterError: ~"var(--smui-errorColor)";
572
+ // The send button, and the stop button while the agent is busy.
573
+ @composerActionBg: ~"var(--smui-primaryColor)";
574
+ @composerActionColor: ~"var(--smui-onPrimaryColor)";
575
+ @composerStopBg: ~"var(--smui-onSurfaceColor)";
576
+ @composerStopColor: ~"var(--smui-surfaceBackground)";
577
+ // The surface while files are dragged over it.
578
+ @composerDragBg: ~"var(--smui-primaryContainer)";
579
+
459
580
  /*===================================================== DARK THEME =================================================*/
460
581
  /*-------------------
461
582
  Common
@@ -614,3 +735,33 @@
614
735
  Message
615
736
  --------------------*/
616
737
  @messageBgDark: #323232;
738
+
739
+ // ---- Chart ----
740
+ // Same rule as the light set: fill in order, an unset slot is skipped.
741
+ @chartSeries1Dark: #5aa9e6;
742
+ @chartSeries2Dark: #f0b43a;
743
+ @chartSeries3Dark: #2fc59b;
744
+ @chartSeries4Dark: #e08cc0;
745
+ @chartSeries5Dark: #8fd0f5;
746
+ @chartSeries6Dark: #f27c3c;
747
+ @chartSeries7Dark: #a8b0bc;
748
+ @chartSeries8Dark: false;
749
+ @chartSeries9Dark: false;
750
+ @chartSeries10Dark: false;
751
+ @chartSeries11Dark: false;
752
+ @chartSeries12Dark: false;
753
+
754
+ // ---- DagView ----
755
+ // Dark-only values; `false` = not set: the light value (a runtime token) applies.
756
+ @dagViewNodeBgDark: false;
757
+ @dagViewNodeBorderDark: false;
758
+ @dagViewEdgeColorDark: false;
759
+ @dagViewEdgeActiveColorDark: false;
760
+ @dagViewSelectedRingDark: false;
761
+ @dagViewStatusIdleDark: false;
762
+ @dagViewStatusPendingDark: false;
763
+ @dagViewStatusRunningDark: false;
764
+ @dagViewStatusSuccessDark: false;
765
+ @dagViewStatusWarningDark: false;
766
+ @dagViewStatusErrorDark: false;
767
+ @dagViewStatusSkippedDark: false;
@@ -1,10 +1,46 @@
1
1
  //=====================================================================
2
2
  // Control sizing scale (small / medium / large)
3
3
  //---------------------------------------------------------------------
4
- // Single source for the size variants shared by interactive controls
5
- // (button, checkbox, radio, toggle, textField, selectField, slider,
6
- // rating, datePicker, chip, pagination, icon defaults). Components map
7
- // their `size` prop -> a `smwb-*_size-sm|md|lg` class that reads these.
4
+ // The height tokens @smui-control-h-sm/md/lg are consumed via
5
+ // min-height: var(--smui-control-h-*, @smui-control-h-*) by:
6
+ // - Button (sm/md/lg size classes)
7
+ // - TextField and SelectField (base = md, plus sm/lg size classes)
8
+ // - Chip (default box; its _size-small 24px step stays hardcoded)
9
+ // - Checkbox, RadioButton (_size-small/-medium/-large row classes) and
10
+ // Toggle (row min-height via .smwb-toggle__wrapper:has(.smwb-toggle_size-*))
11
+ // The runtime tokens --smui-control-h-* are declared in variables.less
12
+ // (light mixin only — the same :root block applies under data-theme="dark",
13
+ // so a dark re-declaration would reset a consumer's global density override),
14
+ // and a subtree can override the height at runtime.
15
+ //
16
+ // Variant exemptions: TextField/SelectField --filled and --inline keep their
17
+ // own padding (no token read), radio _size-medium keeps its hardcoded 20px
18
+ // box, and Chip _size-small keeps 24px hardcoded.
19
+ //
20
+ // @smui-control-font-sm/lg is consumed by TextField/SelectField only;
21
+ // @smui-control-font-md is defined but not yet consumed (reserved).
22
+ //
23
+ // Defined but not yet consumed (reserved): @smui-control-px-* and
24
+ // @smui-icon-*. @smui-selection-* is consumed only by the checkbox box
25
+ // edges and the radio sm/lg box edges (radio md is hardcoded 20px);
26
+ // beyond that it is reserved.
27
+ //
28
+ // Intentionally exempt (do not wire without a design decision):
29
+ // - FloatingButton: Material FAB spec diameters (56/48/40, extended
30
+ // 48/40/34) are their own scale, not the control scale
31
+ // - Avatar: identity badge (@avatarSizeSmall/Medium/Large 24/40/56),
32
+ // not an interactive control
33
+ // - Pagination: has its own item scale (@paginationItemSize 32 /
34
+ // @paginationItemSizeSmall 26)
35
+ // - ProgressIndicator: indicator diameter (28px), not a control box
36
+ // - StatusDot: decorative dot (@statusDotSizeSm/Md); also uses the
37
+ // _size-sm suffix, a different class convention
38
+ // - Slider: size scales track thickness and thumb diameter, not a
39
+ // control height
40
+ // - Modal: size selects dialog width, not control height
41
+ // - Rating: size is a pixel number, not a three-step variant
42
+ // - DatePicker / TimePicker / DateTimePicker: compose TextField +
43
+ // Button, so they inherit the tokens
8
44
  //
9
45
  // Override one step from theme.config, e.g. @smui-control-h-md: 44px;
10
46
  //=====================================================================
@@ -24,7 +60,7 @@
24
60
  @smui-control-font-md: 14px;
25
61
  @smui-control-font-lg: 16px;
26
62
 
27
- // Selection-control box (checkbox/radio/toggle thumb) edge
63
+ // Selection-control box edges (checkbox sm/md/lg, radio sm/lg)
28
64
  @smui-selection-sm: 16px;
29
65
  @smui-selection-md: 18px;
30
66
  @smui-selection-lg: 22px;
@@ -5,6 +5,13 @@
5
5
  // <Typography> component (smwb-typography_<variant>) and reusable by
6
6
  // any component. Override a step from theme.config, e.g.
7
7
  // @smui-font-h1-size: 40px;
8
+ // Letter case and spacing per variant are theme variables too; set them from
9
+ // theme.config to, say, put the headings in capitals:
10
+ // @smui-font-h1-transform: uppercase; @smui-font-h1-letter-spacing: 0.06em;
11
+ // The defaults are `auto`, a marker meaning the variant declares nothing of its
12
+ // own, except overline and button, which have always been uppercase with 0.06em.
13
+ // A set value is also readable at runtime as --smui-font-<variant>-transform /
14
+ // -letter-spacing (the compiled value is the var() fallback).
8
15
  //=====================================================================
9
16
 
10
17
  @smui-font-family: var(--smui-fontFamily, inherit);
@@ -28,3 +35,17 @@
28
35
  @smui-font-caption-size: 12px; @smui-font-caption-weight: 400; @smui-font-caption-lh: 1.4;
29
36
  @smui-font-overline-size: 12px; @smui-font-overline-weight: 600; @smui-font-overline-lh: 1.4;
30
37
  @smui-font-button-size: 14px; @smui-font-button-weight: 500; @smui-font-button-lh: 1.75;
38
+
39
+ @smui-font-h1-transform: auto; @smui-font-h1-letter-spacing: auto;
40
+ @smui-font-h2-transform: auto; @smui-font-h2-letter-spacing: auto;
41
+ @smui-font-h3-transform: auto; @smui-font-h3-letter-spacing: auto;
42
+ @smui-font-h4-transform: auto; @smui-font-h4-letter-spacing: auto;
43
+ @smui-font-h5-transform: auto; @smui-font-h5-letter-spacing: auto;
44
+ @smui-font-h6-transform: auto; @smui-font-h6-letter-spacing: auto;
45
+ @smui-font-subtitle1-transform: auto; @smui-font-subtitle1-letter-spacing: auto;
46
+ @smui-font-subtitle2-transform: auto; @smui-font-subtitle2-letter-spacing: auto;
47
+ @smui-font-body1-transform: auto; @smui-font-body1-letter-spacing: auto;
48
+ @smui-font-body2-transform: auto; @smui-font-body2-letter-spacing: auto;
49
+ @smui-font-caption-transform: auto; @smui-font-caption-letter-spacing: auto;
50
+ @smui-font-overline-transform: uppercase; @smui-font-overline-letter-spacing: 0.06em;
51
+ @smui-font-button-transform: uppercase; @smui-font-button-letter-spacing: 0.06em;
@@ -170,6 +170,7 @@
170
170
  @menuDisabledTextColor: @disabledTextColor;
171
171
  @menuOpacityHover: 0.08;
172
172
  @menuOpacityActive: 0.12;
173
+ @menuOpacityFocus: 0.12;
173
174
  @menuOpacitySelected: 0.08;
174
175
  @menuDividerColor: rgba(0, 0, 0, 0.12);
175
176
 
@@ -166,6 +166,7 @@
166
166
  @menuDisabledTextColor: @disabledTextColor;
167
167
  @menuOpacityHover: 0.08;
168
168
  @menuOpacityActive: 0.12;
169
+ @menuOpacityFocus: 0.12;
169
170
  @menuOpacitySelected: 0.08;
170
171
  @menuDividerColor: rgba(0, 0, 0, 0.12);
171
172
 
@@ -142,6 +142,11 @@
142
142
  --smui-space-xxl: @smui-space-xxl;
143
143
  --smui-space-xxxl: @smui-space-xxxl;
144
144
 
145
+ // Control heights (overridable at runtime by client apps, e.g. a density switch)
146
+ --smui-control-h-sm: @smui-control-h-sm;
147
+ --smui-control-h-md: @smui-control-h-md;
148
+ --smui-control-h-lg: @smui-control-h-lg;
149
+
145
150
  /* Border-radius scale */
146
151
  --smui-radius-xs: @smui-radius-xs;
147
152
  --smui-radius-sm: @smui-radius-sm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smwb/ui-styles",
3
- "version": "1.5.1",
3
+ "version": "2.0.0",
4
4
  "description": "Framework-agnostic LESS design tokens and component styles (smwb-*) shared by the @smwb UI libraries. Prebuilt aggregate CSS lives in @smwb/ui-css.",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -19,12 +19,15 @@
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "scripts": {
22
- "lint": "node scripts/check-aggregate.mjs && node scripts/check-tokens.mjs"
22
+ "lint": "node scripts/check-aggregate.mjs && node scripts/check-tokens.mjs && node scripts/check-control-heights.mjs && node scripts/check-typography-case.mjs && node scripts/check-chart-series.mjs"
23
23
  },
24
24
  "homepage": "https://sourcecraft.dev/elfenmail/ui",
25
25
  "repository": {
26
26
  "type": "git",
27
27
  "url": "git+https://git.sourcecraft.dev/elfenmail/ui.git",
28
28
  "directory": "packages/styles"
29
+ },
30
+ "devDependencies": {
31
+ "less": "^4.6.4"
29
32
  }
30
33
  }