Skip to content

Commit f5ccb9f

Browse files
committed
feat: Add comprehensive design tokens documentation for BWSt theme
- Created DESIGN_TOKENS.md to document all CSS custom properties used in the BWSt theme, including color, spacing, typography, interactive states, alerts, focus, layout, button groups, form fields, Font Awesome tokens, animations, and component-specific usage. - Added maintenance TODOs in MAINTENANCE_TODOS.md for tracking completed fixes and open tasks related to the theme. - Updated serve.sh scripts across themes to fix shell script syntax for THEME_CSS variable. - Refactored button-link.scss and split-button.scss to use design tokens for visited link color and background color respectively. - Corrected CSS-Calc-Syntax in alert.scss for padding-top calculation using the correct spacing variable.
1 parent ed6c7a9 commit f5ccb9f

File tree

9 files changed

+1194
-6
lines changed

9 files changed

+1194
-6
lines changed

packages/themes/bwst/A11Y_AUDIT.md

Lines changed: 894 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
# BWSt Design Tokens
2+
3+
Comprehensive documentation of all CSS custom properties (design tokens) defined and used in the BWSt theme.
4+
5+
## Color Tokens
6+
7+
| Token | Value | Category | Usage | Notes |
8+
|-------|-------|----------|-------|-------|
9+
| `--color-primary` | `#156570` | Color | Primary buttons, links, active states, focus indicators, checkboxes/radios when checked | Core brand color; most interactive elements |
10+
| `--color-primary-variant` | `#207a8b` | Color | Button hover states, pagination hover/active, checkbox/radio hover states, link focus outline | Darker shade for hover/focus states |
11+
| `--color-secondary` | `#ccebf7` | Color | Secondary buttons | Light blue background |
12+
| `--color-danger` | `#ca0101` | Color | Danger buttons, error states, error alerts, form field error borders, error text | Used for destructive actions and error messaging |
13+
| `--color-warning` | `#c44931` | Color | Warning alerts | Orange/red for warning states |
14+
| `--color-success` | `#005c45` | Color | Success alerts | Green for positive feedback |
15+
| `--color-subtle` | `#576164` | Color | Input borders, tooltip borders, alert default accent color, placeholder text, input field borders when readonly/disabled | Gray for subtle/inactive elements |
16+
| `--color-light` | `#ffffff` | Color | Background for inputs, cards, alerts, button text (primary), checkbox/radio checked states | White background |
17+
| `--color-text` | `#202020` | Color | Default text color, button text (normal/tertiary) | Near-black for readability |
18+
| `--color-mute` | `#f2f3f4` | Color | Disabled input backgrounds, indeterminate checkbox backgrounds | Very light gray background |
19+
| `--color-mute-variant` | `#bec5c9` | Color | Input field borders (readonly/disabled), badge hint background | Medium gray for inactive elements |
20+
| `--color-visited` | `#551a8b` | Color | Visited link color | Purple (HTML standard) |
21+
22+
## Spacing Tokens
23+
24+
| Token | Value | Category | Usage | Notes |
25+
|-------|-------|----------|-------|-------|
26+
| `--spacing` | `#{to-rem(4)}` | Spacing | Base unit for gaps, padding in radio/checkbox inputs, alert padding | Responsive 4px base unit using `to-rem()` |
27+
| `--border-radius` | `#{to-rem(4)}` | Border | Input containers, buttons, links on focus, cards, checkboxes, selects | Consistent 4px border radius |
28+
| `--border-width` | `1px` | Border | Input borders, tooltip borders, alert card borders, link focus outline width | Standard 1px border width |
29+
30+
## Typography Tokens
31+
32+
Typography in BWSt theme is defined via mixins rather than CSS variables. The mixins define fixed values:
33+
34+
| Mixin | Font Size | Line Height | Font Weight | Usage |
35+
|-------|-----------|------------|-------------|-------|
36+
| `kol-typography-body` | `to-rem(16)` | 1.5 | normal | Body text |
37+
| `kol-typography-h1` | `to-rem(24)` | 1.667 | normal | Heading level 1 |
38+
| `kol-typography-h2` | `to-rem(20)` | 1.4 | normal | Heading level 2 |
39+
| `kol-typography-h3` | `to-rem(18)` | 1.333 | normal | Heading level 3 |
40+
| `kol-typography-accordion` | `to-rem(18)` | 1.1 | 700 | Accordion headers |
41+
| `kol-typography-hint` | `to-rem(14.4)` | normal | normal | Form hints (italic) |
42+
43+
### Font Family
44+
45+
| Token | Value | Usage | Notes |
46+
|-------|-------|-------|-------|
47+
| `--font-family` | `'Noto Sans Regular', Arial, helvetica, sans-serif` | Global font family | All text elements |
48+
| `--font-size` | `#{to-rem(16)}` | Base font size | Root element font size |
49+
50+
## Interactive State Tokens
51+
52+
### Button States
53+
54+
| Token | Used In | Default Value | Variants |
55+
|-------|---------|---------------|----------|
56+
| `--text-background-color` | All buttons | Varies by variant | primary, secondary, tertiary, normal, danger, ghost |
57+
| `--text-border-color` | All buttons | Varies by variant | primary, secondary, tertiary, normal, danger, ghost |
58+
| `--text-color` | All buttons | Varies by variant | primary, secondary, tertiary, normal, danger, ghost |
59+
60+
Button variant mappings:
61+
- **Primary**: bg=primary, border=primary, text=light
62+
- **Secondary**: bg=secondary, border=primary, text=primary
63+
- **Tertiary**: bg=light, border=primary, text=primary
64+
- **Normal**: bg=light, border=text, text=text
65+
- **Danger**: bg=danger, border=danger, text=light
66+
- **Ghost**: bg=transparent, border=transparent, text=primary
67+
68+
Hover state (all except danger): bg/border=primary-variant, text=light
69+
70+
### Selection Input Tokens (Checkboxes/Radios)
71+
72+
| Token | Value | Usage | Notes |
73+
|-------|-------|-------|-------|
74+
| `--kol-selection-input-main-color` | Varies by mode | Primary state color | Varies in different selection input modes |
75+
| `--kol-selection-input-focus-color` | Varies by mode | Focus state color | Can use primary-variant |
76+
| `--kol-selection-input-hover-color` | `rgb(8, 35, 48, 0.24)` | Hover overlay | Semi-transparent dark overlay |
77+
| `--kol-selection-input-icon-color` | Varies by mode | Icon color when checked | Light or dark depending on background |
78+
| `--kol-selection-input-off-color` | Varies by mode | Unchecked state color | Usually mute or subtle |
79+
80+
## Alert Tokens
81+
82+
| Token | Value | Usage | Notes |
83+
|-------|-------|-------|-------|
84+
| `--alert-accent-color` | Varies by type | Alert border, text, and background | Set based on alert type |
85+
86+
Alert type mappings:
87+
- **default**: accent-color=subtle
88+
- **error**: accent-color=danger
89+
- **info**: accent-color=primary
90+
- **success**: accent-color=success
91+
- **warning**: accent-color=warning
92+
93+
## Focus & Outline Tokens
94+
95+
| Token | Value | Category | Usage | Notes |
96+
|-------|-------|----------|-------|-------|
97+
| `--kol-focus-outline-offset` | `2px` (default), `-2px` (override) | Focus | Outline offset for focus states | Can be overridden per component |
98+
99+
Focus mixin (`focus-outline`):
100+
- Outline color: `--color-primary-variant`
101+
- Outline width: `to-rem(2)`
102+
- Border radius: `--border-radius`
103+
- Outline offset: `var(--kol-focus-outline-offset, 2px)`
104+
105+
## Theme Configuration Tokens
106+
107+
| Token | Value | Usage | Notes |
108+
|-------|-------|-------|-------|
109+
| `--theme-visibility-delay` | `0.5s` | Animation | Transition delay for visibility changes |
110+
111+
## Layout & Structure Tokens
112+
113+
| Token | Value | Usage | Context | Notes |
114+
|-------|-------|-------|---------|-------|
115+
| `--kol-nav-item-padding-left` | `0` | Navigation | Initial padding for nav items | Increases with nesting |
116+
| `--kol-nav-item-padding-right` | `16` | Navigation | Right padding for nav items | |
117+
| `--kol-nav-nested-padding-left` | `calc(var(--kol-nav-item-padding-left) + 8)` | Navigation | Nested nav item padding | Dynamically calculated |
118+
| `--kol-table-selection-col-width` | SCSS variable | Table | Selection column width | Set via SCSS |
119+
| `--tree-item-indentation` | `#{to-rem(20)}` | Tree | Indent per tree level | 20px indentation |
120+
121+
## Button Group Tokens
122+
123+
| Token | Value | Context | Notes |
124+
|-------|-------|---------|-------|
125+
| `--button-group-display` | `flex` or `grid` | Button groups | Layout mode |
126+
| `--button-group-gap` | `#{to-rem(16)}` or `#{to-rem(32)}` | Button groups | Spacing between buttons |
127+
| `--button-group-order` | `0` or `1` | Button groups | Order in flex/grid layout |
128+
129+
## Form Field Tokens
130+
131+
| Token | Value | Usage | Notes |
132+
|-------|-------|-------|-------|
133+
| `--display` | `flex` or `grid` | Form layouts | Layout mode for form field ordering |
134+
| `--grid-template-columns` | `1fr auto` or `auto 1fr` | Form layouts | Column structure |
135+
| `--grid-template-rows` | `1fr auto` or `auto 1fr` | Form layouts | Row structure |
136+
137+
## Font Awesome Tokens
138+
139+
| Token | Value | Usage | Notes |
140+
|-------|-------|-------|-------|
141+
| `--fa-font-solid` | `normal 900 1em/1 'Font Awesome 6 Free'` | Icons | Solid Font Awesome icons |
142+
| `--fa-font-regular` | `normal 400 1em/1 'Font Awesome 6 Free'` | Icons | Regular Font Awesome icons |
143+
| `--fa-font-brands` | `normal 400 1em/1 'Font Awesome 6 Brands'` | Icons | Brand Font Awesome icons |
144+
| `--fa-animation-direction` | `reverse` | Icons | Animation direction |
145+
146+
## Animations & Keyframes
147+
148+
### Defined Keyframes
149+
150+
| Keyframe | Purpose | Animation |
151+
|----------|---------|-----------|
152+
| `@keyframes spin` | Loading spinner | Rotates from 0° to 360° |
153+
154+
### Transition Timing
155+
156+
- Focus outline offset: `200ms linear`
157+
- Button transitions: `0.5s` (background-color, color, border-color)
158+
- Checkbox/radio: `0.5s`
159+
160+
## Component-Specific Token Usage
161+
162+
### Input Components
163+
- **Containers**: Use `--color-light` (bg), `--color-subtle` (border), `--border-radius`
164+
- **Disabled**: Use `--color-mute` (bg), `--color-mute-variant` (border)
165+
- **Focus**: Use focus-outline mixin with `--color-primary-variant`
166+
- **Error**: Use `--color-danger` for border and text
167+
168+
### Buttons
169+
- **All variants**: Leverage `--color-primary`, `--color-secondary`, `--color-danger`, `--color-light`
170+
- **Hover**: Switch to `--color-primary-variant`
171+
- **Text**: Use `--text-color`, `--text-background-color`, `--text-border-color`
172+
173+
### Links
174+
- **Default**: `--color-primary`
175+
- **Visited**: `--color-visited`
176+
- **Focus**: Border using `--border-width` and `--border-radius`
177+
178+
### Alerts
179+
- **Type-specific**: `--alert-accent-color` changes based on type (danger, warning, success, info, default)
180+
- **Card variant**: Full background using accent color
181+
- **Message variant**: Border accent only
182+
183+
### Forms
184+
- **Error**: Left border (3px) in `--color-danger`
185+
- **Labels**: Font size `to-rem(14)`, font-weight bold
186+
- **Hints**: Uses `kol-typography-hint` mixin
187+
188+
## Issues & Observations
189+
190+
### Potential Issues
191+
192+
- **Hardcoded Values**: Some components use hardcoded colors instead of tokens:
193+
- Box shadows with `rgb(8, 35, 48, 0.24)` (should be token-based or documented)
194+
- Some border-radius hardcoded as `3px` in badge (inconsistent with `--border-radius`)
195+
- Some padding/margin use hardcoded pixel values like `to-rem(8)`, `to-rem(16)` instead of spacing token
196+
197+
- **Spacing Token**: The `--spacing` token is defined as `to-rem(4)` but rarely used directly. Components mostly use `to-rem(16)`, `to-rem(8)`, etc. Consider:
198+
- Using spacing multipliers: `calc(var(--spacing) * 4)`, `calc(var(--spacing) * 2)`
199+
- This is done in some places (radio/checkbox orientation gap) but inconsistent
200+
201+
- **Typography**: All typography properties are in mixins, not CSS variables. Consider extracting:
202+
- `--font-size-body`, `--font-size-h1`, etc.
203+
- `--line-height-body`, `--line-height-h1`, etc.
204+
- This would allow runtime customization
205+
206+
- **Focus Token Override**: The `--kol-focus-outline-offset` has a default in the mixin (`2px`) but can be overridden to `-2px`. This should be documented more clearly.
207+
208+
### Unused/Undocumented Tokens
209+
210+
- `--text-outline`: Used in button components but not clearly documented
211+
- `--text-box-shadow`: Set but rarely used
212+
- `--text-border-radius`: Set but mostly uses `--border-radius` instead
213+
214+
### Token Dependencies
215+
216+
Several tokens depend on others:
217+
- `--alert-accent-color` depends on alert type (danger, warning, success, etc.)
218+
- `--kol-nav-nested-padding-left` depends on `--kol-nav-item-padding-left`
219+
- Button hover states override multiple `--text-*` tokens simultaneously
220+
221+
## Token Definition Locations
222+
223+
### Global Tokens (global.scss)
224+
- All base color tokens
225+
- Border and spacing base tokens
226+
- Font family and size
227+
- Default focus colors
228+
229+
### Component-Specific Tokens
230+
- **Buttons** (button.scss mixin): `--text-background-color`, `--text-border-color`, `--text-color` per variant
231+
- **Alerts** (alert.scss mixin): `--alert-accent-color` per type
232+
- **Forms**: Various layout tokens for field ordering
233+
- **Navigation**: Padding and indentation tokens
234+
- **Checkboxes/Radios**: Selection input color tokens
235+
236+
### Computed/Calculated Tokens
237+
- `--kol-nav-nested-padding-left`: Uses `calc()`
238+
- Typography sizes: Converted via `to-rem()` function
239+
240+
## Summary Statistics
241+
242+
- **Color Tokens**: 12
243+
- **Spacing/Border Tokens**: 3
244+
- **Typography Tokens**: 6 (mixins only)
245+
- **State Tokens**: 8+ (button variants, selections, alerts)
246+
- **Utility Tokens**: 10+
247+
- **Total Defined Tokens**: 40+
248+
249+
## Recommendations
250+
251+
1. **Create Spacing Scale**: Convert `--spacing` usage to multipliers for consistency
252+
2. **Tokenize Typography**: Move font sizes from mixins to CSS variables
253+
3. **Document Hardcoded Values**: Create tokens for `rgb(8, 35, 48, 0.24)` and other commonly repeated values
254+
4. **Consistent Naming**: Standardize token naming (currently mixes `--color-*`, `--text-*`, `--kol-*` prefixes)
255+
5. **Shadow Token**: Define `--shadow-default` for the commonly used box-shadow value
256+
6. **Line Height Token**: Create `--line-height-base` and other line-height tokens
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# BWSt Theme — Maintenance TODOs
2+
3+
## Completed Fixes (v1.0)
4+
5+
All fixes verified and merged into the theme.
6+
7+
- [x] alert.scss:31 — rgb() → rgba() for drop-shadow
8+
- [x] alert.scss:104 — CSS-Calc-Syntax fix (--var-spacing → var(--spacing))
9+
- [x] kol-table-stateless-wc.scss:155 — rgb() → rgba()
10+
- [x] kol-table-stateless-wc.scss:212 — rgb() → rgba()
11+
- [x] button.scss:95 — rgb() → rgba()
12+
- [x] pagination-mixin.scss:26 — rgb() → rgba()
13+
- [x] input-radio.scss:58 — rgb() → rgba()
14+
- [x] nav.scss:105 — rgb() → rgba()
15+
- [x] input-checkbox.scss:72 — rgb() → rgba()
16+
- [x] input-checkbox.scss:222 — rgb() → rgba()
17+
- [x] button-link.scss:25 — var(--visited) → var(--color-visited)
18+
- [x] split-button.scss:50 — #fff → var(--color-light)
19+
20+
## Open Tasks
21+
22+
### Critical
23+
24+
- [ ] serve.sh:5 — Fix shell script syntax: `'pwd'``` `pwd` `` or `$(pwd)`
25+
26+
### High
27+
28+
- [ ] Theme Variables Audit — Create comprehensive list of all available design tokens
29+
- [ ] A11y Audit — Verify color contrast, keyboard navigation, ARIA attributes
30+
31+
### Medium
32+
33+
- [ ] focus-visible Fallbacks — Ensure all components have `:focus` state defined
34+
- [ ] Responsive Design Review — Audit REM/EM vs. PX unit usage for consistency
35+
36+
### Low
37+
38+
- [ ] Documentation — Update component style guide with BWSt-specific token mappings

