@hero-design/rn-work-uikit 1.1.0-alpha.0 → 1.1.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.
@@ -0,0 +1,7 @@
1
+ import theme from '..';
2
+
3
+ describe('theme', () => {
4
+ it('returns correct theme object', () => {
5
+ expect(theme).toMatchSnapshot();
6
+ });
7
+ });
@@ -0,0 +1,59 @@
1
+ import type { Theme } from '@hero-design/rn';
2
+
3
+ const getTextInputTheme = (theme: Theme) => {
4
+ const baseTextInputTheme = theme.__hd__.textInput;
5
+
6
+ // Override specific values here as needed
7
+ const colors = {
8
+ ...baseTextInputTheme.colors,
9
+ // Example: override specific colors
10
+ // text: theme.colors.customTextColor,
11
+ };
12
+
13
+ const space = {
14
+ ...baseTextInputTheme.space,
15
+ // Example: override specific spacing
16
+ // containerPadding: theme.space.large,
17
+ };
18
+
19
+ const fonts = {
20
+ ...baseTextInputTheme.fonts,
21
+ // Example: override fonts
22
+ // text: theme.fonts.custom.bold,
23
+ };
24
+
25
+ const fontSizes = {
26
+ ...baseTextInputTheme.fontSizes,
27
+ // Example: override font sizes
28
+ // text: theme.fontSizes.xlarge,
29
+ };
30
+
31
+ const borderWidths = {
32
+ ...baseTextInputTheme.borderWidths,
33
+ };
34
+
35
+ const radii = {
36
+ ...baseTextInputTheme.radii,
37
+ };
38
+
39
+ const sizes = {
40
+ ...baseTextInputTheme.sizes,
41
+ };
42
+
43
+ const lineHeights = {
44
+ ...baseTextInputTheme.lineHeights,
45
+ };
46
+
47
+ return {
48
+ colors,
49
+ space,
50
+ fonts,
51
+ fontSizes,
52
+ borderWidths,
53
+ radii,
54
+ sizes,
55
+ lineHeights,
56
+ };
57
+ };
58
+
59
+ export default getTextInputTheme;
@@ -0,0 +1,32 @@
1
+ import {
2
+ getTheme as getBaseTheme,
3
+ Theme as BaseTheme,
4
+ swagSystemPalette,
5
+ } from '@hero-design/rn';
6
+ import type { Scale, SystemPalette } from '@hero-design/rn';
7
+ import getTextInputTheme from './components/textInput';
8
+
9
+ // Work-specific theme type that includes textInput overrides
10
+ type Theme = BaseTheme & {
11
+ __hd__: BaseTheme['__hd__'] & {
12
+ textInput: ReturnType<typeof getTextInputTheme>;
13
+ };
14
+ };
15
+
16
+ const getTheme = (
17
+ scale?: Scale,
18
+ systemPalette: SystemPalette = swagSystemPalette
19
+ ): Theme => {
20
+ const baseTheme = getBaseTheme(scale, systemPalette);
21
+
22
+ return {
23
+ ...baseTheme,
24
+ __hd__: {
25
+ ...baseTheme.__hd__,
26
+ textInput: getTextInputTheme(baseTheme),
27
+ },
28
+ };
29
+ };
30
+
31
+ export default getTheme;
32
+ export type { Theme };
@@ -0,0 +1,17 @@
1
+ import getTheme from './getTheme';
2
+ import type { Theme } from './getTheme';
3
+ import { WorkThemeProvider, useWorkTheme } from './ThemeProvider';
4
+ import WorkThemeSwitcher, { withWorkTheme } from './ThemeSwitcher';
5
+
6
+ const defaultTheme = getTheme();
7
+
8
+ // Export with generic names to hide "Work" terminology from external consumers
9
+ export type { Theme };
10
+ export {
11
+ getTheme,
12
+ WorkThemeProvider as ThemeProvider,
13
+ WorkThemeSwitcher as ThemeSwitcher,
14
+ useWorkTheme as useTheme,
15
+ withWorkTheme as withTheme,
16
+ };
17
+ export default defaultTheme;