@consta/uikit 4.17.2 → 4.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/__internal__/src/components/Avatar/Avatar.css +1 -1
  2. package/__internal__/src/components/Badge/Badge.css +1 -1
  3. package/__internal__/src/components/Badge/Badge.d.ts +5 -0
  4. package/__internal__/src/components/Badge/Badge.js +1 -1
  5. package/__internal__/src/components/Badge/Badge.js.map +1 -1
  6. package/__internal__/src/components/Breadcrumbs/BreadcrumbsMore/BreadcrumbsMore.js +1 -1
  7. package/__internal__/src/components/Breadcrumbs/BreadcrumbsMore/BreadcrumbsMore.js.map +1 -1
  8. package/__internal__/src/components/Breadcrumbs/helpers.d.ts +2 -2
  9. package/__internal__/src/components/Breadcrumbs/helpers.js +1 -1
  10. package/__internal__/src/components/Breadcrumbs/helpers.js.map +1 -1
  11. package/__internal__/src/components/Checkbox/Checkbox.css +2 -2
  12. package/__internal__/src/components/CheckboxGroup/CheckboxGroup.js +1 -1
  13. package/__internal__/src/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
  14. package/__internal__/src/components/CheckboxGroup/helper.d.ts +2 -1
  15. package/__internal__/src/components/CheckboxGroup/helper.js +1 -1
  16. package/__internal__/src/components/CheckboxGroup/helper.js.map +1 -1
  17. package/__internal__/src/components/CheckboxGroup/types.d.ts +3 -0
  18. package/__internal__/src/components/CheckboxGroup/types.js.map +1 -1
  19. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.css +1 -1
  20. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
  21. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
  22. package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js +1 -1
  23. package/__internal__/src/components/DateTime/DateTimeTypeDate/DateTimeTypeDate.js.map +1 -1
  24. package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js +1 -1
  25. package/__internal__/src/components/DateTime/DateTimeTypeMonth/DateTimeTypeMonth.js.map +1 -1
  26. package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js +1 -1
  27. package/__internal__/src/components/DateTime/DateTimeTypeYear/DateTimeTypeYear.js.map +1 -1
  28. package/__internal__/src/components/DragNDropField/DragNDropField.d.ts +1 -2
  29. package/__internal__/src/components/DragNDropField/DragNDropField.js +1 -1
  30. package/__internal__/src/components/DragNDropField/DragNDropField.js.map +1 -1
  31. package/__internal__/src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.css +1 -1
  32. package/__internal__/src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.js +1 -1
  33. package/__internal__/src/components/DragNDropField/DragNDropFieldTooltip/DragNDropFieldTooltip.js.map +1 -1
  34. package/__internal__/src/components/File/File.css +1 -1
  35. package/__internal__/src/components/Informer/Informer.d.ts +1 -1
  36. package/__internal__/src/components/Informer/Informer.js +1 -1
  37. package/__internal__/src/components/Informer/Informer.js.map +1 -1
  38. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js +1 -1
  39. package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js.map +1 -1
  40. package/__internal__/src/components/ListCanary/maps.d.ts +1 -0
  41. package/__internal__/src/components/ListCanary/maps.js +1 -1
  42. package/__internal__/src/components/ListCanary/maps.js.map +1 -1
  43. package/__internal__/src/components/Popover/Popover.css +1 -1
  44. package/__internal__/src/components/Popover/Popover.d.ts +3 -4
  45. package/__internal__/src/components/Popover/Popover.js +1 -1
  46. package/__internal__/src/components/Popover/Popover.js.map +1 -1
  47. package/__internal__/src/components/Popover/index.d.ts +1 -0
  48. package/__internal__/src/components/Popover/index.js +1 -1
  49. package/__internal__/src/components/Popover/index.js.map +1 -1
  50. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.css +9 -1
  51. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.js +1 -1
  52. package/__internal__/src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.js.map +1 -1
  53. package/__internal__/src/components/ProgressStepBar/ProgressStepBarLine/ProgressStepBarLine.js +1 -1
  54. package/__internal__/src/components/ProgressStepBar/ProgressStepBarLine/ProgressStepBarLine.js.map +1 -1
  55. package/__internal__/src/components/RadioGroup/RadioGroup.css +1 -1
  56. package/__internal__/src/components/RadioGroup/RadioGroup.js +1 -1
  57. package/__internal__/src/components/RadioGroup/RadioGroup.js.map +1 -1
  58. package/__internal__/src/components/RadioGroup/helper.d.ts +2 -1
  59. package/__internal__/src/components/RadioGroup/helper.js +1 -1
  60. package/__internal__/src/components/RadioGroup/helper.js.map +1 -1
  61. package/__internal__/src/components/RadioGroup/types.d.ts +3 -0
  62. package/__internal__/src/components/RadioGroup/types.js.map +1 -1
  63. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
  64. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
  65. package/__internal__/src/components/Slider/SliderPoint/SliderPoint.js +1 -1
  66. package/__internal__/src/components/Slider/SliderPoint/SliderPoint.js.map +1 -1
  67. package/__internal__/src/components/TabsDeprecated/Tab/TabsTab.css +1 -1
  68. package/__internal__/src/components/TabsDeprecated/Tab/TabsTab.js +1 -1
  69. package/__internal__/src/components/TabsDeprecated/Tab/TabsTab.js.map +1 -1
  70. package/__internal__/src/components/Tooltip/Tooltip.d.ts +2 -1
  71. package/__internal__/src/components/Tooltip/Tooltip.js +1 -1
  72. package/__internal__/src/components/Tooltip/Tooltip.js.map +1 -1
  73. package/__internal__/src/components/User/User.css +1 -1
  74. package/__internal__/src/components/User/User.js +1 -1
  75. package/__internal__/src/components/User/User.js.map +1 -1
  76. package/__internal__/src/utils/isRenderProp.d.ts +2 -0
  77. package/__internal__/src/utils/isRenderProp.js +2 -0
  78. package/__internal__/src/utils/isRenderProp.js.map +1 -0
  79. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- export*from"./Popover";
