@consta/uikit 4.14.2 → 4.15.0
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.
- package/__internal__/src/components/AutoCompleteCanary/useAutoComplete.js +1 -1
- package/__internal__/src/components/AutoCompleteCanary/useAutoComplete.js.map +1 -1
- package/__internal__/src/components/Combobox/helpers.d.ts +5 -2
- package/__internal__/src/components/Combobox/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.d.ts +3 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/DatePickerFieldTypeDate.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDate/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateRange/DatePickerFieldTypeDateRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.d.ts +3 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/DatePickerFieldTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTime/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeDateTimeRange/DatePickerFieldTypeDateTimeRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.d.ts +3 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/DatePickerFieldTypeMonth.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonth/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeMonthRange/DatePickerFieldTypeMonthRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.d.ts +3 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/DatePickerFieldTypeTime.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeTime/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.d.ts +3 -2
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/DatePickerFieldTypeYear.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/helpers.d.ts +2 -0
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/helpers.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYear/helpers.js.map +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange.js +1 -1
- package/__internal__/src/components/DatePicker/DatePickerFieldTypeYearRange/DatePickerFieldTypeYearRange.js.map +1 -1
- package/__internal__/src/components/DatePicker/types.d.ts +1 -0
- package/__internal__/src/components/DatePicker/types.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/DateTimeTypeDateTime.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeDateTime/DateTimeTypeDateTime.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/DateTimeTypeTime.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/DateTimeTypeTime.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/helpers.d.ts +2 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/helpers.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeTime/helpers.js.map +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js +1 -1
- package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js.map +1 -1
- package/__internal__/src/components/DateTime/helpers/getDaysOfMonth.d.ts +2 -1
- package/__internal__/src/components/DateTime/helpers/getDaysOfMonth.js +1 -1
- package/__internal__/src/components/DateTime/helpers/getDaysOfMonth.js.map +1 -1
- package/__internal__/src/components/DateTime/helpers/getMonthsOfYear.d.ts +2 -1
- package/__internal__/src/components/DateTime/helpers/getMonthsOfYear.js +1 -1
- package/__internal__/src/components/DateTime/helpers/getMonthsOfYear.js.map +1 -1
- package/__internal__/src/components/DateTime/helpers/getYearsOfDecade.d.ts +2 -1
- package/__internal__/src/components/DateTime/helpers/getYearsOfDecade.js +1 -1
- package/__internal__/src/components/DateTime/helpers/getYearsOfDecade.js.map +1 -1
- package/__internal__/src/components/DateTime/helpers/types.d.ts +2 -0
- package/__internal__/src/components/DateTime/helpers/types.js.map +1 -1
- package/__internal__/src/components/EventInterceptor/propsHandlers/useTextFieldEventsHandler.d.ts +3 -2
- package/__internal__/src/components/FieldLabel/FieldLabel.css +1 -1
- package/__internal__/src/components/FieldLabel/FieldLabel.d.ts +2 -0
- package/__internal__/src/components/FieldLabel/FieldLabel.js +1 -1
- package/__internal__/src/components/FieldLabel/FieldLabel.js.map +1 -1
- package/__internal__/src/components/Select/helpers.d.ts +5 -2
- package/__internal__/src/components/Select/helpers.js.map +1 -1
- package/__internal__/src/components/SelectComponents/Select.css +1 -1
- package/__internal__/src/components/SelectComponents/SelectContainer/SelectContainer.d.ts +3 -1
- package/__internal__/src/components/SelectComponents/SelectContainer/SelectContainer.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectContainer/SelectContainer.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.d.ts +2 -0
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectValueTag/SelectValueTag.css +1 -1
- package/__internal__/src/components/SelectComponents/types.d.ts +1 -1
- package/__internal__/src/components/SelectComponents/types.js +1 -1
- package/__internal__/src/components/SelectComponents/types.js.map +1 -1
- package/__internal__/src/components/Slider/Slider.js +1 -1
- package/__internal__/src/components/Slider/Slider.js.map +1 -1
- package/__internal__/src/components/Slider/helper.d.ts +1 -0
- package/__internal__/src/components/Slider/helper.js.map +1 -1
- package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
- package/__internal__/src/components/TextField/TextField.css +1 -1
- package/__internal__/src/components/TextField/TextField.js +1 -1
- package/__internal__/src/components/TextField/TextField.js.map +1 -1
- package/__internal__/src/components/TextField/types.d.ts +1 -0
- package/__internal__/src/components/TextField/types.js.map +1 -1
- package/__internal__/src/components/User/User.js +1 -1
- package/__internal__/src/components/User/User.js.map +1 -1
- package/__internal__/src/components/UserSelect/helpers.d.ts +5 -2
- package/__internal__/src/components/UserSelect/helpers.js.map +1 -1
- package/__internal__/src/utils/date/index.d.ts +1 -0
- package/__internal__/src/utils/date/index.js +1 -1
- package/__internal__/src/utils/date/index.js.map +1 -1
- package/__internal__/src/utils/date/isDisableDate.d.ts +8 -0
- package/__internal__/src/utils/date/isDisableDate.js +2 -0
- package/__internal__/src/utils/date/isDisableDate.js.map +1 -0
- package/__internal__/src/utils/date/isInMinMaxDade.d.ts +1 -1
- package/__internal__/src/utils/date/isInMinMaxDade.js +1 -1
- package/__internal__/src/utils/date/isInMinMaxDade.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","names":["IconClose","IconEye","IconEyeClose","IconSelect","IconSelectOpen","React","forwardRef","useCallback","useEffect","TextAreaAutoSize","useFlag","useForkRef","useMutableRef","useSortSteps","cn","getByMap","isString","usePropsHandler","FieldCaption","FieldLabel","getIncrementFlag","getTypeForRender","getValueByStep","sizeMap","textFieldPropFormDefault","textFieldPropSizeDefault","textFieldPropViewDefault","textFieldPropWidthDefault","COMPONENT_NAME","cnTextField","TextFieldRender","props","ref","textFieldRef","useRef","inputRef","className","type","value","onChange","id","name","rows","cols","minRows","maxRows","inputRefProp","maxLength","disabled","size","view","form","state","status","width","onBlur","onFocus","autoFocus","placeholder","leftSide","rightSide","autoComplete","withClearButton","incrementButtons","max","min","readOnly","required","step","tabIndex","ariaLabel","label","inputContainerRef","labelPosition","caption","iconSizeProp","iconSize","focused","onClick","onKeyDownProp","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","otherProps","focus","setFocus","passwordVisible","setPasswordVisuble","valueRef","onClickRef","onChangeRef","handleEyeClick","e","stopPropagation","toggle","current","LeftIcon","RightIcon","leftSideIsString","rightSideIsString","sortedSteps","handleChange","target","handleFocus","on","commonProps","handleBlur","off","toString","Eye","textareaProps","inputProps","Array","isArray","flag","preventDefault","handleClear","changeNumberValue","isIncrement","rootProps","selectionStart","length","withValue","position","TextField"],"sources":["../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import './TextField.css';\n\nimport { IconClose } from '@consta/icons/IconClose';\nimport { IconEye } from '@consta/icons/IconEye';\nimport { IconEyeClose } from '@consta/icons/IconEyeClose';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport { IconSelectOpen } from '@consta/icons/IconSelectOpen';\nimport React, { forwardRef, useCallback, useEffect } from 'react';\nimport TextAreaAutoSize from 'react-textarea-autosize';\n\nimport { useFlag } from '../../hooks/useFlag/useFlag';\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { useMutableRef } from '../../hooks/useMutableRef/useMutableRef';\nimport { useSortSteps } from '../../hooks/useSortSteps/useSortSteps';\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { isString } from '../../utils/type-guards';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\nimport { FieldCaption } from '../FieldCaption/FieldCaption';\nimport { FieldLabel } from '../FieldLabel/FieldLabel';\nimport {\n getIncrementFlag,\n getTypeForRender,\n getValueByStep,\n sizeMap,\n} from './helpers';\nimport {\n TextFieldComponent,\n textFieldPropFormDefault,\n TextFieldProps,\n textFieldPropSizeDefault,\n textFieldPropViewDefault,\n textFieldPropWidthDefault,\n} from './types';\n\nexport const COMPONENT_NAME = 'TextField' as const;\nexport const cnTextField = cn(COMPONENT_NAME);\n\nexport const TextFieldRender = <TYPE extends string>(\n props: TextFieldProps<TYPE>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const textFieldRef = React.useRef<HTMLDivElement>(null);\n const inputRef = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n\n const {\n className,\n type = 'text',\n value,\n onChange,\n id,\n name,\n rows,\n cols,\n minRows,\n maxRows,\n inputRef: inputRefProp,\n maxLength,\n disabled,\n size = textFieldPropSizeDefault,\n view = textFieldPropViewDefault,\n form = textFieldPropFormDefault,\n state,\n status,\n width = textFieldPropWidthDefault,\n onBlur,\n onFocus,\n autoFocus = false,\n placeholder,\n leftSide,\n rightSide,\n autoComplete,\n withClearButton,\n incrementButtons = true,\n max,\n min,\n readOnly,\n required,\n step = 1,\n tabIndex,\n ariaLabel,\n label,\n inputContainerRef,\n labelPosition = 'top',\n caption,\n iconSize: iconSizeProp,\n focused,\n onClick,\n // onkey props\n onKeyDown: onKeyDownProp,\n onKeyDownCapture,\n onKeyPress,\n onKeyPressCapture,\n onKeyUp,\n onKeyUpCapture,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, textFieldRef);\n const [focus, setFocus] = useFlag(autoFocus);\n const [passwordVisible, setPasswordVisuble] = useFlag(false);\n\n const valueRef = useMutableRef(value);\n const onClickRef = useMutableRef(onClick);\n const onChangeRef = useMutableRef(onChange);\n\n const handleEyeClick = useCallback(\n (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n e.stopPropagation();\n setPasswordVisuble.toggle();\n inputRef.current?.focus();\n },\n [],\n );\n\n const textarea = type === 'textarea';\n const LeftIcon = leftSide;\n const RightIcon = rightSide;\n const leftSideIsString = isString(leftSide);\n const rightSideIsString = isString(rightSide);\n const iconSize = getByMap(sizeMap, size, iconSizeProp);\n\n const sortedSteps = useSortSteps({\n step,\n min: Number(min),\n max: Number(max),\n });\n\n const handleChange: React.ChangeEventHandler<\n HTMLInputElement | HTMLTextAreaElement\n > = useCallback(\n (e) => {\n !disabled &&\n onChangeRef.current?.({ e, id, name, value: e.target.value || null });\n },\n [id, name, disabled],\n );\n\n const handleBlur: React.FocusEventHandler<HTMLElement> = (e) => {\n setFocus.off();\n onBlur?.(e);\n };\n\n const handleFocus: React.FocusEventHandler<HTMLElement> = (e) => {\n setFocus.on();\n onFocus?.(e);\n };\n\n const commonProps = {\n 'className': cnTextField('Input'),\n 'value': value || '',\n 'onChange': handleChange,\n maxLength,\n disabled,\n 'onBlur': handleBlur,\n 'onFocus': handleFocus,\n autoFocus,\n placeholder,\n autoComplete,\n readOnly,\n tabIndex,\n name,\n onKeyDownCapture,\n onKeyPress,\n onKeyPressCapture,\n onKeyUp,\n onKeyUpCapture,\n 'id': id ? id.toString() : '',\n 'aria-label': ariaLabel,\n };\n\n const Eye = passwordVisible ? IconEyeClose : IconEye;\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n const flag = getIncrementFlag(e);\n onKeyDownProp?.(e);\n if (type === 'number' && typeof flag === 'boolean' && !disabled) {\n e.preventDefault();\n onChange?.({\n e,\n value: getValueByStep(sortedSteps, value, flag, min, max),\n });\n }\n };\n\n const textareaProps = {\n rows,\n cols,\n minRows: minRows || rows,\n maxRows: maxRows || rows,\n ref: useForkRef([inputRef, inputRefProp]) as (\n node: HTMLTextAreaElement,\n ) => void,\n };\n\n const inputProps = {\n type: getTypeForRender(type, passwordVisible),\n max,\n min,\n step: !Array.isArray(sortedSteps) ? sortedSteps : 0,\n onKeyDown,\n ref: useForkRef([\n inputRef,\n inputRefProp,\n ]) as React.RefCallback<HTMLInputElement>,\n };\n\n const handleClear = useCallback((e: React.MouseEvent<HTMLButtonElement>) => {\n onChangeRef.current?.({\n e,\n value: null,\n });\n }, []);\n\n const changeNumberValue = (\n e: React.MouseEvent<HTMLButtonElement>,\n isIncrement = true,\n ) => {\n onChange?.({\n e,\n value: getValueByStep(sortedSteps, value, isIncrement, min, max),\n });\n };\n\n const rootProps = {\n onClick: useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n inputRef.current?.focus();\n onClickRef.current?.(e);\n }, []),\n };\n\n // при смене passwordVible, перемещаем курсор в конец строки\n useEffect(() => {\n if (type === 'password' && inputRef.current) {\n inputRef.current.selectionStart = valueRef.current?.length || 0;\n }\n }, [passwordVisible]);\n\n return (\n <div\n className={cnTextField({ labelPosition, size, view, width }, [className])}\n ref={useForkRef([ref, textFieldRef])}\n {...rootProps}\n {...otherProps}\n >\n {label && (\n <FieldLabel\n required={required}\n className={cnTextField('Label', { labelPosition })}\n size={size}\n >\n {label}\n </FieldLabel>\n )}\n <div className={cnTextField('Body')}>\n <div\n ref={inputContainerRef}\n className={cnTextField('InputContainer', {\n view,\n form,\n status: status || state,\n disabled,\n type,\n focus: focus || focused,\n withValue: !!value,\n })}\n >\n {LeftIcon && (\n <div\n className={cnTextField('Side', {\n position: 'left',\n type: leftSideIsString ? 'string' : 'icon',\n })}\n title={typeof leftSide === 'string' ? leftSide : undefined}\n >\n {leftSideIsString ? (\n leftSide\n ) : (\n <LeftIcon className={cnTextField('Icon')} size={iconSize} />\n )}\n </div>\n )}\n {textarea ? (\n <TextAreaAutoSize {...commonProps} {...textareaProps} />\n ) : (\n <input {...commonProps} {...inputProps} />\n )}\n\n {type === 'number' && incrementButtons && (\n <div className={cnTextField('Counter')}>\n <button\n onFocus={handleFocus}\n onClick={(e) => changeNumberValue(e, true)}\n type=\"button\"\n className={cnTextField('CounterButton')}\n >\n <IconSelectOpen size=\"xs\" />\n </button>\n <button\n onFocus={handleFocus}\n onClick={(e) => changeNumberValue(e, false)}\n type=\"button\"\n className={cnTextField('CounterButton')}\n >\n <IconSelect size=\"xs\" />\n </button>\n </div>\n )}\n\n {value && withClearButton && type !== 'number' && (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={handleClear}\n className={cnTextField('ClearButton')}\n >\n <IconClose size=\"xs\" className={cnTextField('ClearButtonIcon')} />\n </button>\n )}\n\n {type === 'password' && value && (\n <button\n className={cnTextField('ClearButton')}\n type=\"button\"\n onClick={handleEyeClick}\n >\n <Eye className={cnTextField('Icon')} size={iconSize} />\n </button>\n )}\n\n {RightIcon && type !== 'number' && type !== 'password' && (\n <div\n className={cnTextField('Side', {\n position: 'right',\n type: rightSideIsString ? 'string' : 'icon',\n })}\n title={typeof rightSide === 'string' ? rightSide : undefined}\n >\n {rightSideIsString ? (\n rightSide\n ) : (\n <RightIcon className={cnTextField('Icon')} size={iconSize} />\n )}\n </div>\n )}\n </div>\n {caption && (\n <FieldCaption\n className={cnTextField('Caption')}\n status={status || state}\n >\n {caption}\n </FieldCaption>\n )}\n </div>\n </div>\n );\n};\n\nexport const TextField = forwardRef(TextFieldRender) as TextFieldComponent;\nexport * from './types';\n"],"mappings":"krBAAA,wBAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,OAASC,OAAT,KAAwB,uBAAxB,CACA,OAASC,YAAT,KAA6B,4BAA7B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,WAA5B,CAAyCC,SAAzC,KAA0D,OAA1D,CACA,MAAOC,iBAAP,KAA6B,yBAA7B,CAEA,OAASC,OAAT,mCACA,OAASC,UAAT,yCACA,OAASC,aAAT,+CACA,OAASC,YAAT,6CACA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,QAAT,+BACA,OAASC,eAAT,2CACA,OAASC,YAAT,oCACA,OAASC,UAAT,gCACA,OACEC,gBADF,CAEEC,gBAFF,CAGEC,cAHF,CAIEC,OAJF,iBAMA,OAEEC,wBAFF,CAIEC,wBAJF,CAKEC,wBALF,CAMEC,yBANF,eASA,MAAO,IAAMC,eAAc,CAAG,WAAvB,CACP,MAAO,IAAMC,YAAW,CAAGf,EAAE,aAAtB,CAEP,MAAO,IAAMgB,gBAAe,CAAG,SAC7BC,CAD6B,CAE7BC,CAF6B,CAG1B,IACGC,EAAY,CAAG5B,KAAK,CAAC6B,MAAN,CAA6B,IAA7B,CADlB,CAEGC,CAAQ,CAAG9B,KAAK,CAAC6B,MAAN,CAA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GhB,oBAAC,EAAD,EAAW,SAAS,CAAE/B,WAAW,CAAC,MAAD,CAAjC,CAA2C,IAAI,CAAE+C,EAAjD,EAVJ,CA5EJ,CADF,CA4FGF,CAAO,EACN,oBAAC,YAAD,EACE,SAAS,CAAE7C,WAAW,CAAC,SAAD,CADxB,CAEE,MAAM,CAAEwB,CAAM,EAAID,CAFpB,EAIGsB,CAJH,CA7FJ,CAfF,CAsHH,CA7TM,CA+TP,MAAO,IAAMqD,UAAS,CAAGzH,UAAU,CAACwB,eAAD,CAA5B,CACP"}
|
|
1
|
+
{"version":3,"file":"TextField.js","names":["IconClose","IconEye","IconEyeClose","IconSelect","IconSelectOpen","React","forwardRef","useCallback","useEffect","TextAreaAutoSize","useFlag","useForkRef","useMutableRef","useSortSteps","cn","getByMap","isString","usePropsHandler","FieldCaption","FieldLabel","getIncrementFlag","getTypeForRender","getValueByStep","sizeMap","textFieldPropFormDefault","textFieldPropSizeDefault","textFieldPropViewDefault","textFieldPropWidthDefault","COMPONENT_NAME","cnTextField","TextFieldRender","props","ref","textFieldRef","useRef","inputRef","className","type","value","onChange","id","name","rows","cols","minRows","maxRows","inputRefProp","maxLength","disabled","size","view","form","state","status","width","onBlur","onFocus","autoFocus","placeholder","leftSide","rightSide","autoComplete","withClearButton","incrementButtons","max","min","readOnly","required","step","tabIndex","ariaLabel","label","labelIcon","inputContainerRef","labelPosition","caption","iconSizeProp","iconSize","focused","onClick","onKeyDownProp","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","otherProps","focus","setFocus","passwordVisible","setPasswordVisuble","valueRef","onClickRef","onChangeRef","handleEyeClick","e","stopPropagation","toggle","current","LeftIcon","RightIcon","leftSideIsString","rightSideIsString","sortedSteps","handleChange","target","handleFocus","on","commonProps","handleBlur","off","toString","Eye","textareaProps","inputProps","Array","isArray","flag","preventDefault","handleClear","changeNumberValue","isIncrement","rootProps","selectionStart","length","withValue","position","TextField"],"sources":["../../../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import './TextField.css';\n\nimport { IconClose } from '@consta/icons/IconClose';\nimport { IconEye } from '@consta/icons/IconEye';\nimport { IconEyeClose } from '@consta/icons/IconEyeClose';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport { IconSelectOpen } from '@consta/icons/IconSelectOpen';\nimport React, { forwardRef, useCallback, useEffect } from 'react';\nimport TextAreaAutoSize from 'react-textarea-autosize';\n\nimport { useFlag } from '../../hooks/useFlag/useFlag';\nimport { useForkRef } from '../../hooks/useForkRef/useForkRef';\nimport { useMutableRef } from '../../hooks/useMutableRef/useMutableRef';\nimport { useSortSteps } from '../../hooks/useSortSteps/useSortSteps';\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { isString } from '../../utils/type-guards';\nimport { usePropsHandler } from '../EventInterceptor/usePropsHandler';\nimport { FieldCaption } from '../FieldCaption/FieldCaption';\nimport { FieldLabel } from '../FieldLabel/FieldLabel';\nimport {\n getIncrementFlag,\n getTypeForRender,\n getValueByStep,\n sizeMap,\n} from './helpers';\nimport {\n TextFieldComponent,\n textFieldPropFormDefault,\n TextFieldProps,\n textFieldPropSizeDefault,\n textFieldPropViewDefault,\n textFieldPropWidthDefault,\n} from './types';\n\nexport const COMPONENT_NAME = 'TextField' as const;\nexport const cnTextField = cn(COMPONENT_NAME);\n\nexport const TextFieldRender = <TYPE extends string>(\n props: TextFieldProps<TYPE>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const textFieldRef = React.useRef<HTMLDivElement>(null);\n const inputRef = React.useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n\n const {\n className,\n type = 'text',\n value,\n onChange,\n id,\n name,\n rows,\n cols,\n minRows,\n maxRows,\n inputRef: inputRefProp,\n maxLength,\n disabled,\n size = textFieldPropSizeDefault,\n view = textFieldPropViewDefault,\n form = textFieldPropFormDefault,\n state,\n status,\n width = textFieldPropWidthDefault,\n onBlur,\n onFocus,\n autoFocus = false,\n placeholder,\n leftSide,\n rightSide,\n autoComplete,\n withClearButton,\n incrementButtons = true,\n max,\n min,\n readOnly,\n required,\n step = 1,\n tabIndex,\n ariaLabel,\n label,\n labelIcon,\n inputContainerRef,\n labelPosition = 'top',\n caption,\n iconSize: iconSizeProp,\n focused,\n onClick,\n // onkey props\n onKeyDown: onKeyDownProp,\n onKeyDownCapture,\n onKeyPress,\n onKeyPressCapture,\n onKeyUp,\n onKeyUpCapture,\n ...otherProps\n } = usePropsHandler(COMPONENT_NAME, props, textFieldRef);\n const [focus, setFocus] = useFlag(autoFocus);\n const [passwordVisible, setPasswordVisuble] = useFlag(false);\n\n const valueRef = useMutableRef(value);\n const onClickRef = useMutableRef(onClick);\n const onChangeRef = useMutableRef(onChange);\n\n const handleEyeClick = useCallback(\n (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n e.stopPropagation();\n setPasswordVisuble.toggle();\n inputRef.current?.focus();\n },\n [],\n );\n\n const textarea = type === 'textarea';\n const LeftIcon = leftSide;\n const RightIcon = rightSide;\n const leftSideIsString = isString(leftSide);\n const rightSideIsString = isString(rightSide);\n const iconSize = getByMap(sizeMap, size, iconSizeProp);\n\n const sortedSteps = useSortSteps({\n step,\n min: Number(min),\n max: Number(max),\n });\n\n const handleChange: React.ChangeEventHandler<\n HTMLInputElement | HTMLTextAreaElement\n > = useCallback(\n (e) => {\n !disabled &&\n onChangeRef.current?.({ e, id, name, value: e.target.value || null });\n },\n [id, name, disabled],\n );\n\n const handleBlur: React.FocusEventHandler<HTMLElement> = (e) => {\n setFocus.off();\n onBlur?.(e);\n };\n\n const handleFocus: React.FocusEventHandler<HTMLElement> = (e) => {\n setFocus.on();\n onFocus?.(e);\n };\n\n const commonProps = {\n 'className': cnTextField('Input'),\n 'value': value || '',\n 'onChange': handleChange,\n maxLength,\n disabled,\n 'onBlur': handleBlur,\n 'onFocus': handleFocus,\n autoFocus,\n placeholder,\n autoComplete,\n readOnly,\n tabIndex,\n name,\n onKeyDownCapture,\n onKeyPress,\n onKeyPressCapture,\n onKeyUp,\n onKeyUpCapture,\n 'id': id ? id.toString() : '',\n 'aria-label': ariaLabel,\n };\n\n const Eye = passwordVisible ? IconEyeClose : IconEye;\n\n const onKeyDown = (e: React.KeyboardEvent) => {\n const flag = getIncrementFlag(e);\n onKeyDownProp?.(e);\n if (type === 'number' && typeof flag === 'boolean' && !disabled) {\n e.preventDefault();\n onChange?.({\n e,\n value: getValueByStep(sortedSteps, value, flag, min, max),\n });\n }\n };\n\n const textareaProps = {\n rows,\n cols,\n minRows: minRows || rows,\n maxRows: maxRows || rows,\n ref: useForkRef([inputRef, inputRefProp]) as (\n node: HTMLTextAreaElement,\n ) => void,\n };\n\n const inputProps = {\n type: getTypeForRender(type, passwordVisible),\n max,\n min,\n step: !Array.isArray(sortedSteps) ? sortedSteps : 0,\n onKeyDown,\n ref: useForkRef([\n inputRef,\n inputRefProp,\n ]) as React.RefCallback<HTMLInputElement>,\n };\n\n const handleClear = useCallback((e: React.MouseEvent<HTMLButtonElement>) => {\n onChangeRef.current?.({\n e,\n value: null,\n });\n }, []);\n\n const changeNumberValue = (\n e: React.MouseEvent<HTMLButtonElement>,\n isIncrement = true,\n ) => {\n onChange?.({\n e,\n value: getValueByStep(sortedSteps, value, isIncrement, min, max),\n });\n };\n\n const rootProps = {\n onClick: useCallback((e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n inputRef.current?.focus();\n onClickRef.current?.(e);\n }, []),\n };\n\n // при смене passwordVible, перемещаем курсор в конец строки\n useEffect(() => {\n if (type === 'password' && inputRef.current) {\n inputRef.current.selectionStart = valueRef.current?.length || 0;\n }\n }, [passwordVisible]);\n\n return (\n <div\n className={cnTextField({ labelPosition, size, view, width }, [className])}\n ref={useForkRef([ref, textFieldRef])}\n {...rootProps}\n {...otherProps}\n >\n {label && (\n <FieldLabel\n icon={labelIcon}\n required={required}\n className={cnTextField('Label', { labelPosition })}\n size={size}\n >\n {label}\n </FieldLabel>\n )}\n <div className={cnTextField('Body')}>\n <div\n ref={inputContainerRef}\n className={cnTextField('InputContainer', {\n view,\n form,\n status: status || state,\n disabled,\n type,\n focus: focus || focused,\n withValue: !!value,\n })}\n >\n {LeftIcon && (\n <div\n className={cnTextField('Side', {\n position: 'left',\n type: leftSideIsString ? 'string' : 'icon',\n })}\n title={typeof leftSide === 'string' ? leftSide : undefined}\n >\n {leftSideIsString ? (\n leftSide\n ) : (\n <LeftIcon className={cnTextField('Icon')} size={iconSize} />\n )}\n </div>\n )}\n {textarea ? (\n <TextAreaAutoSize {...commonProps} {...textareaProps} />\n ) : (\n <input {...commonProps} {...inputProps} />\n )}\n\n {type === 'number' && incrementButtons && (\n <div className={cnTextField('Counter')}>\n <button\n onFocus={handleFocus}\n onClick={(e) => changeNumberValue(e, true)}\n type=\"button\"\n className={cnTextField('CounterButton')}\n >\n <IconSelectOpen size=\"xs\" />\n </button>\n <button\n onFocus={handleFocus}\n onClick={(e) => changeNumberValue(e, false)}\n type=\"button\"\n className={cnTextField('CounterButton')}\n >\n <IconSelect size=\"xs\" />\n </button>\n </div>\n )}\n\n {value && withClearButton && type !== 'number' && (\n <button\n type=\"button\"\n disabled={disabled}\n onClick={handleClear}\n className={cnTextField('ClearButton')}\n >\n <IconClose size=\"xs\" className={cnTextField('ClearButtonIcon')} />\n </button>\n )}\n\n {type === 'password' && value && (\n <button\n className={cnTextField('ClearButton')}\n type=\"button\"\n onClick={handleEyeClick}\n >\n <Eye className={cnTextField('Icon')} size={iconSize} />\n </button>\n )}\n\n {RightIcon && type !== 'number' && type !== 'password' && (\n <div\n className={cnTextField('Side', {\n position: 'right',\n type: rightSideIsString ? 'string' : 'icon',\n })}\n title={typeof rightSide === 'string' ? rightSide : undefined}\n >\n {rightSideIsString ? (\n rightSide\n ) : (\n <RightIcon className={cnTextField('Icon')} size={iconSize} />\n )}\n </div>\n )}\n </div>\n {caption && (\n <FieldCaption\n className={cnTextField('Caption')}\n status={status || state}\n >\n {caption}\n </FieldCaption>\n )}\n </div>\n </div>\n );\n};\n\nexport const TextField = forwardRef(TextFieldRender) as TextFieldComponent;\nexport * from './types';\n"],"mappings":"8rBAAA,wBAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,OAASC,OAAT,KAAwB,uBAAxB,CACA,OAASC,YAAT,KAA6B,4BAA7B,CACA,OAASC,UAAT,KAA2B,0BAA3B,CACA,OAASC,cAAT,KAA+B,8BAA/B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,WAA5B,CAAyCC,SAAzC,KAA0D,OAA1D,CACA,MAAOC,iBAAP,KAA6B,yBAA7B,CAEA,OAASC,OAAT,mCACA,OAASC,UAAT,yCACA,OAASC,aAAT,+CACA,OAASC,YAAT,6CACA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,QAAT,+BACA,OAASC,eAAT,2CACA,OAASC,YAAT,oCACA,OAASC,UAAT,gCACA,OACEC,gBADF,CAEEC,gBAFF,CAGEC,cAHF,CAIEC,OAJF,iBAMA,OAEEC,wBAFF,CAIEC,wBAJF,CAKEC,wBALF,CAMEC,yBANF,eASA,MAAO,IAAMC,eAAc,CAAG,WAAvB,CACP,MAAO,IAAMC,YAAW,CAAGf,EAAE,aAAtB,CAEP,MAAO,IAAMgB,gBAAe,CAAG,SAC7BC,CAD6B,CAE7BC,CAF6B,CAG1B,IACGC,EAAY,CAAG5B,KAAK,CAAC6B,MAAN,CAA6B,IAA7B,CADlB,CAEGC,CAAQ,CAAG9B,KAAK,CAAC6B,MAAN,CAAqD,IAArD,CAFd,GAwDCjB,eAAe,CAACW,cAAD,CAAiBG,CAAjB,CAAwBE,CAAxB,CAxDhB,CAKDG,CALC,GAKDA,SALC,KAMDC,IANC,CAMDA,CANC,YAMM,MANN,GAODC,CAPC,GAODA,KAPC,CAQDC,CARC,GAQDA,QARC,CASDC,CATC,GASDA,EATC,CAUDC,CAVC,GAUDA,IAVC,CAWDC,CAXC,GAWDA,IAXC,CAYDC,CAZC,GAYDA,IAZC,CAaDC,CAbC,GAaDA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AuHH,CA/TM,CAiUP,MAAO,IAAMqD,UAAS,CAAG1H,UAAU,CAACwB,eAAD,CAA5B,CACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["textFieldPropSize","textFieldPropSizeDefault","textFieldPropView","textFieldPropViewDefault","textFieldPropForm","textFieldPropFormDefault","textFieldPropStatus","textFieldPropWidth","textFieldPropWidthDefault"],"sources":["../../../../../src/components/TextField/types.ts"],"sourcesContent":["import { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { AutoCompete } from '../../utils/types/AutoComplete';\nimport { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type TextFieldPropValue = string | null;\nexport type TextFieldPropName = string;\nexport type TextFieldPropId = string | number;\n\nexport const textFieldPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type TextFieldPropSize = typeof textFieldPropSize[number];\nexport const textFieldPropSizeDefault: TextFieldPropSize = textFieldPropSize[0];\n\nexport type TextFieldPropOnChange = (args: TextFieldOnChangeArguments) => void;\nexport type TextFieldOnChangeArguments = {\n e: React.ChangeEvent | React.MouseEvent | React.KeyboardEvent;\n id?: TextFieldPropId;\n name?: TextFieldPropName;\n value: TextFieldPropValue;\n};\n\nexport const textFieldPropView = ['default', 'clear'] as const;\nexport type TextFieldPropView = typeof textFieldPropView[number];\nexport const textFieldPropViewDefault: TextFieldPropView = textFieldPropView[0];\n\nexport const textFieldPropForm = [\n 'default',\n 'defaultClear',\n 'defaultBrick',\n 'brick',\n 'brickDefault',\n 'brickClear',\n 'brickRound',\n 'round',\n 'roundClear',\n 'roundBrick',\n 'clearRound',\n 'clearDefault',\n 'clearBrick',\n 'clearClear',\n] as const;\nexport type TextFieldPropForm = typeof textFieldPropForm[number];\nexport const textFieldPropFormDefault: TextFieldPropForm = textFieldPropForm[0];\n\nexport const textFieldPropStatus = ['alert', 'success', 'warning'] as const;\nexport type TextFieldPropStatus = typeof textFieldPropStatus[number];\n\nexport const textFieldPropWidth = ['default', 'full'] as const;\nexport type TextFieldPropWidth = typeof textFieldPropWidth[number];\nexport const textFieldPropWidthDefault: TextFieldPropWidth =\n textFieldPropWidth[0];\n\nexport type TextFieldPropsTextareaType<TYPE> = TYPE extends 'textarea'\n ?\n | {\n minRows?: never;\n maxRows?: never;\n rows?: number;\n }\n | {\n rows?: never;\n minRows?: number;\n maxRows?: number;\n }\n : {\n rows?: never;\n minRows?: never;\n maxRows?: never;\n };\n\nexport type TextFieldPropRightSide<TYPE extends string> = TYPE extends\n | 'number'\n | 'password'\n ? {\n rightSide?: never;\n }\n : {\n rightSide?: string | IconComponent;\n };\n\nexport type TextFieldProps<TYPE extends string> = PropsWithHTMLAttributes<\n {\n className?: string;\n value?: TextFieldPropValue;\n cols?: number;\n onChange?: TextFieldPropOnChange;\n id?: TextFieldPropId;\n name?: TextFieldPropName;\n type?: TYPE;\n disabled?: boolean;\n maxLength?: number;\n size?: TextFieldPropSize;\n view?: TextFieldPropView;\n form?: TextFieldPropForm;\n state?: TextFieldPropStatus;\n status?: TextFieldPropStatus;\n width?: TextFieldPropWidth;\n onFocus?: React.FocusEventHandler<HTMLElement>;\n onBlur?: React.FocusEventHandler<HTMLElement>;\n incrementButtons?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n leftSide?: string | IconComponent;\n rightSide?: string | IconComponent;\n withClearButton?: boolean;\n autoComplete?: AutoCompete;\n max?: number | string;\n min?: number | string;\n readOnly?: boolean;\n required?: boolean;\n step?: number | string | number[];\n tabIndex?: number;\n inputContainerRef?: React.Ref<HTMLDivElement>;\n inputRef?: React.Ref<HTMLTextAreaElement | HTMLInputElement>;\n ariaLabel?: string;\n iconSize?: IconPropSize;\n children?: never;\n label?: string;\n caption?: string;\n labelPosition?: 'top' | 'left';\n focused?: boolean;\n onKeyDownCapture?: React.KeyboardEventHandler;\n onKeyPress?: React.KeyboardEventHandler;\n onKeyPressCapture?: React.KeyboardEventHandler;\n onKeyUp?: React.KeyboardEventHandler;\n onKeyUpCapture?: React.KeyboardEventHandler;\n onKeyDown?: React.KeyboardEventHandler;\n },\n HTMLDivElement\n> &\n TextFieldPropsTextareaType<TYPE> &\n TextFieldPropRightSide<TYPE>;\n\nexport type TextFieldComponent = <TYPE extends string>(\n props: TextFieldProps<TYPE> & React.RefAttributes<HTMLElement>,\n) => React.ReactElement | null;\n"],"mappings":"AAUA,MAAO,IAAMA,kBAAiB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAUP,MAAO,IAAME,kBAAiB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAC/B,SAD+B,CAE/B,cAF+B,CAG/B,cAH+B,CAI/B,OAJ+B,CAK/B,cAL+B,CAM/B,YAN+B,CAO/B,YAP+B,CAQ/B,OAR+B,CAS/B,YAT+B,CAU/B,YAV+B,CAW/B,YAX+B,CAY/B,cAZ+B,CAa/B,YAb+B,CAc/B,YAd+B,CAA1B,CAiBP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA5B,CAGP,MAAO,IAAMC,mBAAkB,CAAG,CAAC,SAAD,CAAY,MAAZ,CAA3B,CAEP,MAAO,IAAMC,0BAA6C,CACxDD,kBAAkB,CAAC,CAAD,CADb"}
|
|
1
|
+
{"version":3,"file":"types.js","names":["textFieldPropSize","textFieldPropSizeDefault","textFieldPropView","textFieldPropViewDefault","textFieldPropForm","textFieldPropFormDefault","textFieldPropStatus","textFieldPropWidth","textFieldPropWidthDefault"],"sources":["../../../../../src/components/TextField/types.ts"],"sourcesContent":["import { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { AutoCompete } from '../../utils/types/AutoComplete';\nimport { PropsWithHTMLAttributes } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type TextFieldPropValue = string | null;\nexport type TextFieldPropName = string;\nexport type TextFieldPropId = string | number;\n\nexport const textFieldPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type TextFieldPropSize = typeof textFieldPropSize[number];\nexport const textFieldPropSizeDefault: TextFieldPropSize = textFieldPropSize[0];\n\nexport type TextFieldPropOnChange = (args: TextFieldOnChangeArguments) => void;\nexport type TextFieldOnChangeArguments = {\n e: React.ChangeEvent | React.MouseEvent | React.KeyboardEvent;\n id?: TextFieldPropId;\n name?: TextFieldPropName;\n value: TextFieldPropValue;\n};\n\nexport const textFieldPropView = ['default', 'clear'] as const;\nexport type TextFieldPropView = typeof textFieldPropView[number];\nexport const textFieldPropViewDefault: TextFieldPropView = textFieldPropView[0];\n\nexport const textFieldPropForm = [\n 'default',\n 'defaultClear',\n 'defaultBrick',\n 'brick',\n 'brickDefault',\n 'brickClear',\n 'brickRound',\n 'round',\n 'roundClear',\n 'roundBrick',\n 'clearRound',\n 'clearDefault',\n 'clearBrick',\n 'clearClear',\n] as const;\nexport type TextFieldPropForm = typeof textFieldPropForm[number];\nexport const textFieldPropFormDefault: TextFieldPropForm = textFieldPropForm[0];\n\nexport const textFieldPropStatus = ['alert', 'success', 'warning'] as const;\nexport type TextFieldPropStatus = typeof textFieldPropStatus[number];\n\nexport const textFieldPropWidth = ['default', 'full'] as const;\nexport type TextFieldPropWidth = typeof textFieldPropWidth[number];\nexport const textFieldPropWidthDefault: TextFieldPropWidth =\n textFieldPropWidth[0];\n\nexport type TextFieldPropsTextareaType<TYPE> = TYPE extends 'textarea'\n ?\n | {\n minRows?: never;\n maxRows?: never;\n rows?: number;\n }\n | {\n rows?: never;\n minRows?: number;\n maxRows?: number;\n }\n : {\n rows?: never;\n minRows?: never;\n maxRows?: never;\n };\n\nexport type TextFieldPropRightSide<TYPE extends string> = TYPE extends\n | 'number'\n | 'password'\n ? {\n rightSide?: never;\n }\n : {\n rightSide?: string | IconComponent;\n };\n\nexport type TextFieldProps<TYPE extends string> = PropsWithHTMLAttributes<\n {\n className?: string;\n value?: TextFieldPropValue;\n cols?: number;\n onChange?: TextFieldPropOnChange;\n id?: TextFieldPropId;\n name?: TextFieldPropName;\n type?: TYPE;\n disabled?: boolean;\n maxLength?: number;\n size?: TextFieldPropSize;\n view?: TextFieldPropView;\n form?: TextFieldPropForm;\n state?: TextFieldPropStatus;\n status?: TextFieldPropStatus;\n width?: TextFieldPropWidth;\n onFocus?: React.FocusEventHandler<HTMLElement>;\n onBlur?: React.FocusEventHandler<HTMLElement>;\n incrementButtons?: boolean;\n autoFocus?: boolean;\n placeholder?: string;\n leftSide?: string | IconComponent;\n rightSide?: string | IconComponent;\n withClearButton?: boolean;\n autoComplete?: AutoCompete;\n max?: number | string;\n min?: number | string;\n readOnly?: boolean;\n required?: boolean;\n step?: number | string | number[];\n tabIndex?: number;\n inputContainerRef?: React.Ref<HTMLDivElement>;\n inputRef?: React.Ref<HTMLTextAreaElement | HTMLInputElement>;\n ariaLabel?: string;\n iconSize?: IconPropSize;\n children?: never;\n label?: string;\n labelIcon?: IconComponent;\n caption?: string;\n labelPosition?: 'top' | 'left';\n focused?: boolean;\n onKeyDownCapture?: React.KeyboardEventHandler;\n onKeyPress?: React.KeyboardEventHandler;\n onKeyPressCapture?: React.KeyboardEventHandler;\n onKeyUp?: React.KeyboardEventHandler;\n onKeyUpCapture?: React.KeyboardEventHandler;\n onKeyDown?: React.KeyboardEventHandler;\n },\n HTMLDivElement\n> &\n TextFieldPropsTextareaType<TYPE> &\n TextFieldPropRightSide<TYPE>;\n\nexport type TextFieldComponent = <TYPE extends string>(\n props: TextFieldProps<TYPE> & React.RefAttributes<HTMLElement>,\n) => React.ReactElement | null;\n"],"mappings":"AAUA,MAAO,IAAMA,kBAAiB,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAUP,MAAO,IAAME,kBAAiB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAA1B,CAEP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,kBAAiB,CAAG,CAC/B,SAD+B,CAE/B,cAF+B,CAG/B,cAH+B,CAI/B,OAJ+B,CAK/B,cAL+B,CAM/B,YAN+B,CAO/B,YAP+B,CAQ/B,OAR+B,CAS/B,YAT+B,CAU/B,YAV+B,CAW/B,YAX+B,CAY/B,cAZ+B,CAa/B,YAb+B,CAc/B,YAd+B,CAA1B,CAiBP,MAAO,IAAMC,yBAA2C,CAAGD,iBAAiB,CAAC,CAAD,CAArE,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAA5B,CAGP,MAAO,IAAMC,mBAAkB,CAAG,CAAC,SAAD,CAAY,MAAZ,CAA3B,CAEP,MAAO,IAAMC,0BAA6C,CACxDD,kBAAkB,CAAC,CAAD,CADb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["as","className","size","avatarUrl","name","view","width","onlyAvatar","withArrow","iconRight","onIconRightClick","info","status"];import"./User.css";import{IconSelect}from"@consta/icons/IconSelect";import React from"react";import{cn}from"../../utils/bem";import{getByMap}from"../../utils/getByMap";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{Avatar}from"../Avatar/Avatar";import{Button}from"../Button/Button";import{Text}from"../Text/Text";export var userPropSize=["m","s","l"];export var userPropSizeDefault=userPropSize[0];export var userPropView=["clear","ghost"];export var userPropViewDefault=userPropView[0];export var userPropWidth=["default","full"];export var userPropWidthDefault=userPropWidth[0];export var userPropStatus=["available","remote","out"];export var cnUser=cn("User");var infoSizeMap={s:"2xs",m:"2xs",l:"xs"},iconSizeMap={s:"xs",m:"xs",l:"s"},avatarSizeMap={s:"xs",m:"s",l:"m"},buttonSizeMap={s:"xs",m:"xs",l:"s"};export var User=forwardRefWithAs(function(a,b){var c=a.as,d=void 0===c?"div":c,e=a.className,f=a.size,g=void 0===f?userPropSizeDefault:f,h=a.avatarUrl,i=a.name,j=a.view,k=void 0===j?userPropViewDefault:j,l=a.width,m=void 0===l?userPropWidthDefault:l,n=a.onlyAvatar,o=a.withArrow,p=a.iconRight,q=a.onIconRightClick,r=a.info,s=a.status,t=_objectWithoutProperties(a,_excluded),u=n||!i&&!r,v=p;return React.createElement(d,Object.assign({},t,{className:cnUser({size:g,view:k,width:m,withArrow:o,minified:u},[e]),ref:b}),React.createElement("div",{className:cnUser("AvatarWrapper",{status:s})},React.createElement(Avatar,{size:getByMap(avatarSizeMap,g),url:h,name:i})),!u&&(i||r)&&React.createElement("div",{className:cnUser("Block")},i&&React.createElement(Text,{className:cnUser("Name"),size:g,view:"primary",lineHeight:"2xs"},i),r&&"s"!==g&&React.createElement(Text,{className:cnUser("Info"),size:getByMap(infoSizeMap,g),view:"secondary",lineHeight:"2xs"},r)),o&&React.createElement(IconSelect,{className:cnUser("Icon"),size:getByMap(iconSizeMap,g),view:"secondary"}),v&&!q&&React.createElement(v,{className:cnUser("Icon"),size:getByMap(iconSizeMap,g),view:"secondary"}),v&&q&&React.createElement(Button,{className:cnUser("IconRightButton"),onClick:q,iconRight:v,onlyIcon:!0,type:"button",view:"clear",size:getByMap(buttonSizeMap,g),form:"round"}))});
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["as","className","size","avatarUrl","name","view","width","onlyAvatar","withArrow","iconRight","onIconRightClick","info","status"];import"./User.css";import{IconSelect}from"@consta/icons/IconSelect";import React from"react";import{cn}from"../../utils/bem";import{getByMap}from"../../utils/getByMap";import{forwardRefWithAs}from"../../utils/types/PropsWithAsAttributes";import{Avatar}from"../Avatar/Avatar";import{Button}from"../Button/Button";import{Text}from"../Text/Text";export var userPropSize=["m","s","l"];export var userPropSizeDefault=userPropSize[0];export var userPropView=["clear","ghost"];export var userPropViewDefault=userPropView[0];export var userPropWidth=["default","full"];export var userPropWidthDefault=userPropWidth[0];export var userPropStatus=["available","remote","out"];export var cnUser=cn("User");var infoSizeMap={s:"2xs",m:"2xs",l:"xs"},iconSizeMap={s:"xs",m:"xs",l:"s"},avatarSizeMap={s:"xs",m:"s",l:"m"},buttonSizeMap={s:"xs",m:"xs",l:"s"},nameSizeMap={s:"xs",m:"s",l:"m"};export var User=forwardRefWithAs(function(a,b){var c=a.as,d=void 0===c?"div":c,e=a.className,f=a.size,g=void 0===f?userPropSizeDefault:f,h=a.avatarUrl,i=a.name,j=a.view,k=void 0===j?userPropViewDefault:j,l=a.width,m=void 0===l?userPropWidthDefault:l,n=a.onlyAvatar,o=a.withArrow,p=a.iconRight,q=a.onIconRightClick,r=a.info,s=a.status,t=_objectWithoutProperties(a,_excluded),u=n||!i&&!r,v=p;return React.createElement(d,Object.assign({},t,{className:cnUser({size:g,view:k,width:m,withArrow:o,minified:u},[e]),ref:b}),React.createElement("div",{className:cnUser("AvatarWrapper",{status:s})},React.createElement(Avatar,{size:getByMap(avatarSizeMap,g),url:h,name:i})),!u&&(i||r)&&React.createElement("div",{className:cnUser("Block")},i&&React.createElement(Text,{className:cnUser("Name"),size:nameSizeMap[g],view:"primary",lineHeight:"2xs"},i),r&&"s"!==g&&React.createElement(Text,{className:cnUser("Info"),size:getByMap(infoSizeMap,g),view:"secondary",lineHeight:"2xs"},r)),o&&React.createElement(IconSelect,{className:cnUser("Icon"),size:getByMap(iconSizeMap,g),view:"secondary"}),v&&!q&&React.createElement(v,{className:cnUser("Icon"),size:getByMap(iconSizeMap,g),view:"secondary"}),v&&q&&React.createElement(Button,{className:cnUser("IconRightButton"),onClick:q,iconRight:v,onlyIcon:!0,type:"button",view:"clear",size:getByMap(buttonSizeMap,g),form:"round"}))});
|
|
2
2
|
//# sourceMappingURL=User.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","names":["IconSelect","React","cn","getByMap","forwardRefWithAs","Avatar","Button","Text","userPropSize","userPropSizeDefault","userPropView","userPropViewDefault","userPropWidth","userPropWidthDefault","userPropStatus","cnUser","infoSizeMap","s","m","l","iconSizeMap","avatarSizeMap","buttonSizeMap","User","props","ref","as","className","size","avatarUrl","name","view","width","propOnlyAvatar","onlyAvatar","withArrow","iconRight","onIconRightClick","info","status","otherProps","IconRight","minified"],"sources":["../../../../../src/components/User/User.tsx"],"sourcesContent":["import './User.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport React from 'react';\n\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';\nimport { Avatar } from '../Avatar/Avatar';\nimport { Button, ButtonPropSize } from '../Button/Button';\nimport { Text, TextPropSize } from '../Text/Text';\n\nexport const userPropSize = ['m', 's', 'l'] as const;\nexport type UserPropSize = typeof userPropSize[number];\nexport const userPropSizeDefault: UserPropSize = userPropSize[0];\n\nexport const userPropView = ['clear', 'ghost'] as const;\nexport type UserPropView = typeof userPropView[number];\nexport const userPropViewDefault: UserPropView = userPropView[0];\n\nexport const userPropWidth = ['default', 'full'] as const;\nexport type UserPropWidth = typeof userPropWidth[number];\nexport const userPropWidthDefault: UserPropWidth = userPropWidth[0];\n\nexport const userPropStatus = ['available', 'remote', 'out'] as const;\nexport type UserPropStatus = typeof userPropStatus[number];\n\ntype Props = {\n avatarUrl?: string;\n name?: string;\n size?: UserPropSize;\n view?: UserPropView;\n width?: UserPropWidth;\n status?: UserPropStatus;\n onlyAvatar?: boolean;\n info?: string;\n children?: never;\n} & (\n | {\n withArrow?: boolean;\n iconRight?: never;\n onIconRightClick?: never;\n }\n | {\n withArrow?: never;\n iconRight?: IconComponent;\n onIconRightClick?: (e: React.SyntheticEvent) => void;\n }\n);\n\nexport const cnUser = cn('User');\n\nconst infoSizeMap: Record<UserPropSize, TextPropSize> = {\n s: '2xs',\n m: '2xs',\n l: 'xs',\n};\n\nconst iconSizeMap: Record<UserPropSize, IconPropSize> = {\n s: 'xs',\n m: 'xs',\n l: 's',\n};\n\nconst avatarSizeMap: Record<UserPropSize, IconPropSize> = {\n s: 'xs',\n m: 's',\n l: 'm',\n};\n\nconst buttonSizeMap: Record<UserPropSize, ButtonPropSize> = {\n s: 'xs',\n m: 'xs',\n l: 's',\n};\n\nexport const User = forwardRefWithAs<Props>((props, ref) => {\n const {\n as = 'div',\n className,\n size = userPropSizeDefault,\n avatarUrl,\n name,\n view = userPropViewDefault,\n width = userPropWidthDefault,\n onlyAvatar: propOnlyAvatar,\n withArrow,\n iconRight,\n onIconRightClick,\n info,\n status,\n ...otherProps\n } = props;\n const Tag = as as string;\n const onlyAvatar = propOnlyAvatar || (!name && !info);\n const IconRight = iconRight;\n\n return (\n <Tag\n {...otherProps}\n className={cnUser(\n { size, view, width, withArrow, minified: onlyAvatar },\n [className],\n )}\n ref={ref}\n >\n <div className={cnUser('AvatarWrapper', { status })}>\n <Avatar\n size={getByMap(avatarSizeMap, size)}\n url={avatarUrl}\n name={name}\n />\n </div>\n {!onlyAvatar && (name || info) && (\n <div className={cnUser('Block')}>\n {name && (\n <Text\n className={cnUser('Name')}\n size={size}\n view=\"primary\"\n lineHeight=\"2xs\"\n >\n {name}\n </Text>\n )}\n {info && size !== 's' && (\n <Text\n className={cnUser('Info')}\n size={getByMap(infoSizeMap, size)}\n view=\"secondary\"\n lineHeight=\"2xs\"\n >\n {info}\n </Text>\n )}\n </div>\n )}\n {withArrow && (\n <IconSelect\n className={cnUser('Icon')}\n size={getByMap(iconSizeMap, size)}\n view=\"secondary\"\n />\n )}\n {IconRight && !onIconRightClick && (\n <IconRight\n className={cnUser('Icon')}\n size={getByMap(iconSizeMap, size)}\n view=\"secondary\"\n />\n )}\n {IconRight && onIconRightClick && (\n <Button\n className={cnUser('IconRightButton')}\n onClick={onIconRightClick}\n iconRight={IconRight}\n onlyIcon\n type=\"button\"\n view=\"clear\"\n size={getByMap(buttonSizeMap, size)}\n form=\"round\"\n />\n )}\n </Tag>\n );\n});\n"],"mappings":"uOAAA,mBAGA,OAASA,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,gBAAT,+CACA,OAASC,MAAT,wBACA,OAASC,MAAT,wBACA,OAASC,IAAT,oBAEA,MAAO,IAAMC,aAAY,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,GAAX,CAArB,CAEP,MAAO,IAAMC,oBAAiC,CAAGD,YAAY,CAAC,CAAD,CAAtD,CAEP,MAAO,IAAME,aAAY,CAAG,CAAC,OAAD,CAAU,OAAV,CAArB,CAEP,MAAO,IAAMC,oBAAiC,CAAGD,YAAY,CAAC,CAAD,CAAtD,CAEP,MAAO,IAAME,cAAa,CAAG,CAAC,SAAD,CAAY,MAAZ,CAAtB,CAEP,MAAO,IAAMC,qBAAmC,CAAGD,aAAa,CAAC,CAAD,CAAzD,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,WAAD,CAAc,QAAd,CAAwB,KAAxB,CAAvB,CA0BP,MAAO,IAAMC,OAAM,CAAGb,EAAE,CAAC,MAAD,CAAjB,C,GAEDc,YAA+C,CAAG,CACtDC,CAAC,CAAE,KADmD,CAEtDC,CAAC,CAAE,KAFmD,CAGtDC,CAAC,CAAE,IAHmD,C,CAMlDC,WAA+C,CAAG,CACtDH,CAAC,CAAE,IADmD,CAEtDC,CAAC,CAAE,IAFmD,CAGtDC,CAAC,CAAE,GAHmD,C,CAMlDE,aAAiD,CAAG,CACxDJ,CAAC,CAAE,IADqD,CAExDC,CAAC,CAAE,GAFqD,CAGxDC,CAAC,CAAE,GAHqD,C,CAMpDG,aAAmD,CAAG,CAC1DL,CAAC,CAAE,IADuD,CAE1DC,CAAC,CAAE,IAFuD,CAG1DC,CAAC,CAAE,GAHuD,C,
|
|
1
|
+
{"version":3,"file":"User.js","names":["IconSelect","React","cn","getByMap","forwardRefWithAs","Avatar","Button","Text","userPropSize","userPropSizeDefault","userPropView","userPropViewDefault","userPropWidth","userPropWidthDefault","userPropStatus","cnUser","infoSizeMap","s","m","l","iconSizeMap","avatarSizeMap","buttonSizeMap","nameSizeMap","User","props","ref","as","className","size","avatarUrl","name","view","width","propOnlyAvatar","onlyAvatar","withArrow","iconRight","onIconRightClick","info","status","otherProps","IconRight","minified"],"sources":["../../../../../src/components/User/User.tsx"],"sourcesContent":["import './User.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport { IconSelect } from '@consta/icons/IconSelect';\nimport React from 'react';\n\nimport { cn } from '../../utils/bem';\nimport { getByMap } from '../../utils/getByMap';\nimport { forwardRefWithAs } from '../../utils/types/PropsWithAsAttributes';\nimport { Avatar } from '../Avatar/Avatar';\nimport { Button, ButtonPropSize } from '../Button/Button';\nimport { Text, TextPropSize } from '../Text/Text';\n\nexport const userPropSize = ['m', 's', 'l'] as const;\nexport type UserPropSize = typeof userPropSize[number];\nexport const userPropSizeDefault: UserPropSize = userPropSize[0];\n\nexport const userPropView = ['clear', 'ghost'] as const;\nexport type UserPropView = typeof userPropView[number];\nexport const userPropViewDefault: UserPropView = userPropView[0];\n\nexport const userPropWidth = ['default', 'full'] as const;\nexport type UserPropWidth = typeof userPropWidth[number];\nexport const userPropWidthDefault: UserPropWidth = userPropWidth[0];\n\nexport const userPropStatus = ['available', 'remote', 'out'] as const;\nexport type UserPropStatus = typeof userPropStatus[number];\n\ntype Props = {\n avatarUrl?: string;\n name?: string;\n size?: UserPropSize;\n view?: UserPropView;\n width?: UserPropWidth;\n status?: UserPropStatus;\n onlyAvatar?: boolean;\n info?: string;\n children?: never;\n} & (\n | {\n withArrow?: boolean;\n iconRight?: never;\n onIconRightClick?: never;\n }\n | {\n withArrow?: never;\n iconRight?: IconComponent;\n onIconRightClick?: (e: React.SyntheticEvent) => void;\n }\n);\n\nexport const cnUser = cn('User');\n\nconst infoSizeMap: Record<UserPropSize, TextPropSize> = {\n s: '2xs',\n m: '2xs',\n l: 'xs',\n};\n\nconst iconSizeMap: Record<UserPropSize, IconPropSize> = {\n s: 'xs',\n m: 'xs',\n l: 's',\n};\n\nconst avatarSizeMap: Record<UserPropSize, IconPropSize> = {\n s: 'xs',\n m: 's',\n l: 'm',\n};\n\nconst buttonSizeMap: Record<UserPropSize, ButtonPropSize> = {\n s: 'xs',\n m: 'xs',\n l: 's',\n};\n\nconst nameSizeMap: Record<UserPropSize, TextPropSize> = {\n s: 'xs',\n m: 's',\n l: 'm',\n};\n\nexport const User = forwardRefWithAs<Props>((props, ref) => {\n const {\n as = 'div',\n className,\n size = userPropSizeDefault,\n avatarUrl,\n name,\n view = userPropViewDefault,\n width = userPropWidthDefault,\n onlyAvatar: propOnlyAvatar,\n withArrow,\n iconRight,\n onIconRightClick,\n info,\n status,\n ...otherProps\n } = props;\n const Tag = as as string;\n const onlyAvatar = propOnlyAvatar || (!name && !info);\n const IconRight = iconRight;\n\n return (\n <Tag\n {...otherProps}\n className={cnUser(\n { size, view, width, withArrow, minified: onlyAvatar },\n [className],\n )}\n ref={ref}\n >\n <div className={cnUser('AvatarWrapper', { status })}>\n <Avatar\n size={getByMap(avatarSizeMap, size)}\n url={avatarUrl}\n name={name}\n />\n </div>\n {!onlyAvatar && (name || info) && (\n <div className={cnUser('Block')}>\n {name && (\n <Text\n className={cnUser('Name')}\n size={nameSizeMap[size]}\n view=\"primary\"\n lineHeight=\"2xs\"\n >\n {name}\n </Text>\n )}\n {info && size !== 's' && (\n <Text\n className={cnUser('Info')}\n size={getByMap(infoSizeMap, size)}\n view=\"secondary\"\n lineHeight=\"2xs\"\n >\n {info}\n </Text>\n )}\n </div>\n )}\n {withArrow && (\n <IconSelect\n className={cnUser('Icon')}\n size={getByMap(iconSizeMap, size)}\n view=\"secondary\"\n />\n )}\n {IconRight && !onIconRightClick && (\n <IconRight\n className={cnUser('Icon')}\n size={getByMap(iconSizeMap, size)}\n view=\"secondary\"\n />\n )}\n {IconRight && onIconRightClick && (\n <Button\n className={cnUser('IconRightButton')}\n onClick={onIconRightClick}\n iconRight={IconRight}\n onlyIcon\n type=\"button\"\n view=\"clear\"\n size={getByMap(buttonSizeMap, size)}\n form=\"round\"\n />\n )}\n </Tag>\n );\n});\n"],"mappings":"uOAAA,mBAGA,OAASA,UAAT,KAA2B,0BAA3B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,uBACA,OAASC,QAAT,4BACA,OAASC,gBAAT,+CACA,OAASC,MAAT,wBACA,OAASC,MAAT,wBACA,OAASC,IAAT,oBAEA,MAAO,IAAMC,aAAY,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,GAAX,CAArB,CAEP,MAAO,IAAMC,oBAAiC,CAAGD,YAAY,CAAC,CAAD,CAAtD,CAEP,MAAO,IAAME,aAAY,CAAG,CAAC,OAAD,CAAU,OAAV,CAArB,CAEP,MAAO,IAAMC,oBAAiC,CAAGD,YAAY,CAAC,CAAD,CAAtD,CAEP,MAAO,IAAME,cAAa,CAAG,CAAC,SAAD,CAAY,MAAZ,CAAtB,CAEP,MAAO,IAAMC,qBAAmC,CAAGD,aAAa,CAAC,CAAD,CAAzD,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,WAAD,CAAc,QAAd,CAAwB,KAAxB,CAAvB,CA0BP,MAAO,IAAMC,OAAM,CAAGb,EAAE,CAAC,MAAD,CAAjB,C,GAEDc,YAA+C,CAAG,CACtDC,CAAC,CAAE,KADmD,CAEtDC,CAAC,CAAE,KAFmD,CAGtDC,CAAC,CAAE,IAHmD,C,CAMlDC,WAA+C,CAAG,CACtDH,CAAC,CAAE,IADmD,CAEtDC,CAAC,CAAE,IAFmD,CAGtDC,CAAC,CAAE,GAHmD,C,CAM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AAD,EACE,SAAS,CAAEvB,MAAM,CAAC,MAAD,CADnB,CAEE,IAAI,CAAEZ,QAAQ,CAACiB,WAAD,CAAcS,CAAd,CAFhB,CAGE,IAAI,CAAC,WAHP,EA/CJ,CAqDGa,CAAS,EAAIJ,CAAb,EACC,oBAAC,MAAD,EACE,SAAS,CAAEvB,MAAM,CAAC,iBAAD,CADnB,CAEE,OAAO,CAAEuB,CAFX,CAGE,SAAS,CAAEI,CAHb,CAIE,QAAQ,GAJV,CAKE,IAAI,CAAC,QALP,CAME,IAAI,CAAC,OANP,CAOE,IAAI,CAAEvC,QAAQ,CAACmB,aAAD,CAAgBO,CAAhB,CAPhB,CAQE,IAAI,CAAC,OARP,EAtDJ,CAmEH,CAzFmC,CAA7B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IconComponent } from '@consta/icons/Icon';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
|
|
3
4
|
import { PropForm, PropSize, PropStatus, PropView, RenderItemProps } from '../SelectComponents/types';
|
|
@@ -75,6 +76,7 @@ export declare type UserSelectProps<ITEM = DefaultItem, GROUP = DefaultGroup, MU
|
|
|
75
76
|
getGroupLabel?: PropGetGroupLabel<GROUP>;
|
|
76
77
|
getGroupKey?: PropGetGroupKey<GROUP>;
|
|
77
78
|
label?: string;
|
|
79
|
+
labelIcon?: IconComponent;
|
|
78
80
|
caption?: string;
|
|
79
81
|
labelPosition?: 'top' | 'left';
|
|
80
82
|
}, HTMLDivElement> & (ITEM extends {
|
|
@@ -107,7 +109,7 @@ export declare const isMultipleParams: <ITEM, GROUP>(params: UserSelectProps<ITE
|
|
|
107
109
|
export declare const isNotMultipleParams: <ITEM, GROUP>(params: UserSelectProps<ITEM, GROUP, boolean>) => params is UserSelectProps<ITEM, GROUP, false>;
|
|
108
110
|
export declare function withDefaultGetters<ITEM = DefaultItem, GROUP = DefaultGroup, MULTIPLE extends boolean = false>(props: UserSelectProps<ITEM, GROUP, MULTIPLE>): {
|
|
109
111
|
disabled?: boolean | undefined;
|
|
110
|
-
form?: "default" | "round" | "brick" | "
|
|
112
|
+
form?: "default" | "round" | "defaultClear" | "defaultBrick" | "brick" | "brickDefault" | "brickClear" | "brickRound" | "roundClear" | "roundBrick" | "clearRound" | "clearDefault" | "clearBrick" | "clearClear" | undefined;
|
|
111
113
|
size?: "m" | "s" | "l" | undefined;
|
|
112
114
|
view?: "default" | "clear" | undefined;
|
|
113
115
|
dropdownForm?: "default" | "round" | "brick" | undefined;
|
|
@@ -147,9 +149,10 @@ export declare function withDefaultGetters<ITEM = DefaultItem, GROUP = DefaultGr
|
|
|
147
149
|
getGroupLabel?: PropGetGroupLabel<GROUP> | undefined;
|
|
148
150
|
getGroupKey?: PropGetGroupKey<GROUP> | undefined;
|
|
149
151
|
label?: string | undefined;
|
|
152
|
+
labelIcon?: IconComponent | undefined;
|
|
150
153
|
caption?: string | undefined;
|
|
151
154
|
labelPosition?: "left" | "top" | undefined;
|
|
152
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "size" | "caption" | "form" | "label" | "view" | "status" | "name" | "disabled" | "value" | "multiple" | "required" | "inputRef" | "items" | "dropdownForm" | "ariaLabel" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "labelPosition" | "searchFunction" | "searchValue" | "labelForCreate" | "labelForNotFound" | "onCreate" | "getItemSubLabel" | "getItemAvatarUrl"> & React.RefAttributes<HTMLDivElement> & (ITEM extends {
|
|
155
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "css" | "placeholder" | "onFocus" | "onBlur" | "onChange" | "size" | "caption" | "form" | "label" | "view" | "status" | "name" | "disabled" | "value" | "multiple" | "required" | "inputRef" | "items" | "dropdownForm" | "ariaLabel" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "labelIcon" | "labelPosition" | "searchFunction" | "searchValue" | "labelForCreate" | "labelForNotFound" | "onCreate" | "getItemSubLabel" | "getItemAvatarUrl"> & React.RefAttributes<HTMLDivElement> & (ITEM extends {
|
|
153
156
|
label: string;
|
|
154
157
|
} ? {} : {
|
|
155
158
|
getItemLabel: PropGetItemLabel<ITEM>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["defaultGetItemKey","item","id","defaultGetItemLabel","label","defaultGetItemSubLabel","subLabel","defaultGetItemAvatarUrl","avatarUrl","defaultGetItemGroupKey","groupId","defaultGetItemDisabled","disabled","defaultGetGroupKey","group","defaultGetGroupLabel","isMultipleParams","params","multiple","isNotMultipleParams","withDefaultGetters","props","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupLabel","getGroupKey","getItemSubLabel","getItemAvatarUrl","searchCompare","searchValue","compare","toLocaleLowerCase","indexOf"],"sources":["../../../../../src/components/UserSelect/helpers.ts"],"sourcesContent":["import React from 'react';\n\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport {\n PropForm,\n PropSize,\n PropStatus,\n PropView,\n RenderItemProps,\n} from '../SelectComponents/types';\n\nexport type DefaultItem = {\n label: string;\n id: string | number;\n subLabel?: string;\n avatarUrl?: string;\n groupId?: string | number;\n disabled?: boolean;\n};\n\nexport type DefaultGroup = {\n label: string;\n id: string | number;\n};\n\ntype RenderValueProps<ITEM> = {\n item: ITEM;\n handleRemove?: (e: React.SyntheticEvent) => void;\n};\n\nexport type PropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type PropGetItemSubLabel<ITEM> = (item: ITEM) => string | undefined;\nexport type PropGetItemAvatarUrl<ITEM> = (item: ITEM) => string | undefined;\nexport type PropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type PropGetItemGroupKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type PropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;\nexport type PropGetGroupKey<GROUP> = (group: GROUP) => string | number;\nexport type PropGetGroupLabel<GROUP> = (group: GROUP) => string;\n\ntype PropSearchFunction<ITEM> = (item: ITEM, searchValue: string) => boolean;\ntype PropOnChange<ITEM, MULTIPLE extends boolean> = (props: {\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null;\n e: React.SyntheticEvent;\n}) => void;\ntype PropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type PropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactElement | null;\nexport type PropRenderValue<ITEM> = (\n props: RenderValueProps<ITEM>,\n) => React.ReactElement | null;\n\nexport type UserSelectProps<\n ITEM = DefaultItem,\n GROUP = DefaultGroup,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n disabled?: boolean;\n form?: PropForm;\n size?: Exclude<PropSize, 'xs'>;\n view?: PropView;\n dropdownForm?: 'default' | 'brick' | 'round';\n placeholder?: string;\n ariaLabel?: string;\n dropdownClassName?: string;\n status?: PropStatus;\n dropdownRef?: React.RefObject<HTMLDivElement>;\n name?: string;\n items: ITEM[];\n required?: boolean;\n isLoading?: boolean;\n renderItem?: PropRenderItem<ITEM>;\n renderValue?: PropRenderValue<ITEM>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n onCreate?: (props: { e: React.SyntheticEvent; label: string }) => void;\n inputRef?: React.RefObject<HTMLInputElement>;\n labelForNotFound?: string;\n labelForCreate?: string;\n labelForEmptyItems?: string;\n searchFunction?: PropSearchFunction<ITEM>;\n searchValue?: string;\n multiple?: MULTIPLE;\n value?: PropValue<ITEM, MULTIPLE>;\n onChange: PropOnChange<ITEM, MULTIPLE>;\n groups?: GROUP[];\n getItemLabel?: PropGetItemLabel<ITEM>;\n getItemSubLabel?: PropGetItemSubLabel<ITEM>;\n getItemAvatarUrl?: PropGetItemAvatarUrl<ITEM>;\n getItemKey?: PropGetItemKey<ITEM>;\n getItemGroupKey?: PropGetItemGroupKey<ITEM>;\n getItemDisabled?: PropGetItemDisabled<ITEM>;\n getGroupLabel?: PropGetGroupLabel<GROUP>;\n getGroupKey?: PropGetGroupKey<GROUP>;\n label?: string;\n caption?: string;\n labelPosition?: 'top' | 'left';\n },\n HTMLDivElement\n> &\n (ITEM extends { label: DefaultItem['label'] }\n ? {}\n : { getItemLabel: PropGetItemLabel<ITEM> }) &\n (ITEM extends { id: DefaultItem['id'] }\n ? {}\n : { getItemKey: PropGetItemKey<ITEM> }) &\n (GROUP extends { label: DefaultGroup['label'] }\n ? {}\n : { getGroupLabel: PropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: DefaultGroup['id'] }\n ? {}\n : { getGroupKey: PropGetGroupKey<GROUP> });\n\nexport type UserSelectComponent = <\n ITEM = DefaultItem,\n GROUP = DefaultGroup,\n MULTIPLE extends boolean = false,\n>(\n props: UserSelectProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactElement | null;\n\nexport const defaultGetItemKey: PropGetItemKey<DefaultItem> = (item) => item.id;\nexport const defaultGetItemLabel: PropGetItemLabel<DefaultItem> = (item) =>\n item.label;\nexport const defaultGetItemSubLabel: PropGetItemSubLabel<DefaultItem> = (\n item,\n) => item.subLabel;\nexport const defaultGetItemAvatarUrl: PropGetItemAvatarUrl<DefaultItem> = (\n item,\n) => item.avatarUrl;\nexport const defaultGetItemGroupKey: PropGetItemGroupKey<DefaultItem> = (\n item,\n) => item.groupId;\nexport const defaultGetItemDisabled: PropGetItemDisabled<DefaultItem> = (\n item,\n) => item.disabled;\n\nexport const defaultGetGroupKey: PropGetGroupKey<DefaultGroup> = (group) =>\n group.id;\nexport const defaultGetGroupLabel: PropGetGroupLabel<DefaultGroup> = (group) =>\n group.label;\n\nexport const isMultipleParams = <ITEM, GROUP>(\n params: UserSelectProps<ITEM, GROUP, boolean>,\n): params is UserSelectProps<ITEM, GROUP, true> => {\n return !!params.multiple;\n};\n\nexport const isNotMultipleParams = <ITEM, GROUP>(\n params: UserSelectProps<ITEM, GROUP, boolean>,\n): params is UserSelectProps<ITEM, GROUP, false> => {\n return !params.multiple;\n};\n\nexport function withDefaultGetters<\n ITEM = DefaultItem,\n GROUP = DefaultGroup,\n MULTIPLE extends boolean = false,\n>(props: UserSelectProps<ITEM, GROUP, MULTIPLE>) {\n return {\n ...props,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemGroupKey: props.getItemGroupKey || defaultGetItemGroupKey,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n getGroupLabel: props.getGroupLabel || defaultGetGroupLabel,\n getGroupKey: props.getGroupKey || defaultGetGroupKey,\n getItemSubLabel: props.getItemSubLabel || defaultGetItemSubLabel,\n getItemAvatarUrl: props.getItemAvatarUrl || defaultGetItemAvatarUrl,\n };\n}\n\nexport const searchCompare = (\n searchValue: string,\n compare?: string,\n): boolean => {\n if (!compare) {\n return false;\n }\n\n return (\n compare.toLocaleLowerCase().indexOf(searchValue.toLocaleLowerCase()) !== -1\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["defaultGetItemKey","item","id","defaultGetItemLabel","label","defaultGetItemSubLabel","subLabel","defaultGetItemAvatarUrl","avatarUrl","defaultGetItemGroupKey","groupId","defaultGetItemDisabled","disabled","defaultGetGroupKey","group","defaultGetGroupLabel","isMultipleParams","params","multiple","isNotMultipleParams","withDefaultGetters","props","getItemLabel","getItemKey","getItemGroupKey","getItemDisabled","getGroupLabel","getGroupKey","getItemSubLabel","getItemAvatarUrl","searchCompare","searchValue","compare","toLocaleLowerCase","indexOf"],"sources":["../../../../../src/components/UserSelect/helpers.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\nimport {\n PropForm,\n PropSize,\n PropStatus,\n PropView,\n RenderItemProps,\n} from '../SelectComponents/types';\n\nexport type DefaultItem = {\n label: string;\n id: string | number;\n subLabel?: string;\n avatarUrl?: string;\n groupId?: string | number;\n disabled?: boolean;\n};\n\nexport type DefaultGroup = {\n label: string;\n id: string | number;\n};\n\ntype RenderValueProps<ITEM> = {\n item: ITEM;\n handleRemove?: (e: React.SyntheticEvent) => void;\n};\n\nexport type PropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type PropGetItemSubLabel<ITEM> = (item: ITEM) => string | undefined;\nexport type PropGetItemAvatarUrl<ITEM> = (item: ITEM) => string | undefined;\nexport type PropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type PropGetItemGroupKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type PropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;\nexport type PropGetGroupKey<GROUP> = (group: GROUP) => string | number;\nexport type PropGetGroupLabel<GROUP> = (group: GROUP) => string;\n\ntype PropSearchFunction<ITEM> = (item: ITEM, searchValue: string) => boolean;\ntype PropOnChange<ITEM, MULTIPLE extends boolean> = (props: {\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null;\n e: React.SyntheticEvent;\n}) => void;\ntype PropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type PropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactElement | null;\nexport type PropRenderValue<ITEM> = (\n props: RenderValueProps<ITEM>,\n) => React.ReactElement | null;\n\nexport type UserSelectProps<\n ITEM = DefaultItem,\n GROUP = DefaultGroup,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n disabled?: boolean;\n form?: PropForm;\n size?: Exclude<PropSize, 'xs'>;\n view?: PropView;\n dropdownForm?: 'default' | 'brick' | 'round';\n placeholder?: string;\n ariaLabel?: string;\n dropdownClassName?: string;\n status?: PropStatus;\n dropdownRef?: React.RefObject<HTMLDivElement>;\n name?: string;\n items: ITEM[];\n required?: boolean;\n isLoading?: boolean;\n renderItem?: PropRenderItem<ITEM>;\n renderValue?: PropRenderValue<ITEM>;\n onFocus?: React.FocusEventHandler<HTMLInputElement>;\n onBlur?: React.FocusEventHandler<HTMLInputElement>;\n onCreate?: (props: { e: React.SyntheticEvent; label: string }) => void;\n inputRef?: React.RefObject<HTMLInputElement>;\n labelForNotFound?: string;\n labelForCreate?: string;\n labelForEmptyItems?: string;\n searchFunction?: PropSearchFunction<ITEM>;\n searchValue?: string;\n multiple?: MULTIPLE;\n value?: PropValue<ITEM, MULTIPLE>;\n onChange: PropOnChange<ITEM, MULTIPLE>;\n groups?: GROUP[];\n getItemLabel?: PropGetItemLabel<ITEM>;\n getItemSubLabel?: PropGetItemSubLabel<ITEM>;\n getItemAvatarUrl?: PropGetItemAvatarUrl<ITEM>;\n getItemKey?: PropGetItemKey<ITEM>;\n getItemGroupKey?: PropGetItemGroupKey<ITEM>;\n getItemDisabled?: PropGetItemDisabled<ITEM>;\n getGroupLabel?: PropGetGroupLabel<GROUP>;\n getGroupKey?: PropGetGroupKey<GROUP>;\n label?: string;\n labelIcon?: IconComponent;\n caption?: string;\n labelPosition?: 'top' | 'left';\n },\n HTMLDivElement\n> &\n (ITEM extends { label: DefaultItem['label'] }\n ? {}\n : { getItemLabel: PropGetItemLabel<ITEM> }) &\n (ITEM extends { id: DefaultItem['id'] }\n ? {}\n : { getItemKey: PropGetItemKey<ITEM> }) &\n (GROUP extends { label: DefaultGroup['label'] }\n ? {}\n : { getGroupLabel: PropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: DefaultGroup['id'] }\n ? {}\n : { getGroupKey: PropGetGroupKey<GROUP> });\n\nexport type UserSelectComponent = <\n ITEM = DefaultItem,\n GROUP = DefaultGroup,\n MULTIPLE extends boolean = false,\n>(\n props: UserSelectProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactElement | null;\n\nexport const defaultGetItemKey: PropGetItemKey<DefaultItem> = (item) => item.id;\nexport const defaultGetItemLabel: PropGetItemLabel<DefaultItem> = (item) =>\n item.label;\nexport const defaultGetItemSubLabel: PropGetItemSubLabel<DefaultItem> = (\n item,\n) => item.subLabel;\nexport const defaultGetItemAvatarUrl: PropGetItemAvatarUrl<DefaultItem> = (\n item,\n) => item.avatarUrl;\nexport const defaultGetItemGroupKey: PropGetItemGroupKey<DefaultItem> = (\n item,\n) => item.groupId;\nexport const defaultGetItemDisabled: PropGetItemDisabled<DefaultItem> = (\n item,\n) => item.disabled;\n\nexport const defaultGetGroupKey: PropGetGroupKey<DefaultGroup> = (group) =>\n group.id;\nexport const defaultGetGroupLabel: PropGetGroupLabel<DefaultGroup> = (group) =>\n group.label;\n\nexport const isMultipleParams = <ITEM, GROUP>(\n params: UserSelectProps<ITEM, GROUP, boolean>,\n): params is UserSelectProps<ITEM, GROUP, true> => {\n return !!params.multiple;\n};\n\nexport const isNotMultipleParams = <ITEM, GROUP>(\n params: UserSelectProps<ITEM, GROUP, boolean>,\n): params is UserSelectProps<ITEM, GROUP, false> => {\n return !params.multiple;\n};\n\nexport function withDefaultGetters<\n ITEM = DefaultItem,\n GROUP = DefaultGroup,\n MULTIPLE extends boolean = false,\n>(props: UserSelectProps<ITEM, GROUP, MULTIPLE>) {\n return {\n ...props,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemGroupKey: props.getItemGroupKey || defaultGetItemGroupKey,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n getGroupLabel: props.getGroupLabel || defaultGetGroupLabel,\n getGroupKey: props.getGroupKey || defaultGetGroupKey,\n getItemSubLabel: props.getItemSubLabel || defaultGetItemSubLabel,\n getItemAvatarUrl: props.getItemAvatarUrl || defaultGetItemAvatarUrl,\n };\n}\n\nexport const searchCompare = (\n searchValue: string,\n compare?: string,\n): boolean => {\n if (!compare) {\n return false;\n }\n\n return (\n compare.toLocaleLowerCase().indexOf(searchValue.toLocaleLowerCase()) !== -1\n );\n};\n"],"mappings":"qqBAkIA,MAAO,IAAMA,kBAA8C,CAAG,SAACC,CAAD,QAAUA,EAAI,CAACC,EAAf,CAAvD,CACP,MAAO,IAAMC,oBAAkD,CAAG,SAACF,CAAD,QAChEA,EAAI,CAACG,KAD2D,CAA3D,CAEP,MAAO,IAAMC,uBAAwD,CAAG,SACtEJ,CADsE,QAEnEA,EAAI,CAACK,QAF8D,CAAjE,CAGP,MAAO,IAAMC,wBAA0D,CAAG,SACxEN,CADwE,QAErEA,EAAI,CAACO,SAFgE,CAAnE,CAGP,MAAO,IAAMC,uBAAwD,CAAG,SACtER,CADsE,QAEnEA,EAAI,CAACS,OAF8D,CAAjE,CAGP,MAAO,IAAMC,uBAAwD,CAAG,SACtEV,CADsE,QAEnEA,EAAI,CAACW,QAF8D,CAAjE,CAIP,MAAO,IAAMC,mBAAiD,CAAG,SAACC,CAAD,QAC/DA,EAAK,CAACZ,EADyD,CAA1D,CAEP,MAAO,IAAMa,qBAAqD,CAAG,SAACD,CAAD,QACnEA,EAAK,CAACV,KAD6D,CAA9D,CAGP,MAAO,IAAMY,iBAAgB,CAAG,SAC9BC,CAD8B,CAEmB,CACjD,MAAO,CAAC,CAACA,CAAM,CAACC,QACjB,CAJM,CAMP,MAAO,IAAMC,oBAAmB,CAAG,SACjCF,CADiC,CAEiB,CAClD,MAAO,CAACA,CAAM,CAACC,QAChB,CAJM,CAMP,MAAO,SAASE,mBAAT,CAILC,CAJK,CAI0C,CAC/C,sCACKA,CADL,MAEEC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsBnB,mBAFtC,CAGEoB,UAAU,CAAEF,CAAK,CAACE,UAAN,EAAoBvB,iBAHlC,CAIEwB,eAAe,CAAEH,CAAK,CAACG,eAAN,EAAyBf,sBAJ5C,CAKEgB,eAAe,CAAEJ,CAAK,CAACI,eAAN,EAAyBd,sBAL5C,CAMEe,aAAa,CAAEL,CAAK,CAACK,aAAN,EAAuBX,oBANxC,CAOEY,WAAW,CAAEN,CAAK,CAACM,WAAN,EAAqBd,kBAPpC,CAQEe,eAAe,CAAEP,CAAK,CAACO,eAAN,EAAyBvB,sBAR5C,CASEwB,gBAAgB,CAAER,CAAK,CAACQ,gBAAN,EAA0BtB,uBAT9C,EAWD,CAED,MAAO,IAAMuB,cAAa,CAAG,SAC3BC,CAD2B,CAE3BC,CAF2B,CAGf,SACPA,CADO,EAM+D,CAAC,CAA1E,GAAAA,CAAO,CAACC,iBAAR,GAA4BC,OAA5B,CAAoCH,CAAW,CAACE,iBAAZ,EAApC,CAEH,CAXM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import setYear from"date-fns/setYear";export var leapYear=2020;export var dateComparer=function(c,a){var b,d;return(null!==(b=null===c||void 0===c?void 0:c.getTime())&&void 0!==b?b:0)-(null!==(d=null===a||void 0===a?void 0:a.getTime())&&void 0!==d?d:0)};export var getStartAndEndDate=function(a,b){return[a,b].sort(dateComparer)};export var minDateDefault=setYear(new Date(1970,0,1,0,0,0,0),1);export var maxDateDefault=new Date(9999,11,31,23,59,59);export*from"./isInMinMaxDade";export*from"./isDateRange";export*from"./isOnlyOneDateInRange";export*from"./getCentury";export*from"./startOfCentury";export*from"./endOfCentury";export*from"./isEqualDate";
|
|
1
|
+
import setYear from"date-fns/setYear";export var leapYear=2020;export var dateComparer=function(c,a){var b,d;return(null!==(b=null===c||void 0===c?void 0:c.getTime())&&void 0!==b?b:0)-(null!==(d=null===a||void 0===a?void 0:a.getTime())&&void 0!==d?d:0)};export var getStartAndEndDate=function(a,b){return[a,b].sort(dateComparer)};export var minDateDefault=setYear(new Date(1970,0,1,0,0,0,0),1);export var maxDateDefault=new Date(9999,11,31,23,59,59);export*from"./isInMinMaxDade";export*from"./isDateRange";export*from"./isOnlyOneDateInRange";export*from"./getCentury";export*from"./startOfCentury";export*from"./endOfCentury";export*from"./isEqualDate";export*from"./isDisableDate";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["setYear","leapYear","dateComparer","a","b","getTime","getStartAndEndDate","date1","date2","sort","minDateDefault","Date","maxDateDefault"],"sources":["../../../../../src/utils/date/index.ts"],"sourcesContent":["import setYear from 'date-fns/setYear';\n\nexport const leapYear = 2020;\n\nexport const dateComparer = (a?: Date, b?: Date): number =>\n (a?.getTime() ?? 0) - (b?.getTime() ?? 0);\n\nexport const getStartAndEndDate = (date1: Date, date2: Date): Date[] =>\n [date1, date2].sort(dateComparer);\n\nexport const minDateDefault = setYear(new Date(1970, 0, 1, 0, 0, 0, 0), 1);\nexport const maxDateDefault = new Date(9999, 11, 31, 23, 59, 59);\n\nexport * from './isInMinMaxDade';\nexport * from './isDateRange';\nexport * from './isOnlyOneDateInRange';\nexport * from './getCentury';\nexport * from './startOfCentury';\nexport * from './endOfCentury';\nexport * from './isEqualDate';\n"],"mappings":"AAAA,MAAOA,QAAP,KAAoB,kBAApB,CAEA,MAAO,IAAMC,SAAQ,CAAG,IAAjB,CAEP,MAAO,IAAMC,aAAY,CAAG,SAACC,CAAD,CAAWC,CAAX,gBAC1B,kBAACD,CAAD,WAACA,CAAD,QAACA,CAAC,CAAEE,OAAH,EAAD,gBAAiB,CAAjB,oBAAuBD,CAAvB,WAAuBA,CAAvB,QAAuBA,CAAC,CAAEC,OAAH,EAAvB,gBAAuC,CAAvC,CAD0B,CAArB,CAGP,MAAO,IAAMC,mBAAkB,CAAG,SAACC,CAAD,CAAcC,CAAd,QAChC,CAACD,CAAD,CAAQC,CAAR,EAAeC,IAAf,CAAoBP,YAApB,CADgC,CAA3B,CAGP,MAAO,IAAMQ,eAAc,CAAGV,OAAO,CAAC,GAAIW,KAAJ,CAAS,IAAT,CAAe,CAAf,CAAkB,CAAlB,CAAqB,CAArB,CAAwB,CAAxB,CAA2B,CAA3B,CAA8B,CAA9B,CAAD,CAAmC,CAAnC,CAA9B,CACP,MAAO,IAAMC,eAAc,CAAG,GAAID,KAAJ,CAAS,IAAT,CAAe,EAAf,CAAmB,EAAnB,CAAuB,EAAvB,CAA2B,EAA3B,CAA+B,EAA/B,CAAvB,CAEP,8BACA,2BACA,oCACA,0BACA,8BACA,4BACA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["setYear","leapYear","dateComparer","a","b","getTime","getStartAndEndDate","date1","date2","sort","minDateDefault","Date","maxDateDefault"],"sources":["../../../../../src/utils/date/index.ts"],"sourcesContent":["import setYear from 'date-fns/setYear';\n\nexport const leapYear = 2020;\n\nexport const dateComparer = (a?: Date, b?: Date): number =>\n (a?.getTime() ?? 0) - (b?.getTime() ?? 0);\n\nexport const getStartAndEndDate = (date1: Date, date2: Date): Date[] =>\n [date1, date2].sort(dateComparer);\n\nexport const minDateDefault = setYear(new Date(1970, 0, 1, 0, 0, 0, 0), 1);\nexport const maxDateDefault = new Date(9999, 11, 31, 23, 59, 59);\n\nexport * from './isInMinMaxDade';\nexport * from './isDateRange';\nexport * from './isOnlyOneDateInRange';\nexport * from './getCentury';\nexport * from './startOfCentury';\nexport * from './endOfCentury';\nexport * from './isEqualDate';\nexport * from './isDisableDate';\n"],"mappings":"AAAA,MAAOA,QAAP,KAAoB,kBAApB,CAEA,MAAO,IAAMC,SAAQ,CAAG,IAAjB,CAEP,MAAO,IAAMC,aAAY,CAAG,SAACC,CAAD,CAAWC,CAAX,gBAC1B,kBAACD,CAAD,WAACA,CAAD,QAACA,CAAC,CAAEE,OAAH,EAAD,gBAAiB,CAAjB,oBAAuBD,CAAvB,WAAuBA,CAAvB,QAAuBA,CAAC,CAAEC,OAAH,EAAvB,gBAAuC,CAAvC,CAD0B,CAArB,CAGP,MAAO,IAAMC,mBAAkB,CAAG,SAACC,CAAD,CAAcC,CAAd,QAChC,CAACD,CAAD,CAAQC,CAAR,EAAeC,IAAf,CAAoBP,YAApB,CADgC,CAA3B,CAGP,MAAO,IAAMQ,eAAc,CAAGV,OAAO,CAAC,GAAIW,KAAJ,CAAS,IAAT,CAAe,CAAf,CAAkB,CAAlB,CAAqB,CAArB,CAAwB,CAAxB,CAA2B,CAA3B,CAA8B,CAA9B,CAAD,CAAmC,CAAnC,CAA9B,CACP,MAAO,IAAMC,eAAc,CAAG,GAAID,KAAJ,CAAS,IAAT,CAAe,EAAf,CAAmB,EAAnB,CAAuB,EAAvB,CAA2B,EAA3B,CAA+B,EAA/B,CAAvB,CAEP,8BACA,2BACA,oCACA,0BACA,8BACA,4BACA,2BACA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DateTimePropDisableDates, DateTimePropType } from "../../components/DateTime";
|
|
2
|
+
export declare const isEqualDates: (firstDate: Date, secondDate: Date, mode: DateTimePropType | undefined, timeType?: 'hours' | 'minutes' | 'seconds' | undefined) => boolean;
|
|
3
|
+
export declare const isDisableDate: <TYPE extends "time" | "date" | "month" | "year" | "date-time">(params: {
|
|
4
|
+
date: Date;
|
|
5
|
+
disableDates: DateTimePropDisableDates | undefined;
|
|
6
|
+
mode?: "time" | "date" | "month" | "year" | "date-time" | undefined;
|
|
7
|
+
timeType?: (TYPE extends "time" ? "hours" | "minutes" | "seconds" : undefined) | undefined;
|
|
8
|
+
}) => boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var clearTime=function(a,b,c){var d=null!==c&&void 0!==c?c:{},e=d.hours,f=d.minutes,g=d.seconds,h=d.miliseconds,i=new Date(a);return e&&i.setHours("start"===b?0:23),f&&i.setMinutes("start"===b?0:59),g&&i.setSeconds("start"===b?0:59),h&&i.setMilliseconds("start"===b?0:999),i},isInRangeWithoutTime=function(a,b,c){var d=b.getTime(),e=c.getTime(),f=[clearTime(a,"start",{hours:!0,minutes:!0,seconds:!0,miliseconds:!0}).getTime(),clearTime(a,"end",{hours:!0,minutes:!0,seconds:!0,miliseconds:!0}).getTime()];return d<=f[0]&&f[0]<=e&&d<=f[1]&&f[1]<=e};export var isEqualDates=function(a,b,c){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:"hours";if("time"===c)return"seconds"===d&&clearTime(a,"start",{miliseconds:!0}).getTime()===clearTime(b,"start",{miliseconds:!0}).getTime();var e=[a.getFullYear(),b.getFullYear()],f=[a.getMonth(),b.getMonth()],g=[a.getDate(),b.getDate()];return"year"===c?e[0]===e[1]:"month"===c?f[0]===f[1]&&e[0]===e[1]:g[0]===g[1]&&f[0]===f[1]&&e[0]===e[1]};var isInRange=function(a,b,c,d){var e=4<arguments.length&&arguments[4]!==void 0?arguments[4]:"hours";if("year"===d||"month"===d||"date"===d)return isInRangeWithoutTime(a,b,c);var f=b.getTime(),g=c.getTime(),h=f<=a.getTime()&&a.getTime()<=g;if(isEqualDates(a,c,"date",e)){var i=[clearTime(a,"start",{minutes:"hours"===e,seconds:"hours"===e||"minutes"===e,miliseconds:!1}).getTime(),clearTime(a,"end",{minutes:"hours"===e,seconds:"hours"===e||"minutes"===e,miliseconds:!1}).getTime()];return f<=i[0]&&i[0]<=g&&f<=i[1]&&i[1]<=g}return h};export var isDisableDate=function(a){var b=a.disableDates,c=a.mode,d=a.date,e=a.timeType;return!!b&&!!b.find(function(a){return a instanceof Date?isEqualDates(a,d,c,e):isInRange(d,a[0],a[1],c,e)})};
|
|
2
|
+
//# sourceMappingURL=isDisableDate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDisableDate.js","names":["clearTime","date","type","params","hours","minutes","seconds","miliseconds","copyDate","Date","setHours","setMinutes","setSeconds","setMilliseconds","isInRangeWithoutTime","min","max","minTime","getTime","maxTime","dateTime","isEqualDates","firstDate","secondDate","mode","timeType","years","getFullYear","months","getMonth","dates","getDate","isInRange","minDate","maxDate","compare","dateTimes","isDisableDate","disableDates","find","compareDate"],"sources":["../../../../../src/utils/date/isDisableDate.ts"],"sourcesContent":["import {\n DateTimePropDisableDates,\n DateTimePropType,\n} from '##/components/DateTime';\n\nconst clearTime = (\n date: Date,\n type: 'start' | 'end',\n params?: {\n hours?: boolean;\n minutes?: boolean;\n seconds?: boolean;\n miliseconds?: boolean;\n },\n) => {\n const { hours, minutes, seconds, miliseconds } = params ?? {};\n const copyDate = new Date(date);\n hours && copyDate.setHours(type === 'start' ? 0 : 23);\n minutes && copyDate.setMinutes(type === 'start' ? 0 : 59);\n seconds && copyDate.setSeconds(type === 'start' ? 0 : 59);\n miliseconds && copyDate.setMilliseconds(type === 'start' ? 0 : 999);\n return copyDate;\n};\n\nconst isInRangeWithoutTime = (date: Date, min: Date, max: Date) => {\n const minTime = min.getTime();\n const maxTime = max.getTime();\n const dateTime = [\n clearTime(date, 'start', {\n hours: true,\n minutes: true,\n seconds: true,\n miliseconds: true,\n }).getTime(),\n clearTime(date, 'end', {\n hours: true,\n minutes: true,\n seconds: true,\n miliseconds: true,\n }).getTime(),\n ];\n return (\n minTime <= dateTime[0] &&\n dateTime[0] <= maxTime &&\n minTime <= dateTime[1] &&\n dateTime[1] <= maxTime\n );\n};\n\nexport const isEqualDates = (\n firstDate: Date,\n secondDate: Date,\n mode: DateTimePropType | undefined,\n timeType: 'hours' | 'minutes' | 'seconds' | undefined = 'hours',\n) => {\n if (mode === 'time') {\n if (timeType === 'seconds') {\n return (\n clearTime(firstDate, 'start', { miliseconds: true }).getTime() ===\n clearTime(secondDate, 'start', { miliseconds: true }).getTime()\n );\n }\n return false;\n }\n const years = [firstDate.getFullYear(), secondDate.getFullYear()];\n const months = [firstDate.getMonth(), secondDate.getMonth()];\n const dates = [firstDate.getDate(), secondDate.getDate()];\n\n if (mode === 'year') {\n return years[0] === years[1];\n }\n if (mode === 'month') {\n return months[0] === months[1] && years[0] === years[1];\n }\n\n return (\n dates[0] === dates[1] && months[0] === months[1] && years[0] === years[1]\n );\n};\n\nconst isInRange = (\n date: Date,\n minDate: Date,\n maxDate: Date,\n mode: DateTimePropType | undefined,\n timeType: 'hours' | 'minutes' | 'seconds' | undefined = 'hours',\n) => {\n if (mode === 'year' || mode === 'month' || mode === 'date') {\n return isInRangeWithoutTime(date, minDate, maxDate);\n }\n const minTime = minDate.getTime();\n const maxTime = maxDate.getTime();\n const compare = minTime <= date.getTime() && date.getTime() <= maxTime;\n if (isEqualDates(date, maxDate, 'date', timeType)) {\n const dateTimes = [\n clearTime(date, 'start', {\n minutes: timeType === 'hours',\n seconds: timeType === 'hours' || timeType === 'minutes',\n miliseconds: false,\n }).getTime(),\n clearTime(date, 'end', {\n minutes: timeType === 'hours',\n seconds: timeType === 'hours' || timeType === 'minutes',\n miliseconds: false,\n }).getTime(),\n ];\n return (\n minTime <= dateTimes[0] &&\n dateTimes[0] <= maxTime &&\n minTime <= dateTimes[1] &&\n dateTimes[1] <= maxTime\n );\n }\n return compare;\n};\n\nexport const isDisableDate = <TYPE extends DateTimePropType>(params: {\n date: Date;\n disableDates: DateTimePropDisableDates | undefined;\n mode?: DateTimePropType;\n timeType?: TYPE extends 'time' ? 'hours' | 'minutes' | 'seconds' : undefined;\n}) => {\n const { disableDates, mode, date, timeType } = params;\n if (!disableDates) {\n return false;\n }\n return !!disableDates.find((compareDate) =>\n compareDate instanceof Date\n ? isEqualDates(compareDate, date, mode, timeType)\n : isInRange(date, compareDate[0], compareDate[1], mode, timeType),\n );\n};\n"],"mappings":"GAKMA,UAAS,CAAG,SAChBC,CADgB,CAEhBC,CAFgB,CAGhBC,CAHgB,CASb,cAC8CA,CAD9C,WAC8CA,CAD9C,CAC8CA,CAD9C,CACwD,EADxD,CACKC,CADL,GACKA,KADL,CACYC,CADZ,GACYA,OADZ,CACqBC,CADrB,GACqBA,OADrB,CAC8BC,CAD9B,GAC8BA,WAD9B,CAEGC,CAAQ,CAAG,GAAIC,KAAJ,CAASR,CAAT,CAFd,CAOH,MAJAG,EAAK,EAAII,CAAQ,CAACE,QAAT,CAA2B,OAAT,GAAAR,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AY/B,KAAvB,CACIY,YAAY,CAACmB,CAAD,CAAcvC,CAAd,CAAoBuB,CAApB,CAA0BC,CAA1B,CADhB,CAEIO,SAAS,CAAC/B,CAAD,CAAOuC,CAAW,CAAC,CAAD,CAAlB,CAAuBA,CAAW,CAAC,CAAD,CAAlC,CAAuChB,CAAvC,CAA6CC,CAA7C,CAHY,CAAlB,CAKV,CAfM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const isInMinMaxDate: (date: Date, minDate?: Date, maxDate?: Date, startOf?: ((date: Date) => Date) | undefined, endOf?: ((date: Date) => Date) | undefined) => boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isWithinInterval}from"date-fns";var isMinMax=function(a,b,c){var d=null===b||void 0===b?void 0:b.getTime(),e=null===c||void 0===c?void 0:c.getTime();if(b&&c&&d&&e)return!!(d<e)&&isWithinInterval(a,{start:b,end:c});var f=a.getTime();return d&&!e?d<=f:d||!e||e>=f};export var
|
|
1
|
+
import{isWithinInterval}from"date-fns";var isMinMax=function(a,b,c){var d=null===b||void 0===b?void 0:b.getTime(),e=null===c||void 0===c?void 0:c.getTime();if(b&&c&&d&&e)return!!(d<e)&&isWithinInterval(a,{start:b,end:c});var f=a.getTime();return d&&!e?d<=f:d||!e||e>=f};export var isInMinMaxDate=function(a,b,c,d,e){return!(b||c)||isMinMax(a,d&&b&&d(b)||b,e&&c&&e(c)||c)};
|
|
2
2
|
//# sourceMappingURL=isInMinMaxDade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInMinMaxDade.js","names":["isWithinInterval","isMinMax","date","minDate","maxDate","minDateTime","getTime","maxDateTime","start","end","dateTime","
|
|
1
|
+
{"version":3,"file":"isInMinMaxDade.js","names":["isWithinInterval","isMinMax","date","minDate","maxDate","minDateTime","getTime","maxDateTime","start","end","dateTime","isInMinMaxDate","startOf","endOf"],"sources":["../../../../../src/utils/date/isInMinMaxDade.ts"],"sourcesContent":["import { isWithinInterval } from 'date-fns';\n\nconst isMinMax = (date: Date, minDate?: Date, maxDate?: Date): boolean => {\n const minDateTime = minDate?.getTime();\n const maxDateTime = maxDate?.getTime();\n\n if (minDate && maxDate && minDateTime && maxDateTime) {\n return minDateTime < maxDateTime\n ? isWithinInterval(date, { start: minDate, end: maxDate })\n : false;\n }\n\n const dateTime = date.getTime();\n\n if (minDateTime && !maxDateTime) {\n return minDateTime <= dateTime;\n }\n\n if (!minDateTime && maxDateTime) {\n return maxDateTime >= dateTime;\n }\n\n return true;\n};\n\nexport const isInMinMaxDate = (\n date: Date,\n minDate?: Date,\n maxDate?: Date,\n startOf?: (date: Date) => Date,\n endOf?: (date: Date) => Date,\n): boolean => {\n if (!minDate && !maxDate) {\n return true;\n }\n return isMinMax(\n date,\n (startOf && minDate && startOf(minDate)) || minDate,\n (endOf && maxDate && endOf(maxDate)) || maxDate,\n );\n};\n"],"mappings":"AAAA,OAASA,gBAAT,KAAiC,UAAjC,CAEA,GAAMC,SAAQ,CAAG,SAACC,CAAD,CAAaC,CAAb,CAA6BC,CAA7B,CAAyD,IAClEC,EAAW,QAAGF,CAAH,WAAGA,CAAH,QAAGA,CAAO,CAAEG,OAAT,EADoD,CAElEC,CAAW,QAAGH,CAAH,WAAGA,CAAH,QAAGA,CAAO,CAAEE,OAAT,EAFoD,CAIxE,GAAIH,CAAO,EAAIC,CAAX,EAAsBC,CAAtB,EAAqCE,CAAzC,CACE,SAAOF,CAAW,CAAGE,CAArB,GACIP,gBAAgB,CAACE,CAAD,CAAO,CAAEM,KAAK,CAAEL,CAAT,CAAkBM,GAAG,CAAEL,CAAvB,CAAP,CADpB,CAKF,GAAMM,EAAQ,CAAGR,CAAI,CAACI,OAAL,EAAjB,CAVwE,MAYpED,EAAW,EAAI,CAACE,CAZoD,CAa/DF,CAAW,EAAIK,CAbgD,CAgBnEL,CAAD,GAAgBE,CAhBoD,EAiB/DA,CAAW,EAAIG,CAIzB,CArBD,CAuBA,MAAO,IAAMC,eAAc,CAAG,SAC5BT,CAD4B,CAE5BC,CAF4B,CAG5BC,CAH4B,CAI5BQ,CAJ4B,CAK5BC,CAL4B,CAMhB,SACPV,CAAD,EAAaC,CADL,GAILH,QAAQ,CACbC,CADa,CAEZU,CAAO,EAAIT,CAAX,EAAsBS,CAAO,CAACT,CAAD,CAA9B,EAA4CA,CAF/B,CAGZU,CAAK,EAAIT,CAAT,EAAoBS,CAAK,CAACT,CAAD,CAA1B,EAAwCA,CAH3B,CAKhB,CAfM"}
|