basefn 1.4.0 → 1.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,4 +1,4 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import "../styles/variables.css";
|
|
2
2
|
|
|
3
3
|
.basefn-button {
|
|
4
4
|
display: inline-flex;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
height: var(--basefn-button-height);
|
|
12
12
|
padding: 0 var(--basefn-button-padding-x);
|
|
13
13
|
border: var(--basefn-border-width) solid transparent;
|
|
14
|
-
border-radius: var(--basefn-radius-
|
|
14
|
+
border-radius: var(--basefn-radius-xl);
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
transition: all var(--basefn-transition-fast);
|
|
17
17
|
outline: none;
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
background-color: transparent;
|
|
65
65
|
border-color: transparent;
|
|
66
66
|
border: 0;
|
|
67
|
-
padding: 0;
|
|
68
67
|
color: var(--basefn-text-tertiary);
|
|
69
68
|
}
|
|
70
69
|
|
|
@@ -21,12 +21,26 @@ let stringToTheme = (str: string) => {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// Apply theme to document
|
|
24
|
+
// Apply theme to document (disables transitions temporarily for instant switch)
|
|
25
25
|
let applyTheme = (theme: theme) => {
|
|
26
26
|
let themeValue = themeToString(theme)
|
|
27
27
|
|
|
28
28
|
(
|
|
29
|
-
%raw(`function(val) {
|
|
29
|
+
%raw(`function(val) {
|
|
30
|
+
// Disable all transitions
|
|
31
|
+
document.documentElement.classList.add('no-transitions');
|
|
32
|
+
|
|
33
|
+
// Apply theme
|
|
34
|
+
document.documentElement.setAttribute('data-theme', val);
|
|
35
|
+
|
|
36
|
+
// Force reflow to ensure styles are applied
|
|
37
|
+
document.documentElement.offsetHeight;
|
|
38
|
+
|
|
39
|
+
// Re-enable transitions after a frame
|
|
40
|
+
requestAnimationFrame(() => {
|
|
41
|
+
document.documentElement.classList.remove('no-transitions');
|
|
42
|
+
});
|
|
43
|
+
}`): string => unit
|
|
30
44
|
)(themeValue)
|
|
31
45
|
}
|
|
32
46
|
|
|
@@ -21,7 +21,21 @@ function stringToTheme(str) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function applyTheme(theme) {
|
|
24
|
-
((function(val) {
|
|
24
|
+
((function(val) {
|
|
25
|
+
// Disable all transitions
|
|
26
|
+
document.documentElement.classList.add('no-transitions');
|
|
27
|
+
|
|
28
|
+
// Apply theme
|
|
29
|
+
document.documentElement.setAttribute('data-theme', val);
|
|
30
|
+
|
|
31
|
+
// Force reflow to ensure styles are applied
|
|
32
|
+
document.documentElement.offsetHeight;
|
|
33
|
+
|
|
34
|
+
// Re-enable transitions after a frame
|
|
35
|
+
requestAnimationFrame(() => {
|
|
36
|
+
document.documentElement.classList.remove('no-transitions');
|
|
37
|
+
});
|
|
38
|
+
})(themeToString(theme)));
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
function saveThemePreference(theme) {
|
package/src/styles/variables.css
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
@import url(
|
|
2
|
-
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap");
|
|
3
2
|
|
|
4
3
|
:root {
|
|
5
4
|
/* Color Palette - Neutral Theme */
|
|
@@ -31,14 +30,18 @@
|
|
|
31
30
|
--font-mono: "Source Code", monospace;
|
|
32
31
|
|
|
33
32
|
/* Typography */
|
|
34
|
-
--basefn-font-family:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
--basefn-font-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
--basefn-font-size-
|
|
33
|
+
--basefn-font-family:
|
|
34
|
+
-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",
|
|
35
|
+
"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
36
|
+
--basefn-font-family-mono:
|
|
37
|
+
ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono",
|
|
38
|
+
monospace;
|
|
39
|
+
|
|
40
|
+
--basefn-font-size-xs: 0.75rem; /* 12px */
|
|
41
|
+
--basefn-font-size-sm: 0.875rem; /* 14px */
|
|
42
|
+
--basefn-font-size-base: 1rem; /* 16px */
|
|
43
|
+
--basefn-font-size-lg: 1.125rem; /* 18px */
|
|
44
|
+
--basefn-font-size-xl: 1.25rem; /* 20px */
|
|
42
45
|
|
|
43
46
|
--basefn-font-weight-normal: 400;
|
|
44
47
|
--basefn-font-weight-medium: 500;
|
|
@@ -50,18 +53,18 @@
|
|
|
50
53
|
--basefn-line-height-relaxed: 1.75;
|
|
51
54
|
|
|
52
55
|
/* Spacing */
|
|
53
|
-
--basefn-spacing-xs: 0.25rem;
|
|
54
|
-
--basefn-spacing-sm: 0.5rem;
|
|
55
|
-
--basefn-spacing-md: 0.75rem;
|
|
56
|
-
--basefn-spacing-lg: 1rem;
|
|
57
|
-
--basefn-spacing-xl: 1.5rem;
|
|
58
|
-
--basefn-spacing-2xl: 2rem;
|
|
56
|
+
--basefn-spacing-xs: 0.25rem; /* 4px */
|
|
57
|
+
--basefn-spacing-sm: 0.5rem; /* 8px */
|
|
58
|
+
--basefn-spacing-md: 0.75rem; /* 12px */
|
|
59
|
+
--basefn-spacing-lg: 1rem; /* 16px */
|
|
60
|
+
--basefn-spacing-xl: 1.5rem; /* 24px */
|
|
61
|
+
--basefn-spacing-2xl: 2rem; /* 32px */
|
|
59
62
|
|
|
60
63
|
/* Border Radius */
|
|
61
|
-
--basefn-radius-sm: 0.25rem;
|
|
62
|
-
--basefn-radius-md: 0.375rem;
|
|
63
|
-
--basefn-radius-lg: 0.5rem;
|
|
64
|
-
--basefn-radius-xl: 0.75rem;
|
|
64
|
+
--basefn-radius-sm: 0.25rem; /* 4px */
|
|
65
|
+
--basefn-radius-md: 0.375rem; /* 6px */
|
|
66
|
+
--basefn-radius-lg: 0.5rem; /* 8px */
|
|
67
|
+
--basefn-radius-xl: 0.75rem; /* 12px */
|
|
65
68
|
--basefn-radius-full: 9999px;
|
|
66
69
|
|
|
67
70
|
/* Border Width */
|
|
@@ -70,8 +73,10 @@
|
|
|
70
73
|
|
|
71
74
|
/* Shadows */
|
|
72
75
|
--basefn-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
73
|
-
--basefn-shadow-md:
|
|
74
|
-
|
|
76
|
+
--basefn-shadow-md:
|
|
77
|
+
0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
78
|
+
--basefn-shadow-lg:
|
|
79
|
+
0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
75
80
|
|
|
76
81
|
/* Focus Ring */
|
|
77
82
|
--basefn-focus-ring-color: rgba(59, 130, 246, 0.5);
|
|
@@ -84,12 +89,12 @@
|
|
|
84
89
|
--basefn-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
85
90
|
|
|
86
91
|
/* Form-specific Variables */
|
|
87
|
-
--basefn-form-input-height: 2.5rem;
|
|
88
|
-
--basefn-form-input-height-sm: 2rem;
|
|
89
|
-
--basefn-form-input-height-lg: 3rem;
|
|
92
|
+
--basefn-form-input-height: 2.5rem; /* 40px */
|
|
93
|
+
--basefn-form-input-height-sm: 2rem; /* 32px */
|
|
94
|
+
--basefn-form-input-height-lg: 3rem; /* 48px */
|
|
90
95
|
|
|
91
|
-
--basefn-form-input-padding-x: 0.75rem;
|
|
92
|
-
--basefn-form-input-padding-y: 0.5rem;
|
|
96
|
+
--basefn-form-input-padding-x: 0.75rem; /* 12px */
|
|
97
|
+
--basefn-form-input-padding-y: 0.5rem; /* 8px */
|
|
93
98
|
|
|
94
99
|
--basefn-form-input-bg: #ffffff;
|
|
95
100
|
--basefn-form-input-border: var(--basefn-color-neutral-300);
|
|
@@ -102,13 +107,13 @@
|
|
|
102
107
|
--basefn-form-input-disabled-text: var(--basefn-color-neutral-500);
|
|
103
108
|
|
|
104
109
|
/* Button Variables */
|
|
105
|
-
--basefn-button-height: 2.5rem;
|
|
106
|
-
--basefn-button-height-sm: 2rem;
|
|
107
|
-
--basefn-button-height-lg: 3rem;
|
|
110
|
+
--basefn-button-height: 2.5rem; /* 40px */
|
|
111
|
+
--basefn-button-height-sm: 2rem; /* 32px */
|
|
112
|
+
--basefn-button-height-lg: 3rem; /* 48px */
|
|
108
113
|
|
|
109
|
-
--basefn-button-padding-x:
|
|
110
|
-
--basefn-button-padding-x-sm: 0.75rem;
|
|
111
|
-
--basefn-button-padding-x-lg: 1.5rem;
|
|
114
|
+
--basefn-button-padding-x: 1.5rem; /* 16px */
|
|
115
|
+
--basefn-button-padding-x-sm: 0.75rem; /* 12px */
|
|
116
|
+
--basefn-button-padding-x-lg: 1.5rem; /* 24px */
|
|
112
117
|
|
|
113
118
|
/* Semantic Color Tokens - Light Theme */
|
|
114
119
|
/* Backgrounds */
|
|
@@ -117,7 +122,6 @@
|
|
|
117
122
|
--basefn-bg-tertiary: #f3f4f6;
|
|
118
123
|
--basefn-bg-primary-aa: #eff6ff;
|
|
119
124
|
|
|
120
|
-
|
|
121
125
|
/* Text colors */
|
|
122
126
|
--basefn-text-primary: #111827;
|
|
123
127
|
--basefn-text-secondary: #4b5563;
|
|
@@ -145,7 +149,11 @@
|
|
|
145
149
|
|
|
146
150
|
/* Dark Theme */
|
|
147
151
|
[data-theme="dark"] {
|
|
148
|
-
|
|
152
|
+
/* Secondary button - visible in dark mode */
|
|
153
|
+
--basefn-color-secondary: #475569;
|
|
154
|
+
--basefn-color-secondary-hover: #64748b;
|
|
155
|
+
--basefn-color-secondary-active: #334155;
|
|
156
|
+
|
|
149
157
|
/* Backgrounds - Slate palette */
|
|
150
158
|
--basefn-bg-primary: #0f172a;
|
|
151
159
|
--basefn-bg-secondary: #131c2f;
|
|
@@ -178,8 +186,10 @@
|
|
|
178
186
|
|
|
179
187
|
/* Shadows - darker for dark mode */
|
|
180
188
|
--basefn-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
|
|
181
|
-
--basefn-shadow-md:
|
|
182
|
-
|
|
189
|
+
--basefn-shadow-md:
|
|
190
|
+
0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
|
|
191
|
+
--basefn-shadow-lg:
|
|
192
|
+
0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
|
|
183
193
|
|
|
184
194
|
/* Alert semantic colors - Dark theme */
|
|
185
195
|
--basefn-alert-info-bg: #1e3a5f;
|
|
@@ -195,5 +205,14 @@
|
|
|
195
205
|
/* Base reset for form elements */
|
|
196
206
|
* {
|
|
197
207
|
box-sizing: border-box;
|
|
198
|
-
font-family:
|
|
208
|
+
font-family: "Source Sans", sans-serif;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/* Disable all transitions during theme switch */
|
|
212
|
+
.no-transitions,
|
|
213
|
+
.no-transitions *,
|
|
214
|
+
.no-transitions *::before,
|
|
215
|
+
.no-transitions *::after {
|
|
216
|
+
transition: none !important;
|
|
217
|
+
animation: none !important;
|
|
199
218
|
}
|