1
+ export*from"./Popover";export{usePopoverReposition}from"./usePopoverReposition";
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/Popover/index.ts"],"sourcesContent":["export * from './Popover';\n"],"mappings":"AAAA"}
1
+ {"version":3,"file":"index.js","names":["usePopoverReposition"],"sources":["../../../../../src/components/Popover/index.ts"],"sourcesContent":["export * from './Popover';\nexport { usePopoverReposition } from './usePopoverReposition';\n"],"mappings":"AAAA,uBACA,OAASA,oBAAT"}
@@ -1 +1,9 @@
1
- .ProgressStepBarItem{align-items:flex-start;display:inline-flex;flex:1;height:100%;position:relative;width:100%}.ProgressStepBarItem_direction_horizontal{flex-direction:column}.ProgressStepBarItem_direction_horizontal .ProgressStepBarItem-Point_size_xs{margin-bottom:var(--space-2xs)}.ProgressStepBarItem_direction_horizontal .ProgressStepBarItem-Point_size_m,.ProgressStepBarItem_direction_horizontal .ProgressStepBarItem-Point_size_s{margin-bottom:var(--space-xs)}.ProgressStepBarItem_direction_vertical{flex-direction:row}.ProgressStepBarItem_direction_vertical .ProgressStepBarItem-Point{margin-right:var(--space-xs)}.ProgressStepBarItem_direction_vertical .ProgressStepBarItem-Content_size_xs{margin-top:-4px}.ProgressStepBarItem_size_xs{--progress-step-bar-item-point-size:var(--space-xs);--progress-step-bar-item-label-margin:var(--space-2xs)}.ProgressStepBarItem_size_s{--progress-step-bar-item-point-size:var(--space-m);--progress-step-bar-item-label-margin:var(--space-xs)}.ProgressStepBarItem_size_m{--progress-step-bar-item-point-size:var(--space-xl);--progress-step-bar-item-label-margin:var(--space-xs)}.ProgressStepBarItem_position_start{flex:1}.ProgressStepBarItem_position_start .ProgressStepBarItem-Content,.ProgressStepBarItem_position_start.ProgressStepBarItem_direction_horizontal{align-items:flex-start;text-align:left}.ProgressStepBarItem_position_center{flex:2}.ProgressStepBarItem_position_center .ProgressStepBarItemr-Content,.ProgressStepBarItem_position_center.ProgressStepBarItem_direction_horizontal{align-items:center;text-align:center}.ProgressStepBarItem_position_end{flex:1}.ProgressStepBarItem_position_end .ProgressStepBarItem-Content,.ProgressStepBarItem_position_end.ProgressStepBarItem_direction_horizontal{align-items:flex-end;text-align:right}.ProgressStepBarItem_status_system{--progress-step-bar-item-point-background:var(--color-bg-system);--progress-step-bar-item-point-content-color:var(--color-typo-secondary)}.ProgressStepBarItem_status_normal{--progress-step-bar-item-point-background:var(--color-bg-normal);--progress-step-bar-item-point-content-color:var(--color-bg-default)}.ProgressStepBarItem_status_success{--progress-step-bar-item-point-background:var(--color-bg-success);--progress-step-bar-item-point-content-color:var(--color-bg-default)}.ProgressStepBarItem_status_warning{--progress-step-bar-item-point-background:var(--color-bg-warning);--progress-step-bar-item-point-content-color:var(--color-bg-default)}.ProgressStepBarItem_status_alert{--progress-step-bar-item-point-background:var(--color-bg-alert);--progress-step-bar-item-point-content-color:var(--color-bg-default)}.ProgressStepBarItem .ProgressStepBarItem-PointIcon,.ProgressStepBarItem .ProgressStepBarItem-PointText{color:var(--progress-step-bar-item-point-content-color)}.ProgressStepBarItem .ProgressSpin{stroke:var(--progress-step-bar-item-point-content-color)}.ProgressStepBarItem-Point{align-items:center;background-color:var(--progress-step-bar-item-point-background);border:none;border-radius:calc(var(--progress-step-bar-item-point-size)*.5);color:var(--color-bg-default);display:flex;justify-content:center;margin:0;min-height:var(--progress-step-bar-item-point-size);min-width:var(--progress-step-bar-item-point-size);padding:0;transition:background-color .3s}.ProgressStepBarItem-Point_pointer{cursor:pointer}.ProgressStepBarItem-PointText{color:var(--color-typo-secondary);transition:color .3s}.ProgressStepBarItem-Content_bottomOffset,.ProgressStepBarItem-Label{margin-bottom:var(--progress-step-bar-item-label-margin)}
1
+ .ProgressStepBarItem{align-items:flex-start;display:inline-flex;flex:1;height:100%;position:relative;width:100%}.ProgressStepBarItem_direction_horizontal{flex-direction:column}.ProgressStepBarItem_direction_horizontal .ProgressStepBarItem-Point_size_xs{margin-bottom:var(--space-2xs)}.ProgressStepBarItem_direction_horizontal .ProgressStepBarItem-Point_size_m,.ProgressStepBarItem_direction_horizontal .ProgressStepBarItem-Point_size_s{margin-bottom:var(--space-xs)}.ProgressStepBarItem_direction_vertical{flex-direction:row}.ProgressStepBarItem_direction_vertical .ProgressStepBarItem-Point{margin-right:var(--space-xs)}.ProgressStepBarItem_direction_vertical .ProgressStepBarItem-Content_size_xs{margin-top:-4px}.ProgressStepBarItem::-webkit-scrollbar{display:none}.ProgressStepBarItem_size_xs{--progress-step-bar-item-point-size:var(--space-xs);--progress-step-bar-item-label-margin:var(--space-2xs)}.ProgressStepBarItem_size_s{--progress-step-bar-item-point-size:var(--space-m);--progress-step-bar-item-label-margin:var(--space-xs)}.ProgressStepBarItem_size_m{--progress-step-bar-item-point-size:var(--space-xl);--progress-step-bar-item-label-margin:var(--space-xs)}.ProgressStepBarItem_position_start.ProgressStepBarItem_direction_horizontal{align-items:flex-start;text-align:left}.ProgressStepBarItem_position_center.ProgressStepBarItem_direction_horizontal{align-items:center;text-align:center}.ProgressStepBarItem_position_end.ProgressStepBarItem_direction_horizontal{align-items:flex-end;text-align:right}.ProgressStepBarItem_status_system{--progress-step-bar-item-point-background:var(--color-bg-system);--progress-step-bar-item-point-content-color:var(--color-typo-secondary)}.ProgressStepBarItem_status_normal{--progress-step-bar-item-point-background:var(--color-bg-normal);--progress-step-bar-item-point-content-color:var(
2
+ --color-control-typo-primary
3
+ )}.ProgressStepBarItem_status_success{--progress-step-bar-item-point-background:var(--color-bg-success);--progress-step-bar-item-point-content-color:var(
4
+ --color-control-typo-primary
5
+ )}.ProgressStepBarItem_status_warning{--progress-step-bar-item-point-background:var(--color-bg-warning);--progress-step-bar-item-point-content-color:var(
6
+ --color-control-typo-primary
7
+ )}.ProgressStepBarItem_status_alert{--progress-step-bar-item-point-background:var(--color-bg-alert);--progress-step-bar-item-point-content-color:var(
8
+ --color-control-typo-primary
9
+ )}.ProgressStepBarItem .ProgressStepBarItem-PointIcon,.ProgressStepBarItem .ProgressStepBarItem-PointText{color:var(--progress-step-bar-item-point-content-color)}.ProgressStepBarItem .ProgressSpin{stroke:var(--progress-step-bar-item-point-content-color)}.ProgressStepBarItem-Point{align-items:center;background-color:var(--progress-step-bar-item-point-background);border:none;border-radius:calc(var(--progress-step-bar-item-point-size)*.5);color:var(--color-bg-default);display:flex;justify-content:center;margin:0;min-height:var(--progress-step-bar-item-point-size);min-width:var(--progress-step-bar-item-point-size);padding:0;transition:background-color .3s}.ProgressStepBarItem-Point_pointer{cursor:pointer}.ProgressStepBarItem-PointText.Text{line-height:var(--size-text-xs);transition:color .3s}.ProgressStepBarItem-Content_bottomOffset,.ProgressStepBarItem-Label{margin-bottom:var(--progress-step-bar-item-label-margin)}
@@ -1,2 +1,2 @@
1
- import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["content","tooltipContent","label","point","status","progress","direction","size","pointRef","onClick","position","tooltipZIndex","className"];import"./ProgressStepBarItem.css";import React,{useRef}from"react";import{useForkRef}from"../../../hooks/useForkRef";import{useMouseLeave}from"../../../hooks/useMouseLeave";import{useFlag}from"../../../hooks/useFlag/useFlag";import{cnMixFocus}from"../../../mixs/MixFocus/MixFocus";import{cn}from"../../../utils/bem";import{ProgressSpin}from"../../ProgressSpin/ProgressSpin";import{Text}from"../../Text/Text";import{Tooltip}from"../../Tooltip/Tooltip";import{propPositionDefault,propStatusDefault}from"../helpers";var cnProgressStepBarItem=cn("ProgressStepBarItem"),possibleVerticalDirections=["leftCenter","rightCenter","rightUp","downCenter"],possibleHorizontalDirections=["downCenter","upCenter","downStartLeft","downStartRight"],renderPointContent=function(a,b,c){if(c)return React.createElement(ProgressSpin,{size:b});if(!a)return null;if("number"==typeof a)return React.createElement(Text,{className:cnProgressStepBarItem("PointText"),size:"s"===b?"2xs":"xs",weight:"bold"},a);return React.createElement(a,{className:cnProgressStepBarItem("PointIcon"),size:"xs"})};export var ProgressStepBarItem=React.forwardRef(function(a,b){var c=a.content,d=a.tooltipContent,e=a.label,f=a.point,g=a.status,h=a.progress,i=a.direction,j=a.size,k=a.pointRef,l=a.onClick,m=a.position,n=void 0===m?propPositionDefault:m,o=a.tooltipZIndex,p=a.className,q=_objectWithoutProperties(a,_excluded),r=useFlag(),s=_slicedToArray(r,2),t=s[0],u=s[1],v=useRef(null),w=useRef(null),x=useRef(null),y=useForkRef([x,k]),z={onMouseEnter:u.on,className:cnProgressStepBarItem("Point",{size:j,pointer:!!l},[l?cnMixFocus():void 0]),children:"xs"!==j&&renderPointContent(f,j,h),ref:y,onClick:l};return useMouseLeave({isActive:t,refs:[v,x,w],handler:u.off,debounce:100}),React.createElement(React.Fragment,null,React.createElement("div",Object.assign({ref:b,className:cnProgressStepBarItem({direction:i,position:n,status:g||propStatusDefault,size:j},[p])},q),React.createElement("button",Object.assign({tabIndex:-1,type:"button"},z)),(e||c)&&React.createElement("div",{className:cnProgressStepBarItem("Content",{bottomOffset:!!c})},e&&React.createElement(Text,{className:cnProgressStepBarItem("Label"),ref:v,size:j,onMouseEnter:u.on,lineHeight:"s"===j?"xs":j,view:"primary"},e),c)),d&&t&&React.createElement(Tooltip,{ref:w,anchorRef:e||c?v:x,className:cnProgressStepBarItem("Tooltip"),direction:"horizontal"===i?"downCenter":"leftUp",style:{zIndex:o},isInteractive:!1,possibleDirections:"horizontal"===i?possibleHorizontalDirections:possibleVerticalDirections},d))});
1
+ import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["content","tooltipContent","label","point","status","progress","direction","size","pointRef","onClick","position","tooltipZIndex","className"];import"./ProgressStepBarItem.css";import React,{useMemo,useRef}from"react";import{useForkRef}from"../../../hooks/useForkRef";import{useMouseLeave}from"../../../hooks/useMouseLeave";import{useFlag}from"../../../hooks/useFlag/useFlag";import{cnMixFocus}from"../../../mixs/MixFocus/MixFocus";import{cn}from"../../../utils/bem";import{ProgressSpin}from"../../ProgressSpin/ProgressSpin";import{Text}from"../../Text/Text";import{Tooltip}from"../../Tooltip/Tooltip";import{propPositionDefault,propStatusDefault}from"../helpers";var cnProgressStepBarItem=cn("ProgressStepBarItem"),possibleVerticalDirections=["leftCenter","rightCenter","rightUp","downCenter"],possibleHorizontalDirections=["downCenter","upCenter","downStartLeft","downStartRight"],renderPointContent=function(a,b,c){if(c)return React.createElement(ProgressSpin,{size:b});if(!a)return null;if("number"==typeof a)return React.createElement(Text,{className:cnProgressStepBarItem("PointText"),size:"s"===b?"2xs":"xs",weight:"bold"},a);return React.createElement(a,{className:cnProgressStepBarItem("PointIcon"),size:"xs"})};export var ProgressStepBarItem=React.forwardRef(function(a,b){var c=a.content,d=a.tooltipContent,e=a.label,f=a.point,g=a.status,h=a.progress,i=a.direction,j=a.size,k=a.pointRef,l=a.onClick,m=a.position,n=void 0===m?propPositionDefault:m,o=a.tooltipZIndex,p=a.className,q=_objectWithoutProperties(a,_excluded),r=useFlag(),s=_slicedToArray(r,2),t=s[0],u=s[1],v=useRef(null),w=useRef(null),x=useRef(null),y=useForkRef([x,k]),z={onMouseEnter:u.on,className:cnProgressStepBarItem("Point",{size:j,pointer:!!l},[l?cnMixFocus():void 0]),children:"xs"!==j&&renderPointContent(f,j,h),ref:y,onClick:l},A=useMemo(function(){if("vertical"===i)return{tooltipDirection:"leftUp",possibleDirections:possibleVerticalDirections,spareDirection:"rightCenter"};var a="downCenter";return"start"===n&&(a="rightCenter"),"end"===n&&(a="leftCenter"),{tooltipDirection:"downCenter",possibleDirections:possibleHorizontalDirections,spareDirection:a}},[i,n]),B=A.tooltipDirection,C=A.possibleDirections,D=A.spareDirection;return useMouseLeave({isActive:t,refs:[v,x,w],handler:u.off,debounce:100}),React.createElement(React.Fragment,null,React.createElement("div",Object.assign({ref:b,className:cnProgressStepBarItem({direction:i,position:n,status:g||propStatusDefault,size:j},[p])},q),React.createElement("button",Object.assign({tabIndex:-1,type:"button"},z)),(e||c)&&React.createElement("div",{className:cnProgressStepBarItem("Content",{bottomOffset:!!c})},e&&React.createElement(Text,{className:cnProgressStepBarItem("Label"),ref:v,size:j,onMouseEnter:u.on,lineHeight:"s"===j?"xs":j,view:"primary"},e),c)),d&&t&&React.createElement(Tooltip,{ref:w,anchorRef:x,className:cnProgressStepBarItem("Tooltip"),direction:B,style:{zIndex:o},isInteractive:!1,possibleDirections:C,spareDirection:D},d))});
2
2
  //# sourceMappingURL=ProgressStepBarItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressStepBarItem.js","names":["React","useRef","useForkRef","useMouseLeave","useFlag","cnMixFocus","cn","ProgressSpin","Text","Tooltip","propPositionDefault","propStatusDefault","cnProgressStepBarItem","possibleVerticalDirections","possibleHorizontalDirections","renderPointContent","point","size","progress","ProgressStepBarItem","forwardRef","props","ref","content","tooltipContent","label","status","direction","pointRefProp","pointRef","onClick","position","tooltipZIndex","className","otherProps","isTooltipVisible","setTooltipVisible","anchorRef","tooltipRef","pointForkedRef","pointProps","onMouseEnter","on","pointer","children","isActive","refs","handler","off","debounce","bottomOffset","zIndex"],"sources":["../../../../../../src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.tsx"],"sourcesContent":["import './ProgressStepBarItem.css';\n\nimport { IconComponent } from '@consta/icons/Icon';\nimport React, { useRef } from 'react';\n\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { useMouseLeave } from '##/hooks/useMouseLeave';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { cnMixFocus } from '../../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../../utils/bem';\nimport { Direction } from '../../Popover/Popover';\nimport { ProgressSpin } from '../../ProgressSpin/ProgressSpin';\nimport { Text } from '../../Text/Text';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport {\n PointNumbersMap,\n ProgressStepBarItemComponent,\n propPositionDefault,\n propStatusDefault,\n} from '../helpers';\n\nconst cnProgressStepBarItem = cn('ProgressStepBarItem');\n\nconst possibleVerticalDirections: Direction[] = [\n 'leftCenter',\n 'rightCenter',\n 'rightUp',\n 'downCenter',\n];\nconst possibleHorizontalDirections: Direction[] = [\n 'downCenter',\n 'upCenter',\n 'downStartLeft',\n 'downStartRight',\n];\n\nconst renderPointContent = (\n point: PointNumbersMap | IconComponent | undefined,\n size: 'm' | 's',\n progress: boolean | undefined,\n) => {\n if (progress) return <ProgressSpin size={size} />;\n if (!point) return null;\n\n if (typeof point === 'number') {\n return (\n <Text\n className={cnProgressStepBarItem('PointText')}\n size={size === 's' ? '2xs' : 'xs'}\n weight=\"bold\"\n >\n {point}\n </Text>\n );\n }\n\n const Icon = point;\n\n return <Icon className={cnProgressStepBarItem('PointIcon')} size=\"xs\" />;\n};\n\nexport const ProgressStepBarItem: ProgressStepBarItemComponent =\n React.forwardRef((props, ref) => {\n const {\n content,\n tooltipContent,\n label,\n point,\n status,\n progress,\n direction,\n size,\n pointRef: pointRefProp,\n onClick,\n position = propPositionDefault,\n tooltipZIndex,\n className,\n ...otherProps\n } = props;\n\n const [isTooltipVisible, setTooltipVisible] = useFlag();\n\n const anchorRef = useRef<HTMLDivElement>(null);\n const tooltipRef = useRef<HTMLDivElement>(null);\n const pointRef = useRef<HTMLButtonElement>(null);\n\n const pointForkedRef = useForkRef([pointRef, pointRefProp]);\n\n const pointProps = {\n onMouseEnter: setTooltipVisible.on,\n className: cnProgressStepBarItem(\n 'Point',\n {\n size,\n pointer: !!onClick,\n },\n [onClick ? cnMixFocus() : undefined],\n ),\n children: size !== 'xs' && renderPointContent(point, size, progress),\n ref: pointForkedRef,\n onClick,\n };\n\n useMouseLeave({\n isActive: isTooltipVisible,\n refs: [anchorRef, pointRef, tooltipRef],\n handler: setTooltipVisible.off,\n debounce: 100,\n });\n\n return (\n <>\n <div\n ref={ref}\n className={cnProgressStepBarItem(\n {\n direction,\n position,\n status: status || propStatusDefault,\n size,\n },\n [className],\n )}\n {...otherProps}\n >\n <button tabIndex={-1} type=\"button\" {...pointProps} />\n {(label || content) && (\n <div\n className={cnProgressStepBarItem('Content', {\n bottomOffset: !!content,\n })}\n >\n {label && (\n <Text\n className={cnProgressStepBarItem('Label')}\n ref={anchorRef}\n size={size}\n onMouseEnter={setTooltipVisible.on}\n lineHeight={size === 's' ? 'xs' : size}\n view=\"primary\"\n >\n {label}\n </Text>\n )}\n {content}\n </div>\n )}\n </div>\n {tooltipContent && isTooltipVisible && (\n <Tooltip\n ref={tooltipRef}\n anchorRef={label || content ? anchorRef : pointRef}\n className={cnProgressStepBarItem('Tooltip')}\n direction={direction === 'horizontal' ? 'downCenter' : 'leftUp'}\n style={{ zIndex: tooltipZIndex }}\n isInteractive={false}\n possibleDirections={\n direction === 'horizontal'\n ? possibleHorizontalDirections\n : possibleVerticalDirections\n }\n >\n {tooltipContent}\n </Tooltip>\n )}\n </>\n );\n });\n"],"mappings":"oTAAA,kCAGA,MAAOA,MAAP,EAAgBC,MAAhB,KAA8B,OAA9B,CAEA,OAASC,UAAT,iCACA,OAASC,aAAT,oCAEA,OAASC,OAAT,sCACA,OAASC,UAAT,uCACA,OAASC,EAAT,0BAEA,OAASC,YAAT,uCACA,OAASC,IAAT,uBACA,OAASC,OAAT,6BACA,OAGEC,mBAHF,CAIEC,iBAJF,kB,GAOMC,sBAAqB,CAAGN,EAAE,CAAC,qBAAD,C,CAE1BO,0BAAuC,CAAG,CAC9C,YAD8C,CAE9C,aAF8C,CAG9C,SAH8C,CAI9C,YAJ8C,C,CAM1CC,4BAAyC,CAAG,CAChD,YADgD,CAEhD,UAFgD,CAGhD,eAHgD,CAIhD,gBAJgD,C,CAO5CC,kBAAkB,CAAG,SACzBC,CADyB,CAEzBC,CAFyB,CAGzBC,CAHyB,CAItB,CACH,GAAIA,CAAJ,CAAc,MAAO,qBAAC,YAAD,EAAc,IAAI,CAAED,CAApB,EAAP,CACd,GAAI,CAACD,CAAL,CAAY,MAAO,KAAP,CAEZ,GAAqB,QAAjB,QAAOA,EAA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,EAKGE,CAAK,EACJ,oBAAC,IAAD,EACE,SAAS,CAAEb,qBAAqB,CAAC,OAAD,CADlC,CAEE,GAAG,CAAEyB,CAFP,CAGE,IAAI,CAAEpB,CAHR,CAIE,YAAY,CAAEmB,CAAiB,CAACM,EAJlC,CAKE,UAAU,CAAW,GAAT,GAAAzB,CAAI,CAAW,IAAX,CAAkBA,CALpC,CAME,IAAI,CAAC,SANP,EAQGQ,CARH,CANJ,CAiBGF,CAjBH,CAfJ,CADF,CAqCGC,CAAc,EAAIW,CAAlB,EACC,oBAAC,OAAD,EACE,GAAG,CAAEG,CADP,CAEE,SAAS,CAAEb,CAAK,EAAIF,CAAT,CAAmBc,CAAnB,CAA+BR,CAF5C,CAGE,SAAS,CAAEjB,qBAAqB,CAAC,SAAD,CAHlC,CAIE,SAAS,CAAgB,YAAd,GAAAe,CAAS,CAAoB,YAApB,CAAmC,QAJzD,CAKE,KAAK,CAAE,CAAEwB,MAAM,CAAEnB,CAAV,CALT,CAME,aAAa,GANf,CAOE,kBAAkB,CACF,YAAd,GAAAL,CAAS,CACLb,4BADK,CAELD,0BAVR,EAaGW,CAbH,CAtCJ,CAwDH,CAzGD,CADK"}
