bref-ui 0.0.2 → 0.0.4

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.
@@ -8,11 +8,20 @@
8
8
  filled = false,
9
9
  size = 'medium',
10
10
  color = 'foreground',
11
+ ariaLabel,
12
+ contrastMode,
11
13
  ...rest
12
14
  }: IconProps & SvelteHTMLElements['span'] = $props();
13
15
  </script>
14
16
 
15
- <span {...rest} class:filled class={`${size} ${color}`} aria-hidden="true">
17
+ <span
18
+ {...rest}
19
+ class:filled
20
+ class={`${size} ${color}`}
21
+ class:contrastMode
22
+ aria-label={ariaLabel}
23
+ aria-hidden={ariaLabel ? 'false' : 'true'}
24
+ >
16
25
  {name}
17
26
  </span>
18
27
 
@@ -54,25 +63,55 @@
54
63
  .foreground {
55
64
  color: var(--color-foreground);
56
65
  }
66
+ .foreground.contrastMode {
67
+ color: var(--color-foreground-contrast);
68
+ }
57
69
  .primary {
58
- color: var(--color-primary-base);
70
+ color: var(--color-primary);
71
+ }
72
+ .primary.contrastMode {
73
+ color: var(--color-primary-contrast);
59
74
  }
75
+
60
76
  .secondary {
61
- color: var(--color-secondary-base);
77
+ color: var(--color-secondary);
78
+ }
79
+ .secondary.contrastMode {
80
+ color: var(--color-secondary-contrast);
62
81
  }
82
+
63
83
  .success {
64
- color: var(--color-success-base);
84
+ color: var(--color-success);
85
+ }
86
+ .success.contrastMode {
87
+ color: var(--color-success-contrast);
65
88
  }
89
+
66
90
  .warning {
67
- color: var(--color-warning-base);
91
+ color: var(--color-warning);
68
92
  }
93
+ .warning.contrastMode {
94
+ color: var(--color-warning-contrast);
95
+ }
96
+
69
97
  .danger {
70
- color: var(--color-danger-base);
98
+ color: var(--color-danger);
71
99
  }
100
+ .danger.contrastMode {
101
+ color: var(--color-danger-contrast);
102
+ }
103
+
72
104
  .background {
73
105
  color: var(--color-background);
74
106
  }
107
+ .background.contrastMode {
108
+ color: var(--color-background-contrast);
109
+ }
110
+
75
111
  .info {
76
- color: var(--color-info-base);
112
+ color: var(--color-info);
113
+ }
114
+ .info.contrastMode {
115
+ color: var(--color-info-contrast);
77
116
  }
78
117
  </style>
@@ -5,4 +5,6 @@ export interface IconProps {
5
5
  filled?: boolean;
6
6
  size?: Size;
7
7
  color?: Color;
8
+ ariaLabel?: string;
9
+ contrastMode?: boolean;
8
10
  }
@@ -1,14 +1,13 @@
1
- import type { ColorTokenProps, ThemeMode, ThemeProps } from './types.ts';
1
+ import type { ColorTokenProps, ThemeProps } from './types.ts';
2
2
  /**
3
- * Generates a complete set of color tokens based on a base color and theme mode.
4
- * Produces consistent, accessible color variations for UI components including
5
- * soft backgrounds, hover states, active states, muted variants, and contrast colors.
3
+ * Generates a minimal set of color tokens based on a base color.
4
+ * Produces soft, saturated, and contrast variants. Hover/active states are
5
+ * left to components using CSS color-mix() for context-aware state derivation.
6
6
  *
7
7
  * @param color - The base color in any valid CSS color format
8
- * @param mode - The current theme mode ('light' or 'dark')
9
- * @returns An object containing all color token variations
8
+ * @returns An object containing soft, saturated, and contrast color tokens
10
9
  */
