@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 +28 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -5
- package/dist/index.d.ts +26 -5
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -7,14 +7,34 @@ import { AccessibilityRole, AccessibilityState, AccessibilityValue, PressablePro
|
|
|
7
7
|
|
|
8
8
|
type EntropixTheme = typeof tokens;
|
|
9
9
|
type ThemeMode = "light" | "dark";
|
|
10
|
+
type BrandName = string;
|
|
10
11
|
interface ThemeContextValue {
|
|
11
12
|
mode: ThemeMode;
|
|
13
|
+
brand: BrandName;
|
|
12
14
|
tokens: EntropixTheme;
|
|
13
15
|
baseTokens: typeof tokens$1;
|
|
14
16
|
}
|
|
17
|
+
type BrandThemes = Record<ThemeMode, EntropixTheme>;
|
|
18
|
+
/**
|
|
19
|
+
* registerBrand — Register a custom brand's theme tokens.
|
|
20
|
+
*
|
|
21
|
+
* Call this before rendering EntropixProvider to make a brand available.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { tokens as acmeLight } from "@entropix/tokens/brands/ocean/native/light";
|
|
25
|
+
* import { tokens as acmeDark } from "@entropix/tokens/brands/ocean/native/dark";
|
|
26
|
+
*
|
|
27
|
+
* registerBrand("ocean", { light: acmeLight, dark: acmeDark });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function registerBrand(name: string, themes: BrandThemes): void;
|
|
15
31
|
interface EntropixProviderProps {
|
|
16
32
|
/** Theme mode: "light" or "dark". Default: "light" */
|
|
17
33
|
mode?: ThemeMode;
|
|
34
|
+
/** Brand name. Default: "default" */
|
|
35
|
+
brand?: BrandName;
|
|
36
|
+
/** Override tokens directly (bypasses brand registry) */
|
|
37
|
+
tokens?: EntropixTheme;
|
|
18
38
|
children: React.ReactNode;
|
|
19
39
|
}
|
|
20
40
|
/**
|
|
@@ -24,16 +44,16 @@ interface EntropixProviderProps {
|
|
|
24
44
|
* automatically pick up the current theme tokens.
|
|
25
45
|
*
|
|
26
46
|
* ```tsx
|
|
27
|
-
* <EntropixProvider mode="dark">
|
|
47
|
+
* <EntropixProvider brand="ocean" mode="dark">
|
|
28
48
|
* <App />
|
|
29
49
|
* </EntropixProvider>
|
|
30
50
|
* ```
|
|
31
51
|
*/
|
|
32
|
-
declare function EntropixProvider({ mode, children, }: EntropixProviderProps): react_jsx_runtime.JSX.Element;
|
|
52
|
+
declare function EntropixProvider({ mode, brand, tokens: tokenOverride, children, }: EntropixProviderProps): react_jsx_runtime.JSX.Element;
|
|
33
53
|
/**
|
|
34
54
|
* useTheme — Access current Entropix theme tokens.
|
|
35
55
|
*
|
|
36
|
-
* Returns the resolved token values for the current theme
|
|
56
|
+
* Returns the resolved token values for the current theme and brand.
|
|
37
57
|
* Must be used within an EntropixProvider.
|
|
38
58
|
*/
|
|
39
59
|
declare function useTheme(): ThemeContextValue;
|
|
@@ -345,6 +365,7 @@ interface InputProps {
|
|
|
345
365
|
textStyle?: TextStyle;
|
|
346
366
|
/** testID for testing */
|
|
347
367
|
testID?: string;
|
|
368
|
+
variant?: string;
|
|
348
369
|
}
|
|
349
370
|
/**
|
|
350
371
|
* Input -- styled text input with label, helper text, and error message.
|
|
@@ -358,7 +379,7 @@ interface InputProps {
|
|
|
358
379
|
* />
|
|
359
380
|
* ```
|
|
360
381
|
*/
|
|
361
|
-
declare function Input({ value, defaultValue, onChange, disabled, readOnly, required, invalid, label, helperText, errorMessage, placeholder, type, size, style, inputStyle, textStyle, testID, }: InputProps): react_jsx_runtime.JSX.Element;
|
|
382
|
+
declare function Input({ value, defaultValue, onChange, disabled, readOnly, required, invalid, label, helperText, errorMessage, placeholder, type, size, style, inputStyle, textStyle, testID, variant: _variant }: InputProps): react_jsx_runtime.JSX.Element;
|
|
362
383
|
|
|
363
384
|
type TextareaSize = "sm" | "md" | "lg";
|
|
364
385
|
interface TextareaProps {
|
|
@@ -729,4 +750,4 @@ interface DividerProps extends ViewProps {
|
|
|
729
750
|
*/
|
|
730
751
|
declare function Divider({ orientation, spacing, style, ...rest }: DividerProps): react_jsx_runtime.JSX.Element;
|
|
731
752
|
|
|
732
|
-
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, BREAKPOINTS, type Breakpoint, Button, type ButtonProps, Checkbox, type CheckboxProps, type CheckboxSize, Container, type ContainerProps, type ContainerSize, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, Divider, type DividerProps, EntropixProvider, type EntropixProviderProps, type EntropixTheme, Inline, type InlineProps, Input, type InputProps, type InputSize, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, type MenuProps, MenuTrigger, type MenuTriggerProps, type RNAccessibilityProps, RadioGroup, type RadioGroupProps, RadioItem, type RadioItemProps, Select, SelectContent, type SelectContentProps, SelectOption, type SelectOptionProps, type SelectProps, SelectTrigger, type SelectTriggerProps, type SpacingSize$1 as SpacingSize, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Textarea, type TextareaProps, type TextareaSize, type ThemeMode, Toggle, type ToggleProps, mapAccessibilityToRN, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
|
753
|
+
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, BREAKPOINTS, type BrandName, type Breakpoint, Button, type ButtonProps, Checkbox, type CheckboxProps, type CheckboxSize, Container, type ContainerProps, type ContainerSize, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, Divider, type DividerProps, EntropixProvider, type EntropixProviderProps, type EntropixTheme, Inline, type InlineProps, Input, type InputProps, type InputSize, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, type MenuProps, MenuTrigger, type MenuTriggerProps, type RNAccessibilityProps, RadioGroup, type RadioGroupProps, RadioItem, type RadioItemProps, Select, SelectContent, type SelectContentProps, SelectOption, type SelectOptionProps, type SelectProps, SelectTrigger, type SelectTriggerProps, type SpacingSize$1 as SpacingSize, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Textarea, type TextareaProps, type TextareaSize, type ThemeMode, Toggle, type ToggleProps, mapAccessibilityToRN, registerBrand, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,34 @@ import { AccessibilityRole, AccessibilityState, AccessibilityValue, PressablePro
|
|
|
7
7
|
|
|
8
8
|
type EntropixTheme = typeof tokens;
|
|
9
9
|
type ThemeMode = "light" | "dark";
|
|
10
|
+
type BrandName = string;
|
|
10
11
|
interface ThemeContextValue {
|
|
11
12
|
mode: ThemeMode;
|
|
13
|
+
brand: BrandName;
|
|
12
14
|
tokens: EntropixTheme;
|
|
13
15
|
baseTokens: typeof tokens$1;
|
|
14
16
|
}
|
|
17
|
+
type BrandThemes = Record<ThemeMode, EntropixTheme>;
|
|
18
|
+
/**
|
|
19
|
+
* registerBrand — Register a custom brand's theme tokens.
|
|
20
|
+
*
|
|
21
|
+
* Call this before rendering EntropixProvider to make a brand available.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { tokens as acmeLight } from "@entropix/tokens/brands/ocean/native/light";
|
|
25
|
+
* import { tokens as acmeDark } from "@entropix/tokens/brands/ocean/native/dark";
|
|
26
|
+
*
|
|
27
|
+
* registerBrand("ocean", { light: acmeLight, dark: acmeDark });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function registerBrand(name: string, themes: BrandThemes): void;
|
|
15
31
|
interface EntropixProviderProps {
|
|
16
32
|
/** Theme mode: "light" or "dark". Default: "light" */
|
|
17
33
|
mode?: ThemeMode;
|
|
34
|
+
/** Brand name. Default: "default" */
|
|
35
|
+
brand?: BrandName;
|
|
36
|
+
/** Override tokens directly (bypasses brand registry) */
|
|
37
|
+
tokens?: EntropixTheme;
|
|
18
38
|
children: React.ReactNode;
|
|
19
39
|
}
|
|
20
40
|
/**
|
|
@@ -24,16 +44,16 @@ interface EntropixProviderProps {
|
|
|
24
44
|
* automatically pick up the current theme tokens.
|
|
25
45
|
*
|
|
26
46
|
* ```tsx
|
|
27
|
-
* <EntropixProvider mode="dark">
|
|
47
|
+
* <EntropixProvider brand="ocean" mode="dark">
|
|
28
48
|
* <App />
|
|
29
49
|
* </EntropixProvider>
|
|
30
50
|
* ```
|
|
31
51
|
*/
|
|
32
|
-
declare function EntropixProvider({ mode, children, }: EntropixProviderProps): react_jsx_runtime.JSX.Element;
|
|
52
|
+
declare function EntropixProvider({ mode, brand, tokens: tokenOverride, children, }: EntropixProviderProps): react_jsx_runtime.JSX.Element;
|
|
33
53
|
/**
|
|
34
54
|
* useTheme — Access current Entropix theme tokens.
|
|
35
55
|
*
|
|
36
|
-
* Returns the resolved token values for the current theme
|
|
56
|
+
* Returns the resolved token values for the current theme and brand.
|
|
37
57
|
* Must be used within an EntropixProvider.
|
|
38
58
|
*/
|
|
39
59
|
declare function useTheme(): ThemeContextValue;
|
|
@@ -345,6 +365,7 @@ interface InputProps {
|
|
|
345
365
|
textStyle?: TextStyle;
|
|
346
366
|
/** testID for testing */
|
|
347
367
|
testID?: string;
|
|
368
|
+
variant?: string;
|
|
348
369
|
}
|
|
349
370
|
/**
|
|
350
371
|
* Input -- styled text input with label, helper text, and error message.
|
|
@@ -358,7 +379,7 @@ interface InputProps {
|
|
|
358
379
|
* />
|
|
359
380
|
* ```
|
|
360
381
|
*/
|
|
361
|
-
declare function Input({ value, defaultValue, onChange, disabled, readOnly, required, invalid, label, helperText, errorMessage, placeholder, type, size, style, inputStyle, textStyle, testID, }: InputProps): react_jsx_runtime.JSX.Element;
|
|
382
|
+
declare function Input({ value, defaultValue, onChange, disabled, readOnly, required, invalid, label, helperText, errorMessage, placeholder, type, size, style, inputStyle, textStyle, testID, variant: _variant }: InputProps): react_jsx_runtime.JSX.Element;
|
|
362
383
|
|
|
363
384
|
type TextareaSize = "sm" | "md" | "lg";
|
|
364
385
|
interface TextareaProps {
|
|
@@ -729,4 +750,4 @@ interface DividerProps extends ViewProps {
|
|
|
729
750
|
*/
|
|
730
751
|
declare function Divider({ orientation, spacing, style, ...rest }: DividerProps): react_jsx_runtime.JSX.Element;
|
|
731
752
|
|
|
732
|
-
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, BREAKPOINTS, type Breakpoint, Button, type ButtonProps, Checkbox, type CheckboxProps, type CheckboxSize, Container, type ContainerProps, type ContainerSize, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, Divider, type DividerProps, EntropixProvider, type EntropixProviderProps, type EntropixTheme, Inline, type InlineProps, Input, type InputProps, type InputSize, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, type MenuProps, MenuTrigger, type MenuTriggerProps, type RNAccessibilityProps, RadioGroup, type RadioGroupProps, RadioItem, type RadioItemProps, Select, SelectContent, type SelectContentProps, SelectOption, type SelectOptionProps, type SelectProps, SelectTrigger, type SelectTriggerProps, type SpacingSize$1 as SpacingSize, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Textarea, type TextareaProps, type TextareaSize, type ThemeMode, Toggle, type ToggleProps, mapAccessibilityToRN, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
|
753
|
+
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps, BREAKPOINTS, type BrandName, type Breakpoint, Button, type ButtonProps, Checkbox, type CheckboxProps, type CheckboxSize, Container, type ContainerProps, type ContainerSize, Dialog, DialogClose, type DialogCloseProps, DialogContent, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogOverlay, type DialogOverlayProps, type DialogProps, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerProps, Divider, type DividerProps, EntropixProvider, type EntropixProviderProps, type EntropixTheme, Inline, type InlineProps, Input, type InputProps, type InputSize, Menu, MenuContent, type MenuContentProps, MenuItem, type MenuItemProps, type MenuProps, MenuTrigger, type MenuTriggerProps, type RNAccessibilityProps, RadioGroup, type RadioGroupProps, RadioItem, type RadioItemProps, Select, SelectContent, type SelectContentProps, SelectOption, type SelectOptionProps, type SelectProps, SelectTrigger, type SelectTriggerProps, type SpacingSize$1 as SpacingSize, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps, Textarea, type TextareaProps, type TextareaSize, type ThemeMode, Toggle, type ToggleProps, mapAccessibilityToRN, registerBrand, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -9,21 +9,40 @@ import { useButton, useToggle, useDialog, useTabs, useAccordion, useMenu, useInp
|
|
|
9
9
|
// src/theme/theme-context.tsx
|
|
10
10
|
var ThemeContext = createContext({
|
|
11
11
|
mode: "light",
|
|
12
|
+
brand: "default",
|
|
12
13
|
tokens: tokens$1,
|
|
13
14
|
baseTokens: tokens
|
|
14
15
|
});
|
|
16
|
+
var brandRegistry = {
|
|
17
|
+
default: {
|
|
18
|
+
light: tokens$1,
|
|
19
|
+
dark: tokens$2
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function registerBrand(name, themes) {
|
|
23
|
+
brandRegistry[name] = themes;
|
|
24
|
+
}
|
|
15
25
|
function EntropixProvider({
|
|
16
26
|
mode = "light",
|
|
27
|
+
brand = "default",
|
|
28
|
+
tokens: tokenOverride,
|
|
17
29
|
children
|
|
18
30
|
}) {
|
|
19
|
-
const value = useMemo(
|
|
20
|
-
|
|
31
|
+
const value = useMemo(() => {
|
|
32
|
+
let resolvedTokens;
|
|
33
|
+
if (tokenOverride) {
|
|
34
|
+
resolvedTokens = tokenOverride;
|
|
35
|
+
} else {
|
|
36
|
+
const brandThemes = brandRegistry[brand] ?? brandRegistry.default;
|
|
37
|
+
resolvedTokens = brandThemes[mode] ?? brandThemes.light;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
21
40
|
mode,
|
|
22
|
-
|
|
41
|
+
brand,
|
|
42
|
+
tokens: resolvedTokens,
|
|
23
43
|
baseTokens: tokens
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
);
|
|
44
|
+
};
|
|
45
|
+
}, [mode, brand, tokenOverride]);
|
|
27
46
|
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
|
|
28
47
|
}
|
|
29
48
|
function useTheme() {
|
|
@@ -992,7 +1011,8 @@ function Input({
|
|
|
992
1011
|
style,
|
|
993
1012
|
inputStyle,
|
|
994
1013
|
textStyle,
|
|
995
|
-
testID
|
|
1014
|
+
testID,
|
|
1015
|
+
variant: _variant
|
|
996
1016
|
}) {
|
|
997
1017
|
const { tokens: t, baseTokens: bt } = useTheme();
|
|
998
1018
|
const {
|
|
@@ -2022,6 +2042,6 @@ function Divider({
|
|
|
2022
2042
|
);
|
|
2023
2043
|
}
|
|
2024
2044
|
|
|
2025
|
-
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, BREAKPOINTS, Button, Checkbox, Container, Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogTitle, DialogTrigger, Divider, EntropixProvider, Inline, Input, Menu, MenuContent, MenuItem, MenuTrigger, RadioGroup, RadioItem, Select, SelectContent, SelectOption, SelectTrigger, Stack, Switch, Tab, TabList, TabPanel, Tabs, Textarea, Toggle, mapAccessibilityToRN, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
|
2045
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, BREAKPOINTS, Button, Checkbox, Container, Dialog, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogTitle, DialogTrigger, Divider, EntropixProvider, Inline, Input, Menu, MenuContent, MenuItem, MenuTrigger, RadioGroup, RadioItem, Select, SelectContent, SelectOption, SelectTrigger, Stack, Switch, Tab, TabList, TabPanel, Tabs, Textarea, Toggle, mapAccessibilityToRN, registerBrand, useBreakpoint, useBreakpointValue, useScreenDimensions, useTheme };
|
|
2026
2046
|
//# sourceMappingURL=index.js.map
|
|
2027
2047
|
//# sourceMappingURL=index.js.map
|