1
+ {"version":3,"file":"ProgressStepBarItem.js","names":["React","useMemo","useRef","useForkRef","useMouseLeave","useFlag","cnMixFocus","cn","ProgressSpin","Text","Tooltip","propPositionDefault","propStatusDefault","cnProgressStepBarItem","possibleVerticalDirections","possibleHorizontalDirections","renderPointContent","point","size","progress","ProgressStepBarItem","forwardRef","props","ref","content","tooltipContent","label","status","direction","pointRefProp","pointRef","onClick","position","tooltipZIndex","className","otherProps","isTooltipVisible","setTooltipVisible","anchorRef","tooltipRef","pointForkedRef","pointProps","onMouseEnter","on","pointer","children","tooltipDirection","possibleDirections","spareDirection","isActive","refs","handler","off","debounce","bottomOffset","zIndex"],"sources":["../../../../../../src/components/ProgressStepBar/ProgressStepBarItem/ProgressStepBarItem.tsx"],"sourcesContent":["import './ProgressStepBarItem.css';\n\nimport { IconComponent } from '@consta/icons/Icon';\nimport React, { useMemo, useRef } from 'react';\n\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { useMouseLeave } from '##/hooks/useMouseLeave';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { cnMixFocus } from '../../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../../utils/bem';\nimport { Direction } from '../../Popover/Popover';\nimport { ProgressSpin } from '../../ProgressSpin/ProgressSpin';\nimport { Text } from '../../Text/Text';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport {\n PointNumbersMap,\n ProgressStepBarItemComponent,\n propPositionDefault,\n propStatusDefault,\n} from '../helpers';\n\nconst cnProgressStepBarItem = cn('ProgressStepBarItem');\n\nconst possibleVerticalDirections: Direction[] = [\n 'leftCenter',\n 'rightCenter',\n 'rightUp',\n 'downCenter',\n];\nconst possibleHorizontalDirections: Direction[] = [\n 'downCenter',\n 'upCenter',\n 'downStartLeft',\n 'downStartRight',\n];\n\nconst renderPointContent = (\n point: PointNumbersMap | IconComponent | undefined,\n size: 'm' | 's',\n progress: boolean | undefined,\n) => {\n if (progress) return <ProgressSpin size={size} />;\n if (!point) return null;\n\n if (typeof point === 'number') {\n return (\n <Text\n className={cnProgressStepBarItem('PointText')}\n size={size === 's' ? '2xs' : 'xs'}\n weight=\"bold\"\n >\n {point}\n </Text>\n );\n }\n\n const Icon = point;\n\n return <Icon className={cnProgressStepBarItem('PointIcon')} size=\"xs\" />;\n};\n\nexport const ProgressStepBarItem: ProgressStepBarItemComponent =\n React.forwardRef((props, ref) => {\n const {\n content,\n tooltipContent,\n label,\n point,\n status,\n progress,\n direction,\n size,\n pointRef: pointRefProp,\n onClick,\n position = propPositionDefault,\n tooltipZIndex,\n className,\n ...otherProps\n } = props;\n\n const [isTooltipVisible, setTooltipVisible] = useFlag();\n\n const anchorRef = useRef<HTMLDivElement>(null);\n const tooltipRef = useRef<HTMLDivElement>(null);\n const pointRef = useRef<HTMLButtonElement>(null);\n\n const pointForkedRef = useForkRef([pointRef, pointRefProp]);\n\n const pointProps = {\n onMouseEnter: setTooltipVisible.on,\n className: cnProgressStepBarItem(\n 'Point',\n {\n size,\n pointer: !!onClick,\n },\n [onClick ? cnMixFocus() : undefined],\n ),\n children: size !== 'xs' && renderPointContent(point, size, progress),\n ref: pointForkedRef,\n onClick,\n };\n\n const { tooltipDirection, possibleDirections, spareDirection } = useMemo<{\n tooltipDirection: Direction;\n possibleDirections: Direction[];\n spareDirection: Direction;\n }>(() => {\n if (direction === 'vertical') {\n return {\n tooltipDirection: 'leftUp',\n possibleDirections: possibleVerticalDirections,\n spareDirection: 'rightCenter',\n };\n }\n let spareDirection: Direction = 'downCenter';\n if (position === 'start') {\n spareDirection = 'rightCenter';\n }\n if (position === 'end') {\n spareDirection = 'leftCenter';\n }\n return {\n tooltipDirection: 'downCenter',\n possibleDirections: possibleHorizontalDirections,\n spareDirection,\n };\n }, [direction, position]);\n\n useMouseLeave({\n isActive: isTooltipVisible,\n refs: [anchorRef, pointRef, tooltipRef],\n handler: setTooltipVisible.off,\n debounce: 100,\n });\n\n return (\n <>\n <div\n ref={ref}\n className={cnProgressStepBarItem(\n {\n direction,\n position,\n status: status || propStatusDefault,\n size,\n },\n [className],\n )}\n {...otherProps}\n >\n <button tabIndex={-1} type=\"button\" {...pointProps} />\n {(label || content) && (\n <div\n className={cnProgressStepBarItem('Content', {\n bottomOffset: !!content,\n })}\n >\n {label && (\n <Text\n className={cnProgressStepBarItem('Label')}\n ref={anchorRef}\n size={size}\n onMouseEnter={setTooltipVisible.on}\n lineHeight={size === 's' ? 'xs' : size}\n view=\"primary\"\n >\n {label}\n </Text>\n )}\n {content}\n </div>\n )}\n </div>\n {tooltipContent && isTooltipVisible && (\n <Tooltip\n ref={tooltipRef}\n anchorRef={pointRef}\n className={cnProgressStepBarItem('Tooltip')}\n direction={tooltipDirection}\n style={{ zIndex: tooltipZIndex }}\n isInteractive={false}\n possibleDirections={possibleDirections}\n spareDirection={spareDirection}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AEX,qBAAqB,CAAC,SAAD,CAAY,CAC1CyC,YAAY,CAAE,CAAC,CAAC9B,CAD0B,CAAZ,CADlC,EAKGE,CAAK,EACJ,oBAAC,IAAD,EACE,SAAS,CAAEb,qBAAqB,CAAC,OAAD,CADlC,CAEE,GAAG,CAAEyB,CAFP,CAGE,IAAI,CAAEpB,CAHR,CAIE,YAAY,CAAEmB,CAAiB,CAACM,EAJlC,CAKE,UAAU,CAAW,GAAT,GAAAzB,CAAI,CAAW,IAAX,CAAkBA,CALpC,CAME,IAAI,CAAC,SANP,EAQGQ,CARH,CANJ,CAiBGF,CAjBH,CAfJ,CADF,CAqCGC,CAAc,EAAIW,CAAlB,EACC,oBAAC,OAAD,EACE,GAAG,CAAEG,CADP,CAEE,SAAS,CAAET,CAFb,CAGE,SAAS,CAAEjB,qBAAqB,CAAC,SAAD,CAHlC,CAIE,SAAS,CAAEiC,CAJb,CAKE,KAAK,CAAE,CAAES,MAAM,CAAEtB,CAAV,CALT,CAME,aAAa,GANf,CAOE,kBAAkB,CAAEc,CAPtB,CAQE,cAAc,CAAEC,CARlB,EAUGvB,CAVH,CAtCJ,CAqDH,CAhID,CADK"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["lines","activeStepIndex","size","direction"];import"./ProgressStepBarLine.css";import React from"react";import{cn}from"../../../utils/bem";var cnProgressStepBarLine=cn("ProgressStepBarLine"),getActiveLineSize=function(a,b){var c=b.map(function(a){var b=a.size;return b}),d=a?Math.max(a,0):void 0;return"number"!=typeof d||0===d?0:c.splice(0,d).reduce(function(c,a){return c+a})},getPathParams=function(a,b){var c=[],d=0;return a.forEach(function(a){var e=a.size,f=a.status;c.push({width:"horizontal"===b?e:"var(--progress-step-bar-line-width)",height:"horizontal"===b?"var(--progress-step-bar-line-height)":e,x:"horizontal"===b?d:0,y:"horizontal"===b?0:d,fill:"var(--color-bg-".concat(f||"normal",")")}),d+=e}),c};export var ProgressStepBarLine=function(a){var b,c=a.lines,d=a.activeStepIndex,e=a.size,f=a.direction,g=_objectWithoutProperties(a,_excluded),h=c.map(function(a){var b=a.size;return b}).reduce(function(c,a){return c+a}),i=getActiveLineSize(d,c);return React.createElement("div",Object.assign({},g,{className:cnProgressStepBarLine({size:e,direction:f}),style:(b={},_defineProperty(b,"--line-size","".concat(h,"px")),_defineProperty(b,"--line-active-size","".concat(i,"px")),b)}),React.createElement("svg",{className:cnProgressStepBarLine("Svg"),width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg"},getPathParams(c,f).map(function(a,b){var c=a.fill,d=a.height,e=a.width,f=a.x,g=a.y;return React.createElement("rect",{key:b,style:{height:d,width:e,fill:c},x:f,y:g})})))};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["lines","activeStepIndex","size","direction"];import"./ProgressStepBarLine.css";import React from"react";import{cn}from"../../../utils/bem";var cnProgressStepBarLine=cn("ProgressStepBarLine"),getActiveLineSize=function(a,b){var c=b.map(function(a){var b=a.size;return b}),d=a?Math.max(a,0):void 0;return"number"!=typeof d||0===d?0:c.splice(0,d).reduce(function(c,a){return c+a},0)},getPathParams=function(a,b){var c=[],d=0;return a.forEach(function(a){var e=a.size,f=a.status;c.push({width:"horizontal"===b?e:"var(--progress-step-bar-line-width)",height:"horizontal"===b?"var(--progress-step-bar-line-height)":e,x:"horizontal"===b?d:0,y:"horizontal"===b?0:d,fill:"var(--color-bg-".concat(f||"normal",")")}),d+=e}),c};export var ProgressStepBarLine=function(a){var b,c=a.lines,d=a.activeStepIndex,e=a.size,f=a.direction,g=_objectWithoutProperties(a,_excluded),h=c.map(function(a){var b=a.size;return b}).reduce(function(c,a){return c+a},0),i=getActiveLineSize(d,c);return React.createElement("div",Object.assign({},g,{className:cnProgressStepBarLine({size:e,direction:f}),style:(b={},_defineProperty(b,"--line-size","".concat(h,"px")),_defineProperty(b,"--line-active-size","".concat(i,"px")),b)}),React.createElement("svg",{className:cnProgressStepBarLine("Svg"),width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg"},getPathParams(c,f).map(function(a,b){var c=a.fill,d=a.height,e=a.width,f=a.x,g=a.y;return React.createElement("rect",{key:b,style:{height:d,width:e,fill:c},x:f,y:g})})))};
2
2
  //# sourceMappingURL=ProgressStepBarLine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgressStepBarLine.js","names":["React","cn","cnProgressStepBarLine","getActiveLineSize","activeStepIndex","lines","lineSizes","map","size","active","Math","max","splice","reduce","a","b","getPathParams","direction","paths","width","forEach","status","push","height","x","y","fill","ProgressStepBarLine","props","otherProps","lineSize","activeLineSize","index"],"sources":["../../../../../../src/components/ProgressStepBar/ProgressStepBarLine/ProgressStepBarLine.tsx"],"sourcesContent":["import './ProgressStepBarLine.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { Line, PropDirection, PropSize } from '../helpers';\n\ntype ProgressStepBarLineProps = {\n lines: Line[];\n size: PropSize;\n direction: PropDirection;\n activeStepIndex?: number;\n};\n\nconst cnProgressStepBarLine = cn('ProgressStepBarLine');\n\nconst getActiveLineSize = (\n activeStepIndex: number | undefined,\n lines: Line[],\n) => {\n const lineSizes = lines.map(({ size }) => size);\n const active = activeStepIndex ? Math.max(activeStepIndex, 0) : undefined;\n if (typeof active !== 'number' || active === 0) {\n return 0;\n }\n\n return lineSizes.splice(0, active).reduce((a, b) => a + b);\n};\n\ntype PathItem = {\n fill: string;\n height: string | number;\n width: string | number;\n x: number;\n y: number;\n};\nconst getPathParams = (lines: Line[], direction: PropDirection) => {\n const paths: PathItem[] = [];\n let width = 0;\n lines.forEach(({ size, status }) => {\n paths.push({\n width:\n direction === 'horizontal'\n ? size\n : 'var(--progress-step-bar-line-width)',\n height:\n direction === 'horizontal'\n ? 'var(--progress-step-bar-line-height)'\n : size,\n x: direction === 'horizontal' ? width : 0,\n y: direction === 'horizontal' ? 0 : width,\n fill: `var(--color-bg-${status || 'normal'})`,\n });\n width += size;\n });\n return paths;\n};\n\nexport const ProgressStepBarLine = (props: ProgressStepBarLineProps) => {\n const { lines, activeStepIndex, size, direction, ...otherProps } = props;\n const lineSize = lines.map(({ size }) => size).reduce((a, b) => a + b);\n const activeLineSize = getActiveLineSize(activeStepIndex, lines);\n\n return (\n <div\n {...otherProps}\n className={cnProgressStepBarLine({ size, direction })}\n style={{\n ['--line-size' as string]: `${lineSize}px`,\n ['--line-active-size' as string]: `${activeLineSize}px`,\n }}\n >\n <svg\n className={cnProgressStepBarLine('Svg')}\n width=\"100%\"\n height=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {getPathParams(lines, direction).map(\n ({ fill, height, width, x, y }, index) => (\n <rect key={index} style={{ height, width, fill }} x={x} y={y} />\n ),\n )}\n </svg>\n </div>\n );\n};\n"],"mappings":"qNAAA,kCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0B,GAUMC,sBAAqB,CAAGD,EAAE,CAAC,qBAAD,C,CAE1BE,iBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IACGC,EAAS,CAAGD,CAAK,CAACE,GAAN,CAAU,eAAGC,EAAH,GAAGA,IAAH,OAAcA,EAAd,CAAV,CADf,CAEGC,CAAM,CAAGL,CAAe,CAAGM,IAAI,CAACC,GAAL,CAASP,CAAT,CAA0B,CAA1B,CAAH,OAF3B,OAGmB,QAAlB,QAAOK,EAAP,EAAyC,CAAX,GAAAA,CAH/B,CAIM,CAJN,CAOIH,CAAS,CAACM,MAAV,CAAiB,CAAjB,CAAoBH,CAApB,EAA4BI,MAA5B,CAAmC,SAACC,CAAD,CAAIC,CAAJ,QAAUD,EAAC,CAAGC,CAAd,CAAnC,CACR,C,CASKC,aAAa,CAAG,SAACX,CAAD,CAAgBY,CAAhB,CAA6C,IAC3DC,EAAiB,CAAG,EADuC,CAE7DC,CAAK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AE7B,qBAAqB,CAAC,KAAD,CADlC,CAEE,KAAK,CAAC,MAFR,CAGE,MAAM,CAAC,MAHT,CAIE,KAAK,CAAC,4BAJR,EAMGc,aAAa,CAACX,CAAD,CAAQY,CAAR,CAAb,CAAgCV,GAAhC,CACC,WAAgCyB,CAAhC,KAAGN,EAAH,GAAGA,IAAH,CAASH,CAAT,GAASA,MAAT,CAAiBJ,CAAjB,GAAiBA,KAAjB,CAAwBK,CAAxB,GAAwBA,CAAxB,CAA2BC,CAA3B,GAA2BA,CAA3B,OACE,6BAAM,GAAG,CAAEO,CAAX,CAAkB,KAAK,CAAE,CAAET,MAAM,CAANA,CAAF,CAAUJ,KAAK,CAALA,CAAV,CAAiBO,IAAI,CAAJA,CAAjB,CAAzB,CAAkD,CAAC,CAAEF,CAArD,CAAwD,CAAC,CAAEC,CAA3D,EADF,CADD,CANH,CARF,CAsBH,CA5BM"}
1
+ {"version":3,"file":"ProgressStepBarLine.js","names":["React","cn","cnProgressStepBarLine","getActiveLineSize","activeStepIndex","lines","lineSizes","map","size","active","Math","max","splice","reduce","a","b","getPathParams","direction","paths","width","forEach","status","push","height","x","y","fill","ProgressStepBarLine","props","otherProps","lineSize","activeLineSize","index"],"sources":["../../../../../../src/components/ProgressStepBar/ProgressStepBarLine/ProgressStepBarLine.tsx"],"sourcesContent":["import './ProgressStepBarLine.css';\n\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { Line, PropDirection, PropSize } from '../helpers';\n\ntype ProgressStepBarLineProps = {\n lines: Line[];\n size: PropSize;\n direction: PropDirection;\n activeStepIndex?: number;\n};\n\nconst cnProgressStepBarLine = cn('ProgressStepBarLine');\n\nconst getActiveLineSize = (\n activeStepIndex: number | undefined,\n lines: Line[],\n) => {\n const lineSizes = lines.map(({ size }) => size);\n const active = activeStepIndex ? Math.max(activeStepIndex, 0) : undefined;\n if (typeof active !== 'number' || active === 0) {\n return 0;\n }\n\n return lineSizes.splice(0, active).reduce((a, b) => a + b, 0);\n};\n\ntype PathItem = {\n fill: string;\n height: string | number;\n width: string | number;\n x: number;\n y: number;\n};\nconst getPathParams = (lines: Line[], direction: PropDirection) => {\n const paths: PathItem[] = [];\n let width = 0;\n lines.forEach(({ size, status }) => {\n paths.push({\n width:\n direction === 'horizontal'\n ? size\n : 'var(--progress-step-bar-line-width)',\n height:\n direction === 'horizontal'\n ? 'var(--progress-step-bar-line-height)'\n : size,\n x: direction === 'horizontal' ? width : 0,\n y: direction === 'horizontal' ? 0 : width,\n fill: `var(--color-bg-${status || 'normal'})`,\n });\n width += size;\n });\n return paths;\n};\n\nexport const ProgressStepBarLine = (props: ProgressStepBarLineProps) => {\n const { lines, activeStepIndex, size, direction, ...otherProps } = props;\n const lineSize = lines.map(({ size }) => size).reduce((a, b) => a + b, 0);\n const activeLineSize = getActiveLineSize(activeStepIndex, lines);\n\n return (\n <div\n {...otherProps}\n className={cnProgressStepBarLine({ size, direction })}\n style={{\n ['--line-size' as string]: `${lineSize}px`,\n ['--line-active-size' as string]: `${activeLineSize}px`,\n }}\n >\n <svg\n className={cnProgressStepBarLine('Svg')}\n width=\"100%\"\n height=\"100%\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {getPathParams(lines, direction).map(\n ({ fill, height, width, x, y }, index) => (\n <rect key={index} style={{ height, width, fill }} x={x} y={y} />\n ),\n )}\n </svg>\n </div>\n );\n};\n"],"mappings":"qNAAA,kCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0B,GAUMC,sBAAqB,CAAGD,EAAE,CAAC,qBAAD,C,CAE1BE,iBAAiB,CAAG,SACxBC,CADwB,CAExBC,CAFwB,CAGrB,IACGC,EAAS,CAAGD,CAAK,CAACE,GAAN,CAAU,eAAGC,EAAH,GAAGA,IAAH,OAAcA,EAAd,CAAV,CADf,CAEGC,CAAM,CAAGL,CAAe,CAAGM,IAAI,CAACC,GAAL,CAASP,CAAT,CAA0B,CAA1B,CAAH,OAF3B,OAGmB,QAAlB,QAA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AArC,CAAsD,CAAtD,CAFqD,CAGhEgB,CAAc,CAAG5B,iBAAiB,CAACC,CAAD,CAAkBC,CAAlB,CAH8B,CAKtE,MACE,4CACMwB,CADN,EAEE,SAAS,CAAE3B,qBAAqB,CAAC,CAAEM,IAAI,CAAJA,CAAF,CAAQS,SAAS,CAATA,CAAR,CAAD,CAFlC,CAGE,KAAK,yBACF,aADE,WAC2Ba,CAD3B,0BAEF,oBAFE,WAEkCC,CAFlC,UAHP,GAQE,2BACE,SAAS,CAAE7B,qBAAqB,CAAC,KAAD,CADlC,CAEE,KAAK,CAAC,MAFR,CAGE,MAAM,CAAC,MAHT,CAIE,KAAK,CAAC,4BAJR,EAMGc,aAAa,CAACX,CAAD,CAAQY,CAAR,CAAb,CAAgCV,GAAhC,CACC,WAAgCyB,CAAhC,KAAGN,EAAH,GAAGA,IAAH,CAASH,CAAT,GAASA,MAAT,CAAiBJ,CAAjB,GAAiBA,KAAjB,CAAwBK,CAAxB,GAAwBA,CAAxB,CAA2BC,CAA3B,GAA2BA,CAA3B,OACE,6BAAM,GAAG,CAAEO,CAAX,CAAkB,KAAK,CAAE,CAAET,MAAM,CAANA,CAAF,CAAUJ,KAAK,CAALA,CAAV,CAAiBO,IAAI,CAAJA,CAAjB,CAAzB,CAAkD,CAAC,CAAEF,CAArD,CAAwD,CAAC,CAAEC,CAA3D,EADF,CADD,CANH,CARF,CAsBH,CA5BM"}
@@ -1 +1 @@
1
- .RadioGroup{display:flex}.RadioGroup_direction_column{flex-direction:column}.RadioGroup_direction_column .RadioGroup-Item:not(:last-child){margin-bottom:var(--offset)}.RadioGroup_direction_row{flex-direction:row}.RadioGroup_direction_row .RadioGroup-Item:not(:last-child){margin-right:var(--offset)}.RadioGroup_size_xs{--offset:var(--space-3xs)}.RadioGroup_size_s{--offset:var(--space-2xs)}.RadioGroup_size_m{--offset:var(--space-xs)}.RadioGroup_size_l{--offset:var(--space-s)}
1
+ .RadioGroup{display:flex}.RadioGroup_direction_column{flex-direction:column}.RadioGroup_direction_column .RadioGroup-Item:not(:last-child){margin-bottom:var(--offset)}.RadioGroup_direction_row{flex-direction:row}.RadioGroup_direction_row .RadioGroup-Item:not(:last-child){margin-right:var(--offset)}.RadioGroup_size_xs{--offset:var(--space-2xs)}.RadioGroup_size_m,.RadioGroup_size_s{--offset:var(--space-xs)}.RadioGroup_size_l{--offset:var(--space-s)}
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["value","items","getItemLabel","getItemDisabled","onChange","name","direction","size","view","align","disabled","className"];import"./RadioGroup.css";import React,{forwardRef}from"react";import{useChoiceGroup}from"../../hooks/useChoiceGroup/useChoiceGroup";import{cn}from"../../utils/bem";import{Radio}from"../Radio/Radio";import{withDefaultGetters}from"./helper";import{radioGroupDefaultDirection,radioGroupDefaultSize,radioGroupDefaultView,radioGroupPropAlignDefault}from"./types";export var cnRadioGroup=cn("RadioGroup");var RadioGroupRender=function(a,b){var c=withDefaultGetters(a),d=c.value,e=void 0===d?null:d,f=c.items,g=c.getItemLabel,h=c.getItemDisabled,i=c.onChange,j=c.name,k=c.direction,l=void 0===k?radioGroupDefaultDirection:k,m=c.size,n=void 0===m?radioGroupDefaultSize:m,o=c.view,p=void 0===o?radioGroupDefaultView:o,q=c.align,r=void 0===q?radioGroupPropAlignDefault:q,s=c.disabled,t=c.className,u=_objectWithoutProperties(c,_excluded),v=useChoiceGroup({value:e,getKey:g,callBack:i,multiple:!1}),w=v.getOnChange,x=v.getChecked;return React.createElement("div",Object.assign({},u,{ref:b,className:cnRadioGroup({direction:l,size:n,view:p},[t])}),f.map(function(a){return React.createElement(Radio,{align:r,key:g(a),label:g(a),size:n,view:p,name:j,disabled:void 0!==s&&s||!!h&&h(a),checked:x(a),onChange:function(b){var c=b.e;return w(a)(c)},className:cnRadioGroup("Item")})}))};export var RadioGroup=forwardRef(RadioGroupRender);export*from"./types";
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["value","items","getItemLabel","getItemKey","getItemDisabled","onChange","name","direction","size","view","align","disabled","className"];import"./RadioGroup.css";import React,{forwardRef}from"react";import{useChoiceGroup}from"../../hooks/useChoiceGroup/useChoiceGroup";import{cn}from"../../utils/bem";import{Radio}from"../Radio/Radio";import{withDefaultGetters}from"./helper";import{radioGroupDefaultDirection,radioGroupDefaultSize,radioGroupDefaultView,radioGroupPropAlignDefault}from"./types";export var cnRadioGroup=cn("RadioGroup");var RadioGroupRender=function(a,b){var c=withDefaultGetters(a),d=c.value,e=void 0===d?null:d,f=c.items,g=c.getItemLabel,h=c.getItemKey,i=c.getItemDisabled,j=c.onChange,k=c.name,l=c.direction,m=void 0===l?radioGroupDefaultDirection:l,n=c.size,o=void 0===n?radioGroupDefaultSize:n,p=c.view,q=void 0===p?radioGroupDefaultView:p,r=c.align,s=void 0===r?radioGroupPropAlignDefault:r,t=c.disabled,u=c.className,v=_objectWithoutProperties(c,_excluded),w=useChoiceGroup({value:e,getKey:function getKey(a){var b;return null!==(b=h(a))&&void 0!==b?b:g(a)},callBack:j,multiple:!1}),x=w.getOnChange,y=w.getChecked;return React.createElement("div",Object.assign({},v,{ref:b,className:cnRadioGroup({direction:m,size:o,view:q},[u])}),f.map(function(a){var b;return React.createElement(Radio,{align:s,key:null!==(b=h(a))&&void 0!==b?b:g(a),label:g(a),size:o,view:q,name:k,disabled:void 0!==t&&t||!!i&&i(a),checked:y(a),onChange:function(b){var c=b.e;return x(a)(c)},className:cnRadioGroup("Item")})}))};export var RadioGroup=forwardRef(RadioGroupRender);export*from"./types";
2
2
  //# sourceMappingURL=RadioGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.js","names":["React","forwardRef","useChoiceGroup","cn","Radio","withDefaultGetters","radioGroupDefaultDirection","radioGroupDefaultSize","radioGroupDefaultView","radioGroupPropAlignDefault","cnRadioGroup","RadioGroupRender","props","ref","value","items","getItemLabel","getItemDisabled","onChange","name","direction","size","view","align","disabled","className","otherProps","getKey","callBack","multiple","getOnChange","getChecked","map","item","e","RadioGroup"],"sources":["../../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import './RadioGroup.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { useChoiceGroup } from '../../hooks/useChoiceGroup/useChoiceGroup';\nimport { cn } from '../../utils/bem';\nimport { Radio } from '../Radio/Radio';\nimport { withDefaultGetters } from './helper';\nimport {\n RadioGroupComponent,\n radioGroupDefaultDirection,\n radioGroupDefaultSize,\n radioGroupDefaultView,\n radioGroupPropAlignDefault,\n RadioGroupProps,\n} from './types';\n\nexport const cnRadioGroup = cn('RadioGroup');\n\nconst RadioGroupRender = (\n props: RadioGroupProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n value = null,\n items,\n getItemLabel,\n getItemDisabled,\n onChange,\n name,\n direction = radioGroupDefaultDirection,\n size = radioGroupDefaultSize,\n view = radioGroupDefaultView,\n align = radioGroupPropAlignDefault,\n disabled = false,\n className,\n ...otherProps\n } = withDefaultGetters(props);\n\n const { getOnChange, getChecked } = useChoiceGroup({\n value,\n getKey: getItemLabel,\n callBack: onChange,\n multiple: false,\n });\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnRadioGroup({ direction, size, view }, [className])}\n >\n {items.map((item) => (\n <Radio\n align={align}\n key={getItemLabel(item)}\n label={getItemLabel(item)}\n size={size}\n view={view}\n name={name}\n disabled={disabled || (!!getItemDisabled && getItemDisabled(item))}\n checked={getChecked(item)}\n onChange={({ e }) => getOnChange(item)(e)}\n className={cnRadioGroup('Item')}\n />\n ))}\n </div>\n );\n};\n\nexport const RadioGroup = forwardRef(RadioGroupRender) as RadioGroupComponent;\n\nexport * from './types';\n"],"mappings":"iOAAA,yBAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,cAAT,iDACA,OAASC,EAAT,uBACA,OAASC,KAAT,sBACA,OAASC,kBAAT,gBACA,OAEEC,0BAFF,CAGEC,qB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Q,CAAE,eAAa,CAAC,CAACF,CAAF,EAAqBA,CAAe,CAACgB,CAAD,CAP7D,CAQE,OAAO,CAAEF,CAAU,CAACE,CAAD,CARrB,CASE,QAAQ,CAAE,eAAGC,EAAH,GAAGA,CAAH,OAAWJ,EAAW,CAACG,CAAD,CAAX,CAAkBC,CAAlB,CAAX,CATZ,CAUE,SAAS,CAAExB,YAAY,CAAC,MAAD,CAVzB,EADS,CAAV,CALH,CAqBH,CAjDD,CAmDA,MAAO,IAAMyB,WAAU,CAAGlC,UAAU,CAACU,gBAAD,CAA7B,CAEP"}
1
+ {"version":3,"file":"RadioGroup.js","names":["React","forwardRef","useChoiceGroup","cn","Radio","withDefaultGetters","radioGroupDefaultDirection","radioGroupDefaultSize","radioGroupDefaultView","radioGroupPropAlignDefault","cnRadioGroup","RadioGroupRender","props","ref","value","items","getItemLabel","getItemKey","getItemDisabled","onChange","name","direction","size","view","align","disabled","className","otherProps","getKey","item","callBack","multiple","getOnChange","getChecked","map","e","RadioGroup"],"sources":["../../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import './RadioGroup.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { useChoiceGroup } from '../../hooks/useChoiceGroup/useChoiceGroup';\nimport { cn } from '../../utils/bem';\nimport { Radio } from '../Radio/Radio';\nimport { withDefaultGetters } from './helper';\nimport {\n RadioGroupComponent,\n radioGroupDefaultDirection,\n radioGroupDefaultSize,\n radioGroupDefaultView,\n radioGroupPropAlignDefault,\n RadioGroupProps,\n} from './types';\n\nexport const cnRadioGroup = cn('RadioGroup');\n\nconst RadioGroupRender = (\n props: RadioGroupProps,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n value = null,\n items,\n getItemLabel,\n getItemKey,\n getItemDisabled,\n onChange,\n name,\n direction = radioGroupDefaultDirection,\n size = radioGroupDefaultSize,\n view = radioGroupDefaultView,\n align = radioGroupPropAlignDefault,\n disabled = false,\n className,\n ...otherProps\n } = withDefaultGetters(props);\n\n const { getOnChange, getChecked } = useChoiceGroup({\n value,\n getKey: (item) => getItemKey(item) ?? getItemLabel(item),\n callBack: onChange,\n multiple: false,\n });\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnRadioGroup({ direction, size, view }, [className])}\n >\n {items.map((item) => (\n <Radio\n align={align}\n key={getItemKey(item) ?? getItemLabel(item)}\n label={getItemLabel(item)}\n size={size}\n view={view}\n name={name}\n disabled={disabled || (!!getItemDisabled && getItemDisabled(item))}\n checked={getChecked(item)}\n onChange={({ e }) => getOnChange(item)(e)}\n className={cnRadioGroup('Item')}\n />\n ))}\n </div>\n );\n};\n\nexport const RadioGroup = forwardRef(RadioGroupRender) as RadioGroupComponent;\n\nexport * from './types';\n"],"mappings":"8OAAA,yBAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,cAAT,iDACA,OAASC,EAAT,uBACA,OAASC,KAAT,sBACA,OAASC,kBAAT,gBACA,OAEEC,0BAFF,CAGEC,qBAHF,CAIEC,qBAJF,CAKEC,0BALF,eASA,MAAO,IAAMC,aAAY,CAAGP,EAAE,CAAC,YAAD,CAAvB,CAEP,GAAMQ,iBAAgB,CAAG,SACvBC,CADuB,CAEvBC,CAFuB,CAGpB,OAgBCR,kBAAkB,CAACO,CAAD,CAhBnB,KAEDE,KAFC,CAEDA,CAFC,YAEO,IAFP,GAGDC,CAHC,GAGDA,KAHC,CAIDC,CAJC,GAIDA,YAJC,CAKDC,CALC,GAKDA,UALC,CAMDC,CANC,GAMDA,eANC,CAODC,CAPC,GAODA,QAPC,CAQDC,CARC,GAQDA,IARC,KASDC,SATC,CASDA,CATC,YASWf,0BATX,OAUDgB,IAVC,CAUDA,CAVC,YAUMf,qBAVN,OAWDgB,IAXC,CAWDA,CAXC,YAWMf,qBAXN,OAYDgB,KAZC,CAYDA,CAZC,YAYOf,0BAZP,OAaDgB,QAbC,CAcDC,CAdC,GAcDA,SAdC,CAeEC,CAfF,yCAkBiCzB,cAAc,CA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GroupProps } from './types';
2
+ import { RadioGroupDefaultItem, RadioGroupPropGetItemDisabled, RadioGroupPropGetItemKey, RadioGroupPropGetItemLabel, RadioGroupProps } from './types';
3
3
  export declare const withDefaultGetters: (props: RadioGroupProps) => {
4
+ getItemKey: RadioGroupPropGetItemKey<RadioGroupDefaultItem>;
4
5
  getItemLabel: RadioGroupPropGetItemLabel<RadioGroupDefaultItem>;
5
6
  getItemDisabled: RadioGroupPropGetItemDisabled<RadioGroupDefaultItem>;
6
7
  align?: "center" | "top" | undefined;
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var defaultGetItemLabel=function(a){return a.label},defaultGetItemDisabled=function(a){return a.disabled};export var withDefaultGetters=function(a){return _objectSpread(_objectSpread({},a),{},{getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemDisabled:a.getItemDisabled||defaultGetItemDisabled})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}var defaultGetItemKey=function(a){return a.key},defaultGetItemLabel=function(a){return a.label},defaultGetItemDisabled=function(a){return a.disabled};export var withDefaultGetters=function(a){return _objectSpread(_objectSpread({},a),{},{getItemKey:a.getItemKey||defaultGetItemKey,getItemLabel:a.getItemLabel||defaultGetItemLabel,getItemDisabled:a.getItemDisabled||defaultGetItemDisabled})};
2
2
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","names":["defaultGetItemLabel","item","label","defaultGetItemDisabled","disabled","withDefaultGetters","props","getItemLabel","getItemDisabled"],"sources":["../../../../../src/components/RadioGroup/helper.ts"],"sourcesContent":["import {\n RadioGroupDefaultItem,\n RadioGroupPropGetItemDisabled,\n RadioGroupPropGetItemLabel,\n RadioGroupProps,\n} from './types';\n\nconst defaultGetItemLabel: RadioGroupPropGetItemLabel<RadioGroupDefaultItem> = (\n item,\n) => item.label;\nconst defaultGetItemDisabled: RadioGroupPropGetItemDisabled<\n RadioGroupDefaultItem\n> = (item) => item.disabled;\n\nexport const withDefaultGetters = (props: RadioGroupProps) => ({\n ...props,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n});\n"],"mappings":"wqBAOMA,oBAAsE,CAAG,SAC7EC,CAD6E,QAE1EA,EAAI,CAACC,KAFqE,C,CAGzEC,sBAEL,CAAG,SAACF,CAAD,QAAUA,EAAI,CAACG,QAAf,C,CAEJ,MAAO,IAAMC,mBAAkB,CAAG,SAACC,CAAD,wCAC7BA,CAD6B,MAEhCC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsBP,mBAFJ,CAGhCQ,eAAe,CAAEF,CAAK,CAACE,eAAN,EAAyBL,sBAHV,GAA3B"}
1
+ {"version":3,"file":"helper.js","names":["defaultGetItemKey","item","key","defaultGetItemLabel","label","defaultGetItemDisabled","disabled","withDefaultGetters","props","getItemKey","getItemLabel","getItemDisabled"],"sources":["../../../../../src/components/RadioGroup/helper.ts"],"sourcesContent":["import {\n RadioGroupDefaultItem,\n RadioGroupPropGetItemDisabled,\n RadioGroupPropGetItemKey,\n RadioGroupPropGetItemLabel,\n RadioGroupProps,\n} from './types';\n\nconst defaultGetItemKey: RadioGroupPropGetItemKey<RadioGroupDefaultItem> = (\n item,\n) => item.key;\nconst defaultGetItemLabel: RadioGroupPropGetItemLabel<RadioGroupDefaultItem> = (\n item,\n) => item.label;\nconst defaultGetItemDisabled: RadioGroupPropGetItemDisabled<\n RadioGroupDefaultItem\n> = (item) => item.disabled;\n\nexport const withDefaultGetters = (props: RadioGroupProps) => ({\n ...props,\n getItemKey: props.getItemKey || defaultGetItemKey,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n});\n"],"mappings":"wqBAQMA,kBAAkE,CAAG,SACzEC,CADyE,QAEtEA,EAAI,CAACC,GAFiE,C,CAGrEC,mBAAsE,CAAG,SAC7EF,CAD6E,QAE1EA,EAAI,CAACG,KAFqE,C,CAGzEC,sBAEL,CAAG,SAACJ,CAAD,QAAUA,EAAI,CAACK,QAAf,C,CAEJ,MAAO,IAAMC,mBAAkB,CAAG,SAACC,CAAD,wCAC7BA,CAD6B,MAEhCC,UAAU,CAAED,CAAK,CAACC,UAAN,EAAoBT,iBAFA,CAGhCU,YAAY,CAAEF,CAAK,CAACE,YAAN,EAAsBP,mBAHJ,CAIhCQ,eAAe,CAAEH,CAAK,CAACG,eAAN,EAAyBN,sBAJV,GAA3B"}
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';
3
3
  export declare type RadioGroupDefaultItem = {
4
+ key?: string | number;
4
5
  label: string;
5
6
  disabled?: boolean;
6
7
  };
@@ -16,12 +17,14 @@ export declare const radioGroupDefaultView: RadioGroupPropView;
16
17
  export declare const radioGroupPropAlign: readonly ["center", "top"];
17
18
  export declare type RadioGroupPropAlign = typeof radioGroupPropAlign[number];
18
19
  export declare const radioGroupPropAlignDefault: RadioGroupPropAlign;
20
+ export declare type RadioGroupPropGetItemKey<ITEM> = (item: ITEM) => string | number | undefined;
19
21
  export declare type RadioGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;
20
22
  export declare type RadioGroupPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;
21
23
  export declare type RadioGroupProps<ITEM = RadioGroupDefaultItem> = PropsWithHTMLAttributesAndRef<{
22
24
  align?: RadioGroupPropAlign;
23
25
  value?: ITEM | null;
24
26
  items: ITEM[];
27
+ getItemKey?: RadioGroupPropGetItemKey<ITEM>;
25
28
  getItemLabel?: RadioGroupPropGetItemLabel<ITEM>;
26
29
  getItemDisabled?: RadioGroupPropGetItemDisabled<ITEM>;
27
30
  onChange: (props: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":["radioGroupDirections","radioGroupDefaultDirection","radioGroupSizes","radioGroupDefaultSize","radioGroupViews","radioGroupDefaultView","radioGroupPropAlign","radioGroupPropAlignDefault"],"sources":["../../../../../src/components/RadioGroup/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type RadioGroupDefaultItem = {\n label: string;\n disabled?: boolean;\n};\n\nexport const radioGroupDirections = ['column', 'row'] as const;\nexport type RadioGroupDirection = typeof radioGroupDirections[number];\nexport const radioGroupDefaultDirection: RadioGroupDirection =\n radioGroupDirections[0];\n\nexport const radioGroupSizes = ['m', 'l', 'xs', 's'] as const;\nexport type RadioGroupPropSize = typeof radioGroupSizes[number];\nexport const radioGroupDefaultSize: RadioGroupPropSize = radioGroupSizes[0];\n\nexport const radioGroupViews = ['primary', 'ghost'] as const;\nexport type RadioGroupPropView = typeof radioGroupViews[number];\nexport const radioGroupDefaultView: RadioGroupPropView = radioGroupViews[0];\n\nexport const radioGroupPropAlign = ['center', 'top'] as const;\nexport type RadioGroupPropAlign = typeof radioGroupPropAlign[number];\nexport const radioGroupPropAlignDefault: RadioGroupPropAlign =\n radioGroupPropAlign[0];\n\nexport type RadioGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type RadioGroupPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type RadioGroupProps<ITEM = RadioGroupDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n align?: RadioGroupPropAlign;\n value?: ITEM | null;\n items: ITEM[];\n getItemLabel?: RadioGroupPropGetItemLabel<ITEM>;\n getItemDisabled?: RadioGroupPropGetItemDisabled<ITEM>;\n onChange: (props: {\n e: React.ChangeEvent<HTMLInputElement>;\n value: ITEM;\n }) => void;\n name?: string;\n direction?: RadioGroupDirection;\n size?: RadioGroupPropSize;\n view?: RadioGroupPropView;\n disabled?: boolean;\n className?: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: RadioGroupDefaultItem['label'] }\n ? {}\n : {\n getItemLabel: RadioGroupPropGetItemLabel<ITEM>;\n });\n\nexport type RadioGroupComponent = <ITEM = RadioGroupDefaultItem>(\n props: RadioGroupProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"AAOA,MAAO,IAAMA,qBAAoB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA7B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,oBAAoB,CAAC,CAAD,CADf,CAGP,MAAO,IAAME,gBAAe,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,IAAX,CAAiB,GAAjB,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,gBAAe,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA5B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,mBAAmB,CAAC,CAAD,CADd"}
1
+ {"version":3,"file":"types.js","names":["radioGroupDirections","radioGroupDefaultDirection","radioGroupSizes","radioGroupDefaultSize","radioGroupViews","radioGroupDefaultView","radioGroupPropAlign","radioGroupPropAlignDefault"],"sources":["../../../../../src/components/RadioGroup/types.ts"],"sourcesContent":["import { PropsWithHTMLAttributesAndRef } from '../../utils/types/PropsWithHTMLAttributes';\n\nexport type RadioGroupDefaultItem = {\n key?: string | number;\n label: string;\n disabled?: boolean;\n};\n\nexport const radioGroupDirections = ['column', 'row'] as const;\nexport type RadioGroupDirection = typeof radioGroupDirections[number];\nexport const radioGroupDefaultDirection: RadioGroupDirection =\n radioGroupDirections[0];\n\nexport const radioGroupSizes = ['m', 'l', 'xs', 's'] as const;\nexport type RadioGroupPropSize = typeof radioGroupSizes[number];\nexport const radioGroupDefaultSize: RadioGroupPropSize = radioGroupSizes[0];\n\nexport const radioGroupViews = ['primary', 'ghost'] as const;\nexport type RadioGroupPropView = typeof radioGroupViews[number];\nexport const radioGroupDefaultView: RadioGroupPropView = radioGroupViews[0];\n\nexport const radioGroupPropAlign = ['center', 'top'] as const;\nexport type RadioGroupPropAlign = typeof radioGroupPropAlign[number];\nexport const radioGroupPropAlignDefault: RadioGroupPropAlign =\n radioGroupPropAlign[0];\n\nexport type RadioGroupPropGetItemKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type RadioGroupPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type RadioGroupPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\n\nexport type RadioGroupProps<ITEM = RadioGroupDefaultItem> =\n PropsWithHTMLAttributesAndRef<\n {\n align?: RadioGroupPropAlign;\n value?: ITEM | null;\n items: ITEM[];\n getItemKey?: RadioGroupPropGetItemKey<ITEM>;\n getItemLabel?: RadioGroupPropGetItemLabel<ITEM>;\n getItemDisabled?: RadioGroupPropGetItemDisabled<ITEM>;\n onChange: (props: {\n e: React.ChangeEvent<HTMLInputElement>;\n value: ITEM;\n }) => void;\n name?: string;\n direction?: RadioGroupDirection;\n size?: RadioGroupPropSize;\n view?: RadioGroupPropView;\n disabled?: boolean;\n className?: string;\n },\n HTMLDivElement\n > &\n (ITEM extends { label: RadioGroupDefaultItem['label'] }\n ? {}\n : {\n getItemLabel: RadioGroupPropGetItemLabel<ITEM>;\n });\n\nexport type RadioGroupComponent = <ITEM = RadioGroupDefaultItem>(\n props: RadioGroupProps<ITEM>,\n) => React.ReactElement | null;\n"],"mappings":"AAQA,MAAO,IAAMA,qBAAoB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA7B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,oBAAoB,CAAC,CAAD,CADf,CAGP,MAAO,IAAME,gBAAe,CAAG,CAAC,GAAD,CAAM,GAAN,CAAW,IAAX,CAAiB,GAAjB,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,gBAAe,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAxB,CAEP,MAAO,IAAMC,sBAAyC,CAAGD,eAAe,CAAC,CAAD,CAAjE,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,QAAD,CAAW,KAAX,CAA5B,CAEP,MAAO,IAAMC,2BAA+C,CAC1DD,mBAAmB,CAAC,CAAD,CADd"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","renderItem","visibleItems","isLoading","getGroupLabel","notFound"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SelectDropdown.css";import React,{Fragment,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,mapVerticalSpase}from"../../ListCanary";import{cnMixSpace}from"../../../mixs/MixSpace";import{isOptionForCreate,isOptionForSelectAll}from"../../../hooks/useSelect/useSelect";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{Popover}from"../../Popover/Popover";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectItemAll}from"../SelectItemAll/SelectSelectAll";import{SelectLoader}from"../SelectLoader/SelectLoader";export var selectDropdownform=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownform[0];var cnSelectDropdown=cn("SelectDropdown");export var SelectDropdown=function(a){var b=a.controlRef,c=a.size,d=a.getOptionProps,e=a.dropdownRef,f=a.labelForCreate,g=a.className,h=a.labelForNotFound,i=a.labelForEmptyItems,j=a.hasItems,k=!(void 0!==j)||j,l=a.form,m=a.isOpen,n=a.offset,o=void 0===n?"none":n,p=a.renderItem,q=a.visibleItems,r=a.isLoading,s=a.getGroupLabel,t=a.notFound,u=_objectWithoutProperties(a,_excluded),v="round"===l?"increased":"normal",w=useRef(null),x=useMemo(function(){return 0<q.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[q]),y="none"===o?void 0:o;return React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:w,timeout:animateTimeout},function(a){var j=fabricIndex(-1);return React.createElement(Popover,Object.assign({},u,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:y,ref:w,role:"listbox",className:cnSelectDropdown(null,[cnListBox({size:c,form:l,border:!0,shadow:!0}),cnMixPopoverAnimate({animate:a}),g]),equalAnchorWidth:!0}),React.createElement("div",{className:cnSelectDropdown("List",[cnMixSpace({pV:mapVerticalSpase[c]})]),ref:e},r&&React.createElement(SelectLoader,{mode:x?"blur":"empty"}),q.map(function(a){return isOptionForCreate(a)?React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:v},d({index:j(),item:a}))):React.createElement(Fragment,{key:a.key},a.group&&s&&React.createElement(SelectGroupLabel,{label:s(a.group),size:c,indent:v}),a.items.map(function(b,e){return isOptionForSelectAll(b)?React.createElement(SelectItemAll,Object.assign({indent:v,size:c},d({index:j(),item:b}),{intermediate:!!(b.checkedCount&&b.totalCount)&&b.checkedCount!==b.totalCount,checked:b.checkedCount===b.totalCount,countItems:b.checkedCount,total:b.totalCount})):React.createElement(Fragment,{key:"".concat(a.key,"-").concat(e)},p(_objectSpread({item:b},d({index:j(),item:b}))))}))}),!r&&k&&t&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:v},h),!r&&!k&&i&&React.createElement(ListItem,{size:c,label:h,innerOffset:v},i)))})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","renderItem","visibleItems","isLoading","getGroupLabel","notFound"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SelectDropdown.css";import React,{Fragment,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,mapVerticalSpase}from"../../ListCanary";import{cnMixSpace}from"../../../mixs/MixSpace";import{isOptionForCreate,isOptionForSelectAll}from"../../../hooks/useSelect/useSelect";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{Popover}from"../../Popover/Popover";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectItemAll}from"../SelectItemAll/SelectSelectAll";import{SelectLoader}from"../SelectLoader/SelectLoader";export var selectDropdownform=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownform[0];var cnSelectDropdown=cn("SelectDropdown");export var SelectDropdown=function(a){var b=a.controlRef,c=a.size,d=a.getOptionProps,e=a.dropdownRef,f=a.labelForCreate,g=a.className,h=a.labelForNotFound,i=a.labelForEmptyItems,j=a.hasItems,k=!(void 0!==j)||j,l=a.form,m=a.isOpen,n=a.offset,o=void 0===n?"none":n,p=a.renderItem,q=a.visibleItems,r=a.isLoading,s=a.getGroupLabel,t=a.notFound,u=_objectWithoutProperties(a,_excluded),v="round"===l?"increased":"normal",w=useRef(null),x=useMemo(function(){return 0<q.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[q]),y="none"===o?void 0:o;return React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:w,timeout:animateTimeout},function(a){var j=fabricIndex(-1);return React.createElement(Popover,Object.assign({},u,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:y,ref:w,role:"listbox",className:cnSelectDropdown(null,[cnListBox({size:c,form:l,border:!0,shadow:!0}),cnMixPopoverAnimate({animate:a}),g]),equalAnchorWidth:!0}),React.createElement("div",{className:cnSelectDropdown("List",[cnMixSpace({pV:mapVerticalSpase[c]})]),ref:e},r&&React.createElement(SelectLoader,{mode:x?"blur":"empty"}),q.map(function(a){return isOptionForCreate(a)?React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:v},d({index:j(),item:a}))):React.createElement(Fragment,{key:a.key},a.group&&s&&React.createElement(SelectGroupLabel,{label:s(a.group),size:c,indent:v}),a.items.map(function(b,e){return isOptionForSelectAll(b)?React.createElement(SelectItemAll,Object.assign({indent:v,size:c},d({index:j(),item:b}),{intermediate:!!(b.checkedCount&&b.totalCount)&&b.checkedCount!==b.totalCount,checked:b.checkedCount===b.totalCount,countItems:b.checkedCount,total:b.totalCount})):React.createElement(Fragment,{key:"".concat(a.key,"-").concat(e)},p(_objectSpread({item:b},d({index:j(),item:b}))))}))}),!r&&k&&t&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:v},h),!r&&!k&&i&&React.createElement(ListItem,{size:c,label:i,innerOffset:v},i)))})};
2
2
  //# sourceMappingURL=SelectDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useMemo","useRef","Transition","cnListBox","ListItem","mapVerticalSpase","cnMixSpace","isOptionForCreate","isOptionForSelectAll","animateTimeout","cnMixPopoverAnimate","cn","fabricIndex","Popover","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","offsetProp","renderItem","visibleItems","isLoading","getGroupLabel","notFound","otherProps","indent","popoverRef","isListShowed","filter","group","Array","isArray","items","length","animate","getIndex","border","shadow","pV","map","label","index","item","key","i","checkedCount","totalCount"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { SelectAllItem } from '##/utils/getGroups';\n\nimport {\n GetOptionPropsResult,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../../../hooks/useSelect/useSelect';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '../../../mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cn } from '../../../utils/bem';\nimport { fabricIndex } from '../../../utils/fabricIndex';\nimport { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';\nimport { Popover, PopoverPropOffset } from '../../Popover/Popover';\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectSelectAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\n\nexport const selectDropdownform = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownform[number];\nexport const defaultSelectDropdownPropForm = selectDropdownform[0];\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: PropSize;\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.Ref<HTMLDivElement>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n offset?: PopoverPropOffset | 'none';\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => JSX.Element | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n checkedCount?: number;\n totalCount?: number;\n }\n )[];\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?: string;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItems?: boolean;\n}>;\n\ntype SelectDropdown = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nexport const SelectDropdown: SelectDropdown = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItems = true,\n form,\n isOpen,\n offset: offsetProp = 'none',\n renderItem,\n visibleItems,\n isLoading,\n getGroupLabel,\n notFound,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const isListShowed = useMemo(() => {\n return (\n visibleItems.filter(\n (group) =>\n isOptionForCreate(group) ||\n (Array.isArray(group.items) && group.items.length > 0),\n ).length > 0\n );\n }, [visibleItems]);\n\n const offset = offsetProp === 'none' ? undefined : offsetProp;\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex(-1);\n return (\n <Popover\n {...otherProps}\n anchorRef={controlRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset={offset}\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown(null, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n equalAnchorWidth\n >\n <div\n className={cnSelectDropdown('List', [\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n ])}\n ref={dropdownRef}\n >\n {isLoading && (\n <SelectLoader mode={isListShowed ? 'blur' : 'empty'} />\n )}\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n {...getOptionProps({ index: getIndex(), item: group })}\n />\n );\n }\n return (\n <Fragment key={group.key}>\n {group.group && getGroupLabel && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n />\n )}\n {group.items.map((item, i) => {\n if (isOptionForSelectAll(item)) {\n return (\n <SelectItemAll\n indent={indent}\n size={size}\n {...getOptionProps({ index: getIndex(), item })}\n intermediate={\n item.checkedCount && item.totalCount\n ? item.checkedCount !== item.totalCount\n : false\n }\n checked={item.checkedCount === item.totalCount}\n countItems={item.checkedCount}\n total={item.totalCount}\n />\n );\n }\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n item,\n ...getOptionProps({ index: getIndex(), item }),\n })}\n </Fragment>\n );\n })}\n </Fragment>\n );\n })}\n {!isLoading && hasItems && notFound && labelForNotFound && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForNotFound}\n </ListItem>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n </Popover>\n );\n }}\n </Transition>\n );\n};\n"],"mappings":"y+BAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,OAA1B,CAAmCC,MAAnC,KAAiD,OAAjD,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,gBAHF,wBAKA,OAASC,UAAT,8BAGA,OAEEC,iBAFF,CAGEC,oBAHF,0CAOA,OACEC,cADF,CAEEC,mBAFF,y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J,CAAI,CAACG,YAAL,GAAsBH,CAAI,CAACI,UATtC,CAUE,UAAU,CAAEJ,CAAI,CAACG,YAVnB,CAWE,KAAK,CAAEH,CAAI,CAACI,UAXd,GAHwB,CAmB1B,oBAAC,QAAD,EAAU,GAAG,WAAKjB,CAAK,CAACc,GAAX,aAAkBC,CAAlB,CAAb,EACGzB,CAAU,gBACTuB,IAAI,CAAJA,CADS,EAENlC,CAAc,CAAC,CAAEiC,KAAK,CAAEN,CAAQ,EAAjB,CAAqBO,IAAI,CAAJA,CAArB,CAAD,CAFR,EADb,CAOH,CA1BA,CARH,CAqCH,CAlDA,CAXH,CA8DG,CAACrB,CAAD,EAAcP,CAAd,EAA0BS,CAA1B,EAAsCX,CAAtC,EACC,oBAAC,QAAD,EACE,IAAI,CAAEL,CADR,CAEE,KAAK,CAAEK,CAFT,CAGE,WAAW,CAAEa,CAHf,EAKGb,CALH,CA/DJ,CAuEG,CAACS,CAAD,EAAc,CAACP,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEN,CADR,CAEE,KAAK,CAAEK,CAFT,CAGE,WAAW,CAAEa,CAHf,EAKGZ,CALH,CAxEJ,CApBF,CAuGH,CAhHH,CAmHH,CA1JM"}
