panelui-native 1.3.0 → 1.4.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/lib/module/components/calendar/index.js +15 -2
- package/lib/module/components/calendar/index.js.map +1 -1
- package/lib/module/components/checkbox/index.js +2 -1
- package/lib/module/components/checkbox/index.js.map +1 -1
- package/lib/module/components/combobox/index.js +5 -2
- package/lib/module/components/combobox/index.js.map +1 -1
- package/lib/module/components/questionnaire/index.js +1 -0
- package/lib/module/components/questionnaire/index.js.map +1 -1
- package/lib/module/components/radio-group/index.js +2 -1
- package/lib/module/components/radio-group/index.js.map +1 -1
- package/lib/module/components/search-bar/index.js +2 -1
- package/lib/module/components/search-bar/index.js.map +1 -1
- package/lib/module/components/section-progress/index.js +1 -1
- package/lib/module/components/section-progress/index.js.map +1 -1
- package/lib/module/components/section-rail/index.js +1 -1
- package/lib/module/components/section-rail/index.js.map +1 -1
- package/lib/module/components/select/index.js +5 -2
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/table/index.js +17 -3
- package/lib/module/components/table/index.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/theme/use-theme.js +55 -4
- package/lib/module/theme/use-theme.js.map +1 -1
- package/lib/typescript/src/components/calendar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/combobox/index.d.ts.map +1 -1
- package/lib/typescript/src/components/questionnaire/index.d.ts.map +1 -1
- package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/search-bar/index.d.ts +3 -0
- package/lib/typescript/src/components/search-bar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/table/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/use-theme.d.ts +32 -1
- package/lib/typescript/src/theme/use-theme.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/calendar/index.tsx +15 -3
- package/src/components/checkbox/index.tsx +1 -1
- package/src/components/combobox/index.tsx +4 -2
- package/src/components/questionnaire/index.tsx +1 -0
- package/src/components/radio-group/index.tsx +5 -1
- package/src/components/search-bar/index.tsx +1 -1
- package/src/components/section-progress/index.tsx +1 -1
- package/src/components/section-rail/index.tsx +1 -1
- package/src/components/select/index.tsx +4 -2
- package/src/components/table/index.tsx +17 -3
- package/src/index.ts +1 -0
- package/src/theme/use-theme.ts +57 -4
- package/theme.css +5 -5
|
@@ -35,6 +35,36 @@ export declare const PANEL_THEMES: readonly PanelThemeFamily[];
|
|
|
35
35
|
export declare const PANEL_THEME_NAMES: readonly PanelTheme[];
|
|
36
36
|
/** The names to pass as `extraThemes` in your metro config. */
|
|
37
37
|
export declare const PANEL_EXTRA_THEMES: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Applies a theme, and tells the operating system which side of light and dark
|
|
40
|
+
* it is on.
|
|
41
|
+
*
|
|
42
|
+
* Uniwind keeps the system appearance in step only for `light` and `dark`.
|
|
43
|
+
* Every other name resets it to the device's own setting, so `grass-dark` on a
|
|
44
|
+
* phone set to Light leaves everything the system draws — the native tab bar,
|
|
45
|
+
* alerts, action sheets, the keyboard — in light. The correction runs in the
|
|
46
|
+
* same tick as the theme change, so no frame is drawn with the two disagreeing.
|
|
47
|
+
*
|
|
48
|
+
* `system` is left alone: pinning the appearance there would stop the app
|
|
49
|
+
* hearing about the device changing.
|
|
50
|
+
*/
|
|
51
|
+
declare function applyTheme(name: ThemeName): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the theme from outside React — at module scope before the app mounts,
|
|
54
|
+
* from a deep link, or from a settings store.
|
|
55
|
+
*
|
|
56
|
+
* Use this rather than calling `Uniwind.setTheme` directly: it is the same
|
|
57
|
+
* change, plus the system appearance that a named theme needs to match.
|
|
58
|
+
* `useTheme` and `useThemeMode` go through it too.
|
|
59
|
+
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* // app/_layout.tsx, before the root component
|
|
62
|
+
* PanelUITheme.setTheme('grass-dark');
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const PanelUITheme: {
|
|
66
|
+
readonly setTheme: typeof applyTheme;
|
|
67
|
+
};
|
|
38
68
|
/**
|
|
39
69
|
* Reactive access to the current Uniwind theme plus a setter.
|
|
40
70
|
* Theme changes are applied natively by Uniwind without re-rendering the tree.
|
|
@@ -43,7 +73,7 @@ export declare function useTheme(): {
|
|
|
43
73
|
/** The active theme name, e.g. `'dark'` or `'moon-dark'`. */
|
|
44
74
|
theme: PanelTheme;
|
|
45
75
|
/** Switch theme by name, or `'system'` to follow the device. */
|
|
46
|
-
setTheme:
|
|
76
|
+
setTheme: typeof applyTheme;
|
|
47
77
|
};
|
|
48
78
|
/**
|
|
49
79
|
* Theme family and light/dark mode as two separate axes — what a picker like
|
|
@@ -69,4 +99,5 @@ export declare function useThemeMode(): {
|
|
|
69
99
|
/** Flip light ↔ dark within the current family. */
|
|
70
100
|
toggleMode: () => void;
|
|
71
101
|
};
|
|
102
|
+
export {};
|
|
72
103
|
//# sourceMappingURL=use-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/use-theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../../../src/theme/use-theme.ts"],"names":[],"mappings":"AAGA,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAClB,OAAO,GACP,MAAM,GACN,MAAM,GACN,WAAW,GACX,OAAO,GACP,YAAY,CAAC;AAEjB,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE9C,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC,6DAA6D;AAC7D,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,8DAA8D;IAC9D,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,gBAAgB,EAsBnD,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,iBAAiB,EAAE,SAAS,UAAU,EAElD,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAE/C,CAAC;AAsBF;;;;;;;;;;;;GAYG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAOzC;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY;;CAEf,CAAC;AAEX;;;GAGG;AACH,wBAAgB,QAAQ;IAIpB,6DAA6D;WAC7C,UAAU;IAC1B,gEAAgE;;EAGnE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY;IAMxB,+BAA+B;;IAE/B,gDAAgD;;IAEhD,4DAA4D;oBAC5C,MAAM;IAItB,mDAAmD;oBACnC,SAAS;IACzB,mDAAmD;;EAGtD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "High-performance React Native UI components for Expo. Semantic design tokens, powered by Uniwind (Tailwind v4) and Reanimated.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -151,6 +151,12 @@ const dayVariants = tv({
|
|
|
151
151
|
label: 'text-sm',
|
|
152
152
|
},
|
|
153
153
|
variants: {
|
|
154
|
+
/*
|
|
155
|
+
* A day on the range band is drawn on the accent fill, so its number takes
|
|
156
|
+
* the colour made for that fill. Listed first: an end of the range is also
|
|
157
|
+
* selected, and the variants below it override this one.
|
|
158
|
+
*/
|
|
159
|
+
inRange: { true: { label: 'text-accent-foreground' } },
|
|
154
160
|
selected: { true: { disc: 'bg-primary', label: 'text-primary-foreground' } },
|
|
155
161
|
today: { true: { disc: 'border border-primary', label: 'text-primary' } },
|
|
156
162
|
outside: { true: { label: 'text-muted-foreground/40' } },
|
|
@@ -773,9 +779,10 @@ function CaptionDropdown({
|
|
|
773
779
|
const list = useRef<ScrollViewRef>(null);
|
|
774
780
|
/*
|
|
775
781
|
* The check is given a colour rather than left to its own fallback, which is
|
|
776
|
-
* white — right inside a filled control, invisible on this panel.
|
|
782
|
+
* white — right inside a filled control, invisible on this panel. It is only
|
|
783
|
+
* drawn on the selected option, which sits on the accent fill.
|
|
777
784
|
*/
|
|
778
|
-
const rawTick = useCSSVariable('--color-foreground');
|
|
785
|
+
const rawTick = useCSSVariable('--color-accent-foreground');
|
|
779
786
|
const tick = typeof rawTick === 'string' ? rawTick : undefined;
|
|
780
787
|
|
|
781
788
|
/*
|
|
@@ -822,7 +829,11 @@ function CaptionDropdown({
|
|
|
822
829
|
selected ? 'bg-accent' : 'active:bg-accent'
|
|
823
830
|
)}
|
|
824
831
|
>
|
|
825
|
-
<Text
|
|
832
|
+
<Text
|
|
833
|
+
size="sm"
|
|
834
|
+
weight={selected ? 'semibold' : 'normal'}
|
|
835
|
+
className={selected ? 'text-accent-foreground' : undefined}
|
|
836
|
+
>
|
|
826
837
|
{option}
|
|
827
838
|
</Text>
|
|
828
839
|
{selected ? <CheckIcon size={16} color={tick} /> : null}
|
|
@@ -1031,6 +1042,7 @@ function CalendarDay({
|
|
|
1031
1042
|
onPress,
|
|
1032
1043
|
}: DayProps) {
|
|
1033
1044
|
const styles = dayVariants({
|
|
1045
|
+
inRange,
|
|
1034
1046
|
selected,
|
|
1035
1047
|
today: today && !selected,
|
|
1036
1048
|
outside,
|
|
@@ -131,7 +131,7 @@ const comboboxVariants = tv({
|
|
|
131
131
|
},
|
|
132
132
|
variants: {
|
|
133
133
|
selected: {
|
|
134
|
-
true: { item: 'bg-accent' },
|
|
134
|
+
true: { item: 'bg-accent', itemLabel: 'text-accent-foreground' },
|
|
135
135
|
},
|
|
136
136
|
disabled: {
|
|
137
137
|
true: { field: 'opacity-[0.64]' },
|
|
@@ -198,7 +198,9 @@ function ComboboxItem({
|
|
|
198
198
|
selected,
|
|
199
199
|
itemDisabled: !!disabled,
|
|
200
200
|
});
|
|
201
|
-
|
|
201
|
+
// Drawn only on a selected row, so on the accent fill: it takes the colour
|
|
202
|
+
// made to be read there.
|
|
203
|
+
const checkColor = useCSSVariable('--color-accent-foreground');
|
|
202
204
|
|
|
203
205
|
return (
|
|
204
206
|
<Pressable
|
|
@@ -218,6 +218,7 @@ const choiceVariants = tv({
|
|
|
218
218
|
selected: {
|
|
219
219
|
true: {
|
|
220
220
|
row: 'border-primary bg-accent',
|
|
221
|
+
label: 'text-accent-foreground',
|
|
221
222
|
// The badge follows the row rather than staying grey against a filled
|
|
222
223
|
// surface, where it would read as the one part that did not respond.
|
|
223
224
|
shortcut: 'border-primary/40 bg-primary/10',
|
|
@@ -118,7 +118,11 @@ const itemVariants = tv({
|
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
120
|
compoundVariants: [
|
|
121
|
-
{
|
|
121
|
+
{
|
|
122
|
+
variant: 'card',
|
|
123
|
+
selected: true,
|
|
124
|
+
class: { row: 'border-primary bg-accent', label: 'text-accent-foreground' },
|
|
125
|
+
},
|
|
122
126
|
// Share the row instead of filling it, keeping the disc on the trailing
|
|
123
127
|
// edge of each narrower card.
|
|
124
128
|
{ variant: 'card', horizontal: true, class: { row: 'w-auto flex-1' } },
|
|
@@ -363,7 +363,7 @@ const searchBarVariants = tv({
|
|
|
363
363
|
bottom: { field: 'rounded-b-none rounded-t-2xl border-0' },
|
|
364
364
|
},
|
|
365
365
|
selected: {
|
|
366
|
-
true: { item: 'bg-accent' },
|
|
366
|
+
true: { item: 'bg-accent', itemLabel: 'text-accent-foreground' },
|
|
367
367
|
},
|
|
368
368
|
},
|
|
369
369
|
defaultVariants: {
|
|
@@ -795,7 +795,7 @@ function SectionProgressItem({ className, value, children }: SectionProgressItem
|
|
|
795
795
|
<Text
|
|
796
796
|
size="sm"
|
|
797
797
|
weight={selected ? 'medium' : 'normal'}
|
|
798
|
-
className={selected ? 'text-foreground' : 'text-muted-foreground'}
|
|
798
|
+
className={selected ? 'text-accent-foreground' : 'text-muted-foreground'}
|
|
799
799
|
// Two lines rather than one: an ellipsis in a navigator hides the very
|
|
800
800
|
// word that says which section the row would jump to.
|
|
801
801
|
numberOfLines={2}
|
|
@@ -612,7 +612,7 @@ function SectionRailItem({ className, value, level = 0, children }: SectionRailI
|
|
|
612
612
|
<Text
|
|
613
613
|
size="sm"
|
|
614
614
|
weight={selected ? 'medium' : 'normal'}
|
|
615
|
-
className={selected ? 'text-foreground' : 'text-muted-foreground'}
|
|
615
|
+
className={selected ? 'text-accent-foreground' : 'text-muted-foreground'}
|
|
616
616
|
// Two lines rather than one: a long section title is worth wrapping,
|
|
617
617
|
// and an ellipsis in a navigator hides the very word that tells you
|
|
618
618
|
// which section you are about to jump to.
|
|
@@ -125,7 +125,7 @@ const selectVariants = tv({
|
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
127
|
selected: {
|
|
128
|
-
true: { item: 'bg-accent' },
|
|
128
|
+
true: { item: 'bg-accent', itemLabel: 'text-accent-foreground' },
|
|
129
129
|
},
|
|
130
130
|
disabled: {
|
|
131
131
|
true: { trigger: 'opacity-[0.64]' },
|
|
@@ -227,7 +227,9 @@ function SelectItem({ value, label, disabled, className, labelClassName }: Selec
|
|
|
227
227
|
selected,
|
|
228
228
|
itemDisabled: !!disabled,
|
|
229
229
|
});
|
|
230
|
-
|
|
230
|
+
// Drawn only on a selected row, so on the accent fill: it takes the colour
|
|
231
|
+
// made to be read there.
|
|
232
|
+
const checkColor = useCSSVariable('--color-accent-foreground');
|
|
231
233
|
|
|
232
234
|
return (
|
|
233
235
|
<Pressable
|
|
@@ -227,6 +227,13 @@ const TableRowContext = createContext<{
|
|
|
227
227
|
last: false,
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Whether the row a cell is in is selected. A selected row is drawn on the
|
|
232
|
+
* accent fill, so the text in its cells has to switch to the colour made to be
|
|
233
|
+
* read on that fill rather than keep the table's own.
|
|
234
|
+
*/
|
|
235
|
+
const TableRowSelectedContext = createContext(false);
|
|
236
|
+
|
|
230
237
|
export interface TableProps extends ViewProps, VariantProps<typeof tableVariants> {
|
|
231
238
|
className?: string;
|
|
232
239
|
/**
|
|
@@ -420,7 +427,7 @@ const TableRow = forwardRef<ViewRef, TableRowProps>(
|
|
|
420
427
|
accessibilityState={{ disabled: !!disabled, selected: !!selected }}
|
|
421
428
|
className={classes}
|
|
422
429
|
>
|
|
423
|
-
{cells}
|
|
430
|
+
<TableRowSelectedContext.Provider value={!!selected}>{cells}</TableRowSelectedContext.Provider>
|
|
424
431
|
</View>
|
|
425
432
|
);
|
|
426
433
|
}
|
|
@@ -437,7 +444,7 @@ const TableRow = forwardRef<ViewRef, TableRowProps>(
|
|
|
437
444
|
onPress={onPress}
|
|
438
445
|
className={classes}
|
|
439
446
|
>
|
|
440
|
-
{cells}
|
|
447
|
+
<TableRowSelectedContext.Provider value={!!selected}>{cells}</TableRowSelectedContext.Provider>
|
|
441
448
|
</AnimatedPressable>
|
|
442
449
|
);
|
|
443
450
|
}
|
|
@@ -668,6 +675,7 @@ const TableCell = forwardRef<ViewRef, TableCellProps>(
|
|
|
668
675
|
width: ownWidth,
|
|
669
676
|
align: ownAlign,
|
|
670
677
|
});
|
|
678
|
+
const rowSelected = useContext(TableRowSelectedContext);
|
|
671
679
|
const { cell, cellLabel } = tableVariants({ size });
|
|
672
680
|
|
|
673
681
|
return (
|
|
@@ -679,7 +687,13 @@ const TableCell = forwardRef<ViewRef, TableCellProps>(
|
|
|
679
687
|
{...props}
|
|
680
688
|
>
|
|
681
689
|
{textChildren(children, (text) => (
|
|
682
|
-
<Text
|
|
690
|
+
<Text
|
|
691
|
+
className={cellLabel({
|
|
692
|
+
className: cn(rowSelected && 'text-accent-foreground', labelClassName),
|
|
693
|
+
})}
|
|
694
|
+
>
|
|
695
|
+
{text}
|
|
696
|
+
</Text>
|
|
683
697
|
))}
|
|
684
698
|
</View>
|
|
685
699
|
);
|
package/src/index.ts
CHANGED
package/src/theme/use-theme.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Appearance, Platform } from 'react-native';
|
|
1
2
|
import { Uniwind, useUniwind } from 'uniwind';
|
|
2
3
|
|
|
3
4
|
/** Themes shipped in `panelui-native/theme.css`. */
|
|
@@ -83,6 +84,58 @@ function findFamily(theme: string): PanelThemeFamily {
|
|
|
83
84
|
);
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
/**
|
|
88
|
+
* The light/dark side of a theme PanelUI knows, or `undefined` for one it does
|
|
89
|
+
* not. A theme registered by the app itself has no mode PanelUI can know, and
|
|
90
|
+
* guessing it from the name would pin the system to the wrong one.
|
|
91
|
+
*/
|
|
92
|
+
function modeOf(theme: string): ThemeMode | undefined {
|
|
93
|
+
const family = PANEL_THEMES.find(
|
|
94
|
+
(candidate) => candidate.light === theme || candidate.dark === theme
|
|
95
|
+
);
|
|
96
|
+
if (!family) return undefined;
|
|
97
|
+
return family.dark === theme ? 'dark' : 'light';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Applies a theme, and tells the operating system which side of light and dark
|
|
102
|
+
* it is on.
|
|
103
|
+
*
|
|
104
|
+
* Uniwind keeps the system appearance in step only for `light` and `dark`.
|
|
105
|
+
* Every other name resets it to the device's own setting, so `grass-dark` on a
|
|
106
|
+
* phone set to Light leaves everything the system draws — the native tab bar,
|
|
107
|
+
* alerts, action sheets, the keyboard — in light. The correction runs in the
|
|
108
|
+
* same tick as the theme change, so no frame is drawn with the two disagreeing.
|
|
109
|
+
*
|
|
110
|
+
* `system` is left alone: pinning the appearance there would stop the app
|
|
111
|
+
* hearing about the device changing.
|
|
112
|
+
*/
|
|
113
|
+
function applyTheme(name: ThemeName): void {
|
|
114
|
+
Uniwind.setTheme(name);
|
|
115
|
+
if (Platform.OS === 'web' || name === 'system' || name === 'light' || name === 'dark') {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const mode = modeOf(name);
|
|
119
|
+
if (mode) Appearance.setColorScheme(mode);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Sets the theme from outside React — at module scope before the app mounts,
|
|
124
|
+
* from a deep link, or from a settings store.
|
|
125
|
+
*
|
|
126
|
+
* Use this rather than calling `Uniwind.setTheme` directly: it is the same
|
|
127
|
+
* change, plus the system appearance that a named theme needs to match.
|
|
128
|
+
* `useTheme` and `useThemeMode` go through it too.
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* // app/_layout.tsx, before the root component
|
|
132
|
+
* PanelUITheme.setTheme('grass-dark');
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
export const PanelUITheme = {
|
|
136
|
+
setTheme: applyTheme,
|
|
137
|
+
} as const;
|
|
138
|
+
|
|
86
139
|
/**
|
|
87
140
|
* Reactive access to the current Uniwind theme plus a setter.
|
|
88
141
|
* Theme changes are applied natively by Uniwind without re-rendering the tree.
|
|
@@ -94,7 +147,7 @@ export function useTheme() {
|
|
|
94
147
|
/** The active theme name, e.g. `'dark'` or `'moon-dark'`. */
|
|
95
148
|
theme: theme as PanelTheme,
|
|
96
149
|
/** Switch theme by name, or `'system'` to follow the device. */
|
|
97
|
-
setTheme:
|
|
150
|
+
setTheme: applyTheme,
|
|
98
151
|
};
|
|
99
152
|
}
|
|
100
153
|
|
|
@@ -123,11 +176,11 @@ export function useThemeMode() {
|
|
|
123
176
|
/** Switch brand, staying in the current light/dark mode. */
|
|
124
177
|
setFamily: (id: string) => {
|
|
125
178
|
const next = PANEL_THEMES.find((candidate) => candidate.id === id);
|
|
126
|
-
if (next)
|
|
179
|
+
if (next) applyTheme(next[mode]);
|
|
127
180
|
},
|
|
128
181
|
/** Set the mode, staying in the current family. */
|
|
129
|
-
setMode: (next: ThemeMode) =>
|
|
182
|
+
setMode: (next: ThemeMode) => applyTheme(family[next]),
|
|
130
183
|
/** Flip light ↔ dark within the current family. */
|
|
131
|
-
toggleMode: () =>
|
|
184
|
+
toggleMode: () => applyTheme(mode === 'dark' ? family.light : family.dark),
|
|
132
185
|
};
|
|
133
186
|
}
|
package/theme.css
CHANGED
|
@@ -453,8 +453,8 @@
|
|
|
453
453
|
--color-muted: rgba(0, 0, 0, 0.05);
|
|
454
454
|
--color-muted-foreground: #6b6f76;
|
|
455
455
|
|
|
456
|
-
--color-accent: rgba(
|
|
457
|
-
--color-accent-foreground: #
|
|
456
|
+
--color-accent: rgba(94, 106, 210, 0.1);
|
|
457
|
+
--color-accent-foreground: #3d47a8;
|
|
458
458
|
|
|
459
459
|
--color-destructive: #eb5757;
|
|
460
460
|
--color-destructive-foreground: #c62b30;
|
|
@@ -536,14 +536,14 @@
|
|
|
536
536
|
--color-primary: #5e6ad2;
|
|
537
537
|
--color-primary-foreground: #ffffff;
|
|
538
538
|
|
|
539
|
-
--color-secondary: rgba(255, 255, 255, 0.
|
|
539
|
+
--color-secondary: rgba(255, 255, 255, 0.08);
|
|
540
540
|
--color-secondary-foreground: #f7f8f8;
|
|
541
541
|
|
|
542
542
|
--color-muted: rgba(255, 255, 255, 0.06);
|
|
543
543
|
--color-muted-foreground: #8a8f98;
|
|
544
544
|
|
|
545
|
-
--color-accent: rgba(
|
|
546
|
-
--color-accent-foreground: #
|
|
545
|
+
--color-accent: rgba(94, 106, 210, 0.18);
|
|
546
|
+
--color-accent-foreground: #b4baf5;
|
|
547
547
|
|
|
548
548
|
--color-destructive: #eb5757;
|
|
549
549
|
--color-destructive-foreground: #ff8a8a;
|