@utilitywarehouse/hearth-react-native 0.12.0 → 0.14.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +22 -0
- package/build/components/Accordion/AccordionTrigger.js +1 -1
- package/build/components/BodyText/index.d.ts +1 -0
- package/build/components/Checkbox/CheckboxGroup.context.d.ts +2 -0
- package/build/components/Checkbox/CheckboxGroup.js +5 -5
- package/build/components/Checkbox/CheckboxIndicator.js +3 -3
- package/build/components/Checkbox/CheckboxTextContent.js +0 -1
- package/build/components/Checkbox/CheckboxTileRoot.js +9 -1
- package/build/components/DatePicker/DatePickerDay.js +3 -3
- package/build/components/FormField/FormField.d.ts +5 -5
- package/build/components/List/List.context.d.ts +2 -0
- package/build/components/List/List.context.js +2 -0
- package/build/components/List/List.js +19 -15
- package/build/components/List/ListAction/ListAction.js +3 -2
- package/build/components/List/ListAction/ListAction.props.d.ts +0 -1
- package/build/components/List/ListItem/ListItem.props.d.ts +4 -1
- package/build/components/List/ListItem/ListItemHeading.d.ts +13 -0
- package/build/components/List/ListItem/ListItemHeading.js +12 -0
- package/build/components/List/ListItem/ListItemHelperText.d.ts +2 -2
- package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
- package/build/components/List/ListItem/ListItemRoot.js +7 -6
- package/build/components/List/ListItem/index.d.ts +1 -1
- package/build/components/List/ListItem/index.js +1 -1
- package/build/components/PillGroup/Pill.js +2 -2
- package/build/components/Radio/RadioGroup.context.d.ts +2 -0
- package/build/components/Radio/RadioGroup.js +1 -1
- package/build/components/Radio/RadioIndicator.js +3 -3
- package/build/components/Radio/RadioTextContent.js +0 -1
- package/build/components/Radio/RadioTileRoot.js +9 -1
- package/build/components/RadioCard/RadioCardIndicator.js +3 -3
- package/build/components/RadioCard/RadioCardRoot.js +3 -3
- package/build/components/Tabs/Tab.js +5 -5
- package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
- package/build/components/ToggleButtonCard/ToggleButtonCardRoot.js +3 -3
- package/build/components/UnstyledIconButton/UnstyledIconButtonRoot.js +1 -1
- package/build/components/VerificationInput/VerificationInput.d.ts +6 -0
- package/build/components/VerificationInput/VerificationInput.js +35 -0
- package/build/components/VerificationInput/VerificationInput.props.d.ts +49 -0
- package/build/components/VerificationInput/VerificationInput.props.js +1 -0
- package/build/components/VerificationInput/VerificationInputSlot.d.ts +9 -0
- package/build/components/VerificationInput/VerificationInputSlot.js +72 -0
- package/build/components/VerificationInput/index.d.ts +4 -0
- package/build/components/VerificationInput/index.js +3 -0
- package/build/components/VerificationInput/useVerificationInput.d.ts +14 -0
- package/build/components/VerificationInput/useVerificationInput.js +58 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/docs/components/AllComponents.web.tsx +9 -0
- package/package.json +10 -11
- package/src/components/Accordion/Accordion.figma.tsx +23 -0
- package/src/components/Accordion/AccordionItemRoot.figma.tsx +47 -0
- package/src/components/Accordion/AccordionTrigger.tsx +1 -1
- package/src/components/Alert/Alert.figma.tsx +47 -0
- package/src/components/Avatar/Avatar.figma.tsx +33 -0
- package/src/components/Badge/Badge.figma.tsx +48 -24
- package/src/components/Banner/Banner.figma.tsx +15 -0
- package/src/components/Banner/BannerIllustration.figma.tsx +30 -0
- package/src/components/BodyText/index.ts +1 -0
- package/src/components/BottomSheet/BottomSheetModal.figma.tsx +20 -0
- package/src/components/Button/Button.figma.tsx +60 -229
- package/src/components/Card/Card.figma.tsx +43 -71
- package/src/components/Card/CardAction/CardAction.figma.tsx +44 -0
- package/src/components/Card/CardAction/CardAction.stories.tsx +1 -1
- package/src/components/Carousel/Carousel.figma.tsx +19 -0
- package/src/components/Checkbox/Checkbox.figma.tsx +26 -41
- package/src/components/Checkbox/CheckboxGroup.context.ts +1 -0
- package/src/components/Checkbox/CheckboxGroup.figma.tsx +20 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +7 -8
- package/src/components/Checkbox/CheckboxImage.figma.tsx +27 -0
- package/src/components/Checkbox/CheckboxIndicator.tsx +3 -3
- package/src/components/Checkbox/CheckboxTextContent.tsx +0 -1
- package/src/components/Checkbox/CheckboxTileRoot.figma.tsx +32 -0
- package/src/components/Checkbox/CheckboxTileRoot.tsx +9 -1
- package/src/components/CurrencyInput/CurrencyInput.figma.tsx +56 -0
- package/src/components/DateInput/DateInput.figma.tsx +75 -0
- package/src/components/DatePicker/DatePickerCalendar.figma.tsx +34 -0
- package/src/components/DatePicker/DatePickerDay.tsx +3 -3
- package/src/components/DatePickerInput/DatePickerInput.figma.tsx +62 -0
- package/src/components/DescriptionList/DescriptionList.figma.tsx +23 -0
- package/src/components/Divider/Divider.figma.tsx +23 -18
- package/src/components/ExpandableCard/ExpandableCard.figma.tsx +54 -0
- package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +23 -0
- package/src/components/FormField/FormField.figma.tsx +23 -0
- package/src/components/Helper/HelperText.figma.tsx +23 -0
- package/src/components/IconButton/IconButton.figma.tsx +55 -161
- package/src/components/IconContainer/IconContainer.figma.tsx +50 -0
- package/src/components/InlineLink/InlineLink.figma.tsx +33 -0
- package/src/components/Input/Input.figma.tsx +52 -110
- package/src/components/Label/Label.figma.tsx +24 -0
- package/src/components/Link/Link.figma.tsx +42 -0
- package/src/components/List/List.context.ts +4 -0
- package/src/components/List/List.docs.mdx +30 -24
- package/src/components/List/List.figma.tsx +29 -108
- package/src/components/List/List.stories.tsx +26 -1
- package/src/components/List/List.tsx +26 -19
- package/src/components/List/ListAction/ListAction.figma.tsx +29 -0
- package/src/components/List/ListAction/ListAction.props.ts +0 -1
- package/src/components/List/ListAction/ListAction.tsx +3 -2
- package/src/components/List/ListItem/ListItem.figma.tsx +40 -220
- package/src/components/List/ListItem/ListItem.props.ts +4 -1
- package/src/components/List/ListItem/ListItemHeading.tsx +20 -0
- package/src/components/List/ListItem/ListItemHelperText.tsx +2 -3
- package/src/components/List/ListItem/ListItemLeadingContent.figma.tsx +29 -0
- package/src/components/List/ListItem/ListItemRoot.tsx +11 -6
- package/src/components/List/ListItem/ListItemTrailingContent.figma.tsx +27 -0
- package/src/components/List/ListItem/index.ts +1 -1
- package/src/components/Menu/Menu.figma.tsx +30 -0
- package/src/components/Menu/MenuItem.figma.tsx +31 -0
- package/src/components/Modal/Modal.docs.mdx +23 -20
- package/src/components/Modal/Modal.figma.tsx +56 -0
- package/src/components/PillGroup/Pill.figma.tsx +25 -0
- package/src/components/PillGroup/Pill.tsx +3 -3
- package/src/components/PillGroup/PillGroup.figma.tsx +21 -0
- package/src/components/ProgressStepper/ProgressStep.figma.tsx +30 -0
- package/src/components/ProgressStepper/ProgressStepper.figma.tsx +20 -0
- package/src/components/Radio/Radio.figma.tsx +22 -42
- package/src/components/Radio/Radio.stories.tsx +24 -0
- package/src/components/Radio/RadioGroup.context.ts +1 -0
- package/src/components/Radio/RadioGroup.figma.tsx +54 -0
- package/src/components/Radio/RadioGroup.tsx +2 -2
- package/src/components/Radio/RadioImage.figma.tsx +27 -0
- package/src/components/Radio/RadioIndicator.tsx +3 -3
- package/src/components/Radio/RadioTextContent.tsx +0 -1
- package/src/components/Radio/RadioTileRoot.figma.tsx +31 -0
- package/src/components/Radio/RadioTileRoot.tsx +9 -1
- package/src/components/RadioCard/RadioCardIndicator.tsx +3 -3
- package/src/components/RadioCard/RadioCardRoot.tsx +3 -3
- package/src/components/SectionHeader/SectionHeader.figma.tsx +30 -16
- package/src/components/Select/Select.figma.tsx +55 -0
- package/src/components/Select/SelectOption.figma.tsx +36 -0
- package/src/components/Spinner/Spinner.figma.tsx +20 -12
- package/src/components/Switch/Switch.figma.tsx +31 -23
- package/src/components/Tabs/Tab.tsx +5 -5
- package/src/components/Tabs/Tabs.figma.tsx +29 -0
- package/src/components/ThemedImage/ThemedImage.stories.tsx +1 -1
- package/src/components/Toast/ToastItem.figma.tsx +22 -0
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
- package/src/components/ToggleButtonCard/ToggleButtonCardRoot.tsx +3 -3
- package/src/components/UnstyledIconButton/UnstyledIconButton.figma.tsx +49 -0
- package/src/components/UnstyledIconButton/UnstyledIconButtonRoot.tsx +1 -1
- package/src/components/VerificationInput/VerificationInput.docs.mdx +68 -0
- package/src/components/VerificationInput/VerificationInput.props.ts +52 -0
- package/src/components/VerificationInput/VerificationInput.stories.tsx +140 -0
- package/src/components/VerificationInput/VerificationInput.tsx +89 -0
- package/src/components/VerificationInput/VerificationInputSlot.tsx +94 -0
- package/src/components/VerificationInput/index.ts +5 -0
- package/src/components/VerificationInput/useVerificationInput.ts +72 -0
- package/src/components/index.ts +1 -0
- package/build/components/List/ListItem/ListItemText.d.ts +0 -6
- package/build/components/List/ListItem/ListItemText.js +0 -7
- package/src/components/Checkbox/CheckboxIndicator.figma.tsx +0 -19
- package/src/components/List/ListItem/ListItemText.tsx +0 -14
- package/src/components/Radio/RadioIndicator.figma.tsx +0 -21
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @utilitywarehouse/hearth-react-native@0.
|
|
2
|
+
> @utilitywarehouse/hearth-react-native@0.14.0 lint /home/runner/work/hearth/hearth/packages/react-native
|
|
3
3
|
> TIMING=1 eslint --max-warnings 0
|
|
4
4
|
|
|
5
5
|
Rule | Time (ms) | Relative
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @utilitywarehouse/hearth-react-native
|
|
2
2
|
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#741](https://github.com/utilitywarehouse/hearth/pull/741) [`acf081a`](https://github.com/utilitywarehouse/hearth/commit/acf081a8e10722ea1e9106f8111f5d9548815646) Thanks [@jordmccord](https://github.com/jordmccord)! - Renames `ListItemText` to `ListItemHeading` (`ListItemText` is deprecated and will be removed in a later release)
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#741](https://github.com/utilitywarehouse/hearth/pull/741) [`acf081a`](https://github.com/utilitywarehouse/hearth/commit/acf081a8e10722ea1e9106f8111f5d9548815646) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `truncateHeading` and `truncateHelperText` props to `ListItem`
|
|
12
|
+
|
|
13
|
+
- [#740](https://github.com/utilitywarehouse/hearth/pull/740) [`16f1ce0`](https://github.com/utilitywarehouse/hearth/commit/16f1ce073d62c4e72693e7e07233a7498c0d0602) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes custom `ListItem` first child border issue
|
|
14
|
+
|
|
15
|
+
- [#737](https://github.com/utilitywarehouse/hearth/pull/737) [`85f76db`](https://github.com/utilitywarehouse/hearth/commit/85f76dbbf7c90db96d7e89e5f5e353a772dd84c2) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes `Radio` and `Checkbox` Groups row direction issue
|
|
16
|
+
|
|
17
|
+
- [#741](https://github.com/utilitywarehouse/hearth/pull/741) [`acf081a`](https://github.com/utilitywarehouse/hearth/commit/acf081a8e10722ea1e9106f8111f5d9548815646) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes `ListItemText` and `ListItemHelperText` prop types
|
|
18
|
+
|
|
19
|
+
## 0.13.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#682](https://github.com/utilitywarehouse/hearth/pull/682) [`57d6c71`](https://github.com/utilitywarehouse/hearth/commit/57d6c71baedeaa0bc914ff5163e73bbf4281aa79) Thanks [@Utakato](https://github.com/Utakato)! - Add Verification Input component
|
|
24
|
+
|
|
3
25
|
## 0.12.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -25,7 +25,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
25
25
|
_hover: {
|
|
26
26
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
27
27
|
},
|
|
28
|
-
'_focus-visible': theme.helpers.focusVisible,
|
|
28
|
+
// '_focus-visible': theme.helpers.focusVisible,
|
|
29
29
|
_active: {
|
|
30
30
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
|
|
31
31
|
},
|
|
@@ -2,9 +2,11 @@ export declare const CheckboxGroupContext: import("react").Context<{
|
|
|
2
2
|
disabled?: boolean;
|
|
3
3
|
validationStatus?: "valid" | "invalid" | "initial";
|
|
4
4
|
type?: "default" | "tile";
|
|
5
|
+
direction?: "column" | "row";
|
|
5
6
|
}>;
|
|
6
7
|
export declare const useCheckboxGroupContext: () => {
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
validationStatus?: "valid" | "invalid" | "initial";
|
|
9
10
|
type?: "default" | "tile";
|
|
11
|
+
direction?: "column" | "row";
|
|
10
12
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import { CheckboxGroup as CheckboxGroupComponent } from './Checkbox';
|
|
4
|
-
import { CheckboxGroupContext } from './CheckboxGroup.context';
|
|
5
3
|
import { View } from 'react-native';
|
|
6
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
7
|
-
import CheckboxGroupTextContent from './CheckboxGroupTextContent';
|
|
8
|
-
import { Label } from '../Label';
|
|
9
5
|
import { Helper } from '../Helper';
|
|
6
|
+
import { Label } from '../Label';
|
|
7
|
+
import { CheckboxGroup as CheckboxGroupComponent } from './Checkbox';
|
|
8
|
+
import { CheckboxGroupContext } from './CheckboxGroup.context';
|
|
9
|
+
import CheckboxGroupTextContent from './CheckboxGroupTextContent';
|
|
10
10
|
const CheckboxGroup = ({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
11
|
-
const value = useMemo(() => ({ disabled, validationStatus, type }), [disabled, validationStatus, type]);
|
|
11
|
+
const value = useMemo(() => ({ disabled, validationStatus, type, direction }), [disabled, validationStatus, type, direction]);
|
|
12
12
|
const showHeader = !!label || !!helperText || !!invalidText || !!validText;
|
|
13
13
|
const childrenArray = React.Children.toArray(children);
|
|
14
14
|
const childIsCard = type === 'tile' ||
|
|
@@ -30,9 +30,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
30
30
|
_hover: {
|
|
31
31
|
outlineColor: theme.components.checkbox.outlineColorHover,
|
|
32
32
|
},
|
|
33
|
-
'_focus-within': {
|
|
34
|
-
|
|
35
|
-
},
|
|
33
|
+
// '_focus-within': {
|
|
34
|
+
// ...theme.helpers.focusVisible,
|
|
35
|
+
// },
|
|
36
36
|
_active: {
|
|
37
37
|
outlineColor: theme.components.checkbox.outlineColorActive,
|
|
38
38
|
},
|
|
@@ -2,10 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { useCheckboxContext } from './Checkbox.context';
|
|
5
|
+
import { useCheckboxGroupContext } from './CheckboxGroup.context';
|
|
5
6
|
const CheckboxTileRoot = ({ children }) => {
|
|
7
|
+
const { direction } = useCheckboxGroupContext();
|
|
6
8
|
const { checked } = useCheckboxContext();
|
|
7
9
|
styles.useVariants({
|
|
8
10
|
checked,
|
|
11
|
+
direction,
|
|
9
12
|
});
|
|
10
13
|
return _jsx(View, { style: styles.container, children: children });
|
|
11
14
|
};
|
|
@@ -13,7 +16,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
13
16
|
container: {
|
|
14
17
|
flexDirection: 'row',
|
|
15
18
|
justifyContent: 'flex-start',
|
|
16
|
-
flex: 1,
|
|
17
19
|
alignSelf: 'stretch',
|
|
18
20
|
gap: theme.components.checkbox.gap,
|
|
19
21
|
padding: theme.components.checkbox.tile.padding,
|
|
@@ -29,6 +31,12 @@ const styles = StyleSheet.create(theme => ({
|
|
|
29
31
|
margin: -theme.components.checkbox.tile.borderWidthSelected / 2,
|
|
30
32
|
},
|
|
31
33
|
},
|
|
34
|
+
direction: {
|
|
35
|
+
row: {},
|
|
36
|
+
column: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
32
40
|
},
|
|
33
41
|
},
|
|
34
42
|
}));
|
|
@@ -133,9 +133,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
133
133
|
},
|
|
134
134
|
],
|
|
135
135
|
_web: {
|
|
136
|
-
'_focus-visible': {
|
|
137
|
-
|
|
138
|
-
},
|
|
136
|
+
// '_focus-visible': {
|
|
137
|
+
// ...theme.helpers.focusVisible,
|
|
138
|
+
// },
|
|
139
139
|
_active: {
|
|
140
140
|
backgroundColor: theme.color.interactive.functional.surface.subtle.active,
|
|
141
141
|
},
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { View } from 'react-native';
|
|
2
2
|
import FormFieldProps from './FormField.props';
|
|
3
|
-
export declare const FormFieldComponent: import("@gluestack-ui/form-control/lib/types").IFormControlComponentType<import("react-native").ViewProps, Omit<import("../Helper/Helper.props").default, "validationStatus">, Omit<import("../Helper/Helper.props").default, "validationStatus">, Omit<import("..").IconProps, "as">, unknown, Omit<import("../Label/Label.props").default, "disabled">, unknown, Omit<import("../Helper/Helper.props").default, "validationStatus">, import("
|
|
3
|
+
export declare const FormFieldComponent: import("@gluestack-ui/form-control/lib/types").IFormControlComponentType<import("react-native").ViewProps, Omit<import("../Helper/Helper.props").default, "validationStatus">, Omit<import("../Helper/Helper.props").default, "validationStatus">, Omit<import("..").IconProps, "as">, unknown, Omit<import("../Label/Label.props").default, "disabled">, unknown, Omit<import("../Helper/Helper.props").default, "validationStatus">, import("..").BodyTextProps>;
|
|
4
4
|
export declare const FormFieldLabel: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>> & {
|
|
5
5
|
Text: import("react").ForwardRefExoticComponent<Omit<Omit<import("../Label/Label.props").default, "disabled">, "ref"> & import("react").RefAttributes<Omit<import("../Label/Label.props").default, "disabled">>>;
|
|
6
6
|
};
|
|
7
7
|
export declare const FormFieldLabelText: import("react").ForwardRefExoticComponent<Omit<Omit<import("../Label/Label.props").default, "disabled">, "ref"> & import("react").RefAttributes<Omit<import("../Label/Label.props").default, "disabled">>>;
|
|
8
8
|
export declare const FormFieldHelper: import("react").ForwardRefExoticComponent<Omit<import("../Helper/Helper.props").default, "validationStatus"> & import("react").RefAttributes<Omit<import("../Helper/Helper.props").default, "validationStatus">>> & {
|
|
9
|
-
Text: import("react").ForwardRefExoticComponent<Omit<import("
|
|
9
|
+
Text: import("react").ForwardRefExoticComponent<Omit<import("..").BodyTextProps, "ref"> & import("react").RefAttributes<import("..").BodyTextProps>>;
|
|
10
10
|
};
|
|
11
|
-
export declare const FormFieldHelperText: import("react").ForwardRefExoticComponent<Omit<import("
|
|
11
|
+
export declare const FormFieldHelperText: import("react").ForwardRefExoticComponent<Omit<import("..").BodyTextProps, "ref"> & import("react").RefAttributes<import("..").BodyTextProps>>;
|
|
12
12
|
export declare const FormFieldHelperIcon: {
|
|
13
13
|
(props: import("..").IconProps): import("react/jsx-runtime").JSX.Element;
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
|
16
16
|
export declare const FormFieldValidText: {
|
|
17
|
-
(props: import("
|
|
17
|
+
(props: import("..").BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
displayName: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const FormFieldInvalidText: {
|
|
21
|
-
(props: import("
|
|
21
|
+
(props: import("..").BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
24
24
|
export declare const FormFieldTextContent: typeof View;
|
|
@@ -4,7 +4,8 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { Card } from '../Card';
|
|
6
6
|
import { SectionHeader } from '../SectionHeader';
|
|
7
|
-
import { ListContext } from './List.context';
|
|
7
|
+
import { ListContext, ListFirstItemContext } from './List.context';
|
|
8
|
+
import { ListAction } from './ListAction';
|
|
8
9
|
import { ListItem } from './ListItem';
|
|
9
10
|
const markFirstListItem = (children) => {
|
|
10
11
|
let found = false;
|
|
@@ -12,21 +13,24 @@ const markFirstListItem = (children) => {
|
|
|
12
13
|
return React.Children.map(children, (child) => {
|
|
13
14
|
if (!React.isValidElement(child))
|
|
14
15
|
return child;
|
|
15
|
-
// Check if the current element is the ListItem and hasn't been marked yet
|
|
16
|
-
if (!found
|
|
16
|
+
// Check if the current element is the ListItem or ListAction and hasn't been marked yet
|
|
17
|
+
if (!found) {
|
|
18
|
+
if (child.type === ListItem || child.type === ListAction) {
|
|
19
|
+
found = true;
|
|
20
|
+
return (_jsx(ListFirstItemContext.Provider, { value: true, children: child }));
|
|
21
|
+
}
|
|
22
|
+
// If the child has nested children, process them recursively
|
|
23
|
+
if (React.isValidElement(child) &&
|
|
24
|
+
child.props &&
|
|
25
|
+
typeof child.props === 'object' &&
|
|
26
|
+
child.props !== null &&
|
|
27
|
+
'children' in child.props &&
|
|
28
|
+
child.props.children) {
|
|
29
|
+
const clonedChildren = recursiveClone(child.props.children);
|
|
30
|
+
return React.cloneElement(child, { children: clonedChildren });
|
|
31
|
+
}
|
|
17
32
|
found = true;
|
|
18
|
-
|
|
19
|
-
return React.cloneElement(child, { isFirst: true });
|
|
20
|
-
}
|
|
21
|
-
// If the child has nested children, process them recursively
|
|
22
|
-
if (React.isValidElement(child) &&
|
|
23
|
-
child.props &&
|
|
24
|
-
typeof child.props === 'object' &&
|
|
25
|
-
child.props !== null &&
|
|
26
|
-
'children' in child.props &&
|
|
27
|
-
child.props.children) {
|
|
28
|
-
const clonedChildren = recursiveClone(child.props.children);
|
|
29
|
-
return React.cloneElement(child, { children: clonedChildren });
|
|
33
|
+
return _jsx(ListFirstItemContext.Provider, { value: true, children: child });
|
|
30
34
|
}
|
|
31
35
|
return child;
|
|
32
36
|
});
|
|
@@ -3,7 +3,7 @@ import { createPressable } from '@gluestack-ui/pressable';
|
|
|
3
3
|
import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
4
4
|
import { Pressable } from 'react-native';
|
|
5
5
|
import { StyleSheet } from 'react-native-unistyles';
|
|
6
|
-
import { useListContext } from '../List.context';
|
|
6
|
+
import { useListContext, useListFirstItemContext } from '../List.context';
|
|
7
7
|
import ListActionContent from './ListActionContent';
|
|
8
8
|
import ListActionText from './ListActionText';
|
|
9
9
|
import ListActionTrailingContent from './ListActionTrailingContent';
|
|
@@ -11,6 +11,7 @@ import ListActionTrailingIcon from './ListActionTrailingIcon';
|
|
|
11
11
|
const ListActionRoot = ({ heading, disabled, variant = 'subtle', ...props }) => {
|
|
12
12
|
const { onPress } = props;
|
|
13
13
|
const listContext = useListContext();
|
|
14
|
+
const isFirstContext = useListFirstItemContext();
|
|
14
15
|
const { active } = props.states || { active: false };
|
|
15
16
|
const getListContainer = () => {
|
|
16
17
|
if (listContext?.container?.includes('subtle')) {
|
|
@@ -29,7 +30,7 @@ const ListActionRoot = ({ heading, disabled, variant = 'subtle', ...props }) =>
|
|
|
29
30
|
disabled: isDisabled,
|
|
30
31
|
active,
|
|
31
32
|
showDisabled: !listContext?.disabled && disabled,
|
|
32
|
-
isFirstChild:
|
|
33
|
+
isFirstChild: isFirstContext,
|
|
33
34
|
container: listContext?.container,
|
|
34
35
|
});
|
|
35
36
|
return (_jsxs(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled || !onPress, children: [_jsx(ListActionContent, { children: _jsx(ListActionText, { children: heading }) }), _jsx(ListActionTrailingContent, { style: styles.centeredTrailingIcon, children: _jsx(ListActionTrailingIcon, { as: ChevronRightSmallIcon }) })] }));
|
|
@@ -4,7 +4,6 @@ interface ListItemBaseProps extends Omit<PressableProps, 'children'> {
|
|
|
4
4
|
loading?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
variant?: 'subtle' | 'emphasis';
|
|
7
|
-
isFirst?: boolean;
|
|
8
7
|
}
|
|
9
8
|
export interface ListItemWithChildren extends ListItemBaseProps {
|
|
10
9
|
children: ViewProps['children'];
|
|
@@ -15,6 +14,8 @@ export interface ListItemWithChildren extends ListItemBaseProps {
|
|
|
15
14
|
numericValue?: never;
|
|
16
15
|
badge?: never;
|
|
17
16
|
badgePosition?: never;
|
|
17
|
+
truncateHeading?: never;
|
|
18
|
+
truncateHelperText?: never;
|
|
18
19
|
}
|
|
19
20
|
export interface ListItemWithoutChildren extends ListItemBaseProps {
|
|
20
21
|
children?: never;
|
|
@@ -25,6 +26,8 @@ export interface ListItemWithoutChildren extends ListItemBaseProps {
|
|
|
25
26
|
numericValue?: string | number;
|
|
26
27
|
badge?: ReactNode;
|
|
27
28
|
badgePosition?: 'top' | 'bottom';
|
|
29
|
+
truncateHeading?: boolean;
|
|
30
|
+
truncateHelperText?: boolean;
|
|
28
31
|
}
|
|
29
32
|
type ListItemProps = ListItemWithChildren | ListItemWithoutChildren;
|
|
30
33
|
export default ListItemProps;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BodyTextProps } from '../../BodyText';
|
|
2
|
+
declare const ListItemHeading: {
|
|
3
|
+
({ children, ...props }: BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `ListItemHeading` instead.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ListItemText: {
|
|
10
|
+
({ children, ...props }: BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default ListItemHeading;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BodyText } from '../../BodyText';
|
|
3
|
+
const ListItemHeading = ({ children, ...props }) => {
|
|
4
|
+
return (_jsx(BodyText, { size: "lg", ...props, children: children }));
|
|
5
|
+
};
|
|
6
|
+
ListItemHeading.displayName = 'ListItemHeading';
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use `ListItemHeading` instead.
|
|
9
|
+
*/
|
|
10
|
+
export const ListItemText = ListItemHeading;
|
|
11
|
+
ListItemText.displayName = 'ListItemText';
|
|
12
|
+
export default ListItemHeading;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BodyTextProps } from '../../BodyText';
|
|
2
2
|
declare const ListItemHelperText: {
|
|
3
|
-
({ children, ...props }:
|
|
3
|
+
({ children, ...props }: BodyTextProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default ListItemHelperText;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type ListItemProps from './ListItem.props';
|
|
2
2
|
declare const ListItemRoot: {
|
|
3
|
-
({ heading, helperText, leadingContent, trailingContent, disabled, loading, children, states, variant, badge, badgePosition, numericValue, ...props }: ListItemProps & {
|
|
3
|
+
({ heading, helperText, leadingContent, trailingContent, disabled, loading, children, states, variant, badge, badgePosition, numericValue, truncateHeading, truncateHelperText, ...props }: ListItemProps & {
|
|
4
4
|
states?: {
|
|
5
5
|
active?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
@@ -5,17 +5,18 @@ import { Pressable } from 'react-native';
|
|
|
5
5
|
import { StyleSheet } from 'react-native-unistyles';
|
|
6
6
|
import { DetailText } from '../../DetailText';
|
|
7
7
|
import { Skeleton } from '../../Skeleton';
|
|
8
|
-
import { useListContext } from '../List.context';
|
|
8
|
+
import { useListContext, useListFirstItemContext } from '../List.context';
|
|
9
9
|
import { ListItemContext } from './ListItem.context';
|
|
10
10
|
import ListItemContent from './ListItemContent';
|
|
11
|
+
import ListItemHeading from './ListItemHeading';
|
|
11
12
|
import ListItemHelperText from './ListItemHelperText';
|
|
12
13
|
import ListItemLeadingContent from './ListItemLeadingContent';
|
|
13
|
-
import ListItemText from './ListItemText';
|
|
14
14
|
import ListItemTrailingContent from './ListItemTrailingContent';
|
|
15
15
|
import ListItemTrailingIcon from './ListItemTrailingIcon';
|
|
16
|
-
const ListItemRoot = ({ heading, helperText, leadingContent, trailingContent, disabled, loading, children, states, variant = 'subtle', badge, badgePosition = 'bottom', numericValue, ...props }) => {
|
|
16
|
+
const ListItemRoot = ({ heading, helperText, leadingContent, trailingContent, disabled, loading, children, states, variant = 'subtle', badge, badgePosition = 'bottom', numericValue, truncateHeading = false, truncateHelperText = false, ...props }) => {
|
|
17
17
|
const { onPress } = props;
|
|
18
18
|
const listContext = useListContext();
|
|
19
|
+
const isFirstContext = useListFirstItemContext();
|
|
19
20
|
const { active } = states || { active: false };
|
|
20
21
|
const getListContainer = () => {
|
|
21
22
|
if (listContext?.container?.includes('subtle')) {
|
|
@@ -37,8 +38,8 @@ const ListItemRoot = ({ heading, helperText, leadingContent, trailingContent, di
|
|
|
37
38
|
showPressed,
|
|
38
39
|
active,
|
|
39
40
|
disabled: isDisabled || isLoading,
|
|
40
|
-
showDisabled: !listContext
|
|
41
|
-
isFirstChild:
|
|
41
|
+
showDisabled: !listContext.disabled && disabled,
|
|
42
|
+
isFirstChild: isFirstContext,
|
|
42
43
|
container: listContext?.container,
|
|
43
44
|
});
|
|
44
45
|
const value = useMemo(() => {
|
|
@@ -52,7 +53,7 @@ const ListItemRoot = ({ heading, helperText, leadingContent, trailingContent, di
|
|
|
52
53
|
if (loading || listContext?.loading) {
|
|
53
54
|
return (_jsxs(Pressable, { ...props, testID: loadingTestID, style: [styles.container, props.style], disabled: isDisabled, children: [leadingContent ? _jsx(Skeleton, { width: 24, height: 24 }) : null, _jsxs(ListItemContent, { children: [_jsx(Skeleton, { width: "80%", height: 20 }), _jsx(Skeleton, { width: "100%", height: 16 })] }), onPress || trailingContent ? _jsx(Skeleton, { width: 24, height: 24 }) : null] }));
|
|
54
55
|
}
|
|
55
|
-
return (_jsx(ListItemContext.Provider, { value: value, children: _jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled, accessibilityRole: onPress ? 'button' : undefined, children: children ? (children) : (_jsxs(_Fragment, { children: [leadingContent ? (_jsx(ListItemLeadingContent, { children: leadingContent })) : null, _jsxs(ListItemContent, { children: [badgePosition === 'top' && badge ? badge : null, _jsx(
|
|
56
|
+
return (_jsx(ListItemContext.Provider, { value: value, children: _jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled, accessibilityRole: onPress ? 'button' : undefined, children: children ? (children) : (_jsxs(_Fragment, { children: [leadingContent ? (_jsx(ListItemLeadingContent, { children: leadingContent })) : null, _jsxs(ListItemContent, { children: [badgePosition === 'top' && badge ? badge : null, _jsx(ListItemHeading, { truncated: truncateHeading, children: heading }), helperText ? (_jsx(ListItemHelperText, { truncated: truncateHelperText, children: helperText })) : null, badgePosition === 'bottom' && badge ? badge : null] }), !!numericValue && _jsx(DetailText, { size: "lg", children: numericValue }), trailingContent ? (_jsx(ListItemTrailingContent, { children: trailingContent })) : onPress ? (_jsx(ListItemTrailingContent, { style: styles.centeredTrailingIcon, children: _jsx(ListItemTrailingIcon, { as: ChevronRightSmallIcon }) })) : null] })) }) }));
|
|
56
57
|
};
|
|
57
58
|
ListItemRoot.displayName = 'ListItemRoot';
|
|
58
59
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { default as ListItem } from './ListItem';
|
|
2
2
|
export type { default as ListItemProps } from './ListItem.props';
|
|
3
3
|
export { default as ListItemContent } from './ListItemContent';
|
|
4
|
+
export { default as ListItemHeading, ListItemText } from './ListItemHeading';
|
|
4
5
|
export { default as ListItemHelperText } from './ListItemHelperText';
|
|
5
6
|
export { default as ListItemIcon } from './ListItemIcon';
|
|
6
7
|
export { default as ListItemLeadingContent } from './ListItemLeadingContent';
|
|
7
|
-
export { default as ListItemText } from './ListItemText';
|
|
8
8
|
export { default as ListItemTrailingContent } from './ListItemTrailingContent';
|
|
9
9
|
export { default as ListItemTrailingIcon } from './ListItemTrailingIcon';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { default as ListItem } from './ListItem';
|
|
2
2
|
export { default as ListItemContent } from './ListItemContent';
|
|
3
|
+
export { default as ListItemHeading, ListItemText } from './ListItemHeading';
|
|
3
4
|
export { default as ListItemHelperText } from './ListItemHelperText';
|
|
4
5
|
export { default as ListItemIcon } from './ListItemIcon';
|
|
5
6
|
export { default as ListItemLeadingContent } from './ListItemLeadingContent';
|
|
6
|
-
export { default as ListItemText } from './ListItemText';
|
|
7
7
|
export { default as ListItemTrailingContent } from './ListItemTrailingContent';
|
|
8
8
|
export { default as ListItemTrailingIcon } from './ListItemTrailingIcon';
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { createPressable } from '@gluestack-ui/pressable';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
-
import { Icon } from '../Icon';
|
|
6
5
|
import { BodyText } from '../BodyText';
|
|
6
|
+
import { Icon } from '../Icon';
|
|
7
7
|
import { usePillGroupContext } from './PillGroup.context';
|
|
8
8
|
const PillRoot = ({ value, label, icon, states = {}, ...props }) => {
|
|
9
9
|
const { active } = states;
|
|
@@ -35,7 +35,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
35
35
|
_hover: {
|
|
36
36
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
37
37
|
},
|
|
38
|
-
'_focus-visible': theme.helpers.focusVisible,
|
|
38
|
+
// '_focus-visible': theme.helpers.focusVisible,
|
|
39
39
|
},
|
|
40
40
|
variants: {
|
|
41
41
|
active: {
|
|
@@ -2,9 +2,11 @@ export declare const RadioGroupContext: import("react").Context<{
|
|
|
2
2
|
disabled?: boolean;
|
|
3
3
|
validationStatus?: "valid" | "invalid" | "initial";
|
|
4
4
|
type?: "default" | "tile";
|
|
5
|
+
direction?: "column" | "row";
|
|
5
6
|
}>;
|
|
6
7
|
export declare const useRadioGroupContext: () => {
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
validationStatus?: "valid" | "invalid" | "initial";
|
|
9
10
|
type?: "default" | "tile";
|
|
11
|
+
direction?: "column" | "row";
|
|
10
12
|
};
|
|
@@ -8,7 +8,7 @@ import { RadioGroup as RadioGroupComponent } from './Radio';
|
|
|
8
8
|
import { RadioGroupContext } from './RadioGroup.context';
|
|
9
9
|
import RadioGroupTextContent from './RadioGroupTextContent';
|
|
10
10
|
const RadioGroup = ({ children, disabled, readonly, validationStatus, label, helperText, invalidText, validText, showValidationIcon = true, helperIcon, type, direction = 'column', gap, ...props }) => {
|
|
11
|
-
const value = useMemo(() => ({ disabled, validationStatus, type }), [disabled, validationStatus, type]);
|
|
11
|
+
const value = useMemo(() => ({ disabled, validationStatus, type, direction }), [disabled, validationStatus, type, direction]);
|
|
12
12
|
const showHeader = !!label || !!helperText || !!invalidText || !!validText;
|
|
13
13
|
const childrenArray = React.Children.toArray(children);
|
|
14
14
|
const childIsCard = type === 'tile' ||
|
|
@@ -30,9 +30,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
30
30
|
_hover: {
|
|
31
31
|
outlineColor: theme.components.radio.outlineColorHover,
|
|
32
32
|
},
|
|
33
|
-
'_focus-within': {
|
|
34
|
-
|
|
35
|
-
},
|
|
33
|
+
// '_focus-within': {
|
|
34
|
+
// ...theme.helpers.focusVisible,
|
|
35
|
+
// },
|
|
36
36
|
_active: {
|
|
37
37
|
outlineColor: theme.components.radio.outlineColorActive,
|
|
38
38
|
},
|
|
@@ -2,10 +2,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { useRadioContext } from './Radio.context';
|
|
5
|
+
import { useRadioGroupContext } from './RadioGroup.context';
|
|
5
6
|
const RadioTileRoot = ({ children }) => {
|
|
7
|
+
const { direction } = useRadioGroupContext();
|
|
6
8
|
const { checked } = useRadioContext();
|
|
7
9
|
styles.useVariants({
|
|
8
10
|
checked,
|
|
11
|
+
direction,
|
|
9
12
|
});
|
|
10
13
|
return _jsx(View, { style: styles.container, children: children });
|
|
11
14
|
};
|
|
@@ -13,7 +16,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
13
16
|
container: {
|
|
14
17
|
flexDirection: 'row',
|
|
15
18
|
justifyContent: 'flex-start',
|
|
16
|
-
flex: 1,
|
|
17
19
|
alignSelf: 'stretch',
|
|
18
20
|
gap: theme.components.radio.gap,
|
|
19
21
|
padding: theme.components.radio.tile.padding,
|
|
@@ -29,6 +31,12 @@ const styles = StyleSheet.create(theme => ({
|
|
|
29
31
|
margin: -theme.components.radio.tile.borderWidthSelected / 2,
|
|
30
32
|
},
|
|
31
33
|
},
|
|
34
|
+
direction: {
|
|
35
|
+
row: {},
|
|
36
|
+
column: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
32
40
|
},
|
|
33
41
|
},
|
|
34
42
|
}));
|
|
@@ -30,9 +30,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
30
30
|
_hover: {
|
|
31
31
|
outlineColor: theme.components.radio.outlineColorHover,
|
|
32
32
|
},
|
|
33
|
-
'_focus-within': {
|
|
34
|
-
|
|
35
|
-
},
|
|
33
|
+
// '_focus-within': {
|
|
34
|
+
// ...theme.helpers.focusVisible,
|
|
35
|
+
// },
|
|
36
36
|
_active: {
|
|
37
37
|
outlineColor: theme.components.radio.outlineColorActive,
|
|
38
38
|
},
|
|
@@ -38,11 +38,11 @@ const styles = StyleSheet.create(theme => ({
|
|
|
38
38
|
_hover: {
|
|
39
39
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
40
40
|
},
|
|
41
|
-
'_focus-visible': {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
41
|
+
// '_focus-visible': {
|
|
42
|
+
// ...theme.helpers.focusVisible,
|
|
43
|
+
// outlineOffset: -2,
|
|
44
|
+
// borderRadius: theme.borderRadius.sm,
|
|
45
|
+
// },
|
|
46
46
|
_active: {
|
|
47
47
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
|
|
48
48
|
},
|
|
@@ -7,7 +7,7 @@ const ButtonRoot = ({ children, onToggle, toggled, states, onPress, ...props })
|
|
|
7
7
|
const { pressed } = useCardPressHandlerContext();
|
|
8
8
|
styles.useVariants({
|
|
9
9
|
toggled,
|
|
10
|
-
active
|
|
10
|
+
active,
|
|
11
11
|
});
|
|
12
12
|
const handlePress = (e) => {
|
|
13
13
|
onPress?.(e);
|
|
@@ -34,7 +34,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
34
34
|
borderColor: theme.color.interactive.neutral.border.subtle,
|
|
35
35
|
height: theme.components.toggleButton.height,
|
|
36
36
|
_web: {
|
|
37
|
-
'_focus-visible': theme.helpers.focusVisible,
|
|
37
|
+
// '_focus-visible': theme.helpers.focusVisible,
|
|
38
38
|
_hover: {
|
|
39
39
|
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
40
40
|
},
|