@webority/theme 0.3.0 → 0.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/theme",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Webority shared design system — Bootstrap 5.3 SCSS overrides, --wui-* tokens, and shared component CSS. The single source of brand chrome for React portals and Razor sites.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -32,6 +32,6 @@
32
32
  "sass": "~1.77.8"
33
33
  },
34
34
  "scripts": {
35
- "build": "sass index.scss dist/webority-theme.css --load-path=node_modules --style=compressed --no-source-map --quiet-deps"
35
+ "build": "sass index.scss dist/webority-theme.css --load-path=node_modules --style=compressed --no-source-map --quiet-deps && node ../../scripts/sync-rcl-assets.mjs theme"
36
36
  }
37
37
  }
@@ -697,3 +697,45 @@ html.is-scrolling *::-webkit-scrollbar-thumb {
697
697
  transition: none;
698
698
  }
699
699
  }
700
+
701
+
702
+ // ---- Theme-flipped typography utilities ------------------------------------
703
+ // Bootstrap builds `.text-body` as `rgba(var(--bs-body-color-rgb), …)` — an RGB
704
+ // TRIPLET baked in at compile time (37, 47, 74). Bridging `--bs-body-color`
705
+ // cannot reach it, so the utility keeps the light-mode colour under
706
+ // [data-theme="dark"]. Redefined against the token, with !important to match
707
+ // Bootstrap's own utility declaration.
708
+ //
709
+ // `.text-body-secondary`, `.text-muted` and `.text-body-emphasis` are NOT
710
+ // redefined: they resolve --bs-secondary-color / --bs-emphasis-color, which the
711
+ // alias layer already bridges, so they flip correctly on their own.
712
+ .text-body {
713
+ color: var(--color-text) !important;
714
+ }
715
+
716
+ // Font-family utilities Bootstrap has no equivalent for. Products were declaring
717
+ // these locally, which is how a font choice drifts between surfaces.
718
+ .font-mono {
719
+ font-family: var(--bs-font-monospace);
720
+ }
721
+ .font-display {
722
+ font-family: var(--bs-body-font-family);
723
+ font-weight: 500;
724
+ letter-spacing: -0.02em;
725
+ }
726
+
727
+ // A hairline rule that follows the theme. `<hr>` carries Bootstrap's own opacity
728
+ // maths, which does not read as a divider on a dark surface.
729
+ .divider {
730
+ height: 1px;
731
+ border: 0;
732
+ margin: 0;
733
+ background: var(--color-border);
734
+ }
735
+ .divider-vertical {
736
+ width: 1px;
737
+ height: auto;
738
+ align-self: stretch;
739
+ border: 0;
740
+ background: var(--color-border);
741
+ }
package/scss/_tokens.scss CHANGED
@@ -23,7 +23,12 @@
23
23
  --wui-text-heading: #071437;
24
24
  --wui-text-1: #252F4A;
25
25
  --wui-text-2: #4B5675;
26
- --wui-text-3: #78829D;
26
+ // Tertiary text — hints, captions, labels, timestamps, placeholders. Was #78829D,
27
+ // which measured 3.5:1 on white and 3.1:1 on a tinted panel: below WCAG AA (4.5:1)
28
+ // everywhere it was used. A tier meant for readable-but-secondary copy has to BE
29
+ // readable, so it darkens to 4.55:1 on every neutral surface. It stays clearly
30
+ // lighter than --wui-text-2; --wui-text-4/5 remain for genuinely decorative use.
31
+ --wui-text-3: #687088;
27
32
  --wui-text-4: #99A1B7;
28
33
  --wui-text-5: #C4CADA;
29
34
 
@@ -114,6 +119,7 @@
114
119
  // Canonical info/success/warning/danger scales: `active` (text/icon on
115
120
  // light), the base `100` (vivid fills/dots), then tints 50/30/20/10/5.
116
121
  // Shared by the portal (aliased to --color-*) and marketing alerts/badges.
122
+ --wui-info-text: #1460ba;
117
123
  --wui-info-active: #056EE9;
118
124
  --wui-info: #1B84FF;
119
125
  --wui-info-50: #8DC2FF;
@@ -122,6 +128,12 @@
122
128
  --wui-info-10: #E9F3FF;
123
129
  --wui-info-5: #F3F9FF;
124
130
 
131
+ // `-text` variants exist because the status colours are FILLS. #F8285A and #04B440
132
+ // are correct on a button or a badge, and both fail AA as text on a light surface
133
+ // (3.6:1 and 2.6:1) — which is how a validation error message, of all things, came
134
+ // to be unreadable. Darkening the base tokens would change every red button and
135
+ // green badge in the system, so text gets its own value and the fills keep theirs.
136
+ --wui-success-text: #0e7531;
125
137
  --wui-success-active: #04B440;
126
138
  --wui-success: #17C653;
127
139
  --wui-success-50: #8BE3A9;
