Skip to content

Commit

Permalink
Merge pull request #4880 from GeekyAnts/release/3.4.0-rc.4
Browse files Browse the repository at this point in the history
Release/3.4.0 rc.4
  • Loading branch information
surajahmed authored Apr 6, 2022
2 parents bdd2ba2 + d638ee3 commit 11333f2
Show file tree
Hide file tree
Showing 24 changed files with 72 additions and 35 deletions.
5 changes: 5 additions & 0 deletions example/storybook/stories/components/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const myTheme = extendTheme({
space: {
mySpace: '29px',
},
colors: {
blue1: {
'100': 'blue',
},
},

components: {
Link: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const Example = () => {
justifyContent="center"
>
{/* Solid */}

<Heading size="md">Solid</Heading>
<Button.Group variant="solid" mb="2.5" mt="1.5">
<Button colorScheme="teal">Save</Button>
Expand All @@ -21,39 +20,44 @@ export const Example = () => {

<Divider />

<Heading size="md">Outline</Heading>
{/* Subtle */}
<Heading size="md">Subtle</Heading>
<Button.Group mb="2.5" mt="1.5" variant="subtle">
<Button colorScheme="teal">Save</Button>
<Button colorScheme="danger">Cancel</Button>
</Button.Group>

<Divider />

{/* Outline */}
<Heading size="md">Outline</Heading>
<Button.Group mb="2.5" mt="1.5" variant="outline">
<Button colorScheme="teal">Save</Button>
<Button colorScheme="danger">Cancel</Button>
</Button.Group>

<Divider />

<Heading size="md">Link</Heading>

{/* Link */}
<Heading size="md">Link</Heading>
<Button.Group mb="2.5" mt="1.5" variant="link">
<Button colorScheme="teal">Save</Button>
<Button colorScheme="danger">Cancel</Button>
</Button.Group>

<Divider />

<Heading size="md">Ghost</Heading>

{/* Ghost */}
<Heading size="md">Ghost</Heading>
<Button.Group mb="2.5" mt="1.5" variant="ghost">
<Button colorScheme="teal">Save</Button>
<Button colorScheme="danger">Cancel</Button>
</Button.Group>

<Divider />

<Heading size="md">Unstyled</Heading>

{/* Unstyled */}
<Heading size="md">Unstyled</Heading>
<Button.Group mb="2.5" mt="1.5" variant="unstyled">
<Button colorScheme="teal">Save</Button>
<Button colorScheme="danger">Cancel</Button>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prettier --write"
]
},
"version": "3.4.0-rc.3",
"version": "3.4.0-rc.4",
"license": "MIT",
"private": false,
"main": "lib/commonjs/index",
Expand Down
4 changes: 2 additions & 2 deletions src/components/composites/Alert/types.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MutableRefObject } from 'react';
import type { InterfaceBoxProps } from '../../../components/primitives/Box';
import type { IIconProps } from '../../primitives';
import type { CustomProps, VariantType } from '../../types';
import type { ColorSchemeType, CustomProps, VariantType } from '../../types';

export interface InterfaceAlertProps extends InterfaceBoxProps<IAlertProps> {
/** The status of the alert
Expand All @@ -15,7 +15,7 @@ export interface InterfaceAlertProps extends InterfaceBoxProps<IAlertProps> {

/** The colorScheme of the Alert.
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
}
export type IAlertContext = {
status?: string;
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/AppBar/types.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { ColorSchemeType } from '../../../components/types';
import type { InterfaceStackProps } from '../../primitives/Stack/Stack';

export type IAppBarProps = InterfaceStackProps & {
colorScheme?: string;
colorScheme?: ColorSchemeType;
statusBarHeight?: number;
space?: number;
};
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/Badge/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ITextProps } from '../../primitives/Text/types';
import type { IIconProps } from '../../primitives/Icon';
import type { CustomProps, VariantType } from '../../types';
import type { InterfaceBoxProps } from '../../primitives/Box';
import type { ColorSchemeType } from '../../../components/types';

export interface InterfaceBadgeProps extends InterfaceBoxProps<IBadgeProps> {
/**
Expand All @@ -12,7 +13,7 @@ export interface InterfaceBadgeProps extends InterfaceBoxProps<IBadgeProps> {
/**
* The color scheme to use for the badge. Must be a key in theme.colors.
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
/**
* The right icon element to use in the button.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/CircularProgress/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import type { CustomProps, ResponsiveValue } from '../../../components/types';
import type { ISizes } from '../../../theme/base/sizes';
import type { IColors } from '../../../theme/base/colors';
import type { InterfaceBoxProps } from '../../../components/primitives/Box/types';
import type { ColorSchemeType } from '../../../components/types';

export type InterfaceCircularProgressProps = InterfaceBoxProps<ICircularProgressProps> & {
style?: ViewStyle;
children?: JSX.Element | JSX.Element[] | string;
value: number;
size?: ResponsiveValue<ISizes | (string & {}) | number>;
thickness?: number;
colorScheme?: string;
colorScheme?: ColorSchemeType;
color?: ResponsiveValue<IColors | (string & {})>;
trackColor?: ResponsiveValue<IColors | (string & {})>;
isIndeterminate?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/Code/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { CustomProps } from '../../../components/types/utils';
import type { InterfaceBoxProps } from '../../primitives/Box';
import type { ColorSchemeType } from '../../../components/types';

export type InterfaceCodeProps = InterfaceBoxProps<ICodeProps> & {
colorScheme?: string | undefined;
colorScheme?: ColorSchemeType;
};

export type ICodeProps = InterfaceCodeProps & CustomProps<'Code'>;
4 changes: 3 additions & 1 deletion src/components/composites/IconButton/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { InterfacePressableProps } from '../../primitives/Pressable/types';
import type { IIconProps } from '../../primitives/Icon';
import type { ColorSchemeType } from '../../../components/types';

import type { CustomProps, VariantType } from '../../types';
import type { ThemeComponentSizeType } from '../../../components/types/utils';
export interface InterfaceIconButtonProps
Expand All @@ -25,7 +27,7 @@ export interface InterfaceIconButtonProps
* The color of the radio when it's checked. This should be one of the color keys in the theme (e.g."green", "red").
* @default 'primary'
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
/**
* The variant of the button style to use.
* @default 'ghost'
Expand Down
1 change: 1 addition & 0 deletions src/components/composites/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const Popover = (
bodyMounted,
setBodyMounted,
setHeaderMounted,
isOpen,
}}
>
<FocusScope contain={trapFocus} restoreFocus autoFocus>
Expand Down
2 changes: 2 additions & 0 deletions src/components/composites/Popover/PopoverContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const PopoverContent = React.forwardRef(
bodyMounted,
bodyId,
headerId,
isOpen,
} = React.useContext(PopoverContext);
const resolvedProps = usePropsResolution('PopoverContent', props);

Expand Down Expand Up @@ -81,6 +82,7 @@ export const PopoverContent = React.forwardRef(
{...accessibilityProps}
{...resolvedProps}
ref={ref}
isOpen={isOpen}
>
{arrowElement}
{restChildren}
Expand Down
1 change: 1 addition & 0 deletions src/components/composites/Popover/PopoverContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export const PopoverContext = React.createContext({
setBodyMounted: (() => {}) as any,
headerMounted: false,
bodyMounted: false,
isOpen: false,
});
5 changes: 3 additions & 2 deletions src/components/composites/Popper/Popper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Popper = (
};

const PopperContent = React.forwardRef(
({ children, style, ...rest }: IBoxProps, ref: any) => {
({ children, style, ...rest }: IBoxProps & { isOpen: boolean }, ref: any) => {
const {
triggerRef,
shouldFlip,
Expand All @@ -52,6 +52,7 @@ const PopperContent = React.forwardRef(
setOverlayRef,
} = usePopperContext('PopperContent');
const overlayRef = React.useRef(null);

// const { top } = useSafeAreaInsets();
const {
overlayProps,
Expand All @@ -63,7 +64,7 @@ const PopperContent = React.forwardRef(
overlayRef,
shouldFlip: shouldFlip,
crossOffset: crossOffset,
isOpen: true,
isOpen: rest.isOpen,
offset: offset,
placement: placementProp as any,
containerPadding: 0,
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/Progress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Box } from '../../primitives';
import type { InterfaceBoxProps } from '../../primitives/Box';
import { usePropsResolution } from '../../../hooks/useThemeProps';
import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';
import type { ColorSchemeType } from '../../../components/types';
import type {
CustomProps,
ThemeComponentSizeType,
Expand All @@ -25,7 +26,7 @@ export interface InterfaceProgressProps
* The color scheme of the progress. This should be one of the color keys in the theme (e.g."green", "red").
* @default primary
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
// /**
// * Whether progress is indeterminate
// * @default false
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/Tabs/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import type { RefObject } from 'react';
import type { ViewProps } from 'react-native';
import type { InterfaceBoxProps } from '../../primitives/Box';
import type { InterfaceIconProps } from '../../primitives/Icon/types';
import type { ColorSchemeType } from '../../../components/types';

export type ITabsProps = InterfaceBoxProps<ITabsProps> & {
align?: 'center' | 'end' | 'start';
id?: string;
colorScheme?: string;
colorScheme?: ColorSchemeType;
index?: number;
defaultIndex?: number;
isFitted?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion src/components/composites/Tag/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { CustomProps } from '../../../components/types';
import type { InterfaceBoxProps } from '../../primitives/Box';
import type { ColorSchemeType } from '../../../components/types';

export interface InterfaceTagProps extends InterfaceBoxProps<ITagProps> {
variant?: 'solid' | 'subtle' | 'outline';
colorScheme?: string;
colorScheme?: ColorSchemeType;
size?: string | number;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/primitives/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const Button = (
);

const boxChildren = (child: any) => {
return <Box _text={_text}>{child}</Box>;
return child ? <Box _text={_text}>{child}</Box> : null;
};

return (
Expand Down
7 changes: 5 additions & 2 deletions src/components/primitives/Button/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ import { useHasResponsiveProps } from '../../../hooks/useHasResponsiveProps';

export default memo(
forwardRef(
({ children, divider, ...props }: IButtonGroupProps, ref?: any) => {
(
{ children, divider, variant, ...props }: IButtonGroupProps,
ref?: any
) => {
const {
space,
direction,
variant,

size,
colorScheme,
isDisabled,
Expand Down
9 changes: 6 additions & 3 deletions src/components/primitives/Button/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
import type { ISpinnerProps } from '../Spinner/types';
import type { IIconProps } from '../Icon';
import type { InterfacePressableProps } from '../Pressable/types';
import type { ColorSchemeType } from '../../../components/types';

// const myFunction = ({ a, b }) => {
// return { a: a, b: b };
Expand All @@ -34,7 +35,7 @@ export interface InterfaceButtonProps
* The color of the radio when it's checked. This should be one of the color keys in the theme (e.g."green", "red").
* @default 'primary'
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
/**
* The variant of the button style to use.
* @default 'solid'
Expand Down Expand Up @@ -149,7 +150,9 @@ export interface IButtonGroupProps extends IStackProps {
* The variant of the button style to use.
* @default 'solid'
*/
variant?: 'ghost' | 'outline' | 'solid' | 'link' | 'unstyled';
variant?: ResponsiveValue<
'ghost' | 'outline' | 'solid' | 'link' | 'unstyled' | 'subtle'
>;
/**
* The start icon element to use in the button.
*/
Expand All @@ -160,7 +163,7 @@ export interface IButtonGroupProps extends IStackProps {
* The color of the radio when it's checked. This should be one of the color keys in the theme (e.g."green", "red").
* @default 'primary'
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
/**
* If true, the button will be disabled.
*/
Expand Down
7 changes: 4 additions & 3 deletions src/components/primitives/Checkbox/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
ResponsiveValue,
ThemeComponentSizeType,
} from '../../../components/types';
import type { ColorSchemeType } from '../../../components/types';

export type ICheckboxValue = string;

Expand All @@ -29,7 +30,7 @@ export interface InterfaceCheckbox extends InterfaceBoxProps<ICheckboxProps> {
/**
* The color of the radio when it's checked. This should be one of the color keys in the theme (e.g."green", "red").
*/
colorScheme?: string | 'default';
colorScheme?: ColorSchemeType & ResponsiveValue<'default'>;
/**
* If true, the checkbox will be initially checked. (use defaultValue prop if using it inside Checkbox.Group)
*/
Expand Down Expand Up @@ -154,7 +155,7 @@ export interface ICheckboxGroupProps
/**
* The color of the radio when it's checked. This should be one of the color keys in the theme (e.g."green", "red").
*/
colorScheme?: string;
colorScheme?: ColorSchemeType;
/**
* The size (width and height) of the checkbox.
*/
Expand All @@ -169,7 +170,7 @@ export interface ICheckboxGroupProps
_checkbox?: Partial<ICheckboxProps>;
}
export interface ICheckboxContext extends IFormControlContext {
colorScheme?: string;
colorScheme?: ColorSchemeType;
size?: ResponsiveValue<'sm' | 'md' | 'lg'>;
state: CheckboxGroupState;
}
Expand Down
Loading

0 comments on commit 11333f2

Please sign in to comment.