diff --git a/example/storybook-nativewind/src/components/Icon/Icon.tsx b/example/storybook-nativewind/src/components/Icon/Icon.tsx index 9695bb34f6..5d857e82c3 100644 --- a/example/storybook-nativewind/src/components/Icon/Icon.tsx +++ b/example/storybook-nativewind/src/components/Icon/Icon.tsx @@ -68,7 +68,7 @@ import { Camera, } from 'lucide-react-native'; const IconBasic = ({ size, ...props }: any) => { - return ; + return ; }; IconBasic.description = diff --git a/example/storybook-nativewind/src/components/Radio/Radio.tsx b/example/storybook-nativewind/src/components/Radio/Radio.tsx index f1eed53d00..066f59276d 100644 --- a/example/storybook-nativewind/src/components/Radio/Radio.tsx +++ b/example/storybook-nativewind/src/components/Radio/Radio.tsx @@ -1,15 +1,5 @@ /* eslint-disable no-console */ import React from 'react'; -import { - Center, - VStack, - HStack, - Box, - Heading, - Text, - FormControl, - CircleIcon, -} from '@gluestack-ui/themed'; import { Radio, RadioGroup, @@ -17,18 +7,18 @@ import { RadioIndicator, RadioLabel, } from '@/components/ui/radio'; +import { CircleIcon } from '@/components/ui/icon'; const RadioBasic = ({ ...props }: any) => { const [values, setValues] = React.useState('Label 1'); return ( - + console.log(nextValue, 'nextValue')} - gap="$2" > @@ -40,7 +30,6 @@ const RadioBasic = ({ ...props }: any) => { value="Label 2" aria-label="Radio" onChange={(nextValue: boolean) => console.log(nextValue, 'nextValue')} - gap="$2" > @@ -56,18 +45,4 @@ RadioBasic.description = export default RadioBasic; -export { - Radio, - RadioGroup, - RadioIcon, - RadioIndicator, - RadioLabel, - CircleIcon, - Center, - VStack, - HStack, - Box, - Heading, - Text, - FormControl, -}; +export { Radio, RadioGroup, RadioIcon, RadioIndicator, RadioLabel, CircleIcon }; diff --git a/example/storybook-nativewind/src/core-components/nativewind/icon/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/icon/index.tsx index 924b868cae..dc2f725a2c 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/icon/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/icon/index.tsx @@ -7,16 +7,7 @@ import { cssInterop } from 'nativewind'; const PrimitiveIcon = React.forwardRef( ( - { - height, - width, - fill = 'none', - color, - size, - stroke = 'currentColor', - as: AsComp, - ...props - }: any, + { height, width, fill, color, size, stroke, as: AsComp, ...props }: any, ref?: any ) => { const sizeProps = useMemo(() => { @@ -55,7 +46,7 @@ export const UIIcon = createIcon({ }); const iconStyle = tva({ - base: '', + base: 'stroke-typography-950 fill-none', variants: { size: { '2xs': 'h-3 w-3', diff --git a/example/storybook-nativewind/src/core-components/nativewind/icon/index.web.tsx b/example/storybook-nativewind/src/core-components/nativewind/icon/index.web.tsx index bc3b86ed35..c20831e126 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/icon/index.web.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/icon/index.web.tsx @@ -2,8 +2,18 @@ import React, { useMemo } from 'react'; import { createIcon } from '@gluestack-ui/icon'; import { tva } from '@gluestack-ui/nativewind-utils/tva'; -const Svg = (props: any) => { - return ; +const accessClassName = (style: any) => { + const obj = style[0]; + const keys = Object.keys(obj); //will return an array of keys + return obj[keys[1]]; +}; + +const Svg = ({ style, className, ...props }: any) => { + const calculateClassName = useMemo(() => { + return className === undefined ? accessClassName(style) : className; + }, [className, style]); + + return ; }; const PrimitiveIcon = React.forwardRef( @@ -118,15 +128,15 @@ const AddIcon = createIcon({ <> ), @@ -142,21 +152,21 @@ const AlertCircleIcon = createIcon({ <> ), @@ -172,15 +182,15 @@ const ArrowUpIcon = createIcon({ <> ), @@ -194,15 +204,15 @@ const ArrowDownIcon = createIcon({ <> ), @@ -216,15 +226,15 @@ const ArrowRightIcon = createIcon({ <> ), @@ -237,15 +247,15 @@ const ArrowLeftIcon = createIcon({ <> ), @@ -266,15 +276,15 @@ const AtSignIcon = createIcon({ <> @@ -292,15 +302,15 @@ const BellIcon = createIcon({ <> ), @@ -317,63 +327,63 @@ const CalendarDaysIcon = createIcon({ <> ), @@ -390,9 +400,9 @@ const CheckIcon = createIcon({ <> ), @@ -405,15 +415,15 @@ const CheckCircleIcon = createIcon({ <> ), @@ -432,9 +442,9 @@ const ChevronUpIcon = createIcon({ <> ), @@ -447,9 +457,9 @@ const ChevronDownIcon = createIcon({ <> ), @@ -462,9 +472,9 @@ const ChevronLeftIcon = createIcon({ <> ), @@ -478,9 +488,9 @@ const ChevronRightIcon = createIcon({ <> ), @@ -494,15 +504,15 @@ const ChevronsLeftIcon = createIcon({ <> ), @@ -516,15 +526,15 @@ const ChevronsRightIcon = createIcon({ <> ), @@ -538,15 +548,15 @@ const ChevronsUpDownIcon = createIcon({ <> ), @@ -577,17 +587,15 @@ const CircleIcon = createIcon({ <> ), }); CircleIcon.displayName = 'CircleIcon'; - export { CircleIcon }; const ClockIcon = createIcon({ @@ -597,15 +605,15 @@ const ClockIcon = createIcon({ <> ), @@ -622,15 +630,15 @@ const CloseIcon = createIcon({ <> ), @@ -643,21 +651,21 @@ const CloseCircleIcon = createIcon({ <> ), @@ -675,15 +683,15 @@ const CopyIcon = createIcon({ <> ), @@ -700,21 +708,21 @@ const DownloadIcon = createIcon({ <> ), @@ -730,15 +738,15 @@ const EditIcon = createIcon({ <> ), @@ -754,15 +762,15 @@ const EyeIcon = createIcon({ <> ), @@ -777,27 +785,27 @@ const EyeOffIcon = createIcon({ <> ), @@ -813,9 +821,9 @@ const FavouriteIcon = createIcon({ <> ), @@ -831,21 +839,21 @@ const GlobeIcon = createIcon({ <> ), @@ -861,39 +869,39 @@ const GripVerticalIcon = createIcon({ <> ), @@ -909,21 +917,21 @@ const HelpCircleIcon = createIcon({ <> ), @@ -939,21 +947,21 @@ const InfoIcon = createIcon({ <> ), @@ -969,15 +977,15 @@ const LinkIcon = createIcon({ <> ), @@ -992,21 +1000,21 @@ const ExternalLinkIcon = createIcon({ <> ), @@ -1022,9 +1030,9 @@ const LoaderIcon = createIcon({ <> ), @@ -1040,15 +1048,15 @@ const LockIcon = createIcon({ <> ), @@ -1064,15 +1072,15 @@ const MailIcon = createIcon({ <> ), @@ -1088,21 +1096,21 @@ const MenuIcon = createIcon({ <> ), @@ -1118,9 +1126,9 @@ const MessageCircleIcon = createIcon({ <> ), @@ -1137,9 +1145,9 @@ const MoonIcon = createIcon({ <> ), @@ -1155,9 +1163,9 @@ const PaperclipIcon = createIcon({ <> ), @@ -1173,9 +1181,9 @@ const PhoneIcon = createIcon({ <> ), @@ -1191,15 +1199,15 @@ const PlayIcon = createIcon({ <> ), @@ -1215,9 +1223,9 @@ const RemoveIcon = createIcon({ <> ), @@ -1233,27 +1241,27 @@ const RepeatIcon = createIcon({ <> ), @@ -1268,33 +1276,33 @@ const Repeat1Icon = createIcon({ <> ), @@ -1310,15 +1318,15 @@ const SearchIcon = createIcon({ <> ), @@ -1334,15 +1342,15 @@ const SettingsIcon = createIcon({ <> ), @@ -1358,33 +1366,33 @@ const ShareIcon = createIcon({ <> ), @@ -1400,15 +1408,15 @@ const SlashIcon = createIcon({ <> ), @@ -1424,9 +1432,9 @@ const StarIcon = createIcon({ <> ), @@ -1442,57 +1450,57 @@ const SunIcon = createIcon({ <> ), @@ -1508,21 +1516,21 @@ const ThreeDotsIcon = createIcon({ <> ), @@ -1538,21 +1546,21 @@ const TrashIcon = createIcon({ <> ), @@ -1568,15 +1576,15 @@ const UnlockIcon = createIcon({ <> ), diff --git a/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx b/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx index 823654fe8b..04f2adb065 100644 --- a/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx +++ b/example/storybook-nativewind/src/core-components/nativewind/radio/index.tsx @@ -15,16 +15,25 @@ import type { VariantProps } from '@gluestack-ui/nativewind-utils'; const PrimitiveIcon = React.forwardRef( ( - { height, width, fill = 'none', color, size, as: AsComp, ...props }: any, + { height, width, fill, color, size, stroke, as: AsComp, ...props }: any, ref?: any ) => { const sizeProps = useMemo(() => { return size ? { size } : { height, width }; }, [size, height, width]); + let colorProps = + stroke === 'currentColor' && color !== undefined ? color : stroke; + if (AsComp) { return ( - + ); } return ( @@ -33,7 +42,7 @@ const PrimitiveIcon = React.forwardRef( height={height} width={width} fill={fill} - color={color} + stroke={colorProps} {...props} /> ); @@ -56,13 +65,13 @@ const radioGroupStyle = tva({ }); const radioIconStyle = tva({ - base: 'rounded-full justify-center items-center', + base: 'rounded-full justify-center items-center stroke-background-800 fill-background-800', parentVariants: { size: { - sm: 'h-3 w-3', - md: 'h-4 w-4', - lg: 'h-[18px] w-[18px]', + sm: 'h-2 w-2', + md: 'h-3 w-3', + lg: 'h-4 w-4', }, }, }); @@ -71,9 +80,9 @@ const radioIndicatorStyle = tva({ base: 'justify-center items-center bg-transparent border-outline-400 border-2 rounded-full data-[focus-visible=true]:web:outline-2 data-[focus-visible=true]:web:outline-primary-700 data-[focus-visible=true]:web:outline data-[checked=true]:border-primary-600 data-[checked=true]:bg-transparent data-[hover=true]:border-outline-500 data-[hover=true]:bg-transparent data-[hover=true]:data-[checked=true]:bg-transparent data-[hover=true]:data-[checked=true]:border-primary-700 data-[hover=true]:data-[invalid=true]:border-error-700 data-[hover=true]:data-[disabled=true]:opacity-40 data-[hover=true]:data-[disabled=true]:border-outline-400 data-[hover=true]:data-[disabled=true]:data-[invalid=true]:border-error-400 data-[active=true]:bg-transparent data-[active=true]:border-primary-800 data-[invalid=true]:border-error-700 data-[disabled=true]:opacity-40 data-[disabled=true]:data-[checked=true]:border-outline-400 data-[disabled=true]:data-[checked=true]:bg-transparent data-[disabled=true]:data-[invalid=true]:border-error-400', parentVariants: { size: { - sm: 'p-px h-4 w-4', - md: 'p-[1.5px] h-5 w-5', - lg: 'p-0.5 h-6 w-6', + sm: 'h-4 w-4', + md: 'h-5 w-5', + lg: 'h-6 w-6', }, }, }); @@ -211,7 +220,6 @@ const RadioIcon = React.forwardRef( { className, size, - color = 'gray', ...props }: IRadioIconProps & { className?: string; @@ -228,7 +236,6 @@ const RadioIcon = React.forwardRef( @@ -241,11 +248,11 @@ const RadioIcon = React.forwardRef( ); } + return ( );