@televet/kibble-ui 1.20.21-beta.cs44 → 1.20.21-beta.cs45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ForwardedRef, ReactElement } from 'react';
|
|
2
2
|
import { InputProps as CInputProps } from '@chakra-ui/input';
|
|
3
3
|
import { WithFormControlProps } from '../FormControl/formControl.component';
|
|
4
|
-
import { FormControlSize } from '
|
|
4
|
+
import { FormControlSize } from 'components/FormControl/formControl.types';
|
|
5
5
|
export interface TextInputBaseProps extends WithFormControlProps, CInputProps {
|
|
6
6
|
leftElement?: ReactElement;
|
|
7
7
|
rightElement?: ReactElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textInput.component-8541ae54.js","sources":["../src/components/TextInput/components/ClearButton/clearButton.records.ts","../src/components/TextInput/components/ClearButton/clearButton.component.tsx","../src/components/TextInput/textInput.component.tsx"],"sourcesContent":["import { FormControlSize } from 'components/FormControl/formControl.types';\n\nexport const closeButtonSize: Record<FormControlSize, number> = {\n xs: 5,\n sm: 5,\n md: 5,\n lg: 6,\n};\n","import React from 'react';\nimport { Button } from '@chakra-ui/button';\nimport { Icon } from 'components/Icon/icon.component';\nimport { useTheme } from 'hooks/useTheme';\nimport { FormControlSize } from 'components/FormControl/formControl.types';\nimport { closeButtonSize } from './clearButton.records';\n\nexport interface ClearButtonProps {\n handleClear?: () => void;\n size?: FormControlSize;\n}\n\nexport const ClearButton = ({ handleClear, size = 'md' }: ClearButtonProps): JSX.Element => {\n const { colors } = useTheme();\n\n return (\n <Button\n color={colors.icon.light.default}\n display=\"inline-flex\"\n minW=\"auto\"\n w={closeButtonSize[size]}\n h={closeButtonSize[size]}\n variant=\"unstyled\"\n opacity={0.5}\n _hover={{ opacity: 0.8 }}\n _active={{ opacity: 1 }}\n mr={size === 'sm' ? 3 : 4}\n onClick={handleClear}\n >\n <Icon name=\"close\" colorToken=\"currentColor\" size={size === 'lg' ? 'sm' : 'xs'} />\n </Button>\n );\n};\n","import React, { forwardRef, ForwardedRef, ReactElement } from 'react';\nimport {\n Input as CInput,\n InputProps as CInputProps,\n InputGroup,\n InputLeftElement,\n InputRightElement,\n} from '@chakra-ui/input';\nimport { withFormControl, WithFormControlProps } from '../FormControl/formControl.component';\nimport { FormControlSize } from '
|
|
1
|
+
{"version":3,"file":"textInput.component-8541ae54.js","sources":["../src/components/TextInput/components/ClearButton/clearButton.records.ts","../src/components/TextInput/components/ClearButton/clearButton.component.tsx","../src/components/TextInput/textInput.component.tsx"],"sourcesContent":["import { FormControlSize } from 'components/FormControl/formControl.types';\n\nexport const closeButtonSize: Record<FormControlSize, number> = {\n xs: 5,\n sm: 5,\n md: 5,\n lg: 6,\n};\n","import React from 'react';\nimport { Button } from '@chakra-ui/button';\nimport { Icon } from 'components/Icon/icon.component';\nimport { useTheme } from 'hooks/useTheme';\nimport { FormControlSize } from 'components/FormControl/formControl.types';\nimport { closeButtonSize } from './clearButton.records';\n\nexport interface ClearButtonProps {\n handleClear?: () => void;\n size?: FormControlSize;\n}\n\nexport const ClearButton = ({ handleClear, size = 'md' }: ClearButtonProps): JSX.Element => {\n const { colors } = useTheme();\n\n return (\n <Button\n color={colors.icon.light.default}\n display=\"inline-flex\"\n minW=\"auto\"\n w={closeButtonSize[size]}\n h={closeButtonSize[size]}\n variant=\"unstyled\"\n opacity={0.5}\n _hover={{ opacity: 0.8 }}\n _active={{ opacity: 1 }}\n mr={size === 'sm' ? 3 : 4}\n onClick={handleClear}\n >\n <Icon name=\"close\" colorToken=\"currentColor\" size={size === 'lg' ? 'sm' : 'xs'} />\n </Button>\n );\n};\n","import React, { forwardRef, ForwardedRef, ReactElement } from 'react';\nimport {\n Input as CInput,\n InputProps as CInputProps,\n InputGroup,\n InputLeftElement,\n InputRightElement,\n} from '@chakra-ui/input';\nimport { withFormControl, WithFormControlProps } from '../FormControl/formControl.component';\nimport { FormControlSize } from 'components/FormControl/formControl.types';\nimport { ClearButton } from './components/ClearButton/clearButton.component';\n\nexport interface TextInputBaseProps extends WithFormControlProps, CInputProps {\n leftElement?: ReactElement;\n rightElement?: ReactElement;\n inputRef?: ForwardedRef<HTMLInputElement>;\n size?: FormControlSize;\n}\n\nexport interface DefaultTextInputProps extends TextInputBaseProps {\n isClearable?: never;\n onClear?: never;\n}\n\nexport interface ClearableTextInputProps extends TextInputBaseProps {\n isClearable: boolean;\n onClear: (val: string | number | readonly string[]) => void;\n}\n\nexport type TextInputProps = DefaultTextInputProps | ClearableTextInputProps;\n\nconst TextInput = withFormControl(({ isClearable = false, size = 'md', ...props }: TextInputProps): JSX.Element => {\n const { leftElement, inputRef, isFieldInline, onClear, value, ...domProps } = props;\n let { rightElement } = props;\n\n const handleClear = (): void => {\n if (onClear) {\n onClear(value || '');\n }\n };\n\n if (isClearable && !!value) {\n rightElement = <ClearButton size={size} handleClear={handleClear} />;\n }\n\n return (\n <InputGroup>\n {leftElement ? <InputLeftElement children={leftElement} h=\"100%\" /> : null}\n <CInput {...domProps} ref={inputRef} size={size} value={value} />\n {rightElement ? <InputRightElement children={rightElement} h=\"100%\" /> : null}\n </InputGroup>\n );\n});\n\nconst WrappedTextInput = forwardRef((props: TextInputProps, ref: ForwardedRef<HTMLInputElement>) => (\n <TextInput inputRef={ref} {...props} />\n));\n\nWrappedTextInput.displayName = 'TextInput';\n\nexport { WrappedTextInput as TextInput };\n"],"names":["closeButtonSize","xs","sm","md","lg","ClearButton","_a","handleClear","_b","size","colors","useTheme","React","createElement","Button","color","icon","light","default","display","minW","w","h","variant","opacity","_hover","_active","mr","onClick","Icon","name","colorToken","TextInput","withFormControl","isClearable","_c","props","__rest","leftElement","inputRef","isFieldInline","onClear","value","domProps","rightElement","InputGroup","InputLeftElement","children","CInput","__assign","ref","InputRightElement","WrappedTextInput","forwardRef","displayName"],"mappings":"0XAEaA,EAAmD,CAC9DC,GAAI,EACJC,GAAI,EACJC,GAAI,EACJC,GAAI,G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