@entropix/react-native 0.2.0 → 1.0.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/dist/index.cjs CHANGED
@@ -11,21 +11,40 @@ var core = require('@entropix/core');
11
11
  // src/theme/theme-context.tsx
12
12
  var ThemeContext = react.createContext({
13
13
  mode: "light",
14
+ brand: "default",
14
15
  tokens: light.tokens,
15
16
  baseTokens: native.tokens
16
17
  });
18
+ var brandRegistry = {
19
+ default: {
20
+ light: light.tokens,
21
+ dark: dark.tokens
22
+ }
23
+ };
24
+ function registerBrand(name, themes) {
25
+ brandRegistry[name] = themes;
26
+ }
17
27
  function EntropixProvider({
18
28
  mode = "light",
29
+ brand = "default",
30
+ tokens: tokenOverride,
19
31
  children
20
32
  }) {
21
- const value = react.useMemo(
22
- () => ({
33
+ const value = react.useMemo(() => {
34
+ let resolvedTokens;
35
+ if (tokenOverride) {
36
+ resolvedTokens = tokenOverride;
37
+ } else {
38
+ const brandThemes = brandRegistry[brand] ?? brandRegistry.default;
39
+ resolvedTokens = brandThemes[mode] ?? brandThemes.light;
40
+ }
41
+ return {
23
42
  mode,
24
- tokens: mode === "dark" ? dark.tokens : light.tokens,
43
+ brand,
44
+ tokens: resolvedTokens,
25
45
  baseTokens: native.tokens
26
- }),
27
- [mode]
28
- );
46
+ };
47
+ }, [mode, brand, tokenOverride]);
29
48
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value, children });
30
49
  }
31
50
  function useTheme() {
@@ -994,7 +1013,8 @@ function Input({
994
1013
  style,
995
1014
  inputStyle,
996
1015
  textStyle,
997
- testID
1016
+ testID,
1017
+ variant: _variant
998
1018
  }) {
999
1019
  const { tokens: t, baseTokens: bt } = useTheme();
1000
1020
  const {
@@ -2062,6 +2082,7 @@ exports.Tabs = Tabs;
2062
2082
  exports.Textarea = Textarea;
2063
2083
  exports.Toggle = Toggle;
2064
2084
  exports.mapAccessibilityToRN = mapAccessibilityToRN;
2085
+ exports.registerBrand = registerBrand;
2065
2086
  exports.useBreakpoint = useBreakpoint;
2066
2087
  exports.useBreakpointValue = useBreakpointValue;
2067
2088
  exports.useScreenDimensions = useScreenDimensions;