@finam/web-ui-kit-components 3.33.2 → 3.34.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/CHANGELOG.md +10 -0
- package/dist/Avatar/index.d.ts +1 -3
- package/dist/Avatar/index.d.ts.map +1 -1
- package/dist/Avatar/index.js +1 -5
- package/dist/Avatar/utils.d.ts.map +1 -1
- package/dist/Avatar/utils.js.map +1 -1
- package/dist/Breadcrumbs/Breadcrumb/Breadcrumb.d.ts +2 -1
- package/dist/Breadcrumbs/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/Breadcrumbs/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/Breadcrumbs/utils/getRenderOnPageItems.d.ts.map +1 -1
- package/dist/Breadcrumbs/utils/getRenderOnPageItems.js +7 -8
- package/dist/Breadcrumbs/utils/getRenderOnPageItems.js.map +1 -1
- package/dist/Calendar/Calendar.js +8 -1
- package/dist/Calendar/Calendar.js.map +1 -1
- package/dist/Calendar/Calendar.styles.css +1 -1
- package/dist/Calendar/Calendar.styles.d.ts +1 -1
- package/dist/Calendar/Calendar.styles.d.ts.map +1 -1
- package/dist/Calendar/Calendar.styles.js +1 -1
- package/dist/Calendar/Calendar.styles.js.map +1 -1
- package/dist/Calendar/Day/Day.d.ts +3 -2
- package/dist/Calendar/Day/Day.d.ts.map +1 -1
- package/dist/Calendar/Day/Day.js +5 -2
- package/dist/Calendar/Day/Day.js.map +1 -1
- package/dist/Calendar/Day/Day.styles.css +2 -2
- package/dist/Calendar/Day/Day.styles.d.ts.map +1 -1
- package/dist/Calendar/Day/Day.styles.js.map +1 -1
- package/dist/Calendar/Day/index.d.ts +1 -3
- package/dist/Calendar/Day/index.d.ts.map +1 -1
- package/dist/Calendar/Day/index.js +1 -5
- package/dist/Calendar/DayWrapper.d.ts +1 -1
- package/dist/Calendar/DayWrapper.d.ts.map +1 -1
- package/dist/Calendar/DayWrapper.js +15 -7
- package/dist/Calendar/DayWrapper.js.map +1 -1
- package/dist/Calendar/SelectMonthTable/SelectMonthTable.styles.css +1 -1
- package/dist/Calendar/SelectMonthTable/SelectMonthTable.styles.d.ts +1 -1
- package/dist/Calendar/SelectMonthTable/SelectMonthTable.styles.d.ts.map +1 -1
- package/dist/Calendar/SelectMonthTable/SelectMonthTable.styles.js.map +1 -1
- package/dist/Calendar/SelectYearTable/SelectYearTable.styles.css +1 -1
- package/dist/Calendar/SelectYearTable/SelectYearTable.styles.d.ts +1 -1
- package/dist/Calendar/SelectYearTable/SelectYearTable.styles.d.ts.map +1 -1
- package/dist/Calendar/SelectYearTable/SelectYearTable.styles.js.map +1 -1
- package/dist/Calendar/SlideTransition/index.d.ts +1 -3
- package/dist/Calendar/SlideTransition/index.d.ts.map +1 -1
- package/dist/Calendar/SlideTransition/index.js +1 -5
- package/dist/Calendar/utils.js +9 -9
- package/dist/Calendar/utils.js.map +1 -1
- package/dist/CheckboxField/index.d.ts +1 -3
- package/dist/CheckboxField/index.d.ts.map +1 -1
- package/dist/CheckboxField/index.js +1 -5
- package/dist/CheckboxField/types.d.ts +2 -2
- package/dist/CheckboxField/types.d.ts.map +1 -1
- package/dist/Chip/index.d.ts +1 -3
- package/dist/Chip/index.d.ts.map +1 -1
- package/dist/Chip/index.js +1 -5
- package/dist/ClickAwayListener/ClickAwayListener.d.ts.map +1 -1
- package/dist/ClickAwayListener/ClickAwayListener.js +3 -1
- package/dist/ClickAwayListener/ClickAwayListener.js.map +1 -1
- package/dist/ClickAwayListener/index.d.ts +1 -3
- package/dist/ClickAwayListener/index.d.ts.map +1 -1
- package/dist/ClickAwayListener/index.js +1 -5
- package/dist/Counter/index.d.ts +1 -3
- package/dist/Counter/index.d.ts.map +1 -1
- package/dist/Counter/index.js +1 -5
- package/dist/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/DatePicker/DatePicker.js +1 -1
- package/dist/DatePicker/DatePicker.js.map +1 -1
- package/dist/DateTimePeriod/index.d.ts +2 -5
- package/dist/DateTimePeriod/index.d.ts.map +1 -1
- package/dist/DateTimePeriod/index.js +1 -5
- package/dist/DateTimePicker/index.d.ts +1 -3
- package/dist/DateTimePicker/index.d.ts.map +1 -1
- package/dist/DateTimePicker/index.js +1 -5
- package/dist/Dialog/Dialog.js +1 -1
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/DialogActions/index.d.ts +1 -3
- package/dist/DialogActions/index.d.ts.map +1 -1
- package/dist/DialogActions/index.js +1 -5
- package/dist/DialogContent/index.d.ts +1 -3
- package/dist/DialogContent/index.d.ts.map +1 -1
- package/dist/DialogContent/index.js +1 -5
- package/dist/DialogTitle/index.d.ts +1 -3
- package/dist/DialogTitle/index.d.ts.map +1 -1
- package/dist/DialogTitle/index.js +1 -5
- package/dist/Divider/index.d.ts +1 -3
- package/dist/Divider/index.d.ts.map +1 -1
- package/dist/Divider/index.js +1 -5
- package/dist/DraggablePopover/DraggablePopover.d.ts.map +1 -1
- package/dist/DraggablePopover/DraggablePopover.js +2 -2
- package/dist/DraggablePopover/DraggablePopover.js.map +1 -1
- package/dist/DraggablePopover/layersManager.d.ts +1 -1
- package/dist/DraggablePopover/layersManager.d.ts.map +1 -1
- package/dist/DraggablePopover/layersManager.js.map +1 -1
- package/dist/DropDownMenu/index.d.ts +1 -3
- package/dist/DropDownMenu/index.d.ts.map +1 -1
- package/dist/DropDownMenu/index.js +1 -5
- package/dist/FeatureCallout/FeatureCalloutActions/index.d.ts +1 -3
- package/dist/FeatureCallout/FeatureCalloutActions/index.d.ts.map +1 -1
- package/dist/FeatureCallout/FeatureCalloutActions/index.js +1 -5
- package/dist/FeatureCallout/FeatureCalloutText/index.d.ts +1 -3
- package/dist/FeatureCallout/FeatureCalloutText/index.d.ts.map +1 -1
- package/dist/FeatureCallout/FeatureCalloutText/index.js +1 -5
- package/dist/FeatureCallout/FeatureCalloutTitle/index.d.ts +1 -3
- package/dist/FeatureCallout/FeatureCalloutTitle/index.d.ts.map +1 -1
- package/dist/FeatureCallout/FeatureCalloutTitle/index.js +1 -5
- package/dist/FeatureCallout/index.d.ts +4 -7
- package/dist/FeatureCallout/index.d.ts.map +1 -1
- package/dist/FeatureCallout/index.js +1 -5
- package/dist/FeatureCallout/utils.d.ts.map +1 -1
- package/dist/FeatureCallout/utils.js +1 -37
- package/dist/FeatureCallout/utils.js.map +1 -1
- package/dist/FieldHint/index.d.ts +1 -3
- package/dist/FieldHint/index.d.ts.map +1 -1
- package/dist/FieldHint/index.js +1 -5
- package/dist/FilterButton/FilterButton.js +1 -1
- package/dist/FilterButton/FilterButton.js.map +1 -1
- package/dist/FormGroup/index.d.ts +1 -3
- package/dist/FormGroup/index.d.ts.map +1 -1
- package/dist/FormGroup/index.js +1 -5
- package/dist/Loader/index.d.ts +1 -3
- package/dist/Loader/index.d.ts.map +1 -1
- package/dist/Loader/index.js +1 -5
- package/dist/LoaderBackdrop/index.d.ts +1 -3
- package/dist/LoaderBackdrop/index.d.ts.map +1 -1
- package/dist/LoaderBackdrop/index.js +1 -5
- package/dist/LoaderDots/index.d.ts +1 -3
- package/dist/LoaderDots/index.d.ts.map +1 -1
- package/dist/LoaderDots/index.js +1 -5
- package/dist/MarketingButton/useMarketingAnimations.d.ts +2 -2
- package/dist/MarketingButton/useMarketingAnimations.d.ts.map +1 -1
- package/dist/MarketingButton/useMarketingAnimations.js +27 -14
- package/dist/MarketingButton/useMarketingAnimations.js.map +1 -1
- package/dist/Modal/ModalManager.d.ts +1 -1
- package/dist/Modal/ModalManager.d.ts.map +1 -1
- package/dist/Modal/ModalManager.js.map +1 -1
- package/dist/Modal/Portal.js +1 -1
- package/dist/Modal/Portal.js.map +1 -1
- package/dist/ModalsProvider/index.d.ts +1 -3
- package/dist/ModalsProvider/index.d.ts.map +1 -1
- package/dist/ModalsProvider/index.js +1 -6
- package/dist/MultiSelectField/MultiSelectField.d.ts.map +1 -1
- package/dist/MultiSelectField/MultiSelectField.js +3 -8
- package/dist/MultiSelectField/MultiSelectField.js.map +1 -1
- package/dist/MultiSelectField/index.d.ts +1 -3
- package/dist/MultiSelectField/index.d.ts.map +1 -1
- package/dist/MultiSelectField/index.js +1 -5
- package/dist/NumberTextField/NumberTextField.js +4 -4
- package/dist/NumberTextField/NumberTextField.js.map +1 -1
- package/dist/NumberTextField/index.d.ts +1 -3
- package/dist/NumberTextField/index.d.ts.map +1 -1
- package/dist/NumberTextField/index.js +1 -5
- package/dist/NumberTextField/utils.d.ts.map +1 -1
- package/dist/NumberTextField/utils.js +1 -1
- package/dist/NumberTextField/utils.js.map +1 -1
- package/dist/PaginatorNumber/NavButton/index.d.ts +1 -3
- package/dist/PaginatorNumber/NavButton/index.d.ts.map +1 -1
- package/dist/PaginatorNumber/NavButton/index.js +1 -5
- package/dist/PaginatorNumber/PageButton/index.d.ts +1 -3
- package/dist/PaginatorNumber/PageButton/index.d.ts.map +1 -1
- package/dist/PaginatorNumber/PageButton/index.js +1 -5
- package/dist/PaginatorNumber/index.d.ts +1 -3
- package/dist/PaginatorNumber/index.d.ts.map +1 -1
- package/dist/PaginatorNumber/index.js +1 -5
- package/dist/PaginatorOverflow/NavButton/index.d.ts +1 -3
- package/dist/PaginatorOverflow/NavButton/index.d.ts.map +1 -1
- package/dist/PaginatorOverflow/NavButton/index.js +1 -5
- package/dist/PaginatorOverflow/PaginatorOverflow.js +2 -2
- package/dist/PaginatorOverflow/PaginatorOverflow.js.map +1 -1
- package/dist/PaginatorOverflow/index.d.ts +1 -3
- package/dist/PaginatorOverflow/index.d.ts.map +1 -1
- package/dist/PaginatorOverflow/index.js +1 -5
- package/dist/Paper/types.d.ts +6 -1
- package/dist/Paper/types.d.ts.map +1 -1
- package/dist/Paper/utils.d.ts +2 -2
- package/dist/PickersUtilsProvider/defaultDateFormatUtils.js +1 -1
- package/dist/PickersUtilsProvider/defaultDateFormatUtils.js.map +1 -1
- package/dist/PickersUtilsProvider/defaultTimeFormatUtils.js +4 -4
- package/dist/PickersUtilsProvider/defaultTimeFormatUtils.js.map +1 -1
- package/dist/PickersUtilsProvider/utils.js +1 -1
- package/dist/PickersUtilsProvider/utils.js.map +1 -1
- package/dist/ProductCard/layouts/ipo/Content.d.ts +2 -2
- package/dist/ProductCard/layouts/ipo/Content.d.ts.map +1 -1
- package/dist/ProductCard/layouts/ipo/Content.js.map +1 -1
- package/dist/ProductCard/utils.d.ts.map +1 -1
- package/dist/ProductCard/utils.js +4 -1
- package/dist/ProductCard/utils.js.map +1 -1
- package/dist/Skeleton/index.d.ts +2 -3
- package/dist/Skeleton/index.d.ts.map +1 -1
- package/dist/Skeleton/index.js +1 -5
- package/dist/Slider/Slider.js +9 -5
- package/dist/Slider/Slider.js.map +1 -1
- package/dist/Snackbar/Snackbar.js.map +1 -1
- package/dist/Stepper/index.d.ts +2 -3
- package/dist/Stepper/index.d.ts.map +1 -1
- package/dist/Stepper/index.js +1 -5
- package/dist/Tab/Tab.d.ts +2 -1
- package/dist/Tab/Tab.d.ts.map +1 -1
- package/dist/Tab/Tab.js +1 -1
- package/dist/Tab/Tab.js.map +1 -1
- package/dist/Tag/Tag.d.ts.map +1 -1
- package/dist/Tag/Tag.js +2 -13
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tag/Tag.styles.css +1 -1
- package/dist/Tag/Tag.styles.d.ts.map +1 -1
- package/dist/Tag/Tag.styles.js.map +1 -1
- package/dist/TextArea/TextArea.d.ts +9 -4
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +58 -9
- package/dist/TextArea/TextArea.js.map +1 -1
- package/dist/TextArea/TextArea.styles.css +2 -0
- package/dist/TextArea/TextArea.styles.d.ts +2 -0
- package/dist/TextArea/TextArea.styles.d.ts.map +1 -1
- package/dist/TextArea/TextArea.styles.js +3 -1
- package/dist/TextArea/TextArea.styles.js.map +1 -1
- package/dist/Tooltip/Tooltip.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/dist/Avatar/index.js.map +0 -1
- package/dist/Calendar/Day/index.js.map +0 -1
- package/dist/Calendar/SlideTransition/index.js.map +0 -1
- package/dist/CheckboxField/index.js.map +0 -1
- package/dist/Chip/index.js.map +0 -1
- package/dist/ClickAwayListener/index.js.map +0 -1
- package/dist/Counter/index.js.map +0 -1
- package/dist/DateTimePeriod/index.js.map +0 -1
- package/dist/DateTimePicker/index.js.map +0 -1
- package/dist/DialogActions/index.js.map +0 -1
- package/dist/DialogContent/index.js.map +0 -1
- package/dist/DialogTitle/index.js.map +0 -1
- package/dist/Divider/index.js.map +0 -1
- package/dist/DropDownMenu/index.js.map +0 -1
- package/dist/FeatureCallout/FeatureCalloutActions/index.js.map +0 -1
- package/dist/FeatureCallout/FeatureCalloutText/index.js.map +0 -1
- package/dist/FeatureCallout/FeatureCalloutTitle/index.js.map +0 -1
- package/dist/FeatureCallout/index.js.map +0 -1
- package/dist/FieldHint/index.js.map +0 -1
- package/dist/FormGroup/index.js.map +0 -1
- package/dist/Loader/index.js.map +0 -1
- package/dist/LoaderBackdrop/index.js.map +0 -1
- package/dist/LoaderDots/index.js.map +0 -1
- package/dist/ModalsProvider/index.js.map +0 -1
- package/dist/MultiSelectField/index.js.map +0 -1
- package/dist/NumberTextField/index.js.map +0 -1
- package/dist/PaginatorNumber/NavButton/index.js.map +0 -1
- package/dist/PaginatorNumber/PageButton/index.js.map +0 -1
- package/dist/PaginatorNumber/index.js.map +0 -1
- package/dist/PaginatorOverflow/NavButton/index.js.map +0 -1
- package/dist/PaginatorOverflow/index.js.map +0 -1
- package/dist/Skeleton/index.js.map +0 -1
- package/dist/Stepper/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberTextField/NumberTextField.js","sources":["../../src/NumberTextField/NumberTextField.tsx"],"sourcesContent":["import {\n memo,\n Ref,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n FocusEvent,\n ChangeEvent,\n KeyboardEvent,\n MouseEvent,\n useState,\n} from 'react';\nimport classnames from 'clsx';\n\nimport Stepper from '../Stepper/index.js';\nimport TextField, { type TextFieldProps } from '../TextField/index.js';\nimport { triggerChangeEvent } from '../utils/event.js';\nimport { KeyboardEventKey } from '../types.js';\nimport {\n calculateFloatPrecision,\n lastCharIsFloatingSymbol,\n getIntLength,\n normalizeValueByStep,\n} from './utils.js';\nimport { setRef, useForkRef } from '../utils/withForwardedRef.js';\nimport { adornmentStepsStyles } from './NumberTextField.styles.js';\n\nconst MAX_VALUE_DEFAULT = 999999999999;\nconst MIN_VALUE_DEFAULT = -999999999999;\nconst MAX_INT_VALUE = 999999999999999;\nconst MIN_INT_VALUE = -999999999999999;\nexport const STEP_DEFAULT = 1;\n\nexport interface Props extends Omit<TextFieldProps, 'value' | 'step' | 'type'> {\n /** Состояние значения числового поля */\n value?: string | number;\n /** Минимально возможное значение числового поля */\n min?: number;\n /** Максимально возможное значение числового поля */\n max?: number;\n /** Шаг изменения значения числового поля */\n step?: number | ((nextValue: number) => number);\n /** Отображаемое количество цифр дробной части */\n dcpl?: number;\n /** Скрытие кнопок пошагового изменения значения числового поля */\n hideSteps?: boolean;\n /** ref для получения функции управления шагом по увеличению значения */\n upRef?: Ref<VoidFunction | undefined>;\n /** ref для получения функции управления шагом по уменьшению значения */\n downRef?: Ref<VoidFunction | undefined>;\n /** Отключение пошагового изменения на событие onWheel */\n disableOnWheel?: boolean;\n}\n\nconst NumberTextField = forwardRef<HTMLInputElement, Props>(({\n value: valueProp,\n min: minProp,\n max: maxProp,\n step: stepProp = STEP_DEFAULT,\n dcpl: dcplProp,\n hideSteps,\n disableOnWheel,\n upRef,\n downRef,\n size,\n ...textFieldProps\n}, forwardedRef) => {\n const {\n className,\n disabled,\n readOnly,\n onChange,\n onFocus,\n onBlur,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n adornment: adornmentProp,\n } = textFieldProps;\n const [focused, setFocused] = useState<boolean>(false);\n const [hovered, setHovered] = useState<boolean>(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const forkedRef = useForkRef(inputRef, forwardedRef);\n\n const valueParsed = useMemo((): number | undefined => {\n if (typeof valueProp === 'string') {\n if (valueProp.trim() === '') {\n return undefined;\n }\n const numberValue = parseFloat(valueProp);\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue)) {\n return numberValue;\n }\n return 0;\n }\n return valueProp || 0;\n }, [valueProp]);\n const valueParsedRef = useRef<number | undefined>(valueParsed);\n valueParsedRef.current = valueParsed;\n\n const getStep = useCallback((value: number) => (\n typeof stepProp === 'number' ? stepProp : stepProp(value)\n ), [stepProp]);\n\n const getDcpl = useCallback((value: number) => {\n if (dcplProp != null && typeof stepProp === 'number') {\n return dcplProp;\n }\n\n return calculateFloatPrecision(getStep(value || 0));\n }, [dcplProp, stepProp, getStep]);\n\n const getMax = useCallback((value: number) => {\n const dcpl = getDcpl(value);\n if (maxProp == null || Number.isNaN(maxProp) || maxProp <= MIN_INT_VALUE) {\n return MAX_VALUE_DEFAULT / (10 ** dcpl);\n }\n return Math.min(maxProp, MAX_INT_VALUE / (10 ** dcpl));\n }, [getDcpl, maxProp]);\n\n const getMin = useCallback((value: number) => {\n const dcpl = getDcpl(value);\n if (minProp == null || Number.isNaN(minProp) || minProp >= MAX_INT_VALUE) {\n return MIN_VALUE_DEFAULT / (10 ** dcpl);\n }\n return Math.max(minProp, MIN_INT_VALUE / (10 ** dcpl));\n }, [getDcpl, minProp]);\n\n const filterMaxValue = useCallback((value: number) => {\n const max = getMax(value);\n return max < value ? max : value;\n }, [getMax]);\n\n const filterMinValue = useCallback((value: number) => {\n const min = getMin(value);\n return min > value ? min : value;\n }, [getMin]);\n\n const normalizeInputValue = useCallback((value: string) => {\n let formattedValue = (value || '').trim().replace(\n /[^\\d.]/g,\n (str, index) => {\n if (str === ',') return '.'; // нужно для работы цифровой клавиатуры на мобильных утройствах\n if (str === '-' && index === 0) return '-';\n return '';\n },\n ).replace(/\\.+/g, '.');\n let parsedValue = parseFloat(formattedValue);\n if (Number.isNaN(parsedValue)) {\n return formattedValue;\n }\n\n const min = getMin(parsedValue);\n if (min >= 0 && parsedValue < 0) {\n formattedValue = formattedValue.replace('-', '');\n parsedValue = parseFloat(formattedValue);\n }\n const [integerPart, ...fractionParts] = formattedValue.split('.');\n const dcpl = getDcpl(parsedValue);\n const maxIntLength = getIntLength(\n (parsedValue < 0 || formattedValue.startsWith('-'))\n ? min\n : getMax(parsedValue),\n integerPart.length,\n );\n\n if (\n fractionParts?.length &&\n (fractionParts.length > 1 || fractionParts[0].length > dcpl)\n ) {\n formattedValue = `${\n integerPart.substr(0, maxIntLength)\n }.${\n fractionParts.join('').substr(0, dcpl)\n }`;\n } else if (integerPart) {\n formattedValue = formattedValue.replace(\n integerPart,\n integerPart.substr(0, maxIntLength),\n );\n }\n return formattedValue;\n }, [getMin, getMax, getDcpl]);\n\n const fireChange = (value: string | number) => {\n if (inputRef.current) {\n triggerChangeEvent(inputRef.current, value);\n }\n };\n\n const stringValue = useMemo((): string => {\n if (typeof valueProp === 'number') {\n return valueProp.toFixed(getDcpl(valueProp));\n }\n\n if (valueProp == null) {\n return '';\n }\n\n return valueProp;\n }, [valueProp, getDcpl]);\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n onFocus?.(event);\n },\n [onFocus],\n );\n\n const fireFormat = useCallback(() => {\n let value = valueParsedRef.current;\n if (value !== undefined) {\n value = filterMaxValue(value);\n value = filterMinValue(value);\n\n let formattedValue = value.toString();\n\n const dcpl = getDcpl(value);\n if (dcpl === 0 || !lastCharIsFloatingSymbol(formattedValue)) {\n formattedValue = value.toFixed(dcpl);\n }\n\n if (formattedValue !== (valueProp?.toString() || '')) {\n fireChange(formattedValue);\n }\n }\n }, [filterMinValue, filterMaxValue, getDcpl, valueProp]);\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setFocused(false);\n fireFormat();\n onBlur?.(event);\n },\n [fireFormat, onBlur],\n );\n\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n event.persist();\n const selectionStart = event.target.selectionStart;\n const selectionEnd = event.target.selectionEnd;\n const selectionDirection = event.target.selectionDirection || undefined;\n\n event.target.value = normalizeInputValue(event.target.value);\n onChange(event);\n\n if (selectionStart != null && selectionEnd != null && selectionDirection !== 'none') {\n event.target.setSelectionRange(selectionStart, selectionEnd, selectionDirection as any);\n }\n }\n }, [onChange, normalizeInputValue]);\n\n const handleMouseEnter = useCallback(\n (event: MouseEvent<HTMLInputElement>) => {\n setHovered(true);\n onMouseEnter?.(event);\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback(\n (event: MouseEvent<HTMLInputElement>) => {\n setHovered(false);\n onMouseLeave?.(event);\n },\n [onMouseLeave],\n );\n\n const handleWheel = useCallback((event: WheelEvent) => {\n event.preventDefault();\n\n const { deltaY } = event;\n let newValue = valueParsedRef.current || 0;\n const delta = Math.sign(-deltaY);\n const step = getStep(newValue + Math.min(0, delta * getStep(newValue)));\n\n newValue += delta * step;\n const nextStep = getStep(newValue);\n newValue = normalizeValueByStep(\n newValue,\n nextStep,\n getDcpl(newValue),\n delta < 0 ? (nextStep === step ? 'up' : 'down') : nextStep === step ? 'down' : 'up',\n );\n newValue = filterMaxValue(newValue);\n newValue = filterMinValue(newValue);\n\n fireChange(newValue.toFixed(getDcpl(newValue)));\n }, [filterMaxValue, filterMinValue, getDcpl, getStep]);\n\n const isWheelEnabled = focused && hovered && !readOnly && !disabled && !disableOnWheel;\n useEffect(() => {\n if (!isWheelEnabled) return undefined;\n\n const input = inputRef.current;\n if (!input) return undefined;\n\n input.addEventListener('wheel', handleWheel, { passive: false });\n\n return () => {\n input.removeEventListener('wheel', handleWheel);\n };\n }, [isWheelEnabled, handleWheel]);\n\n const handleStepUpClick = useCallback(() => {\n if (disabled) return;\n\n let value = valueParsedRef.current || 0;\n const step = getStep(value);\n\n value += step;\n const nextStep = getStep(value);\n value = normalizeValueByStep(\n value,\n nextStep,\n getDcpl(value),\n nextStep === step ? 'down' : 'up',\n );\n value = filterMaxValue(value);\n\n fireChange(value.toFixed(getDcpl(value)));\n }, [disabled, filterMaxValue, getStep, getDcpl]);\n\n if (upRef != null) {\n setRef(upRef, handleStepUpClick);\n }\n\n const handleStepDownClick = useCallback(() => {\n if (disabled) return;\n\n let value = valueParsedRef.current || 0;\n const step = getStep(value - getStep(value));\n\n value -= step;\n const nextStep = getStep(value);\n value = normalizeValueByStep(\n value,\n nextStep,\n getDcpl(value),\n nextStep === step ? 'up' : 'down',\n );\n value = filterMinValue(value);\n\n fireChange(value.toFixed(getDcpl(value)));\n }, [disabled, filterMinValue, getStep, getDcpl]);\n\n if (downRef != null) {\n setRef(downRef, handleStepDownClick);\n }\n\n const handleKeyDown = useCallback((event: KeyboardEvent<HTMLInputElement>) => {\n if (!readOnly && !event.defaultPrevented) {\n switch (event.key) {\n case KeyboardEventKey.ARROW_UP:\n case KeyboardEventKey.UP:\n event.preventDefault();\n handleStepUpClick();\n break;\n case KeyboardEventKey.ARROW_DOWN:\n case KeyboardEventKey.DOWN:\n event.preventDefault();\n handleStepDownClick();\n break;\n case KeyboardEventKey.ENTER:\n fireFormat();\n break;\n }\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n }, [readOnly, onKeyDown, handleStepUpClick, handleStepDownClick, fireFormat]);\n\n const handleMouseDown = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n if (!event.defaultPrevented) {\n event.preventDefault();\n }\n\n if (!readOnly) {\n inputRef.current?.focus();\n }\n }, [readOnly]);\n\n useEffect(() => {\n if (valueProp && typeof valueProp === 'string' && valueParsed !== undefined) {\n const formattedValue = valueParsed.toFixed(getDcpl(valueParsed));\n\n if (formattedValue !== valueProp) {\n fireChange(formattedValue);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const withSteps = !hideSteps && !readOnly;\n\n const adornment = useMemo(() => {\n if (!withSteps) {\n return adornmentProp;\n }\n\n return (\n <Stepper\n size={size}\n disabled={disabled}\n onIncrement={handleStepUpClick}\n onIncrementMouseDown={handleMouseDown}\n onDecrement={handleStepDownClick}\n onDecrementMouseDown={handleMouseDown}\n tabIndex={-1}\n />\n );\n }, [\n adornmentProp, disabled, handleMouseDown,\n handleStepDownClick, handleStepUpClick, withSteps, size,\n ]);\n\n return (\n <TextField\n {...textFieldProps}\n size={size}\n className={classnames(withSteps ? adornmentStepsStyles : '', className)}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n value={stringValue}\n ref={forkedRef}\n type=\"text\"\n adornment={adornment}\n />\n );\n});\n\nexport default memo(NumberTextField);\n"],"names":["MAX_VALUE_DEFAULT","MIN_VALUE_DEFAULT","MAX_INT_VALUE","MIN_INT_VALUE","STEP_DEFAULT","NumberTextField","forwardRef","valueProp","minProp","maxProp","stepProp","dcplProp","hideSteps","disableOnWheel","upRef","downRef","size","textFieldProps","forwardedRef","className","disabled","readOnly","onChange","onFocus","onBlur","onMouseEnter","onMouseLeave","onKeyDown","adornmentProp","focused","setFocused","useState","hovered","setHovered","inputRef","useRef","forkedRef","useForkRef","valueParsed","useMemo","numberValue","parseFloat","Number","valueParsedRef","getStep","useCallback","value","getDcpl","calculateFloatPrecision","getMax","dcpl","Math","getMin","filterMaxValue","max","filterMinValue","min","normalizeInputValue","formattedValue","str","index","parsedValue","integerPart","fractionParts","maxIntLength","getIntLength","fireChange","triggerChangeEvent","stringValue","handleFocus","event","fireFormat","undefined","lastCharIsFloatingSymbol","handleBlur","handleChange","selectionStart","selectionEnd","selectionDirection","handleMouseEnter","handleMouseLeave","handleWheel","deltaY","newValue","delta","step","nextStep","normalizeValueByStep","isWheelEnabled","useEffect","input","handleStepUpClick","setRef","handleStepDownClick","handleKeyDown","KeyboardEventKey","handleMouseDown","_inputRef_current","withSteps","adornment","Stepper","TextField","classnames","adornmentStepsStyles","memo"],"mappings":";;;;;;;;;;;;;AA6BA,MAAMA,oBAAoB;AAC1B,MAAMC,oB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AAMoB,iBAAiBpB,YAAY,OAAO,CAACS,QAAQT;YAEnD,IAAIoB,mBAAmBnD,WACrB2D,WAAWR;QAEf;IAEF,GAAG,EAAE;IAEL,MAAMwC,YAAY,CAACtF,aAAa,CAACS;IAEjC,MAAM8E,YAAY5D,QAAQ;QACxB,IAAI,CAAC2D,WACH,OAAOtE;QAGT,OAAO,WAAP,GACE,IAACwE,SAAOA;YACN,MAAMpF;YACN,UAAUI;YACV,aAAauE;YACb,sBAAsBK;YACtB,aAAaH;YACb,sBAAsBG;YACtB,UAAU;;IAGhB,GAAG;QACDpE;QAAeR;QAAU4E;QACzBH;QAAqBF;QAAmBO;QAAWlF;KACpD;IAED,OAAO,WAAP,GACE,IAACqF,WAASA,uBAAAA,EAAAA,CAAAA,GACJpF,iBAAAA;QACJ,MAAMD;QACN,WAAWsF,KAAWJ,YAAYK,uBAAuB,IAAIpF;QAC7D,SAASkD;QACT,QAAQK;QACR,WAAWoB;QACX,UAAUnB;QACV,cAAcI;QACd,cAAcC;QACd,OAAOZ;QACP,KAAKhC;QACL,MAAK;QACL,WAAW+D;;AAGjB;AAEA,sDAAeK,KAAKnG"}
|
|
1
|
+
{"version":3,"file":"NumberTextField/NumberTextField.js","sources":["../../src/NumberTextField/NumberTextField.tsx"],"sourcesContent":["import {\n memo,\n Ref,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n FocusEvent,\n ChangeEvent,\n KeyboardEvent,\n MouseEvent,\n useState,\n} from 'react';\nimport classnames from 'clsx';\n\nimport Stepper from '../Stepper/index.js';\nimport TextField, { type TextFieldProps } from '../TextField/index.js';\nimport { triggerChangeEvent } from '../utils/event.js';\nimport { KeyboardEventKey } from '../types.js';\nimport {\n calculateFloatPrecision,\n lastCharIsFloatingSymbol,\n getIntLength,\n normalizeValueByStep,\n} from './utils.js';\nimport { setRef, useForkRef } from '../utils/withForwardedRef.js';\nimport { adornmentStepsStyles } from './NumberTextField.styles.js';\n\nconst MAX_VALUE_DEFAULT = 999999999999;\nconst MIN_VALUE_DEFAULT = -999999999999;\nconst MAX_INT_VALUE = 999999999999999;\nconst MIN_INT_VALUE = -999999999999999;\nexport const STEP_DEFAULT = 1;\n\nexport interface Props extends Omit<TextFieldProps, 'value' | 'step' | 'type'> {\n /** Состояние значения числового поля */\n value?: string | number;\n /** Минимально возможное значение числового поля */\n min?: number;\n /** Максимально возможное значение числового поля */\n max?: number;\n /** Шаг изменения значения числового поля */\n step?: number | ((nextValue: number) => number);\n /** Отображаемое количество цифр дробной части */\n dcpl?: number;\n /** Скрытие кнопок пошагового изменения значения числового поля */\n hideSteps?: boolean;\n /** ref для получения функции управления шагом по увеличению значения */\n upRef?: Ref<VoidFunction | undefined>;\n /** ref для получения функции управления шагом по уменьшению значения */\n downRef?: Ref<VoidFunction | undefined>;\n /** Отключение пошагового изменения на событие onWheel */\n disableOnWheel?: boolean;\n}\n\nconst NumberTextField = forwardRef<HTMLInputElement, Props>(({\n value: valueProp,\n min: minProp,\n max: maxProp,\n step: stepProp = STEP_DEFAULT,\n dcpl: dcplProp,\n hideSteps,\n disableOnWheel,\n upRef,\n downRef,\n size,\n ...textFieldProps\n}, forwardedRef) => {\n const {\n className,\n disabled,\n readOnly,\n onChange,\n onFocus,\n onBlur,\n onMouseEnter,\n onMouseLeave,\n onKeyDown,\n adornment: adornmentProp,\n } = textFieldProps;\n const [focused, setFocused] = useState<boolean>(false);\n const [hovered, setHovered] = useState<boolean>(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const forkedRef = useForkRef(inputRef, forwardedRef);\n\n const valueParsed = useMemo((): number | undefined => {\n if (typeof valueProp === 'string') {\n if (valueProp.trim() === '') {\n return undefined;\n }\n const numberValue = parseFloat(valueProp);\n if (!Number.isNaN(numberValue) && Number.isFinite(numberValue)) {\n return numberValue;\n }\n return 0;\n }\n return valueProp || 0;\n }, [valueProp]);\n const valueParsedRef = useRef<number | undefined>(valueParsed);\n valueParsedRef.current = valueParsed;\n\n const getStep = useCallback((value: number) => (\n typeof stepProp === 'number' ? stepProp : stepProp(value)\n ), [stepProp]);\n\n const getDcpl = useCallback((value: number) => {\n if (dcplProp != null && typeof stepProp === 'number') {\n return dcplProp;\n }\n\n return calculateFloatPrecision(getStep(value || 0));\n }, [dcplProp, stepProp, getStep]);\n\n const getMax = useCallback((value: number) => {\n const dcpl = getDcpl(value);\n if (maxProp == null || Number.isNaN(maxProp) || maxProp <= MIN_INT_VALUE) {\n return MAX_VALUE_DEFAULT / (10 ** dcpl);\n }\n return Math.min(maxProp, MAX_INT_VALUE / (10 ** dcpl));\n }, [getDcpl, maxProp]);\n\n const getMin = useCallback((value: number) => {\n const dcpl = getDcpl(value);\n if (minProp == null || Number.isNaN(minProp) || minProp >= MAX_INT_VALUE) {\n return MIN_VALUE_DEFAULT / (10 ** dcpl);\n }\n return Math.max(minProp, MIN_INT_VALUE / (10 ** dcpl));\n }, [getDcpl, minProp]);\n\n const filterMaxValue = useCallback((value: number) => {\n const max = getMax(value);\n return Math.min(value, max);\n }, [getMax]);\n\n const filterMinValue = useCallback((value: number) => {\n const min = getMin(value);\n return Math.max(value, min);\n }, [getMin]);\n\n const normalizeInputValue = useCallback((value: string) => {\n let formattedValue = (value || '').trim().replace(\n /[^\\d.]/g,\n (str, index) => {\n if (str === ',') return '.'; // нужно для работы цифровой клавиатуры на мобильных утройствах\n if (str === '-' && index === 0) return '-';\n return '';\n },\n ).replace(/\\.+/g, '.');\n let parsedValue = parseFloat(formattedValue);\n if (Number.isNaN(parsedValue)) {\n return formattedValue;\n }\n\n const min = getMin(parsedValue);\n if (min >= 0 && parsedValue < 0) {\n formattedValue = formattedValue.replace('-', '');\n parsedValue = parseFloat(formattedValue);\n }\n const [integerPart, ...fractionParts] = formattedValue.split('.');\n const dcpl = getDcpl(parsedValue);\n const maxIntLength = getIntLength(\n (parsedValue < 0 || formattedValue.startsWith('-'))\n ? min\n : getMax(parsedValue),\n integerPart.length,\n );\n\n if (\n fractionParts?.length &&\n (fractionParts.length > 1 || fractionParts[0].length > dcpl)\n ) {\n formattedValue = `${\n integerPart.slice(0, maxIntLength)\n }.${\n fractionParts.join('').slice(0, dcpl)\n }`;\n } else if (integerPart) {\n formattedValue = formattedValue.replace(\n integerPart,\n integerPart.slice(0, maxIntLength),\n );\n }\n return formattedValue;\n }, [getMin, getMax, getDcpl]);\n\n const fireChange = (value: string | number) => {\n if (inputRef.current) {\n triggerChangeEvent(inputRef.current, value);\n }\n };\n\n const stringValue = useMemo((): string => {\n if (typeof valueProp === 'number') {\n return valueProp.toFixed(getDcpl(valueProp));\n }\n\n if (valueProp == null) {\n return '';\n }\n\n return valueProp;\n }, [valueProp, getDcpl]);\n\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setFocused(true);\n onFocus?.(event);\n },\n [onFocus],\n );\n\n const fireFormat = useCallback(() => {\n let value = valueParsedRef.current;\n if (value !== undefined) {\n value = filterMaxValue(value);\n value = filterMinValue(value);\n\n let formattedValue = value.toString();\n\n const dcpl = getDcpl(value);\n if (dcpl === 0 || !lastCharIsFloatingSymbol(formattedValue)) {\n formattedValue = value.toFixed(dcpl);\n }\n\n if (formattedValue !== (valueProp?.toString() || '')) {\n fireChange(formattedValue);\n }\n }\n }, [filterMinValue, filterMaxValue, getDcpl, valueProp]);\n\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n setFocused(false);\n fireFormat();\n onBlur?.(event);\n },\n [fireFormat, onBlur],\n );\n\n const handleChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n if (onChange) {\n event.persist();\n const selectionStart = event.target.selectionStart;\n const selectionEnd = event.target.selectionEnd;\n const selectionDirection = event.target.selectionDirection || undefined;\n\n event.target.value = normalizeInputValue(event.target.value);\n onChange(event);\n\n if (selectionStart != null && selectionEnd != null && selectionDirection !== 'none') {\n event.target.setSelectionRange(selectionStart, selectionEnd, selectionDirection as any);\n }\n }\n }, [onChange, normalizeInputValue]);\n\n const handleMouseEnter = useCallback(\n (event: MouseEvent<HTMLInputElement>) => {\n setHovered(true);\n onMouseEnter?.(event);\n },\n [onMouseEnter],\n );\n\n const handleMouseLeave = useCallback(\n (event: MouseEvent<HTMLInputElement>) => {\n setHovered(false);\n onMouseLeave?.(event);\n },\n [onMouseLeave],\n );\n\n const handleWheel = useCallback((event: WheelEvent) => {\n event.preventDefault();\n\n const { deltaY } = event;\n let newValue = valueParsedRef.current || 0;\n const delta = Math.sign(-deltaY);\n const step = getStep(newValue + Math.min(0, delta * getStep(newValue)));\n\n newValue += delta * step;\n const nextStep = getStep(newValue);\n newValue = normalizeValueByStep(\n newValue,\n nextStep,\n getDcpl(newValue),\n delta < 0 ? (nextStep === step ? 'up' : 'down') : nextStep === step ? 'down' : 'up',\n );\n newValue = filterMaxValue(newValue);\n newValue = filterMinValue(newValue);\n\n fireChange(newValue.toFixed(getDcpl(newValue)));\n }, [filterMaxValue, filterMinValue, getDcpl, getStep]);\n\n const isWheelEnabled = focused && hovered && !readOnly && !disabled && !disableOnWheel;\n useEffect(() => {\n if (!isWheelEnabled) return undefined;\n\n const input = inputRef.current;\n if (!input) return undefined;\n\n input.addEventListener('wheel', handleWheel, { passive: false });\n\n return () => {\n input.removeEventListener('wheel', handleWheel);\n };\n }, [isWheelEnabled, handleWheel]);\n\n const handleStepUpClick = useCallback(() => {\n if (disabled) return;\n\n let value = valueParsedRef.current || 0;\n const step = getStep(value);\n\n value += step;\n const nextStep = getStep(value);\n value = normalizeValueByStep(\n value,\n nextStep,\n getDcpl(value),\n nextStep === step ? 'down' : 'up',\n );\n value = filterMaxValue(value);\n\n fireChange(value.toFixed(getDcpl(value)));\n }, [disabled, filterMaxValue, getStep, getDcpl]);\n\n if (upRef != null) {\n setRef(upRef, handleStepUpClick);\n }\n\n const handleStepDownClick = useCallback(() => {\n if (disabled) return;\n\n let value = valueParsedRef.current || 0;\n const step = getStep(value - getStep(value));\n\n value -= step;\n const nextStep = getStep(value);\n value = normalizeValueByStep(\n value,\n nextStep,\n getDcpl(value),\n nextStep === step ? 'up' : 'down',\n );\n value = filterMinValue(value);\n\n fireChange(value.toFixed(getDcpl(value)));\n }, [disabled, filterMinValue, getStep, getDcpl]);\n\n if (downRef != null) {\n setRef(downRef, handleStepDownClick);\n }\n\n const handleKeyDown = useCallback((event: KeyboardEvent<HTMLInputElement>) => {\n if (!readOnly && !event.defaultPrevented) {\n switch (event.key) {\n case KeyboardEventKey.ARROW_UP:\n case KeyboardEventKey.UP:\n event.preventDefault();\n handleStepUpClick();\n break;\n case KeyboardEventKey.ARROW_DOWN:\n case KeyboardEventKey.DOWN:\n event.preventDefault();\n handleStepDownClick();\n break;\n case KeyboardEventKey.ENTER:\n fireFormat();\n break;\n }\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n }, [readOnly, onKeyDown, handleStepUpClick, handleStepDownClick, fireFormat]);\n\n const handleMouseDown = useCallback((event: MouseEvent<HTMLButtonElement>) => {\n if (!event.defaultPrevented) {\n event.preventDefault();\n }\n\n if (!readOnly) {\n inputRef.current?.focus();\n }\n }, [readOnly]);\n\n useEffect(() => {\n if (valueProp && typeof valueProp === 'string' && valueParsed !== undefined) {\n const formattedValue = valueParsed.toFixed(getDcpl(valueParsed));\n\n if (formattedValue !== valueProp) {\n fireChange(formattedValue);\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const withSteps = !hideSteps && !readOnly;\n\n const adornment = useMemo(() => {\n if (!withSteps) {\n return adornmentProp;\n }\n\n return (\n <Stepper\n size={size}\n disabled={disabled}\n onIncrement={handleStepUpClick}\n onIncrementMouseDown={handleMouseDown}\n onDecrement={handleStepDownClick}\n onDecrementMouseDown={handleMouseDown}\n tabIndex={-1}\n />\n );\n }, [\n adornmentProp, disabled, handleMouseDown,\n handleStepDownClick, handleStepUpClick, withSteps, size,\n ]);\n\n return (\n <TextField\n {...textFieldProps}\n size={size}\n className={classnames(withSteps ? adornmentStepsStyles : '', className)}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n value={stringValue}\n ref={forkedRef}\n type=\"text\"\n adornment={adornment}\n />\n );\n});\n\nexport default memo(NumberTextField);\n"],"names":["MAX_VALUE_DEFAULT","MIN_VALUE_DEFAULT","MAX_INT_VALUE","MIN_INT_VALUE","STEP_DEFAULT","NumberTextField","forwardRef","valueProp","minProp","maxProp","stepProp","dcplProp","hideSteps","disableOnWheel","upRef","downRef","size","textFieldProps","forwardedRef","className","disabled","readOnly","onChange","onFocus","onBlur","onMouseEnter","onMouseLeave","onKeyDown","adornmentProp","focused","setFocused","useState","hovered","setHovered","inputRef","useRef","forkedRef","useForkRef","valueParsed","useMemo","numberValue","parseFloat","Number","valueParsedRef","getStep","useCallback","value","getDcpl","calculateFloatPrecision","getMax","dcpl","Math","getMin","filterMaxValue","max","filterMinValue","min","normalizeInputValue","formattedValue","str","index","parsedValue","integerPart","fractionParts","maxIntLength","getIntLength","fireChange","triggerChangeEvent","stringValue","handleFocus","event","fireFormat","undefined","lastCharIsFloatingSymbol","handleBlur","handleChange","selectionStart","selectionEnd","selectionDirection","handleMouseEnter","handleMouseLeave","handleWheel","deltaY","newValue","delta","step","nextStep","normalizeValueByStep","isWheelEnabled","useEffect","input","handleStepUpClick","setRef","handleStepDownClick","handleKeyDown","KeyboardEventKey","handleMouseDown","_inputRef_current","withSteps","adornment","Stepper","TextField","classnames","adornmentStepsStyles","memo"],"mappings":";;;;;;;;;;;;;AA6BA,MAAMA,oBAAoB;AAC1B,MAAMC,oBAAoB;AAC1B,MAAMC,gBAAgB;AACtB,MAAMC,gBAAgB;AACf,MAAMC,eAAe;AAuB5B,MAAMC,kBAAkB,WAAHA,GAAGC,WAAoC,CAAC,IAAD;;;;iCAAC,EAC3D,OAAOC,SAAS,EAChB,KAAKC,OAAO,EACZ,KAAKC,OAAO,EACZ,MAAMC,WAAWN,YAAY,EAC7B,MAAMO,QAAQ,EACdC,SAAS,EACTC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MAAMpF;YACN,UAAUI;YACV,aAAauE;YACb,sBAAsBK;YACtB,aAAaH;YACb,sBAAsBG;YACtB,UAAU;;IAGhB,GAAG;QACDpE;QAAeR;QAAU4E;QACzBH;QAAqBF;QAAmBO;QAAWlF;KACpD;IAED,OAAO,WAAP,GACE,IAACqF,WAASA,uBAAAA,EAAAA,CAAAA,GACJpF,iBAAAA;QACJ,MAAMD;QACN,WAAWsF,KAAWJ,YAAYK,uBAAuB,IAAIpF;QAC7D,SAASkD;QACT,QAAQK;QACR,WAAWoB;QACX,UAAUnB;QACV,cAAcI;QACd,cAAcC;QACd,OAAOZ;QACP,KAAKhC;QACL,MAAK;QACL,WAAW+D;;AAGjB;AAEA,sDAAeK,KAAKnG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/NumberTextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/NumberTextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/NumberTextField/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GAAI,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/NumberTextField/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,GAAI,OAAO,MAAM,YAAwB,CAAC;AAE/E,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,WAOpD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,eAAe,MAAM,WAMhE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,gBAAgB,IAAI,GAAG,MAAM,WAiB9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const lastCharIsFloatingSymbol = (value)
|
|
1
|
+
const lastCharIsFloatingSymbol = (value)=>/[.,]$/.test(value);
|
|
2
2
|
const calculateFloatPrecision = (value)=>{
|
|
3
3
|
const splitNumber = value.toString().split('.');
|
|
4
4
|
if (splitNumber.length > 1) return splitNumber[1].length;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberTextField/utils.js","sources":["../../src/NumberTextField/utils.ts"],"sourcesContent":["export const lastCharIsFloatingSymbol = (value: string) =>
|
|
1
|
+
{"version":3,"file":"NumberTextField/utils.js","sources":["../../src/NumberTextField/utils.ts"],"sourcesContent":["export const lastCharIsFloatingSymbol = (value: string) => /[.,]$/.test(value);\n\nexport const calculateFloatPrecision = (value: number) => {\n const splitNumber = value.toString().split('.');\n if (splitNumber.length > 1) {\n return splitNumber[1].length;\n }\n\n return 0;\n};\n\nexport const getIntLength = (value: number, defaultLength: number) => {\n if (Number.isFinite(value)) {\n const intValue = parseInt(value.toString(), 10);\n return intValue.toString().length + (intValue === 0 && value < 0 ? 1 : 0);\n }\n return defaultLength;\n};\n\nexport const normalizeValueByStep = (\n value: number,\n step: number,\n dcpl: number,\n roundDirection: 'up' | 'down',\n) => {\n if (!step) {\n return value;\n }\n\n const intifiedValue = Math.round(value * (10 ** dcpl));\n const intifiedStep = step * (10 ** dcpl);\n\n if (intifiedValue % intifiedStep !== 0) {\n const n = roundDirection === 'up'\n ? Math.ceil(intifiedValue / intifiedStep)\n : Math.floor(intifiedValue / intifiedStep);\n return (n * intifiedStep) / (10 ** dcpl);\n }\n\n return value;\n};\n"],"names":["lastCharIsFloatingSymbol","value","calculateFloatPrecision","splitNumber","getIntLength","defaultLength","Number","intValue","parseInt","normalizeValueByStep","step","dcpl","roundDirection","intifiedValue","Math","intifiedStep","n"],"mappings":"AAAO,MAAMA,2BAA2B,CAACC,QAAkB,QAAQ,IAAI,CAACA;AAEjE,MAAMC,0BAA0B,CAACD;IACtC,MAAME,cAAcF,MAAM,QAAQ,GAAG,KAAK,CAAC;IAC3C,IAAIE,YAAY,MAAM,GAAG,GACvB,OAAOA,WAAW,CAAC,EAAE,CAAC,MAAM;IAG9B,OAAO;AACT;AAEO,MAAMC,eAAe,CAACH,OAAeI;IAC1C,IAAIC,OAAO,QAAQ,CAACL,QAAQ;QAC1B,MAAMM,WAAWC,SAASP,MAAM,QAAQ,IAAI;QAC5C,OAAOM,SAAS,QAAQ,GAAG,MAAM,GAAIA,CAAAA,AAAa,MAAbA,YAAkBN,QAAQ,IAAI,IAAI;IACzE;IACA,OAAOI;AACT;AAEO,MAAMI,uBAAuB,CAClCR,OACAS,MACAC,MACAC;IAEA,IAAI,CAACF,MACH,OAAOT;IAGT,MAAMY,gBAAgBC,KAAK,KAAK,CAACb,QAAQ,KAARA,GAAAA,CAAS,IAAMU;IAChD,MAAMI,eAAeL,OAAO,KAAPA,GAAAA,CAAQ,IAAMC;IAEnC,IAAIE,gBAAgBE,iBAAiB,GAAG;QACtC,MAAMC,IAAIJ,AAAmB,SAAnBA,iBACNE,KAAK,IAAI,CAACD,gBAAgBE,gBAC1BD,KAAK,KAAK,CAACD,gBAAgBE;QAC/B,OAAQC,IAAID,eAAAA,KAAAA,GAAAA,CAAiB,IAAMJ;IACrC;IAEA,OAAOV;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PaginatorNumber/NavButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PaginatorNumber/NavButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PaginatorNumber/PageButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PaginatorNumber/PageButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaginatorNumber/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaginatorNumber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PaginatorOverflow/NavButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/PaginatorOverflow/NavButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -26,13 +26,13 @@ const PaginatorOverflow = /*#__PURE__*/ forwardRef(({ count, currentPage, onPage
|
|
|
26
26
|
]);
|
|
27
27
|
const handleInputChange = useCallback((e)=>{
|
|
28
28
|
const value = e.target.value;
|
|
29
|
-
const onlyDigits = value.replace(/
|
|
29
|
+
const onlyDigits = value.replace(/\D/g, '');
|
|
30
30
|
setInputPage(onlyDigits);
|
|
31
31
|
}, []);
|
|
32
32
|
const handleInputSubmit = useCallback(()=>{
|
|
33
33
|
const parsedPage = parseInt(inputPage, 10);
|
|
34
34
|
if (Number.isNaN(parsedPage)) setInputPage('1');
|
|
35
|
-
else handlePageChange(parsedPage
|
|
35
|
+
else handlePageChange(Math.min(parsedPage, count));
|
|
36
36
|
}, [
|
|
37
37
|
handlePageChange,
|
|
38
38
|
inputPage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaginatorOverflow/PaginatorOverflow.js","sources":["../../src/PaginatorOverflow/PaginatorOverflow.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, useCallback, useState } from 'react';\nimport { typography } from '@finam/web-ui-kit-core/styles/typography';\nimport ChevronLeftSmall from '@finam/web-ui-kit-icons/Chevron/ChevronLeftSmall';\nimport ChevronRightSmall from '@finam/web-ui-kit-icons/Chevron/ChevronRightSmall';\nimport ChevronX2LeftSmall from '@finam/web-ui-kit-icons/Chevron/ChevronX2LeftSmall';\nimport ChevronX2RightSmall from '@finam/web-ui-kit-icons/Chevron/ChevronX2RightSmall';\nimport Input from '../Input/Input.js';\nimport NavButton from './NavButton/index.js';\n\nimport { Root, Group, InputWrapper } from './PaginatorOverflow.styles.js';\nimport { InputSize, KeyboardEventKey } from '../types.js';\nimport { Size } from './types.js';\n\nexport interface Props extends HTMLAttributes<HTMLDivElement> {\n /** Количество страниц */\n count: number;\n /** Текущая страница */\n currentPage: number;\n /** Callback, вызываемый при изменении страницы */\n onPageChange: (page: number) => void;\n /** Размер */\n size?: Size;\n}\n\nconst PaginatorOverflow = forwardRef<HTMLDivElement, Props>(\n (\n {\n count,\n currentPage,\n onPageChange,\n size = 'l',\n },\n ref,\n ) => {\n const sizeMap: Record<Size, InputSize> = {\n l: 's',\n m: 'xs',\n };\n\n const inputSize = sizeMap[size];\n\n const [inputPage, setInputPage] = useState(currentPage.toString());\n\n const handlePageChange = useCallback((newPage: number) => {\n const page = Math.max(1, Math.min(newPage, count));\n setInputPage(page.toString());\n onPageChange(page);\n }, [onPageChange, count]);\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n const onlyDigits = value.replace(/
|
|
1
|
+
{"version":3,"file":"PaginatorOverflow/PaginatorOverflow.js","sources":["../../src/PaginatorOverflow/PaginatorOverflow.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, useCallback, useState } from 'react';\nimport { typography } from '@finam/web-ui-kit-core/styles/typography';\nimport ChevronLeftSmall from '@finam/web-ui-kit-icons/Chevron/ChevronLeftSmall';\nimport ChevronRightSmall from '@finam/web-ui-kit-icons/Chevron/ChevronRightSmall';\nimport ChevronX2LeftSmall from '@finam/web-ui-kit-icons/Chevron/ChevronX2LeftSmall';\nimport ChevronX2RightSmall from '@finam/web-ui-kit-icons/Chevron/ChevronX2RightSmall';\nimport Input from '../Input/Input.js';\nimport NavButton from './NavButton/index.js';\n\nimport { Root, Group, InputWrapper } from './PaginatorOverflow.styles.js';\nimport { InputSize, KeyboardEventKey } from '../types.js';\nimport { Size } from './types.js';\n\nexport interface Props extends HTMLAttributes<HTMLDivElement> {\n /** Количество страниц */\n count: number;\n /** Текущая страница */\n currentPage: number;\n /** Callback, вызываемый при изменении страницы */\n onPageChange: (page: number) => void;\n /** Размер */\n size?: Size;\n}\n\nconst PaginatorOverflow = forwardRef<HTMLDivElement, Props>(\n (\n {\n count,\n currentPage,\n onPageChange,\n size = 'l',\n },\n ref,\n ) => {\n const sizeMap: Record<Size, InputSize> = {\n l: 's',\n m: 'xs',\n };\n\n const inputSize = sizeMap[size];\n\n const [inputPage, setInputPage] = useState(currentPage.toString());\n\n const handlePageChange = useCallback((newPage: number) => {\n const page = Math.max(1, Math.min(newPage, count));\n setInputPage(page.toString());\n onPageChange(page);\n }, [onPageChange, count]);\n\n const handleInputChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n const onlyDigits = value.replace(/\\D/g, '');\n\n setInputPage(onlyDigits);\n }, []);\n\n const handleInputSubmit = useCallback(() => {\n const parsedPage = parseInt(inputPage, 10);\n if (!Number.isNaN(parsedPage)) {\n handlePageChange(Math.min(parsedPage, count));\n } else {\n setInputPage('1');\n }\n }, [handlePageChange, inputPage, count]);\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === KeyboardEventKey.ENTER) {\n handleInputSubmit();\n }\n }, [handleInputSubmit]);\n\n return (\n <Root ref={ref}>\n <Group>\n <span className={typography({ variant: 'body14' })}>Стр</span>\n <InputWrapper>\n <Input\n value={inputPage}\n size={inputSize}\n onChange={handleInputChange}\n onBlur={handleInputSubmit}\n onKeyDown={handleKeyDown}\n />\n </InputWrapper>\n <span className={typography({ variant: 'body14' })}>{`из ${count}`}</span>\n </Group>\n <Group>\n <NavButton\n size={size}\n onClick={() => handlePageChange(1)}\n disabled={currentPage === 1}\n icon={<ChevronX2LeftSmall />}\n />\n <NavButton\n size={size}\n onClick={() => handlePageChange(currentPage - 1)}\n disabled={currentPage === 1}\n icon={<ChevronLeftSmall />}\n />\n <NavButton\n size={size}\n onClick={() => handlePageChange(currentPage + 1)}\n disabled={currentPage === count}\n icon={<ChevronRightSmall />}\n />\n <NavButton\n size={size}\n onClick={() => handlePageChange(count)}\n disabled={currentPage === count}\n icon={<ChevronX2RightSmall />}\n />\n </Group>\n </Root>\n );\n },\n);\n\nexport default PaginatorOverflow;\n"],"names":["PaginatorOverflow","forwardRef","count","currentPage","onPageChange","size","ref","sizeMap","inputSize","inputPage","setInputPage","useState","handlePageChange","useCallback","newPage","page","Math","handleInputChange","e","value","onlyDigits","handleInputSubmit","parsedPage","parseInt","Number","handleKeyDown","KeyboardEventKey","Root","Group","typography","InputWrapper","Input","NavButton","ChevronX2LeftSmall","ChevronLeftSmall","ChevronRightSmall","ChevronX2RightSmall"],"mappings":";;;;;;;;;;;AAwBA,MAAMA,oBAAoB,WAAHA,GAAGC,WACxB,CACE,EACEC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,OAAO,GAAG,EACX,EACDC;IAEA,MAAMC,UAAmC;QACvC,GAAG;QACH,GAAG;IACL;IAEA,MAAMC,YAAYD,OAAO,CAACF,KAAK;IAE/B,MA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;wBACN,SAAS,IAAMO,iBAAiBT,cAAc;wBAC9C,UAAUA,AAAgB,MAAhBA;wBACV,oBAAM,IAAC+B,kBAAgBA,CAAAA;;kCAEzB,IAACF,WAASA;wBACR,MAAM3B;wBACN,SAAS,IAAMO,iBAAiBT,cAAc;wBAC9C,UAAUA,gBAAgBD;wBAC1B,oBAAM,IAACiC,mBAAiBA,CAAAA;;kCAE1B,IAACH,WAASA;wBACR,MAAM3B;wBACN,SAAS,IAAMO,iBAAiBV;wBAChC,UAAUC,gBAAgBD;wBAC1B,oBAAM,IAACkC,qBAAmBA,CAAAA;;;;;;AAKpC;AAGF,4CAAepC"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export type { Props as PaginatorOverflowProps };
|
|
3
|
-
export default PaginatorOverflow;
|
|
1
|
+
export { default, type Props as PaginatorOverflowProps } from './PaginatorOverflow.js';
|
|
4
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaginatorOverflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/PaginatorOverflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,KAAK,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/Paper/types.d.ts
CHANGED
|
@@ -2,5 +2,10 @@ import type { tokens } from '@finam/web-ui-kit-core/theme/contract';
|
|
|
2
2
|
import type { BaseSizes } from '@finam/web-ui-kit-core/theme/types';
|
|
3
3
|
export type Shadow = keyof typeof tokens['shadow'];
|
|
4
4
|
export type Background = keyof typeof tokens['colors']['bg']['base'] | 'none';
|
|
5
|
-
|
|
5
|
+
interface BorderRadiusTokens extends BaseSizes {
|
|
6
|
+
modalDialog: string;
|
|
7
|
+
widget: string;
|
|
8
|
+
}
|
|
9
|
+
export type BorderRadius = keyof BorderRadiusTokens;
|
|
10
|
+
export {};
|
|
6
11
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Paper/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEpE,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Paper/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEpE,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9E,UAAU,kBAAmB,SAAQ,SAAS;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC"}
|
package/dist/Paper/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Shadow, Background, BorderRadius } from './types.js';
|
|
|
2
2
|
export declare const PREFIX_SHADOW = "shadow";
|
|
3
3
|
export declare const PREFIX_BACKGROUND = "bg";
|
|
4
4
|
export declare const PREFIX_BORDER_RADIUS = "radius";
|
|
5
|
-
export declare const classNameShadow: (shadow: Shadow) => "shadow-
|
|
5
|
+
export declare const classNameShadow: (shadow: Shadow) => "shadow-cardLow" | "shadow-cardMid" | "shadow-cardHigh" | "shadow-cardDark" | "shadow-onChart" | "shadow-menuPopover" | "shadow-modalDialog" | "shadow-headerMenu" | "shadow-stack";
|
|
6
6
|
export declare const classNameBackground: (background: Background) => "bg-none" | "bg-default" | "bg-tooltip" | "bg-secondary" | "bg-tertiary" | "bg-elevated";
|
|
7
|
-
export declare const classNameBorderRadius: (borderRadius: BorderRadius) => "radius-m" | "radius-none" | "radius-s" | "radius-l" | "radius-xs" | "radius-
|
|
7
|
+
export declare const classNameBorderRadius: (borderRadius: BorderRadius) => "radius-m" | "radius-none" | "radius-s" | "radius-l" | "radius-xs" | "radius-modalDialog" | "radius-widget" | "radius-xl" | "radius-2xl" | "radius-3xl" | "radius-4xl";
|
|
8
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -9,7 +9,7 @@ const formatInputDate = (value, locale = 'ru')=>{
|
|
|
9
9
|
};
|
|
10
10
|
const formatInputValue = (value, locale = 'ru')=>{
|
|
11
11
|
const delimiter = 'ru' === locale ? '.' : '/';
|
|
12
|
-
return value.replace(/[^\d]/g, '').split('').reduce((r, v, index)=>2 === index || 4 === index ? `${r}${delimiter}${v}` : `${r}${v}`, '').
|
|
12
|
+
return value.replace(/[^\d]/g, '').split('').reduce((r, v, index)=>2 === index || 4 === index ? `${r}${delimiter}${v}` : `${r}${v}`, '').slice(0, 10);
|
|
13
13
|
};
|
|
14
14
|
const parseInputDate = (value, locale = 'ru')=>{
|
|
15
15
|
const parseResult = 'ru' === locale ? /^(\d{2})\.(\d{2})\.(\d{4})$/.exec(value.trim()) : /^(\d{2})\/(\d{2})\/(\d{4})$/.exec(value.trim());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickersUtilsProvider/defaultDateFormatUtils.js","sources":["../../src/PickersUtilsProvider/defaultDateFormatUtils.ts"],"sourcesContent":["import type { DateFormatUtils } from '../types.js';\nimport { dateNumeric } from '../utils/dateFormatter.js';\nimport { padNumber } from './utils.js';\n\nconst formatInputDate = (value: Date | number, locale: string = 'ru') => {\n const date = typeof value === 'number' ? new Date(value) : value;\n const days = padNumber(date.getDate());\n const months = padNumber(date.getMonth() + 1);\n const years = date.getFullYear();\n return locale === 'ru' ? `${days}.${months}.${years}` : `${months}/${days}/${years}`;\n};\n\nconst formatInputValue = (value: string, locale: string = 'ru') => {\n const delimiter = locale === 'ru' ? '.' : '/';\n return value\n .replace(/[^\\d]/g, '')\n .split('')\n .reduce(\n (r, v, index) => (index === 2 || index === 4 ? `${r}${delimiter}${v}` : `${r}${v}`),\n '',\n )\n .
|
|
1
|
+
{"version":3,"file":"PickersUtilsProvider/defaultDateFormatUtils.js","sources":["../../src/PickersUtilsProvider/defaultDateFormatUtils.ts"],"sourcesContent":["import type { DateFormatUtils } from '../types.js';\nimport { dateNumeric } from '../utils/dateFormatter.js';\nimport { padNumber } from './utils.js';\n\nconst formatInputDate = (value: Date | number, locale: string = 'ru') => {\n const date = typeof value === 'number' ? new Date(value) : value;\n const days = padNumber(date.getDate());\n const months = padNumber(date.getMonth() + 1);\n const years = date.getFullYear();\n return locale === 'ru' ? `${days}.${months}.${years}` : `${months}/${days}/${years}`;\n};\n\nconst formatInputValue = (value: string, locale: string = 'ru') => {\n const delimiter = locale === 'ru' ? '.' : '/';\n return value\n .replace(/[^\\d]/g, '')\n .split('')\n .reduce(\n (r, v, index) => (index === 2 || index === 4 ? `${r}${delimiter}${v}` : `${r}${v}`),\n '',\n )\n .slice(0, 10);\n};\n\nconst parseInputDate = (value: string, locale: string = 'ru') => {\n const parseResult = locale === 'ru'\n ? /^(\\d{2})\\.(\\d{2})\\.(\\d{4})$/.exec(value.trim())\n : /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/.exec(value.trim());\n if (!parseResult || parseResult.length < 4) {\n return undefined;\n }\n const years = parseInt(parseResult[3], 10);\n const months = parseInt(parseResult[locale === 'ru' ? 2 : 1], 10);\n const days = parseInt(parseResult[locale === 'ru' ? 1 : 2], 10);\n if (months > 12 || days > 31) {\n return undefined;\n }\n return new Date(years, months - 1, days);\n};\n\nconst defaultDateFormatUtils: DateFormatUtils = {\n formatDate: dateNumeric,\n formatInputDate,\n formatInputValue,\n parseInputDate,\n charsFilter: /\\d/g,\n maskLength: 10,\n};\n\nexport default defaultDateFormatUtils;\n"],"names":["formatInputDate","value","locale","date","Date","days","padNumber","months","years","formatInputValue","delimiter","r","v","index","parseInputDate","parseResult","parseInt","defaultDateFormatUtils","dateNumeric"],"mappings":";;AAIA,MAAMA,kBAAkB,CAACC,OAAsBC,SAAiB,IAAI;IAClE,MAAMC,OAAO,AAAiB,YAAjB,OAAOF,QAAqB,IAAIG,KAAKH,SAASA;IAC3D,MAAMI,OAAOC,UAAUH,KAAK,OAAO;IACnC,MAAMI,SAASD,UAAUH,KAAK,QAAQ,KAAK;IAC3C,MAAMK,QAAQL,KAAK,WAAW;IAC9B,OAAOD,AAAW,SAAXA,SAAkB,GAAGG,KAAK,CAAC,EAAEE,OAAO,CAAC,EAAEC,OAAO,GAAG,GAAGD,OAAO,CAAC,EAAEF,KAAK,CAAC,EAAEG,OAAO;AACtF;AAEA,MAAMC,mBAAmB,CAACR,OAAeC,SAAiB,IAAI;IAC5D,MAAMQ,YAAYR,AAAW,SAAXA,SAAkB,MAAM;IAC1C,OAAOD,MACJ,OAAO,CAAC,UAAU,IAClB,KAAK,CAAC,IACN,MAAM,CACL,CAACU,GAAGC,GAAGC,QAAWA,AAAU,MAAVA,SAAeA,AAAU,MAAVA,QAAc,GAAGF,IAAID,YAAYE,GAAG,GAAG,GAAGD,IAAIC,GAAG,EAClF,IAED,KAAK,CAAC,GAAG;AACd;AAEA,MAAME,iBAAiB,CAACb,OAAeC,SAAiB,IAAI;IAC1D,MAAMa,cAAcb,AAAW,SAAXA,SAChB,8BAA8B,IAAI,CAACD,MAAM,IAAI,MAC7C,8BAA8B,IAAI,CAACA,MAAM,IAAI;IACjD,IAAI,CAACc,eAAeA,YAAY,MAAM,GAAG,GACvC;IAEF,MAAMP,QAAQQ,SAASD,WAAW,CAAC,EAAE,EAAE;IACvC,MAAMR,SAASS,SAASD,WAAW,CAACb,AAAW,SAAXA,SAAkB,IAAI,EAAE,EAAE;IAC9D,MAAMG,OAAOW,SAASD,WAAW,CAACb,AAAW,SAAXA,SAAkB,IAAI,EAAE,EAAE;IAC5D,IAAIK,SAAS,MAAMF,OAAO,IACxB;IAEF,OAAO,IAAID,KAAKI,OAAOD,SAAS,GAAGF;AACrC;AAEA,MAAMY,yBAA0C;IAC9C,YAAYC;IACZlB,iBAAAA;IACAS,kBAAAA;IACAK,gBAAAA;IACA,aAAa;IACb,YAAY;AACd;AAEA,oDAAeG"}
|
|
@@ -21,12 +21,12 @@ const formatTimeLocal = (value, { withSeconds, withMilliseconds })=>{
|
|
|
21
21
|
const maskLength = ({ withSeconds, withMilliseconds })=>withMilliseconds ? 12 : withSeconds ? 8 : 5;
|
|
22
22
|
const formatInputValue = (value, { withSeconds, withMilliseconds })=>{
|
|
23
23
|
const delimiter = ':';
|
|
24
|
-
return value.replace(/[^\d]/g, '').split('').reduce((r, v, i)=>2 === i || 4 === i || 6 === i ? `${r}${delimiter}${v}` : `${r}${v}`, '').
|
|
24
|
+
return value.replace(/[^\d]/g, '').split('').reduce((r, v, i)=>2 === i || 4 === i || 6 === i ? `${r}${delimiter}${v}` : `${r}${v}`, '').slice(0, withMilliseconds ? 12 : withSeconds ? 8 : 5);
|
|
25
25
|
};
|
|
26
26
|
const parseInputTime = (value, { withSeconds, withMilliseconds, eventType })=>{
|
|
27
|
-
const secPart = withSeconds || withMilliseconds ? 'change' === eventType ?
|
|
28
|
-
const mlsecPart = withMilliseconds ? 'change' === eventType ?
|
|
29
|
-
const parseResult = new RegExp(`^(
|
|
27
|
+
const secPart = withSeconds || withMilliseconds ? 'change' === eventType ? String.raw`:(\d{2})` : String.raw`:?(\d{2})?` : '';
|
|
28
|
+
const mlsecPart = withMilliseconds ? 'change' === eventType ? String.raw`:(\d{3})` : String.raw`:?(\d{3})?` : '';
|
|
29
|
+
const parseResult = new RegExp(String.raw`^(\d{2}):(\d{2})${secPart}${mlsecPart}$`).exec(value.trim());
|
|
30
30
|
const partsCount = withMilliseconds ? 4 : withSeconds ? 3 : 2;
|
|
31
31
|
if (!parseResult || parseResult.length <= partsCount) return;
|
|
32
32
|
const hours = parseInt(parseResult[1], 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickersUtilsProvider/defaultTimeFormatUtils.js","sources":["../../src/PickersUtilsProvider/defaultTimeFormatUtils.ts"],"sourcesContent":["import type { TimeFormatUtils, TimeFormatOptions } from '../types.js';\nimport { padNumber } from './utils.js';\n\nconst SECOND_IN_MILLISECONDS = 1000;\nconst MINUTE_IN_MILLISECONDS = 60 * SECOND_IN_MILLISECONDS;\nconst HOUR_IN_MILLISECONDS = 60 * MINUTE_IN_MILLISECONDS;\n\nconst formatTime = (value: number, { withSeconds, withMilliseconds }: TimeFormatOptions) => {\n const dateTime = new Date(value);\n const hours = padNumber(dateTime.getUTCHours());\n const minutes = padNumber(dateTime.getUTCMinutes());\n const seconds = (withSeconds || withMilliseconds) ? padNumber(dateTime.getUTCSeconds()) : '';\n const mlsec = withMilliseconds ? padNumber(dateTime.getUTCMilliseconds(), 3) : '';\n return `${hours}:${minutes}${seconds ? ':' : ''}${seconds}${mlsec ? ':' : ''}${mlsec}`;\n};\n\nconst formatTimeLocal = (\n value: number | Date,\n { withSeconds, withMilliseconds }: TimeFormatOptions,\n) => {\n const dateTime = new Date(value);\n const hours = padNumber(dateTime.getHours());\n const minutes = padNumber(dateTime.getMinutes());\n const seconds = (withSeconds || withMilliseconds) ? padNumber(dateTime.getSeconds()) : '';\n const mlsec = withMilliseconds ? padNumber(dateTime.getMilliseconds(), 3) : '';\n return `${hours}:${minutes}${seconds ? ':' : ''}${seconds}${mlsec ? ':' : ''}${mlsec}`;\n};\n\nconst maskLength = (\n { withSeconds, withMilliseconds }: TimeFormatOptions,\n) => (withMilliseconds ? 12 : withSeconds ? 8 : 5);\n\nconst formatInputValue = (value: string, { withSeconds, withMilliseconds }: TimeFormatOptions) => {\n const delimiter = ':';\n return value\n .replace(/[^\\d]/g, '')\n .split('')\n .reduce((r, v, i) => ((i === 2 || i === 4 || i === 6) ? `${r}${delimiter}${v}` : `${r}${v}`), '')\n .
|
|
1
|
+
{"version":3,"file":"PickersUtilsProvider/defaultTimeFormatUtils.js","sources":["../../src/PickersUtilsProvider/defaultTimeFormatUtils.ts"],"sourcesContent":["import type { TimeFormatUtils, TimeFormatOptions } from '../types.js';\nimport { padNumber } from './utils.js';\n\nconst SECOND_IN_MILLISECONDS = 1000;\nconst MINUTE_IN_MILLISECONDS = 60 * SECOND_IN_MILLISECONDS;\nconst HOUR_IN_MILLISECONDS = 60 * MINUTE_IN_MILLISECONDS;\n\nconst formatTime = (value: number, { withSeconds, withMilliseconds }: TimeFormatOptions) => {\n const dateTime = new Date(value);\n const hours = padNumber(dateTime.getUTCHours());\n const minutes = padNumber(dateTime.getUTCMinutes());\n const seconds = (withSeconds || withMilliseconds) ? padNumber(dateTime.getUTCSeconds()) : '';\n const mlsec = withMilliseconds ? padNumber(dateTime.getUTCMilliseconds(), 3) : '';\n return `${hours}:${minutes}${seconds ? ':' : ''}${seconds}${mlsec ? ':' : ''}${mlsec}`;\n};\n\nconst formatTimeLocal = (\n value: number | Date,\n { withSeconds, withMilliseconds }: TimeFormatOptions,\n) => {\n const dateTime = new Date(value);\n const hours = padNumber(dateTime.getHours());\n const minutes = padNumber(dateTime.getMinutes());\n const seconds = (withSeconds || withMilliseconds) ? padNumber(dateTime.getSeconds()) : '';\n const mlsec = withMilliseconds ? padNumber(dateTime.getMilliseconds(), 3) : '';\n return `${hours}:${minutes}${seconds ? ':' : ''}${seconds}${mlsec ? ':' : ''}${mlsec}`;\n};\n\nconst maskLength = (\n { withSeconds, withMilliseconds }: TimeFormatOptions,\n) => (withMilliseconds ? 12 : withSeconds ? 8 : 5);\n\nconst formatInputValue = (value: string, { withSeconds, withMilliseconds }: TimeFormatOptions) => {\n const delimiter = ':';\n return value\n .replace(/[^\\d]/g, '')\n .split('')\n .reduce((r, v, i) => ((i === 2 || i === 4 || i === 6) ? `${r}${delimiter}${v}` : `${r}${v}`), '')\n .slice(0, withMilliseconds ? 12 : (withSeconds ? 8 : 5));\n};\n\nconst parseInputTime = (\n value: string,\n { withSeconds, withMilliseconds, eventType }: TimeFormatOptions,\n) => {\n const secPart = (withSeconds || withMilliseconds)\n ? (eventType === 'change'\n ? String.raw`:(\\d{2})`\n : String.raw`:?(\\d{2})?`)\n : '';\n const mlsecPart = withMilliseconds\n ? (eventType === 'change'\n ? String.raw`:(\\d{3})`\n : String.raw`:?(\\d{3})?`)\n : '';\n const parseResult = new RegExp(String.raw`^(\\d{2}):(\\d{2})${secPart}${mlsecPart}$`).exec(value.trim());\n const partsCount = withMilliseconds ? 4 : (withSeconds ? 3 : 2);\n if (!parseResult || parseResult.length <= partsCount) {\n return undefined;\n }\n const hours = parseInt(parseResult[1], 10);\n const minutes = parseInt(parseResult[2], 10);\n const seconds = parseInt(parseResult[3], 10) || 0;\n const milliseconds = parseInt(parseResult[4], 10) || 0;\n const timeValue =\n hours * HOUR_IN_MILLISECONDS +\n minutes * MINUTE_IN_MILLISECONDS +\n seconds * SECOND_IN_MILLISECONDS +\n milliseconds;\n if (minutes >= 60 || seconds >= 60 || timeValue >= 24 * HOUR_IN_MILLISECONDS) {\n return undefined;\n }\n return timeValue;\n};\n\nconst defaultTimeFormatUtils: TimeFormatUtils = {\n formatTime,\n formatTimeLocal,\n formatInputTime: formatTime,\n formatInputValue,\n parseInputTime,\n charsFilter: /\\d/g,\n maskLength,\n};\n\nexport default defaultTimeFormatUtils;\n"],"names":["SECOND_IN_MILLISECONDS","MINUTE_IN_MILLISECONDS","HOUR_IN_MILLISECONDS","formatTime","value","withSeconds","withMilliseconds","dateTime","Date","hours","padNumber","minutes","seconds","mlsec","formatTimeLocal","maskLength","formatInputValue","delimiter","r","v","i","parseInputTime","eventType","secPart","String","mlsecPart","parseResult","RegExp","partsCount","parseInt","milliseconds","timeValue","defaultTimeFormatUtils"],"mappings":";AAGA,MAAMA,yBAAyB;AAC/B,MAAMC,yBAAyB,KAAKD;AACpC,MAAME,uBAAuB,KAAKD;AAElC,MAAME,aAAa,CAACC,OAAe,EAAEC,WAAW,EAAEC,gBAAgB,EAAqB;IACrF,MAAMC,WAAW,IAAIC,KAAKJ;IAC1B,MAAMK,QAAQC,UAAUH,SAAS,WAAW;IAC5C,MAAMI,UAAUD,UAAUH,SAAS,aAAa;IAChD,MAAMK,UAAWP,eAAeC,mBAAoBI,UAAUH,SAAS,aAAa,MAAM;IAC1F,MAAMM,QAAQP,mBAAmBI,UAAUH,SAAS,kBAAkB,IAAI,KAAK;IAC/E,OAAO,GAAGE,MAAM,CAAC,EAAEE,UAAUC,UAAU,MAAM,KAAKA,UAAUC,QAAQ,MAAM,KAAKA,OAAO;AACxF;AAEA,MAAMC,kBAAkB,CACtBV,OACA,EAAEC,WAAW,EAAEC,gBAAgB,EAAqB;IAEpD,MAAMC,WAAW,IAAIC,KAAKJ;IAC1B,MAAMK,QAAQC,UAAUH,SAAS,QAAQ;IACzC,MAAMI,UAAUD,UAAUH,SAAS,UAAU;IAC7C,MAAMK,UAAWP,eAAeC,mBAAoBI,UAAUH,SAAS,UAAU,MAAM;IACvF,MAAMM,QAAQP,mBAAmBI,UAAUH,SAAS,eAAe,IAAI,KAAK;IAC5E,OAAO,GAAGE,MAAM,CAAC,EAAEE,UAAUC,UAAU,MAAM,KAAKA,UAAUC,QAAQ,MAAM,KAAKA,OAAO;AACxF;AAEA,MAAME,aAAa,CACjB,EAAEV,WAAW,EAAEC,gBAAgB,EAAqB,GAChDA,mBAAmB,KAAKD,cAAc,IAAI;AAEhD,MAAMW,mBAAmB,CAACZ,OAAe,EAAEC,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KAAK7B,sBACtD;IAEF,OAAO6B;AACT;AAEA,MAAMC,yBAA0C;IAC9C7B,YAAAA;IACAW,iBAAAA;IACA,iBAAiBX;IACjBa,kBAAAA;IACAK,gBAAAA;IACA,aAAa;IACbN,YAAAA;AACF;AAEA,oDAAeiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PickersUtilsProvider/utils.js","sources":["../../src/PickersUtilsProvider/utils.ts"],"sourcesContent":["export const padNumber = (value: string | number, digitsCount = 2, padSymbol = '0') => {\n const prefix = Array.from({ length: digitsCount }).join(padSymbol);\n const str = `${prefix}${value}`;\n return str.
|
|
1
|
+
{"version":3,"file":"PickersUtilsProvider/utils.js","sources":["../../src/PickersUtilsProvider/utils.ts"],"sourcesContent":["export const padNumber = (value: string | number, digitsCount = 2, padSymbol = '0') => {\n const prefix = Array.from({ length: digitsCount }).join(padSymbol);\n const str = `${prefix}${value}`;\n return str.slice(-digitsCount);\n};\n"],"names":["padNumber","value","digitsCount","padSymbol","prefix","Array","str"],"mappings":"AAAO,MAAMA,YAAY,CAACC,OAAwBC,cAAc,CAAC,EAAEC,YAAY,GAAG;IAChF,MAAMC,SAASC,MAAM,IAAI,CAAC;QAAE,QAAQH;IAAY,GAAG,IAAI,CAACC;IACxD,MAAMG,MAAM,GAAGF,SAASH,OAAO;IAC/B,OAAOK,IAAI,KAAK,CAAC,CAACJ;AACpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ProductCardIpoStatus } from '../../types.js';
|
|
2
|
-
import { type ProductCardIpoContentRow
|
|
3
|
-
export type { ProductCardIpoContentRow, ProductCardIpoContentRowId };
|
|
2
|
+
import { type ProductCardIpoContentRow } from './contentUtils.js';
|
|
3
|
+
export type { ProductCardIpoContentRow, ProductCardIpoContentRowId } from './contentUtils.js';
|
|
4
4
|
export interface ProductCardIpoContentProps {
|
|
5
5
|
/** Строки таблицы параметров выпуска. */
|
|
6
6
|
rows?: ProductCardIpoContentRow[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/ProductCard/layouts/ipo/Content.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAIL,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/ProductCard/layouts/ipo/Content.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,mBAAmB,CAAC;AAU3B,YAAY,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE9F,MAAM,WAAW,0BAA0B;IACzC,yCAAyC;IACzC,IAAI,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAClC,oCAAoC;IACpC,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAqDD,QAAA,MAAM,6BAA6B,yDAnDmB,0BAA0B,oDAmDf,CAAC;AAGlE,eAAe,6BAA6B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCard/layouts/ipo/Content.js","sources":["../../../../src/ProductCard/layouts/ipo/Content.tsx"],"sourcesContent":["import { memo } from 'react';\nimport Typography from '../../../Typography/index.js';\nimport ProductCardContent from '../../ProductCardContent/index.js';\nimport { useProductCardContext } from '../../ProductCardContext.js';\nimport { ProductCardView, type ProductCardIpoStatus } from '../../types.js';\nimport {\n getIpoStatusText,\n getVisibleIpoContentRows,\n shouldShowIpoStatus,\n type ProductCardIpoContentRow,\n
|
|
1
|
+
{"version":3,"file":"ProductCard/layouts/ipo/Content.js","sources":["../../../../src/ProductCard/layouts/ipo/Content.tsx"],"sourcesContent":["import { memo } from 'react';\nimport Typography from '../../../Typography/index.js';\nimport ProductCardContent from '../../ProductCardContent/index.js';\nimport { useProductCardContext } from '../../ProductCardContext.js';\nimport { ProductCardView, type ProductCardIpoStatus } from '../../types.js';\nimport {\n getIpoStatusText,\n getVisibleIpoContentRows,\n shouldShowIpoStatus,\n type ProductCardIpoContentRow,\n} from './contentUtils.js';\nimport {\n ContentWrap,\n ipoContentMobileRoot,\n Label,\n Row,\n Rows,\n Value,\n} from './Content.styles.js';\n\nexport type { ProductCardIpoContentRow, ProductCardIpoContentRowId } from './contentUtils.js';\n\nexport interface ProductCardIpoContentProps {\n /** Строки таблицы параметров выпуска. */\n rows?: ProductCardIpoContentRow[];\n /** Строка статуса приёма заявок. */\n status?: ProductCardIpoStatus;\n}\n\nconst ProductCardIpoContent = ({ rows = [], status }: ProductCardIpoContentProps) => {\n const { view } = useProductCardContext();\n const visibleRows = getVisibleIpoContentRows(rows, view);\n const showStatus = shouldShowIpoStatus(status);\n\n if (!showStatus && visibleRows.length === 0) {\n return null;\n }\n\n return (\n <ProductCardContent\n className={view === ProductCardView.MOBILE ? ipoContentMobileRoot : undefined}\n >\n <ContentWrap className={view}>\n <Rows className={view}>\n {showStatus && status ? (\n <Row>\n <Label>\n <Typography variant=\"caption11\" color={status.color ?? 'secondary'} data-testid=\"status\">\n {getIpoStatusText(status, view)}\n </Typography>\n </Label>\n {status.dateText ? (\n <Value>\n <Typography variant=\"caption11\" weight=\"semiBold\" data-testid=\"trade-date\">\n {status.dateText}\n </Typography>\n </Value>\n ) : null}\n </Row>\n ) : null}\n {visibleRows.map(({ label, value }) => (\n <Row key={`${label}-${value}`}>\n <Label>\n <Typography variant=\"caption11\" color=\"secondary\">\n {label}\n </Typography>\n </Label>\n <Value>\n <Typography variant=\"caption11\" weight=\"semiBold\">\n {value}\n </Typography>\n </Value>\n </Row>\n ))}\n </Rows>\n </ContentWrap>\n </ProductCardContent>\n );\n};\n\nconst MemoizedProductCardIpoContent = memo(ProductCardIpoContent);\nMemoizedProductCardIpoContent.displayName = 'ProductCardIpoContent';\n\nexport default MemoizedProductCardIpoContent;\n"],"names":["ProductCardIpoContent","rows","status","_status_color","view","useProductCardContext","visibleRows","getVisibleIpoContentRows","showStatus","shouldShowIpoStatus","ProductCardContent","ProductCardView","ipoContentMobileRoot","undefined","ContentWrap","Rows","Row","Label","Typography","getIpoStatusText","Value","label","value","MemoizedProductCardIpoContent","memo"],"mappings":";;;;;;;;AA6BA,MAAMA,wBAAwB,CAAC,EAAEC,OAAO,EAAE,EAAEC,MAAM,EAA8B;QAkBzBC;IAjBrD,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,MAAMC,cAAcC,yBAAyBN,MAAMG;IACnD,MAAMI,aAAaC,oBAAoBP;IAEvC,IAAI,CAACM,cAAcF,AAAuB,MAAvBA,YAAY,MAAM,EACnC,OAAO;IAGT,OAAO,WAAP,GACE,IAACI,oBAAkBA;QACjB,WAAWN,SAASO,gBAAgB,MAAM,GAAGC,uBAAuBC;kBAEpE,kBAACC,aAAWA;YAAC,WAAWV;sBACtB,mBAACW,MAAIA;gBAAC,WAAWX;;oBACdI,cAAcN,SAAS,WAATA,GACb,KAACc,KAAGA;;0CACF,IAACC,OAAKA;0CACJ,kBAACC,YAAUA;oCAAC,SAAQ;oCAAY,OAAK,QAAEf,CAAAA,gBAAAA,OAAO,KAAK,AAAD,IAAXA,gBAAgB;oCAAa,eAAY;8CAC7EgB,iBAAiBjB,QAAQE;;;4BAG7BF,OAAO,QAAQ,GAAG,WAAH,GACd,IAACkB,OAAKA;0CACJ,kBAACF,YAAUA;oCAAC,SAAQ;oCAAY,QAAO;oCAAW,eAAY;8CAC3DhB,OAAO,QAAQ;;iCAGlB;;yBAEJ;oBACHI,YAAY,GAAG,CAAC,CAAC,EAAEe,KAAK,EAAEC,KAAK,EAAE,iBAChC,KAACN,KAAGA;;8CACF,IAACC,OAAKA;8CACJ,kBAACC,YAAUA;wCAAC,SAAQ;wCAAY,OAAM;kDACnCG;;;8CAGL,IAACD,OAAKA;8CACJ,kBAACF,YAAUA;wCAAC,SAAQ;wCAAY,QAAO;kDACpCI;;;;2BARG,GAAGD,MAAM,CAAC,EAAEC,OAAO;;;;;AAiBzC;AAEA,MAAMC,gCAAgC,WAAHA,GAAGC,KAAKxB;AAC3CuB,8BAA8B,WAAW,GAAG;AAE5C,gBAAeA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/ProductCard/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,aAAa,GAAI,MAAM,sBAAsB,WAA2B,CAAC;AAEtF,eAAO,MAAM,2BAA2B,GACtC,UAAU,mBAAmB,EAC7B,MAAM,eAAe,EACrB,OAAO,sBAAsB,WAU9B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/ProductCard/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,aAAa,GAAI,MAAM,sBAAsB,WAA2B,CAAC;AAEtF,eAAO,MAAM,2BAA2B,GACtC,UAAU,mBAAmB,EAC7B,MAAM,eAAe,EACrB,OAAO,sBAAsB,WAU9B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,WAarD,CAAC"}
|
|
@@ -15,7 +15,10 @@ const hexToRgba = (color, alpha)=>{
|
|
|
15
15
|
const normalized = color.trim().replace('#', '');
|
|
16
16
|
if (3 === normalized.length) {
|
|
17
17
|
const [r, g, b] = normalized.split('');
|
|
18
|
-
|
|
18
|
+
const red = parseInt(r + r, 16);
|
|
19
|
+
const green = parseInt(g + g, 16);
|
|
20
|
+
const blue = parseInt(b + b, 16);
|
|
21
|
+
return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
|
|
19
22
|
}
|
|
20
23
|
if (6 === normalized.length) return `rgba(${parseInt(normalized.slice(0, 2), 16)}, ${parseInt(normalized.slice(2, 4), 16)}, ${parseInt(normalized.slice(4, 6), 16)}, ${alpha})`;
|
|
21
24
|
return `rgba(255, 255, 255, ${alpha})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductCard/utils.js","sources":["../../src/ProductCard/utils.ts"],"sourcesContent":["import { getProductCardLayoutConfig } from './layoutConfig.js';\nimport {\n ProductCardLayoutId,\n ProductCardView,\n type ProductCardDesktopSize,\n} from './types.js';\n\nconst classNameSizeMap: Record<ProductCardDesktopSize, string> = {\n l: 'sizeL',\n m: 'sizeM',\n};\n\nexport const classNameSize = (size: ProductCardDesktopSize) => classNameSizeMap[size];\n\nexport const getProductCardSizeClassName = (\n layoutId: ProductCardLayoutId,\n view: ProductCardView,\n size?: ProductCardDesktopSize,\n) => {\n if (size != null) {\n return classNameSize(size);\n }\n\n const { desktopSize, mobileSize } = getProductCardLayoutConfig(layoutId);\n const layoutSize = view === ProductCardView.DESKTOP ? desktopSize : mobileSize;\n\n return classNameSize(layoutSize);\n};\n\nexport const hexToRgba = (color: string, alpha: number) => {\n const normalized = color.trim().replace('#', '');\n if (normalized.length === 3) {\n const [r, g, b] = normalized.split('');\n
|
|
1
|
+
{"version":3,"file":"ProductCard/utils.js","sources":["../../src/ProductCard/utils.ts"],"sourcesContent":["import { getProductCardLayoutConfig } from './layoutConfig.js';\nimport {\n ProductCardLayoutId,\n ProductCardView,\n type ProductCardDesktopSize,\n} from './types.js';\n\nconst classNameSizeMap: Record<ProductCardDesktopSize, string> = {\n l: 'sizeL',\n m: 'sizeM',\n};\n\nexport const classNameSize = (size: ProductCardDesktopSize) => classNameSizeMap[size];\n\nexport const getProductCardSizeClassName = (\n layoutId: ProductCardLayoutId,\n view: ProductCardView,\n size?: ProductCardDesktopSize,\n) => {\n if (size != null) {\n return classNameSize(size);\n }\n\n const { desktopSize, mobileSize } = getProductCardLayoutConfig(layoutId);\n const layoutSize = view === ProductCardView.DESKTOP ? desktopSize : mobileSize;\n\n return classNameSize(layoutSize);\n};\n\nexport const hexToRgba = (color: string, alpha: number) => {\n const normalized = color.trim().replace('#', '');\n if (normalized.length === 3) {\n const [r, g, b] = normalized.split('');\n const red = parseInt(r + r, 16);\n const green = parseInt(g + g, 16);\n const blue = parseInt(b + b, 16);\n return `rgba(${red}, ${green}, ${blue}, ${alpha})`;\n }\n if (normalized.length === 6) {\n return `rgba(${parseInt(normalized.slice(0, 2), 16)}, ${parseInt(normalized.slice(2, 4), 16)}, ${parseInt(normalized.slice(4, 6), 16)}, ${alpha})`;\n }\n return `rgba(255, 255, 255, ${alpha})`;\n};\n"],"names":["classNameSizeMap","classNameSize","size","getProductCardSizeClassName","layoutId","view","desktopSize","mobileSize","getProductCardLayoutConfig","layoutSize","ProductCardView","hexToRgba","color","alpha","normalized","r","g","b","red","parseInt","green","blue"],"mappings":";;AAOA,MAAMA,mBAA2D;IAC/D,GAAG;IACH,GAAG;AACL;AAEO,MAAMC,gBAAgB,CAACC,OAAiCF,gBAAgB,CAACE,KAAK;AAE9E,MAAMC,8BAA8B,CACzCC,UACAC,MACAH;IAEA,IAAIA,AAAQ,QAARA,MACF,OAAOD,cAAcC;IAGvB,MAAM,EAAEI,WAAW,EAAEC,UAAU,EAAE,GAAGC,2BAA2BJ;IAC/D,MAAMK,aAAaJ,SAASK,gBAAgB,OAAO,GAAGJ,cAAcC;IAEpE,OAAON,cAAcQ;AACvB;AAEO,MAAME,YAAY,CAACC,OAAeC;IACvC,MAAMC,aAAaF,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK;IAC7C,IAAIE,AAAsB,MAAtBA,WAAW,MAAM,EAAQ;QAC3B,MAAM,CAACC,GAAGC,GAAGC,EAAE,GAAGH,WAAW,KAAK,CAAC;QACnC,MAAMI,MAAMC,SAASJ,IAAIA,GAAG;QAC5B,MAAMK,QAAQD,SAASH,IAAIA,GAAG;QAC9B,MAAMK,OAAOF,SAASF,IAAIA,GAAG;QAC7B,OAAO,CAAC,KAAK,EAAEC,IAAI,EAAE,EAAEE,MAAM,EAAE,EAAEC,KAAK,EAAE,EAAER,MAAM,CAAC,CAAC;IACpD;IACA,IAAIC,AAAsB,MAAtBA,WAAW,MAAM,EACnB,OAAO,CAAC,KAAK,EAAEK,SAASL,WAAW,KAAK,CAAC,GAAG,IAAI,IAAI,EAAE,EAAEK,SAASL,WAAW,KAAK,CAAC,GAAG,IAAI,IAAI,EAAE,EAAEK,SAASL,WAAW,KAAK,CAAC,GAAG,IAAI,IAAI,EAAE,EAAED,MAAM,CAAC,CAAC;IAEpJ,OAAO,CAAC,oBAAoB,EAAEA,MAAM,CAAC,CAAC;AACxC"}
|
package/dist/Skeleton/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import Skeleton, { Props } from './Skeleton.js';
|
|
2
1
|
export type { TypographyVariant, SkeletonTypographyProps } from './types.js';
|
|
3
|
-
export type { Props as SkeletonProps };
|
|
4
|
-
export default Skeleton;
|
|
2
|
+
export type { Props as SkeletonProps } from './Skeleton.js';
|
|
3
|
+
export { default } from './Skeleton.js';
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Skeleton/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Skeleton/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC7E,YAAY,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/Skeleton/index.js
CHANGED