@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.
- package/CHANGELOG.md +2 -3
- package/THEME_OVERRIDE.md +52 -0
- package/lib/index.js +134 -4
- package/locales/en_AU.js +10 -0
- package/locales/en_AU.mjs +8 -0
- package/locales/en_CA.js +10 -0
- package/locales/en_CA.mjs +8 -0
- package/locales/index.js +11 -0
- package/locales/index.mjs +9 -0
- package/locales/types.js +2 -0
- package/locales/types.mjs +1 -0
- package/package.json +5 -4
- package/rollup.config.mjs +18 -2
- package/src/__tests__/__snapshots__/index.spec.tsx.snap +1 -1
- package/src/__tests__/index.spec.tsx +15 -0
- package/src/__tests__/theme-export-override.spec.ts +90 -0
- package/src/index.ts +13 -1
- package/src/theme/ThemeProvider.ts +20 -0
- package/src/theme/ThemeSwitcher.tsx +76 -0
- package/src/theme/__tests__/ThemeProvider.spec.tsx +32 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1844 -0
- package/src/theme/__tests__/index.spec.ts +7 -0
- package/src/theme/components/textInput.ts +59 -0
- package/src/theme/getTheme.ts +32 -0
- package/src/theme/index.ts +17 -0
- package/stats/1.1.0/rn-work-uikit-stats.html +4842 -0
|
@@ -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;
|