@foxford/ui 2.76.1 → 2.77.0-beta-ee6908c-20250807
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/LICENSE +27 -0
- package/components/Accordion/Accordion.js +1 -1
- package/components/Accordion/Accordion.js.map +1 -1
- package/components/Accordion/Accordion.mjs +1 -1
- package/components/Accordion/Accordion.mjs.map +1 -1
- package/components/Accordion/hooks.js +1 -1
- package/components/Accordion/hooks.js.map +1 -1
- package/components/Accordion/hooks.mjs +1 -1
- package/components/Accordion/hooks.mjs.map +1 -1
- package/components/AccordionItem/AccordionItem.js +1 -1
- package/components/AccordionItem/AccordionItem.js.map +1 -1
- package/components/AccordionItem/AccordionItem.mjs +1 -1
- package/components/AccordionItem/AccordionItem.mjs.map +1 -1
- package/components/ActionBtn/ActionBtn.js +1 -1
- package/components/ActionBtn/ActionBtn.js.map +1 -1
- package/components/ActionBtn/ActionBtn.mjs +1 -1
- package/components/ActionBtn/ActionBtn.mjs.map +1 -1
- package/components/ActionBtn/style.js.map +1 -1
- package/components/ActionBtn/style.mjs.map +1 -1
- package/components/Alert/Alert.js +1 -1
- package/components/Alert/Alert.js.map +1 -1
- package/components/Alert/Alert.mjs +1 -1
- package/components/Alert/Alert.mjs.map +1 -1
- package/components/Amount/Amount.js +1 -1
- package/components/Amount/Amount.js.map +1 -1
- package/components/Amount/Amount.mjs +1 -1
- package/components/Amount/Amount.mjs.map +1 -1
- package/components/Amount/data/index.js.map +1 -1
- package/components/Amount/data/index.mjs.map +1 -1
- package/components/Amount/style.js.map +1 -1
- package/components/Amount/style.mjs.map +1 -1
- package/components/Anchor/Anchor.js +1 -1
- package/components/Anchor/Anchor.js.map +1 -1
- package/components/Anchor/Anchor.mjs +1 -1
- package/components/Anchor/Anchor.mjs.map +1 -1
- package/components/Arrow/Arrow.js.map +1 -1
- package/components/Arrow/Arrow.mjs.map +1 -1
- package/components/ArrowBadge/ArrowBadge.js.map +1 -1
- package/components/ArrowBadge/ArrowBadge.mjs.map +1 -1
- package/components/AspectRatio/style.js.map +1 -1
- package/components/AspectRatio/style.mjs.map +1 -1
- package/components/Avatar/Avatar.js +1 -1
- package/components/Avatar/Avatar.js.map +1 -1
- package/components/Avatar/Avatar.mjs +1 -1
- package/components/Avatar/Avatar.mjs.map +1 -1
- package/components/Avatar/utils.js.map +1 -1
- package/components/Avatar/utils.mjs.map +1 -1
- package/components/Badge/Badge.js +1 -1
- package/components/Badge/Badge.js.map +1 -1
- package/components/Badge/Badge.mjs +1 -1
- package/components/Badge/Badge.mjs.map +1 -1
- package/components/Button/Button.js +1 -1
- package/components/Button/Button.js.map +1 -1
- package/components/Button/Button.mjs +1 -1
- package/components/Button/Button.mjs.map +1 -1
- package/components/Button/hooks.js.map +1 -1
- package/components/Button/hooks.mjs.map +1 -1
- package/components/Button/style.js.map +1 -1
- package/components/Button/style.mjs.map +1 -1
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checkbox/Checkbox.js.map +1 -1
- package/components/Checkbox/Checkbox.mjs +1 -1
- package/components/Checkbox/Checkbox.mjs.map +1 -1
- package/components/Chip/Chip.js +1 -1
- package/components/Chip/Chip.js.map +1 -1
- package/components/Chip/Chip.mjs +1 -1
- package/components/Chip/Chip.mjs.map +1 -1
- package/components/Container/Container.js.map +1 -1
- package/components/Container/Container.mjs.map +1 -1
- package/components/Container/style.js.map +1 -1
- package/components/Container/style.mjs.map +1 -1
- package/components/ContextMenu/ContextMenu.js +1 -1
- package/components/ContextMenu/ContextMenu.js.map +1 -1
- package/components/ContextMenu/ContextMenu.mjs +1 -1
- package/components/ContextMenu/ContextMenu.mjs.map +1 -1
- package/components/ContextMenu/Item.js.map +1 -1
- package/components/ContextMenu/Item.mjs.map +1 -1
- package/components/ContextMenu/style.js.map +1 -1
- package/components/ContextMenu/style.mjs.map +1 -1
- package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.js +1 -1
- package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.js.map +1 -1
- package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.mjs +1 -1
- package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.mjs.map +1 -1
- package/components/ContextMenu.Multilevel/Controls.js.map +1 -1
- package/components/ContextMenu.Multilevel/Controls.mjs.map +1 -1
- package/components/Dialog/Dialog.js.map +1 -1
- package/components/Dialog/Dialog.mjs.map +1 -1
- package/components/DialogComponent/DialogComponent.js +1 -1
- package/components/DialogComponent/DialogComponent.js.map +1 -1
- package/components/DialogComponent/DialogComponent.mjs +1 -1
- package/components/DialogComponent/DialogComponent.mjs.map +1 -1
- package/components/DialogComponent/style.js.map +1 -1
- package/components/DialogComponent/style.mjs.map +1 -1
- package/components/Divider/style.js.map +1 -1
- package/components/Divider/style.mjs.map +1 -1
- package/components/Dropdown/Dropdown.js +1 -1
- package/components/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.mjs +1 -1
- package/components/Dropdown/Dropdown.mjs.map +1 -1
- package/components/Dropdown/DropdownMenuNoOptions.js +1 -1
- package/components/Dropdown/DropdownMenuNoOptions.js.map +1 -1
- package/components/Dropdown/DropdownMenuNoOptions.mjs +1 -1
- package/components/Dropdown/DropdownMenuNoOptions.mjs.map +1 -1
- package/components/Dropdown/hooks.js.map +1 -1
- package/components/Dropdown/hooks.mjs.map +1 -1
- package/components/FormInput/FormInput.js.map +1 -1
- package/components/FormInput/FormInput.mjs.map +1 -1
- package/components/FormInputLabel/FormInputLabel.js +1 -1
- package/components/FormInputLabel/FormInputLabel.js.map +1 -1
- package/components/FormInputLabel/FormInputLabel.mjs +1 -1
- package/components/FormInputLabel/FormInputLabel.mjs.map +1 -1
- package/components/FormLabel/FormLabel.js +1 -1
- package/components/FormLabel/FormLabel.js.map +1 -1
- package/components/FormLabel/FormLabel.mjs +1 -1
- package/components/FormLabel/FormLabel.mjs.map +1 -1
- package/components/Icon/Icon.js +1 -1
- package/components/Icon/Icon.js.map +1 -1
- package/components/Icon/Icon.mjs +1 -1
- package/components/Icon/Icon.mjs.map +1 -1
- package/components/Icon/bg-worker.js.map +1 -1
- package/components/Icon/bg-worker.mjs.map +1 -1
- package/components/Icon/list/default.js.map +1 -1
- package/components/Icon/list/default.mjs.map +1 -1
- package/components/Icon/list/icon-pack.js.map +1 -1
- package/components/Icon/list/icon-pack.mjs.map +1 -1
- package/components/IconButton/IconButton.js.map +1 -1
- package/components/IconButton/IconButton.mjs.map +1 -1
- package/components/Indicator/Indicator.js +1 -1
- package/components/Indicator/Indicator.js.map +1 -1
- package/components/Indicator/Indicator.mjs +1 -1
- package/components/Indicator/Indicator.mjs.map +1 -1
- package/components/Input/Input.js.map +1 -1
- package/components/Input/Input.mjs.map +1 -1
- package/components/Input/helpers.js.map +1 -1
- package/components/Input/helpers.mjs.map +1 -1
- package/components/Input.Phone/Input.Phone.js.map +1 -1
- package/components/Input.Phone/Input.Phone.mjs.map +1 -1
- package/components/InputCheckbox/InputCheckbox.js.map +1 -1
- package/components/InputCheckbox/InputCheckbox.mjs.map +1 -1
- package/components/InputRadio/InputRadio.js.map +1 -1
- package/components/InputRadio/InputRadio.mjs.map +1 -1
- package/components/ListItem/ListItem.js +1 -1
- package/components/ListItem/ListItem.js.map +1 -1
- package/components/ListItem/ListItem.mjs +1 -1
- package/components/ListItem/ListItem.mjs.map +1 -1
- package/components/Menu/Menu.js.map +1 -1
- package/components/Menu/Menu.mjs.map +1 -1
- package/components/MenuComponent/MenuComponent.js.map +1 -1
- package/components/MenuComponent/MenuComponent.mjs.map +1 -1
- package/components/MenuComponent/style.js +1 -1
- package/components/MenuComponent/style.js.map +1 -1
- package/components/MenuComponent/style.mjs +1 -1
- package/components/MenuComponent/style.mjs.map +1 -1
- package/components/MenuContainer/MenuContainer.js +1 -1
- package/components/MenuContainer/MenuContainer.js.map +1 -1
- package/components/MenuContainer/MenuContainer.mjs +1 -1
- package/components/MenuContainer/MenuContainer.mjs.map +1 -1
- package/components/MenuDivider/MenuDivider.js +1 -1
- package/components/MenuDivider/MenuDivider.js.map +1 -1
- package/components/MenuDivider/MenuDivider.mjs +1 -1
- package/components/MenuDivider/MenuDivider.mjs.map +1 -1
- package/components/MenuList/MenuList.js.map +1 -1
- package/components/MenuList/MenuList.mjs.map +1 -1
- package/components/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.mjs.map +1 -1
- package/components/Modal/adapter.js.map +1 -1
- package/components/Modal/adapter.mjs.map +1 -1
- package/components/Modal/style.js +1 -1
- package/components/Modal/style.js.map +1 -1
- package/components/Modal/style.mjs +1 -1
- package/components/Modal/style.mjs.map +1 -1
- package/components/Notification/Notification.js +1 -1
- package/components/Notification/Notification.js.map +1 -1
- package/components/Notification/Notification.mjs +1 -1
- package/components/Notification/Notification.mjs.map +1 -1
- package/components/Paper/Paper.js.map +1 -1
- package/components/Paper/Paper.mjs.map +1 -1
- package/components/Paper/style.js.map +1 -1
- package/components/Paper/style.mjs.map +1 -1
- package/components/Popover/Popover.js.map +1 -1
- package/components/Popover/Popover.mjs.map +1 -1
- package/components/PopoverComponent/PopoverComponent.js +1 -1
- package/components/PopoverComponent/PopoverComponent.js.map +1 -1
- package/components/PopoverComponent/PopoverComponent.mjs +1 -1
- package/components/PopoverComponent/PopoverComponent.mjs.map +1 -1
- package/components/Progress/Progress.js.map +1 -1
- package/components/Progress/Progress.mjs.map +1 -1
- package/components/Progress/style.js +1 -1
- package/components/Progress/style.js.map +1 -1
- package/components/Progress/style.mjs +1 -1
- package/components/Progress/style.mjs.map +1 -1
- package/components/Progress.Circle/Progress.Circle.js +1 -1
- package/components/Progress.Circle/Progress.Circle.js.map +1 -1
- package/components/Progress.Circle/Progress.Circle.mjs +1 -1
- package/components/Progress.Circle/Progress.Circle.mjs.map +1 -1
- package/components/Progress.Circle/style.js +1 -1
- package/components/Progress.Circle/style.js.map +1 -1
- package/components/Progress.Circle/style.mjs +1 -1
- package/components/Progress.Circle/style.mjs.map +1 -1
- package/components/Progress.Segmented/Progress.Segmented.js.map +1 -1
- package/components/Progress.Segmented/Progress.Segmented.mjs.map +1 -1
- package/components/Progress.Segmented/style.js.map +1 -1
- package/components/Progress.Segmented/style.mjs.map +1 -1
- package/components/ProgressCircle/ProgressCircle.js +1 -1
- package/components/ProgressCircle/ProgressCircle.js.map +1 -1
- package/components/ProgressCircle/ProgressCircle.mjs +1 -1
- package/components/ProgressCircle/ProgressCircle.mjs.map +1 -1
- package/components/ProgressCircle/style.js +1 -1
- package/components/ProgressCircle/style.js.map +1 -1
- package/components/ProgressCircle/style.mjs +1 -1
- package/components/ProgressCircle/style.mjs.map +1 -1
- package/components/ProgressLine/ProgressLine.js +1 -1
- package/components/ProgressLine/ProgressLine.js.map +1 -1
- package/components/ProgressLine/ProgressLine.mjs +1 -1
- package/components/ProgressLine/ProgressLine.mjs.map +1 -1
- package/components/Radio/Group.js.map +1 -1
- package/components/Radio/Group.mjs.map +1 -1
- package/components/Radio/Radio.js +1 -1
- package/components/Radio/Radio.js.map +1 -1
- package/components/Radio/Radio.mjs +1 -1
- package/components/Radio/Radio.mjs.map +1 -1
- package/components/Radio/style.js.map +1 -1
- package/components/Radio/style.mjs.map +1 -1
- package/components/Scrollable/Scrollable.js +1 -1
- package/components/Scrollable/Scrollable.js.map +1 -1
- package/components/Scrollable/Scrollable.mjs +1 -1
- package/components/Scrollable/Scrollable.mjs.map +1 -1
- package/components/Section/Section.js.map +1 -1
- package/components/Section/Section.mjs.map +1 -1
- package/components/Section/style.js +1 -1
- package/components/Section/style.js.map +1 -1
- package/components/Section/style.mjs +1 -1
- package/components/Section/style.mjs.map +1 -1
- package/components/Select/Select.js.map +1 -1
- package/components/Select/Select.mjs.map +1 -1
- package/components/Select/style.js +1 -1
- package/components/Select/style.js.map +1 -1
- package/components/Select/style.mjs +1 -1
- package/components/Select/style.mjs.map +1 -1
- package/components/Separator/Separator.js.map +1 -1
- package/components/Separator/Separator.mjs.map +1 -1
- package/components/Separator/SeparatorText.js.map +1 -1
- package/components/Separator/SeparatorText.mjs.map +1 -1
- package/components/Separator/style.js +1 -1
- package/components/Separator/style.js.map +1 -1
- package/components/Separator/style.mjs +1 -1
- package/components/Separator/style.mjs.map +1 -1
- package/components/Spacer/Spacer.js.map +1 -1
- package/components/Spacer/Spacer.mjs.map +1 -1
- package/components/Spacer/style.js.map +1 -1
- package/components/Spacer/style.mjs.map +1 -1
- package/components/Spinner/Spinner.js.map +1 -1
- package/components/Spinner/Spinner.mjs.map +1 -1
- package/components/Spinner/style.js +1 -1
- package/components/Spinner/style.js.map +1 -1
- package/components/Spinner/style.mjs +1 -1
- package/components/Spinner/style.mjs.map +1 -1
- package/components/Switch/Switch.js.map +1 -1
- package/components/Switch/Switch.mjs.map +1 -1
- package/components/Switcher/style.js.map +1 -1
- package/components/Switcher/style.mjs.map +1 -1
- package/components/Tab/Tab.js +1 -1
- package/components/Tab/Tab.js.map +1 -1
- package/components/Tab/Tab.mjs +1 -1
- package/components/Tab/Tab.mjs.map +1 -1
- package/components/TabList/TabList.js +1 -1
- package/components/TabList/TabList.js.map +1 -1
- package/components/TabList/TabList.mjs +1 -1
- package/components/TabList/TabList.mjs.map +1 -1
- package/components/TabList/TabListMenuTab.js +1 -1
- package/components/TabList/TabListMenuTab.js.map +1 -1
- package/components/TabList/TabListMenuTab.mjs +1 -1
- package/components/TabList/TabListMenuTab.mjs.map +1 -1
- package/components/TabList/TabListPanel.js.map +1 -1
- package/components/TabList/TabListPanel.mjs.map +1 -1
- package/components/TabList/hooks.js +1 -1
- package/components/TabList/hooks.js.map +1 -1
- package/components/TabList/hooks.mjs +1 -1
- package/components/TabList/hooks.mjs.map +1 -1
- package/components/TabList/style.js +1 -1
- package/components/TabList/style.js.map +1 -1
- package/components/TabList/style.mjs +1 -1
- package/components/TabList/style.mjs.map +1 -1
- package/components/TabListTab/TabListTab.js.map +1 -1
- package/components/TabListTab/TabListTab.mjs.map +1 -1
- package/components/TabListTab/style.js +1 -1
- package/components/TabListTab/style.js.map +1 -1
- package/components/TabListTab/style.mjs +1 -1
- package/components/TabListTab/style.mjs.map +1 -1
- package/components/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/Tabs.mjs.map +1 -1
- package/components/Tabs/style.js +1 -1
- package/components/Tabs/style.js.map +1 -1
- package/components/Tabs/style.mjs +1 -1
- package/components/Tabs/style.mjs.map +1 -1
- package/components/Tag/Tag.js +1 -1
- package/components/Tag/Tag.js.map +1 -1
- package/components/Tag/Tag.mjs +1 -1
- package/components/Tag/Tag.mjs.map +1 -1
- package/components/Tag/style.js +1 -1
- package/components/Tag/style.js.map +1 -1
- package/components/Tag/style.mjs +1 -1
- package/components/Tag/style.mjs.map +1 -1
- package/components/Text/Ellipsis.js +1 -1
- package/components/Text/Ellipsis.js.map +1 -1
- package/components/Text/Ellipsis.mjs +1 -1
- package/components/Text/Ellipsis.mjs.map +1 -1
- package/components/Text/Text.js.map +1 -1
- package/components/Text/Text.mjs.map +1 -1
- package/components/Text/style.js.map +1 -1
- package/components/Text/style.mjs.map +1 -1
- package/components/Text.Ellipse/Text.Ellipse.js +1 -1
- package/components/Text.Ellipse/Text.Ellipse.js.map +1 -1
- package/components/Text.Ellipse/Text.Ellipse.mjs +1 -1
- package/components/Text.Ellipse/Text.Ellipse.mjs.map +1 -1
- package/components/Textarea/Textarea.js +1 -1
- package/components/Textarea/Textarea.js.map +1 -1
- package/components/Textarea/Textarea.mjs +1 -1
- package/components/Textarea/Textarea.mjs.map +1 -1
- package/components/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.mjs.map +1 -1
- package/components/Tooltip/TooltipWrapper.js.map +1 -1
- package/components/Tooltip/TooltipWrapper.mjs.map +1 -1
- package/components/TooltipComponent/TooltipComponent.js +1 -1
- package/components/TooltipComponent/TooltipComponent.js.map +1 -1
- package/components/TooltipComponent/TooltipComponent.mjs +1 -1
- package/components/TooltipComponent/TooltipComponent.mjs.map +1 -1
- package/dts/index.d.ts +2630 -2557
- package/hocs/withMergedProps.js.map +1 -1
- package/hocs/withMergedProps.mjs.map +1 -1
- package/hocs/withTranslation.js +1 -1
- package/hocs/withTranslation.js.map +1 -1
- package/hocs/withTranslation.mjs +1 -1
- package/hocs/withTranslation.mjs.map +1 -1
- package/hooks/use-config-priority.js.map +1 -1
- package/hooks/use-config-priority.mjs +1 -1
- package/hooks/use-config-priority.mjs.map +1 -1
- package/hooks/useClickOutside.js.map +1 -1
- package/hooks/useClickOutside.mjs.map +1 -1
- package/hooks/useMergedPalette.js +1 -1
- package/hooks/useMergedPalette.js.map +1 -1
- package/hooks/useMergedPalette.mjs +1 -1
- package/hooks/useMergedPalette.mjs.map +1 -1
- package/hooks/useMergedProps.js.map +1 -1
- package/hooks/useMergedProps.mjs.map +1 -1
- package/hooks/useMergedSizes.js.map +1 -1
- package/hooks/useMergedSizes.mjs.map +1 -1
- package/hooks/useResizeObserver.js.map +1 -1
- package/hooks/useResizeObserver.mjs.map +1 -1
- package/hooks/useScrollMonitor.js +1 -1
- package/hooks/useScrollMonitor.js.map +1 -1
- package/hooks/useScrollMonitor.mjs +1 -1
- package/hooks/useScrollMonitor.mjs.map +1 -1
- package/hooks/useScrollThresholds.js.map +1 -1
- package/hooks/useScrollThresholds.mjs.map +1 -1
- package/mixins/color.js.map +1 -1
- package/mixins/color.mjs.map +1 -1
- package/mixins/create-responsive-props.js.map +1 -1
- package/mixins/create-responsive-props.mjs.map +1 -1
- package/mixins/display.js.map +1 -1
- package/mixins/display.mjs.map +1 -1
- package/mixins/responsive-margin.js.map +1 -1
- package/mixins/responsive-margin.mjs.map +1 -1
- package/mixins/responsive-property.js +1 -1
- package/mixins/responsive-property.js.map +1 -1
- package/mixins/responsive-property.mjs +1 -1
- package/mixins/responsive-property.mjs.map +1 -1
- package/mixins/screen.js +1 -1
- package/mixins/screen.js.map +1 -1
- package/mixins/screen.mjs +1 -1
- package/mixins/screen.mjs.map +1 -1
- package/mixins/shared.js +4 -4
- package/mixins/shared.js.map +1 -1
- package/mixins/shared.mjs +4 -4
- package/mixins/shared.mjs.map +1 -1
- package/mixins/vAlign.js.map +1 -1
- package/mixins/vAlign.mjs.map +1 -1
- package/package.json +7 -6
- package/shared/enums/sizeInput.js.map +1 -1
- package/shared/enums/sizeInput.mjs.map +1 -1
- package/shared/resize-observer.js.map +1 -1
- package/shared/resize-observer.mjs.map +1 -1
- package/shared/utils/colors.js.map +1 -1
- package/shared/utils/colors.mjs.map +1 -1
- package/shared/utils/dom.js.map +1 -1
- package/shared/utils/dom.mjs.map +1 -1
- package/shared/utils/react.js.map +1 -1
- package/shared/utils/react.mjs.map +1 -1
- package/shared/utils/rel-builder.js +1 -1
- package/shared/utils/rel-builder.js.map +1 -1
- package/shared/utils/rel-builder.mjs +1 -1
- package/shared/utils/rel-builder.mjs.map +1 -1
- package/theme/colors-dark.js.map +1 -1
- package/theme/colors-dark.mjs.map +1 -1
- package/theme/colors-light.js.map +1 -1
- package/theme/colors-light.mjs.map +1 -1
- package/theme/colors.js.map +1 -1
- package/theme/colors.mjs.map +1 -1
- package/theme/global-styled.js.map +1 -1
- package/theme/global-styled.mjs.map +1 -1
- package/theme/theme-provider.js.map +1 -1
- package/theme/theme-provider.mjs.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.mjs","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Icon } from 'components/Icon'\nimport { SIZES, SIZES_SQUARE } from './constants'\nimport * as Styled from './style'\nimport type { IconButtonProps } from './types'\n\nconst COMPONENT_NAME = 'IconButton'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [IconButtonProps](https://github.com/foxford/ui/blob/master/src/components/IconButton/types.ts)\n */\nconst IconButton: React.ForwardRefExoticComponent<IconButtonProps> = withMergedProps<\n IconButtonProps,\n HTMLButtonElement\n>(\n forwardRef((props, ref) => {\n const { size = 'm', type = 'button', iconProps = {}, icon, ...restProps } = props\n\n return (\n <Styled.Root {...restProps} size={size} type={type} ref={ref}>\n <Icon\n preset='brand'\n name={typeof icon === 'string' ? icon : undefined}\n icon={typeof icon !== 'string' ? icon : undefined}\n {...iconProps}\n />\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.square ? SIZES_SQUARE : SIZES),\n }\n)\n\nexport { IconButton }\n"],"names":["IconButton","withMergedProps","forwardRef","props","ref","size","type","iconProps","icon","restProps","_jsx","Styled","children","Icon","preset","name","undefined","displayName","sizes","square","SIZES_SQUARE","SIZES"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconButton.mjs","sources":["../../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Icon } from 'components/Icon'\nimport { SIZES, SIZES_SQUARE } from './constants'\nimport * as Styled from './style'\nimport type { IconButtonProps } from './types'\n\nconst COMPONENT_NAME = 'IconButton'\n\n/**\n *\n * Component accepts all \\<button\\> attributes.\n *\n * Responsive \"size\", \"margin\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [IconButtonProps](https://github.com/foxford/ui/blob/master/src/components/IconButton/types.ts)\n */\nconst IconButton: React.ForwardRefExoticComponent<IconButtonProps> = withMergedProps<\n IconButtonProps,\n HTMLButtonElement\n>(\n forwardRef<HTMLButtonElement, MergedProps<IconButtonProps>>((props, ref) => {\n const { size = 'm', type = 'button', iconProps = {}, icon, ...restProps } = props\n\n return (\n <Styled.Root {...restProps} size={size} type={type} ref={ref}>\n <Icon\n preset='brand'\n name={typeof icon === 'string' ? icon : undefined}\n icon={typeof icon !== 'string' ? icon : undefined}\n {...iconProps}\n />\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (props.square ? SIZES_SQUARE : SIZES),\n }\n)\n\nexport { IconButton }\n"],"names":["IconButton","withMergedProps","forwardRef","props","ref","size","type","iconProps","icon","restProps","_jsx","Styled","children","Icon","preset","name","undefined","displayName","sizes","square","SIZES_SQUARE","SIZES"],"mappings":"8OAoBMA,MAAAA,WAA+DC,gBAInEC,YAA4D,CAACC,EAAOC,KAClE,MAAMC,KAAEA,EAAO,IAAGC,KAAEA,EAAO,SAAQC,UAAEA,EAAY,CAAE,EAAAC,KAAEA,KAASC,GAAcN,EAE5E,OACEO,IAACC,KAAW,IAAKF,EAAWJ,KAAMA,EAAMC,KAAMA,EAAMF,IAAKA,EAAIQ,SAC3DF,IAACG,KAAI,CACHC,OAAO,QACPC,YAAaP,GAAS,SAAWA,OAAOQ,EACxCR,YAAaA,GAAS,SAAWA,OAAOQ,KACpCT,KAEM,IAGlB,CACEU,YA/BmB,aAgCnBC,MAAQf,GAAWA,EAAMgB,OAASC,aAAeC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');const indicatorPropsWithContent=e=>e.children!==void 0&&e.children!==null||e.text!==void 0&&e.text!==null;const Indicator=withMergedProps.withMergedProps(React.forwardRef(((e,t)=>{const{size:r="m",textProps:s={},children:i,text:n,...o}=e;const a=indicatorPropsWithContent(e);return jsxRuntime.jsx(style.Root,{...o,size:r,square:a,ref:t,children:jsxRuntime.jsx(style.Foreground,{children:a
|
|
1
|
+
'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Text=require('../Text/Text.js');const indicatorPropsWithContent=e=>e.children!==void 0&&e.children!==null||e.text!==void 0&&e.text!==null;const Indicator=withMergedProps.withMergedProps(React.forwardRef(((e,t)=>{const{size:r="m",textProps:s={},children:i,text:n,...o}=e;const a=indicatorPropsWithContent(e);return jsxRuntime.jsx(style.Root,{...o,size:r,square:a,ref:t,children:jsxRuntime.jsx(style.Foreground,{children:a?jsxRuntime.jsx(Text.Text,{as:"span",appearance:"body",size:"inherit",color:"inherit",whiteSpace:"nowrap",weight:700,lineHeight:1,marginTop:1,marginRight:"0.3em",marginLeft:"0.3em",...s,children:i??n}):null})})})),{displayName:'Indicator',sizes:e=>indicatorPropsWithContent(e)?constants.SIZES_SQUARE:constants.SIZES});exports.SIZES=constants.SIZES,exports.SIZES_SQUARE=constants.SIZES_SQUARE,exports.Indicator=Indicator;
|
|
2
2
|
//# sourceMappingURL=Indicator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Indicator.js","sources":["../../../../src/components/Indicator/Indicator.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { SIZES, SIZES_SQUARE } from './constants'\nimport * as Styled from './style'\nimport type { IndicatorProps } from './types'\n\nconst COMPONENT_NAME = 'Indicator'\n\nconst indicatorPropsWithContent = (props: IndicatorProps): boolean =>\n (props.children !== undefined && props.children !== null) || (props.text !== undefined && props.text !== null)\n\n/**\n *\n * Component accepts all \\<span\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [IndicatorProps](https://github.com/foxford/ui/blob/master/src/components/Indicator/types.ts)\n */\nconst Indicator: React.ForwardRefExoticComponent<IndicatorProps> = withMergedProps<IndicatorProps, HTMLSpanElement>(\n forwardRef((props, ref) => {\n const { size = 'm', textProps = {}, children, text, ...restProps } = props\n\n const hasContent = indicatorPropsWithContent(props)\n\n return (\n <Styled.Root {...restProps} size={size} square={hasContent} ref={ref}>\n <Styled.Foreground>\n {hasContent
|
|
1
|
+
{"version":3,"file":"Indicator.js","sources":["../../../../src/components/Indicator/Indicator.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { SIZES, SIZES_SQUARE } from './constants'\nimport * as Styled from './style'\nimport type { IndicatorProps } from './types'\n\nconst COMPONENT_NAME = 'Indicator'\n\nconst indicatorPropsWithContent = (props: IndicatorProps): boolean =>\n (props.children !== undefined && props.children !== null) || (props.text !== undefined && props.text !== null)\n\n/**\n *\n * Component accepts all \\<span\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [IndicatorProps](https://github.com/foxford/ui/blob/master/src/components/Indicator/types.ts)\n */\nconst Indicator: React.ForwardRefExoticComponent<IndicatorProps> = withMergedProps<IndicatorProps, HTMLSpanElement>(\n forwardRef<HTMLSpanElement, MergedProps<IndicatorProps>>((props, ref) => {\n const { size = 'm', textProps = {}, children, text, ...restProps } = props\n\n const hasContent = indicatorPropsWithContent(props)\n\n return (\n <Styled.Root {...restProps} size={size} square={hasContent} ref={ref}>\n <Styled.Foreground>\n {hasContent ? (\n <Text\n as='span'\n appearance='body'\n size='inherit'\n color='inherit'\n whiteSpace='nowrap'\n weight={700}\n lineHeight={1}\n marginTop={1}\n marginRight='0.3em'\n marginLeft='0.3em'\n {...textProps}\n >\n {children ?? text}\n </Text>\n ) : null}\n </Styled.Foreground>\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (indicatorPropsWithContent(props) ? SIZES_SQUARE : SIZES),\n }\n)\n\nexport { Indicator }\n\nexport { SIZES, SIZES_SQUARE }\n"],"names":["indicatorPropsWithContent","props","children","undefined","text","Indicator","withMergedProps","forwardRef","ref","size","textProps","restProps","hasContent","_jsx","Styled","square","jsx","Text","as","appearance","color","whiteSpace","weight","lineHeight","marginTop","marginRight","marginLeft","displayName","sizes","SIZES_SQUARE","SIZES"],"mappings":"6PAUA,MAAMA,0BAA6BC,GAChCA,EAAMC,gBAAaC,GAAaF,EAAMC,WAAa,MAAUD,EAAMG,YAASD,GAAaF,EAAMG,OAAS,KAYrGC,MAAAA,UAA6DC,gBAAAA,gBACjEC,MAAAA,YAAyD,CAACN,EAAOO,KAC/D,MAAMC,KAAEA,EAAO,IAAGC,UAAEA,EAAY,CAAE,EAAAR,SAAEA,EAAQE,KAAEA,KAASO,GAAcV,EAErE,MAAMW,EAAaZ,0BAA0BC,GAE7C,OACEY,WAAAA,IAACC,MAAAA,KAAW,IAAKH,EAAWF,KAAMA,EAAMM,OAAQH,EAAYJ,IAAKA,EAAIN,SACnEW,WAAAG,IAACF,iBAAiB,CAAAZ,SACfU,EACCC,WAAAG,IAACC,UAAI,CACHC,GAAG,OACHC,WAAW,OACXV,KAAK,UACLW,MAAM,UACNC,WAAW,SACXC,OAAQ,IACRC,WAAY,EACZC,UAAW,EACXC,YAAY,QACZC,WAAW,WACPhB,EAASR,SAEZA,GAAYE,IAEb,QAEM,IAGlB,CACEuB,YA9CmB,YA+CnBC,MAAQ3B,GAAWD,0BAA0BC,GAAS4B,UAAYA,aAAGC,UAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{forwardRef}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{SIZES_SQUARE,SIZES}from'./constants.mjs';import{Root,Foreground}from'./style.mjs';import{jsx}from'react/jsx-runtime';import{Text}from'../Text/Text.mjs';const indicatorPropsWithContent=r=>r.children!==void 0&&r.children!==null||r.text!==void 0&&r.text!==null;const Indicator=withMergedProps(forwardRef(((r,t)=>{const{size:e="m",textProps:o={},children:i,text:n,...s}=r;const a=indicatorPropsWithContent(r);return jsx(Root,{...s,size:e,square:a,ref:t,children:jsx(Foreground,{children:a
|
|
1
|
+
import{forwardRef}from'react';import{withMergedProps}from'../../hocs/withMergedProps.mjs';import{SIZES_SQUARE,SIZES}from'./constants.mjs';import{Root,Foreground}from'./style.mjs';import{jsx}from'react/jsx-runtime';import{Text}from'../Text/Text.mjs';const indicatorPropsWithContent=r=>r.children!==void 0&&r.children!==null||r.text!==void 0&&r.text!==null;const Indicator=withMergedProps(forwardRef(((r,t)=>{const{size:e="m",textProps:o={},children:i,text:n,...s}=r;const a=indicatorPropsWithContent(r);return jsx(Root,{...s,size:e,square:a,ref:t,children:jsx(Foreground,{children:a?jsx(Text,{as:"span",appearance:"body",size:"inherit",color:"inherit",whiteSpace:"nowrap",weight:700,lineHeight:1,marginTop:1,marginRight:"0.3em",marginLeft:"0.3em",...o,children:i??n}):null})})})),{displayName:'Indicator',sizes:r=>indicatorPropsWithContent(r)?SIZES_SQUARE:SIZES});export{Indicator,SIZES,SIZES_SQUARE};
|
|
2
2
|
//# sourceMappingURL=Indicator.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Indicator.mjs","sources":["../../../../src/components/Indicator/Indicator.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { SIZES, SIZES_SQUARE } from './constants'\nimport * as Styled from './style'\nimport type { IndicatorProps } from './types'\n\nconst COMPONENT_NAME = 'Indicator'\n\nconst indicatorPropsWithContent = (props: IndicatorProps): boolean =>\n (props.children !== undefined && props.children !== null) || (props.text !== undefined && props.text !== null)\n\n/**\n *\n * Component accepts all \\<span\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [IndicatorProps](https://github.com/foxford/ui/blob/master/src/components/Indicator/types.ts)\n */\nconst Indicator: React.ForwardRefExoticComponent<IndicatorProps> = withMergedProps<IndicatorProps, HTMLSpanElement>(\n forwardRef((props, ref) => {\n const { size = 'm', textProps = {}, children, text, ...restProps } = props\n\n const hasContent = indicatorPropsWithContent(props)\n\n return (\n <Styled.Root {...restProps} size={size} square={hasContent} ref={ref}>\n <Styled.Foreground>\n {hasContent
|
|
1
|
+
{"version":3,"file":"Indicator.mjs","sources":["../../../../src/components/Indicator/Indicator.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { Text } from 'components/Text'\nimport { SIZES, SIZES_SQUARE } from './constants'\nimport * as Styled from './style'\nimport type { IndicatorProps } from './types'\n\nconst COMPONENT_NAME = 'Indicator'\n\nconst indicatorPropsWithContent = (props: IndicatorProps): boolean =>\n (props.children !== undefined && props.children !== null) || (props.text !== undefined && props.text !== null)\n\n/**\n *\n * Component accepts all \\<span\\> attributes.\n *\n * Responsive \"size\" props are supported.\n *\n * Exposed \"ref\" attached to root node.\n *\n * See full [IndicatorProps](https://github.com/foxford/ui/blob/master/src/components/Indicator/types.ts)\n */\nconst Indicator: React.ForwardRefExoticComponent<IndicatorProps> = withMergedProps<IndicatorProps, HTMLSpanElement>(\n forwardRef<HTMLSpanElement, MergedProps<IndicatorProps>>((props, ref) => {\n const { size = 'm', textProps = {}, children, text, ...restProps } = props\n\n const hasContent = indicatorPropsWithContent(props)\n\n return (\n <Styled.Root {...restProps} size={size} square={hasContent} ref={ref}>\n <Styled.Foreground>\n {hasContent ? (\n <Text\n as='span'\n appearance='body'\n size='inherit'\n color='inherit'\n whiteSpace='nowrap'\n weight={700}\n lineHeight={1}\n marginTop={1}\n marginRight='0.3em'\n marginLeft='0.3em'\n {...textProps}\n >\n {children ?? text}\n </Text>\n ) : null}\n </Styled.Foreground>\n </Styled.Root>\n )\n }),\n {\n displayName: COMPONENT_NAME,\n sizes: (props) => (indicatorPropsWithContent(props) ? SIZES_SQUARE : SIZES),\n }\n)\n\nexport { Indicator }\n\nexport { SIZES, SIZES_SQUARE }\n"],"names":["indicatorPropsWithContent","props","children","undefined","text","Indicator","withMergedProps","forwardRef","ref","size","textProps","restProps","hasContent","_jsx","Styled","square","Text","as","appearance","color","whiteSpace","weight","lineHeight","marginTop","marginRight","marginLeft","displayName","sizes","SIZES_SQUARE","SIZES"],"mappings":"yPAUA,MAAMA,0BAA6BC,GAChCA,EAAMC,gBAAaC,GAAaF,EAAMC,WAAa,MAAUD,EAAMG,YAASD,GAAaF,EAAMG,OAAS,KAYrGC,MAAAA,UAA6DC,gBACjEC,YAAyD,CAACN,EAAOO,KAC/D,MAAMC,KAAEA,EAAO,IAAGC,UAAEA,EAAY,CAAE,EAAAR,SAAEA,EAAQE,KAAEA,KAASO,GAAcV,EAErE,MAAMW,EAAaZ,0BAA0BC,GAE7C,OACEY,IAACC,KAAW,IAAKH,EAAWF,KAAMA,EAAMM,OAAQH,EAAYJ,IAAKA,EAAIN,SACnEW,IAACC,WAAiB,CAAAZ,SACfU,EACCC,IAACG,KAAI,CACHC,GAAG,OACHC,WAAW,OACXT,KAAK,UACLU,MAAM,UACNC,WAAW,SACXC,OAAQ,IACRC,WAAY,EACZC,UAAW,EACXC,YAAY,QACZC,WAAW,WACPf,EAASR,SAEZA,GAAYE,IAEb,QAEM,IAGlB,CACEsB,YA9CmB,YA+CnBC,MAAQ1B,GAAWD,0BAA0BC,GAAS2B,aAAeC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef, useState, useImperativeHandle, useRef, useLayoutEffect, useMemo } from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { FormInputLabel, SIZES } from 'components/FormInputLabel'\nimport { FormInput } from 'components/FormInput'\nimport { InputPhone } from 'components/Input.Phone'\nimport { IconButton } from 'components/IconButton'\nimport { SIZES_ICON, SIZES_CONTROL } from './constants'\nimport * as Styled from './style'\nimport type { InputProps } from './types'\n\nconst COMPONENT_NAME = 'Input'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<input\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Input/types.ts).\n */\nconst Input: React.ForwardRefExoticComponent<InputProps> & { Phone: typeof InputPhone } = Object.assign(\n withMergedProps<InputProps, HTMLInputElement>(\n forwardRef((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rounded = true,\n primary = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n width = theme.defaultInputControlsWidth,\n type = 'text',\n labelPosition = 'dynamic',\n iconProps = {},\n controls = {},\n addonButtonProps = {},\n preset,\n className,\n style,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n palette,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n error,\n success,\n label,\n icon,\n text,\n secondary,\n contrast,\n onColored,\n fluid,\n disabled,\n inline,\n inputRef,\n ...inputProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const { icon: additionalControlIcon, buttonProps: additionalControlButtonProps = {} } = controls.additional ?? {}\n\n const [iconBefore, iconAfter = !additionalControlButtonProps.onClick ? additionalControlIcon : undefined] =\n Array.isArray(icon) ? icon : [icon]\n\n const addonControlIcon = addonButtonProps.icon ?? additionalControlIcon\n\n const inputAlwaysActive = Boolean(inputProps.mask && inputProps.alwaysShowMask)\n\n const controlPalette = {\n color: palette.controlsColor,\n colorHover: palette.controlsColorHover,\n colorActive: palette.controlsColorActive,\n colorDisabled: palette.controlsColorDisabled,\n backgroundColor: palette.controlsBackgroundColor,\n backgroundColorHover: palette.controlsBackgroundColorHover,\n backgroundColorActive: palette.controlsBackgroundColorActive,\n backgroundColorDisabled: palette.controlsBackgroundColorDisabled,\n }\n\n const ref = useRef<HTMLInputElement | null>(null)\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(forwardedRef, () => ref.current, [])\n\n const addonRef = useRef<HTMLButtonElement | null>(null)\n const minusRef = useRef<HTMLButtonElement | null>(null)\n const plusRef = useRef<HTMLButtonElement | null>(null)\n\n const inputLabelId = useMemo(() => nanoid(), [])\n\n const [inputActive, setInputActive] = useState(() => {\n if (inputAlwaysActive) return true\n\n const initValue = inputProps.value ?? inputProps.defaultValue\n\n return (typeof initValue === 'string' && initValue.length > 0) || typeof initValue === 'number'\n })\n\n const [minusDisabled, setMinusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.min === undefined) return false\n\n const { value = Infinity, defaultValue = Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const minValue = typeof inputProps.min === 'number' ? inputProps.min : parseFloat(inputProps.min)\n\n return Math.min(initValue, initDefaultValue) <= minValue\n })\n\n const [plusDisabled, setPlusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.max === undefined) return false\n\n const { value = -Infinity, defaultValue = -Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const maxValue = typeof inputProps.max === 'number' ? inputProps.max : parseFloat(inputProps.max)\n\n return Math.max(initValue, initDefaultValue) >= maxValue\n })\n\n useLayoutEffect(() => {\n if (inputAlwaysActive) {\n setInputActive(true)\n } else if (\n inputProps.value !== undefined &&\n inputProps.value !== null &&\n ref.current &&\n ref.current !== document.activeElement\n ) {\n setInputActive(\n (typeof inputProps.value === 'string' && inputProps.value.length > 0) ||\n typeof inputProps.value === 'number'\n )\n }\n }, [inputAlwaysActive, inputProps.value])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...inputProps}\n inputRef={\n inputRef ??\n ((input) => {\n ref.current = input\n })\n }\n className={className}\n style={style}\n size={typeof size === 'number' ? size : undefined}\n rounded={rounded}\n color={color}\n placeholderColor={placeholderColor}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n error={error}\n type={type}\n fluid={fluid}\n disabled={disabled}\n />\n )\n }\n\n return (\n <FormInputLabel\n {...sizeProps}\n className={className}\n style={style}\n sizeUnits={sizeUnits}\n sizes={sizes}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n error={error}\n success={success}\n label={label}\n labelId={inputLabelId}\n labelPosition={labelPosition}\n icon={[iconBefore, iconAfter]}\n text={text}\n primary={primary}\n secondary={secondary}\n contrast={contrast}\n onColored={onColored}\n disabled={disabled}\n inline={inline}\n active={inputActive}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n iconProps={{\n color: disabled ? 'content-disabled' : 'content-onmain-tertiary',\n sizes: SIZES_ICON,\n ...sizeProps,\n ...iconProps,\n }}\n onClick={() => {\n if (ref.current) {\n ref.current.focus()\n }\n }}\n onFocus={(evt) => {\n if (evt.target !== evt.currentTarget) {\n setInputActive(true)\n }\n }}\n onPointerDown={(evt) => {\n if (\n evt.target === ref.current ||\n !(evt.target instanceof Node) ||\n addonRef.current?.contains(evt.target) ||\n minusRef.current?.contains(evt.target) ||\n plusRef.current?.contains(evt.target)\n ) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (!inputAlwaysActive && ref.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setInputActive(Boolean(ref.current.value))\n }\n }}\n input={\n <FormInput\n {...inputProps}\n aria-labelledby={label ? inputLabelId : undefined}\n ref={ref}\n type={type}\n disabled={disabled}\n palette={{\n color: palette.inputColor,\n placeholderColor: palette.inputPlaceholderColor,\n colorDisabled: palette.inputColorDisabled,\n placeholderColorDisabled: palette.inputPlaceholderColorDisabled,\n }}\n onChange={(evt) => {\n if (inputProps.onChange) {\n inputProps.onChange(evt)\n }\n\n if (type === 'number') {\n const currentValue = parseFloat(evt.currentTarget.value)\n\n const minValueReached = currentValue <= parseFloat(evt.currentTarget.min)\n const maxValueReached = currentValue >= parseFloat(evt.currentTarget.max)\n\n setMinusDisabled(minValueReached)\n setPlusDisabled(maxValueReached)\n\n if (minValueReached || maxValueReached) {\n evt.currentTarget.focus()\n }\n }\n }}\n />\n }\n addon={\n (addonButtonProps.onClick || additionalControlButtonProps.onClick) && addonControlIcon ? (\n <IconButton\n ref={addonRef}\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n {...sizeProps}\n {...additionalControlButtonProps}\n {...addonButtonProps}\n icon={addonControlIcon}\n disabled={disabled || addonButtonProps.disabled || additionalControlButtonProps.disabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n if (addonButtonProps.onClick) addonButtonProps.onClick(evt)\n if (additionalControlButtonProps.onClick) additionalControlButtonProps.onClick(evt)\n }}\n />\n ) : undefined\n }\n controls={\n type === 'number' ? (\n <>\n <IconButton\n {...sizeProps}\n ref={minusRef}\n icon='minus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || minusDisabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepDown()\n\n const decremented = ref.current.value\n if (prev !== decremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err)\n }\n }}\n />\n <Styled.IconButtonSeparated\n {...sizeProps}\n ref={plusRef}\n icon='plus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || plusDisabled}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepUp()\n\n const incremented = ref.current.value\n if (prev !== incremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err)\n }\n }}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n sizes: SIZES,\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Phone: InputPhone,\n }\n)\n\nexport { Input, COMPONENT_NAME }\n"],"names":["Input","Object","assign","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rounded","primary","color","placeholderColor","width","defaultInputControlsWidth","type","labelPosition","iconProps","controls","addonButtonProps","preset","className","style","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","palette","widthXXS","widthXS","widthS","widthM","widthL","widthXL","error","success","label","icon","text","secondary","contrast","onColored","fluid","disabled","inline","inputRef","inputProps","sizeProps","additionalControlIcon","buttonProps","additionalControlButtonProps","additional","iconBefore","iconAfter","onClick","undefined","Array","isArray","addonControlIcon","inputAlwaysActive","Boolean","mask","alwaysShowMask","controlPalette","controlsColor","colorHover","controlsColorHover","colorActive","controlsColorActive","colorDisabled","controlsColorDisabled","backgroundColor","controlsBackgroundColor","backgroundColorHover","controlsBackgroundColorHover","backgroundColorActive","controlsBackgroundColorActive","backgroundColorDisabled","controlsBackgroundColorDisabled","ref","useRef","useImperativeHandle","current","addonRef","minusRef","plusRef","inputLabelId","useMemo","nanoid","inputActive","setInputActive","useState","initValue","value","defaultValue","length","minusDisabled","setMinusDisabled","min","Infinity","parseFloat","initDefaultValue","minValue","Math","plusDisabled","setPlusDisabled","max","maxValue","useLayoutEffect","document","activeElement","_jsx","Styled","input","FormInputLabel","labelId","active","borderColor","borderColorDisabled","SIZES_ICON","focus","onFocus","evt","target","currentTarget","onPointerDown","Node","contains","preventDefault","onBlur","relatedTarget","jsx","FormInput","inputColor","inputPlaceholderColor","inputColorDisabled","placeholderColorDisabled","inputPlaceholderColorDisabled","onChange","currentValue","minValueReached","maxValueReached","addon","IconButton","SIZES_CONTROL","stopPropagation","readOnly","_jsxs","_Fragment","children","prev","stepDown","event","Event","bubbles","dispatchEvent","err","console","stepUp","SIZES","displayName","Phone","InputPh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AAAA,SAAA,CAAAC,SAAA,CACEtC,WAAAoB,IAACY,sBAAU,IACLhG,GACJgC,IAAKK,GACL/C,KAAK,QACL9C,MAAOyJ,YAAcA,cACrBrH,QAASoC,GACTpB,SAAUA,IAAYqD,GACtB5E,WAAY,GACZkC,QAAUoE,IAER,GADAA,EAAIuB,mBACAnG,GAAWoG,SAEf,IACE,GAAInE,GAAIG,QAAS,CACfQ,IAAe,GAEf,MAAM4D,EAAOvE,GAAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQqE,WAGRD,IADgBvE,GAAIG,QAAQW,MACN,CACxB,MAAM2D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C3E,GAAIG,QAAQyE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GAEPC,QAAQ3H,MAAM0H,EAChB,KAGJ7C,WAAAoB,IAACnB,0BAA0B,IACrBjE,GACJgC,IAAKM,GACLhD,KAAK,OACL9C,MAAOyJ,YAAcA,cACrBrH,QAASoC,GACTpB,SAAUA,IAAY6D,GACtBlD,QAAUoE,IAER,GADAA,EAAIuB,mBACAnG,GAAWoG,SAEf,IACE,GAAInE,GAAIG,QAAS,CACfQ,IAAe,GAEf,MAAM4D,EAAOvE,GAAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQ4E,SAGRR,IADgBvE,GAAIG,QAAQW,MACN,CACxB,MAAM2D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C3E,GAAIG,QAAQyE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GAEPC,QAAQ3H,MAAM0H,EAChB,aAIJrG,GAEN,IAGN,CACEhE,MAAOwK,UAAKA,MACZC,YAtbiB,UAybrB,CACEC,MAAOC,YAAAA,oCA1bY"}
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef, useState, useImperativeHandle, useRef, useLayoutEffect, useMemo } from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { FormInputLabel, SIZES } from 'components/FormInputLabel'\nimport { FormInput } from 'components/FormInput'\nimport { InputPhone } from 'components/Input.Phone'\nimport { IconButton } from 'components/IconButton'\nimport { SIZES_ICON, SIZES_CONTROL } from './constants'\nimport * as Styled from './style'\nimport type { InputProps } from './types'\n\nconst COMPONENT_NAME = 'Input'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<input\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Input/types.ts).\n */\nconst Input: React.ForwardRefExoticComponent<InputProps> & { Phone: typeof InputPhone } = Object.assign(\n withMergedProps<InputProps, HTMLInputElement>(\n forwardRef<HTMLInputElement, MergedProps<InputProps>>((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rounded = true,\n primary = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n width = theme.defaultInputControlsWidth,\n type = 'text',\n labelPosition = 'dynamic',\n iconProps = {},\n controls = {},\n addonButtonProps = {},\n preset,\n className,\n style,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n palette,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n error,\n success,\n label,\n icon,\n text,\n secondary,\n contrast,\n onColored,\n fluid,\n disabled,\n inline,\n inputRef,\n ...inputProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const { icon: additionalControlIcon, buttonProps: additionalControlButtonProps = {} } = controls.additional ?? {}\n\n const [iconBefore, iconAfter = !additionalControlButtonProps.onClick ? additionalControlIcon : undefined] =\n Array.isArray(icon) ? icon : [icon]\n\n const addonControlIcon = addonButtonProps.icon ?? additionalControlIcon\n\n const inputAlwaysActive = Boolean(inputProps.mask && inputProps.alwaysShowMask)\n\n const controlPalette = {\n color: palette.controlsColor,\n colorHover: palette.controlsColorHover,\n colorActive: palette.controlsColorActive,\n colorDisabled: palette.controlsColorDisabled,\n backgroundColor: palette.controlsBackgroundColor,\n backgroundColorHover: palette.controlsBackgroundColorHover,\n backgroundColorActive: palette.controlsBackgroundColorActive,\n backgroundColorDisabled: palette.controlsBackgroundColorDisabled,\n }\n\n const ref = useRef<HTMLInputElement | null>(null)\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(forwardedRef, () => ref.current, [])\n\n const addonRef = useRef<HTMLButtonElement | null>(null)\n const minusRef = useRef<HTMLButtonElement | null>(null)\n const plusRef = useRef<HTMLButtonElement | null>(null)\n\n const inputLabelId = useMemo(() => nanoid(), [])\n\n const [inputActive, setInputActive] = useState(() => {\n if (inputAlwaysActive) return true\n\n const initValue = inputProps.value ?? inputProps.defaultValue\n\n return (typeof initValue === 'string' && initValue.length > 0) || typeof initValue === 'number'\n })\n\n const [minusDisabled, setMinusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.min === undefined) return false\n\n const { value = Infinity, defaultValue = Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const minValue = typeof inputProps.min === 'number' ? inputProps.min : parseFloat(inputProps.min)\n\n return Math.min(initValue, initDefaultValue) <= minValue\n })\n\n const [plusDisabled, setPlusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.max === undefined) return false\n\n const { value = -Infinity, defaultValue = -Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const maxValue = typeof inputProps.max === 'number' ? inputProps.max : parseFloat(inputProps.max)\n\n return Math.max(initValue, initDefaultValue) >= maxValue\n })\n\n useLayoutEffect(() => {\n if (inputAlwaysActive) {\n setInputActive(true)\n } else if (\n inputProps.value !== undefined &&\n inputProps.value !== null &&\n ref.current &&\n ref.current !== document.activeElement\n ) {\n setInputActive(\n (typeof inputProps.value === 'string' && inputProps.value.length > 0) ||\n typeof inputProps.value === 'number'\n )\n }\n }, [inputAlwaysActive, inputProps.value])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...inputProps}\n inputRef={\n inputRef ??\n ((input) => {\n ref.current = input\n })\n }\n className={className}\n style={style}\n size={typeof size === 'number' ? size : undefined}\n rounded={rounded}\n color={color}\n placeholderColor={placeholderColor}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n error={error}\n type={type}\n fluid={fluid}\n disabled={disabled}\n />\n )\n }\n\n return (\n <FormInputLabel\n {...sizeProps}\n className={className}\n style={style}\n sizeUnits={sizeUnits}\n sizes={sizes}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n error={error}\n success={success}\n label={label}\n labelId={inputLabelId}\n labelPosition={labelPosition}\n icon={[iconBefore, iconAfter]}\n text={text}\n primary={primary}\n secondary={secondary}\n contrast={contrast}\n onColored={onColored}\n disabled={disabled}\n inline={inline}\n active={inputActive}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n iconProps={{\n color: disabled ? 'content-disabled' : 'content-onmain-tertiary',\n sizes: SIZES_ICON,\n ...sizeProps,\n ...iconProps,\n }}\n onClick={() => {\n if (ref.current) {\n ref.current.focus()\n }\n }}\n onFocus={(evt) => {\n if (evt.target !== evt.currentTarget) {\n setInputActive(true)\n }\n }}\n onPointerDown={(evt) => {\n if (\n evt.target === ref.current ||\n !(evt.target instanceof Node) ||\n addonRef.current?.contains(evt.target) ||\n minusRef.current?.contains(evt.target) ||\n plusRef.current?.contains(evt.target)\n ) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (!inputAlwaysActive && ref.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setInputActive(Boolean(ref.current.value))\n }\n }}\n input={\n <FormInput\n {...inputProps}\n aria-labelledby={label ? inputLabelId : undefined}\n ref={ref}\n type={type}\n disabled={disabled}\n palette={{\n color: palette.inputColor,\n placeholderColor: palette.inputPlaceholderColor,\n colorDisabled: palette.inputColorDisabled,\n placeholderColorDisabled: palette.inputPlaceholderColorDisabled,\n }}\n onChange={(evt) => {\n if (inputProps.onChange) {\n inputProps.onChange(evt)\n }\n\n if (type === 'number') {\n const currentValue = parseFloat(evt.currentTarget.value)\n\n const minValueReached = currentValue <= parseFloat(evt.currentTarget.min)\n const maxValueReached = currentValue >= parseFloat(evt.currentTarget.max)\n\n setMinusDisabled(minValueReached)\n setPlusDisabled(maxValueReached)\n\n if (minValueReached || maxValueReached) {\n evt.currentTarget.focus()\n }\n }\n }}\n />\n }\n addon={\n (addonButtonProps.onClick || additionalControlButtonProps.onClick) && addonControlIcon ? (\n <IconButton\n ref={addonRef}\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n {...sizeProps}\n {...additionalControlButtonProps}\n {...addonButtonProps}\n icon={addonControlIcon}\n disabled={disabled || addonButtonProps.disabled || additionalControlButtonProps.disabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n if (addonButtonProps.onClick) addonButtonProps.onClick(evt)\n if (additionalControlButtonProps.onClick) additionalControlButtonProps.onClick(evt)\n }}\n />\n ) : undefined\n }\n controls={\n type === 'number' ? (\n <>\n <IconButton\n {...sizeProps}\n ref={minusRef}\n icon='minus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || minusDisabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepDown()\n\n const decremented = ref.current.value\n if (prev !== decremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n console.error(err)\n }\n }}\n />\n <Styled.IconButtonSeparated\n {...sizeProps}\n ref={plusRef}\n icon='plus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || plusDisabled}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepUp()\n\n const incremented = ref.current.value\n if (prev !== incremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n console.error(err)\n }\n }}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n sizes: SIZES,\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Phone: InputPhone,\n }\n)\n\nexport { Input, COMPONENT_NAME }\n"],"names":["Input","Object","assign","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rounded","primary","color","placeholderColor","width","defaultInputControlsWidth","type","labelPosition","iconProps","controls","addonButtonProps","preset","className","style","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","palette","widthXXS","widthXS","widthS","widthM","widthL","widthXL","error","success","label","icon","text","secondary","contrast","onColored","fluid","disabled","inline","inputRef","inputProps","sizeProps","additionalControlIcon","buttonProps","additionalControlButtonProps","additional","iconBefore","iconAfter","onClick","undefined","Array","isArray","addonControlIcon","inputAlwaysActive","Boolean","mask","alwaysShowMask","controlPalette","controlsColor","colorHover","controlsColorHover","colorActive","controlsColorActive","colorDisabled","controlsColorDisabled","backgroundColor","controlsBackgroundColor","backgroundColorHover","controlsBackgroundColorHover","backgroundColorActive","controlsBackgroundColorActive","backgroundColorDisabled","controlsBackgroundColorDisabled","ref","useRef","useImperativeHandle","current","addonRef","minusRef","plusRef","inputLabelId","useMemo","nanoid","inputActive","setInputActive","useState","initValue","value","defaultValue","length","minusDisabled","setMinusDisabled","min","Infinity","parseFloat","initDefaultValue","minValue","Math","plusDisabled","setPlusDisabled","max","maxValue","useLayoutEffect","document","activeElement","_jsx","Styled","input","FormInputLabel","labelId","active","borderColor","borderColorDisabled","SIZES_ICON","focus","onFocus","evt","target","currentTarget","onPointerDown","Node","contains","preventDefault","onBlur","relatedTarget","jsx","FormInput","inputColor","inputPlaceholderColor","inputColorDisabled","placeholderColorDisabled","inputPlaceholderColorDisabled","onChange","currentValue","minValueReached","maxValueReached","addon","IconButton","SIZES_CONTROL","stopPropagation","readOnly","_jsxs","_Fragment","children","prev","stepDown","event","Event","bubbles","dispatchEvent","err","console","stepUp","SIZES","displayName","Phone","InputPhone"],"mappings":"4jBAyBA,MAAMA,MAAoFC,OAAOC,OAC/FC,gBAAAA,gBACEC,MAAAA,YAAsD,CAACC,EAAOC,KAC5D,MAAMC,EAAQC,OAAAA,WAEd,MAAMC,KACJA,EAAO,IAAGC,QACVA,GAAU,EAAIC,QACdA,GAAU,EAAIC,MACdA,EAAQ,YAAWC,iBACnBA,EAAmB,SAAQC,MAC3BA,EAAQP,EAAMQ,0BAAyBC,KACvCA,EAAO,OAAMC,cACbA,EAAgB,UAASC,UACzBA,EAAY,CAAE,EAAAC,SACdA,EAAW,CAAE,EAAAC,iBACbA,EAAmB,CAAE,EAAAC,OACrBA,EAAMC,UACNA,QACAC,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,OACLA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,UACRA,EAASC,aACTA,EAAYC,YACZA,EAAWC,WACXA,EAAUC,WACVA,EAAUC,WACVA,EAAU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G,SAEf,IACE,GAAInE,GAAIG,QAAS,CACfQ,IAAe,GAEf,MAAM4D,EAAOvE,GAAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQ4E,SAGRR,IADgBvE,GAAIG,QAAQW,MACN,CACxB,MAAM2D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C3E,GAAIG,QAAQyE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GACPC,QAAQ3H,MAAM0H,EAChB,aAIJrG,GAEN,IAGN,CACEhE,MAAOwK,UAAKA,MACZC,YApbiB,UAubrB,CACEC,MAAOC,YAAAA,oCAxbY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.mjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef, useState, useImperativeHandle, useRef, useLayoutEffect, useMemo } from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { FormInputLabel, SIZES } from 'components/FormInputLabel'\nimport { FormInput } from 'components/FormInput'\nimport { InputPhone } from 'components/Input.Phone'\nimport { IconButton } from 'components/IconButton'\nimport { SIZES_ICON, SIZES_CONTROL } from './constants'\nimport * as Styled from './style'\nimport type { InputProps } from './types'\n\nconst COMPONENT_NAME = 'Input'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<input\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Input/types.ts).\n */\nconst Input: React.ForwardRefExoticComponent<InputProps> & { Phone: typeof InputPhone } = Object.assign(\n withMergedProps<InputProps, HTMLInputElement>(\n forwardRef((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rounded = true,\n primary = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n width = theme.defaultInputControlsWidth,\n type = 'text',\n labelPosition = 'dynamic',\n iconProps = {},\n controls = {},\n addonButtonProps = {},\n preset,\n className,\n style,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n palette,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n error,\n success,\n label,\n icon,\n text,\n secondary,\n contrast,\n onColored,\n fluid,\n disabled,\n inline,\n inputRef,\n ...inputProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const { icon: additionalControlIcon, buttonProps: additionalControlButtonProps = {} } = controls.additional ?? {}\n\n const [iconBefore, iconAfter = !additionalControlButtonProps.onClick ? additionalControlIcon : undefined] =\n Array.isArray(icon) ? icon : [icon]\n\n const addonControlIcon = addonButtonProps.icon ?? additionalControlIcon\n\n const inputAlwaysActive = Boolean(inputProps.mask && inputProps.alwaysShowMask)\n\n const controlPalette = {\n color: palette.controlsColor,\n colorHover: palette.controlsColorHover,\n colorActive: palette.controlsColorActive,\n colorDisabled: palette.controlsColorDisabled,\n backgroundColor: palette.controlsBackgroundColor,\n backgroundColorHover: palette.controlsBackgroundColorHover,\n backgroundColorActive: palette.controlsBackgroundColorActive,\n backgroundColorDisabled: palette.controlsBackgroundColorDisabled,\n }\n\n const ref = useRef<HTMLInputElement | null>(null)\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(forwardedRef, () => ref.current, [])\n\n const addonRef = useRef<HTMLButtonElement | null>(null)\n const minusRef = useRef<HTMLButtonElement | null>(null)\n const plusRef = useRef<HTMLButtonElement | null>(null)\n\n const inputLabelId = useMemo(() => nanoid(), [])\n\n const [inputActive, setInputActive] = useState(() => {\n if (inputAlwaysActive) return true\n\n const initValue = inputProps.value ?? inputProps.defaultValue\n\n return (typeof initValue === 'string' && initValue.length > 0) || typeof initValue === 'number'\n })\n\n const [minusDisabled, setMinusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.min === undefined) return false\n\n const { value = Infinity, defaultValue = Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const minValue = typeof inputProps.min === 'number' ? inputProps.min : parseFloat(inputProps.min)\n\n return Math.min(initValue, initDefaultValue) <= minValue\n })\n\n const [plusDisabled, setPlusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.max === undefined) return false\n\n const { value = -Infinity, defaultValue = -Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const maxValue = typeof inputProps.max === 'number' ? inputProps.max : parseFloat(inputProps.max)\n\n return Math.max(initValue, initDefaultValue) >= maxValue\n })\n\n useLayoutEffect(() => {\n if (inputAlwaysActive) {\n setInputActive(true)\n } else if (\n inputProps.value !== undefined &&\n inputProps.value !== null &&\n ref.current &&\n ref.current !== document.activeElement\n ) {\n setInputActive(\n (typeof inputProps.value === 'string' && inputProps.value.length > 0) ||\n typeof inputProps.value === 'number'\n )\n }\n }, [inputAlwaysActive, inputProps.value])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...inputProps}\n inputRef={\n inputRef ??\n ((input) => {\n ref.current = input\n })\n }\n className={className}\n style={style}\n size={typeof size === 'number' ? size : undefined}\n rounded={rounded}\n color={color}\n placeholderColor={placeholderColor}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n error={error}\n type={type}\n fluid={fluid}\n disabled={disabled}\n />\n )\n }\n\n return (\n <FormInputLabel\n {...sizeProps}\n className={className}\n style={style}\n sizeUnits={sizeUnits}\n sizes={sizes}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n error={error}\n success={success}\n label={label}\n labelId={inputLabelId}\n labelPosition={labelPosition}\n icon={[iconBefore, iconAfter]}\n text={text}\n primary={primary}\n secondary={secondary}\n contrast={contrast}\n onColored={onColored}\n disabled={disabled}\n inline={inline}\n active={inputActive}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n iconProps={{\n color: disabled ? 'content-disabled' : 'content-onmain-tertiary',\n sizes: SIZES_ICON,\n ...sizeProps,\n ...iconProps,\n }}\n onClick={() => {\n if (ref.current) {\n ref.current.focus()\n }\n }}\n onFocus={(evt) => {\n if (evt.target !== evt.currentTarget) {\n setInputActive(true)\n }\n }}\n onPointerDown={(evt) => {\n if (\n evt.target === ref.current ||\n !(evt.target instanceof Node) ||\n addonRef.current?.contains(evt.target) ||\n minusRef.current?.contains(evt.target) ||\n plusRef.current?.contains(evt.target)\n ) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (!inputAlwaysActive && ref.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setInputActive(Boolean(ref.current.value))\n }\n }}\n input={\n <FormInput\n {...inputProps}\n aria-labelledby={label ? inputLabelId : undefined}\n ref={ref}\n type={type}\n disabled={disabled}\n palette={{\n color: palette.inputColor,\n placeholderColor: palette.inputPlaceholderColor,\n colorDisabled: palette.inputColorDisabled,\n placeholderColorDisabled: palette.inputPlaceholderColorDisabled,\n }}\n onChange={(evt) => {\n if (inputProps.onChange) {\n inputProps.onChange(evt)\n }\n\n if (type === 'number') {\n const currentValue = parseFloat(evt.currentTarget.value)\n\n const minValueReached = currentValue <= parseFloat(evt.currentTarget.min)\n const maxValueReached = currentValue >= parseFloat(evt.currentTarget.max)\n\n setMinusDisabled(minValueReached)\n setPlusDisabled(maxValueReached)\n\n if (minValueReached || maxValueReached) {\n evt.currentTarget.focus()\n }\n }\n }}\n />\n }\n addon={\n (addonButtonProps.onClick || additionalControlButtonProps.onClick) && addonControlIcon ? (\n <IconButton\n ref={addonRef}\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n {...sizeProps}\n {...additionalControlButtonProps}\n {...addonButtonProps}\n icon={addonControlIcon}\n disabled={disabled || addonButtonProps.disabled || additionalControlButtonProps.disabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n if (addonButtonProps.onClick) addonButtonProps.onClick(evt)\n if (additionalControlButtonProps.onClick) additionalControlButtonProps.onClick(evt)\n }}\n />\n ) : undefined\n }\n controls={\n type === 'number' ? (\n <>\n <IconButton\n {...sizeProps}\n ref={minusRef}\n icon='minus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || minusDisabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepDown()\n\n const decremented = ref.current.value\n if (prev !== decremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err)\n }\n }}\n />\n <Styled.IconButtonSeparated\n {...sizeProps}\n ref={plusRef}\n icon='plus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || plusDisabled}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepUp()\n\n const incremented = ref.current.value\n if (prev !== incremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(err)\n }\n }}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n sizes: SIZES,\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Phone: InputPhone,\n }\n)\n\nexport { Input, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Input","Object","assign","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rounded","primary","color","placeholderColor","width","defaultInputControlsWidth","type","labelPosition","iconProps","controls","addonButtonProps","preset","className","style","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","palette","widthXXS","widthXS","widthS","widthM","widthL","widthXL","error","success","label","icon","text","secondary","contrast","onColored","fluid","disabled","inline","inputRef","inputProps","sizeProps","additionalControlIcon","buttonProps","additionalControlButtonProps","additional","iconBefore","iconAfter","onClick","undefined","Array","isArray","addonControlIcon","inputAlwaysActive","Boolean","mask","alwaysShowMask","controlPalette","controlsColor","colorHover","controlsColorHover","colorActive","controlsColorActive","colorDisabled","controlsColorDisabled","backgroundColor","controlsBackgroundColor","backgroundColorHover","controlsBackgroundColorHover","backgroundColorActive","controlsBackgroundColorActive","backgroundColorDisabled","controlsBackgroundColorDisabled","ref","useRef","useImperativeHandle","current","addonRef","minusRef","plusRef","inputLabelId","useMemo","nanoid","inputActive","setInputActive","useState","initValue","value","defaultValue","length","minusDisabled","setMinusDisabled","min","Infinity","parseFloat","initDefaultValue","minValue","Math","plusDisabled","setPlusDisabled","max","maxValue","useLayoutEffect","document","activeElement","_jsx","Styled","input","FormInputLabel","labelId","active","borderColor","borderColorDisabled","SIZES_ICON","focus","onFocus","evt","target","currentTarget","onPointerDown","Node","contains","preventDefault","onBlur","relatedTarget","FormInput","inputColor","inputPlaceholderColor","inputColorDisabled","placeholderColorDisabled","inputPlaceholderColorDisabled","onChange","currentValue","minValueReached","maxValueReached","addon","IconButton","SIZES_CONTROL","stopPropagation","readOnly","_jsxs","_Fragment","children","prev","stepDown","event","Event","bubbles","dispatchEvent","err","console","stepUp","SIZES","displayName","Phone","InputPhone"],"mappings":"ooBAYMA,MAAAA,eAAiB,QAYvB,MAAMC,MAAoFC,OAAOC,OAC/FC,gBACEC,YAAW,CAACC,EAAOC,KACjB,MAAMC,EAAQC,WAEd,MAAMC,KACJA,EAAO,IAA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AAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQoE,WAGRD,IADgBtE,GAAIG,QAAQW,MACN,CACxB,MAAM0D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C1E,GAAIG,QAAQwE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GAEPC,QAAQ1H,MAAMyH,EAChB,KAGJ5C,IAACC,oBAA0B,IACrBjE,GACJgC,IAAKM,GACLhD,KAAK,OACL9C,MAAOwJ,cACPpH,QAASoC,GACTpB,SAAUA,IAAY6D,GACtBlD,QAAUoE,IAER,GADAA,EAAIsB,mBACAlG,GAAWmG,SAEf,IACE,GAAIlE,GAAIG,QAAS,CACfQ,IAAe,GAEf,MAAM2D,EAAOtE,GAAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQ2E,SAGRR,IADgBtE,GAAIG,QAAQW,MACN,CACxB,MAAM0D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C1E,GAAIG,QAAQwE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GAEPC,QAAQ1H,MAAMyH,EAChB,aAIJpG,GAEN,IAGN,CACEhE,MAAOuK,MACPC,YAtbiB,UAybrB,CACEC,MAAOC"}
|
|
1
|
+
{"version":3,"file":"Input.mjs","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import { forwardRef, useState, useImperativeHandle, useRef, useLayoutEffect, useMemo } from 'react'\nimport { useTheme } from 'styled-components'\nimport { nanoid } from 'nanoid'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { FormInputLabel, SIZES } from 'components/FormInputLabel'\nimport { FormInput } from 'components/FormInput'\nimport { InputPhone } from 'components/Input.Phone'\nimport { IconButton } from 'components/IconButton'\nimport { SIZES_ICON, SIZES_CONTROL } from './constants'\nimport * as Styled from './style'\nimport type { InputProps } from './types'\n\nconst COMPONENT_NAME = 'Input'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Поддерживаются пропсы определения размеров и внешних отступов в зависимости от ширины вьюпорта.\n *\n * Можно передать \"ref\", который будет ассоциирован с \\<input\\>.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/Input/types.ts).\n */\nconst Input: React.ForwardRefExoticComponent<InputProps> & { Phone: typeof InputPhone } = Object.assign(\n withMergedProps<InputProps, HTMLInputElement>(\n forwardRef<HTMLInputElement, MergedProps<InputProps>>((props, forwardedRef) => {\n const theme = useTheme()\n\n const {\n size = 'm',\n rounded = true,\n primary = true,\n color = 'mineShaft',\n placeholderColor = 'silver',\n width = theme.defaultInputControlsWidth,\n type = 'text',\n labelPosition = 'dynamic',\n iconProps = {},\n controls = {},\n addonButtonProps = {},\n preset,\n className,\n style,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizeUnits,\n sizes,\n margin,\n marginXXS,\n marginXS,\n marginS,\n marginM,\n marginL,\n marginXL,\n marginTop,\n marginTopXXS,\n marginTopXS,\n marginTopS,\n marginTopM,\n marginTopL,\n marginTopXL,\n marginRight,\n marginRightXXS,\n marginRightXS,\n marginRightS,\n marginRightM,\n marginRightL,\n marginRightXL,\n marginBottom,\n marginBottomXXS,\n marginBottomXS,\n marginBottomS,\n marginBottomM,\n marginBottomL,\n marginBottomXL,\n marginLeft,\n marginLeftXXS,\n marginLeftXS,\n marginLeftS,\n marginLeftM,\n marginLeftL,\n marginLeftXL,\n palette,\n widthXXS,\n widthXS,\n widthS,\n widthM,\n widthL,\n widthXL,\n error,\n success,\n label,\n icon,\n text,\n secondary,\n contrast,\n onColored,\n fluid,\n disabled,\n inline,\n inputRef,\n ...inputProps\n } = props\n\n const sizeProps = {\n size,\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n }\n\n const { icon: additionalControlIcon, buttonProps: additionalControlButtonProps = {} } = controls.additional ?? {}\n\n const [iconBefore, iconAfter = !additionalControlButtonProps.onClick ? additionalControlIcon : undefined] =\n Array.isArray(icon) ? icon : [icon]\n\n const addonControlIcon = addonButtonProps.icon ?? additionalControlIcon\n\n const inputAlwaysActive = Boolean(inputProps.mask && inputProps.alwaysShowMask)\n\n const controlPalette = {\n color: palette.controlsColor,\n colorHover: palette.controlsColorHover,\n colorActive: palette.controlsColorActive,\n colorDisabled: palette.controlsColorDisabled,\n backgroundColor: palette.controlsBackgroundColor,\n backgroundColorHover: palette.controlsBackgroundColorHover,\n backgroundColorActive: palette.controlsBackgroundColorActive,\n backgroundColorDisabled: palette.controlsBackgroundColorDisabled,\n }\n\n const ref = useRef<HTMLInputElement | null>(null)\n useImperativeHandle<HTMLInputElement | null, HTMLInputElement | null>(forwardedRef, () => ref.current, [])\n\n const addonRef = useRef<HTMLButtonElement | null>(null)\n const minusRef = useRef<HTMLButtonElement | null>(null)\n const plusRef = useRef<HTMLButtonElement | null>(null)\n\n const inputLabelId = useMemo(() => nanoid(), [])\n\n const [inputActive, setInputActive] = useState(() => {\n if (inputAlwaysActive) return true\n\n const initValue = inputProps.value ?? inputProps.defaultValue\n\n return (typeof initValue === 'string' && initValue.length > 0) || typeof initValue === 'number'\n })\n\n const [minusDisabled, setMinusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.min === undefined) return false\n\n const { value = Infinity, defaultValue = Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const minValue = typeof inputProps.min === 'number' ? inputProps.min : parseFloat(inputProps.min)\n\n return Math.min(initValue, initDefaultValue) <= minValue\n })\n\n const [plusDisabled, setPlusDisabled] = useState(() => {\n if (type !== 'number' || inputProps.max === undefined) return false\n\n const { value = -Infinity, defaultValue = -Infinity } = inputProps\n\n const initValue = typeof value === 'number' ? value : parseFloat(value)\n const initDefaultValue = typeof defaultValue === 'number' ? defaultValue : parseFloat(defaultValue)\n const maxValue = typeof inputProps.max === 'number' ? inputProps.max : parseFloat(inputProps.max)\n\n return Math.max(initValue, initDefaultValue) >= maxValue\n })\n\n useLayoutEffect(() => {\n if (inputAlwaysActive) {\n setInputActive(true)\n } else if (\n inputProps.value !== undefined &&\n inputProps.value !== null &&\n ref.current &&\n ref.current !== document.activeElement\n ) {\n setInputActive(\n (typeof inputProps.value === 'string' && inputProps.value.length > 0) ||\n typeof inputProps.value === 'number'\n )\n }\n }, [inputAlwaysActive, inputProps.value])\n\n if (preset !== 'brand') {\n return (\n <Styled.Root\n {...inputProps}\n inputRef={\n inputRef ??\n ((input) => {\n ref.current = input\n })\n }\n className={className}\n style={style}\n size={typeof size === 'number' ? size : undefined}\n rounded={rounded}\n color={color}\n placeholderColor={placeholderColor}\n width={width}\n widthXXS={widthXXS}\n widthXS={widthXS}\n widthS={widthS}\n widthM={widthM}\n widthL={widthL}\n widthXL={widthXL}\n error={error}\n type={type}\n fluid={fluid}\n disabled={disabled}\n />\n )\n }\n\n return (\n <FormInputLabel\n {...sizeProps}\n className={className}\n style={style}\n sizeUnits={sizeUnits}\n sizes={sizes}\n margin={margin}\n marginXXS={marginXXS}\n marginXS={marginXS}\n marginS={marginS}\n marginM={marginM}\n marginL={marginL}\n marginXL={marginXL}\n marginTop={marginTop}\n marginTopXXS={marginTopXXS}\n marginTopXS={marginTopXS}\n marginTopS={marginTopS}\n marginTopM={marginTopM}\n marginTopL={marginTopL}\n marginTopXL={marginTopXL}\n marginRight={marginRight}\n marginRightXXS={marginRightXXS}\n marginRightXS={marginRightXS}\n marginRightS={marginRightS}\n marginRightM={marginRightM}\n marginRightL={marginRightL}\n marginRightXL={marginRightXL}\n marginBottom={marginBottom}\n marginBottomXXS={marginBottomXXS}\n marginBottomXS={marginBottomXS}\n marginBottomS={marginBottomS}\n marginBottomM={marginBottomM}\n marginBottomL={marginBottomL}\n marginBottomXL={marginBottomXL}\n marginLeft={marginLeft}\n marginLeftXXS={marginLeftXXS}\n marginLeftXS={marginLeftXS}\n marginLeftS={marginLeftS}\n marginLeftM={marginLeftM}\n marginLeftL={marginLeftL}\n marginLeftXL={marginLeftXL}\n error={error}\n success={success}\n label={label}\n labelId={inputLabelId}\n labelPosition={labelPosition}\n icon={[iconBefore, iconAfter]}\n text={text}\n primary={primary}\n secondary={secondary}\n contrast={contrast}\n onColored={onColored}\n disabled={disabled}\n inline={inline}\n active={inputActive}\n palette={{\n color: disabled ? palette.colorDisabled : palette.color,\n backgroundColor: disabled ? palette.backgroundColorDisabled : palette.backgroundColor,\n backgroundColorHover: disabled ? palette.backgroundColorDisabled : palette.backgroundColorHover,\n borderColor: disabled ? palette.borderColorDisabled : palette.borderColor,\n }}\n iconProps={{\n color: disabled ? 'content-disabled' : 'content-onmain-tertiary',\n sizes: SIZES_ICON,\n ...sizeProps,\n ...iconProps,\n }}\n onClick={() => {\n if (ref.current) {\n ref.current.focus()\n }\n }}\n onFocus={(evt) => {\n if (evt.target !== evt.currentTarget) {\n setInputActive(true)\n }\n }}\n onPointerDown={(evt) => {\n if (\n evt.target === ref.current ||\n !(evt.target instanceof Node) ||\n addonRef.current?.contains(evt.target) ||\n minusRef.current?.contains(evt.target) ||\n plusRef.current?.contains(evt.target)\n ) {\n return\n }\n evt.preventDefault()\n }}\n onBlur={(evt) => {\n if (!inputAlwaysActive && ref.current && !evt.currentTarget.contains(evt.relatedTarget)) {\n setInputActive(Boolean(ref.current.value))\n }\n }}\n input={\n <FormInput\n {...inputProps}\n aria-labelledby={label ? inputLabelId : undefined}\n ref={ref}\n type={type}\n disabled={disabled}\n palette={{\n color: palette.inputColor,\n placeholderColor: palette.inputPlaceholderColor,\n colorDisabled: palette.inputColorDisabled,\n placeholderColorDisabled: palette.inputPlaceholderColorDisabled,\n }}\n onChange={(evt) => {\n if (inputProps.onChange) {\n inputProps.onChange(evt)\n }\n\n if (type === 'number') {\n const currentValue = parseFloat(evt.currentTarget.value)\n\n const minValueReached = currentValue <= parseFloat(evt.currentTarget.min)\n const maxValueReached = currentValue >= parseFloat(evt.currentTarget.max)\n\n setMinusDisabled(minValueReached)\n setPlusDisabled(maxValueReached)\n\n if (minValueReached || maxValueReached) {\n evt.currentTarget.focus()\n }\n }\n }}\n />\n }\n addon={\n (addonButtonProps.onClick || additionalControlButtonProps.onClick) && addonControlIcon ? (\n <IconButton\n ref={addonRef}\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n {...sizeProps}\n {...additionalControlButtonProps}\n {...addonButtonProps}\n icon={addonControlIcon}\n disabled={disabled || addonButtonProps.disabled || additionalControlButtonProps.disabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n if (addonButtonProps.onClick) addonButtonProps.onClick(evt)\n if (additionalControlButtonProps.onClick) additionalControlButtonProps.onClick(evt)\n }}\n />\n ) : undefined\n }\n controls={\n type === 'number' ? (\n <>\n <IconButton\n {...sizeProps}\n ref={minusRef}\n icon='minus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || minusDisabled}\n marginLeft={12}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepDown()\n\n const decremented = ref.current.value\n if (prev !== decremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n console.error(err)\n }\n }}\n />\n <Styled.IconButtonSeparated\n {...sizeProps}\n ref={plusRef}\n icon='plus'\n sizes={SIZES_CONTROL}\n palette={controlPalette}\n disabled={disabled || plusDisabled}\n onClick={(evt) => {\n evt.stopPropagation()\n if (inputProps.readOnly) return\n\n try {\n if (ref.current) {\n setInputActive(true)\n\n const prev = ref.current.value\n ref.current.stepUp()\n\n const incremented = ref.current.value\n if (prev !== incremented) {\n const event = new Event('input', { bubbles: true })\n ref.current.dispatchEvent(event)\n }\n }\n } catch (err) {\n console.error(err)\n }\n }}\n />\n </>\n ) : undefined\n }\n />\n )\n }),\n {\n sizes: SIZES,\n displayName: COMPONENT_NAME,\n }\n ),\n {\n Phone: InputPhone,\n }\n)\n\nexport { Input, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","Input","Object","assign","withMergedProps","forwardRef","props","forwardedRef","theme","useTheme","size","rounded","primary","color","placeholderColor","width","defaultInputControlsWidth","type","labelPosition","iconProps","controls","addonButtonProps","preset","className","style","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizeUnits","sizes","margin","marginXXS","marginXS","marginS","marginM","marginL","marginXL","marginTop","marginTopXXS","marginTopXS","marginTopS","marginTopM","marginTopL","marginTopXL","marginRight","marginRightXXS","marginRightXS","marginRightS","marginRightM","marginRightL","marginRightXL","marginBottom","marginBottomXXS","marginBottomXS","marginBottomS","marginBottomM","marginBottomL","marginBottomXL","marginLeft","marginLeftXXS","marginLeftXS","marginLeftS","marginLeftM","marginLeftL","marginLeftXL","palette","widthXXS","widthXS","widthS","widthM","widthL","widthXL","error","success","label","icon","text","secondary","contrast","onColored","fluid","disabled","inline","inputRef","inputProps","sizeProps","additionalControlIcon","buttonProps","additionalControlButtonProps","additional","iconBefore","iconAfter","onClick","undefined","Array","isArray","addonControlIcon","inputAlwaysActive","Boolean","mask","alwaysShowMask","controlPalette","controlsColor","colorHover","controlsColorHover","colorActive","controlsColorActive","colorDisabled","controlsColorDisabled","backgroundColor","controlsBackgroundColor","backgroundColorHover","controlsBackgroundColorHover","backgroundColorActive","controlsBackgroundColorActive","backgroundColorDisabled","controlsBackgroundColorDisabled","ref","useRef","useImperativeHandle","current","addonRef","minusRef","plusRef","inputLabelId","useMemo","nanoid","inputActive","setInputActive","useState","initValue","value","defaultValue","length","minusDisabled","setMinusDisabled","min","Infinity","parseFloat","initDefaultValue","minValue","Math","plusDisabled","setPlusDisabled","max","maxValue","useLayoutEffect","document","activeElement","_jsx","Styled","input","FormInputLabel","labelId","active","borderColor","borderColorDisabled","SIZES_ICON","focus","onFocus","evt","target","currentTarget","onPointerDown","Node","contains","preventDefault","onBlur","relatedTarget","FormInput","inputColor","inputPlaceholderColor","inputColorDisabled","placeholderColorDisabled","inputPlaceholderColorDisabled","onChange","currentValue","minValueReached","maxValueReached","addon","IconButton","SIZES_CONTROL","stopPropagation","readOnly","_jsxs","_Fragment","children","prev","stepDown","event","Event","bubbles","dispatchEvent","err","console","stepUp","SIZES","displayName","Phone","InputPhone"],"mappings":"ooBAaMA,MAAAA,eAAiB,QAYvB,MAAMC,MAAoFC,OAAOC,OAC/FC,gBACEC,YAAsD,CAACC,EAAOC,KAC5D,MAAMC,EAAQC,WAEd,MAAMC,KACJA,EAAO,IAAGC,QACVA,GAAU,EAAIC,QACdA,GAAU,EAAIC,MACdA,EAAQ,YAAWC,iBACnBA,EAAmB,SAAQC,MAC3BA,EAAQP,EAAMQ,0BAAyBC,KACvCA,EAAO,OAAMC,cACbA,EAAgB,UAASC,UACzBA,EAAY,CAAE,EAAAC,SACdA,EAAW,CAAE,EAAAC,iBACbA,EAAmB,CAAE,EAAAC,OACrBA,EAAMC,UACNA,EAASC,MACTA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,MACNA,EAAKC,MACLA,EAAKC,MACLA,EAAKC,OACLA,EAAMC,UACNA,EAASC,MACTA,EAAKC,OACLA,EAAMC,UACNA,EAASC,SACTA,EAAQC,QACRA,EAAOC,QACPA,EAAOC,QACPA,EAAOC,SACPA,EAAQC,UACRA,EAASC,aACTA,EAAYC,YACZA,EAAWC,WACXA,EAAUC,WACVA,EAAUC,WACVA,EAAUC,YACVA,EAAWC,YACXA,EAAWC,eACXA,EAAcC,cACdA,EAAaC,aACbA,EAAYC,aACZA,EAAYC,aACZA,EAAYC,cACZA,EAAaC,aACbA,EAAYC,gBACZA,EAAeC,eACfA,EAAcC,cACdA,EAAaC,cACbA,EAAaC,cACbA,EAAaC,eACbA,EAAcC,WACdA,EAAUC,cACVA,GAAaC,aACbA,GAAYC,YACZA,GAAWC,YACXA,GAAWC,YACXA,GAAWC,aACXA,GAAYC,QACZA,GAAOC,SAC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AiB0E,QAAQoE,GACnDxE,GAA6BI,SAASJ,GAA6BI,QAAQoE,GAAI,SAGrFnE,EAEN5E,SACEH,IAAS,SACP0K,KAAAC,SAAA,CAAAC,SAAA,CACErC,IAAC+B,WAAU,IACL/F,GACJgC,IAAKK,GACL/C,KAAK,QACL9C,MAAOwJ,cACPpH,QAASoC,GACTpB,SAAUA,IAAYqD,GACtB5E,WAAY,GACZkC,QAAUoE,IAER,GADAA,EAAIsB,mBACAlG,GAAWmG,SAEf,IACE,GAAIlE,GAAIG,QAAS,CACfQ,IAAe,GAEf,MAAM2D,EAAOtE,GAAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQoE,WAGRD,IADgBtE,GAAIG,QAAQW,MACN,CACxB,MAAM0D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C1E,GAAIG,QAAQwE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GACPC,QAAQ1H,MAAMyH,EAChB,KAGJ5C,IAACC,oBAA0B,IACrBjE,GACJgC,IAAKM,GACLhD,KAAK,OACL9C,MAAOwJ,cACPpH,QAASoC,GACTpB,SAAUA,IAAY6D,GACtBlD,QAAUoE,IAER,GADAA,EAAIsB,mBACAlG,GAAWmG,SAEf,IACE,GAAIlE,GAAIG,QAAS,CACfQ,IAAe,GAEf,MAAM2D,EAAOtE,GAAIG,QAAQW,MAIzB,GAHAd,GAAIG,QAAQ2E,SAGRR,IADgBtE,GAAIG,QAAQW,MACN,CACxB,MAAM0D,EAAQ,IAAIC,MAAM,QAAS,CAAEC,SAAS,IAC5C1E,GAAIG,QAAQwE,cAAcH,EAC5B,CACF,CACD,CAAC,MAAOI,GACPC,QAAQ1H,MAAMyH,EAChB,aAIJpG,GAEN,IAGN,CACEhE,MAAOuK,MACPC,YApbiB,UAubrB,CACEC,MAAOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../src/components/Input/helpers.ts"],"sourcesContent":["import { PossibleValues } from 'mixins/responsive-property'\nimport { SizeInput } from 'shared/enums/sizeInput'\n\nexport const chooseWidthValue = (width: PossibleValues): PossibleValues => {\n if (width === 'auto') return 'auto'\n if (typeof width === 'number') return width\n if (typeof width === 'boolean') return width\n\n if (width && SizeInput[width]) return SizeInput[width]\n\n return 'auto'\n}\n"],"names":["width","SizeInput"],"mappings":"+FAGiCA,GAC3BA,IAAU,OAAe,cAClBA,GAAU,iBACVA,GAAU,UADiBA,EAGlCA,GAASC,
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../src/components/Input/helpers.ts"],"sourcesContent":["import type { PossibleValues } from 'mixins/responsive-property'\nimport { SizeInput } from 'shared/enums/sizeInput'\n\nexport const chooseWidthValue = (width: PossibleValues): PossibleValues => {\n if (width === 'auto') return 'auto'\n if (typeof width === 'number') return width\n if (typeof width === 'boolean') return width\n\n if (width && SizeInput[width as keyof typeof SizeInput]) {\n return SizeInput[width as keyof typeof SizeInput]\n }\n\n return 'auto'\n}\n"],"names":["width","SizeInput"],"mappings":"+FAGiCA,GAC3BA,IAAU,OAAe,cAClBA,GAAU,iBACVA,GAAU,UADiBA,EAGlCA,GAASC,oBAAUD,GACdC,UAAAA,UAAUD,GAGZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","sources":["../../../../src/components/Input/helpers.ts"],"sourcesContent":["import { PossibleValues } from 'mixins/responsive-property'\nimport { SizeInput } from 'shared/enums/sizeInput'\n\nexport const chooseWidthValue = (width: PossibleValues): PossibleValues => {\n if (width === 'auto') return 'auto'\n if (typeof width === 'number') return width\n if (typeof width === 'boolean') return width\n\n if (width && SizeInput[width]) return SizeInput[width]\n\n return 'auto'\n}\n"],"names":["chooseWidthValue","width","SizeInput"],"mappings":"wDAGaA,MAAAA,iBAAoBC,GAC3BA,IAAU,OAAe,cAClBA,GAAU,iBACVA,GAAU,UADiBA,EAGlCA,GAASC,UAAUD,
|
|
1
|
+
{"version":3,"file":"helpers.mjs","sources":["../../../../src/components/Input/helpers.ts"],"sourcesContent":["import type { PossibleValues } from 'mixins/responsive-property'\nimport { SizeInput } from 'shared/enums/sizeInput'\n\nexport const chooseWidthValue = (width: PossibleValues): PossibleValues => {\n if (width === 'auto') return 'auto'\n if (typeof width === 'number') return width\n if (typeof width === 'boolean') return width\n\n if (width && SizeInput[width as keyof typeof SizeInput]) {\n return SizeInput[width as keyof typeof SizeInput]\n }\n\n return 'auto'\n}\n"],"names":["chooseWidthValue","width","SizeInput"],"mappings":"wDAGaA,MAAAA,iBAAoBC,GAC3BA,IAAU,OAAe,cAClBA,GAAU,iBACVA,GAAU,UADiBA,EAGlCA,GAASC,UAAUD,GACdC,UAAUD,GAGZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.Phone.js","sources":["../../../../src/components/Input.Phone/Input.Phone.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Input.Phone.js","sources":["../../../../src/components/Input.Phone/Input.Phone.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport type { InputMaskState } from 'shared/interfaces'\nimport { Input } from '../Input/Input'\nimport type { InputProps } from '../Input'\nimport {\n COUNTRY_DATA,\n DEFAULT_MASK,\n INITIAL_MASK,\n REGEXPS,\n RUSSIAN_PHONE_WITHOUT_COUNTY_CODE_LENGTH,\n} from './constants'\n\nconst onlyNumbers = (value = ''): string => value.replace(REGEXPS.NOT_NUMBERS, '')\n\nexport interface InputPhoneProps extends InputProps {\n /**\n * Settings for different country codes\n */\n countryData?: string[][]\n /**\n * Default field mask that is set when none of the countryData prop matches\n */\n defaultMask?: string\n /**\n * The default field mask when the phone field is empty is required to enable autocomplete in\n * the browser\n */\n initialMask?: string\n /** If event should return stripped phone value (not for redux forms) */\n stripValue?: boolean\n}\n\ninterface InputPhoneState {\n mask: string\n regexp?: RegExp | null\n}\n\n/**\n * Расширен:\n * - `InputProps`\n */\nexport class InputPhone extends PureComponent<typeof InputPhone.defaultProps & InputPhoneProps, InputPhoneState> {\n static displayName = 'Input.Phone'\n static defaultProps = {\n countryData: COUNTRY_DATA,\n defaultMask: DEFAULT_MASK,\n initialMask: INITIAL_MASK,\n placeholder: '+9 (999) 999-99-99',\n rounded: true,\n type: 'text',\n color: 'mineShaft',\n mask: '',\n placeholderColor: 'silver',\n }\n\n autocorrectOf8: boolean\n autocorrectOf9: boolean\n\n constructor(props: typeof InputPhone.defaultProps & InputPhoneProps) {\n super(props)\n\n this.autocorrectOf8 = true\n this.autocorrectOf9 = true\n\n const { mask } = this.getUpdates(props.value || '')\n\n this.state = { mask, regexp: null }\n }\n\n componentDidUpdate(nextProps: InputPhoneProps) {\n const { value } = this.props\n\n if (value !== nextProps.value) {\n this.change(value)\n }\n }\n\n getUpdates = (\n value: InputPhoneProps['value'],\n prevValue: InputPhoneProps['value'] = undefined\n ): {\n mask: string\n numbers: string\n startsFrom8: boolean\n startsFrom9: boolean\n regexp: RegExp | null\n } => {\n const { countryData, defaultMask, initialMask } = this.props\n const numbers = onlyNumbers(value as string)\n\n let mask = initialMask\n let regexp = null\n let startsFrom8 = false\n let startsFrom9 = false\n\n if (!numbers)\n return {\n mask,\n numbers,\n startsFrom8,\n startsFrom9,\n regexp,\n }\n\n let isRussian = false\n\n for (let i = 0; i < countryData.length; i++) {\n if (numbers.startsWith(countryData[i][1])) {\n ;[, , mask, regexp] = countryData[i]\n isRussian = i === 0 || i === 1\n }\n }\n\n startsFrom8 = isRussian && REGEXPS.FROM_8.test(numbers) && this.autocorrectOf8\n startsFrom9 =\n (!mask || (numbers.length === RUSSIAN_PHONE_WITHOUT_COUNTY_CODE_LENGTH && prevValue === '')) &&\n this.autocorrectOf9 &&\n REGEXPS.FROM_9.test(numbers)\n\n if (startsFrom8) {\n // RUSSIAN_MASK\n mask = COUNTRY_DATA[0][2]\n\n this.autocorrectOf8 = false\n }\n\n if (startsFrom9) {\n // RUSSIAN_MASK\n mask = COUNTRY_DATA[0][2]\n\n this.autocorrectOf9 = false\n }\n\n if (!mask) {\n mask = defaultMask\n }\n\n return {\n mask,\n numbers,\n startsFrom8,\n startsFrom9,\n regexp,\n }\n }\n\n change = (phone: InputPhoneProps['value']) => {\n const { mask } = this.getUpdates(phone)\n\n this.setState({ mask })\n }\n\n handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n e.persist()\n\n const { onChange, stripValue } = this.props\n\n if (onChange) {\n const _e = e\n if (stripValue) _e.target.value = onlyNumbers(e.target.value)\n onChange(_e)\n }\n }\n\n beforeMaskedValueChange = (newState: InputMaskState, oldState: InputMaskState) => {\n const { mask, numbers, startsFrom8, startsFrom9, regexp } = this.getUpdates(newState.value, oldState.value)\n\n this.setState({ mask, regexp })\n\n /**\n * For the correct caret position, when the user enters 9 in the phone field and it's replaced\n * by '+7 (9'\n */\n if (startsFrom9) {\n return {\n selection: numbers.length === 1 ? { start: 5, end: 5 } : newState.selection,\n value: newState.value.replace(REGEXPS.FROM_9, '+79$1'),\n }\n }\n\n if (startsFrom8) {\n return { selection: { start: 2, end: 2 }, value: newState.value.replace(REGEXPS.FROM_8, '+7$1') }\n }\n\n if (REGEXPS.FILLED.test(oldState.value) && numbers.length === 1) {\n return { selection: { start: 2, end: 2 }, value: newState.value }\n }\n\n if (!REGEXPS.FILLED.test(oldState.value) && REGEXPS.FILLED.test(newState.value)) {\n return {\n ...newState,\n selection: newState.selection ? { start: newState.selection.start + 1, end: newState.selection.end + 1 } : null,\n }\n }\n\n return newState\n }\n\n render() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { countryData, defaultMask, initialMask, stripValue, ...props } = this.props\n const { mask, regexp } = this.state\n\n return (\n <Input\n {...props}\n beforeMaskedValueChange={this.beforeMaskedValueChange}\n mask={mask}\n data-regexp={regexp instanceof RegExp ? regexp.toString() : undefined}\n onChange={this.handleChange}\n />\n )\n }\n}\n"],"names":["onlyNumbers","value","replace","REGEXPS","NOT_NUMBERS","InputPhone","PureComponent","static","countryData","COUNTRY_DATA","defaultMask","DEFAULT_MASK","initialMask","INITIAL_MASK","placeholder","rounded","type","color","mask","placeholderColor","constructor","props","super","this","autocorrectOf8","autocorrectOf9","getUpdates","state","regexp","componentDidUpdate","nextProps","change","prevValue","numbers","startsFrom8","startsFrom9","isRussian","i","length","startsWith","FROM_8","test","RUSSIAN_PHONE_WITHOUT_COUNTY_CODE_LENGTH","FROM_9","phone","setState","handleChange","e","persist","onChange","stripValue","_e","target","beforeMaskedValueChange","newState","oldState","selection","start","end","FILLED","render","_jsx","Input","RegExp","toString","undefined"],"mappings":"mKAYA,MAAMA,YAAcA,CAACC,EAAQ,KAAeA,EAAMC,QAAQC,UAAOA,QAACC,YAAa,uBA6BxE,MAAMC,mBAAmBC,MAAAA,cAC9BC,mBAAqB,cACrBA,oBAAsB,CACpBC,YAAaC,UAAYA,aACzBC,YAAaC,UAAYA,aACzBC,YAAaC,UAAYA,aACzBC,YAAa,qBACbC,SAAS,EACTC,KAAM,OACNC,MAAO,YACPC,KAAM,GACNC,iBAAkB,UAMpBC,WAAAA,CAAYC,GACVC,MAAMD,GAENE,KAAKC,gBAAiB,EACtBD,KAAKE,gBAAiB,EAEtB,MAAMP,KAAEA,GAASK,KAAKG,WAAWL,EAAMpB,OAAS,IAEhDsB,KAAKI,MAAQ,CAAET,OAAMU,OAAQ,KAC/B,CAEAC,kBAAAA,CAAmBC,GACjB,MAAM7B,MAAEA,GAAUsB,KAAKF,MAEnBpB,IAAU6B,EAAU7B,OACtBsB,KAAKQ,OAAO9B,EAEhB,CAEAyB,WAAaA,CACXzB,EACA+B,KAQA,MAAMxB,YAAEA,EAAWE,YAAEA,EAAWE,YAAEA,GAAgBW,KAAKF,MACvD,MAAMY,EAAUjC,YAAYC,GAE5B,IAAIiB,EAAON,EACX,IAAIgB,EAAS,KACb,IAAIM,GAAc,EAClB,IAAIC,GAAc,EAElB,IAAKF,EACH,MAAO,CACLf,OACAe,UACAC,cACAC,cACAP,UAGJ,IAAIQ,GAAY,EAEhB,IAAK,IAAIC,EAAI,EAAGA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AAKzD,MAAOqD,EAASrD,MAAMC,QAAQC,UAAOA,QAACqC,OAAQ,SAGtFrC,UAAOA,QAACwD,OAAOlB,KAAKc,EAAStD,QAAUgC,EAAQK,SAAW,EACrD,CAAEkB,UAAW,CAAEC,MAAO,EAAGC,IAAK,GAAKzD,MAAOqD,EAASrD,QAGvDE,UAAOA,QAACwD,OAAOlB,KAAKc,EAAStD,QAAUE,UAAAA,QAAQwD,OAAOlB,KAAKa,EAASrD,OAChE,IACFqD,EACHE,UAAWF,EAASE,UAAY,CAAEC,MAAOH,EAASE,UAAUC,MAAQ,EAAGC,IAAKJ,EAASE,UAAUE,IAAM,GAAM,MAIxGJ,CAAQ,EAGjBM,MAAAA,GAEE,MAAMpD,YAAEA,EAAWE,YAAEA,EAAWE,YAAEA,EAAWsC,WAAEA,KAAe7B,GAAUE,KAAKF,MAC7E,MAAMH,KAAEA,EAAIU,OAAEA,GAAWL,KAAKI,MAE9B,OACEkC,WAAAA,IAACC,MAAAA,MAAK,IACAzC,EACJgC,wBAAyB9B,KAAK8B,wBAC9BnC,KAAMA,EACN,cAAaU,aAAkBmC,OAASnC,EAAOoC,gBAAaC,EAC5DhB,SAAU1B,KAAKuB,cAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.Phone.mjs","sources":["../../../../src/components/Input.Phone/Input.Phone.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"Input.Phone.mjs","sources":["../../../../src/components/Input.Phone/Input.Phone.tsx"],"sourcesContent":["import { PureComponent } from 'react'\nimport type { InputMaskState } from 'shared/interfaces'\nimport { Input } from '../Input/Input'\nimport type { InputProps } from '../Input'\nimport {\n COUNTRY_DATA,\n DEFAULT_MASK,\n INITIAL_MASK,\n REGEXPS,\n RUSSIAN_PHONE_WITHOUT_COUNTY_CODE_LENGTH,\n} from './constants'\n\nconst onlyNumbers = (value = ''): string => value.replace(REGEXPS.NOT_NUMBERS, '')\n\nexport interface InputPhoneProps extends InputProps {\n /**\n * Settings for different country codes\n */\n countryData?: string[][]\n /**\n * Default field mask that is set when none of the countryData prop matches\n */\n defaultMask?: string\n /**\n * The default field mask when the phone field is empty is required to enable autocomplete in\n * the browser\n */\n initialMask?: string\n /** If event should return stripped phone value (not for redux forms) */\n stripValue?: boolean\n}\n\ninterface InputPhoneState {\n mask: string\n regexp?: RegExp | null\n}\n\n/**\n * Расширен:\n * - `InputProps`\n */\nexport class InputPhone extends PureComponent<typeof InputPhone.defaultProps & InputPhoneProps, InputPhoneState> {\n static displayName = 'Input.Phone'\n static defaultProps = {\n countryData: COUNTRY_DATA,\n defaultMask: DEFAULT_MASK,\n initialMask: INITIAL_MASK,\n placeholder: '+9 (999) 999-99-99',\n rounded: true,\n type: 'text',\n color: 'mineShaft',\n mask: '',\n placeholderColor: 'silver',\n }\n\n autocorrectOf8: boolean\n autocorrectOf9: boolean\n\n constructor(props: typeof InputPhone.defaultProps & InputPhoneProps) {\n super(props)\n\n this.autocorrectOf8 = true\n this.autocorrectOf9 = true\n\n const { mask } = this.getUpdates(props.value || '')\n\n this.state = { mask, regexp: null }\n }\n\n componentDidUpdate(nextProps: InputPhoneProps) {\n const { value } = this.props\n\n if (value !== nextProps.value) {\n this.change(value)\n }\n }\n\n getUpdates = (\n value: InputPhoneProps['value'],\n prevValue: InputPhoneProps['value'] = undefined\n ): {\n mask: string\n numbers: string\n startsFrom8: boolean\n startsFrom9: boolean\n regexp: RegExp | null\n } => {\n const { countryData, defaultMask, initialMask } = this.props\n const numbers = onlyNumbers(value as string)\n\n let mask = initialMask\n let regexp = null\n let startsFrom8 = false\n let startsFrom9 = false\n\n if (!numbers)\n return {\n mask,\n numbers,\n startsFrom8,\n startsFrom9,\n regexp,\n }\n\n let isRussian = false\n\n for (let i = 0; i < countryData.length; i++) {\n if (numbers.startsWith(countryData[i][1])) {\n ;[, , mask, regexp] = countryData[i]\n isRussian = i === 0 || i === 1\n }\n }\n\n startsFrom8 = isRussian && REGEXPS.FROM_8.test(numbers) && this.autocorrectOf8\n startsFrom9 =\n (!mask || (numbers.length === RUSSIAN_PHONE_WITHOUT_COUNTY_CODE_LENGTH && prevValue === '')) &&\n this.autocorrectOf9 &&\n REGEXPS.FROM_9.test(numbers)\n\n if (startsFrom8) {\n // RUSSIAN_MASK\n mask = COUNTRY_DATA[0][2]\n\n this.autocorrectOf8 = false\n }\n\n if (startsFrom9) {\n // RUSSIAN_MASK\n mask = COUNTRY_DATA[0][2]\n\n this.autocorrectOf9 = false\n }\n\n if (!mask) {\n mask = defaultMask\n }\n\n return {\n mask,\n numbers,\n startsFrom8,\n startsFrom9,\n regexp,\n }\n }\n\n change = (phone: InputPhoneProps['value']) => {\n const { mask } = this.getUpdates(phone)\n\n this.setState({ mask })\n }\n\n handleChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {\n e.persist()\n\n const { onChange, stripValue } = this.props\n\n if (onChange) {\n const _e = e\n if (stripValue) _e.target.value = onlyNumbers(e.target.value)\n onChange(_e)\n }\n }\n\n beforeMaskedValueChange = (newState: InputMaskState, oldState: InputMaskState) => {\n const { mask, numbers, startsFrom8, startsFrom9, regexp } = this.getUpdates(newState.value, oldState.value)\n\n this.setState({ mask, regexp })\n\n /**\n * For the correct caret position, when the user enters 9 in the phone field and it's replaced\n * by '+7 (9'\n */\n if (startsFrom9) {\n return {\n selection: numbers.length === 1 ? { start: 5, end: 5 } : newState.selection,\n value: newState.value.replace(REGEXPS.FROM_9, '+79$1'),\n }\n }\n\n if (startsFrom8) {\n return { selection: { start: 2, end: 2 }, value: newState.value.replace(REGEXPS.FROM_8, '+7$1') }\n }\n\n if (REGEXPS.FILLED.test(oldState.value) && numbers.length === 1) {\n return { selection: { start: 2, end: 2 }, value: newState.value }\n }\n\n if (!REGEXPS.FILLED.test(oldState.value) && REGEXPS.FILLED.test(newState.value)) {\n return {\n ...newState,\n selection: newState.selection ? { start: newState.selection.start + 1, end: newState.selection.end + 1 } : null,\n }\n }\n\n return newState\n }\n\n render() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { countryData, defaultMask, initialMask, stripValue, ...props } = this.props\n const { mask, regexp } = this.state\n\n return (\n <Input\n {...props}\n beforeMaskedValueChange={this.beforeMaskedValueChange}\n mask={mask}\n data-regexp={regexp instanceof RegExp ? regexp.toString() : undefined}\n onChange={this.handleChange}\n />\n )\n }\n}\n"],"names":["onlyNumbers","value","replace","REGEXPS","NOT_NUMBERS","InputPhone","PureComponent","static","countryData","COUNTRY_DATA","defaultMask","DEFAULT_MASK","initialMask","INITIAL_MASK","placeholder","rounded","type","color","mask","placeholderColor","constructor","props","super","this","autocorrectOf8","autocorrectOf9","getUpdates","state","regexp","componentDidUpdate","nextProps","change","prevValue","numbers","startsFrom8","startsFrom9","isRussian","i","length","startsWith","FROM_8","test","RUSSIAN_PHONE_WITHOUT_COUNTY_CODE_LENGTH","FROM_9","phone","setState","handleChange","e","persist","onChange","stripValue","_e","target","beforeMaskedValueChange","newState","oldState","selection","start","end","FILLED","render","_jsx","Input","RegExp","toString","undefined"],"mappings":"+NAYA,MAAMA,YAAcA,CAACC,EAAQ,KAAeA,EAAMC,QAAQC,QAAQC,YAAa,IA6BxE,MAAMC,mBAAmBC,cAC9BC,mBAAqB,cACrBA,oBAAsB,CACpBC,YAAaC,aACbC,YAAaC,aACbC,YAAaC,aACbC,YAAa,qBACbC,SAAS,EACTC,KAAM,OACNC,MAAO,YACPC,KAAM,GACNC,iBAAkB,UAMpBC,WAAAA,CAAYC,GACVC,MAAMD,GAENE,KAAKC,gBAAiB,EACtBD,KAAKE,gBAAiB,EAEtB,MAAMP,KAAEA,GAASK,KAAKG,WAAWL,EAAMpB,OAAS,IAEhDsB,KAAKI,MAAQ,CAAET,OAAMU,OAAQ,KAC/B,CAEAC,kBAAAA,CAAmBC,GACjB,MAAM7B,MAAEA,GAAUsB,KAAKF,MAEnBpB,IAAU6B,EAAU7B,OACtBsB,KAAKQ,OAAO9B,EAEhB,CAEAyB,WAAaA,CACXzB,EACA+B,KAQA,MA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B,KAAKsB,SAAS,CAAE3B,OAAMU,WAMlBO,EACK,CACLqB,UAAWvB,EAAQK,SAAW,EAAI,CAAEmB,MAAO,EAAGC,IAAK,GAAMJ,EAASE,UAClEvD,MAAOqD,EAASrD,MAAMC,QAAQC,QAAQwC,OAAQ,UAI9CT,EACK,CAAEsB,UAAW,CAAEC,MAAO,EAAGC,IAAK,GAAKzD,MAAOqD,EAASrD,MAAMC,QAAQC,QAAQqC,OAAQ,SAGtFrC,QAAQwD,OAAOlB,KAAKc,EAAStD,QAAUgC,EAAQK,SAAW,EACrD,CAAEkB,UAAW,CAAEC,MAAO,EAAGC,IAAK,GAAKzD,MAAOqD,EAASrD,QAGvDE,QAAQwD,OAAOlB,KAAKc,EAAStD,QAAUE,QAAQwD,OAAOlB,KAAKa,EAASrD,OAChE,IACFqD,EACHE,UAAWF,EAASE,UAAY,CAAEC,MAAOH,EAASE,UAAUC,MAAQ,EAAGC,IAAKJ,EAASE,UAAUE,IAAM,GAAM,MAIxGJ,CAAQ,EAGjBM,MAAAA,GAEE,MAAMpD,YAAEA,EAAWE,YAAEA,EAAWE,YAAEA,EAAWsC,WAAEA,KAAe7B,GAAUE,KAAKF,MAC7E,MAAMH,KAAEA,EAAIU,OAAEA,GAAWL,KAAKI,MAE9B,OACEkC,IAACC,MAAK,IACAzC,EACJgC,wBAAyB9B,KAAK8B,wBAC9BnC,KAAMA,EACN,cAAaU,aAAkBmC,OAASnC,EAAOoC,gBAAaC,EAC5DhB,SAAU1B,KAAKuB,cAGrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputCheckbox.js","sources":["../../../../src/components/InputCheckbox/InputCheckbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputCheckboxProps } from './types'\n\nconst COMPONENT_NAME = 'InputCheckbox'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputCheckbox/types.ts).\n *\n * @visibleName Checkbox\n */\nconst InputCheckbox: React.ForwardRefExoticComponent<InputCheckboxProps> = withMergedProps<\n InputCheckboxProps,\n HTMLInputElement\n>(\n forwardRef(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n indeterminate,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n indeterminate={indeterminate}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='checkbox' ref={ref} />\n <Styled.InputMask>\n {indeterminate === true ? <Styled.InputIndeterminate /> : <Styled.InputChecked />}\n </Styled.InputMask>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputCheckbox, COMPONENT_NAME }\n"],"names":["InputCheckbox","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","indeterminate","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","jsx","type","InputChecked","displayName","SIZES"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputCheckbox.js","sources":["../../../../src/components/InputCheckbox/InputCheckbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputCheckboxProps } from './types'\n\nconst COMPONENT_NAME = 'InputCheckbox'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputCheckbox/types.ts).\n *\n * @visibleName Checkbox\n */\nconst InputCheckbox: React.ForwardRefExoticComponent<InputCheckboxProps> = withMergedProps<\n InputCheckboxProps,\n HTMLInputElement\n>(\n forwardRef<HTMLInputElement, MergedProps<InputCheckboxProps>>(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n indeterminate,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n indeterminate={indeterminate}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='checkbox' ref={ref} />\n <Styled.InputMask>\n {indeterminate === true ? <Styled.InputIndeterminate /> : <Styled.InputChecked />}\n </Styled.InputMask>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputCheckbox, COMPONENT_NAME }\n"],"names":["InputCheckbox","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","indeterminate","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","jsx","type","InputChecked","displayName","SIZES"],"mappings":"yNAqBA,MAAMA,cAAqEC,gBAAAA,gBAIzEC,MAAAA,YACE,EAEIC,OAAO,IACPC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,QACAC,YACAC,SACAC,SACAC,QACAC,UACAC,WACAC,YACAC,gBACAC,EACAC,gBACAC,YACAC,cACGC,GAELC,IAGEC,WAAAA,KAACC,MAAAA,KAAW,CACVvB,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,MAAOA,EACPC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,MAAOA,EACPC,QAASA,EACTC,SAAUA,EACVC,UAAWA,EACXC,QAASA,EACTC,MAAOA,EACPC,cAAeA,EACfC,UAAWA,EACXC,SAAUA,EAASK,SAEnBC,CAAAA,WAAAC,IAACH,YAAY,IAAKH,EAAYD,SAAUA,EAAUQ,KAAK,WAAWN,IAAKA,IACvEI,WAAAC,IAACH,gBAAgB,CAAAC,SACWC,eAAzBR,KAAkB,EAAQM,MAAAA,mBAAgCA,MAAmBK,aAA1B,CAAA,UAM9D,CACEC,YA7EmB,gBA8EnBtB,MAAOuB,UAAAA,+BA9EY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputCheckbox.mjs","sources":["../../../../src/components/InputCheckbox/InputCheckbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputCheckboxProps } from './types'\n\nconst COMPONENT_NAME = 'InputCheckbox'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputCheckbox/types.ts).\n *\n * @visibleName Checkbox\n */\nconst InputCheckbox: React.ForwardRefExoticComponent<InputCheckboxProps> = withMergedProps<\n InputCheckboxProps,\n HTMLInputElement\n>(\n forwardRef(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n indeterminate,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n indeterminate={indeterminate}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='checkbox' ref={ref} />\n <Styled.InputMask>\n {indeterminate === true ? <Styled.InputIndeterminate /> : <Styled.InputChecked />}\n </Styled.InputMask>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputCheckbox, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","InputCheckbox","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","indeterminate","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","type","displayName","SIZES"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputCheckbox.mjs","sources":["../../../../src/components/InputCheckbox/InputCheckbox.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputCheckboxProps } from './types'\n\nconst COMPONENT_NAME = 'InputCheckbox'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputCheckbox/types.ts).\n *\n * @visibleName Checkbox\n */\nconst InputCheckbox: React.ForwardRefExoticComponent<InputCheckboxProps> = withMergedProps<\n InputCheckboxProps,\n HTMLInputElement\n>(\n forwardRef<HTMLInputElement, MergedProps<InputCheckboxProps>>(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n indeterminate,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n indeterminate={indeterminate}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='checkbox' ref={ref} />\n <Styled.InputMask>\n {indeterminate === true ? <Styled.InputIndeterminate /> : <Styled.InputChecked />}\n </Styled.InputMask>\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputCheckbox, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","InputCheckbox","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","indeterminate","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","type","displayName","SIZES"],"mappings":"mPAOMA,MAAAA,eAAiB,gBAcvB,MAAMC,cAAqEC,gBAIzEC,YACE,EAEIC,OAAO,IACPC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,QACAC,YACAC,SACAC,SACAC,QACAC,UACAC,WACAC,YACAC,UACAC,QACAC,gBACAC,YACAC,cACGC,GAELC,IAGEC,KAACC,KAAW,CACVvB,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,MAAOA,EACPC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,MAAOA,EACPC,QAASA,EACTC,SAAUA,EACVC,UAAWA,EACXC,QAASA,EACTC,MAAOA,EACPC,cAAeA,EACfC,UAAWA,EACXC,SAAUA,EAASK,SAEnBC,CAAAA,IAACF,MAAY,IAAKH,EAAYD,SAAUA,EAAUO,KAAK,WAAWL,IAAKA,IACvEI,IAACF,UAAgB,CAAAC,SACWC,IAAzBR,KAAkB,EAAQM,mBAAgCA,aAAP,CAAA,UAM9D,CACEI,YA7EmB,gBA8EnBpB,MAAOqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputRadio.js","sources":["../../../../src/components/InputRadio/InputRadio.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputRadioProps } from './types'\n\nconst COMPONENT_NAME = 'InputRadio'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputRadio/types.ts).\n *\n * @visibleName Radio\n */\nconst InputRadio: React.ForwardRefExoticComponent<InputRadioProps> = withMergedProps<InputRadioProps, HTMLInputElement>(\n forwardRef(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='radio' ref={ref} />\n <Styled.InputMask />\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputRadio, COMPONENT_NAME }\n"],"names":["InputRadio","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","jsx","type","displayName","SIZES"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputRadio.js","sources":["../../../../src/components/InputRadio/InputRadio.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputRadioProps } from './types'\n\nconst COMPONENT_NAME = 'InputRadio'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputRadio/types.ts).\n *\n * @visibleName Radio\n */\nconst InputRadio: React.ForwardRefExoticComponent<InputRadioProps> = withMergedProps<InputRadioProps, HTMLInputElement>(\n forwardRef<HTMLInputElement, MergedProps<InputRadioProps>>(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='radio' ref={ref} />\n <Styled.InputMask />\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputRadio, COMPONENT_NAME }\n"],"names":["InputRadio","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","jsx","type","displayName","SIZES"],"mappings":"yNAqBA,MAAMA,WAA+DC,gBAAAA,gBACnEC,MAAAA,YACE,EAEIC,OAAO,IACPC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,QACAC,YACAC,SACAC,SACAC,QACAC,UACAC,WACAC,YACAC,gBACAC,EACAC,YACAC,cACGC,GAELC,IAGEC,WAAAA,KAACC,MAAAA,KAAW,CACVtB,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,MAAOA,EACPC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,MAAOA,EACPC,QAASA,EACTC,SAAUA,EACVC,UAAWA,EACXC,QAASA,EACTC,MAAOA,EACPC,UAAWA,EACXC,SAAUA,EAASK,SAEnBC,CAAAA,WAAAC,IAACH,YAAY,IAAKH,EAAYD,SAAUA,EAAUQ,KAAK,QAAQN,IAAKA,IACpEI,WAAAC,IAACH,yBAKT,CACEK,YAtEmB,aAuEnBpB,MAAOqB,UAAAA,+BAvEY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputRadio.mjs","sources":["../../../../src/components/InputRadio/InputRadio.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputRadioProps } from './types'\n\nconst COMPONENT_NAME = 'InputRadio'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputRadio/types.ts).\n *\n * @visibleName Radio\n */\nconst InputRadio: React.ForwardRefExoticComponent<InputRadioProps> = withMergedProps<InputRadioProps, HTMLInputElement>(\n forwardRef(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='radio' ref={ref} />\n <Styled.InputMask />\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputRadio, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","InputRadio","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","type","displayName","SIZES"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InputRadio.mjs","sources":["../../../../src/components/InputRadio/InputRadio.tsx"],"sourcesContent":["import { forwardRef } from 'react'\nimport { withMergedProps } from 'hocs/withMergedProps'\nimport type { MergedProps } from 'hocs/withMergedProps'\nimport { SIZES } from './constants'\nimport * as Styled from './style'\nimport type { InputRadioProps } from './types'\n\nconst COMPONENT_NAME = 'InputRadio'\n\n/**\n *\n * Компонент поддерживает все атрибуты \\<input\\> элемента.\n *\n * Переданный \"ref\" будет ассоциирован с \\<input\\>.\n *\n * Поддерживаются пропсы определения размеров в зависимости от ширины вьюпорта.\n *\n * Полный интерфейс можно посмотреть [тут](https://github.com/foxford/ui/blob/master/src/components/InputRadio/types.ts).\n *\n * @visibleName Radio\n */\nconst InputRadio: React.ForwardRefExoticComponent<InputRadioProps> = withMergedProps<InputRadioProps, HTMLInputElement>(\n forwardRef<HTMLInputElement, MergedProps<InputRadioProps>>(\n (\n {\n size = 'm',\n sizeXXS,\n sizeXS,\n sizeS,\n sizeM,\n sizeL,\n sizeXL,\n sizes,\n sizeUnits,\n preset,\n inline,\n error,\n success,\n contrast,\n onColored,\n palette,\n style,\n className,\n disabled,\n ...inputProps\n },\n ref\n ) => {\n return (\n <Styled.Root\n size={size}\n sizeXXS={sizeXXS}\n sizeXS={sizeXS}\n sizeS={sizeS}\n sizeM={sizeM}\n sizeL={sizeL}\n sizeXL={sizeXL}\n sizes={sizes}\n sizeUnits={sizeUnits}\n preset={preset}\n inline={inline}\n error={error}\n success={success}\n contrast={contrast}\n onColored={onColored}\n palette={palette}\n style={style}\n className={className}\n disabled={disabled}\n >\n <Styled.Input {...inputProps} disabled={disabled} type='radio' ref={ref} />\n <Styled.InputMask />\n </Styled.Root>\n )\n }\n ),\n {\n displayName: COMPONENT_NAME,\n sizes: SIZES,\n }\n)\n\nexport { InputRadio, COMPONENT_NAME }\n"],"names":["COMPONENT_NAME","InputRadio","withMergedProps","forwardRef","size","sizeXXS","sizeXS","sizeS","sizeM","sizeL","sizeXL","sizes","sizeUnits","preset","inline","error","success","contrast","onColored","palette","style","className","disabled","inputProps","ref","_jsxs","Styled","children","_jsx","type","displayName","SIZES"],"mappings":"mNAOMA,MAAAA,eAAiB,aAcvB,MAAMC,WAA+DC,gBACnEC,YACE,EAEIC,OAAO,IACPC,UACAC,SACAC,QACAC,QACAC,QACAC,SACAC,QACAC,YACAC,SACAC,SACAC,QACAC,UACAC,WACAC,YACAC,UACAC,QACAC,YACAC,cACGC,GAELC,IAGEC,KAACC,KAAW,CACVtB,KAAMA,EACNC,QAASA,EACTC,OAAQA,EACRC,MAAOA,EACPC,MAAOA,EACPC,MAAOA,EACPC,OAAQA,EACRC,MAAOA,EACPC,UAAWA,EACXC,OAAQA,EACRC,OAAQA,EACRC,MAAOA,EACPC,QAASA,EACTC,SAAUA,EACVC,UAAWA,EACXC,QAASA,EACTC,MAAOA,EACPC,UAAWA,EACXC,SAAUA,EAASK,SAEnBC,CAAAA,IAACF,MAAY,IAAKH,EAAYD,SAAUA,EAAUO,KAAK,QAAQL,IAAKA,IACpEI,IAACF,mBAKT,CACEI,YAtEmB,aAuEnBnB,MAAOoB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Skeleton=require('../Skeleton/Skeleton.js');var Text=require('../Text/Text.js');var Icon=require('../Icon/Icon.js');const ListItem=withMergedProps.withMergedProps(React.forwardRef(((e,t)=>{const{size:s="s",borderRadius:i=0,mediaBorderRadius:n="50%",controlPosition:o="left",captionPosition:r="bottom",ellipsis:
|
|
1
|
+
'use strict';var React=require('react');var withMergedProps=require('../../hocs/withMergedProps.js');var constants=require('./constants.js');var style=require('./style.js');var jsxRuntime=require('react/jsx-runtime');var Skeleton=require('../Skeleton/Skeleton.js');var Text=require('../Text/Text.js');var Icon=require('../Icon/Icon.js');const ListItem=withMergedProps.withMergedProps(React.forwardRef(((e,t)=>{const{size:s="s",borderRadius:i=0,mediaBorderRadius:n="50%",controlPosition:o="left",captionPosition:r="bottom",ellipsis:l=!0,iconProps:a={},textProps:c={},captionProps:d={},sizeXXS:u,sizeXS:x,sizeS:p,sizeM:j,sizeL:m,sizeXL:R,text:h,children:y,control:f,icon:z,media:b,caption:S,addon:g,onColored:I,disabled:v,loading:P,...T}=e;let q;let L;f&&(q='label'),T.href&&(q='a'),T.as&&(q=T.as),q||(L='button'),T.type&&(L=T.type);const M={size:s,sizeXXS:u,sizeXS:x,sizeS:p,sizeM:j,sizeL:m,sizeXL:R};const X={onColored:I,disabled:v};const k=typeof f=='object'&&typeof f.props=='object'&&f.props!==null?f.props:{};const[w,C]=Array.isArray(z)?z:[z];const E={appearance:'body',size:'inherit',color:'inherit',ellipsis:l};const A={appearance:'body',size:.9,sizeUnits:'em',color:'inherit',ellipsis:l};return jsxRuntime.jsx(style.Root,{...M,...X,...T,as:q,type:L,borderRadius:i,mediaBorderRadius:n,ref:t,children:typeof y=='function'?y({textProps:E,captionProps:A}):jsxRuntime.jsxs(jsxRuntime.Fragment,P?{children:[b?jsxRuntime.jsx(style.Media,{children:jsxRuntime.jsx(Skeleton.Skeleton,{width:"100%",height:"100%",borderRadius:"inherit"})}):null,jsxRuntime.jsx(style.Content,{children:jsxRuntime.jsx(Skeleton.Skeleton,{width:"100%",borderRadius:4,children:jsxRuntime.jsx(Text.Text,{...E,...c})})})]}:{children:[f&&o==='left'?typeof f=='function'?f({...M,...X}):React.cloneElement(f,{...M,...X,...k}):null,w?jsxRuntime.jsx(Icon.Icon,{preset:"brand",name:typeof w=='string'?w:void 0,icon:typeof w!='string'?w:void 0,...a}):null,b?jsxRuntime.jsx(style.Media,{children:React.isValidElement(b)?b:jsxRuntime.jsx(style.Img,{alt:"",...b})}):null,y||h||S?jsxRuntime.jsxs(style.Content,{children:[S&&r==='top'?jsxRuntime.jsx(Text.Text,{as:"span",...A,...d,children:S}):null,y||h?jsxRuntime.jsx(Text.Text,{as:"span",...E,...c,children:y??h}):null,S&&r==='bottom'?jsxRuntime.jsx(Text.Text,{as:"span",...A,...d,children:S}):null]}):null,g,C?jsxRuntime.jsx(Icon.Icon,{preset:"brand",name:typeof C=='string'?C:void 0,icon:typeof C!='string'?C:void 0,...a}):null,f&&o==='right'?typeof f=='function'?f({...M,...X}):React.cloneElement(f,{...M,...X,...k}):null]})})})),{displayName:'ListItem',sizes:constants.SIZES});exports.ListItem=ListItem;
|
|
2
2
|
//# sourceMappingURL=ListItem.js.map
|