@utilitywarehouse/hearth-react-native 0.2.0 → 0.3.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +3 -1
- package/CHANGELOG.md +34 -0
- package/build/components/Alert/AlertCloseButton.js +25 -3
- package/build/components/Alert/AlertIcon.js +17 -1
- package/build/components/Alert/AlertIconButton.js +27 -1
- package/build/components/Alert/AlertLink.js +47 -1
- package/build/components/Alert/AlertText.d.ts +1 -1
- package/build/components/Alert/AlertText.js +26 -2
- package/build/components/Alert/AlertTitle.d.ts +1 -1
- package/build/components/Alert/AlertTitle.js +26 -2
- package/build/components/Badge/Badge.js +101 -14
- package/build/components/Badge/Badge.props.d.ts +2 -2
- package/build/components/Badge/BadgeIcon.js +27 -29
- package/build/components/Badge/BadgeText.js +29 -31
- package/build/components/Button/Button.d.ts +2 -2
- package/build/components/Button/ButtonGroupRoot.d.ts +3 -2
- package/build/components/Button/ButtonGroupRoot.js +9 -0
- package/build/components/Button/ButtonRoot.js +1 -0
- package/build/components/Card/Card.props.d.ts +2 -2
- package/build/components/Checkbox/Checkbox.d.ts +2 -2
- package/build/components/Checkbox/Checkbox.js +11 -10
- package/build/components/Checkbox/Checkbox.props.d.ts +3 -1
- package/build/components/Checkbox/CheckboxIcon.js +1 -1
- package/build/components/Checkbox/CheckboxImage.d.ts +6 -0
- package/build/components/Checkbox/CheckboxImage.js +5 -0
- package/build/components/Checkbox/CheckboxTileRoot.js +1 -1
- package/build/components/Checkbox/index.d.ts +3 -2
- package/build/components/Checkbox/index.js +2 -1
- package/build/components/CurrencyInput/CurrencyInput.d.ts +6 -0
- package/build/components/CurrencyInput/CurrencyInput.js +47 -0
- package/build/components/CurrencyInput/CurrencyInput.props.d.ts +14 -0
- package/build/components/CurrencyInput/CurrencyInput.props.js +1 -0
- package/build/components/CurrencyInput/index.d.ts +1 -0
- package/build/components/CurrencyInput/index.js +1 -0
- package/build/components/DescriptionList/DescriptionList.context.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.context.js +9 -0
- package/build/components/DescriptionList/DescriptionList.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionList.js +25 -0
- package/build/components/DescriptionList/DescriptionList.props.d.ts +18 -0
- package/build/components/DescriptionList/DescriptionList.props.js +1 -0
- package/build/components/DescriptionList/DescriptionListItem.d.ts +6 -0
- package/build/components/DescriptionList/DescriptionListItem.js +49 -0
- package/build/components/DescriptionList/DescriptionListItem.props.d.ts +17 -0
- package/build/components/DescriptionList/DescriptionListItem.props.js +1 -0
- package/build/components/DescriptionList/index.d.ts +4 -0
- package/build/components/DescriptionList/index.js +2 -0
- package/build/components/Divider/Divider.js +46 -0
- package/build/components/Divider/Divider.props.d.ts +2 -2
- package/build/components/Flex/Flex.props.d.ts +3 -2
- package/build/components/Grid/Grid.props.d.ts +2 -2
- package/build/components/IconContainer/IconContainer.d.ts +5 -0
- package/build/components/IconContainer/IconContainer.js +161 -0
- package/build/components/IconContainer/IconContainer.props.d.ts +15 -0
- package/build/components/IconContainer/IconContainer.props.js +1 -0
- package/build/components/IconContainer/index.d.ts +2 -0
- package/build/components/IconContainer/index.js +1 -0
- package/build/components/Icons/CircleIcon.js +3 -3
- package/build/components/Input/Input.js +2 -34
- package/build/components/Input/Input.props.d.ts +1 -17
- package/build/components/Input/InputField.js +0 -7
- package/build/components/Link/Link.d.ts +1 -1
- package/build/components/Link/Link.js +4 -4
- package/build/components/Link/Link.props.d.ts +3 -0
- package/build/components/Modal/Modal.js +17 -1
- package/build/components/Radio/Radio.d.ts +2 -2
- package/build/components/Radio/Radio.js +9 -8
- package/build/components/Radio/Radio.props.d.ts +3 -1
- package/build/components/Radio/RadioImage.d.ts +6 -0
- package/build/components/Radio/RadioImage.js +5 -0
- package/build/components/Radio/RadioTileRoot.js +1 -1
- package/build/components/Radio/index.d.ts +3 -2
- package/build/components/Radio/index.js +2 -1
- package/build/components/SectionHeader/SectionHeader.js +1 -0
- package/build/components/Select/SelectOption.js +1 -7
- package/build/components/Tabs/Tab.d.ts +18 -0
- package/build/components/Tabs/Tab.js +74 -0
- package/build/components/Tabs/Tab.props.d.ts +14 -0
- package/build/components/Tabs/Tab.props.js +1 -0
- package/build/components/Tabs/TabPanel.d.ts +3 -0
- package/build/components/Tabs/TabPanel.js +34 -0
- package/build/components/Tabs/TabPanel.props.d.ts +8 -0
- package/build/components/Tabs/TabPanel.props.js +1 -0
- package/build/components/Tabs/Tabs.context.d.ts +23 -0
- package/build/components/Tabs/Tabs.context.js +8 -0
- package/build/components/Tabs/Tabs.d.ts +6 -0
- package/build/components/Tabs/Tabs.js +114 -0
- package/build/components/Tabs/Tabs.props.d.ts +19 -0
- package/build/components/Tabs/Tabs.props.js +1 -0
- package/build/components/Tabs/TabsList.d.ts +6 -0
- package/build/components/Tabs/TabsList.js +112 -0
- package/build/components/Tabs/TabsList.props.d.ts +6 -0
- package/build/components/Tabs/TabsList.props.js +1 -0
- package/build/components/Tabs/index.d.ts +8 -0
- package/build/components/Tabs/index.js +4 -0
- package/build/components/UnstyledIconButton/UnstyledIconButton.d.ts +1 -1
- package/build/components/UnstyledIconButton/UnstyledIconButton.js +4 -4
- package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +2 -1
- package/build/components/index.d.ts +4 -0
- package/build/components/index.js +4 -0
- package/build/core/themes.d.ts +428 -160
- package/build/core/themes.js +57 -1
- package/build/tokens/color.d.ts +88 -80
- package/build/tokens/color.js +44 -40
- package/build/tokens/components/dark/alert.d.ts +13 -0
- package/build/tokens/components/dark/alert.js +13 -0
- package/build/tokens/components/dark/button.d.ts +1 -0
- package/build/tokens/components/dark/button.js +1 -0
- package/build/tokens/components/dark/checkbox.d.ts +4 -1
- package/build/tokens/components/dark/checkbox.js +4 -1
- package/build/tokens/components/dark/icon-button.d.ts +10 -3
- package/build/tokens/components/dark/icon-button.js +10 -3
- package/build/tokens/components/dark/index.d.ts +1 -0
- package/build/tokens/components/dark/index.js +1 -0
- package/build/tokens/components/dark/link.d.ts +5 -0
- package/build/tokens/components/dark/link.js +5 -0
- package/build/tokens/components/dark/progress-bar.d.ts +41 -0
- package/build/tokens/components/dark/progress-bar.js +40 -0
- package/build/tokens/components/dark/radio.d.ts +1 -1
- package/build/tokens/components/dark/radio.js +1 -1
- package/build/tokens/components/dark/tabs.d.ts +2 -0
- package/build/tokens/components/dark/tabs.js +2 -0
- package/build/tokens/components/light/alert.d.ts +13 -0
- package/build/tokens/components/light/alert.js +13 -0
- package/build/tokens/components/light/badge.d.ts +1 -1
- package/build/tokens/components/light/badge.js +1 -1
- package/build/tokens/components/light/button.d.ts +1 -0
- package/build/tokens/components/light/button.js +1 -0
- package/build/tokens/components/light/checkbox.d.ts +6 -3
- package/build/tokens/components/light/checkbox.js +6 -3
- package/build/tokens/components/light/icon-button.d.ts +8 -1
- package/build/tokens/components/light/icon-button.js +8 -1
- package/build/tokens/components/light/index.d.ts +1 -0
- package/build/tokens/components/light/index.js +1 -0
- package/build/tokens/components/light/link.d.ts +5 -0
- package/build/tokens/components/light/link.js +5 -0
- package/build/tokens/components/light/progress-bar.d.ts +41 -0
- package/build/tokens/components/light/progress-bar.js +40 -0
- package/build/tokens/components/light/radio.d.ts +3 -3
- package/build/tokens/components/light/radio.js +3 -3
- package/build/tokens/components/light/tabs.d.ts +2 -0
- package/build/tokens/components/light/tabs.js +2 -0
- package/build/tokens/index.d.ts +1 -0
- package/build/tokens/index.js +1 -0
- package/build/tokens/layout.d.ts +48 -30
- package/build/tokens/layout.js +24 -15
- package/build/tokens/motion.d.ts +23 -0
- package/build/tokens/motion.js +22 -0
- package/build/tokens/primitive.d.ts +19 -0
- package/build/tokens/primitive.js +19 -0
- package/build/tokens/semantic-dark.d.ts +26 -24
- package/build/tokens/semantic-dark.js +26 -24
- package/build/tokens/semantic-light.d.ts +18 -16
- package/build/tokens/semantic-light.js +18 -16
- package/build/types/values.d.ts +2 -1
- package/build/utils/formatThousands.d.ts +2 -0
- package/build/utils/formatThousands.js +16 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/docs/assets/bank-logo.png +0 -0
- package/docs/assets/bank-logo1.png +0 -0
- package/docs/components/AllComponents.web.tsx +97 -8
- package/docs/components/NextPrevPage.tsx +11 -3
- package/docs/components/UsageWrap.tsx +2 -2
- package/docs/components/index.ts +6 -7
- package/docs/heplers/addReactNativePrefix.ts +8 -0
- package/docs/heplers/index.ts +1 -0
- package/docs/introduction.mdx +3 -3
- package/docs/theme-tokens.mdx +42 -0
- package/package.json +13 -13
- package/src/components/Alert/AlertCloseButton.tsx +33 -5
- package/src/components/Alert/AlertIcon.tsx +17 -1
- package/src/components/Alert/AlertIconButton.tsx +37 -4
- package/src/components/Alert/AlertLink.tsx +52 -1
- package/src/components/Alert/AlertText.tsx +28 -3
- package/src/components/Alert/AlertTitle.tsx +28 -3
- package/src/components/Badge/Badge.docs.mdx +7 -7
- package/src/components/Badge/Badge.props.ts +3 -2
- package/src/components/Badge/Badge.stories.tsx +81 -92
- package/src/components/Badge/Badge.tsx +101 -14
- package/src/components/Badge/BadgeIcon.tsx +27 -29
- package/src/components/Badge/BadgeText.tsx +29 -31
- package/src/components/Button/ButtonGroupRoot.tsx +12 -2
- package/src/components/Button/ButtonRoot.tsx +1 -0
- package/src/components/Card/Card.docs.mdx +1 -1
- package/src/components/Card/Card.props.ts +2 -2
- package/src/components/Checkbox/Checkbox.docs.mdx +45 -7
- package/src/components/Checkbox/Checkbox.props.ts +3 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +37 -1
- package/src/components/Checkbox/Checkbox.tsx +12 -9
- package/src/components/Checkbox/CheckboxIcon.tsx +1 -1
- package/src/components/Checkbox/CheckboxImage.tsx +9 -0
- package/src/components/Checkbox/CheckboxTileRoot.tsx +1 -1
- package/src/components/Checkbox/index.ts +3 -2
- package/src/components/CurrencyInput/CurrencyInput.docs.mdx +120 -0
- package/src/components/CurrencyInput/CurrencyInput.props.ts +19 -0
- package/src/components/CurrencyInput/CurrencyInput.stories.tsx +116 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +91 -0
- package/src/components/CurrencyInput/index.ts +1 -0
- package/src/components/DescriptionList/DescriptionList.context.ts +18 -0
- package/src/components/DescriptionList/DescriptionList.docs.mdx +98 -0
- package/src/components/DescriptionList/DescriptionList.props.ts +20 -0
- package/src/components/DescriptionList/DescriptionList.stories.tsx +154 -0
- package/src/components/DescriptionList/DescriptionList.tsx +64 -0
- package/src/components/DescriptionList/DescriptionListItem.props.ts +19 -0
- package/src/components/DescriptionList/DescriptionListItem.tsx +101 -0
- package/src/components/DescriptionList/index.ts +4 -0
- package/src/components/Divider/Divider.props.ts +2 -2
- package/src/components/Divider/Divider.stories.tsx +3 -3
- package/src/components/Divider/Divider.tsx +46 -0
- package/src/components/Flex/Flex.docs.mdx +4 -4
- package/src/components/Flex/Flex.props.ts +3 -2
- package/src/components/Flex/Flex.stories.tsx +1 -1
- package/src/components/Grid/Grid.docs.mdx +12 -12
- package/src/components/Grid/Grid.props.ts +2 -2
- package/src/components/Grid/Grid.stories.tsx +2 -2
- package/src/components/IconContainer/IconContainer.docs.mdx +90 -0
- package/src/components/IconContainer/IconContainer.props.ts +17 -0
- package/src/components/IconContainer/IconContainer.stories.tsx +130 -0
- package/src/components/IconContainer/IconContainer.tsx +180 -0
- package/src/components/IconContainer/index.tsx +2 -0
- package/src/components/Icons/CircleIcon.tsx +9 -11
- package/src/components/Input/Input.docs.mdx +3 -3
- package/src/components/Input/Input.props.ts +0 -20
- package/src/components/Input/Input.stories.tsx +0 -6
- package/src/components/Input/Input.tsx +2 -49
- package/src/components/Input/InputField.tsx +0 -7
- package/src/components/Link/Link.props.ts +3 -0
- package/src/components/Link/Link.tsx +12 -6
- package/src/components/List/List.docs.mdx +24 -23
- package/src/components/Modal/Modal.tsx +18 -0
- package/src/components/Radio/Radio.docs.mdx +96 -124
- package/src/components/Radio/Radio.props.ts +3 -1
- package/src/components/Radio/Radio.stories.tsx +47 -0
- package/src/components/Radio/Radio.tsx +10 -7
- package/src/components/Radio/RadioImage.tsx +9 -0
- package/src/components/Radio/RadioTileRoot.tsx +1 -1
- package/src/components/Radio/index.ts +3 -2
- package/src/components/SectionHeader/SectionHeader.tsx +1 -0
- package/src/components/Select/Select.docs.mdx +6 -6
- package/src/components/Select/Select.stories.tsx +7 -7
- package/src/components/Select/SelectOption.tsx +4 -10
- package/src/components/Tabs/Tab.props.ts +16 -0
- package/src/components/Tabs/Tab.tsx +113 -0
- package/src/components/Tabs/TabPanel.props.ts +10 -0
- package/src/components/Tabs/TabPanel.tsx +46 -0
- package/src/components/Tabs/Tabs.context.ts +26 -0
- package/src/components/Tabs/Tabs.docs.mdx +214 -0
- package/src/components/Tabs/Tabs.props.ts +21 -0
- package/src/components/Tabs/Tabs.stories.tsx +270 -0
- package/src/components/Tabs/Tabs.tsx +139 -0
- package/src/components/Tabs/TabsList.props.ts +8 -0
- package/src/components/Tabs/TabsList.tsx +194 -0
- package/src/components/Tabs/index.ts +8 -0
- package/src/components/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
- package/src/components/UnstyledIconButton/UnstyledIconButton.tsx +9 -3
- package/src/components/index.ts +4 -0
- package/src/core/themes.ts +57 -1
- package/src/tokens/color.ts +44 -40
- package/src/tokens/components/dark/alert.ts +13 -0
- package/src/tokens/components/dark/button.ts +1 -0
- package/src/tokens/components/dark/checkbox.ts +4 -1
- package/src/tokens/components/dark/icon-button.ts +10 -3
- package/src/tokens/components/dark/index.ts +1 -0
- package/src/tokens/components/dark/link.ts +5 -0
- package/src/tokens/components/dark/progress-bar.ts +41 -0
- package/src/tokens/components/dark/radio.ts +1 -1
- package/src/tokens/components/dark/tabs.ts +2 -0
- package/src/tokens/components/light/alert.ts +13 -0
- package/src/tokens/components/light/badge.ts +1 -1
- package/src/tokens/components/light/button.ts +1 -0
- package/src/tokens/components/light/checkbox.ts +6 -3
- package/src/tokens/components/light/icon-button.ts +8 -1
- package/src/tokens/components/light/index.ts +1 -0
- package/src/tokens/components/light/link.ts +5 -0
- package/src/tokens/components/light/progress-bar.ts +41 -0
- package/src/tokens/components/light/radio.ts +3 -3
- package/src/tokens/components/light/tabs.ts +2 -0
- package/src/tokens/index.ts +1 -0
- package/src/tokens/layout.ts +24 -15
- package/src/tokens/motion.ts +23 -0
- package/src/tokens/primitive.ts +19 -0
- package/src/tokens/semantic-dark.ts +26 -24
- package/src/tokens/semantic-light.ts +18 -16
- package/src/types/values.ts +3 -1
- package/src/utils/formatThousands.ts +14 -0
- package/src/utils/index.ts +1 -0
- package/docs/assets/react-native-pig.png +0 -0
- package/docs/components/AdvancedRadioExample.tsx +0 -126
|
@@ -18,7 +18,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
18
18
|
gap: theme.components.radio.gap,
|
|
19
19
|
padding: theme.components.radio.tile.padding,
|
|
20
20
|
borderWidth: theme.components.radio.tile.borderWidth,
|
|
21
|
-
borderColor: theme.color.border.
|
|
21
|
+
borderColor: theme.color.border.strong,
|
|
22
22
|
borderRadius: theme.components.radio.tile.borderRadius,
|
|
23
23
|
backgroundColor: theme.color.surface.neutral.strong,
|
|
24
24
|
variants: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { default as Radio, RadioIndicator, RadioLabel,
|
|
1
|
+
export { default as Radio, RadioIcon, RadioIndicator, RadioLabel, RadioTile } from './Radio';
|
|
2
|
+
export type { default as RadioProps } from './Radio.props';
|
|
2
3
|
export { default as RadioGroup } from './RadioGroup';
|
|
3
4
|
export { default as RadioGroupTextContent } from './RadioGroupTextContent';
|
|
5
|
+
export { default as RadioImage } from './RadioImage';
|
|
4
6
|
export { default as RadioTextContent } from './RadioTextContent';
|
|
5
|
-
export type { default as RadioProps } from './Radio.props';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as Radio, RadioIndicator, RadioLabel,
|
|
1
|
+
export { default as Radio, RadioIcon, RadioIndicator, RadioLabel, RadioTile } from './Radio';
|
|
2
2
|
export { default as RadioGroup } from './RadioGroup';
|
|
3
3
|
export { default as RadioGroupTextContent } from './RadioGroupTextContent';
|
|
4
|
+
export { default as RadioImage } from './RadioImage';
|
|
4
5
|
export { default as RadioTextContent } from './RadioTextContent';
|
|
@@ -22,13 +22,7 @@ const SelectOption = ({ label, value, leadingIcon: LeftIcon, trailingIcon: Right
|
|
|
22
22
|
close();
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
return (_jsxs(Pressable, { onPress: handlePress, disabled: disabled, style: ({ pressed }) => [styles.container, pressed && styles.pressed], children: [!!LeftIcon && (_jsx(View, { children: (()
|
|
26
|
-
const IconAny = Icon;
|
|
27
|
-
return _jsx(IconAny, { style: styles.icon, as: LeftIcon });
|
|
28
|
-
})() })), _jsx(View, { style: styles.labelContainer, children: _jsx(BodyText, { children: label }) }), isSelected && (_jsx(View, { children: _jsx(TickSmallIcon, { style: styles.icon }) })), !!RightIcon && !isSelected && (_jsx(View, { children: (() => {
|
|
29
|
-
const IconAny = Icon;
|
|
30
|
-
return _jsx(IconAny, { style: styles.icon, as: RightIcon });
|
|
31
|
-
})() }))] }));
|
|
25
|
+
return (_jsxs(Pressable, { onPress: handlePress, disabled: disabled, style: ({ pressed }) => [styles.container, pressed && styles.pressed], children: [!!LeftIcon && (_jsx(View, { children: _jsx(Icon, { as: LeftIcon, style: styles.icon }) })), _jsx(View, { style: styles.labelContainer, children: _jsx(BodyText, { children: label }) }), isSelected && (_jsx(View, { children: _jsx(Icon, { as: TickSmallIcon, style: styles.icon }) })), !!RightIcon && !isSelected && (_jsx(View, { children: _jsx(Icon, { as: RightIcon, style: styles.icon }) }))] }));
|
|
32
26
|
};
|
|
33
27
|
const styles = StyleSheet.create(theme => ({
|
|
34
28
|
container: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type TabProps from './Tab.props';
|
|
2
|
+
declare const PressableTab: import("react").ForwardRefExoticComponent<TabProps & {
|
|
3
|
+
states?: {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
} & Omit<import("react-native").PressableProps, "children"> & {
|
|
8
|
+
tabIndex?: 0 | -1 | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
children?: import("react").ReactNode | (({ hovered, pressed, focused, focusVisible, disabled, }: {
|
|
11
|
+
hovered?: boolean | undefined;
|
|
12
|
+
pressed?: boolean | undefined;
|
|
13
|
+
focused?: boolean | undefined;
|
|
14
|
+
focusVisible?: boolean | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
}) => import("react").ReactNode);
|
|
17
|
+
} & import("react").RefAttributes<unknown>>;
|
|
18
|
+
export default PressableTab;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useRef } from 'react';
|
|
3
|
+
import { Platform, Pressable, View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
import { DetailText } from '../DetailText';
|
|
6
|
+
import { Icon } from '../Icon';
|
|
7
|
+
import { useTabsContext } from './Tabs.context';
|
|
8
|
+
import { createPressable } from '@gluestack-ui/pressable';
|
|
9
|
+
const Tab = ({ value, children, icon, disabled, style, states, ...props }) => {
|
|
10
|
+
const { value: active, select, size, disabled: allDisabled, registerTabLayout, } = useTabsContext();
|
|
11
|
+
const { active: pressed } = states || { active: false };
|
|
12
|
+
const isActive = active === value;
|
|
13
|
+
styles.useVariants({ size, pressed });
|
|
14
|
+
const ref = useRef(null);
|
|
15
|
+
const handlePress = () => {
|
|
16
|
+
if (disabled || allDisabled)
|
|
17
|
+
return;
|
|
18
|
+
select(value);
|
|
19
|
+
};
|
|
20
|
+
const handleLayout = useCallback((e) => {
|
|
21
|
+
const { x, y, width, height } = e.nativeEvent.layout;
|
|
22
|
+
registerTabLayout(value, { x, y, width, height });
|
|
23
|
+
}, [value, registerTabLayout]);
|
|
24
|
+
return (_jsx(Pressable, { ref: ref, accessibilityRole: "tab", accessibilityState: { selected: isActive, disabled: !!(disabled || allDisabled) }, onPress: handlePress, onLayout: handleLayout, style: [styles.tab, style], ...(Platform.OS === 'web'
|
|
25
|
+
? { id: `tab-${value}`, 'aria-controls': `tabpanel-${value}` }
|
|
26
|
+
: null), ...props, children: _jsxs(View, { style: styles.content, children: [icon ? _jsx(Icon, { as: icon }) : null, _jsx(DetailText, { size: size, children: children })] }) }));
|
|
27
|
+
};
|
|
28
|
+
Tab.displayName = 'Tab';
|
|
29
|
+
const styles = StyleSheet.create(theme => ({
|
|
30
|
+
tab: {
|
|
31
|
+
position: 'relative',
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
paddingHorizontal: theme.components.tabs.item.paddingHorizontal,
|
|
36
|
+
paddingVertical: theme.components.tabs.item.paddingVertical,
|
|
37
|
+
_web: {
|
|
38
|
+
_hover: {
|
|
39
|
+
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
40
|
+
},
|
|
41
|
+
'_focus-visible': {
|
|
42
|
+
...theme.helpers.focusVisible,
|
|
43
|
+
outlineOffset: -2,
|
|
44
|
+
borderRadius: theme.borderRadius.sm,
|
|
45
|
+
},
|
|
46
|
+
_active: {
|
|
47
|
+
backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
variants: {
|
|
51
|
+
size: {
|
|
52
|
+
md: { height: theme.components.tabs.md.height },
|
|
53
|
+
lg: { height: theme.components.tabs.lg.height },
|
|
54
|
+
},
|
|
55
|
+
pressed: {
|
|
56
|
+
true: {
|
|
57
|
+
backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
|
|
58
|
+
},
|
|
59
|
+
false: {},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
content: {
|
|
64
|
+
flexDirection: 'row',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
gap: theme.components.tabs.item.gap,
|
|
67
|
+
},
|
|
68
|
+
badge: {
|
|
69
|
+
marginLeft: theme.space[25],
|
|
70
|
+
},
|
|
71
|
+
}));
|
|
72
|
+
const PressableTab = createPressable({ Root: Tab });
|
|
73
|
+
PressableTab.displayName = 'Tab';
|
|
74
|
+
export default PressableTab;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
|
+
export interface TabProps extends PressableProps {
|
|
4
|
+
/** Unique value for the tab */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Tab label */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Optional leading icon */
|
|
9
|
+
icon?: ComponentType<any>;
|
|
10
|
+
/** Whether the tab is disabled */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
style?: ViewProps['style'];
|
|
13
|
+
}
|
|
14
|
+
export default TabProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Platform, View } from 'react-native';
|
|
4
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
+
import { useTabsContext } from './Tabs.context';
|
|
6
|
+
const TabPanel = ({ value, children, keepMounted, style, ...rest }) => {
|
|
7
|
+
const { value: active } = useTabsContext();
|
|
8
|
+
const isActive = active === value;
|
|
9
|
+
if (!isActive && !keepMounted)
|
|
10
|
+
return null;
|
|
11
|
+
styles.useVariants({ active: isActive });
|
|
12
|
+
return (_jsx(View, { ...(Platform.OS === 'web'
|
|
13
|
+
? {
|
|
14
|
+
id: `tabpanel-${value}`,
|
|
15
|
+
role: 'tabpanel',
|
|
16
|
+
'aria-labelledby': `tab-${value}`,
|
|
17
|
+
hidden: !isActive || undefined,
|
|
18
|
+
}
|
|
19
|
+
: { accessibilityRole: 'summary' }), importantForAccessibility: isActive ? undefined : 'no-hide-descendants', accessibilityElementsHidden: isActive ? undefined : true, style: [styles.panel, style], ...rest, children: children }));
|
|
20
|
+
};
|
|
21
|
+
const styles = StyleSheet.create(theme => ({
|
|
22
|
+
panel: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
width: '100%',
|
|
25
|
+
paddingTop: theme.space[100],
|
|
26
|
+
variants: {
|
|
27
|
+
active: {
|
|
28
|
+
true: { display: 'flex' },
|
|
29
|
+
false: { display: 'none' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
export default memo(TabPanel);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
2
|
+
export interface TabsContextValue {
|
|
3
|
+
value: string | undefined;
|
|
4
|
+
size: 'md' | 'lg';
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
select: (value: string) => void;
|
|
7
|
+
registerTabLayout: (value: string, layout: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
getTabLayout: (value: string) => {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
} | undefined;
|
|
19
|
+
indicatorXSV: SharedValue<number>;
|
|
20
|
+
indicatorSizeSV: SharedValue<number>;
|
|
21
|
+
}
|
|
22
|
+
export declare const TabsContext: import("react").Context<TabsContextValue | undefined>;
|
|
23
|
+
export declare const useTabsContext: () => TabsContextValue;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const TabsContext = createContext(undefined);
|
|
3
|
+
export const useTabsContext = () => {
|
|
4
|
+
const ctx = useContext(TabsContext);
|
|
5
|
+
if (!ctx)
|
|
6
|
+
throw new Error('Tab / TabPanel must be used within Tabs');
|
|
7
|
+
return ctx;
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type TabsProps from './Tabs.props';
|
|
2
|
+
declare const Tabs: {
|
|
3
|
+
({ value: controlledValue, defaultValue, onValueChange, size, disabled, children, withPanels, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export default Tabs;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, isValidElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { Easing, useSharedValue, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import { TabsContext } from './Tabs.context';
|
|
6
|
+
const Tabs = ({ value: controlledValue, defaultValue, onValueChange, size = 'md', disabled, children, withPanels, ...props }) => {
|
|
7
|
+
// Collect child tab values
|
|
8
|
+
const tabValues = useMemo(() => {
|
|
9
|
+
const vals = [];
|
|
10
|
+
const walk = (node) => {
|
|
11
|
+
Children.forEach(node, child => {
|
|
12
|
+
if (!isValidElement(child))
|
|
13
|
+
return;
|
|
14
|
+
const props = child.props;
|
|
15
|
+
const type = child.type;
|
|
16
|
+
if (type?.displayName === 'Tab' && typeof props?.value === 'string') {
|
|
17
|
+
vals.push(props.value);
|
|
18
|
+
}
|
|
19
|
+
if (props?.children)
|
|
20
|
+
walk(props.children);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
walk(children);
|
|
24
|
+
return vals;
|
|
25
|
+
}, [children]);
|
|
26
|
+
const getInitial = () => {
|
|
27
|
+
if (controlledValue !== undefined)
|
|
28
|
+
return controlledValue;
|
|
29
|
+
if (defaultValue)
|
|
30
|
+
return defaultValue;
|
|
31
|
+
return tabValues[0];
|
|
32
|
+
};
|
|
33
|
+
const [uncontrolled, setUncontrolled] = useState(getInitial);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (controlledValue !== undefined)
|
|
36
|
+
setUncontrolled(controlledValue);
|
|
37
|
+
}, [controlledValue]);
|
|
38
|
+
// Ensure value remains valid if tabs change
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setUncontrolled(prev => {
|
|
41
|
+
if (!prev)
|
|
42
|
+
return tabValues[0];
|
|
43
|
+
if (!tabValues.includes(prev))
|
|
44
|
+
return tabValues[0];
|
|
45
|
+
return prev;
|
|
46
|
+
});
|
|
47
|
+
}, [tabValues.join('|')]);
|
|
48
|
+
const currentValue = controlledValue !== undefined ? controlledValue : uncontrolled;
|
|
49
|
+
const select = useCallback((val) => {
|
|
50
|
+
if (disabled)
|
|
51
|
+
return;
|
|
52
|
+
if (controlledValue === undefined)
|
|
53
|
+
setUncontrolled(val);
|
|
54
|
+
onValueChange?.(val);
|
|
55
|
+
}, [controlledValue, disabled, onValueChange]);
|
|
56
|
+
// Indicator shared values (declared early so registerTabLayout can reference)
|
|
57
|
+
const indicatorX = useSharedValue(0);
|
|
58
|
+
const indicatorSize = useSharedValue(0);
|
|
59
|
+
// Layout registry for animated indicator
|
|
60
|
+
const layoutsRef = useRef(new Map());
|
|
61
|
+
const prevValueRef = useRef(undefined);
|
|
62
|
+
const initialisedRef = useRef(false);
|
|
63
|
+
const registerTabLayout = useCallback((value, layout) => {
|
|
64
|
+
layoutsRef.current.set(value, layout);
|
|
65
|
+
const active = controlledValue !== undefined ? controlledValue : uncontrolled;
|
|
66
|
+
if (!active)
|
|
67
|
+
return;
|
|
68
|
+
// Initial active tab: seed indicator & prevValue so first change animates
|
|
69
|
+
if (!initialisedRef.current && value === active) {
|
|
70
|
+
indicatorX.value = layout.x;
|
|
71
|
+
indicatorSize.value = layout.width;
|
|
72
|
+
prevValueRef.current = active;
|
|
73
|
+
initialisedRef.current = true;
|
|
74
|
+
}
|
|
75
|
+
}, [controlledValue, uncontrolled, indicatorX, indicatorSize]);
|
|
76
|
+
const getTabLayout = useCallback((v) => layoutsRef.current.get(v), []);
|
|
77
|
+
const contextValue = useMemo(() => ({
|
|
78
|
+
value: currentValue,
|
|
79
|
+
size,
|
|
80
|
+
select,
|
|
81
|
+
disabled,
|
|
82
|
+
registerTabLayout,
|
|
83
|
+
getTabLayout,
|
|
84
|
+
indicatorXSV: indicatorX,
|
|
85
|
+
indicatorSizeSV: indicatorSize,
|
|
86
|
+
}), [
|
|
87
|
+
currentValue,
|
|
88
|
+
size,
|
|
89
|
+
select,
|
|
90
|
+
disabled,
|
|
91
|
+
registerTabLayout,
|
|
92
|
+
getTabLayout,
|
|
93
|
+
tabValues,
|
|
94
|
+
indicatorX,
|
|
95
|
+
indicatorSize,
|
|
96
|
+
]);
|
|
97
|
+
// Animate indicator only on value changes after initialisation
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (!currentValue || !initialisedRef.current)
|
|
100
|
+
return;
|
|
101
|
+
if (prevValueRef.current === undefined || prevValueRef.current === currentValue)
|
|
102
|
+
return;
|
|
103
|
+
const layout = getTabLayout(currentValue);
|
|
104
|
+
if (!layout)
|
|
105
|
+
return;
|
|
106
|
+
const cfg = { duration: 250, easing: Easing.out(Easing.ease) };
|
|
107
|
+
indicatorX.value = withTiming(layout.x, cfg);
|
|
108
|
+
indicatorSize.value = withTiming(layout.width, cfg);
|
|
109
|
+
prevValueRef.current = currentValue;
|
|
110
|
+
}, [currentValue, getTabLayout, indicatorX, indicatorSize, tabValues.join('|')]);
|
|
111
|
+
return (_jsx(TabsContext.Provider, { value: contextValue, children: _jsx(View, { ...props, children: children }) }));
|
|
112
|
+
};
|
|
113
|
+
Tabs.displayName = 'Tabs';
|
|
114
|
+
export default Tabs;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
export interface TabsProps extends ViewProps {
|
|
4
|
+
/** Controlled active tab value */
|
|
5
|
+
value?: string;
|
|
6
|
+
/** Uncontrolled initial value */
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
/** Callback when active tab changes */
|
|
9
|
+
onValueChange?: (value: string) => void;
|
|
10
|
+
/** Size variant */
|
|
11
|
+
size?: 'md' | 'lg';
|
|
12
|
+
/** Tabs (Tab components) */
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/** Disable all tabs */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** If true, expect sibling TabPanel components and manage their rendering/ARIA linkage */
|
|
17
|
+
withPanels?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export default TabsProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeftSmallIcon, ChevronRightSmallIcon, } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { Platform, View } from 'react-native';
|
|
5
|
+
import Animated, { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useSharedValue, } from 'react-native-reanimated';
|
|
6
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
7
|
+
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
8
|
+
import { useTabsContext } from './Tabs.context';
|
|
9
|
+
const Indicator = Animated.createAnimatedComponent(View);
|
|
10
|
+
const SCROLL_STEP_RATIO = 0.6;
|
|
11
|
+
const SCROLL_BUTTON_HITSLOP = { top: 10, bottom: 10, left: 10, right: 10 };
|
|
12
|
+
const TabsList = ({ children, style, ...rest }) => {
|
|
13
|
+
const { indicatorSizeSV, indicatorXSV } = useTabsContext();
|
|
14
|
+
const scrollRef = useRef(null);
|
|
15
|
+
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
16
|
+
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
17
|
+
const containerWidthRef = useRef(0);
|
|
18
|
+
const contentWidthRef = useRef(0);
|
|
19
|
+
const scrollX = useSharedValue(0);
|
|
20
|
+
const indicatorStyle = useAnimatedStyle(() => ({
|
|
21
|
+
transform: [{ translateX: indicatorXSV.value }],
|
|
22
|
+
width: indicatorSizeSV.value,
|
|
23
|
+
}));
|
|
24
|
+
const updateScrollState = useCallback(() => {
|
|
25
|
+
const cw = containerWidthRef.current;
|
|
26
|
+
const contentW = contentWidthRef.current;
|
|
27
|
+
const x = scrollX.value;
|
|
28
|
+
const overflow = contentW > cw + 1;
|
|
29
|
+
setCanScrollLeft(overflow && x > 0);
|
|
30
|
+
setCanScrollRight(overflow && x + cw < contentW - 1);
|
|
31
|
+
}, [scrollX]);
|
|
32
|
+
const onLayoutContainer = (e) => {
|
|
33
|
+
containerWidthRef.current = e.nativeEvent.layout.width;
|
|
34
|
+
updateScrollState();
|
|
35
|
+
};
|
|
36
|
+
const onContentSizeChange = (w) => {
|
|
37
|
+
contentWidthRef.current = w;
|
|
38
|
+
updateScrollState();
|
|
39
|
+
};
|
|
40
|
+
const onScrollHandler = useAnimatedScrollHandler({
|
|
41
|
+
onScroll: (e) => {
|
|
42
|
+
scrollX.value = e.contentOffset.x;
|
|
43
|
+
runOnJS(updateScrollState)();
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const scrollBy = (direction) => {
|
|
47
|
+
const viewW = containerWidthRef.current;
|
|
48
|
+
const step = viewW * SCROLL_STEP_RATIO;
|
|
49
|
+
const current = scrollX.value;
|
|
50
|
+
const max = Math.max(0, contentWidthRef.current - viewW);
|
|
51
|
+
const target = Math.max(0, Math.min(current + direction * step, max));
|
|
52
|
+
scrollRef.current?.scrollTo({ x: target, animated: true });
|
|
53
|
+
};
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (Platform.OS === 'web') {
|
|
56
|
+
const handler = () => updateScrollState();
|
|
57
|
+
window.addEventListener('resize', handler);
|
|
58
|
+
return () => window.removeEventListener('resize', handler);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}, [updateScrollState]);
|
|
62
|
+
return (_jsxs(View, { style: [styles.wrapper, style], ...rest, accessibilityRole: "tablist", children: [canScrollLeft && (_jsx(View, { style: [styles.iconButtonWrap, styles.scrollButtonLeft], accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", ...(Platform.OS === 'web' ? { 'aria-hidden': true } : {}), children: _jsx(UnstyledIconButton, { accessibilityLabel: undefined, icon: ChevronLeftSmallIcon, onPress: () => scrollBy(-1), style: styles.iconButton, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", hitSlop: SCROLL_BUTTON_HITSLOP, ...(Platform.OS === 'web' ? { 'aria-hidden': true, tabIndex: -1 } : {}) }) })), _jsx(Animated.ScrollView, { ref: scrollRef, horizontal: true, showsHorizontalScrollIndicator: false, onLayout: onLayoutContainer, onContentSizeChange: onContentSizeChange, onScroll: onScrollHandler, scrollEventThrottle: 16, bounces: false, contentContainerStyle: styles.scrollContent, children: _jsxs(View, { style: styles.container, children: [children, _jsx(Indicator, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.indicator, indicatorStyle] })] }) }), canScrollRight && (_jsx(View, { style: [styles.iconButtonWrap, styles.scrollButtonRight], accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", ...(Platform.OS === 'web' ? { 'aria-hidden': true } : {}), children: _jsx(UnstyledIconButton, { accessibilityLabel: undefined, icon: ChevronRightSmallIcon, onPress: () => scrollBy(1), style: styles.iconButton, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", hitSlop: SCROLL_BUTTON_HITSLOP, ...(Platform.OS === 'web' ? { 'aria-hidden': true, tabIndex: -1 } : {}) }) }))] }));
|
|
63
|
+
};
|
|
64
|
+
TabsList.displayName = 'TabsList';
|
|
65
|
+
const styles = StyleSheet.create(theme => ({
|
|
66
|
+
wrapper: {
|
|
67
|
+
position: 'relative',
|
|
68
|
+
width: '100%',
|
|
69
|
+
borderBottomWidth: theme.components.tabs.divider.borderWidth,
|
|
70
|
+
borderColor: theme.components.tabs.divider.color,
|
|
71
|
+
},
|
|
72
|
+
scrollContent: {
|
|
73
|
+
paddingBottom: 0,
|
|
74
|
+
},
|
|
75
|
+
container: {
|
|
76
|
+
position: 'relative',
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
gap: theme.components.tabs.gap,
|
|
79
|
+
},
|
|
80
|
+
indicator: {
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
height: 6,
|
|
83
|
+
borderTopLeftRadius: theme.components.tabs.item.selected.borderTopRadius,
|
|
84
|
+
borderTopRightRadius: theme.components.tabs.item.selected.borderTopRadius,
|
|
85
|
+
borderBottomLeftRadius: theme.components.tabs.item.selected.borderBottomRadius,
|
|
86
|
+
borderBottomRightRadius: theme.components.tabs.item.selected.borderBottomRadius,
|
|
87
|
+
backgroundColor: theme.color.surface.brand.default,
|
|
88
|
+
bottom: 0,
|
|
89
|
+
left: 0,
|
|
90
|
+
},
|
|
91
|
+
scrollButtonLeft: {
|
|
92
|
+
position: 'absolute',
|
|
93
|
+
left: 0,
|
|
94
|
+
top: '50%',
|
|
95
|
+
transform: [{ translateY: -theme.space[150] }],
|
|
96
|
+
zIndex: 10,
|
|
97
|
+
},
|
|
98
|
+
scrollButtonRight: {
|
|
99
|
+
position: 'absolute',
|
|
100
|
+
right: 0,
|
|
101
|
+
top: '50%',
|
|
102
|
+
transform: [{ translateY: -theme.space[150] }],
|
|
103
|
+
zIndex: 10,
|
|
104
|
+
},
|
|
105
|
+
iconButtonWrap: {},
|
|
106
|
+
iconButton: {
|
|
107
|
+
backgroundColor: theme.color.surface.neutral.subtle,
|
|
108
|
+
width: theme.space[300],
|
|
109
|
+
height: theme.space[300],
|
|
110
|
+
},
|
|
111
|
+
}));
|
|
112
|
+
export default TabsList;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Tab } from './Tab';
|
|
2
|
+
export type { TabProps } from './Tab.props';
|
|
3
|
+
export { default as TabPanel } from './TabPanel';
|
|
4
|
+
export type { TabPanelProps } from './TabPanel.props';
|
|
5
|
+
export { default as Tabs } from './Tabs';
|
|
6
|
+
export type { TabsProps } from './Tabs.props';
|
|
7
|
+
export { default as TabsList } from './TabsList';
|
|
8
|
+
export type { TabsListProps } from './TabsList.props';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UnstyledIconButtonProps } from './UnstyledIconButton.props';
|
|
2
2
|
declare const UnstyledIconButton: {
|
|
3
|
-
({ icon, disabled, pressed, size, inverted, ...props }: UnstyledIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
({ icon, disabled, pressed, size, inverted, iconStyle, ...props }: UnstyledIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default UnstyledIconButton;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createButton } from '@gluestack-ui/button';
|
|
3
|
-
import
|
|
3
|
+
import { useButtonGroupContext } from '../Button/ButtonGroup.context';
|
|
4
4
|
import UnstyledIconButtonIconComponent from './UnstyledIconButtonIcon';
|
|
5
|
+
import UnstyledIconButtonRootComponent from './UnstyledIconButtonRoot';
|
|
5
6
|
import UnstyledIconButtonSpinerComponent from './UnstyledIconButtonSpinner';
|
|
6
|
-
import { useButtonGroupContext } from '../Button/ButtonGroup.context';
|
|
7
7
|
const UnstyledIconButtonComponent = createButton({
|
|
8
8
|
Root: UnstyledIconButtonRootComponent,
|
|
9
9
|
Icon: UnstyledIconButtonIconComponent,
|
|
@@ -15,12 +15,12 @@ const UnstyledIconButtonSpinner = UnstyledIconButtonComponent.Spinner;
|
|
|
15
15
|
const UnstyledIconButtonIcon = UnstyledIconButtonComponent.Icon;
|
|
16
16
|
UnstyledIconButtonSpinner.displayName = 'UnstyledIconButtonSpinner';
|
|
17
17
|
UnstyledIconButtonIcon.displayName = 'UnstyledIconButtonIcon';
|
|
18
|
-
const UnstyledIconButton = ({ icon, disabled = false, pressed, size = 'md', inverted = false, ...props }) => {
|
|
18
|
+
const UnstyledIconButton = ({ icon, disabled = false, pressed, size = 'md', inverted = false, iconStyle, ...props }) => {
|
|
19
19
|
const { disabled: groupDisabled, loading: groupLoading } = useButtonGroupContext();
|
|
20
20
|
const { loading } = props;
|
|
21
21
|
const isLoading = loading ?? groupLoading;
|
|
22
22
|
const buttonDisabled = isLoading || (disabled ?? groupDisabled);
|
|
23
|
-
return (_jsx(UnstyledIconButtonComponent, { ...props, size: size, inverted: inverted, isDisabled: buttonDisabled, isPressed: pressed, icon: icon, children: loading ? _jsx(UnstyledIconButtonSpinner, {}) : _jsx(UnstyledIconButtonIcon, { as: icon }) }));
|
|
23
|
+
return (_jsx(UnstyledIconButtonComponent, { ...props, size: size, inverted: inverted, isDisabled: buttonDisabled, isPressed: pressed, icon: icon, children: loading ? (_jsx(UnstyledIconButtonSpinner, {})) : (_jsx(UnstyledIconButtonIcon, { as: icon, style: iconStyle })) }));
|
|
24
24
|
};
|
|
25
25
|
UnstyledIconButton.displayName = 'UnstyledIconButton';
|
|
26
26
|
export default UnstyledIconButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
|
-
import type { PressableProps } from 'react-native';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
3
|
export type UnstyledIconButtonProps = {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
pressed?: boolean;
|
|
@@ -8,4 +8,5 @@ export type UnstyledIconButtonProps = {
|
|
|
8
8
|
size?: 'sm' | 'md';
|
|
9
9
|
inverted?: boolean;
|
|
10
10
|
children?: React.ReactNode;
|
|
11
|
+
iconStyle?: ViewProps['style'];
|
|
11
12
|
} & PressableProps;
|
|
@@ -8,6 +8,8 @@ export * from './Button';
|
|
|
8
8
|
export * from './Card';
|
|
9
9
|
export * from './Center';
|
|
10
10
|
export * from './Checkbox';
|
|
11
|
+
export * from './CurrencyInput';
|
|
12
|
+
export * from './DescriptionList';
|
|
11
13
|
export * from './DetailText';
|
|
12
14
|
export * from './Divider';
|
|
13
15
|
export * from './Flex';
|
|
@@ -18,6 +20,7 @@ export * from './Helper';
|
|
|
18
20
|
export * from './HTMLElements';
|
|
19
21
|
export * from './Icon';
|
|
20
22
|
export * from './IconButton';
|
|
23
|
+
export * from './IconContainer';
|
|
21
24
|
export * from './InlineLink';
|
|
22
25
|
export * from './Input';
|
|
23
26
|
export * from './Label';
|
|
@@ -31,6 +34,7 @@ export * from './Select';
|
|
|
31
34
|
export * from './Skeleton';
|
|
32
35
|
export * from './Spinner';
|
|
33
36
|
export * from './Switch';
|
|
37
|
+
export * from './Tabs';
|
|
34
38
|
export * from './Textarea';
|
|
35
39
|
export * from './ToggleButtonCard';
|
|
36
40
|
export { FlatList, Image, KeyboardAvoidingView, ScrollView, SectionList, StatusBar, View, } from 'react-native';
|
|
@@ -9,6 +9,8 @@ export * from './Button';
|
|
|
9
9
|
export * from './Card';
|
|
10
10
|
export * from './Center';
|
|
11
11
|
export * from './Checkbox';
|
|
12
|
+
export * from './CurrencyInput';
|
|
13
|
+
export * from './DescriptionList';
|
|
12
14
|
export * from './DetailText';
|
|
13
15
|
export * from './Divider';
|
|
14
16
|
export * from './Flex';
|
|
@@ -19,6 +21,7 @@ export * from './Helper';
|
|
|
19
21
|
export * from './HTMLElements';
|
|
20
22
|
export * from './Icon';
|
|
21
23
|
export * from './IconButton';
|
|
24
|
+
export * from './IconContainer';
|
|
22
25
|
export * from './InlineLink';
|
|
23
26
|
export * from './Input';
|
|
24
27
|
export * from './Label';
|
|
@@ -32,6 +35,7 @@ export * from './Select';
|
|
|
32
35
|
export * from './Skeleton';
|
|
33
36
|
export * from './Spinner';
|
|
34
37
|
export * from './Switch';
|
|
38
|
+
export * from './Tabs';
|
|
35
39
|
export * from './Textarea';
|
|
36
40
|
export * from './ToggleButtonCard';
|
|
37
41
|
export { FlatList, Image, KeyboardAvoidingView, ScrollView, SectionList, StatusBar, View, } from 'react-native';
|