diff --git a/example/storybook/stories/components/composites/Actionsheet/Icon.tsx b/example/storybook/stories/components/composites/Actionsheet/Icon.tsx
index 7ede85c57..ce1450555 100644
--- a/example/storybook/stories/components/composites/Actionsheet/Icon.tsx
+++ b/example/storybook/stories/components/composites/Actionsheet/Icon.tsx
@@ -24,68 +24,28 @@ export function Example() {
- }
+ startIcon={}
>
Delete
- }
+ startIcon={}
>
Share
- }
+ startIcon={}
>
Play
- }
+ startIcon={}
>
Favourite
+
}
diff --git a/example/storybook/stories/components/composites/Actionsheet/Usage.tsx b/example/storybook/stories/components/composites/Actionsheet/Usage.tsx
index cef175086..8c85ab566 100644
--- a/example/storybook/stories/components/composites/Actionsheet/Usage.tsx
+++ b/example/storybook/stories/components/composites/Actionsheet/Usage.tsx
@@ -21,7 +21,7 @@ export function Example() {
Delete
- Share
+ Share
Play
Favourite
Cancel
diff --git a/package.json b/package.json
index 1170ad83e..ebe8165ae 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
"prettier --write"
]
},
- "version": "3.4.0-rc.7",
+ "version": "3.4.0-rc.10",
"license": "MIT",
"private": false,
"main": "lib/commonjs/index",
diff --git a/src/components/composites/Actionsheet/ActionsheetItem.tsx b/src/components/composites/Actionsheet/ActionsheetItem.tsx
index 0b3106918..5c2240272 100644
--- a/src/components/composites/Actionsheet/ActionsheetItem.tsx
+++ b/src/components/composites/Actionsheet/ActionsheetItem.tsx
@@ -1,24 +1,99 @@
import React, { memo, forwardRef } from 'react';
-import { Button } from '../../primitives/Button';
-import type { IActionsheetItemProps } from './types';
+import { Pressable } from '../../primitives/Pressable';
+import Box from '../../primitives/Box';
+import { HStack } from '../../primitives/Stack';
+import Spinner from '../../primitives/Spinner';
import { usePropsResolution } from '../../../hooks';
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
+import type { IActionsheetItemProps } from './types';
-const ActionsheetItem = (props: IActionsheetItemProps, ref?: any) => {
- const resolvedProps = usePropsResolution(
- 'ActionsheetItem',
- props,
- undefined,
- {
- cascadePseudoProps: true,
- }
- );
+const ActionsheetItem = (
+ {
+ //@ts-ignore
+ children,
+ startIcon,
+ rightIcon,
+ leftIcon,
+ endIcon,
+ spinner,
+ isDisabled,
+ isLoading,
+ spinnerPlacement = 'start',
+ ...props
+ }: IActionsheetItemProps,
+ ref: any
+) => {
+ const {
+ _text,
+ _stack,
+ _icon,
+ _spinner,
+ isLoadingText,
+ ...resolvedProps
+ } = usePropsResolution('ActionsheetItem', props, undefined, {
+ cascadePseudoProps: true,
+ });
//TODO: refactor for responsive prop
if (useHasResponsiveProps(props)) {
return null;
}
- return ;
+ if (leftIcon) {
+ startIcon = leftIcon;
+ }
+ if (rightIcon) {
+ endIcon = rightIcon;
+ }
+ if (endIcon && React.isValidElement(endIcon)) {
+ endIcon = React.Children.map(
+ endIcon,
+ (child: JSX.Element, index: number) => {
+ return React.cloneElement(child, {
+ key: `button-end-icon-${index}`,
+ ..._icon,
+ ...child.props,
+ });
+ }
+ );
+ }
+ if (startIcon && React.isValidElement(startIcon)) {
+ startIcon = React.Children.map(
+ startIcon,
+ (child: JSX.Element, index: number) => {
+ return React.cloneElement(child, {
+ key: `button-start-icon-${index}`,
+ ..._icon,
+ ...child.props,
+ });
+ }
+ );
+ }
+ const spinnerElement = spinner ? (
+ spinner
+ ) : (
+
+ );
+
+ const boxChildren = (child: any) => {
+ return child ? {child} : null;
+ };
+
+ return (
+
+
+ {startIcon && !isLoading ? startIcon : null}
+ {isLoading && spinnerPlacement === 'start' ? spinnerElement : null}
+ {isLoading
+ ? isLoadingText
+ ? boxChildren(isLoadingText)
+ : null
+ : boxChildren(children)}
+
+ {endIcon && !isLoading ? endIcon : null}
+ {isLoading && spinnerPlacement === 'end' ? spinnerElement : null}
+
+
+ );
};
export default memo(forwardRef(ActionsheetItem));
diff --git a/src/components/composites/Actionsheet/types.tsx b/src/components/composites/Actionsheet/types.tsx
index ebf0ea912..0a55333cd 100644
--- a/src/components/composites/Actionsheet/types.tsx
+++ b/src/components/composites/Actionsheet/types.tsx
@@ -48,7 +48,8 @@ export interface IActionsheetFooterProps
extends InterfaceBoxProps {}
export interface IActionsheetHeaderProps
extends InterfaceBoxProps {}
-export interface IActionsheetItemProps extends InterfaceButtonProps {}
+export interface IActionsheetItemProps
+ extends Omit {}
export type IActionsheetComponentType = ((
props: IActionsheetProps & { ref?: MutableRefObject }
diff --git a/src/components/primitives/index.ts b/src/components/primitives/index.ts
index f33ba3feb..9033f9bf9 100644
--- a/src/components/primitives/index.ts
+++ b/src/components/primitives/index.ts
@@ -68,4 +68,6 @@ export { VisuallyHidden } from './VisuallyHidden';
export { default as ZStack } from './ZStack';
export type { IZStackProps } from './ZStack';
-export { Overlay, IOverlayProps } from './Overlay';
+export { Overlay } from './Overlay';
+
+export type { IOverlayProps } from './Overlay';
diff --git a/src/hooks/useThemeProps/usePropsResolution.tsx b/src/hooks/useThemeProps/usePropsResolution.tsx
index 0ec7972d7..c1b245b56 100644
--- a/src/hooks/useThemeProps/usePropsResolution.tsx
+++ b/src/hooks/useThemeProps/usePropsResolution.tsx
@@ -342,7 +342,9 @@ export const usePropsResolutionWithComponentTheme = (
'background: #4b5563; color: #FFF; font-weight: 700; padding: 2px 8px;'
);
}
- let [flattenProps, specificityMap] = callPropsFlattener(
+ //TODO: hack
+ let flattenProps: any, specificityMap;
+ [flattenProps, specificityMap] = callPropsFlattener(
incomingWithDefaultProps,
{},
2
diff --git a/src/theme/components/actionsheet.ts b/src/theme/components/actionsheet.ts
index 6891c0db7..f350a4b02 100644
--- a/src/theme/components/actionsheet.ts
+++ b/src/theme/components/actionsheet.ts
@@ -50,13 +50,22 @@ export const ActionsheetItem = {
baseStyle: () => ({
width: '100%',
justifyContent: 'flex-start',
+ _stack: {
+ space: 4,
+ },
p: 4,
_text: {
- fontSize: 16,
+ fontSize: 'md',
fontWeight: 'normal',
},
+ _disabled: {
+ opacity: 40,
+ },
_light: {
bg: 'muted.50',
+ _icon: {
+ color: 'muted.500',
+ },
_text: {
color: 'text.900',
},
@@ -77,6 +86,9 @@ export const ActionsheetItem = {
},
_dark: {
bg: 'muted.800',
+ _icon: {
+ color: 'muted.400',
+ },
_text: {
color: 'muted.50',
},
@@ -95,7 +107,4 @@ export const ActionsheetItem = {
},
},
}),
- defaultProps: {
- variant: 'unstyled',
- },
};