@docsplain-kit/utilities 0.0.34 → 0.0.36
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/auto-complete/auto-complete.js +2 -1
- package/auto-complete/auto-complete.js.map +1 -1
- package/calendar/calendar.js +3 -1
- package/calendar/calendar.js.map +1 -1
- package/calendar/sub-components/day/day.js +6 -1
- package/calendar/sub-components/day/day.js.map +1 -1
- package/calendar/sub-components/days/days.js +2 -1
- package/calendar/sub-components/days/days.js.map +1 -1
- package/calendar/sub-components/days-head/days-head.js +4 -2
- package/calendar/sub-components/days-head/days-head.js.map +1 -1
- package/countdown-timer/countdown.js +4 -2
- package/countdown-timer/countdown.js.map +1 -1
- package/data-table/data-table.js +7 -9
- package/data-table/data-table.js.map +1 -1
- package/date-time-picker/date-time-picker.js +2 -1
- package/date-time-picker/date-time-picker.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +12 -1
- package/index.js.map +1 -1
- package/kanban-list/kanban-list.js +3 -2
- package/kanban-list/kanban-list.js.map +1 -1
- package/package.json +2 -2
- package/right-click-menu/menu-item/menu-item.js +2 -1
- package/right-click-menu/menu-item/menu-item.js.map +1 -1
- package/right-click-menu/right-click-menu.js +2 -1
- package/right-click-menu/right-click-menu.js.map +1 -1
- package/simple-data-table/simple-data-table.js +7 -6
- package/simple-data-table/simple-data-table.js.map +1 -1
- package/theme/ThemeProvider.d.ts +30 -0
- package/theme/ThemeProvider.js +49 -0
- package/theme/ThemeProvider.js.map +1 -0
- package/theme/context.d.ts +2 -0
- package/theme/context.js +6 -0
- package/theme/context.js.map +1 -0
- package/theme/index.d.ts +3 -0
- package/theme/index.js +27 -0
- package/theme/index.js.map +1 -0
- package/theme/theme-utils.d.ts +59 -0
- package/theme/theme-utils.js +82 -0
- package/theme/theme-utils.js.map +1 -0
- package/theme/types.d.ts +7 -0
- package/theme/types.js +3 -0
- package/theme/types.js.map +1 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.createColorGetter = exports.createThemeSelector = exports.DARK_BORDERS = exports.DARK_TEXT = exports.DARK_BACKGROUNDS = exports.isDarkTheme = exports.themeClass = exports.useThemeSafe = void 0;
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var context_1 = require("./context");
|
|
6
|
+
/**
|
|
7
|
+
* Theme Utility Functions
|
|
8
|
+
*
|
|
9
|
+
* Self-contained theme helpers for utilities components (no dependency on core).
|
|
10
|
+
* Use UtilitiesThemeProvider at the app root with the same theme as your UI kit.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Helper to safely get theme from UtilitiesThemeProvider.
|
|
14
|
+
* Returns 'light' if not in provider context.
|
|
15
|
+
*/
|
|
16
|
+
var useThemeSafe = function () {
|
|
17
|
+
var theme = (0, react_1.useContext)(context_1.ThemeContext);
|
|
18
|
+
return theme !== null && theme !== void 0 ? theme : 'light';
|
|
19
|
+
};
|
|
20
|
+
exports.useThemeSafe = useThemeSafe;
|
|
21
|
+
/**
|
|
22
|
+
* Get theme-aware class conditionally (hook).
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* themeClass('bg-white', 'bg-control-800')
|
|
26
|
+
* // Returns 'bg-white' in light, 'bg-control-800' in dark
|
|
27
|
+
*/
|
|
28
|
+
var themeClass = function (lightClass, darkClass) {
|
|
29
|
+
var theme = (0, exports.useThemeSafe)();
|
|
30
|
+
return theme === 'dark' ? darkClass : lightClass;
|
|
31
|
+
};
|
|
32
|
+
exports.themeClass = themeClass;
|
|
33
|
+
/**
|
|
34
|
+
* Quick check if currently in dark theme
|
|
35
|
+
*/
|
|
36
|
+
var isDarkTheme = function () { return (0, exports.useThemeSafe)() === 'dark'; };
|
|
37
|
+
exports.isDarkTheme = isDarkTheme;
|
|
38
|
+
/**
|
|
39
|
+
* Common background colors for dark mode
|
|
40
|
+
*/
|
|
41
|
+
exports.DARK_BACKGROUNDS = {
|
|
42
|
+
page: 'bg-control-900',
|
|
43
|
+
card: 'bg-control-800',
|
|
44
|
+
elevated: 'bg-control-700',
|
|
45
|
+
overlay: 'bg-black/50',
|
|
46
|
+
subtle: 'bg-control-800/50'
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Common text colors for dark mode
|
|
50
|
+
*/
|
|
51
|
+
exports.DARK_TEXT = {
|
|
52
|
+
primary: 'text-control-100',
|
|
53
|
+
secondary: 'text-control-400',
|
|
54
|
+
muted: 'text-control-500',
|
|
55
|
+
disabled: 'text-control-600'
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Common border colors for dark mode
|
|
59
|
+
*/
|
|
60
|
+
exports.DARK_BORDERS = {
|
|
61
|
+
"default": 'border-control-700',
|
|
62
|
+
subtle: 'border-control-800',
|
|
63
|
+
strong: 'border-control-600'
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Creates a theme selector function for component styles
|
|
67
|
+
*/
|
|
68
|
+
function createThemeSelector(lightStyles, darkStyles) {
|
|
69
|
+
return function (theme) { return (theme === 'dark' ? darkStyles : lightStyles); };
|
|
70
|
+
}
|
|
71
|
+
exports.createThemeSelector = createThemeSelector;
|
|
72
|
+
/**
|
|
73
|
+
* Merges light and dark color objects into a theme-aware getter
|
|
74
|
+
*/
|
|
75
|
+
function createColorGetter(lightColors, darkColors) {
|
|
76
|
+
return function (theme, key) {
|
|
77
|
+
var colors = theme === 'dark' ? darkColors : lightColors;
|
|
78
|
+
return colors[key];
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.createColorGetter = createColorGetter;
|
|
82
|
+
//# sourceMappingURL=theme-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-utils.js","sourceRoot":"","sources":["../../theme/theme-utils.ts"],"names":[],"mappings":";;;AAAA,+BAAmC;AACnC,qCAAyC;AAGzC;;;;;GAKG;AAEH;;;GAGG;AACI,IAAM,YAAY,GA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