11
- declare const generateColorTokens: (color: string, mode: ThemeMode) => ColorTokenProps;
10
+ declare const generateColorTokens: (color: string) => ColorTokenProps;
12
11
  /**
13
12
  * Sets a CSS custom property on the document root element.
14
13
  * Automatically prefixes the key with '--' if not already present.
@@ -19,20 +18,19 @@ declare const generateColorTokens: (color: string, mode: ThemeMode) => ColorToke
19
18
  declare const setCSSProperty: (key: string, value: string) => void;
20
19
  /**
21
20
  * Generates and applies a complete set of color tokens as CSS custom properties.
22
- * Each token is set as `--color-{mode}-{colorKey}-{variant}` on the document root.
21
+ * Each token is set as `--color-{colorKey}` and `--color-{colorKey}-{variant}` on the document root.
23
22
  *
24
23
  * @param colorKey - The semantic name for the color (e.g., 'primary', 'success')
25
24
  * @param baseColor - The base color in any valid CSS color format
26
- * @param mode - The current theme mode ('light' or 'dark')
27
25
  */
28
- declare const setColorTokens: (colorKey: string, baseColor: string, mode: ThemeMode) => void;
26
+ declare const setColorTokens: (colorKey: string, baseColor: string) => void;
29
27
  /**
30
- * Applies all color tokens for a specific theme mode as CSS custom properties.
31
- * Sets palette colors, surface colors, and border color for the given mode.
28
+ * Applies all theme tokens as CSS custom properties.
29
+ * Palette colors are set without mode prefix (consistent across themes).
30
+ * Surface colors (background/foreground) are set with mode prefix for light/dark switching.
32
31
  *
33
32
  * @param theme - The theme configuration object containing palette and surface colors
34
- * @param mode - The theme mode ('light' or 'dark') to apply
35
33
  */
36
- declare const setThemeMode: (userTheme: ThemeProps, mode: ThemeMode) => void;
37
- export { generateColorTokens, setCSSProperty, setThemeMode };
34
+ declare const setThemeTokens: (theme: ThemeProps) => void;
35
+ export { generateColorTokens, setCSSProperty, setThemeTokens };
38
36
  export default setColorTokens;
@@ -1,86 +1,42 @@
1
1
  import { colord } from 'colord';
2
2
  /**
3
3
  * Generates a soft background color from the base color.
4
- * In light mode, produces a much lighter shade (like a 100-200 on a color scale)
5
- * suitable as a background when using the base color as foreground.
6
- * In dark mode, produces a darker, desaturated version for the same effect.
4
+ * Produces a lighter, slightly desaturated shade suitable as a
5
+ * background when using the base color as foreground.
7
6
  *
8
7
  * @param baseColor - The base color in any valid CSS color format
9
- * @param mode - The current theme mode ('light' or 'dark')
10
8
  * @returns A hex color string representing the soft background color
11
9
  */
12
- const generateSoftColor = (baseColor, mode) => mode === 'light'
13
- ? colord(baseColor).lighten(0.35).desaturate(0.1).toHex()
14
- : colord(baseColor).darken(0.35).desaturate(0.2).toHex();
10
+ const generateSoftColor = (baseColor) => colord(baseColor).lighten(0.25).desaturate(0.1).toHex();
15
11
  /**
16
- * Returns the base color unchanged.
17
- * This function serves as a passthrough to maintain consistency
18
- * in the color token generation API.
12
+ * Generates a saturated (darker) version of the base color.
13
+ * Produces a deeper, more intense shade suitable for emphasis or contrast.
19
14
  *
20
15
  * @param baseColor - The base color in any valid CSS color format
21
- * @param _mode - The current theme mode (unused, kept for API consistency)
22
- * @returns The base color as a hex string
16
+ * @returns A hex color string representing the saturated color
23
17
  */
