Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrepreneur committed Dec 28, 2023
1 parent abfaf36 commit 9eb7a37
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@raidguild/design-system",
"version": "0.5.5",
"version": "0.5.6",
"license": "MIT",
"author": "Raid Guild",
"main": "./dist/src/index.js",
Expand Down
1 change: 1 addition & 0 deletions src/components/forms/CreatableSelect/CreatableSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type Option =
| { value: null; label: string }
| { label: string | number; value: string | number }
| { value: number; label: string };

export interface CreatableSelectProps {
name: string;
label?: string | React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/CreatableSelect/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as CreatableSelect } from './CreatableSelect';
export type { CreatableSelectProps } from './CreatableSelect';
export type { CreatableSelectProps, Option } from './CreatableSelect';
31 changes: 17 additions & 14 deletions src/components/forms/NumberInput/NumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,23 @@ const NumberInput = ({
m={0}
>
<Stack spacing={spacing}>
<HStack>
{label && <FormLabel m={0}>{label}</FormLabel>}
{tooltip && (
<Tooltip>
<Icon
as={FaInfoCircle}
boxSize={3}
color='red.500'
bg='white'
borderRadius='full'
/>
</Tooltip>
)}
</HStack>
{label && (
<HStack>
{label && <FormLabel m={0}>{label}</FormLabel>}
{tooltip && (
<Tooltip>
<Icon
as={FaInfoCircle}
boxSize={3}
color='red.500'
bg='white'
borderRadius='full'
/>
</Tooltip>
)}
</HStack>
)}

<ChakraNumberInput
variant={variant}
step={step}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { ChakraStylesConfig, Select as ReactSelect } from 'chakra-react-select';
import { FormLabel, Box, Stack } from '../../../chakra';
import { FormLabel, Box, Stack, ChakraSelectProps } from '../../../chakra';

export type Option =
| {
Expand All @@ -12,7 +12,7 @@ export type Option =
| { value: null; label: string }
| { label: string | number; value: string | number }
| { value: number; label: string };
export interface ControlledSelectProps {
export interface CustomControlledSelectProps {
label?: string | React.ReactNode;
placeholder?: string;
defaultValue?: Option | Option[];
Expand Down Expand Up @@ -51,6 +51,18 @@ export interface ControlledSelectProps {
| 'primary';
}

type ControlledSelectProps = CustomControlledSelectProps &
Omit<
ChakraSelectProps,
| 'size'
| 'onFocus'
| 'onBlur'
| 'onChange'
| 'value'
| 'defaultValue'
| 'onKeyDown'
>;

const ControlledSelect: React.FC<ControlledSelectProps> = ({
label,
placeholder,
Expand Down Expand Up @@ -78,7 +90,7 @@ const ControlledSelect: React.FC<ControlledSelectProps> = ({
};

return (
<Stack spacing={2}>
<Stack spacing={2} w='100%'>
{label && <FormLabel>{label}</FormLabel>}
<Box>
<ReactSelect
Expand Down

0 comments on commit 9eb7a37

Please sign in to comment.