@consta/uikit 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectItemAll/SelectItemAll.js +2 -0
- package/__internal__/src/components/SelectComponents/SelectItemAll/SelectItemAll.js.map +1 -0
- package/__internal__/src/components/SelectComponents/SelectItemAll/index.d.ts +1 -1
- package/__internal__/src/components/SelectComponents/SelectItemAll/index.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectItemAll/index.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectLoader/SelectLoader.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectLoader/SelectLoader.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectValueTag/SelectValueTag.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectValueTag/SelectValueTag.js.map +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.css +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.js +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.js.map +1 -1
- package/__internal__/src/components/UserSelect/UserSelectValue/UserSelectValue.css +1 -1
- package/__internal__/src/components/UserSelect/UserSelectValue/UserSelectValue.js +1 -1
- package/__internal__/src/components/UserSelect/UserSelectValue/UserSelectValue.js.map +1 -1
- package/package.json +1 -1
- package/__internal__/src/components/SelectComponents/SelectItemAll/SelectSelectAll.js +0 -2
- package/__internal__/src/components/SelectComponents/SelectItemAll/SelectSelectAll.js.map +0 -1
- /package/__internal__/src/components/SelectComponents/SelectItemAll/{SelectSelectAll.d.ts → SelectItemAll.d.ts} +0 -0
package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","labelForCreate","inputValue","active","hovered","size","indent"];import"./SelectCreateButton.css";import React,{forwardRef}from"react";import{ListAddItem}from"../../ListCanary";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","labelForCreate","inputValue","active","hovered","size","indent"];import"./SelectCreateButton.css";import React,{forwardRef}from"react";import{ListAddItem}from"../../ListCanary";import{cn}from"../../../utils/bem";export var cnSelectCreateButton=cn("SelectCreateButton");export var SelectCreateButton=forwardRef(function(a,b){var c=a.className,d=a.labelForCreate,e=a.inputValue,f=a.active,g=a.hovered,h=a.size,i=a.indent,j=_objectWithoutProperties(a,_excluded);return React.createElement(ListAddItem,Object.assign({},j,{ref:b,className:cnSelectCreateButton(null,[c]),"aria-selected":f,role:"option",active:g,size:h,innerOffset:i,label:React.createElement(React.Fragment,null,d," \xAB",React.createElement("b",null,e),"\xBB")}))});
|
|
2
2
|
//# sourceMappingURL=SelectCreateButton.js.map
|
package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectCreateButton.js","names":["React","forwardRef","ListAddItem","
|
|
1
|
+
{"version":3,"file":"SelectCreateButton.js","names":["React","forwardRef","ListAddItem","cn","cnSelectCreateButton","SelectCreateButton","props","ref","className","labelForCreate","inputValue","active","hovered","size","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectCreateButton/SelectCreateButton.tsx"],"sourcesContent":["import './SelectCreateButton.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { ListAddItem } from '##/components/ListCanary';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { PropSize } from '../types';\n\ntype SelectCreateButtonProps = PropsWithHTMLAttributesAndRef<\n {\n labelForCreate?: string;\n inputValue?: string;\n active: boolean;\n hovered: boolean;\n size: PropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const cnSelectCreateButton = cn('SelectCreateButton');\n\nexport const SelectCreateButton: React.FC<SelectCreateButtonProps> = forwardRef(\n (props, ref) => {\n const {\n className,\n labelForCreate,\n inputValue,\n active,\n hovered,\n size,\n indent,\n ...otherProps\n } = props;\n\n return (\n <ListAddItem\n {...otherProps}\n ref={ref}\n className={cnSelectCreateButton(null, [className])}\n aria-selected={active}\n role=\"option\"\n active={hovered}\n size={size}\n innerOffset={indent}\n label={\n <>\n {labelForCreate} «<b>{inputValue}</b>»\n </>\n }\n />\n );\n },\n);\n"],"mappings":"kLAAA,iCAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,WAAT,wBACA,OAASC,EAAT,0BAiBA,MAAO,IAAMC,qBAAoB,CAAGD,EAAE,CAAC,oBAAD,CAA/B,CAEP,MAAO,IAAME,mBAAqD,CAAGJ,UAAU,CAC7E,SAACK,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CASIF,CATJ,CACEE,SADF,CAEEC,CAFF,CASIH,CATJ,CAEEG,cAFF,CAGEC,CAHF,CASIJ,CATJ,CAGEI,UAHF,CAIEC,CAJF,CASIL,CATJ,CAIEK,MAJF,CAKEC,CALF,CASIN,CATJ,CAKEM,OALF,CAMEC,CANF,CASIP,CATJ,CAMEO,IANF,CAOEC,CAPF,CASIR,CATJ,CAOEQ,MAPF,CAQKC,CARL,0BASIT,CATJ,YAWA,MACE,qBAAC,WAAD,kBACMS,CADN,EAEE,GAAG,CAAER,CAFP,CAGE,SAAS,CAAEH,oBAAoB,CAAC,IAAD,CAAO,CAACI,CAAD,CAAP,CAHjC,CAIE,gBAAeG,CAJjB,CAKE,IAAI,CAAC,QALP,CAME,MAAM,CAAEC,CANV,CAOE,IAAI,CAAEC,CAPR,CAQE,WAAW,CAAEC,CARf,CASE,KAAK,CACH,wCACGL,CADH,SACoB,6BAAIC,CAAJ,CADpB,QAVJ,GAgBH,CA9B4E,CAAxE"}
|
|
@@ -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=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom"];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,useEffect,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,ListLoader,mapVerticalSpase}from"../../ListCanary";import{Popover}from"../../Popover";import{useDebounce}from"../../../hooks/useDebounce";import{useFlag}from"../../../hooks/useFlag";import{forkRef,useForkRef}from"../../../hooks/useForkRef";import{useVirtualScroll}from"../../../hooks/useVirtualScroll";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cnMixScrollBar}from"../../../mixs/MixScrollBar";import{cnMixSpace}from"../../../mixs/MixSpace";import{
|
|
1
|
+
import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";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","itemsRefs","virtualScroll","onScrollToBottom"];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,useEffect,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,ListLoader,mapVerticalSpase}from"../../ListCanary";import{Popover}from"../../Popover";import{useDebounce}from"../../../hooks/useDebounce";import{useFlag}from"../../../hooks/useFlag";import{forkRef,useForkRef}from"../../../hooks/useForkRef";import{useVirtualScroll}from"../../../hooks/useVirtualScroll";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cnMixScrollBar}from"../../../mixs/MixScrollBar";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectItemAll}from"../SelectItemAll/SelectItemAll";import{SelectLoader}from"../SelectLoader/SelectLoader";import{isNotOptionForCreate,isOptionForCreate,isOptionForSelectAll}from"../useSelect";export var selectDropdownform=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownform[0];var cnSelectDropdown=cn("SelectDropdown"),getLenghtElements=function(a){for(var b,c=1>=a.length?0:a.length,d=0;d<a.length;d++)b=a[d],isNotOptionForCreate(b)&&b.items.length&&(c+=b.items.length);return c},isVisible=function(a,b){return b>=a[0]&&b<a[1]};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=a.itemsRefs,v=a.virtualScroll,w=a.onScrollToBottom,x=_objectWithoutProperties(a,_excluded),y="round"===l?"increased":"normal",z=useMemo(function(){return 0<q.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[q]),A="none"===o?void 0:o,B=useMemo(function(){return getLenghtElements(q)},[q]),C=useVirtualScroll({length:B,isActive:v&&m,onScrollToBottom:w}),D=C.spaceTop,E=C.slice,F=C.listRefs,G=C.scrollElementRef,H=0===E[0]&&v?[0,50]:E,I=useRef(null),J=useForkRef([G,e]),K=useFlag(),L=_slicedToArray(K,2),M=L[0],N=L[1],O=useDebounce(N.off,100);return useEffect(function(){var a,b=function(){N.on(),O()};return null===(a=G.current)||void 0===a?void 0:a.addEventListener("scroll",b),function(){var a;null===(a=G.current)||void 0===a?void 0:a.removeEventListener("scroll",b)}},[G.current]),React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:I,timeout:animateTimeout},function(a){var e=fabricIndex(),j=fabricIndex();return React.createElement(Popover,Object.assign({},x,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:A,ref:I,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("ScrollContainer",[cnMixSpace({pV:mapVerticalSpase[c]}),cnMixScrollBar()]),ref:J},r&&!z&&React.createElement(SelectLoader,null),React.createElement("div",{className:cnSelectDropdown("List",{scrolled:M}),style:{marginTop:D}},q.map(function(a){if(isOptionForCreate(a)){var g=e();return React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:y,ref:u[g]},d({index:g,item:a,keyPrefix:D})))}var b=1<q.length?j():0;return React.createElement(Fragment,{key:a.key},a.group&&s&&isVisible(H,b)&&React.createElement(SelectGroupLabel,{label:s(a.group),size:c,indent:y,ref:F[b],key:"group".concat(a.key).concat(D)}),a.items.map(function(b,f){if(isOptionForSelectAll(b)){var g=j(),h=e();if(isVisible(H,g))return React.createElement(SelectItemAll,Object.assign({ref:forkRef([F[g],u[h]]),indent:y,size:c},d({index:h,item:b,keyPrefix:D}),{intermediate:!!(b.checkedCount&&b.totalCount)&&b.checkedCount!==b.totalCount,checked:b.checkedCount===b.totalCount,countItems:b.checkedCount,total:b.totalCount}))}else{var i=j(),k=e();if(isVisible(H,i))return React.createElement(Fragment,{key:"".concat(a.key,"-").concat(f)},p(_objectSpread({ref:forkRef([F[i],u[k]]),item:b},d({index:k,item:b,keyPrefix:D}))))}}))}),r&&z&&React.createElement(ListLoader,{size:c,innerOffset:y})),!r&&k&&t&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:y},h),!r&&!k&&i&&React.createElement(ListItem,{size:c,label:i,innerOffset:y},i)))})};
|
|
2
2
|
//# sourceMappingURL=SelectDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useEffect","useMemo","useRef","Transition","cnListBox","ListItem","ListLoader","mapVerticalSpase","Popover","useDebounce","useFlag","forkRef","useForkRef","useVirtualScroll","animateTimeout","cnMixPopoverAnimate","cnMixScrollBar","cnMixSpace","cnCanary","fabricIndex","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","getLenghtElements","elements","element","lenght","length","index","items","isVisible","slise","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRefProp","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","offsetProp","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","otherProps","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","slice","listRefs","scrollElementRef","popoverRef","scrolled","setScroled","setScroledOffDebouns","off","fn","on","current","addEventListener","removeEventListener","animate","getIndex","getVirtualIndex","border","shadow","pV","marginTop","map","label","item","keyPrefix","virtualIndex","key","i","checkedCount","totalCount","ref"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useEffect, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n ListLoader,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { Popover, PopoverPropOffset } from '##/components/Popover';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '##/mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cnCanary } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\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';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../useSelect';\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 itemsRefs: React.RefObject<HTMLDivElement>[];\n virtualScroll?: boolean;\n onScrollToBottom?: () => void;\n}>;\n\ntype SelectDropdown = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nconst cnSelectDropdown = cnCanary('SelectDropdown');\n\nconst getLenghtElements = <ITEM, GROUP>(\n elements: (\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) => {\n let lenght = elements.length <= 1 ? 0 : elements.length;\n\n for (let index = 0; index < elements.length; index++) {\n const element = elements[index];\n\n if (isNotOptionForCreate(element) && element.items.length) {\n lenght += element.items.length;\n }\n }\n\n return lenght;\n};\n\nconst isVisible = (slise: [number, number], index: number) => {\n return index >= slise[0] && index < slise[1];\n};\n\nexport const SelectDropdown: SelectDropdown = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef: dropdownRefProp,\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 itemsRefs,\n virtualScroll,\n onScrollToBottom,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\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 const lengthForVirtualScroll = useMemo(\n () => getLenghtElements(visibleItems),\n [visibleItems],\n );\n\n const {\n spaceTop,\n slice: sliceHookProp,\n listRefs,\n scrollElementRef,\n } = useVirtualScroll({\n length: lengthForVirtualScroll,\n isActive: virtualScroll && isOpen,\n onScrollToBottom,\n });\n\n const slice: [number, number] =\n sliceHookProp[0] === 0 && virtualScroll ? [0, 50] : sliceHookProp;\n\n const popoverRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useForkRef([scrollElementRef, dropdownRefProp]);\n const [scrolled, setScroled] = useFlag();\n const setScroledOffDebouns = useDebounce(setScroled.off, 100);\n\n useEffect(() => {\n const fn = () => {\n setScroled.on();\n setScroledOffDebouns();\n };\n\n scrollElementRef.current?.addEventListener('scroll', fn);\n\n return () => {\n scrollElementRef.current?.removeEventListener('scroll', fn);\n };\n }, [scrollElementRef.current]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex();\n const getVirtualIndex = fabricIndex();\n\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('ScrollContainer', [\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n cnMixScrollBar(),\n ])}\n ref={dropdownRef}\n >\n {isLoading && !isListShowed && <SelectLoader />}\n <div\n className={cnSelectDropdown('List', { scrolled })}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n ref={itemsRefs[index]}\n {...getOptionProps({\n index,\n item: group,\n keyPrefix: spaceTop,\n })}\n />\n );\n }\n\n const virtualIndex =\n visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group${group.key}${spaceTop}`}\n />\n )}\n {group.items.map((item, i) => {\n if (isOptionForSelectAll(item)) {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n\n if (isVisible(slice, virtualIndex)) {\n return (\n <SelectItemAll\n ref={forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ])}\n indent={indent}\n size={size}\n {...getOptionProps({\n index,\n item,\n keyPrefix: spaceTop,\n })}\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 } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n ref: forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ]),\n item,\n ...getOptionProps({\n index,\n item,\n keyPrefix: spaceTop,\n }),\n })}\n </Fragment>\n );\n }\n }\n })}\n </Fragment>\n );\n })}\n {isLoading && isListShowed && (\n <ListLoader size={size} innerOffset={indent} />\n )}\n </div>\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":"ylCAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,OAArC,CAA8CC,MAA9C,KAA4D,OAA5D,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,UAHF,CAIEC,gBAJF,wBAMA,OAASC,OAAT,qBACA,OAASC,WAAT,kCACA,OAASC,OAAT,8BACA,OAASC,OAAT,CAAkBC,UAAlB,iCACA,OAASC,gBAAT,uCACA,OACEC,cADF,CAEEC,mBAFF,yDAIA,OAASC,cAAT,kCACA,OAASC,UAAT,8BACA,OAASC,QAAT,0BACA,OAASC,WAAT,kCAIA,OAASC,kBAAT,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,CAAD,EAAc,CAACP,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEP,CADR,CAEE,KAAK,CAAEO,CAFT,CAGE,WAAW,CAAEe,CAHf,EAKGf,CALH,CAvHJ,CApBF,CAsJH,CAjKH,CAoKH,CAjPM"}
|
|
1
|
+
{"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useEffect","useMemo","useRef","Transition","cnListBox","ListItem","ListLoader","mapVerticalSpase","Popover","useDebounce","useFlag","forkRef","useForkRef","useVirtualScroll","animateTimeout","cnMixPopoverAnimate","cnMixScrollBar","cnMixSpace","cn","fabricIndex","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","getLenghtElements","elements","element","lenght","length","index","items","isVisible","slise","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRefProp","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","offsetProp","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","otherProps","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","slice","listRefs","scrollElementRef","popoverRef","scrolled","setScroled","setScroledOffDebouns","off","fn","on","current","addEventListener","removeEventListener","animate","getIndex","getVirtualIndex","border","shadow","pV","marginTop","map","label","item","keyPrefix","virtualIndex","key","i","checkedCount","totalCount","ref"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useEffect, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n ListLoader,\n mapVerticalSpase,\n} from '##/components/ListCanary';\nimport { Popover, PopoverPropOffset } from '##/components/Popover';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '##/mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectItemAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../useSelect';\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 itemsRefs: React.RefObject<HTMLDivElement>[];\n virtualScroll?: boolean;\n onScrollToBottom?: () => void;\n}>;\n\ntype SelectDropdown = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nconst getLenghtElements = <ITEM, GROUP>(\n elements: (\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) => {\n let lenght = elements.length <= 1 ? 0 : elements.length;\n\n for (let index = 0; index < elements.length; index++) {\n const element = elements[index];\n\n if (isNotOptionForCreate(element) && element.items.length) {\n lenght += element.items.length;\n }\n }\n\n return lenght;\n};\n\nconst isVisible = (slise: [number, number], index: number) => {\n return index >= slise[0] && index < slise[1];\n};\n\nexport const SelectDropdown: SelectDropdown = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef: dropdownRefProp,\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 itemsRefs,\n virtualScroll,\n onScrollToBottom,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\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 const lengthForVirtualScroll = useMemo(\n () => getLenghtElements(visibleItems),\n [visibleItems],\n );\n\n const {\n spaceTop,\n slice: sliceHookProp,\n listRefs,\n scrollElementRef,\n } = useVirtualScroll({\n length: lengthForVirtualScroll,\n isActive: virtualScroll && isOpen,\n onScrollToBottom,\n });\n\n const slice: [number, number] =\n sliceHookProp[0] === 0 && virtualScroll ? [0, 50] : sliceHookProp;\n\n const popoverRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useForkRef([scrollElementRef, dropdownRefProp]);\n const [scrolled, setScroled] = useFlag();\n const setScroledOffDebouns = useDebounce(setScroled.off, 100);\n\n useEffect(() => {\n const fn = () => {\n setScroled.on();\n setScroledOffDebouns();\n };\n\n scrollElementRef.current?.addEventListener('scroll', fn);\n\n return () => {\n scrollElementRef.current?.removeEventListener('scroll', fn);\n };\n }, [scrollElementRef.current]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex();\n const getVirtualIndex = fabricIndex();\n\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('ScrollContainer', [\n cnMixSpace({\n pV: mapVerticalSpase[size],\n }),\n cnMixScrollBar(),\n ])}\n ref={dropdownRef}\n >\n {isLoading && !isListShowed && <SelectLoader />}\n <div\n className={cnSelectDropdown('List', { scrolled })}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n ref={itemsRefs[index]}\n {...getOptionProps({\n index,\n item: group,\n keyPrefix: spaceTop,\n })}\n />\n );\n }\n\n const virtualIndex =\n visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group${group.key}${spaceTop}`}\n />\n )}\n {group.items.map((item, i) => {\n if (isOptionForSelectAll(item)) {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n\n if (isVisible(slice, virtualIndex)) {\n return (\n <SelectItemAll\n ref={forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ])}\n indent={indent}\n size={size}\n {...getOptionProps({\n index,\n item,\n keyPrefix: spaceTop,\n })}\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 } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n ref: forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ]),\n item,\n ...getOptionProps({\n index,\n item,\n keyPrefix: spaceTop,\n }),\n })}\n </Fragment>\n );\n }\n }\n })}\n </Fragment>\n );\n })}\n {isLoading && isListShowed && (\n <ListLoader size={size} innerOffset={indent} />\n )}\n </div>\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":"ylCAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,OAArC,CAA8CC,MAA9C,KAA4D,OAA5D,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,UAHF,CAIEC,gBAJF,wBAMA,O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AW,CAAEsB,CAArC,EAhGJ,CAVF,CA6GG,CAACP,CAAD,EAAcP,CAAd,EAA0BS,CAA1B,EAAsCX,CAAtC,EACC,oBAAC,QAAD,EACE,IAAI,CAAEN,CADR,CAEE,KAAK,CAAEM,CAFT,CAGE,WAAW,CAAEgB,CAHf,EAKGhB,CALH,CA9GJ,CAsHG,CAACS,CAAD,EAAc,CAACP,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEP,CADR,CAEE,KAAK,CAAEO,CAFT,CAGE,WAAW,CAAEe,CAHf,EAKGf,CALH,CAvHJ,CApBF,CAsJH,CAjKH,CAoKH,CAjPM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","active","hovered","multiple","size","indent","disabled"];import"./SelectItem.css";import React,{forwardRef}from"react";import{Checkbox}from"../../Checkbox";import{ListItem}from"../../ListCanary";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","active","hovered","multiple","size","indent","disabled"];import"./SelectItem.css";import React,{forwardRef}from"react";import{Checkbox}from"../../Checkbox";import{ListItem}from"../../ListCanary";import{cn}from"../../../utils/bem";export var sizeCheckboxMap={xs:"m",s:"m",m:"l",l:"l"};export var cnSelectItem=cn("SelectItem");export var SelectItem=forwardRef(function(a,b){var c=a.className,d=a.label,e=a.active,f=a.hovered,g=a.multiple,h=a.size,i=a.indent,j=a.disabled,k=_objectWithoutProperties(a,_excluded);return React.createElement(ListItem,Object.assign({},k,{ref:b,className:cnSelectItem(null,[c]),"aria-selected":e,"aria-disabled":j,role:"option",label:d,innerOffset:i,size:h,active:f,checked:!g&&e,disabled:j,leftSide:g&&React.createElement(Checkbox,{checked:e,disabled:j,size:sizeCheckboxMap[h]})}),d)});
|
|
2
2
|
//# sourceMappingURL=SelectItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItem.js","names":["React","forwardRef","Checkbox","ListItem","
|
|
1
|
+
{"version":3,"file":"SelectItem.js","names":["React","forwardRef","Checkbox","ListItem","cn","sizeCheckboxMap","xs","s","m","l","cnSelectItem","SelectItem","props","ref","className","label","active","hovered","multiple","size","indent","disabled","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectItem/SelectItem.tsx"],"sourcesContent":["import './SelectItem.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { Checkbox, CheckboxPropSize } from '##/components/Checkbox';\nimport { ListItem } from '##/components/ListCanary';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { PropSize } from '../types';\n\nexport type SelectItemProps = PropsWithHTMLAttributesAndRef<\n {\n label: string;\n active: boolean;\n hovered: boolean;\n multiple: boolean;\n size: PropSize;\n indent: 'normal' | 'increased';\n disabled: boolean | undefined;\n },\n HTMLDivElement\n>;\n\nexport const sizeCheckboxMap: Record<PropSize, CheckboxPropSize> = {\n xs: 'm',\n s: 'm',\n m: 'l',\n l: 'l',\n};\n\nexport const cnSelectItem = cn('SelectItem');\n\nexport const SelectItem: React.FC<SelectItemProps> = forwardRef(\n (props, ref) => {\n const {\n className,\n label,\n active,\n hovered,\n multiple,\n size,\n indent,\n disabled,\n ...otherProps\n } = props;\n\n return (\n <ListItem\n {...otherProps}\n ref={ref}\n className={cnSelectItem(null, [className])}\n aria-selected={active}\n aria-disabled={disabled}\n role=\"option\"\n label={label}\n innerOffset={indent}\n size={size}\n active={hovered}\n checked={!multiple && active}\n disabled={disabled}\n leftSide={\n multiple && (\n <Checkbox\n checked={active}\n disabled={disabled}\n size={sizeCheckboxMap[size]}\n />\n )\n }\n >\n {label}\n </ListItem>\n );\n },\n);\n"],"mappings":"kLAAA,yBAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,sBACA,OAASC,QAAT,wBACA,OAASC,EAA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objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["checked","intermediate","size","indent","hovered","countItems","className","total"];import React,{forwardRef}from"react";import{ListItem}from"../../ListCanary";import{Text}from"../../Text";import{cn}from"../../../utils/bem";import{Checkbox}from"../../Checkbox/Checkbox";import{sizeCheckboxMap}from"../SelectItem/SelectItem";export var cnSelectItemAll=cn("SelectItemAll");var textSizeMap={xs:"s",s:"s",m:"m",l:"l"};export var SelectItemAll=forwardRef(function(a,b){var c=a.checked,d=a.intermediate,e=a.size,f=a.indent,g=a.hovered,h=a.countItems,i=void 0===h?0:h,j=a.className,k=a.total,l=void 0===k?0:k,m=_objectWithoutProperties(a,_excluded);return React.createElement(ListItem,Object.assign({},m,{ref:b,className:cnSelectItemAll(null,[j]),"aria-selected":c,role:"option",label:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",innerOffset:f,size:e,active:g,rightSide:React.createElement(Text,{size:textSizeMap[e],lineHeight:"xs",view:"ghost"},"".concat(i," \u0438\u0437 ").concat(l)),leftSide:React.createElement(Checkbox,{checked:c,intermediate:d,size:sizeCheckboxMap[e]})}),"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435")});
|
|
2
|
+
//# sourceMappingURL=SelectItemAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectItemAll.js","names":["React","forwardRef","ListItem","Text","cn","Checkbox","sizeCheckboxMap","cnSelectItemAll","textSizeMap","xs","s","m","l","SelectItemAll","props","ref","checked","intermediate","size","indent","hovered","countItems","className","total","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectItemAll/SelectItemAll.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { ListItem } from '##/components/ListCanary';\nimport { Text, TextPropSize } from '##/components/Text';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { Checkbox } from '../../Checkbox/Checkbox';\nimport { sizeCheckboxMap } from '../SelectItem/SelectItem';\nimport { PropSize } from '../types';\n\nexport type SelectItemAllProps = PropsWithHTMLAttributesAndRef<\n {\n checked: boolean;\n intermediate?: boolean;\n size: PropSize;\n hovered?: boolean;\n indent?: 'normal' | 'increased';\n countItems?: number;\n total?: number;\n },\n HTMLDivElement\n>;\n\nexport const cnSelectItemAll = cn('SelectItemAll');\n\nconst textSizeMap: Record<PropSize, TextPropSize> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nexport const SelectItemAll: React.FC<SelectItemAllProps> = forwardRef(\n (props, ref) => {\n const {\n checked,\n intermediate,\n size,\n indent,\n hovered,\n countItems = 0,\n className,\n total = 0,\n ...otherProps\n } = props;\n\n return (\n <ListItem\n {...otherProps}\n ref={ref}\n className={cnSelectItemAll(null, [className])}\n aria-selected={checked}\n role=\"option\"\n label=\"Выбрать все\"\n innerOffset={indent}\n size={size}\n active={hovered}\n rightSide={\n <Text\n size={textSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >{`${countItems} из ${total}`}</Text>\n }\n leftSide={\n <Checkbox\n checked={checked}\n intermediate={intermediate}\n size={sizeCheckboxMap[size]}\n />\n }\n >\n Выбрать все\n </ListItem>\n );\n },\n);\n"],"mappings":"yLAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,wBACA,OAASC,IAAT,kBACA,OAASC,EAAT,0BAGA,OAASC,QAAT,+BACA,OAASC,eAAT,gCAgBA,MAAO,IAAMC,gBAAe,CAAGH,EAAE,CAAC,eAAD,CAA1B,CAEP,GAAMI,YAA2C,CAAG,CAClDC,EAAE,CAAE,GAD8C,CAElDC,CAAC,CAAE,GAF+C,CAGlDC,CAAC,CAAE,GAH+C,CAIlDC,CAAC,CAAE,GAJ+C,CAApD,CAOA,MAAO,IAAMC,cAA2C,CAAGZ,UAAU,CACnE,SAACa,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CAUIF,CAVJ,CACEE,OADF,CAEEC,CAFF,CAUIH,CAVJ,CAEEG,YAFF,CAGEC,CAHF,CAUIJ,CAVJ,CAGEI,IAHF,CAIEC,CAJF,CAUIL,CAVJ,CAIEK,MAJF,CAKEC,CALF,CAUIN,CAVJ,CAKEM,OALF,GAUIN,CAVJ,CAMEO,UANF,CAMEA,CANF,YAMe,CANf,GAOEC,CAPF,CAUIR,CAVJ,CAOEQ,SAPF,GAUIR,CAVJ,CAQES,KARF,CAQEA,CARF,YAQU,CARV,GASKC,CATL,0BAUIV,CAVJ,YAYA,MACE,qBAAC,QAAD,kBACMU,CADN,EAEE,GAAG,CAAET,CAFP,CAGE,SAAS,CAAER,eAAe,CAAC,IAAD,CAAO,CAACe,CAAD,CAAP,CAH5B,CAIE,gBAAeN,CAJjB,CAKE,IAAI,CAAC,QALP,CAME,KAAK,CAAC,+DANR,CAOE,WAAW,CAAEG,CAPf,CAQE,IAAI,CAAED,CARR,CASE,MAAM,CAAEE,CATV,CAUE,SAAS,CACP,oBAAC,IAAD,EACE,IAAI,CAAEZ,WAAW,CAACU,CAAD,CADnB,CAEE,UAAU,CAAC,IAFb,CAGE,IAAI,CAAC,OAHP,YAIKG,CAJL,0BAIsBE,CAJtB,EAXJ,CAiBE,QAAQ,CACN,oBAAC,QAAD,EACE,OAAO,CAAEP,CADX,CAEE,YAAY,CAAEC,CAFhB,CAGE,IAAI,CAAEX,eAAe,CAACY,CAAD,CAHvB,EAlBJ,mEA4BH,CA3CkE,CAA9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './SelectItemAll';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./
|
|
1
|
+
export*from"./SelectItemAll";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/SelectComponents/SelectItemAll/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/SelectComponents/SelectItemAll/index.ts"],"sourcesContent":["export * from './SelectItemAll';\n"],"mappings":"AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./SelectLoader.css";import React from"react";import{Loader}from"../../LoaderDeprecated";import{
|
|
1
|
+
import"./SelectLoader.css";import React from"react";import{Loader}from"../../LoaderDeprecated";import{cn}from"../../../utils/bem";export var cnSelectLoader=cn("SelectLoader");export var SelectLoader=function(){return React.createElement("div",{className:cnSelectLoader()},React.createElement(Loader,{className:cnSelectLoader("Loader"),size:"s"}))};
|
|
2
2
|
//# sourceMappingURL=SelectLoader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectLoader.js","names":["React","Loader","
|
|
1
|
+
{"version":3,"file":"SelectLoader.js","names":["React","Loader","cn","cnSelectLoader","SelectLoader"],"sources":["../../../../../../src/components/SelectComponents/SelectLoader/SelectLoader.tsx"],"sourcesContent":["import './SelectLoader.css';\n\nimport React from 'react';\n\nimport { Loader } from '##/components/LoaderDeprecated';\nimport { cn } from '##/utils/bem';\n\nexport const cnSelectLoader = cn('SelectLoader');\n\nexport const SelectLoader = () => {\n return (\n <div className={cnSelectLoader()}>\n <Loader className={cnSelectLoader('Loader')} size=\"s\" />\n </div>\n );\n};\n"],"mappings":"AAAA,2BAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,MAAT,8BACA,OAASC,EAAT,0BAEA,MAAO,IAAMC,eAAc,CAAGD,EAAE,CAAC,cAAD,CAAzB,CAEP,MAAO,IAAME,aAAY,CAAG,UAAM,CAChC,MACE,4BAAK,SAAS,CAAED,cAAc,EAA9B,EACE,oBAAC,MAAD,EAAQ,SAAS,CAAEA,cAAc,CAAC,QAAD,CAAjC,CAA6C,IAAI,CAAC,GAAlD,EADF,CAIH,CANM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./SelectValueTag.css";import React from"react";import{Tag}from"../../Tag";import{
|
|
1
|
+
import"./SelectValueTag.css";import React from"react";import{Tag}from"../../Tag";import{cn}from"../../../utils/bem";export var cnSelectValueTag=cn("SelectValueTag");export var SelectValueTag=function(a){var b=a.handleRemove,c=void 0===b?function(){}:b,d=a.size,e=a.label,f=a.disabled;return React.createElement(Tag,{className:cnSelectValueTag({size:d,disabled:f}),label:e,mode:"cancel",onCancel:c,size:d})};
|
|
2
2
|
//# sourceMappingURL=SelectValueTag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectValueTag.js","names":["React","Tag","
|
|
1
|
+
{"version":3,"file":"SelectValueTag.js","names":["React","Tag","cn","cnSelectValueTag","SelectValueTag","props","handleRemove","size","label","disabled"],"sources":["../../../../../../src/components/SelectComponents/SelectValueTag/SelectValueTag.tsx"],"sourcesContent":["import './SelectValueTag.css';\n\nimport React from 'react';\n\nimport { Tag } from '##/components/Tag';\nimport { cn } from '##/utils/bem';\n\ntype SelectValueTagProps = {\n label: string;\n size: 's' | 'm' | 'l' | 'xs';\n children?: never;\n disabled?: boolean;\n handleRemove?: (e: React.SyntheticEvent) => void;\n};\n\nexport const cnSelectValueTag = cn('SelectValueTag');\n\nexport const SelectValueTag: React.FC<SelectValueTagProps> = (props) => {\n const { handleRemove = () => {}, size, label, disabled } = props;\n\n return (\n <Tag\n className={cnSelectValueTag({ size, disabled })}\n label={label}\n mode=\"cancel\"\n onCancel={handleRemove}\n size={size}\n />\n );\n};\n"],"mappings":"AAAA,6BAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,GAAT,iBACA,OAASC,EAAT,0BAUA,MAAO,IAAMC,iBAAgB,CAAGD,EAAE,CAAC,gBAAD,CAA3B,CAEP,MAAO,IAAME,eAA6C,CAAG,SAACC,CAAD,CAAW,CACtE,MAA2DA,CAA3D,CAAQC,YAAR,CAAQA,CAAR,YAAuB,UAAM,CAAE,CAA/B,GAAiCC,CAAjC,CAA2DF,CAA3D,CAAiCE,IAAjC,CAAuCC,CAAvC,CAA2DH,CAA3D,CAAuCG,KAAvC,CAA8CC,CAA9C,CAA2DJ,CAA3D,CAA8CI,QAA9C,CAEA,MACE,qBAAC,GAAD,EACE,SAAS,CAAEN,gBAAgB,CAAC,CAAEI,IAAI,CAAJA,CAAF,CAAQE,QAAQ,CAARA,CAAR,CAAD,CAD7B,CAEE,KAAK,CAAED,CAFT,CAGE,IAAI,CAAC,QAHP,CAIE,QAAQ,CAAEF,CAJZ,CAKE,IAAI,CAAEC,CALR,EAQH,CAZM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.UserSelectItem{align-items:center;background-color:var(--color-control-bg-clear);color:var(--color-control-typo-default);cursor:pointer;display:flex;font-size:var(--font-size);position:relative}.UserSelectItem_size_s{--font-size:var(--control-text-size-s);--sub-info-space:var(--space-xs);--sub-label-font-size:var(--size-text-2xs)}.UserSelectItem_size_m{--font-size:var(--control-text-size-m);--sub-info-space:var(--space-s);--sub-label-font-size:var(--size-text-xs)}.UserSelectItem_size_l{--font-size:var(--control-text-size-l);--sub-info-space:var(--space-s);--sub-label-font-size:var(--size-text-s)}.UserSelectItem_disable{color:var(--color-control-typo-disable)}.UserSelectItem_disable .UserSelectItem-AvatarContainer{opacity:.6}.UserSelectItem_hovered{background-color:var(--color-control-bg-clear-hover)}.UserSelectItem_active{color:var(--color-control-typo-secondary)}.UserSelectItem_indent_increased{padding-left:calc(var(--horizontal-space)*2.6)}.UserSelectItem-AvatarContainer{position:relative}.UserSelectItem-CheckIcon{background-color:var(--color-control-bg-primary);border:1px solid var(--color-control-bg-default);border-radius:50%;bottom:calc(var(--space-2xs)*-1);color:var(--color-control-bg-default);height:var(--graphics-size-xs);padding:0;position:absolute;right:calc(var(--space-2xs)*-1);width:var(--graphics-size-xs)}.UserSelectItem-CheckIcon_animate_entered,.UserSelectItem-CheckIcon_animate_entering,.UserSelectItem-CheckIcon_animate_exited,.UserSelectItem-CheckIcon_animate_exiting{transition:.2s ease;transition-property:opacity,transform}.UserSelectItem-CheckIcon_animate_entered,.UserSelectItem-CheckIcon_animate_entering{opacity:1;transform:scale(1)}.UserSelectItem-CheckIcon_animate_exiting{opacity:0;transform:scale(.25)}.UserSelectItem-CheckIcon_animate_exited{opacity:0;transform:scale(0)}.UserSelectItem-Info{padding-left:var(--sub-info-space)}.UserSelectItem-SubLabel{font-size:var(--sub-label-font-size);opacity:.7}.UserSelectItem-SubLabel_disable{opacity:1}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","subLabel","avatarUrl","active","hovered","size","indent","disable","multiple"];import"./UserSelectItem.css";import{IconCheck}from"@consta/icons/IconCheck";import React,{forwardRef,useRef}from"react";import{Transition}from"react-transition-group";import{Avatar}from"../../Avatar";import{mapHorisontalSpase,mapHorisontalSpaseIncreased,mapItemVerticalPadding}from"../../ListCanary";import{cnMixSpace}from"../../../mixs/MixSpace";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","subLabel","avatarUrl","active","hovered","size","indent","disable","multiple"];import"./UserSelectItem.css";import{IconCheck}from"@consta/icons/IconCheck";import React,{forwardRef,useRef}from"react";import{Transition}from"react-transition-group";import{Avatar}from"../../Avatar";import{mapHorisontalSpase,mapHorisontalSpaseIncreased,mapItemVerticalPadding}from"../../ListCanary";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";export var cnUserSelectItem=cn("UserSelectItem");export var UserSelectItem=forwardRef(function(a,b){var c=a.className,d=a.label,e=a.subLabel,f=a.avatarUrl,g=a.active,h=a.hovered,i=a.size,j=a.indent,k=a.disable,l=a.multiple,m=_objectWithoutProperties(a,_excluded),n=useRef(null);return React.createElement("div",Object.assign({},m,{className:cnUserSelectItem({active:g,hovered:h,size:i,indent:j,disable:k},[cnMixSpace({pH:"increased"===j?mapHorisontalSpaseIncreased[i]:mapHorisontalSpase[i],pV:mapItemVerticalPadding[i]}),c]),"aria-selected":g,ref:b}),React.createElement("div",{className:cnUserSelectItem("AvatarContainer")},React.createElement(Avatar,{className:cnUserSelectItem("Avatar"),url:f,name:d}),l&&React.createElement(Transition,{in:g,unmountOnExit:!0,timeout:200,nodeRef:n},function(a){return React.createElement(IconCheck,{className:cnUserSelectItem("CheckIcon",{animate:a}),ref:n})}),!l&&g&&React.createElement(IconCheck,{className:cnUserSelectItem("CheckIcon")})),e?React.createElement("div",{className:cnUserSelectItem("Info")},React.createElement("div",null,d),React.createElement("div",{className:cnUserSelectItem("SubLabel",{disable:k})},e)):React.createElement("div",{className:cnUserSelectItem("Info")},d))});
|
|
2
2
|
//# sourceMappingURL=UserSelectItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserSelectItem.js","names":["IconCheck","React","forwardRef","useRef","Transition","Avatar","mapHorisontalSpase","mapHorisontalSpaseIncreased","mapItemVerticalPadding","cnMixSpace","
|
|
1
|
+
{"version":3,"file":"UserSelectItem.js","names":["IconCheck","React","forwardRef","useRef","Transition","Avatar","mapHorisontalSpase","mapHorisontalSpaseIncreased","mapItemVerticalPadding","cnMixSpace","cn","cnUserSelectItem","UserSelectItem","props","ref","className","label","subLabel","avatarUrl","active","hovered","size","indent","disable","multiple","otherProps","iconRef","pH","pV","animate"],"sources":["../../../../../../src/components/UserSelect/UserSelectItem/UserSelectItem.tsx"],"sourcesContent":["import './UserSelectItem.css';\n\nimport { IconCheck } from '@consta/icons/IconCheck';\nimport React, { forwardRef, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { Avatar } from '##/components/Avatar';\nimport {\n mapHorisontalSpase,\n mapHorisontalSpaseIncreased,\n mapItemVerticalPadding,\n} from '##/components/ListCanary';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\ntype UserSelectItemProps = PropsWithHTMLAttributes<\n {\n label: string;\n active: boolean;\n hovered: boolean;\n size: 's' | 'm' | 'l';\n indent: 'normal' | 'increased';\n subLabel?: string;\n avatarUrl?: string;\n disable?: boolean;\n multiple?: boolean;\n },\n HTMLDivElement\n>;\n\nexport const cnUserSelectItem = cn('UserSelectItem');\n\nexport const UserSelectItem = forwardRef<HTMLDivElement, UserSelectItemProps>(\n (props, ref) => {\n const {\n className,\n label,\n subLabel,\n avatarUrl,\n active,\n hovered,\n size,\n indent,\n disable,\n multiple,\n ...otherProps\n } = props;\n\n const iconRef = useRef<HTMLSpanElement>(null);\n\n return (\n <div\n {...otherProps}\n className={cnUserSelectItem(\n { active, hovered, size, indent, disable },\n [\n cnMixSpace({\n pH:\n indent === 'increased'\n ? mapHorisontalSpaseIncreased[size]\n : mapHorisontalSpase[size],\n pV: mapItemVerticalPadding[size],\n }),\n className,\n ],\n )}\n aria-selected={active}\n ref={ref}\n >\n <div className={cnUserSelectItem('AvatarContainer')}>\n <Avatar\n className={cnUserSelectItem('Avatar')}\n url={avatarUrl}\n name={label}\n />\n {multiple && (\n <Transition\n in={active}\n unmountOnExit\n timeout={200}\n nodeRef={iconRef}\n >\n {(animate) => (\n <IconCheck\n className={cnUserSelectItem('CheckIcon', { animate })}\n ref={iconRef}\n />\n )}\n </Transition>\n )}\n {!multiple && active && (\n <IconCheck className={cnUserSelectItem('CheckIcon')} />\n )}\n </div>\n {!subLabel ? (\n <div className={cnUserSelectItem('Info')}>{label}</div>\n ) : (\n <div className={cnUserSelectItem('Info')}>\n <div>{label}</div>\n <div className={cnUserSelectItem('SubLabel', { disable })}>\n {subLabel}\n </div>\n </div>\n )}\n </div>\n );\n },\n);\n"],"mappings":"wMAAA,6BAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAASC,M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AD,EACE,SAAS,CAAEA,gBAAgB,CAAC,QAAD,CAD7B,CAEE,GAAG,CAAEO,CAFP,CAGE,IAAI,CAAEF,CAHR,EADF,CAMGQ,CAAQ,EACP,oBAAC,UAAD,EACE,GAAIL,CADN,CAEE,aAAa,GAFf,CAGE,OAAO,CAAE,GAHX,CAIE,OAAO,CAAEO,CAJX,EAMG,SAACG,CAAD,QACC,qBAAC,SAAD,EACE,SAAS,CAAElB,gBAAgB,CAAC,WAAD,CAAc,CAAEkB,OAAO,CAAPA,CAAF,CAAd,CAD7B,CAEE,GAAG,CAAEH,CAFP,EADD,CANH,CAPJ,CAqBG,CAACF,CAAD,EAAaL,CAAb,EACC,oBAAC,SAAD,EAAW,SAAS,CAAER,gBAAgB,CAAC,WAAD,CAAtC,EAtBJ,CAlBF,CA2CIM,CAAD,CAGC,2BAAK,SAAS,CAAEN,gBAAgB,CAAC,MAAD,CAAhC,EACE,+BAAMK,CAAN,CADF,CAEE,2BAAK,SAAS,CAAEL,gBAAgB,CAAC,UAAD,CAAa,CAAEY,OAAO,CAAPA,CAAF,CAAb,CAAhC,EACGN,CADH,CAFF,CAHD,CACC,2BAAK,SAAS,CAAEN,gBAAgB,CAAC,MAAD,CAAhC,EAA2CK,CAA3C,CA5CJ,CAuDH,CA1EqC,CAAjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.UserSelectValue_multiple{margin-bottom:calc(var(--space-s)/4);margin-right:var(--space-xs)}.UserSelectValue_disabled{opacity:.6}.UserSelectValue:not(.UserSelectValue_multiple).User:hover{background-color:var(--color-control-bg-clear)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./UserSelectValue.css";import{IconClose}from"@consta/icons/IconClose";import React from"react";import{
|
|
1
|
+
import"./UserSelectValue.css";import{IconClose}from"@consta/icons/IconClose";import React from"react";import{cn}from"../../../utils/bem";import{User}from"../../User/User";export var cnUserSelectValue=cn("UserSelectValue");export var UserSelectValue=function(a){var b=a.size,c=a.label,d=a.subLabel,e=a.disabled,f=a.handleRemove,g=a.avatarUrl,h=a.multiple;return React.createElement(User,{className:cnUserSelectValue({multiple:h,size:b,disabled:e}),avatarUrl:g,name:c,info:d,size:b,view:h?"ghost":"clear",iconRight:!e&&h?IconClose:void 0,onIconRightClick:!e&&h?f:void 0})};
|
|
2
2
|
//# sourceMappingURL=UserSelectValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserSelectValue.js","names":["IconClose","React","
|
|
1
|
+
{"version":3,"file":"UserSelectValue.js","names":["IconClose","React","cn","User","cnUserSelectValue","UserSelectValue","props","size","label","subLabel","disabled","handleRemove","avatarUrl","multiple"],"sources":["../../../../../../src/components/UserSelect/UserSelectValue/UserSelectValue.tsx"],"sourcesContent":["import './UserSelectValue.css';\n\nimport { IconClose } from '@consta/icons/IconClose';\nimport React from 'react';\n\nimport { cn } from '../../../utils/bem';\nimport { User } from '../../User/User';\n\ntype UserValueProps = {\n label: string;\n size: 's' | 'm' | 'l';\n subLabel?: string;\n avatarUrl?: string;\n handleRemove?: (e: React.SyntheticEvent) => void;\n multiple?: boolean;\n disabled?: boolean;\n children?: never;\n};\n\nexport const cnUserSelectValue = cn('UserSelectValue');\n\nexport const UserSelectValue: React.FC<UserValueProps> = (props) => {\n const { size, label, subLabel, disabled, handleRemove, avatarUrl, multiple } =\n props;\n\n return (\n <User\n className={cnUserSelectValue({ multiple, size, disabled })}\n avatarUrl={avatarUrl}\n name={label}\n info={subLabel}\n size={size}\n view={multiple ? 'ghost' : 'clear'}\n iconRight={!disabled && multiple ? IconClose : undefined}\n onIconRightClick={!disabled && multiple ? handleRemove : undefined}\n />\n );\n};\n"],"mappings":"AAAA,8BAEA,OAASA,SAAT,KAA0B,yBAA1B,CACA,MAAOC,MAAP,KAAkB,OAAlB,CAEA,OAASC,EAAT,0BACA,OAASC,IAAT,uBAaA,MAAO,IAAMC,kBAAiB,CAAGF,EAAE,CAAC,iBAAD,CAA5B,CAEP,MAAO,IAAMG,gBAAyC,CAAG,SAACC,CAAD,CAAW,CAClE,GAAQC,EAAR,CACED,CADF,CAAQC,IAAR,CAAcC,CAAd,CACEF,CADF,CAAcE,KAAd,CAAqBC,CAArB,CACEH,CADF,CAAqBG,QAArB,CAA+BC,CAA/B,CACEJ,CADF,CAA+BI,QAA/B,CAAyCC,CAAzC,CACEL,CADF,CAAyCK,YAAzC,CAAuDC,CAAvD,CACEN,CADF,CAAuDM,SAAvD,CAAkEC,CAAlE,CACEP,CADF,CAAkEO,QAAlE,CAGA,MACE,qBAAC,IAAD,EACE,SAAS,CAAET,iBAAiB,CAAC,CAAES,QAAQ,CAARA,CAAF,CAAYN,IAAI,CAAJA,CAAZ,CAAkBG,QAAQ,CAARA,CAAlB,CAAD,CAD9B,CAEE,SAAS,CAAEE,CAFb,CAGE,IAAI,CAAEJ,CAHR,CAIE,IAAI,CAAEC,CAJR,CAKE,IAAI,CAAEF,CALR,CAME,IAAI,CAAEM,CAAQ,CAAG,OAAH,CAAa,OAN7B,CAOE,SAAS,CAAE,CAACH,CAAD,EAAaG,CAAb,CAAwBb,SAAxB,OAPb,CAQE,gBAAgB,CAAE,CAACU,CAAD,EAAaG,CAAb,CAAwBF,CAAxB,OARpB,EAWH,CAhBM"}
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["checked","intermediate","size","indent","hovered","countItems","className","total"];import React,{forwardRef}from"react";import{ListItem}from"../../ListCanary";import{Text}from"../../Text";import{cnCanary}from"../../../utils/bem";import{Checkbox}from"../../Checkbox/Checkbox";import{sizeCheckboxMap}from"../SelectItem/SelectItem";export var cnSelectItemAll=cnCanary("SelectItemAll");var textSizeMap={xs:"s",s:"s",m:"m",l:"l"};export var SelectItemAll=forwardRef(function(a,b){var c=a.checked,d=a.intermediate,e=a.size,f=a.indent,g=a.hovered,h=a.countItems,i=void 0===h?0:h,j=a.className,k=a.total,l=void 0===k?0:k,m=_objectWithoutProperties(a,_excluded);return React.createElement(ListItem,Object.assign({},m,{ref:b,className:cnSelectItemAll(null,[j]),"aria-selected":c,role:"option",label:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",innerOffset:f,size:e,active:g,rightSide:React.createElement(Text,{size:textSizeMap[e],lineHeight:"xs",view:"ghost"},"".concat(i," \u0438\u0437 ").concat(l)),leftSide:React.createElement(Checkbox,{checked:c,intermediate:d,size:sizeCheckboxMap[e]})}),"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435")});
|
|
2
|
-
//# sourceMappingURL=SelectSelectAll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectSelectAll.js","names":["React","forwardRef","ListItem","Text","cnCanary","Checkbox","sizeCheckboxMap","cnSelectItemAll","textSizeMap","xs","s","m","l","SelectItemAll","props","ref","checked","intermediate","size","indent","hovered","countItems","className","total","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectItemAll/SelectSelectAll.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { ListItem } from '##/components/ListCanary';\nimport { Text, TextPropSize } from '##/components/Text';\nimport { cnCanary } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { Checkbox } from '../../Checkbox/Checkbox';\nimport { sizeCheckboxMap } from '../SelectItem/SelectItem';\nimport { PropSize } from '../types';\n\nexport type SelectItemAllProps = PropsWithHTMLAttributesAndRef<\n {\n checked: boolean;\n intermediate?: boolean;\n size: PropSize;\n hovered?: boolean;\n indent?: 'normal' | 'increased';\n countItems?: number;\n total?: number;\n },\n HTMLDivElement\n>;\n\nexport const cnSelectItemAll = cnCanary('SelectItemAll');\n\nconst textSizeMap: Record<PropSize, TextPropSize> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nexport const SelectItemAll: React.FC<SelectItemAllProps> = forwardRef(\n (props, ref) => {\n const {\n checked,\n intermediate,\n size,\n indent,\n hovered,\n countItems = 0,\n className,\n total = 0,\n ...otherProps\n } = props;\n\n return (\n <ListItem\n {...otherProps}\n ref={ref}\n className={cnSelectItemAll(null, [className])}\n aria-selected={checked}\n role=\"option\"\n label=\"Выбрать все\"\n innerOffset={indent}\n size={size}\n active={hovered}\n rightSide={\n <Text\n size={textSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >{`${countItems} из ${total}`}</Text>\n }\n leftSide={\n <Checkbox\n checked={checked}\n intermediate={intermediate}\n size={sizeCheckboxMap[size]}\n />\n }\n >\n Выбрать все\n </ListItem>\n );\n },\n);\n"],"mappings":"yLAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,wBACA,OAASC,IAAT,kBACA,OAASC,QAAT,0BAGA,OAASC,QAAT,+BACA,OAASC,eAAT,gCAgBA,MAAO,IAAMC,gBAAe,CAAGH,QAAQ,CAAC,eAAD,CAAhC,CAEP,GAAMI,YAA2C,CAAG,CAClDC,EAAE,CAAE,GAD8C,CAElDC,CAAC,CAAE,GAF+C,CAGlDC,CAAC,CAAE,GAH+C,CAIlDC,CAAC,CAAE,GAJ+C,CAApD,CAOA,MAAO,IAAMC,cAA2C,CAAGZ,UAAU,CACnE,SAACa,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CAUIF,CAVJ,CACEE,OADF,CAEEC,CAFF,CAUIH,CAVJ,CAEEG,YAFF,CAGEC,CAHF,CAUIJ,CAVJ,CAGEI,IAHF,CAIEC,CAJF,CAUIL,CAVJ,CAIEK,MAJF,CAKEC,CALF,CAUIN,CAVJ,CAKEM,OALF,GAUIN,CAVJ,CAMEO,UANF,CAMEA,CANF,YAMe,CANf,GAOEC,CAPF,CAUIR,CAVJ,CAOEQ,SAPF,GAUIR,CAVJ,CAQES,KARF,CAQEA,CARF,YAQU,CARV,GASKC,CATL,0BAUIV,CAVJ,Y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