24
- const generateBaseColor = (baseColor, _mode) => colord(baseColor).toHex();
25
- /**
26
- * Generates a hover state color from the base color.
27
- * In light mode, produces a slightly darker shade to indicate interactivity.
28
- * In dark mode, produces a slightly lighter shade for the same visual feedback.
29
- *
30
- * @param baseColor - The base color in any valid CSS color format
31
- * @param mode - The current theme mode ('light' or 'dark')
32
- * @returns A hex color string for the hover state
33
- */
34
- const generateHoverColor = (baseColor, mode) => mode === 'light' ? colord(baseColor).darken(0.1).toHex() : colord(baseColor).lighten(0.1).toHex();
35
- /**
36
- * Generates an active/pressed state color from the base color.
37
- * In light mode, produces a more pronounced darker shade than hover.
38
- * In dark mode, produces a more pronounced lighter shade than hover.
39
- * Used to indicate active state on click or tap interactions.
40
- *
41
- * @param baseColor - The base color in any valid CSS color format
42
- * @param mode - The current theme mode ('light' or 'dark')
43
- * @returns A hex color string for the active state
44
- */
45
- const generateActiveColor = (baseColor, mode) => mode === 'light' ? colord(baseColor).darken(0.2).toHex() : colord(baseColor).lighten(0.2).toHex();
46
- /**
47
- * Generates a muted/desaturated version of the base color.
48
- * Useful for disabled states, placeholder elements, or less prominent UI elements.
49
- * Also slightly adjusts lightness based on theme mode for better visual balance.
50
- *
51
- * @param baseColor - The base color in any valid CSS color format
52
- * @param mode - The current theme mode ('light' or 'dark')
53
- * @returns A hex color string representing the muted color
54
- */
55
- const generateMutedColor = (baseColor, mode) => mode === 'light'
56
- ? colord(baseColor).desaturate(0.4).lighten(0.15).toHex()
57
- : colord(baseColor).desaturate(0.4).darken(0.15).toHex();
18
+ const generateSaturatedColor = (baseColor) => colord(baseColor).darken(0.15).saturate(0.1).toHex();
58
19
  /**
59
20
  * Generates a contrast color for text or icons placed on top of the base color.
60
21
  * Returns either black or white depending on the base color's perceived brightness,
61
22
  * ensuring readability and accessibility (WCAG compliance).
62
23
  *
63
24
  * @param baseColor - The base color in any valid CSS color format
64
- * @param _mode - The current theme mode (unused, contrast is based on color luminance)
65
25
  * @returns '#ffffff' for dark base colors, '#000000' for light base colors
66
26
  */
67
- const generateContrastColor = (baseColor, _mode) => colord(baseColor).isDark() ? '#ffffff' : '#000000';
27
+ const generateContrastColor = (baseColor) => colord(baseColor).isDark() ? '#ffffff' : '#000000';
68
28
  /**
69
- * Generates a complete set of color tokens based on a base color and theme mode.
70
- * Produces consistent, accessible color variations for UI components including
71
- * soft backgrounds, hover states, active states, muted variants, and contrast colors.
29
+ * Generates a minimal set of color tokens based on a base color.
30
+ * Produces soft, saturated, and contrast variants. Hover/active states are
31
+ * left to components using CSS color-mix() for context-aware state derivation.
72
32
  *
73
33
  * @param color - The base color in any valid CSS color format
74
- * @param mode - The current theme mode ('light' or 'dark')
75
- * @returns An object containing all color token variations
34
+ * @returns An object containing soft, saturated, and contrast color tokens
76
35
  */
