diff --git a/src/renderer/components/date-picker/index.tsx b/src/renderer/components/date-picker/index.tsx new file mode 100644 index 000000000..f4df8352e --- /dev/null +++ b/src/renderer/components/date-picker/index.tsx @@ -0,0 +1,19 @@ +import styled from '@emotion/styled'; +import { + DatePicker as MantineDatePicker, + DatePickerProps as MantineDatePickerProps, +} from '@mantine/dates'; + +interface DatePickerProps extends MantineDatePickerProps { + width?: number | string; +} + +const StyledDatePicker = styled(MantineDatePicker)``; + +export const DatePicker = ({ width, ...props }: DatePickerProps) => { + return ; +}; + +DatePicker.defaultProps = { + width: undefined, +}; diff --git a/src/renderer/components/index.ts b/src/renderer/components/index.ts index 45fdba862..059521851 100644 --- a/src/renderer/components/index.ts +++ b/src/renderer/components/index.ts @@ -9,3 +9,6 @@ export * from './segmented-control'; export * from './dropdown-menu'; export * from './toast'; export * from './switch'; +export * from './popover'; +export * from './select'; +export * from './date-picker'; diff --git a/src/renderer/components/input/index.tsx b/src/renderer/components/input/index.tsx index d46c03c28..bb3df71e8 100644 --- a/src/renderer/components/input/index.tsx +++ b/src/renderer/components/input/index.tsx @@ -3,6 +3,8 @@ import styled from '@emotion/styled'; import { TextInput as MantineTextInput, TextInputProps as MantineTextInputProps, + NumberInput as MantineNumberInput, + NumberInputProps as MantineNumberInputProps, PasswordInput as MantinePasswordInput, PasswordInputProps as MantinePasswordInputProps, FileInput as MantineFileInput, @@ -11,14 +13,22 @@ import { interface TextInputProps extends MantineTextInputProps { children?: React.ReactNode; + width?: number | string; +} + +interface NumberInputProps extends MantineNumberInputProps { + children?: React.ReactNode; + width?: number | string; } interface PasswordInputProps extends MantinePasswordInputProps { children?: React.ReactNode; + width?: number | string; } interface FileInputProps extends MantineFileInputProps { children?: React.ReactNode; + width?: number | string; } const StyledTextInput = styled(MantineTextInput)` @@ -58,6 +68,43 @@ const StyledTextInput = styled(MantineTextInput)` } `; +const StyledNumberInput = styled(MantineNumberInput)` + &:focus, + &:focus-within { + border-color: var(--primary-color); + } + + & .mantine-NumberInput-wrapper { + border-color: var(--primary-color); + } + + & .mantine-NumberInput-input { + &:focus, + &:focus-within { + border-color: var(--primary-color); + } + + color: var(--input-fg); + background: var(--input-bg); + + &::placeholder { + color: var(--input-placeholder-fg); + } + } + + & .mantine-Input-icon { + color: var(--input-placeholder-fg); + } + + & .mantine-NumberInput-required { + color: var(--secondary-color); + } + + & .mantine-NumberInput-label { + font-family: var(--label-font-faimly); + } +`; + const StyledPasswordInput = styled(MantinePasswordInput)` & .mantine-PasswordInput-input { &:focus, @@ -93,19 +140,34 @@ const StyledFileInput = styled(MantineFileInput)` `; export const TextInput = forwardRef( - ({ children, ...props }: TextInputProps, ref) => { + ({ children, width, ...props }: TextInputProps, ref) => { return ( - + {children} ); } ); -export const PasswordInput = forwardRef( - ({ children, ...props }: PasswordInputProps, ref) => { +export const NumberInput = forwardRef( + ({ children, width, ...props }: NumberInputProps, ref) => { return ( - + + {children} + + ); + } +); + +export const PasswordInput = forwardRef( + ({ children, width, ...props }: PasswordInputProps, ref) => { + return ( + {children} ); @@ -113,9 +175,9 @@ export const PasswordInput = forwardRef( ); export const FileInput = forwardRef( - ({ children, ...props }: FileInputProps, ref) => { + ({ children, width, ...props }: FileInputProps, ref) => { return ( - + {children} ); @@ -123,13 +185,21 @@ export const FileInput = forwardRef( ); TextInput.defaultProps = { - children: null, + children: undefined, + width: undefined, +}; + +NumberInput.defaultProps = { + children: undefined, + width: undefined, }; PasswordInput.defaultProps = { - children: null, + children: undefined, + width: undefined, }; FileInput.defaultProps = { - children: null, + children: undefined, + width: undefined, }; diff --git a/src/renderer/components/select/index.tsx b/src/renderer/components/select/index.tsx new file mode 100644 index 000000000..45c43db9f --- /dev/null +++ b/src/renderer/components/select/index.tsx @@ -0,0 +1,19 @@ +import styled from '@emotion/styled'; +import { + Select as MantineSelect, + SelectProps as MantineSelectProps, +} from '@mantine/core'; + +interface SelectProps extends MantineSelectProps { + width?: number | string; +} + +const StyledSelect = styled(MantineSelect)``; + +export const Select = ({ width, ...props }: SelectProps) => { + return ; +}; + +Select.defaultProps = { + width: undefined, +};