@entropix/react-native 0.3.0 → 1.0.1
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/accordion.cjs +26 -0
- package/dist/accordion.d.cts +34 -0
- package/dist/accordion.d.ts +34 -0
- package/dist/accordion.js +5 -0
- package/dist/button.cjs +14 -0
- package/dist/button.d.cts +35 -0
- package/dist/button.d.ts +35 -0
- package/dist/button.js +5 -0
- package/dist/checkbox.cjs +14 -0
- package/dist/checkbox.d.cts +41 -0
- package/dist/checkbox.d.ts +41 -0
- package/dist/checkbox.js +5 -0
- package/dist/chunk-2SQB7RNT.cjs +110 -0
- package/dist/chunk-3MHE2C74.js +143 -0
- package/dist/chunk-45KMMZUT.js +131 -0
- package/dist/chunk-64DK6YFL.js +164 -0
- package/dist/chunk-73BDGPZT.js +89 -0
- package/dist/chunk-B5YFEA66.cjs +243 -0
- package/dist/chunk-BOUIB4OY.cjs +56 -0
- package/dist/chunk-C6HF6QXK.js +154 -0
- package/dist/chunk-CXQNNEPC.js +249 -0
- package/dist/chunk-EFRYMWJB.js +86 -0
- package/dist/chunk-FQUZIDVS.cjs +174 -0
- package/dist/chunk-G7WPUTB6.cjs +258 -0
- package/dist/chunk-HH3CEDSH.js +122 -0
- package/dist/chunk-IRQWSFCZ.cjs +156 -0
- package/dist/chunk-KU24A5PQ.js +92 -0
- package/dist/chunk-OMKUPSHJ.cjs +95 -0
- package/dist/chunk-P5NAXMSC.cjs +91 -0
- package/dist/chunk-PKDXWKLO.cjs +245 -0
- package/dist/chunk-PVTPOJRU.js +155 -0
- package/dist/chunk-Q7TEJ62Q.cjs +160 -0
- package/dist/chunk-THX22NZW.cjs +146 -0
- package/dist/chunk-UHVTF2Y4.js +172 -0
- package/dist/chunk-UYXJHKYK.cjs +166 -0
- package/dist/chunk-VP567WZL.js +237 -0
- package/dist/chunk-XBNX4SLA.js +105 -0
- package/dist/chunk-XND7AIKO.cjs +133 -0
- package/dist/chunk-XSOLJOBG.js +238 -0
- package/dist/chunk-Z2MBHXUQ.cjs +127 -0
- package/dist/chunk-ZPAOLIIG.cjs +88 -0
- package/dist/chunk-ZYOTKLBG.js +52 -0
- package/dist/dialog.cjs +38 -0
- package/dist/dialog.d.cts +83 -0
- package/dist/dialog.d.ts +83 -0
- package/dist/dialog.js +5 -0
- package/dist/index.cjs +187 -2063
- package/dist/index.d.cts +21 -651
- package/dist/index.d.ts +21 -651
- package/dist/index.js +15 -2025
- package/dist/input.cjs +14 -0
- package/dist/input.d.cts +57 -0
- package/dist/input.d.ts +57 -0
- package/dist/input.js +5 -0
- package/dist/layout.cjs +25 -0
- package/dist/layout.d.cts +108 -0
- package/dist/layout.d.ts +108 -0
- package/dist/layout.js +4 -0
- package/dist/menu.cjs +26 -0
- package/dist/menu.d.cts +34 -0
- package/dist/menu.d.ts +34 -0
- package/dist/menu.js +5 -0
- package/dist/radio.cjs +18 -0
- package/dist/radio.d.cts +55 -0
- package/dist/radio.d.ts +55 -0
- package/dist/radio.js +5 -0
- package/dist/select.cjs +26 -0
- package/dist/select.d.cts +86 -0
- package/dist/select.d.ts +86 -0
- package/dist/select.js +5 -0
- package/dist/switch.cjs +14 -0
- package/dist/switch.d.cts +27 -0
- package/dist/switch.d.ts +27 -0
- package/dist/switch.js +5 -0
- package/dist/tabs.cjs +26 -0
- package/dist/tabs.d.cts +33 -0
- package/dist/tabs.d.ts +33 -0
- package/dist/tabs.js +5 -0
- package/dist/textarea.cjs +14 -0
- package/dist/textarea.d.cts +55 -0
- package/dist/textarea.d.ts +55 -0
- package/dist/textarea.js +5 -0
- package/dist/theme.cjs +20 -0
- package/dist/theme.d.cts +59 -0
- package/dist/theme.d.ts +59 -0
- package/dist/theme.js +3 -0
- package/dist/toggle.cjs +18 -0
- package/dist/toggle.d.cts +41 -0
- package/dist/toggle.d.ts +41 -0
- package/dist/toggle.js +5 -0
- package/package.json +146 -4
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQ7TEJ62Q_cjs = require('./chunk-Q7TEJ62Q.cjs');
|
|
4
|
+
require('./chunk-P5NAXMSC.cjs');
|
|
5
|
+
require('./chunk-BOUIB4OY.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "Accordion", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkQ7TEJ62Q_cjs.Accordion; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "AccordionItem", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkQ7TEJ62Q_cjs.AccordionItem; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "AccordionPanel", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkQ7TEJ62Q_cjs.AccordionPanel; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "AccordionTrigger", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkQ7TEJ62Q_cjs.AccordionTrigger; }
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=accordion.cjs.map
|
|
26
|
+
//# sourceMappingURL=accordion.cjs.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleProp, ViewStyle, PressableProps, TextStyle } from 'react-native';
|
|
4
|
+
import { UseAccordionOptions } from '@entropix/core';
|
|
5
|
+
|
|
6
|
+
interface AccordionProps extends UseAccordionOptions {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
}
|
|
10
|
+
declare function Accordion({ children, style, ...options }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
interface AccordionItemProps {
|
|
13
|
+
value: string;
|
|
14
|
+
/** Whether this is the last item (hides bottom border). Auto-detected if omitted. */
|
|
15
|
+
isLast?: boolean;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
declare function AccordionItem({ value, isLast, children, style, }: AccordionItemProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
interface AccordionTriggerProps extends Omit<PressableProps, "onPress" | "style" | "children"> {
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
textStyle?: TextStyle;
|
|
25
|
+
}
|
|
26
|
+
declare function AccordionTrigger({ children, style, textStyle, ...rest }: AccordionTriggerProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
interface AccordionPanelProps {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
}
|
|
32
|
+
declare function AccordionPanel({ children, style }: AccordionPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
33
|
+
|
|
34
|
+
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleProp, ViewStyle, PressableProps, TextStyle } from 'react-native';
|
|
4
|
+
import { UseAccordionOptions } from '@entropix/core';
|
|
5
|
+
|
|
6
|
+
interface AccordionProps extends UseAccordionOptions {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
}
|
|
10
|
+
declare function Accordion({ children, style, ...options }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
interface AccordionItemProps {
|
|
13
|
+
value: string;
|
|
14
|
+
/** Whether this is the last item (hides bottom border). Auto-detected if omitted. */
|
|
15
|
+
isLast?: boolean;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
}
|
|
19
|
+
declare function AccordionItem({ value, isLast, children, style, }: AccordionItemProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
|
|
21
|
+
interface AccordionTriggerProps extends Omit<PressableProps, "onPress" | "style" | "children"> {
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
textStyle?: TextStyle;
|
|
25
|
+
}
|
|
26
|
+
declare function AccordionTrigger({ children, style, textStyle, ...rest }: AccordionTriggerProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
interface AccordionPanelProps {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
}
|
|
32
|
+
declare function AccordionPanel({ children, style }: AccordionPanelProps): react_jsx_runtime.JSX.Element | null;
|
|
33
|
+
|
|
34
|
+
export { Accordion, AccordionItem, type AccordionItemProps, AccordionPanel, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerProps };
|
package/dist/button.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkXND7AIKO_cjs = require('./chunk-XND7AIKO.cjs');
|
|
4
|
+
require('./chunk-P5NAXMSC.cjs');
|
|
5
|
+
require('./chunk-BOUIB4OY.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "Button", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkXND7AIKO_cjs.Button; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=button.cjs.map
|
|
14
|
+
//# sourceMappingURL=button.cjs.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
|
+
|
|
5
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
6
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
7
|
+
interface ButtonProps extends Omit<PressableProps, "disabled" | "onPress" | "style" | "children"> {
|
|
8
|
+
/** Called when the button is pressed */
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
/** Whether the button is disabled */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Whether the button is in a loading state */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** Visual variant. Default: "primary" */
|
|
15
|
+
variant?: ButtonVariant;
|
|
16
|
+
/** Size. Default: "md" */
|
|
17
|
+
size?: ButtonSize;
|
|
18
|
+
/** Override container style */
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
/** Override label text style */
|
|
21
|
+
textStyle?: TextStyle;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Button — styled React Native button with variant and size support.
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Button variant="primary" size="md" onPress={handlePress}>
|
|
29
|
+
* Save Changes
|
|
30
|
+
* </Button>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function Button({ onPress, disabled, loading, variant, size, style, textStyle, children, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
|
+
|
|
5
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "danger";
|
|
6
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
7
|
+
interface ButtonProps extends Omit<PressableProps, "disabled" | "onPress" | "style" | "children"> {
|
|
8
|
+
/** Called when the button is pressed */
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
/** Whether the button is disabled */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Whether the button is in a loading state */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** Visual variant. Default: "primary" */
|
|
15
|
+
variant?: ButtonVariant;
|
|
16
|
+
/** Size. Default: "md" */
|
|
17
|
+
size?: ButtonSize;
|
|
18
|
+
/** Override container style */
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
/** Override label text style */
|
|
21
|
+
textStyle?: TextStyle;
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Button — styled React Native button with variant and size support.
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Button variant="primary" size="md" onPress={handlePress}>
|
|
29
|
+
* Save Changes
|
|
30
|
+
* </Button>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function Button({ onPress, disabled, loading, variant, size, style, textStyle, children, ...rest }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkIRQWSFCZ_cjs = require('./chunk-IRQWSFCZ.cjs');
|
|
4
|
+
require('./chunk-P5NAXMSC.cjs');
|
|
5
|
+
require('./chunk-BOUIB4OY.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, "Checkbox", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return chunkIRQWSFCZ_cjs.Checkbox; }
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=checkbox.cjs.map
|
|
14
|
+
//# sourceMappingURL=checkbox.cjs.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
|
+
|
|
5
|
+
type CheckboxSize = "sm" | "md" | "lg";
|
|
6
|
+
interface CheckboxProps extends Omit<PressableProps, "disabled" | "onPress" | "style" | "children"> {
|
|
7
|
+
/** Controlled checked state */
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
/** Default checked state for uncontrolled mode */
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
/** Called when checked state changes */
|
|
12
|
+
onChange?: (checked: boolean) => void;
|
|
13
|
+
/** Whether the checkbox is disabled */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Whether the checkbox is in an indeterminate state */
|
|
16
|
+
indeterminate?: boolean;
|
|
17
|
+
/** Accessible label */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Size variant. Default: "md" */
|
|
20
|
+
size?: CheckboxSize;
|
|
21
|
+
/** Override container style */
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
/** Override label text style */
|
|
24
|
+
textStyle?: TextStyle;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Checkbox -- styled checkbox with indicator box and label.
|
|
29
|
+
*
|
|
30
|
+
* Renders a row with a square indicator (filled when checked with
|
|
31
|
+
* a checkmark, dash when indeterminate) and a text label.
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Checkbox onChange={setAccepted} label="Accept Terms">
|
|
35
|
+
* I agree to the terms and conditions
|
|
36
|
+
* </Checkbox>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function Checkbox({ checked, defaultChecked, onChange, disabled, indeterminate, label, size, style, textStyle, children, ...rest }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
export { Checkbox, type CheckboxProps, type CheckboxSize };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
|
+
|
|
5
|
+
type CheckboxSize = "sm" | "md" | "lg";
|
|
6
|
+
interface CheckboxProps extends Omit<PressableProps, "disabled" | "onPress" | "style" | "children"> {
|
|
7
|
+
/** Controlled checked state */
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
/** Default checked state for uncontrolled mode */
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
/** Called when checked state changes */
|
|
12
|
+
onChange?: (checked: boolean) => void;
|
|
13
|
+
/** Whether the checkbox is disabled */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Whether the checkbox is in an indeterminate state */
|
|
16
|
+
indeterminate?: boolean;
|
|
17
|
+
/** Accessible label */
|
|
18
|
+
label?: string;
|
|
19
|
+
/** Size variant. Default: "md" */
|
|
20
|
+
size?: CheckboxSize;
|
|
21
|
+
/** Override container style */
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
/** Override label text style */
|
|
24
|
+
textStyle?: TextStyle;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Checkbox -- styled checkbox with indicator box and label.
|
|
29
|
+
*
|
|
30
|
+
* Renders a row with a square indicator (filled when checked with
|
|
31
|
+
* a checkmark, dash when indeterminate) and a text label.
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Checkbox onChange={setAccepted} label="Accept Terms">
|
|
35
|
+
* I agree to the terms and conditions
|
|
36
|
+
* </Checkbox>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
declare function Checkbox({ checked, defaultChecked, onChange, disabled, indeterminate, label, size, style, textStyle, children, ...rest }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
|
|
41
|
+
export { Checkbox, type CheckboxProps, type CheckboxSize };
|
package/dist/checkbox.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkP5NAXMSC_cjs = require('./chunk-P5NAXMSC.cjs');
|
|
4
|
+
var chunkBOUIB4OY_cjs = require('./chunk-BOUIB4OY.cjs');
|
|
5
|
+
var reactNative = require('react-native');
|
|
6
|
+
var core = require('@entropix/core');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
var TabsContext = react.createContext(null);
|
|
11
|
+
function useTabsContext() {
|
|
12
|
+
const context = react.useContext(TabsContext);
|
|
13
|
+
if (!context) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"Tabs compound components must be used within a <Tabs> provider."
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
function Tabs({ children, style, ...options }) {
|
|
21
|
+
const tabs = core.useTabs(options);
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: tabs, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style, children }) });
|
|
23
|
+
}
|
|
24
|
+
function TabList({ children, style }) {
|
|
25
|
+
const { tokens: t, baseTokens: bt } = chunkBOUIB4OY_cjs.useTheme();
|
|
26
|
+
const { getTabListProps } = useTabsContext();
|
|
27
|
+
const propGetterReturn = getTabListProps();
|
|
28
|
+
const rnAccessibility = chunkP5NAXMSC_cjs.mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
reactNative.View,
|
|
31
|
+
{
|
|
32
|
+
...rnAccessibility,
|
|
33
|
+
style: [
|
|
34
|
+
{
|
|
35
|
+
flexDirection: "row",
|
|
36
|
+
gap: bt.entropixSpacing1,
|
|
37
|
+
borderBottomWidth: 1,
|
|
38
|
+
borderBottomColor: t.entropixColorBorderDefault
|
|
39
|
+
},
|
|
40
|
+
style
|
|
41
|
+
],
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function Tab({ value, children, style, textStyle, ...rest }) {
|
|
47
|
+
const { tokens: t, baseTokens: bt } = chunkBOUIB4OY_cjs.useTheme();
|
|
48
|
+
const { getTabProps, selectedKey } = useTabsContext();
|
|
49
|
+
const propGetterReturn = getTabProps(value);
|
|
50
|
+
const rnAccessibility = chunkP5NAXMSC_cjs.mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
51
|
+
const isActive = selectedKey === value;
|
|
52
|
+
const isDisabled = propGetterReturn.accessibility.disabled === true;
|
|
53
|
+
const handlePress = react.useCallback(() => {
|
|
54
|
+
propGetterReturn.onAction?.();
|
|
55
|
+
}, [propGetterReturn.onAction]);
|
|
56
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
reactNative.Pressable,
|
|
58
|
+
{
|
|
59
|
+
...rnAccessibility,
|
|
60
|
+
...rest,
|
|
61
|
+
onPress: propGetterReturn.onAction ? handlePress : void 0,
|
|
62
|
+
style: [
|
|
63
|
+
{
|
|
64
|
+
paddingVertical: bt.entropixSpacing2,
|
|
65
|
+
paddingHorizontal: bt.entropixSpacing4,
|
|
66
|
+
borderBottomWidth: 2,
|
|
67
|
+
borderBottomColor: isActive ? t.entropixColorActionPrimaryDefault : "transparent"
|
|
68
|
+
},
|
|
69
|
+
isDisabled && { opacity: 0.5 },
|
|
70
|
+
style
|
|
71
|
+
],
|
|
72
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
73
|
+
reactNative.Text,
|
|
74
|
+
{
|
|
75
|
+
style: [
|
|
76
|
+
{
|
|
77
|
+
fontSize: bt.entropixFontSizeSm,
|
|
78
|
+
fontWeight: "500",
|
|
79
|
+
color: isActive ? t.entropixColorActionPrimaryDefault : t.entropixColorTextSecondary
|
|
80
|
+
},
|
|
81
|
+
textStyle
|
|
82
|
+
],
|
|
83
|
+
children
|
|
84
|
+
}
|
|
85
|
+
) : children
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function TabPanel({ value, children, style }) {
|
|
90
|
+
const { baseTokens: bt } = chunkBOUIB4OY_cjs.useTheme();
|
|
91
|
+
const { getTabPanelProps, selectedKey } = useTabsContext();
|
|
92
|
+
const propGetterReturn = getTabPanelProps(value);
|
|
93
|
+
const rnAccessibility = chunkP5NAXMSC_cjs.mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
94
|
+
if (selectedKey !== value) return null;
|
|
95
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
96
|
+
reactNative.View,
|
|
97
|
+
{
|
|
98
|
+
...rnAccessibility,
|
|
99
|
+
style: [{ padding: bt.entropixSpacing4 }, style],
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
exports.Tab = Tab;
|
|
106
|
+
exports.TabList = TabList;
|
|
107
|
+
exports.TabPanel = TabPanel;
|
|
108
|
+
exports.Tabs = Tabs;
|
|
109
|
+
//# sourceMappingURL=chunk-2SQB7RNT.cjs.map
|
|
110
|
+
//# sourceMappingURL=chunk-2SQB7RNT.cjs.map
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { mapAccessibilityToRN } from './chunk-73BDGPZT.js';
|
|
2
|
+
import { useTheme } from './chunk-ZYOTKLBG.js';
|
|
3
|
+
import { View, Text, Pressable } from 'react-native';
|
|
4
|
+
import { useRadioGroup } from '@entropix/core';
|
|
5
|
+
import { createContext, useCallback, useContext } from 'react';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var RadioGroupContext = createContext(null);
|
|
9
|
+
function useRadioGroupContext() {
|
|
10
|
+
const context = useContext(RadioGroupContext);
|
|
11
|
+
if (!context) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
"Radio compound components must be used within a <RadioGroup> provider."
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
18
|
+
function RadioGroup({
|
|
19
|
+
label,
|
|
20
|
+
style,
|
|
21
|
+
textStyle,
|
|
22
|
+
children,
|
|
23
|
+
testID,
|
|
24
|
+
...options
|
|
25
|
+
}) {
|
|
26
|
+
const { tokens: t, baseTokens: bt } = useTheme();
|
|
27
|
+
const radioGroup = useRadioGroup(options);
|
|
28
|
+
const propGetterReturn = radioGroup.getRadioGroupProps();
|
|
29
|
+
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
30
|
+
if (label) {
|
|
31
|
+
rnAccessibility.accessibilityLabel = label;
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: radioGroup, children: /* @__PURE__ */ jsxs(
|
|
34
|
+
View,
|
|
35
|
+
{
|
|
36
|
+
...rnAccessibility,
|
|
37
|
+
testID,
|
|
38
|
+
style: [
|
|
39
|
+
{
|
|
40
|
+
gap: bt.entropixSpacing2
|
|
41
|
+
},
|
|
42
|
+
style
|
|
43
|
+
],
|
|
44
|
+
children: [
|
|
45
|
+
label ? /* @__PURE__ */ jsx(
|
|
46
|
+
Text,
|
|
47
|
+
{
|
|
48
|
+
style: [
|
|
49
|
+
{
|
|
50
|
+
fontSize: bt.entropixFontSizeSm,
|
|
51
|
+
fontWeight: "500",
|
|
52
|
+
color: t.entropixColorTextPrimary
|
|
53
|
+
},
|
|
54
|
+
textStyle
|
|
55
|
+
],
|
|
56
|
+
children: label
|
|
57
|
+
}
|
|
58
|
+
) : null,
|
|
59
|
+
children
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) });
|
|
63
|
+
}
|
|
64
|
+
function RadioItem({
|
|
65
|
+
value,
|
|
66
|
+
disabled,
|
|
67
|
+
style,
|
|
68
|
+
textStyle,
|
|
69
|
+
children,
|
|
70
|
+
...rest
|
|
71
|
+
}) {
|
|
72
|
+
const { tokens: t, baseTokens: bt } = useTheme();
|
|
73
|
+
const { getRadioProps } = useRadioGroupContext();
|
|
74
|
+
const propGetterReturn = getRadioProps(value, { disabled });
|
|
75
|
+
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
76
|
+
const isChecked = propGetterReturn.accessibility.checked === true;
|
|
77
|
+
const isDisabled = propGetterReturn.accessibility.disabled === true;
|
|
78
|
+
const handlePress = useCallback(() => {
|
|
79
|
+
propGetterReturn.onAction?.();
|
|
80
|
+
}, [propGetterReturn.onAction]);
|
|
81
|
+
return /* @__PURE__ */ jsxs(
|
|
82
|
+
Pressable,
|
|
83
|
+
{
|
|
84
|
+
...rnAccessibility,
|
|
85
|
+
...rest,
|
|
86
|
+
disabled: isDisabled,
|
|
87
|
+
onPress: isDisabled ? void 0 : handlePress,
|
|
88
|
+
style: [
|
|
89
|
+
{
|
|
90
|
+
flexDirection: "row",
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
gap: bt.entropixSpacing2
|
|
93
|
+
},
|
|
94
|
+
isDisabled && { opacity: 0.5 },
|
|
95
|
+
style
|
|
96
|
+
],
|
|
97
|
+
children: [
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
View,
|
|
100
|
+
{
|
|
101
|
+
style: {
|
|
102
|
+
width: 20,
|
|
103
|
+
height: 20,
|
|
104
|
+
borderRadius: 10,
|
|
105
|
+
borderWidth: 2,
|
|
106
|
+
borderColor: isChecked ? t.entropixColorActionPrimaryDefault : t.entropixColorBorderDefault,
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
justifyContent: "center"
|
|
109
|
+
},
|
|
110
|
+
children: isChecked ? /* @__PURE__ */ jsx(
|
|
111
|
+
View,
|
|
112
|
+
{
|
|
113
|
+
style: {
|
|
114
|
+
width: 10,
|
|
115
|
+
height: 10,
|
|
116
|
+
borderRadius: 5,
|
|
117
|
+
backgroundColor: t.entropixColorActionPrimaryDefault
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
) : null
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
124
|
+
Text,
|
|
125
|
+
{
|
|
126
|
+
style: [
|
|
127
|
+
{
|
|
128
|
+
fontSize: bt.entropixFontSizeSm,
|
|
129
|
+
color: t.entropixColorTextPrimary
|
|
130
|
+
},
|
|
131
|
+
textStyle
|
|
132
|
+
],
|
|
133
|
+
children
|
|
134
|
+
}
|
|
135
|
+
) : children
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { RadioGroup, RadioItem };
|
|
142
|
+
//# sourceMappingURL=chunk-3MHE2C74.js.map
|
|
143
|
+
//# sourceMappingURL=chunk-3MHE2C74.js.map
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { mapAccessibilityToRN } from './chunk-73BDGPZT.js';
|
|
2
|
+
import { useTheme } from './chunk-ZYOTKLBG.js';
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { Pressable, Text } from 'react-native';
|
|
5
|
+
import { useButton } from '@entropix/core';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function Button({
|
|
9
|
+
onPress,
|
|
10
|
+
disabled,
|
|
11
|
+
loading,
|
|
12
|
+
variant = "primary",
|
|
13
|
+
size = "md",
|
|
14
|
+
style,
|
|
15
|
+
textStyle,
|
|
16
|
+
children,
|
|
17
|
+
...rest
|
|
18
|
+
}) {
|
|
19
|
+
const { tokens: t, baseTokens: bt } = useTheme();
|
|
20
|
+
const { isDisabled, isLoading, getButtonProps } = useButton({
|
|
21
|
+
disabled,
|
|
22
|
+
loading,
|
|
23
|
+
onPress,
|
|
24
|
+
elementType: "div"
|
|
25
|
+
});
|
|
26
|
+
const propGetterReturn = getButtonProps();
|
|
27
|
+
const rnAccessibility = mapAccessibilityToRN(propGetterReturn.accessibility);
|
|
28
|
+
const handlePress = useCallback(() => {
|
|
29
|
+
propGetterReturn.onAction?.();
|
|
30
|
+
}, [propGetterReturn.onAction]);
|
|
31
|
+
const sizeStyles = getSizeStyle(size, bt);
|
|
32
|
+
const variantStyles = getVariantStyle(variant, t);
|
|
33
|
+
const labelColor = getVariantTextColor(variant, t);
|
|
34
|
+
const isInactive = isDisabled || isLoading;
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
Pressable,
|
|
37
|
+
{
|
|
38
|
+
...rnAccessibility,
|
|
39
|
+
...rest,
|
|
40
|
+
disabled: isInactive,
|
|
41
|
+
onPress: isInactive ? void 0 : handlePress,
|
|
42
|
+
style: [
|
|
43
|
+
baseStyle,
|
|
44
|
+
sizeStyles.container,
|
|
45
|
+
variantStyles,
|
|
46
|
+
isInactive && { opacity: 0.5 },
|
|
47
|
+
style
|
|
48
|
+
],
|
|
49
|
+
children: typeof children === "string" ? /* @__PURE__ */ jsx(
|
|
50
|
+
Text,
|
|
51
|
+
{
|
|
52
|
+
style: [
|
|
53
|
+
{ color: labelColor, fontSize: sizeStyles.fontSize, fontWeight: "500" },
|
|
54
|
+
textStyle
|
|
55
|
+
],
|
|
56
|
+
children
|
|
57
|
+
}
|
|
58
|
+
) : children
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
var baseStyle = {
|
|
63
|
+
flexDirection: "row",
|
|
64
|
+
alignItems: "center",
|
|
65
|
+
justifyContent: "center"
|
|
66
|
+
};
|
|
67
|
+
function getSizeStyle(size, bt) {
|
|
68
|
+
switch (size) {
|
|
69
|
+
case "sm":
|
|
70
|
+
return {
|
|
71
|
+
container: {
|
|
72
|
+
paddingVertical: bt.entropixSpacing1,
|
|
73
|
+
paddingHorizontal: bt.entropixSpacing3,
|
|
74
|
+
borderRadius: bt.entropixRadiusSm,
|
|
75
|
+
gap: bt.entropixButtonGap
|
|
76
|
+
},
|
|
77
|
+
fontSize: bt.entropixFontSizeXs
|
|
78
|
+
};
|
|
79
|
+
case "lg":
|
|
80
|
+
return {
|
|
81
|
+
container: {
|
|
82
|
+
paddingVertical: bt.entropixSpacing3,
|
|
83
|
+
paddingHorizontal: bt.entropixSpacing6,
|
|
84
|
+
borderRadius: bt.entropixRadiusLg,
|
|
85
|
+
gap: bt.entropixButtonGap
|
|
86
|
+
},
|
|
87
|
+
fontSize: bt.entropixFontSizeBase
|
|
88
|
+
};
|
|
89
|
+
default:
|
|
90
|
+
return {
|
|
91
|
+
container: {
|
|
92
|
+
paddingVertical: bt.entropixButtonPaddingY,
|
|
93
|
+
paddingHorizontal: bt.entropixButtonPaddingX,
|
|
94
|
+
borderRadius: bt.entropixButtonBorderRadius,
|
|
95
|
+
gap: bt.entropixButtonGap
|
|
96
|
+
},
|
|
97
|
+
fontSize: bt.entropixButtonFontSize
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function getVariantStyle(variant, t) {
|
|
102
|
+
switch (variant) {
|
|
103
|
+
case "primary":
|
|
104
|
+
return { backgroundColor: t.entropixButtonPrimaryBg, borderWidth: 1, borderColor: t.entropixButtonPrimaryBorder };
|
|
105
|
+
case "secondary":
|
|
106
|
+
return { backgroundColor: t.entropixButtonSecondaryBg, borderWidth: 1, borderColor: t.entropixButtonSecondaryBorder };
|
|
107
|
+
case "outline":
|
|
108
|
+
return { backgroundColor: "transparent", borderWidth: 1, borderColor: t.entropixColorBorderDefault };
|
|
109
|
+
case "ghost":
|
|
110
|
+
return { backgroundColor: "transparent", borderWidth: 1, borderColor: "transparent" };
|
|
111
|
+
case "danger":
|
|
112
|
+
return { backgroundColor: t.entropixButtonDangerBg, borderWidth: 1, borderColor: t.entropixButtonDangerBorder };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function getVariantTextColor(variant, t) {
|
|
116
|
+
switch (variant) {
|
|
117
|
+
case "primary":
|
|
118
|
+
return t.entropixButtonPrimaryText;
|
|
119
|
+
case "secondary":
|
|
120
|
+
return t.entropixButtonSecondaryText;
|
|
121
|
+
case "outline":
|
|
122
|
+
case "ghost":
|
|
123
|
+
return t.entropixColorTextPrimary;
|
|
124
|
+
case "danger":
|
|
125
|
+
return t.entropixButtonDangerText;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export { Button };
|
|
130
|
+
//# sourceMappingURL=chunk-45KMMZUT.js.map
|
|
131
|
+
//# sourceMappingURL=chunk-45KMMZUT.js.map
|