Skip to content

Commit 8a32596

Browse files
QuintonJasondjkajabipixelflips
authored
Next Version Bump (#2158)
* Remove CodeQL workflow - migrating to Aikido for SAST scanning * fix: add semantic tokens and dark mode support (#2156) * feat: add ds-tokens and semantic tokens * fix: resolve build error * feat: update core to semantic tokens * feat: validate tokens * feat: add dark mode toggle * fix: color update * fix: update maps to preserve token values * fix: update heading values * fix: update tokens and dark mode values * fix: update token values * fix: update semantic token mapping from loop * fix: token cleanup * fix: remove dark mode temp files * fix: update color token pairings * fix: update ds tokens dark mode dev version * fix(sage-alert): update colors to match pine alert * fix(sage-alert): update alert close button color * fix: update subtle button dark mode colors * fix: add latest ds tokens * fix: remove console warnings * fix: update buttons hover colors * fix: remove problematic @import from _ds_tokens.scss - Reverted automatic Pine tokens import that broke Vite builds - The ~@ prefix is webpack-specific and incompatible with Vite - Tokens are now documented as requiring app-level loading (CDN or import) - Added Pine tokens import to sage-lib docs specifically (webpack env) - Bumped version to 6.2.25-dev.9 * fix(button): move dark theme override to end of file for CSS cascade - Move [data-theme="dark"] block to Theme Overrides section at EOF - Ensures dark theme styles properly override generated button styles - Add comment to prevent future regressions Bump sage-assets to 6.2.25-dev.11 * fix: update to latest packs and dropdown semantic border * style: update to use semantic tokens grey black white * fix: update semantic tokens names * fix: update to semantic values * fix: add lock file * fix: update to ds tokens 1.0.1 * fix: remove hard coded dark mode attr * fix: resolve linter errors * style: oop fix * style: oop fix * style: oop fix * fix: oop fix * fix: oop fix * fix: remove ds tokens dependancy * fix: align alert switch and tooltip to pine styles * fix: align badge input popover property and form element error message * fix: update disabled border * fix: added border's to modal like things * fix: lint error fix * fix: update tokens * fix: remove yarn dependancy * fix: update hero custom bg example * fix: updated pagination * style: updated alerts and banner to core tokens * fix: update dark mode error state * fix: remove border and update lang * fix: update alert icon and text colors * fix: update alert and button color * fix: update disabled select icon color * chore(ci): updating rails gem version [ci skip] * chore(release): publish [skip ci] * Remove dependency-review workflow - migrating to Aikido * chore: removed dev test version * chore: update yarn lock * chore: remove test version work * fix: update token values remove commented file and update token version * fix: update brand token * style: update divider color header and sidenav colors * chore: resolve scss error * fix: normalize base color comparisons in SCSS color palette * style: adjust stylelint for color-named rule in SCSS color palette * refactor: simplify color block generation in SCSS and enhance contrast logic * refactor: update color handling in SCSS to use sd for hex values --------- Co-authored-by: Djamshed Karimov <djamshed.karimov@kajabi.com> Co-authored-by: Djamshed Karimov <81991459+djkajabi@users.noreply.github.com> Co-authored-by: Phillip Lovelace <phillip.lovelace@kajabi.com>
1 parent a970ce1 commit 8a32596

File tree

91 files changed

+1270
-655
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+1270
-655
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

.github/workflows/dependency-review.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

docs/app/views/application/_app_head_content.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
1010
})(window,document,'script','dataLayer','GTM-T8W9NCJ');</script>
1111
<% end %>
12-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@pine-ds/core@latest/dist/pine-core/pine-core.css">
12+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@kajabi-ui/styles@latest/dist/pine/pine.css">
1313
<%= stylesheet_pack_tag "docs" %>
1414
<link rel="canonical" href="<%= url_for(only_path: false) %>" />
1515
<link href="/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180" type="image/png">

docs/app/views/application/_assistant.html.erb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,18 @@
1313
name: "search"
1414
}
1515
} %>
16+
<%= sage_component SageButton, {
17+
value: "Toggle dark mode",
18+
attributes: {
19+
"data-js-dark-mode-toggle": true,
20+
title: "Toggle dark mode",
21+
"aria-label": "Toggle dark mode"
22+
},
23+
subtle: true,
24+
icon: {
25+
name: "flash",
26+
style: "only"
27+
}
28+
} %>
1629
<% end %>
1730
<% end %>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* Dark Mode Toggle
3+
* Handles switching between light and dark themes
4+
*/
5+
6+
const THEME_KEY = 'sage-theme';
7+
const THEME_DARK = 'dark';
8+
const THEME_LIGHT = 'light';
9+
10+
class DarkModeToggle {
11+
constructor() {
12+
this.toggle = document.querySelector('[data-js-dark-mode-toggle]');
13+
if (!this.toggle) return;
14+
15+
this.init();
16+
}
17+
18+
init() {
19+
// Set initial theme from localStorage or system preference
20+
const savedTheme = localStorage.getItem(THEME_KEY);
21+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
22+
const initialTheme = savedTheme || (prefersDark ? THEME_DARK : THEME_LIGHT);
23+
24+
this.setTheme(initialTheme, false);
25+
26+
// Listen for toggle clicks
27+
this.toggle.addEventListener('click', () => this.handleToggle());
28+
29+
// Listen for system theme changes
30+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
31+
if (!localStorage.getItem(THEME_KEY)) {
32+
this.setTheme(e.matches ? THEME_DARK : THEME_LIGHT, false);
33+
}
34+
});
35+
}
36+
37+
handleToggle() {
38+
const currentTheme = document.documentElement.getAttribute('data-theme');
39+
const newTheme = currentTheme === THEME_DARK ? THEME_LIGHT : THEME_DARK;
40+
this.setTheme(newTheme, true);
41+
}
42+
43+
setTheme(theme, save = true) {
44+
// Update data-theme attribute on <html>
45+
document.documentElement.setAttribute('data-theme', theme);
46+
47+
// Update toggle button aria-label and icon
48+
const isDark = theme === THEME_DARK;
49+
this.toggle.setAttribute('aria-label', isDark ? 'Switch to light mode' : 'Switch to dark mode');
50+
this.toggle.setAttribute('title', isDark ? 'Switch to light mode' : 'Switch to dark mode');
51+
52+
// Update icon (pds-icon element)
53+
const icon = this.toggle.querySelector('pds-icon');
54+
if (icon) {
55+
// When dark mode: use flash-filled, when light mode: use flash
56+
icon.setAttribute('name', isDark ? 'flash-filled' : 'flash');
57+
}
58+
59+
// Save to localStorage if requested
60+
if (save) {
61+
localStorage.setItem(THEME_KEY, theme);
62+
}
63+
}
64+
}
65+
66+
// Initialize when DOM is ready
67+
if (document.readyState === 'loading') {
68+
document.addEventListener('DOMContentLoaded', () => new DarkModeToggle());
69+
} else {
70+
new DarkModeToggle();
71+
}
72+
73+
export default DarkModeToggle;
74+