@@ -130,6 +142,7 @@
130
142
  --wui-success-10: #E8FAEE;
131
143
  --wui-success-5: #F3FCF6;
132
144
 
145
+ --wui-warning-text: #876100;
133
146
  --wui-warning-active: #DFA000;
134
147
  --wui-warning: #F6B100;
135
148
  --wui-warning-50: #FBD880;
@@ -138,6 +151,7 @@
138
151
  --wui-warning-10: #FFF8E6;
139
152
  --wui-warning-5: #FEFBF2;
140
153
 
154
+ --wui-danger-text: #b61d42;
141
155
  --wui-danger-active: #E82646;
142
156
  --wui-danger: #F8285A;
143
157
  --wui-danger-50: #FC94AD;
@@ -200,3 +200,20 @@ $link-hover-decoration: underline;
200
200
  $focus-ring-width: 3px;
201
201
  $focus-ring-color: rgba($primary, 0.30); // tracks $primary automatically
202
202
  $focus-ring-blur: 0;
203
+
204
+
205
+ // ---- Table ----------------------------------------------------------
206
+ // Set HERE, not in the component layer, and the reason is specificity.
207
+ // Bootstrap emits `.table > :not(caption) > * > * { padding: … }` at (0,1,1).
208
+ // The base table rules are wrapped in `:where()` — deliberately, so variants like
209
+ // `.table-ledger` (0,1,2) can override them — which makes them (0,0,3). A class
210
+ // beats three type selectors, so a `padding` declared there loses to Bootstrap's
211
+ // and never applies.
212
+ //
213
+ // Overriding the SCSS variable makes Bootstrap's own high-specificity rule emit our
214
+ // value, so the base table is styled without the component layer having to outrank
215
+ // Bootstrap. Variants that set their own padding are unaffected — theirs still wins.
216
+ // (Cell colour and header background take the same approach one level down, through
217
+ // `--bs-table-color` / `--bs-table-bg`; see the base `.table` rules.)
218
+ $table-cell-padding-y: 0.75rem; // 12px
219
+ $table-cell-padding-x: 0.75rem; // 12px
@@ -47,6 +47,8 @@
47
47
  --color-info-5: var(--wui-info-5);
48
48
  --color-info-strong: var(--color-info-active);
49
49
  --color-info-soft: var(--color-info-10);
50
+ // Use this — never --color-info — when the colour IS the text.
51
+ --color-info-text: var(--wui-info-text);
50
52
 
51
53
  --color-success-active: var(--wui-success-active);
52
54
  --color-success: var(--wui-success);
@@ -57,6 +59,8 @@
57
59
  --color-success-5: var(--wui-success-5);
58
60
  --color-success-strong: var(--color-success-active);
59
61
  --color-success-soft: var(--color-success-10);
62
+ // Use this — never --color-success — when the colour IS the text.
63
+ --color-success-text: var(--wui-success-text);
60
64
 
61
65
  --color-warning-active: var(--wui-warning-active);
62
66
  --color-warning: var(--wui-warning);
@@ -67,6 +71,8 @@
67
71
  --color-warning-5: var(--wui-warning-5);
68
72
  --color-warning-strong: var(--color-warning-active);
69
73
  --color-warning-soft: var(--color-warning-10);
74
+ // Use this — never --color-warning — when the colour IS the text.
75
+ --color-warning-text: var(--wui-warning-text);
70
76
 
71
77
  --color-danger-active: var(--wui-danger-active);
72
78
  --color-danger: var(--wui-danger);
@@ -77,6 +83,8 @@
77
83
  --color-danger-5: var(--wui-danger-5);
78
84
  --color-danger-strong: var(--color-danger-active);
79
85
  --color-danger-soft: var(--color-danger-10);
86
+ // Use this — never --color-danger — when the colour IS the text.
87
+ --color-danger-text: var(--wui-danger-text);
80
88
 
81
89
  // Accent → warning ramp
82
90
  --color-accent: var(--color-warning);
@@ -117,6 +125,14 @@
117
125
  --color-primary-hover: var(--wui-dark-primary-hover);
118
126
  --color-primary-soft: color-mix(in srgb, var(--wui-primary) 20%, transparent);
119
127
 
128
+ // On a dark surface the FILL colours are already the readable ones — the darkened
129
+ // `-text` values would sink into the background. So dark mode maps text back to the
130
+ // bright tokens rather than inheriting light mode's.
131
+ --color-success-text: var(--wui-success);
132
+ --color-danger-text: var(--wui-danger);
133
+ --color-warning-text: var(--wui-warning);
134
+ --color-info-text: var(--wui-info);
135
+
120
136
  --color-success-soft: color-mix(in srgb, var(--wui-success) 18%, transparent);
121
137
  --color-warning-soft: color-mix(in srgb, var(--wui-warning) 18%, transparent);
122
138
  --color-danger-soft: color-mix(in srgb, var(--wui-danger) 18%, transparent);