packages/themes/bwst/serve.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export THEME_MODULE="`pwd`/dist"
44
export THEME_EXPORT=$1
5-
export THEME_CSS="'pwd'/inject-assets.css"
5+
export THEME_CSS="`pwd`/inject-assets.css"
66
cd ../../../node_modules/@public-ui/sample-react/
77
echo "`pwd`"
88
npm start

packages/themes/bwst/src/components/button-link.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
&:visited {
25-
color: var(--visited);
25+
color: var(--color-visited);
2626
}
2727

2828
&__text {

packages/themes/bwst/src/components/split-button.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
}
4848

4949
.kol-popover__content {
50-
background-color: #fff;
50+
background-color: var(--color-light);
5151
}
5252

5353
@include kol-button('kol-button');

packages/themes/bwst/src/mixins/alert.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
.kol-alert__heading {
102102
.kol-alert--variant-msg & {
103103
color: var(--alert-accent-color);
104-
padding-top: calc(--var-spacing / 2);
104+
padding-top: calc(var(--spacing) / 2);
105105
}
106106

107107
.kol-alert--variant-card & {

packages/themes/default/serve.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export THEME_MODULE="`pwd`/dist"
44
export THEME_EXPORT=$1
5-
export THEME_CSS="'pwd'/inject-assets.css"
5+
export THEME_CSS="`pwd`/inject-assets.css"
66
cd ../../../node_modules/@public-ui/sample-react/
77
echo "`pwd`"
88
npm start

packages/themes/kern/serve.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
export THEME_MODULE="`pwd`/dist"
44
export THEME_EXPORT=$1
5-
export THEME_CSS="'pwd'/inject-assets.css"
5+
export THEME_CSS="`pwd`/inject-assets.css"
66
cd ../../../node_modules/@public-ui/sample-react/
77
echo "`pwd`"
88
npm start

0 commit comments

Comments
 (0)