docs/lib/sage-frontend/javascript/docs/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require('./meter')
66
require('./button-group')
77
require('./example')
88
require('./scroll-to-active-nav-item')
9+
require('./dark-mode-toggle')
910

1011
import SageDocsTabs from './tabs';
1112

docs/lib/sage-frontend/stylesheets/docs/_assistant.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
margin-block-end: 0;
3131

3232
.sage-switch__label {
33-
color: sage-color(white);
33+
color: var(--pine-color-white);
3434
}
3535
}

docs/lib/sage-frontend/stylesheets/docs/_colors.scss

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@
4343
}
4444

4545
// build individual color blocks
46+
// Use sd-sage-color() directly for hex values (works with published npm version)
47+
/* stylelint-disable max-nesting-depth */
4648
@each $name, $color in $sage-colors {
4749
@each $value, $map in $color {
48-
$hex: sage-color($name, $value);
50+
// Get hex value directly from Style Dictionary
51+
$hex: sd-sage-color($name, $value, hex);
4952

5053
// Determine class name for $value == 50
5154
$classname: ".color-#{"" + $name}-#{$value}";
@@ -60,41 +63,12 @@
6063
font-size: sage-font-size(body);
6164
background: $hex;
6265

63-
@if ($name == grey and $value > 400) {
64-
color: sage-color(white);
65-
}
66-
@else if ($name == white or $name == grey) {
67-
color: sage-color(grey, 950);
68-
}
69-
@else if ($name == black or $name == charcoal) {
70-
color: sage-color(white);
71-
}
72-
@else if ($name == blue and $value > 400) {
73-
color: sage-color(blue, 200);
74-
}
75-
@else if ($name == blue) {
76-
color: sage-color(blue, 950);
77-
}
78-
@else if ($name == mercury and $value > 200) {
79-
color: sage-color(white);
80-
}
81-
@else if ($name == mercury) {
82-
color: sage-color(mercury, 500);
83-
}
84-
@else if ($name == green and $value > 200) {
85-
color: sage-color(white);
86-
}
87-
@else if ($name == green) {
88-
color: sage-color(green, 600);
89-
}
90-
@else if ($name == yellow and $value > 300) {
91-
color: sage-color(white);
92-
}
93-
@else if (lightness($hex) < 65) {
94-
color: sage-color($name, 100);
66+
// Simple lightness-based contrast: white text on dark, black text on light
67+
@if (lightness($hex) < 55%) {
68+
color: #fff;
9569
}
9670
@else {
97-
color: sage-color($name, 400);
71+
color: sd-sage-color(grey, 950, hex);
9872
}
9973

10074
&::after {
@@ -106,17 +80,18 @@
10680
}
10781
}
10882
}
83+
/* stylelint-enable max-nesting-depth */
10984

11085
[class*="color-"]:only-child {
11186
border-radius: sage-border(radius);
11287
}
11388

11489
.color-white-100 {
11590
border-radius: sage-border(radius);
116-
border: 1px solid sage-color(grey, 800);
117-
box-shadow: inset 0 0 0.0625rem sage-color(grey, 800);
91+
border: 1px solid sd-sage-color(grey, 300, hex);
92+
box-shadow: inset 0 0 0.0625rem sd-sage-color(grey, 300, hex);
11893
}
11994

12095
.color-black-100 {
121-
color: sage-color(white);
96+
color: #fff;
12297
}

docs/lib/sage-frontend/stylesheets/docs/_quick_links.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
For Sage documentation use
55
================================================== */
66

7-
$-quick-links-color-text: sage-color(grey, 900);
7+
$-quick-links-color-text: var(--pine-color-text-active);
88
$-quick-links-color-focus: sage-color(primary, 300);
99
$-quick-links-color-background: sage-color(primary, 200);
1010

@@ -13,7 +13,7 @@ $-quick-links-color-background: sage-color(primary, 200);
1313
inset-block-start: 0;
1414
overflow: hidden;
1515
padding: sage-spacing(2xs) sage-spacing();
16-
background-color: #fff;
16+
background-color: var(--pine-color-background-container);
1717
border-radius: sage-border(radius);
1818
}
1919

0 commit comments

Comments
 (0)