1
+ {"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useMemo","useRef","Transition","cnListBox","ListItem","mapVerticalSpase","cnMixSpace","isOptionForCreate","isOptionForSelectAll","animateTimeout","cnMixPopoverAnimate","cn","fabricIndex","Popover","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","offsetProp","renderItem","visibleItems","isLoading","getGroupLabel","notFound","otherProps","indent","popoverRef","isListShowed","filter","group","Array","isArray","items","length","animate","getIndex","border","shadow","pV","map","label","index","item","key","i","checkedCount","totalCount"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { SelectAllItem } from '##/utils/getGroups';\n\nimport {\n GetOptionPropsResult,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../../../hooks/useSelect/useSelect';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '../../../mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cn } from '../../../utils/bem';\nimport { fabricIndex } from '../../../utils/fabricIndex';\nimport { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';\nimport { Popover, PopoverPropOffset } from '../../Popover/Popover';\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectSelectAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\n\nexport const selectDropdownform = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownform[number];\nexport const defaultSelectDropdownPropForm = selectDropdownform[0];\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: PropSize;\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.Ref<HTMLDivElement>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n offset?: PopoverPropOffset | 'none';\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => JSX.Element | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n checkedCount?: number;\n totalCount?: number;\n }\n )[];\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?: string;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItems?: boolean;\n}>;\n\ntype SelectDropdown = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nexport const SelectDropdown: SelectDropdown = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItems = true,\n form,\n isOpen,\n offset: offsetProp = 'none',\n renderItem,\n visibleItems,\n isLoading,\n getGroupLabel,\n notFound,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const isListShowed = useMemo(() => {\n return (\n visibleItems.filter(\n (group) =>\n isOptionForCreate(group) ||\n (Array.isArray(group.items) && group.items.length > 0),\n ).length > 0\n );\n }, [visibleItems]);\n\n const offset = offsetProp === 'none' ? undefined : offsetProp;\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex(-1);\n return (\n <Popover\n {...otherProps}\n anchorRef={controlRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset={offset}\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown(null, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n equalAnchorWidth\n >\n <div\n className={cnSelectDropdown('List', [\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n ])}\n ref={dropdownRef}\n >\n {isLoading && (\n <SelectLoader mode={isListShowed ? 'blur' : 'empty'} />\n )}\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n {...getOptionProps({ index: getIndex(), item: group })}\n />\n );\n }\n return (\n <Fragment key={group.key}>\n {group.group && getGroupLabel && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n />\n )}\n {group.items.map((item, i) => {\n if (isOptionForSelectAll(item)) {\n return (\n <SelectItemAll\n indent={indent}\n size={size}\n {...getOptionProps({ index: getIndex(), item })}\n intermediate={\n item.checkedCount && item.totalCount\n ? item.checkedCount !== item.totalCount\n : false\n }\n checked={item.checkedCount === item.totalCount}\n countItems={item.checkedCount}\n total={item.totalCount}\n />\n );\n }\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n item,\n ...getOptionProps({ index: getIndex(), item }),\n })}\n </Fragment>\n );\n })}\n </Fragment>\n );\n })}\n {!isLoading && hasItems && notFound && labelForNotFound && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForNotFound}\n </ListItem>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <ListItem\n size={size}\n label={labelForEmptyItems}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n </Popover>\n );\n }}\n </Transition>\n );\n};\n"],"mappings":"y+BAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,OAA1B,CAAmCC,MAAnC,KAAiD,OAAjD,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,gBAHF,wBAKA,OAASC,UAAT,8BAGA,OAEEC,iBAFF,CAGEC,oBAHF,0CAOA,OACEC,cADF,CAEEC,mBAFF,yDAIA,OAASC,EAAT,0BACA,OAASC,WAAT,kCAEA,OAASC,OAAT,6BACA,OAASC,kBAAT,gDACA,OAASC,gBAAT,4CACA,OAASC,aAAT,wCACA,OAASC,YAAT,oCAGA,MAAO,IAAMC,mBAA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AAU,GAAG,WAAKjB,CAAK,CAACc,GAAX,aAAkBC,CAAlB,CAAb,EACGzB,CAAU,gBACTuB,IAAI,CAAJA,CADS,EAENlC,CAAc,CAAC,CAAEiC,KAAK,CAAEN,CAAQ,EAAjB,CAAqBO,IAAI,CAAJA,CAArB,CAAD,CAFR,EADb,CAOH,CA1BA,CARH,CAqCH,CAlDA,CAXH,CA8DG,CAACrB,CAAD,EAAcP,CAAd,EAA0BS,CAA1B,EAAsCX,CAAtC,EACC,oBAAC,QAAD,EACE,IAAI,CAAEL,CADR,CAEE,KAAK,CAAEK,CAFT,CAGE,WAAW,CAAEa,CAHf,EAKGb,CALH,CA/DJ,CAuEG,CAACS,CAAD,EAAc,CAACP,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEN,CADR,CAEE,KAAK,CAAEM,CAFT,CAGE,WAAW,CAAEY,CAHf,EAKGZ,CALH,CAxEJ,CApBF,CAuGH,CAhHH,CAmHH,CA1JM"}
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["hovered","onHover","value","position","disabled","withTooltip","focused","popoverPosition","buttonRef","handlePress","onKeyPress","tooltipFormatter","buttonLabel","onFocus","tooltipZIndex"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SliderPoint.css";import React,{useEffect,useRef}from"react";import{useFlag}from"../../../hooks/useFlag/useFlag";import{useForkRef}from"../../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../../mixs/MixFocus/MixFocus";import{cn}from"../../../utils/bem";import{generateThemeClassNames,ThemeContext,useTheme}from"../../Theme/Theme";import{Tooltip}from"../../Tooltip/Tooltip";var cnSliderPoint=cn("SliderPoint"),getTooltipPosition=function(a,b){if(a&&b&&b.current){var c=b.current.getBoundingClientRect(),d=c.y,e=c.height;return{x:a.x,y:d-e+30}}return{x:0,y:0}};export var SliderPoint=function(a){var b=a.hovered,c=a.onHover,d=a.value,e=a.position,f=a.disabled,g=a.withTooltip,h=a.focused,i=a.popoverPosition,j=a.buttonRef,k=a.handlePress,l=a.onKeyPress,m=a.tooltipFormatter,n=a.buttonLabel,o=a.onFocus,p=a.tooltipZIndex,q=_objectWithoutProperties(a,_excluded),r=useFlag(!1),s=_slicedToArray(r,2),t=s[0],u=s[1],v=u.on,w=u.off,x=useTheme(),y=x.theme,z=_objectSpread(_objectSpread({},y),{},{color:{primary:y.color.invert,accent:y.color.accent,invert:y.color.primary}}),A=generateThemeClassNames(z);useEffect(function(){h?v():w()},[h]);var B=function(a){f||(null===o||void 0===o?void 0:o(a,n),v())},C=function(a){f||(null===c||void 0===c?void 0:c(a),a&&v(),a&&v(),!a&&!h&&w())},D=useRef(null);return React.createElement(React.Fragment,null,React.createElement("button",Object.assign({type:"button","aria-label":"".concat(n,"-button"),className:cnSliderPoint({hovered:b,disabled:f},[f?"":cnMixFocus()]),onMouseOver:function onMouseOver(){return C(!0)},onMouseOut:function onMouseOut(){return C(!1)},onMouseDown:function onMouseDown(){return null===k||void 0===k?void 0:k(n)},onTouchStart:function onTouchStart(){return null===k||void 0===k?void 0:k(n)},onKeyDown:function onKeyDown(a){return null===l||void 0===l?void 0:l(a,n)},onFocus:B,onBlur:function handleBlur(a){f||(null===o||void 0===o?void 0:o(a,null),w())},onClick:B,ref:useForkRef([j,D]),tabIndex:0,style:_defineProperty({},"--slider-button-left","".concat(e,"%"))},q)),t&&g&&i&&React.createElement(ThemeContext.Provider,{value:{theme:z,themeClassNames:A}},React.createElement(Tooltip,{position:getTooltipPosition(i,j||D),className:cnSliderPoint("Tooltip"),direction:"downCenter",possibleDirections:["downCenter","leftDown","rightDown"],style:{zIndex:p}},m?m(d):d)))};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["hovered","onHover","value","position","disabled","withTooltip","focused","popoverPosition","buttonRef","handlePress","onKeyPress","tooltipFormatter","buttonLabel","onFocus","tooltipZIndex"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SliderPoint.css";import React,{useEffect,useRef}from"react";import{useFlag}from"../../../hooks/useFlag/useFlag";import{useForkRef}from"../../../hooks/useForkRef/useForkRef";import{cnMixFocus}from"../../../mixs/MixFocus/MixFocus";import{cn}from"../../../utils/bem";import{generateThemeClassNames,ThemeContext,useTheme}from"../../Theme/Theme";import{Tooltip}from"../../Tooltip/Tooltip";var cnSliderPoint=cn("SliderPoint"),getTooltipPosition=function(a,b){if(a&&b&&b.current){var c=b.current.getBoundingClientRect(),d=c.y,e=c.height;return{x:Math.round(a.x),y:Math.round(d-e+22)}}return{x:0,y:0}};export var SliderPoint=function(a){var b=a.hovered,c=a.onHover,d=a.value,e=a.position,f=a.disabled,g=a.withTooltip,h=a.focused,i=a.popoverPosition,j=a.buttonRef,k=a.handlePress,l=a.onKeyPress,m=a.tooltipFormatter,n=a.buttonLabel,o=a.onFocus,p=a.tooltipZIndex,q=_objectWithoutProperties(a,_excluded),r=useFlag(!1),s=_slicedToArray(r,2),t=s[0],u=s[1],v=useTheme(),w=v.theme,x=_objectSpread(_objectSpread({},w),{},{color:{primary:w.color.invert,accent:w.color.accent,invert:w.color.primary}}),y=generateThemeClassNames(x),z=function(a){f||(null===o||void 0===o?void 0:o(a,n),u.on())},A=function(a){f||(null===c||void 0===c?void 0:c(a),a&&u.on(),a&&u.on(),!a&&!h&&u.off())},B=useRef(null),C=getTooltipPosition(i,j||B);return useEffect(function(){h?u.on():u.off()},[h]),React.createElement(React.Fragment,null,React.createElement("button",Object.assign({type:"button","aria-label":"".concat(n,"-button"),className:cnSliderPoint({hovered:b,disabled:f},[f?"":cnMixFocus()]),onMouseOver:function onMouseOver(){return A(!0)},onMouseOut:function onMouseOut(){return A(!1)},onMouseDown:function onMouseDown(){return null===k||void 0===k?void 0:k(n)},onTouchStart:function onTouchStart(){return null===k||void 0===k?void 0:k(n)},onKeyDown:function onKeyDown(a){return null===l||void 0===l?void 0:l(a,n)},onFocus:z,onBlur:function handleBlur(a){f||(null===o||void 0===o?void 0:o(a,null),u.off())},onClick:z,ref:useForkRef([j,B]),tabIndex:0,style:_defineProperty({},"--slider-button-left","".concat(e,"%"))},q)),t&&g&&i&&React.createElement(ThemeContext.Provider,{value:{theme:x,themeClassNames:y}},React.createElement(Tooltip,{position:C,className:cnSliderPoint("Tooltip"),direction:"downCenter",possibleDirections:["downCenter","leftDown","rightDown","upCenter"],style:{zIndex:p},offset:8},m?m(d):d)))};
2
2
  //# sourceMappingURL=SliderPoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SliderPoint.js","names":["React","useEffect","useRef","useFlag","useForkRef","cnMixFocus","cn","generateThemeClassNames","ThemeContext","useTheme","Tooltip","cnSliderPoint","getTooltipPosition","popoverPosition","buttonRef","current","getBoundingClientRect","y","height","x","SliderPoint","props","hovered","onHover","value","position","disabled","withTooltip","focused","handlePress","onKeyPress","tooltipFormatter","buttonLabel","onFocus","tooltipZIndex","otherProps","tooltipVisible","on","off","theme","tooltipTheme","color","primary","invert","accent","tooltipThemeClassNames","handleFocus","e","handleMouseAction","enter","pointRef","handleBlur","themeClassNames","zIndex"],"sources":["../../../../../../src/components/Slider/SliderPoint/SliderPoint.tsx"],"sourcesContent":["import './SliderPoint.css';\n\nimport React, { useEffect, useRef } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { useForkRef } from '../../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../../utils/bem';\nimport {\n generateThemeClassNames,\n ThemeContext,\n useTheme,\n} from '../../Theme/Theme';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { SliderPointProps, TrackPosition } from '../helper';\n\nconst cnSliderPoint = cn('SliderPoint');\n\nconst getTooltipPosition = (\n popoverPosition: TrackPosition,\n buttonRef: React.RefObject<HTMLButtonElement>,\n) => {\n if (popoverPosition && buttonRef && buttonRef.current) {\n const { y, height } = buttonRef.current.getBoundingClientRect();\n return {\n x: popoverPosition.x,\n y: y - height + 30,\n };\n }\n return { x: 0, y: 0 };\n};\n\nexport const SliderPoint = (props: SliderPointProps) => {\n const {\n hovered,\n onHover,\n value,\n position,\n disabled,\n withTooltip,\n focused,\n popoverPosition,\n buttonRef,\n handlePress,\n onKeyPress,\n tooltipFormatter,\n buttonLabel,\n onFocus,\n tooltipZIndex,\n ...otherProps\n } = props;\n\n const [tooltipVisible, { on, off }] = useFlag(false);\n\n const { theme } = useTheme();\n\n const tooltipTheme = {\n ...theme,\n color: {\n primary: theme.color.invert,\n accent: theme.color.accent,\n invert: theme.color.primary,\n },\n };\n\n const tooltipThemeClassNames = generateThemeClassNames(tooltipTheme);\n\n useEffect(() => {\n focused ? on() : off();\n }, [focused]);\n\n const handleFocus = (\n e: React.FocusEvent<HTMLButtonElement> | React.MouseEvent,\n ) => {\n if (!disabled) {\n onFocus?.(e, buttonLabel);\n on();\n }\n };\n\n const handleMouseAction = (enter: boolean) => {\n if (!disabled) {\n onHover?.(enter);\n enter && on();\n if (enter) on();\n if (!enter && !focused) off();\n }\n };\n\n const handleBlur = (\n e:\n | React.FocusEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLButtonElement>,\n ) => {\n if (!disabled) {\n onFocus?.(e, null);\n off();\n }\n };\n\n const pointRef = useRef<HTMLButtonElement>(null);\n\n return (\n <>\n <button\n type=\"button\"\n aria-label={`${buttonLabel}-button`}\n className={cnSliderPoint({ hovered, disabled }, [\n !disabled ? cnMixFocus() : '',\n ])}\n onMouseOver={() => handleMouseAction(true)}\n onMouseOut={() => handleMouseAction(false)}\n onMouseDown={() => handlePress?.(buttonLabel)}\n onTouchStart={() => handlePress?.(buttonLabel)}\n onKeyDown={(e) => onKeyPress?.(e, buttonLabel)}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onClick={handleFocus}\n ref={useForkRef([buttonRef, pointRef])}\n tabIndex={0}\n style={{\n ['--slider-button-left' as string]: `${position}%`,\n }}\n {...otherProps}\n />\n {tooltipVisible && withTooltip && popoverPosition && (\n <ThemeContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n theme: tooltipTheme,\n themeClassNames: tooltipThemeClassNames,\n }}\n >\n <Tooltip\n position={getTooltipPosition(\n popoverPosition,\n buttonRef || pointRef,\n )}\n className={cnSliderPoint('Tooltip')}\n direction=\"downCenter\"\n possibleDirections={['downCenter', 'leftDown', 'rightDown']}\n style={{ zIndex: tooltipZIndex }}\n >\n {tooltipFormatter ? tooltipFormatter(value) : value}\n </Tooltip>\n </ThemeContext.Provider>\n )}\n </>\n );\n};\n"],"mappings":"ygCAAA,0BAEA,MAAOA,MAAP,EAAgBC,SAAhB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CAAS,EAAIoC,CAFa,CAD9B,CAKE,SAAS,CAAEvC,aAAa,CAAC,SAAD,CAL1B,CAME,SAAS,CAAC,YANZ,CAOE,kBAAkB,CAAE,CAAC,YAAD,CAAe,UAAf,CAA2B,WAA3B,CAPtB,CAQE,KAAK,CAAE,CAAE0C,MAAM,CAAEnB,CAAV,CART,EAUGH,CAAgB,CAAGA,CAAgB,CAACP,CAAD,CAAnB,CAA6BA,CAVhD,CAPF,CAvBJ,CA8CH,CArHM"}
1
+ {"version":3,"file":"SliderPoint.js","names":["React","useEffect","useRef","useFlag","useForkRef","cnMixFocus","cn","generateThemeClassNames","ThemeContext","useTheme","Tooltip","cnSliderPoint","getTooltipPosition","popoverPosition","buttonRef","current","getBoundingClientRect","y","height","x","Math","round","SliderPoint","props","hovered","onHover","value","position","disabled","withTooltip","focused","handlePress","onKeyPress","tooltipFormatter","buttonLabel","onFocus","tooltipZIndex","otherProps","tooltipVisible","setTooltipVisible","theme","tooltipTheme","color","primary","invert","accent","tooltipThemeClassNames","handleFocus","e","on","handleMouseAction","enter","off","pointRef","tooltipPosition","handleBlur","themeClassNames","zIndex"],"sources":["../../../../../../src/components/Slider/SliderPoint/SliderPoint.tsx"],"sourcesContent":["import './SliderPoint.css';\n\nimport React, { useEffect, useRef } from 'react';\n\nimport { useFlag } from '../../../hooks/useFlag/useFlag';\nimport { useForkRef } from '../../../hooks/useForkRef/useForkRef';\nimport { cnMixFocus } from '../../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../../utils/bem';\nimport {\n generateThemeClassNames,\n ThemeContext,\n useTheme,\n} from '../../Theme/Theme';\nimport { Tooltip } from '../../Tooltip/Tooltip';\nimport { SliderPointProps, TrackPosition } from '../helper';\n\nconst cnSliderPoint = cn('SliderPoint');\n\nconst getTooltipPosition = (\n popoverPosition?: TrackPosition,\n buttonRef?: React.RefObject<HTMLButtonElement>,\n) => {\n if (popoverPosition && buttonRef && buttonRef.current) {\n const { y, height } = buttonRef.current.getBoundingClientRect();\n return {\n x: Math.round(popoverPosition.x),\n y: Math.round(y - height + 22),\n };\n }\n\n return { x: 0, y: 0 };\n};\nexport const SliderPoint = (props: SliderPointProps) => {\n const {\n hovered,\n onHover,\n value,\n position,\n disabled,\n withTooltip,\n focused,\n popoverPosition,\n buttonRef,\n handlePress,\n onKeyPress,\n tooltipFormatter,\n buttonLabel,\n onFocus,\n tooltipZIndex,\n ...otherProps\n } = props;\n\n const [tooltipVisible, setTooltipVisible] = useFlag(false);\n\n const { theme } = useTheme();\n\n const tooltipTheme = {\n ...theme,\n color: {\n primary: theme.color.invert,\n accent: theme.color.accent,\n invert: theme.color.primary,\n },\n };\n\n const tooltipThemeClassNames = generateThemeClassNames(tooltipTheme);\n\n const handleFocus = (\n e: React.FocusEvent<HTMLButtonElement> | React.MouseEvent,\n ) => {\n if (!disabled) {\n onFocus?.(e, buttonLabel);\n setTooltipVisible.on();\n }\n };\n\n const handleMouseAction = (enter: boolean) => {\n if (!disabled) {\n onHover?.(enter);\n enter && setTooltipVisible.on();\n if (enter) setTooltipVisible.on();\n if (!enter && !focused) setTooltipVisible.off();\n }\n };\n\n const handleBlur = (\n e:\n | React.FocusEvent<HTMLButtonElement>\n | React.MouseEvent<HTMLButtonElement>,\n ) => {\n if (!disabled) {\n onFocus?.(e, null);\n setTooltipVisible.off();\n }\n };\n\n const pointRef = useRef<HTMLButtonElement>(null);\n\n const tooltipPosition = getTooltipPosition(\n popoverPosition,\n buttonRef || pointRef,\n );\n\n useEffect(() => {\n focused ? setTooltipVisible.on() : setTooltipVisible.off();\n }, [focused]);\n\n return (\n <>\n <button\n type=\"button\"\n aria-label={`${buttonLabel}-button`}\n className={cnSliderPoint({ hovered, disabled }, [\n !disabled ? cnMixFocus() : '',\n ])}\n onMouseOver={() => handleMouseAction(true)}\n onMouseOut={() => handleMouseAction(false)}\n onMouseDown={() => handlePress?.(buttonLabel)}\n onTouchStart={() => handlePress?.(buttonLabel)}\n onKeyDown={(e) => onKeyPress?.(e, buttonLabel)}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onClick={handleFocus}\n ref={useForkRef([buttonRef, pointRef])}\n tabIndex={0}\n style={{\n ['--slider-button-left' as string]: `${position}%`,\n }}\n {...otherProps}\n />\n {tooltipVisible && withTooltip && popoverPosition && (\n <ThemeContext.Provider\n // eslint-disable-next-line react/jsx-no-constructed-context-values\n value={{\n theme: tooltipTheme,\n themeClassNames: tooltipThemeClassNames,\n }}\n >\n <Tooltip\n position={tooltipPosition}\n className={cnSliderPoint('Tooltip')}\n direction=\"downCenter\"\n possibleDirections={[\n 'downCenter',\n 'leftDown',\n 'rightDown',\n 'upCenter',\n ]}\n style={{ zIndex: tooltipZIndex }}\n offset={8}\n >\n {tooltipFormatter ? tooltipFormatter(value) : value}\n </Tooltip>\n </ThemeContext.Provider>\n )}\n </>\n );\n};\n"],"mappings":"ygCAAA,0BAEA,MAAOA,MAAP,EAAgBC,SAAhB,CAA2BC,MAA3B,KAAyC,OAAzC,CAEA,OAASC,OAAT,sCACA,OAASC,UAAT,4CACA,OAASC,UAAT,uCACA,OAASC,EAAT,0BACA,OACEC,uBADF,CAEEC,YAFF,CAGEC,QAHF,yBAKA,OAASC,OAAT,6B,GAGMC,cAAa,CAAGL,EAAE,CAAC,aAAD,C,CAElBM,kBAAkB,CAAG,SACzBC,CADyB,CAEzBC,CAFyB,CAGtB,CACH,GAAID,CAAe,EAAIC,CAAnB,EAAgCA,CAAS,CAACC,OAA9C,CAAuD,CACrD,MAAsBD,CAAS,CAACC,OAAV,CAAkBC,qBAAlB,EAAtB,CAAQC,CAAR,GAAQA,CAAR,CAAWC,CAAX,GAAWA,MAAX,CACA,MAAO,CACLC,CAAC,CAAEC,IAAI,CAACC,KAAL,CAAWR,CAAe,CAACM,CAA3B,CADE,CAELF,CAAC,CAAEG,IAAI,CAACC,KAAL,CAAWJ,CAAC,CAAGC,CAAJ,CAAa,EAAxB,CAFE,CAIR,CAED,MAAO,CAAEC,CAAC,CAAE,CAAL,CAAQF,CA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A,CAAW,CAAGG,CAAH,CAAjB,CAThB,CAUE,SAAS,CAAE,mBAACc,CAAD,gBAAOhB,CAAP,WAAOA,CAAP,QAAOA,CAAU,CAAGgB,CAAH,CAAMd,CAAN,CAAjB,CAVb,CAWE,OAAO,CAAEa,CAXX,CAYE,MAAM,CApCO,QAAbQ,WAAa,CACjBP,CADiB,CAId,CACEpB,CADF,UAEDO,CAFC,WAEDA,CAFC,QAEDA,CAAO,CAAGa,CAAH,CAAM,IAAN,CAFN,CAGDT,CAAiB,CAACa,GAAlB,EAHC,CAKJ,CAeG,CAaE,OAAO,CAAEL,CAbX,CAcE,GAAG,CAAE3C,UAAU,CAAC,CAACU,CAAD,CAAYuC,CAAZ,CAAD,CAdjB,CAeE,QAAQ,CAAE,CAfZ,CAgBE,KAAK,oBACF,sBADE,WACoC1B,CADpC,MAhBP,EAmBMU,CAnBN,EADF,CAsBGC,CAAc,EAAIT,CAAlB,EAAiChB,CAAjC,EACC,oBAAC,YAAD,CAAc,QAAd,EAEE,KAAK,CAAE,CACL2B,KAAK,CAAEC,CADF,CAELe,eAAe,CAAEV,CAFZ,CAFT,EAOE,oBAAC,OAAD,EACE,QAAQ,CAAEQ,CADZ,CAEE,SAAS,CAAE3C,aAAa,CAAC,SAAD,CAF1B,CAGE,SAAS,CAAC,YAHZ,CAIE,kBAAkB,CAAE,CAClB,YADkB,CAElB,UAFkB,CAGlB,WAHkB,CAIlB,UAJkB,CAJtB,CAUE,KAAK,CAAE,CAAE8C,MAAM,CAAErB,CAAV,CAVT,CAWE,MAAM,CAAE,CAXV,EAaGH,CAAgB,CAAGA,CAAgB,CAACP,CAAD,CAAnB,CAA6BA,CAbhD,CAPF,CAvBJ,CAiDH,CA7HM"}
@@ -1 +1 @@
1
- .TabsTab{--tab-indent:var(--space-m);align-items:center;background-color:transparent;border:none;color:var(--color-typo-secondary);cursor:pointer;display:inline-flex;font-family:var(--font);font-size:var(--tab-font-size);line-height:var(--size-text-2xl);padding:var(--tab-padding) 0;position:relative;text-align:left;transition:color .2s}.TabsTab_size_xs{--only-icon-size:var(--space-m);--tab-padding:calc(var(--space-xs)/2 - var(--space-3xs)/2);--tab-font-size:var(--size-text-xs)}.TabsTab_size_s{--only-icon-size:var(--space-l);--tab-padding:calc(var(--space-xs) - var(--space-3xs));--tab-font-size:var(--size-text-s)}.TabsTab_size_m{--only-icon-size:var(--space-xl);--tab-padding:calc(var(--space-m)/2 - var(--space-3xs)/2);--tab-font-size:var(--size-text-m)}.TabsTab:hover,.TabsTab_checked{color:var(--color-typo-primary)}.TabsTab:before{border-radius:var(--control-radius);bottom:0;content:"";display:block;left:calc(var(--space-2xs)*-1);position:absolute;right:calc(var(--space-2xs)*-1);top:0}.TabsTab:focus{outline:none}.TabsTab-Icon{flex-shrink:0}.TabsTab:not(.TabsTab_onlyIcon) .TabsTab-Icon{margin-right:calc(var(--tab-indent)*.5)}.TabsTab_onlyIcon{justify-content:center;width:var(--only-icon-size)}
1
+ .deprecated--TabsTab{--tab-indent:var(--space-m);align-items:center;background-color:transparent;border:none;color:var(--color-typo-secondary);cursor:pointer;display:inline-flex;font-family:var(--font);font-size:var(--tab-font-size);line-height:var(--size-text-2xl);padding:var(--tab-padding) 0;position:relative;text-align:left;transition:color .2s}.deprecated--TabsTab_size_xs{--only-icon-size:var(--space-m);--tab-padding:calc(var(--space-xs)/2 - var(--space-3xs)/2);--tab-font-size:var(--size-text-xs)}.deprecated--TabsTab_size_s{--only-icon-size:var(--space-l);--tab-padding:calc(var(--space-xs) - var(--space-3xs));--tab-font-size:var(--size-text-s)}.deprecated--TabsTab_size_m{--only-icon-size:var(--space-xl);--tab-padding:calc(var(--space-m)/2 - var(--space-3xs)/2);--tab-font-size:var(--size-text-m)}.deprecated--TabsTab:hover,.deprecated--TabsTab_checked{color:var(--color-typo-primary)}.deprecated--TabsTab:before{border-radius:var(--control-radius);bottom:0;content:"";display:block;left:calc(var(--space-2xs)*-1);position:absolute;right:calc(var(--space-2xs)*-1);top:0}.deprecated--TabsTab:focus{outline:none}.deprecated--TabsTab-Icon{flex-shrink:0}.deprecated--TabsTab:not(.deprecated--TabsTab_onlyIcon) .deprecated--TabsTab-Icon{margin-right:calc(var(--tab-indent)*.5)}.deprecated--TabsTab_onlyIcon{justify-content:center;width:var(--only-icon-size)}
@@ -1,2 +1,2 @@
1
- import"./TabsTab.css";import React,{forwardRef}from"react";import{cnMixFocus}from"../../../mixs/MixFocus/MixFocus";import{cn}from"../../../utils/bem";import{getByMap}from"../../../utils/getByMap";export var cnTabsTab=cn("TabsTab");var sizeMap={s:"xs",m:"s",xs:"xs"};export var TabsTab=forwardRef(function(a,b){var c=a.label,d=a.onChange,e=a.checked,f=a.size,g=a.onlyIcon,h=a.icon,i=a.iconSize,j=a.className,k=getByMap(sizeMap,f,i);return React.createElement("button",{className:cnTabsTab({size:f,checked:e,onlyIcon:g},[cnMixFocus({before:!0}),j]),onClick:e?void 0:d,ref:b,role:"tab",type:"button",title:g?c:void 0},h&&React.createElement(h,{className:cnTabsTab("Icon"),size:k}),!g&&c)});
1
+ import"./TabsTab.css";import React,{forwardRef}from"react";import{cnMixFocus}from"../../../mixs/MixFocus/MixFocus";import{cnDeprecated}from"../../../utils/bem";import{getByMap}from"../../../utils/getByMap";export var cnTabsTab=cnDeprecated("TabsTab");var sizeMap={s:"xs",m:"s",xs:"xs"};export var TabsTab=forwardRef(function(a,b){var c=a.label,d=a.onChange,e=a.checked,f=a.size,g=a.onlyIcon,h=a.icon,i=a.iconSize,j=a.className,k=getByMap(sizeMap,f,i);return React.createElement("button",{className:cnTabsTab({size:f,checked:e,onlyIcon:g},[cnMixFocus({before:!0}),j]),onClick:e?void 0:d,ref:b,role:"tab",type:"button",title:g?c:void 0},h&&React.createElement(h,{className:cnTabsTab("Icon"),size:k}),!g&&c)});
2
2
  //# sourceMappingURL=TabsTab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TabsTab.js","names":["React","forwardRef","cnMixFocus","cn","getByMap","cnTabsTab","sizeMap","s","m","xs","TabsTab","props","ref","label","onChange","checked","size","onlyIcon","Icon","icon","iconSizeProp","iconSize","className","before"],"sources":["../../../../../../src/components/TabsDeprecated/Tab/TabsTab.tsx"],"sourcesContent":["import './TabsTab.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React, { forwardRef } from 'react';\n\nimport { cnMixFocus } from '../../../mixs/MixFocus/MixFocus';\nimport { cn } from '../../../utils/bem';\nimport { getByMap } from '../../../utils/getByMap';\nimport { TabsPropSize } from '../TabsDeprecated';\n\nexport const cnTabsTab = cn('TabsTab');\n\ntype Props = {\n size: TabsPropSize;\n onlyIcon?: boolean;\n icon?: IconComponent;\n iconSize?: IconPropSize;\n label: string;\n checked: boolean;\n onChange: React.MouseEventHandler<HTMLButtonElement>;\n className?: string;\n};\n\nconst sizeMap: Record<TabsPropSize, IconPropSize> = {\n s: 'xs',\n m: 's',\n xs: 'xs',\n};\n\nexport const TabsTab = forwardRef<HTMLButtonElement, Props>((props, ref) => {\n const {\n label,\n onChange,\n checked,\n size,\n onlyIcon,\n icon: Icon,\n iconSize: iconSizeProp,\n className,\n } = props;\n const iconSize = getByMap(sizeMap, size, iconSizeProp);\n\n return (\n <button\n className={cnTabsTab({ size, checked, onlyIcon }, [\n cnMixFocus({ before: true }),\n className,\n ])}\n onClick={checked ? undefined : onChange}\n ref={ref}\n role=\"tab\"\n type=\"button\"\n title={onlyIcon ? label : undefined}\n >\n {Icon && <Icon className={cnTabsTab('Icon')} size={iconSize} />}\n {!onlyIcon && label}\n </button>\n );\n});\n"],"mappings":"AAAA,sBAGA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,uCACA,OAASC,EAAT,0BACA,OAASC,QAAT,+BAGA,MAAO,IAAMC,UAAS,CAAGF,EAAE,CAAC,SAAD,CAApB,CAaP,GAAMG,QAA2C,CAAG,CAClDC,CAAC,CAAE,IAD+C,CAElDC,CAAC,CAAE,GAF+C,CAGlDC,EAAE,CAAE,IAH8C,CAApD,CAMA,MAAO,IAAMC,QAAO,CAAGT,UAAU,CAA2B,SAACU,CAAD,CAAQC,CAAR,CAAgB,IAExEC,EAFwE,CAUtEF,CAVsE,CAExEE,KAFwE,CAGxEC,CAHwE,CAUtEH,CAVsE,CAGxEG,QAHwE,CAIxEC,CAJwE,CAUtEJ,CAVsE,CAIxEI,OAJwE,CAKxEC,CALwE,CAUtEL,CAVsE,CAKxEK,IALwE,CAMxEC,CANwE,CAUtEN,CAVsE,CAMxEM,QANwE,CAOlEC,CAPkE,CAUtEP,CAVsE,CAOxEQ,IAPwE,CAQ9DC,CAR8D,CAUtET,CAVsE,CAQxEU,QARwE,CASxEC,CATwE,CAUtEX,CAVsE,CASxEW,SATwE,CAWpED,CAAQ,CAAGjB,QAAQ,CAACE,OAAD,CAAUU,CAAV,CAAgBI,CAAhB,CAXiD,CAa1E,MACE,+BACE,SAAS,CAAEf,SAAS,CAAC,CAAEW,IAAI,CAAJA,CAAF,CAAQD,OAAO,CAAPA,CAAR,CAAiBE,QAAQ,CAARA,CAAjB,CAAD,CAA8B,CAChDf,UAAU,CAAC,CAAEqB,MAAM,GAAR,CAAD,CADsC,CAEhDD,CAFgD,CAA9B,CADtB,CAKE,OAAO,CAAEP,CAAO,QAAeD,CALjC,CAME,GAAG,CAAEF,CANP,CAOE,IAAI,CAAC,KAPP,CAQE,IAAI,CAAC,QARP,CASE,KAAK,CAAEK,CAAQ,CAAGJ,CAAH,OATjB,EAWGK,CAAI,EAAI,oBAAC,CAAD,EAAM,SAAS,CAAEb,SAAS,CAAC,MAAD,CAA1B,CAAoC,IAAI,CAAEgB,CAA1C,EAXX,CAYG,CAACJ,CAAD,EAAaJ,CAZhB,CAeH,CA7BgC,CAA1B"}
1
+ {"version":3,"file":"TabsTab.js","names":["React","forwardRef","cnMixFocus","cnDeprecated","getByMap","cnTabsTab","sizeMap","s","m","xs","TabsTab","props","ref","label","onChange","checked","size","onlyIcon","Icon","icon","iconSizeProp","iconSize","className","before"],"sources":["../../../../../../src/components/TabsDeprecated/Tab/TabsTab.tsx"],"sourcesContent":["import './TabsTab.css';\n\nimport { IconComponent, IconPropSize } from '@consta/icons/Icon';\nimport React, { forwardRef } from 'react';\n\nimport { cnMixFocus } from '../../../mixs/MixFocus/MixFocus';\nimport { cnDeprecated } from '../../../utils/bem';\nimport { getByMap } from '../../../utils/getByMap';\nimport { TabsPropSize } from '../TabsDeprecated';\n\nexport const cnTabsTab = cnDeprecated('TabsTab');\n\ntype Props = {\n size: TabsPropSize;\n onlyIcon?: boolean;\n icon?: IconComponent;\n iconSize?: IconPropSize;\n label: string;\n checked: boolean;\n onChange: React.MouseEventHandler<HTMLButtonElement>;\n className?: string;\n};\n\nconst sizeMap: Record<TabsPropSize, IconPropSize> = {\n s: 'xs',\n m: 's',\n xs: 'xs',\n};\n\nexport const TabsTab = forwardRef<HTMLButtonElement, Props>((props, ref) => {\n const {\n label,\n onChange,\n checked,\n size,\n onlyIcon,\n icon: Icon,\n iconSize: iconSizeProp,\n className,\n } = props;\n const iconSize = getByMap(sizeMap, size, iconSizeProp);\n\n return (\n <button\n className={cnTabsTab({ size, checked, onlyIcon }, [\n cnMixFocus({ before: true }),\n className,\n ])}\n onClick={checked ? undefined : onChange}\n ref={ref}\n role=\"tab\"\n type=\"button\"\n title={onlyIcon ? label : undefined}\n >\n {Icon && <Icon className={cnTabsTab('Icon')} size={iconSize} />}\n {!onlyIcon && label}\n </button>\n );\n});\n"],"mappings":"AAAA,sBAGA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,UAAT,uCACA,OAASC,YAAT,0BACA,OAASC,QAAT,+BAGA,MAAO,IAAMC,UAAS,CAAGF,YAAY,CAAC,SAAD,CAA9B,CAaP,GAAMG,QAA2C,CAAG,CAClDC,CAAC,CAAE,IAD+C,CAElDC,CAAC,CAAE,GAF+C,CAGlDC,EAAE,CAAE,IAH8C,CAApD,CAMA,MAAO,IAAMC,QAAO,CAAGT,UAAU,CAA2B,SAACU,CAAD,CAAQC,CAAR,CAAgB,IAExEC,EAFwE,CAUtEF,CAVsE,CAExEE,KAFwE,CAGxEC,CAHwE,CAUtEH,CAVsE,CAGxEG,QAHwE,CAIxEC,CAJwE,CAUtEJ,CAVsE,CAIxEI,OAJwE,CAKxEC,CALwE,CAUtEL,CAVsE,CAKxEK,IALwE,CAMxEC,CANwE,CAUtEN,CAVsE,CAMxEM,QANwE,CAOlEC,CAPkE,CAUtEP,CAVsE,CAOxEQ,IAPwE,CAQ9DC,CAR8D,CAUtET,CAVsE,CAQxEU,QARwE,CASxEC,CATwE,CAUtEX,CAVsE,CASxEW,SATwE,CAWpED,CAAQ,CAAGjB,QAAQ,CAACE,OAAD,CAAUU,CAAV,CAAgBI,CAAhB,CAXiD,CAa1E,MACE,+BACE,SAAS,CAAEf,SAAS,CAAC,CAAEW,IAAI,CAAJA,CAAF,CAAQD,OAAO,CAAPA,CAAR,CAAiBE,QAAQ,CAARA,CAAjB,CAAD,CAA8B,CAChDf,UAAU,CAAC,CAAEqB,MAAM,GAAR,CAAD,CADsC,CAEhDD,CAFgD,CAA9B,CADtB,CAKE,OAAO,CAAEP,CAAO,QAAeD,CALjC,CAME,GAAG,CAAEF,CANP,CAOE,IAAI,CAAC,KAPP,CAQE,IAAI,CAAC,QARP,CASE,KAAK,CAAEK,CAAQ,CAAGJ,CAAH,OATjB,EAWGK,CAAI,EAAI,oBAAC,CAAD,EAAM,SAAS,CAAEb,SAAS,CAAC,MAAD,CAA1B,CAAoC,IAAI,CAAEgB,CAA1C,EAXX,CAYG,CAACJ,CAAD,EAAaJ,CAZhB,CAeH,CA7BgC,CAA1B"}
@@ -18,6 +18,7 @@ export declare type TooltipProps = PropsWithJsxAttributes<{
18
18
  children: React.ReactNode;
19
19
  onClickOutside?: ClickOutsideHandler;
20
20
  className?: string;
21
+ offset?: number;
21
22
  onSetDirection?: (direction: Direction) => void;
22
23
  } & PositioningProps>;
23
- export declare const Tooltip: React.ForwardRefExoticComponent<Pick<TooltipProps, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "status" | "key" | "direction" | "position" | "possibleDirections" | "spareDirection" | "isInteractive" | "onClickOutside" | "onSetDirection" | "anchorRef" | "equalAnchorWidth"> & React.RefAttributes<HTMLDivElement>>;
24
+ export declare const Tooltip: React.ForwardRefExoticComponent<Pick<TooltipProps, "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "size" | "status" | "key" | "direction" | "offset" | "position" | "possibleDirections" | "spareDirection" | "isInteractive" | "onClickOutside" | "onSetDirection" | "anchorRef" | "equalAnchorWidth"> & React.RefAttributes<HTMLDivElement>>;
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["children","size","className","status","onSetDirection","style"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Tooltip.css";import React,{useMemo,useState}from"react";import{cnMixPopoverArrow}from"../../mixs/MixPopoverArrow/MixPopoverArrow";import{cn}from"../../utils/bem";import{Popover}from"../Popover/Popover";import{Text}from"../Text/Text";import{generateDeps,generateThemeClassNames,ThemeContext,useTheme}from"../Theme/Theme";var ARROW_SIZE=6,ARROW_OFFSET=8,cnTooltip=cn("Tooltip");export var tooltipPropSizes=["m","s","l"];export var tooltipPropSizesDefault=tooltipPropSizes[0];export var tooltipPropStatus=["normal","alert","success","warning"];function renderChildren(a){return"string"==typeof a||"number"==typeof a?React.createElement(Text,{size:"xs"},a):a}export var Tooltip=React.forwardRef(function(a,b){var c,d=a.children,e=a.size,f=void 0===e?tooltipPropSizesDefault:e,g=a.className,h=a.status,i=a.onSetDirection,j=a.style,k=_objectWithoutProperties(a,_excluded),l=useTheme(),m=l.theme,n=useState(),o=_slicedToArray(n,2),p=o[0],q=o[1],r=useMemo(function(){var a=h?_objectSpread(_objectSpread({},m),{},{color:{primary:m.color.accent,accent:m.color.accent,invert:m.color.primary}}):_objectSpread(_objectSpread({},m),{},{color:{primary:m.color.invert,accent:m.color.accent,invert:m.color.primary}});return{theme:a,themeClassNames:generateThemeClassNames(a)}},[generateDeps(m),h]);return React.createElement(ThemeContext.Provider,{value:r},React.createElement(Popover,Object.assign({},k,{arrowOffset:ARROW_OFFSET+ARROW_SIZE,offset:10,onSetDirection:function onSetDirection(a){i&&i(a),q(a)},ref:b,className:cnTooltip({status:h},[g]),style:_objectSpread((c={},_defineProperty(c,"--popover-arrow-size","".concat(ARROW_SIZE,"px")),_defineProperty(c,"--popover-arrow-offset","".concat(ARROW_OFFSET,"px")),c),j)}),React.createElement("div",{className:cnTooltip("Background")}),React.createElement("div",{className:cnTooltip("Arrow",[cnMixPopoverArrow({direction:p})])}),React.createElement("div",{className:cnTooltip("Content",{size:f})},renderChildren(d))))});
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["children","size","className","status","onSetDirection","style","offset"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./Tooltip.css";import React,{useMemo,useState}from"react";import{cnMixPopoverArrow}from"../../mixs/MixPopoverArrow/MixPopoverArrow";import{cn}from"../../utils/bem";import{Popover}from"../Popover/Popover";import{Text}from"../Text/Text";import{generateDeps,generateThemeClassNames,ThemeContext,useTheme}from"../Theme/Theme";var ARROW_SIZE=6,ARROW_OFFSET=8,cnTooltip=cn("Tooltip");export var tooltipPropSizes=["m","s","l"];export var tooltipPropSizesDefault=tooltipPropSizes[0];export var tooltipPropStatus=["normal","alert","success","warning"];function renderChildren(a){return"string"==typeof a||"number"==typeof a?React.createElement(Text,{size:"xs"},a):a}export var Tooltip=React.forwardRef(function(a,b){var c,d=a.children,e=a.size,f=void 0===e?tooltipPropSizesDefault:e,g=a.className,h=a.status,i=a.onSetDirection,j=a.style,k=a.offset,l=void 0===k?0:k,m=_objectWithoutProperties(a,_excluded),n=useTheme(),o=n.theme,p=useState(),q=_slicedToArray(p,2),r=q[0],s=q[1],t=useMemo(function(){var a=h?_objectSpread(_objectSpread({},o),{},{color:{primary:o.color.accent,accent:o.color.accent,invert:o.color.primary}}):_objectSpread(_objectSpread({},o),{},{color:{primary:o.color.invert,accent:o.color.accent,invert:o.color.primary}});return{theme:a,themeClassNames:generateThemeClassNames(a)}},[generateDeps(o),h]);return React.createElement(ThemeContext.Provider,{value:t},React.createElement(Popover,Object.assign({},m,{arrowOffset:ARROW_OFFSET+ARROW_SIZE,offset:10+l,onSetDirection:function onSetDirection(a){i&&i(a),s(a)},ref:b,className:cnTooltip({status:h},[g]),style:_objectSpread((c={},_defineProperty(c,"--popover-arrow-size","".concat(ARROW_SIZE,"px")),_defineProperty(c,"--popover-arrow-offset","".concat(ARROW_OFFSET,"px")),c),j)}),React.createElement("div",{className:cnTooltip("Background")}),React.createElement("div",{className:cnTooltip("Arrow",[cnMixPopoverArrow({direction:r})])}),React.createElement("div",{className:cnTooltip("Content",{size:f})},renderChildren(d))))});
2
2
  //# sourceMappingURL=Tooltip.js.map