77
- const generateColorTokens = (color, mode) => ({
78
- soft: generateSoftColor(color, mode),
79
- base: generateBaseColor(color, mode),
80
- hover: generateHoverColor(color, mode),
81
- active: generateActiveColor(color, mode),
82
- muted: generateMutedColor(color, mode),
83
- contrast: generateContrastColor(color, mode)
36
+ const generateColorTokens = (color) => ({
37
+ soft: generateSoftColor(color),
38
+ saturated: generateSaturatedColor(color),
39
+ contrast: generateContrastColor(color)
84
40
  });
85
41
  /**
86
42
  * Sets a CSS custom property on the document root element.
@@ -95,54 +51,55 @@ const setCSSProperty = (key, value) => {
95
51
  };
96
52
  /**
97
53
  * Generates and applies a complete set of color tokens as CSS custom properties.
98
- * Each token is set as `--color-{mode}-{colorKey}-{variant}` on the document root.
54
+ * Each token is set as `--color-{colorKey}` and `--color-{colorKey}-{variant}` on the document root.
99
55
  *
100
56
  * @param colorKey - The semantic name for the color (e.g., 'primary', 'success')
101
57
  * @param baseColor - The base color in any valid CSS color format
102
- * @param mode - The current theme mode ('light' or 'dark')
103
58
  */
104
- const setColorTokens = (colorKey, baseColor, mode) => {
105
- const tokens = generateColorTokens(baseColor, mode);
59
+ const setColorTokens = (colorKey, baseColor) => {
60
+ const tokens = generateColorTokens(baseColor);
61
+ setCSSProperty(`--color-${colorKey}`, baseColor);
106
62
  Object.entries(tokens).forEach(([variant, value]) => {
107
- setCSSProperty(`--color-${mode}-${colorKey}-${variant}`, value);
63
+ setCSSProperty(`--color-${colorKey}-${variant}`, value);
108
64
  });
109
65
  };
110
66
  /**
111
- * Flips the background and foreground colors of the theme for dark mode.
112
- * In dark mode, the background becomes the foreground and vice versa.
113
- * This ensures appropriate contrast and readability in dark themes.
67
+ * Generates and applies surface color tokens with mode prefix for light/dark switching.
68
+ * Each token is set as `--color-{mode}-{surfaceKey}-{variant}` on the document root.
114
69
  *
115
- * @param theme - The theme configuration object containing surface colors
116
- * @param mode - The current theme mode ('light' or 'dark')
117
- * @returns A new ThemeProps object with flipped background and foreground if in dark mode
70
+ * @param surfaceKey - The semantic name for the surface (e.g., 'background', 'foreground')
71
+ * @param baseColor - The base color in any valid CSS color format
72
+ * @param mode - The theme mode ('light' or 'dark')
118
73
  */
119
- const flipThemeBackgroundAndForeground = (theme, mode) => {
120
- const flippedTheme = structuredClone(theme);
121
- if (mode === 'dark') {
122
- const darkBackground = theme.surfaceHex.background;
123
- const lightForeground = theme.surfaceHex.foreground;
124
- flippedTheme.surfaceHex.background = lightForeground;
125
- flippedTheme.surfaceHex.foreground = darkBackground;
126
- }
127
- return flippedTheme;
74
+ const setSurfaceTokens = (surfaceKey, baseColor, mode) => {
75
+ const tokens = generateColorTokens(baseColor);
76
+ setCSSProperty(`--color-${mode}-${surfaceKey}`, baseColor);
77
+ Object.entries(tokens).forEach(([variant, value]) => {
78
+ setCSSProperty(`--color-${mode}-${surfaceKey}-${variant}`, value);
79
+ });
128
80
  };
129
81
  /**
130
- * Applies all color tokens for a specific theme mode as CSS custom properties.
131
- * Sets palette colors, surface colors, and border color for the given mode.
82
+ * Applies all theme tokens as CSS custom properties.
83
+ * Palette colors are set without mode prefix (consistent across themes).
84
+ * Surface colors (background/foreground) are set with mode prefix for light/dark switching.
132
85
  *
133
86
  * @param theme - The theme configuration object containing palette and surface colors
134
- * @param mode - The theme mode ('light' or 'dark') to apply
135
87
  */
136
- const setThemeMode = (userTheme, mode) => {
137
- const theme = flipThemeBackgroundAndForeground(userTheme, mode);
88
+ const setThemeTokens = (theme) => {
89
+ // Palette colors: same across light/dark modes
138
90
  Object.entries(theme.paletteHex).forEach(([color, value]) => {
139
- setCSSProperty(`--color-${mode}-${color}`, value);
140
- setColorTokens(color, value, mode);
91
+ setColorTokens(color, value);
141
92
  });
93
+ // Surface colors: different for light/dark modes
94
+ // Light mode uses colors as-is
142
95
  Object.entries(theme.surfaceHex).forEach(([surface, value]) => {
143
- setCSSProperty(`--color-${mode}-${surface}`, value);
96
+ setSurfaceTokens(surface, value, 'light');
144
97
  });
145
- setCSSProperty(`--color-${mode}-border`, theme.border.colorHex);
98
+ // Dark mode flips background and foreground
99
+ setSurfaceTokens('background', theme.surfaceHex.foreground, 'dark');
100
+ setSurfaceTokens('foreground', theme.surfaceHex.background, 'dark');
101
+ // Border color
102
+ setCSSProperty('--color-border', theme.border.colorHex);
146
103
  };
147
- export { generateColorTokens, setCSSProperty, setThemeMode };
104
+ export { generateColorTokens, setCSSProperty, setThemeTokens };
148
105
  export default setColorTokens;
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { setCSSProperty, setThemeMode } from './color-tokens.js';
2
+ import { setCSSProperty, setThemeTokens } from './color-tokens.js';
3
3
  import { initializeThemeMode } from './mode.js';
4
4
  import { DEFAULT_THEME, type ThemeProps } from './types.js';
5
5
 
@@ -23,8 +23,7 @@
23
23
  };
24
24
 
25
25
  $effect.pre(() => {
26
- setThemeMode(theme, 'light');
27
- setThemeMode(theme, 'dark');
26
+ setThemeTokens(theme);
28
27
 
29
28
  setCSSProperty(`--border-width`, `${theme.border.widthPx}px`);
30
29
  setCSSProperty(`--border-radius`, `${theme.border.radiusRem}rem`);
@@ -38,51 +37,15 @@
38
37
  :global(:root),
39
38
  :global(:root[data-theme='light']) {
40
39
  color-scheme: light;
41
- --color-primary: var(--color-light-primary);
42
- --color-primary-soft: var(--color-light-primary-soft);
43
- --color-primary-base: var(--color-light-primary-base);
44
- --color-primary-hover: var(--color-light-primary-hover);
45
- --color-primary-active: var(--color-light-primary-active);
46
- --color-primary-muted: var(--color-light-primary-muted);
47
- --color-primary-contrast: var(--color-light-primary-contrast);
48
- --color-secondary: var(--color-light-secondary);
49
- --color-secondary-soft: var(--color-light-secondary-soft);
50
- --color-secondary-base: var(--color-light-secondary-base);
51
- --color-secondary-hover: var(--color-light-secondary-hover);
52
- --color-secondary-active: var(--color-light-secondary-active);
53
- --color-secondary-muted: var(--color-light-secondary-muted);
54
- --color-secondary-contrast: var(--color-light-secondary-contrast);
55
- --color-success: var(--color-light-success);
56
- --color-success-soft: var(--color-light-success-soft);
57
- --color-success-base: var(--color-light-success-base);
58
- --color-success-hover: var(--color-light-success-hover);
59
- --color-success-active: var(--color-light-success-active);
60
- --color-success-muted: var(--color-light-success-muted);
61
- --color-success-contrast: var(--color-light-success-contrast);
62
- --color-warning: var(--color-light-warning);
63
- --color-warning-soft: var(--color-light-warning-soft);
64
- --color-warning-base: var(--color-light-warning-base);
65
- --color-warning-hover: var(--color-light-warning-hover);
66
- --color-warning-active: var(--color-light-warning-active);
67
- --color-warning-muted: var(--color-light-warning-muted);
68
- --color-warning-contrast: var(--color-light-warning-contrast);
69
- --color-danger: var(--color-light-danger);
70
- --color-danger-soft: var(--color-light-danger-soft);
71
- --color-danger-base: var(--color-light-danger-base);
72
- --color-danger-hover: var(--color-light-danger-hover);
73
- --color-danger-active: var(--color-light-danger-active);
74
- --color-danger-muted: var(--color-light-danger-muted);
75
- --color-danger-contrast: var(--color-light-danger-contrast);
76
- --color-info: var(--color-light-info);
77
- --color-info-soft: var(--color-light-info-soft);
78
- --color-info-base: var(--color-light-info-base);
79
- --color-info-hover: var(--color-light-info-hover);
80
- --color-info-active: var(--color-light-info-active);
81
- --color-info-muted: var(--color-light-info-muted);
82
- --color-info-contrast: var(--color-light-info-contrast);
83
- --color-border: var(--color-light-border);
40
+ --hover-mix: var(--color-foreground);
84
41
  --color-background: var(--color-light-background);
42
+ --color-background-soft: var(--color-light-background-soft);
43
+ --color-background-saturated: var(--color-light-background-saturated);
44
+ --color-background-contrast: var(--color-light-background-contrast);
85
45
  --color-foreground: var(--color-light-foreground);
46
+ --color-foreground-soft: var(--color-light-foreground-soft);
47
+ --color-foreground-saturated: var(--color-light-foreground-saturated);
48
+ --color-foreground-contrast: var(--color-light-foreground-contrast);
86
49
  }
87
50
 
88
51
  :global(*) {
@@ -100,101 +63,29 @@
100
63
 
101
64
  :global(:root[data-theme='dark']) {
102
65
  color-scheme: dark;
103
- --color-primary: var(--color-dark-primary);
104
- --color-primary-soft: var(--color-dark-primary-soft);
105
- --color-primary-base: var(--color-dark-primary-base);
106
- --color-primary-hover: var(--color-dark-primary-hover);
107
- --color-primary-active: var(--color-dark-primary-active);
108
- --color-primary-muted: var(--color-dark-primary-muted);
109
- --color-primary-contrast: var(--color-dark-primary-contrast);
110
- --color-secondary: var(--color-dark-secondary);
111
- --color-secondary-soft: var(--color-dark-secondary-soft);
112
- --color-secondary-base: var(--color-dark-secondary-base);
113
- --color-secondary-hover: var(--color-dark-secondary-hover);
114
- --color-secondary-active: var(--color-dark-secondary-active);
115
- --color-secondary-muted: var(--color-dark-secondary-muted);
116
- --color-secondary-contrast: var(--color-dark-secondary-contrast);
117
- --color-success: var(--color-dark-success);
118
- --color-success-soft: var(--color-dark-success-soft);
119
- --color-success-base: var(--color-dark-success-base);
120
- --color-success-hover: var(--color-dark-success-hover);
121
- --color-success-active: var(--color-dark-success-active);
122
- --color-success-muted: var(--color-dark-success-muted);
123
- --color-success-contrast: var(--color-dark-success-contrast);
124
- --color-warning: var(--color-dark-warning);
125
- --color-warning-soft: var(--color-dark-warning-soft);
126
- --color-warning-base: var(--color-dark-warning-base);
127
- --color-warning-hover: var(--color-dark-warning-hover);
128
- --color-warning-active: var(--color-dark-warning-active);
129
- --color-warning-muted: var(--color-dark-warning-muted);
130
- --color-warning-contrast: var(--color-dark-warning-contrast);
131
- --color-danger: var(--color-dark-danger);
132
- --color-danger-soft: var(--color-dark-danger-soft);
133
- --color-danger-base: var(--color-dark-danger-base);
134
- --color-danger-hover: var(--color-dark-danger-hover);
135
- --color-danger-active: var(--color-dark-danger-active);
136
- --color-danger-muted: var(--color-dark-danger-muted);
137
- --color-danger-contrast: var(--color-dark-danger-contrast);
138
- --color-info: var(--color-dark-info);
139
- --color-info-soft: var(--color-dark-info-soft);
140
- --color-info-base: var(--color-dark-info-base);
141
- --color-info-hover: var(--color-dark-info-hover);
142
- --color-info-active: var(--color-dark-info-active);
143
- --color-info-muted: var(--color-dark-info-muted);
144
- --color-info-contrast: var(--color-dark-info-contrast);
145
- --color-border: var(--color-dark-border);
66
+ --hover-mix: var(--color-foreground);
146
67
  --color-background: var(--color-dark-background);
68
+ --color-background-soft: var(--color-dark-background-soft);
69
+ --color-background-saturated: var(--color-dark-background-saturated);
70
+ --color-background-contrast: var(--color-dark-background-contrast);
147
71
  --color-foreground: var(--color-dark-foreground);
72
+ --color-foreground-soft: var(--color-dark-foreground-soft);
73
+ --color-foreground-saturated: var(--color-dark-foreground-saturated);
74
+ --color-foreground-contrast: var(--color-dark-foreground-contrast);
148
75
  }
149
76
 
150
77
  @media (prefers-color-scheme: dark) {
151
78
  :global(:root:not([data-theme='light'])) {
152
79
  color-scheme: dark;
153
- --color-primary: var(--color-dark-primary);
154
- --color-primary-soft: var(--color-dark-primary-soft);
155
- --color-primary-base: var(--color-dark-primary-base);
156
- --color-primary-hover: var(--color-dark-primary-hover);
157
- --color-primary-active: var(--color-dark-primary-active);
158
- --color-primary-muted: var(--color-dark-primary-muted);
159
- --color-primary-contrast: var(--color-dark-primary-contrast);
160
- --color-secondary: var(--color-dark-secondary);
161
- --color-secondary-soft: var(--color-dark-secondary-soft);
162
- --color-secondary-base: var(--color-dark-secondary-base);
163
- --color-secondary-hover: var(--color-dark-secondary-hover);
164
- --color-secondary-active: var(--color-dark-secondary-active);
165
- --color-secondary-muted: var(--color-dark-secondary-muted);
166
- --color-secondary-contrast: var(--color-dark-secondary-contrast);
167
- --color-success: var(--color-dark-success);
168
- --color-success-soft: var(--color-dark-success-soft);
169
- --color-success-base: var(--color-dark-success-base);
170
- --color-success-hover: var(--color-dark-success-hover);
171
- --color-success-active: var(--color-dark-success-active);
172
- --color-success-muted: var(--color-dark-success-muted);
173
- --color-success-contrast: var(--color-dark-success-contrast);
174
- --color-warning: var(--color-dark-warning);
175
- --color-warning-soft: var(--color-dark-warning-soft);
176
- --color-warning-base: var(--color-dark-warning-base);
177
- --color-warning-hover: var(--color-dark-warning-hover);
178
- --color-warning-active: var(--color-dark-warning-active);
179
- --color-warning-muted: var(--color-dark-warning-muted);
180
- --color-warning-contrast: var(--color-dark-warning-contrast);
181
- --color-danger: var(--color-dark-danger);
182
- --color-danger-soft: var(--color-dark-danger-soft);
183
- --color-danger-base: var(--color-dark-danger-base);
184
- --color-danger-hover: var(--color-dark-danger-hover);
185
- --color-danger-active: var(--color-dark-danger-active);
186
- --color-danger-muted: var(--color-dark-danger-muted);
187
- --color-danger-contrast: var(--color-dark-danger-contrast);
188
- --color-info: var(--color-dark-info);
189
- --color-info-soft: var(--color-dark-info-soft);
190
- --color-info-base: var(--color-dark-info-base);
191
- --color-info-hover: var(--color-dark-info-hover);
192
- --color-info-active: var(--color-dark-info-active);
193
- --color-info-muted: var(--color-dark-info-muted);
194
- --color-info-contrast: var(--color-dark-info-contrast);
195
- --color-border: var(--color-dark-border);
80
+ --hover-mix: var(--color-foreground);
196
81
  --color-background: var(--color-dark-background);
82
+ --color-background-soft: var(--color-dark-background-soft);
83
+ --color-background-saturated: var(--color-dark-background-saturated);
84
+ --color-background-contrast: var(--color-dark-background-contrast);
197
85
  --color-foreground: var(--color-dark-foreground);
86
+ --color-foreground-soft: var(--color-dark-foreground-soft);
87
+ --color-foreground-saturated: var(--color-dark-foreground-saturated);
88
+ --color-foreground-contrast: var(--color-dark-foreground-contrast);
198
89
  }
199
90
  }
200
91
  </style>
@@ -21,10 +21,7 @@ export interface ThemeProps {
21
21
  }
22
22
  export interface ColorTokenProps {
23
23
  soft: string;
24
- base: string;
25
- hover: string;
26
- active: string;
27
- muted: string;
24
+ saturated: string;
28
25
  contrast: string;
29
26
  }
30
27
  export declare const DEFAULT_THEME: ThemeProps;
@@ -0,0 +1,80 @@
1
+ <script lang="ts">
2
+ import Button from '../base/button/button.svelte';
3
+ import DemoSection from './demo-section.svelte';
4
+ import DemoCodeSnippet from './demo-code-snippet.svelte';
5
+ </script>
6
+
7
+ <DemoSection
8
+ title="Buttons"
9
+ id="buttons"
10
+ description="Buttons with customizable size, color, variant, and optional icons."
11
+ >
12
+ <h3>Variants</h3>
13
+ <div>
14
+ <Button label="Filled" variant="filled" onClick={() => {}} />
15
+ <Button label="Soft" variant="soft" onClick={() => {}} />
16
+ <Button label="Ghost" variant="ghost" onClick={() => {}} />
17
+ </div>
18
+ <h3>Colors</h3>
19
+ <div>
20
+ <Button label="Primary" color="primary" onClick={() => {}} />
21
+ <Button label="Secondary" color="secondary" onClick={() => {}} />
22
+ <Button label="Success" color="success" onClick={() => {}} />
23
+ <Button label="Warning" color="warning" onClick={() => {}} />
24
+ <Button label="Danger" color="danger" onClick={() => {}} />
25
+ <Button label="Info" color="info" onClick={() => {}} />
26
+ </div>
27
+ <h3>Sizes</h3>
28
+ <div>
29
+ <Button label="X-Small" size="x-small" onClick={() => {}} />
30
+ <Button label="Small" size="small" onClick={() => {}} />
31
+ <Button label="Medium" size="medium" onClick={() => {}} />
32
+ <Button label="Large" size="large" onClick={() => {}} />
33
+ <Button label="X-Large" size="x-large" onClick={() => {}} />
34
+ </div>
35
+ <h3>With Icons</h3>
36
+ <div>
37
+ <Button label="Add" icon={{ name: 'add' }} onClick={() => {}} />
38
+ <Button label="Favorite" icon={{ name: 'favorite', filled: true }} color="danger" onClick={() => {}} />
39
+ <Button label="Settings" icon={{ name: 'settings' }} variant="soft" onClick={() => {}} />
40
+ <Button label="Delete" icon={{ name: 'delete' }} variant="ghost" color="danger" onClick={() => {}} />
41
+ </div>
42
+ <h3>Wide</h3>
43
+ <div class="wide-container">
44
+ <Button label="Full Width Button" wide onClick={() => {}} />
45
+ <Button label="Full Width Soft" wide variant="soft" color="secondary" onClick={() => {}} />
46
+ </div>
47
+ <h3>Disabled</h3>
48
+ <div>
49
+ <Button label="Disabled" disabled onClick={() => {}} />
50
+ <Button label="Disabled Soft" disabled variant="soft" onClick={() => {}} />
51
+ <Button label="Disabled Ghost" disabled variant="ghost" onClick={() => {}} />
52
+ </div>
53
+ <h3>Usage Example</h3>
54
+ <DemoCodeSnippet
55
+ snippet={`<Button
56
+ label="Submit"
57
+ icon={{ name: 'check', filled: true }}
58
+ color="success"
59
+ variant="filled"
60
+ size="large"
61
+ onClick={() => handleSubmit()}
62
+ />`}
63
+ />
64
+ </DemoSection>
65
+
66
+ <style>
67
+ div {
68
+ display: flex;
69
+ gap: 1rem;
70
+ align-items: center;
71
+ justify-content: center;
72
+ flex-wrap: wrap;
73
+ }
74
+
75
+ .wide-container {
76
+ flex-direction: column;
77
+ width: 100%;
78
+ max-width: 300px;
79
+ }
80
+ </style>
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const DemoButton: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, string>;
17
+ type DemoButton = InstanceType<typeof DemoButton>;
18
+ export default DemoButton;