@consta/uikit 4.7.0 → 4.7.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/ListCanary/index.d.ts +1 -0
- package/ListCanary/index.js +1 -0
- package/__internal__/src/components/AutoCompleteCanary/useAutoComplete.d.ts +1 -6
- package/__internal__/src/components/Breadcrumbs/useElements.d.ts +6 -6
- package/__internal__/src/components/Breadcrumbs/useElements.js +1 -1
- package/__internal__/src/components/Breadcrumbs/useElements.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenu.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenu.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.css +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.d.ts +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevel/index.js.map +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/ContextMenuLevels.js.map +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.d.ts +1 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.js +2 -0
- package/__internal__/src/components/ContextMenu/ContextMenuLevels/index.js.map +1 -0
- package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +6 -1
- package/__internal__/src/components/ContextMenu/types.js +1 -1
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.d.ts +1 -2
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListAddItem/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListBox/ListBox.css +1 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/cnListBox.d.ts +2 -0
- package/__internal__/src/components/ListCanary/ListBox/cnListBox.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/cnListBox.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/index.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListBox/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.d.ts +3 -0
- package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.js +2 -0
- package/__internal__/src/components/ListCanary/ListBox/mapVerticalSpase.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListCanary.d.ts +0 -1
- package/__internal__/src/components/ListCanary/ListCanary.js +1 -1
- package/__internal__/src/components/ListCanary/ListCanary.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.css +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.d.ts +5 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js +2 -0
- package/__internal__/src/components/ListCanary/ListDivider/ListDivider.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/index.d.ts +1 -0
- package/__internal__/src/components/ListCanary/ListDivider/index.js +2 -0
- package/__internal__/src/components/ListCanary/ListDivider/index.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.css +1 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.d.ts +2 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js +1 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/ListGroupLabel.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListGroupLabel/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.css +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js +1 -1
- package/__internal__/src/components/ListCanary/ListItem/ListItem.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItem/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js +1 -1
- package/__internal__/src/components/ListCanary/ListItemGrid/ListItemGrid.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.css +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.d.ts +7 -3
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/ListLoader.js.map +1 -1
- package/__internal__/src/components/ListCanary/ListLoader/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/helper.d.ts +17 -19
- package/__internal__/src/components/ListCanary/helper.js +1 -1
- package/__internal__/src/components/ListCanary/helper.js.map +1 -1
- package/__internal__/src/components/ListCanary/index.d.ts +4 -0
- package/__internal__/src/components/ListCanary/index.js +1 -1
- package/__internal__/src/components/ListCanary/index.js.map +1 -1
- package/__internal__/src/components/ListCanary/maps.d.ts +9 -0
- package/__internal__/src/components/ListCanary/maps.js +2 -0
- package/__internal__/src/components/ListCanary/maps.js.map +1 -0
- package/__internal__/src/components/ListCanary/types.d.ts +55 -31
- package/__internal__/src/components/ListCanary/types.js +1 -1
- package/__internal__/src/components/ListCanary/types.js.map +1 -1
- package/__internal__/src/components/Popover/helpers.d.ts +1 -1
- package/__internal__/src/components/Popover/helpers.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.css +1 -1
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts +1 -1
- 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.css +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/SelectGroupLabel/SelectGroupLabel.d.ts +1 -3
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js.map +1 -1
- package/__internal__/src/components/SelectComponents/SelectItem/SelectItem.css +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/helpers.d.ts +1 -1
- package/__internal__/src/components/SelectComponents/helpers.js +1 -1
- package/__internal__/src/components/SelectComponents/helpers.js.map +1 -1
- package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.css +1 -1
- package/__internal__/src/components/UserSelect/UserSelectItem/UserSelectItem.d.ts +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/hooks/useRefs/useRefs.d.ts +3 -1
- package/__internal__/src/hooks/useRefs/useRefs.js +1 -1
- package/__internal__/src/hooks/useRefs/useRefs.js.map +1 -1
- package/__internal__/src/hooks/useSelect/useSelect.d.ts +1 -6
- package/__internal__/src/mixs/MixSpace/MixSpace.d.ts +17 -17
- package/__internal__/src/mixs/MixSpace/MixSpace.js.map +1 -1
- package/__internal__/src/utils/getGroups.d.ts +1 -1
- package/__internal__/src/utils/getGroups.js.map +1 -1
- package/package.json +1 -1
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.css +0 -1
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.d.ts +0 -4
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.js +0 -2
- package/__internal__/src/components/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +0 -1
- package/__internal__/src/components/ListCanary/List.css +0 -1
- package/__internal__/src/components/ListCanary/ListAddItem/ListAddItem.css +0 -1
- package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","names":["
|
|
1
|
+
{"version":3,"file":"helper.js","names":["defaultGetItemLabel","item","label","defaultGetItemDisabled","disabled","defaultGetItemActive","active","defaultGetItemChecked","checked","defaultGetItemStatus","status","defaultGetItemGroupKey","groupId","defaultGetItemLeftSide","leftSide","defaultGetItemLeftIcon","leftIcon","defaultGetItemRightSide","rightSide","defaultGetItemRightIcon","rightIcon","defaultGetItemOnClick","onClick","defaultGetGroupKey","group","id","defaultGetGroupLabel","defaultGetGroupRightSide","withDefaultGetters","props","getItemLabel","getItemGroupKey","getItemActive","getItemChecked","getItemDisabled","getItemLeftSide","getItemLeftIcon","getItemRightSide","getItemRightIcon","getItemStatus","getItemOnClick","getGroupLabel","getGroupKey","getGroupRightSide"],"sources":["../../../../../src/components/ListCanary/helper.ts"],"sourcesContent":["import {\n DefaultListGroup,\n DefaultListItem,\n ListPropGetGroupKey,\n ListPropGetGroupLabel,\n ListPropGetGroupRightSide,\n ListPropGetItemActive,\n ListPropGetItemChecked,\n ListPropGetItemDisabled,\n ListPropGetItemGroupId,\n ListPropGetItemLabel,\n ListPropGetItemLeftIcon,\n ListPropGetItemLeftSide,\n ListPropGetItemOnClick,\n ListPropGetItemRightIcon,\n ListPropGetItemRightSide,\n ListPropGetItemStatus,\n ListProps,\n} from './types';\n\nconst defaultGetItemLabel: ListPropGetItemLabel<DefaultListItem> = (item) =>\n item.label;\nconst defaultGetItemDisabled: ListPropGetItemDisabled<DefaultListItem> = (\n item,\n) => item.disabled;\nconst defaultGetItemActive: ListPropGetItemActive<DefaultListItem> = (item) =>\n item.active;\nconst defaultGetItemChecked: ListPropGetItemChecked<DefaultListItem> = (item) =>\n item.checked;\nconst defaultGetItemStatus: ListPropGetItemStatus<DefaultListItem> = (item) =>\n item.status;\nconst defaultGetItemGroupKey: ListPropGetItemGroupId<DefaultListItem> = (\n item,\n) => item.groupId;\nconst defaultGetItemLeftSide: ListPropGetItemLeftSide<DefaultListItem> = (\n item,\n) => item.leftSide;\nconst defaultGetItemLeftIcon: ListPropGetItemLeftIcon<DefaultListItem> = (\n item,\n) => item.leftIcon;\nconst defaultGetItemRightSide: ListPropGetItemRightSide<DefaultListItem> = (\n item,\n) => item.rightSide;\nconst defaultGetItemRightIcon: ListPropGetItemRightIcon<DefaultListItem> = (\n item,\n) => item.rightIcon;\n\nconst defaultGetItemOnClick: ListPropGetItemOnClick<DefaultListItem> = (item) =>\n item.onClick;\n\nconst defaultGetGroupKey: ListPropGetGroupKey<DefaultListGroup> = (group) =>\n group.id;\nconst defaultGetGroupLabel: ListPropGetGroupLabel<DefaultListGroup> = (group) =>\n group.label;\nconst defaultGetGroupRightSide: ListPropGetGroupRightSide<DefaultListGroup> = (\n group,\n) => group.rightSide;\n\nexport function withDefaultGetters<\n ITEM = DefaultListItem,\n GROUP = DefaultListGroup,\n>(props: ListProps<ITEM, GROUP>) {\n return {\n ...props,\n getItemLabel: props.getItemLabel || defaultGetItemLabel,\n getItemGroupKey: props.getItemGroupKey || defaultGetItemGroupKey,\n getItemActive: props.getItemActive || defaultGetItemActive,\n getItemChecked: props.getItemChecked || defaultGetItemChecked,\n getItemDisabled: props.getItemDisabled || defaultGetItemDisabled,\n getItemLeftSide: props.getItemLeftSide || defaultGetItemLeftSide,\n getItemLeftIcon: props.getItemLeftIcon || defaultGetItemLeftIcon,\n getItemRightSide: props.getItemRightSide || defaultGetItemRightSide,\n getItemRightIcon: props.getItemRightIcon || defaultGetItemRightIcon,\n getItemStatus: props.getItemStatus || defaultGetItemStatus,\n getItemOnClick: props.getItemOnClick || defaultGetItemOnClick,\n getGroupLabel: props.getGroupLabel || defaultGetGroupLabel,\n getGroupKey: props.getGroupKey || defaultGetGroupKey,\n getGroupRightSide: props.getGroupRightSide || defaultGetGroupRightSide,\n };\n}\n"],"mappings":"wqBAoBMA,oBAA0D,CAAG,SAACC,CAAD,QACjEA,EAAI,CAACC,KAD4D,C,CAE7DC,sBAAgE,CAAG,SACvEF,CADuE,QAEpEA,EAAI,CAACG,QAF+D,C,CAGnEC,oBAA4D,CAAG,SAACJ,CAAD,QACnEA,EAAI,CAACK,MAD8D,C,CAE/DC,qBAA8D,CAAG,SAACN,CAAD,QACrEA,EAAI,CAACO,OADgE,C,CAEjEC,oBAA4D,CAAG,SAACR,CAAD,QACnEA,EAAI,CAACS,MAD8D,C,CAE/DC,sBAA+D,CAAG,SACtEV,CADsE,QAEnEA,EAAI,CAACW,OAF8D,C,CAGlEC,sBAAgE,CAAG,SACvEZ,CADuE,QAEpEA,EAAI,CAACa,QAF+D,C,CAGnEC,sBAAgE,CAAG,SACvEd,CADuE,QAEpEA,EAAI,CAACe,QAF+D,C,CAGnEC,uBAAkE,CAAG,SACzEhB,CADyE,QAEtEA,EAAI,CAACiB,SAFiE,C,CAGrEC,uBAAkE,CAAG,SACzElB,CADyE,QAEtEA,EAAI,CAACmB,SAFiE,C,CAIrEC,qBAA8D,CAAG,SAACpB,CAAD,QACrEA,EAAI,CAACqB,OADgE,C,CAGjEC,kBAAyD,CAAG,SAACC,CAAD,QAChEA,EAAK,CAACC,EAD0D,C,CAE5DC,oBAA6D,CAAG,SAACF,CAAD,QACpEA,EAAK,CAACtB,KAD8D,C,CAEhEyB,wBAAqE,CAAG,SAC5EH,CAD4E,QAEzEA,EAAK,CAACN,SAFmE,C,CAI9E,MAAO,SAASU,mBAAT,CAGLC,CAHK,CAG0B,CAC/B,sCACKA,CADL,MAEEC,YAAY,CAAED,CAAK,CAACC,YAAN,EAAsB9B,mBAFtC,CAGE+B,eAAe,CAAEF,CAAK,CAACE,eAAN,EAAyBpB,sBAH5C,CAIEqB,aAAa,CAAEH,CAAK,CAACG,aAAN,EAAuB3B,oBAJxC,CAKE4B,cAAc,CAAEJ,CAAK,CAACI,cAAN,EAAwB1B,qBAL1C,CAME2B,eAAe,CAAEL,CAAK,CAACK,eAAN,EAAyB/B,sBAN5C,CAOEgC,eAAe,CAAEN,CAAK,CAACM,eAAN,EAAyBtB,sBAP5C,CAQEuB,eAAe,CAAEP,CAAK,CAACO,eAAN,EAAyBrB,sBAR5C,CASEsB,gBAAgB,CAAER,CAAK,CAACQ,gBAAN,EAA0BpB,uBAT9C,CAUEqB,gBAAgB,CAAET,CAAK,CAACS,gBAAN,EAA0BnB,uBAV9C,CAWEoB,aAAa,CAAEV,CAAK,CAACU,aAAN,EAAuB9B,oBAXxC,CAYE+B,cAAc,CAAEX,CAAK,CAACW,cAAN,EAAwBnB,qBAZ1C,CAaEoB,aAAa,CAAEZ,CAAK,CAACY,aAAN,EAAuBf,oBAbxC,CAcEgB,WAAW,CAAEb,CAAK,CAACa,WAAN,EAAqBnB,kBAdpC,CAeEoB,iBAAiB,CAAEd,CAAK,CAACc,iBAAN,EAA2BhB,wBAfhD,EAiBD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export*from"./ListCanary";export*from"./types";export*from"./ListAddItem";export*from"./ListItem";export*from"./ListLoader";export*from"./ListGroupLabel";
|
|
1
|
+
export*from"./ListCanary";export*from"./types";export*from"./ListAddItem";export*from"./ListItem";export*from"./ListLoader";export*from"./ListGroupLabel";export*from"./ListItemGrid";export*from"./ListBox";export*from"./ListDivider";export*from"./maps";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/ListCanary/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/ListCanary/index.ts"],"sourcesContent":["export * from './ListCanary';\nexport * from './types';\nexport * from './ListAddItem';\nexport * from './ListItem';\nexport * from './ListLoader';\nexport * from './ListGroupLabel';\nexport * from './ListItemGrid';\nexport * from './ListBox';\nexport * from './ListDivider';\nexport * from './maps';\n"],"mappings":"AAAA,0BACA,qBACA,2BACA,wBACA,0BACA,8BACA,4BACA,uBACA,2BACA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IconPropSize } from '@consta/icons/Icon';
|
|
2
|
+
import { Space } from "../../mixs/MixSpace";
|
|
3
|
+
import { ListPropSize } from './types';
|
|
4
|
+
export declare const mapHorisontalSpase: Record<ListPropSize, Space>;
|
|
5
|
+
export declare const mapHorisontalSpaseIncreased: Record<ListPropSize, Space>;
|
|
6
|
+
export declare const mapGroupVerticalSpaseTop: Record<ListPropSize, Space>;
|
|
7
|
+
export declare const mapGroupVerticalSpaseBottom: Record<ListPropSize, Space>;
|
|
8
|
+
export declare const mapItemVerticalPadding: Record<ListPropSize, Space>;
|
|
9
|
+
export declare const mapIconSize: Record<ListPropSize, IconPropSize>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export var mapHorisontalSpase={xs:"xs",s:"xs",m:"s",l:"s"};export var mapHorisontalSpaseIncreased={xs:"s",s:"s",m:"m",l:"l"};export var mapGroupVerticalSpaseTop={xs:"s",s:"m",m:"m",l:"l"};export var mapGroupVerticalSpaseBottom={xs:"2xs",s:"2xs",m:"xs",l:"s"};export var mapItemVerticalPadding={xs:"2xs",s:"2xs",m:"xs",l:"xs"};export var mapIconSize={xs:"xs",s:"xs",m:"s",l:"s"};
|
|
2
|
+
//# sourceMappingURL=maps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maps.js","names":["mapHorisontalSpase","xs","s","m","l","mapHorisontalSpaseIncreased","mapGroupVerticalSpaseTop","mapGroupVerticalSpaseBottom","mapItemVerticalPadding","mapIconSize"],"sources":["../../../../../src/components/ListCanary/maps.ts"],"sourcesContent":["import { IconPropSize } from '@consta/icons/Icon';\n\nimport { Space } from '##/mixs/MixSpace';\n\nimport { ListPropSize } from './types';\n\nexport const mapHorisontalSpase: Record<ListPropSize, Space> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 's',\n};\n\nexport const mapHorisontalSpaseIncreased: Record<ListPropSize, Space> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nexport const mapGroupVerticalSpaseTop: Record<ListPropSize, Space> = {\n xs: 's',\n s: 'm',\n m: 'm',\n l: 'l',\n};\n\nexport const mapGroupVerticalSpaseBottom: Record<ListPropSize, Space> = {\n xs: '2xs',\n s: '2xs',\n m: 'xs',\n l: 's',\n};\n\nexport const mapItemVerticalPadding: Record<ListPropSize, Space> = {\n xs: '2xs',\n s: '2xs',\n m: 'xs',\n l: 'xs',\n};\n\nexport const mapIconSize: Record<ListPropSize, IconPropSize> = {\n xs: 'xs',\n s: 'xs',\n m: 's',\n l: 's',\n};\n"],"mappings":"AAMA,MAAO,IAAMA,mBAA+C,CAAG,CAC7DC,EAAE,CAAE,IADyD,CAE7DC,CAAC,CAAE,IAF0D,CAG7DC,CAAC,CAAE,GAH0D,CAI7DC,CAAC,CAAE,GAJ0D,CAAxD,CAOP,MAAO,IAAMC,4BAAwD,CAAG,CACtEJ,EAAE,CAAE,GADkE,CAEtEC,CAAC,CAAE,GAFmE,CAGtEC,CAAC,CAAE,GAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAME,yBAAqD,CAAG,CACnEL,EAAE,CAAE,GAD+D,CAEnEC,CAAC,CAAE,GAFgE,CAGnEC,CAAC,CAAE,GAHgE,CAInEC,CAAC,CAAE,GAJgE,CAA9D,CAOP,MAAO,IAAMG,4BAAwD,CAAG,CACtEN,EAAE,CAAE,KADkE,CAEtEC,CAAC,CAAE,KAFmE,CAGtEC,CAAC,CAAE,IAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAMI,uBAAmD,CAAG,CACjEP,EAAE,CAAE,KAD6D,CAEjEC,CAAC,CAAE,KAF8D,CAGjEC,CAAC,CAAE,IAH8D,CAIjEC,CAAC,CAAE,IAJ8D,CAA5D,CAOP,MAAO,IAAMK,YAA+C,CAAG,CAC7DR,EAAE,CAAE,IADyD,CAE7DC,CAAC,CAAE,IAF0D,CAG7DC,CAAC,CAAE,GAH0D,CAI7DC,CAAC,CAAE,GAJ0D,CAAxD"}
|
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
import { IconComponent } from '@consta/icons/Icon';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { MixSpaceProps } from "../../mixs/MixSpace";
|
|
4
|
+
import { Group } from "../../utils/getGroups";
|
|
3
5
|
import { PropsWithAsAttributes } from "../../utils/types/PropsWithAsAttributes";
|
|
4
6
|
import { PropsWithHTMLAttributesAndRef } from "../../utils/types/PropsWithHTMLAttributes";
|
|
5
7
|
export declare const listPropSize: readonly ["m", "xs", "s", "l"];
|
|
6
8
|
export declare type ListPropSize = typeof listPropSize[number];
|
|
7
9
|
export declare const defaultListPropSize: "m";
|
|
8
|
-
export declare const
|
|
9
|
-
export declare type
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const listPropInnerOffset: readonly ["normal", "increased"];
|
|
11
|
+
export declare type ListPropInnerOffset = typeof listPropInnerOffset[number];
|
|
12
|
+
export declare const defaultListPropInnerOffset: "normal";
|
|
13
|
+
export declare const listPropStatus: readonly ["alert", "success", "warning"];
|
|
14
|
+
export declare type ListPropStatus = typeof listPropStatus[number];
|
|
15
|
+
export declare const listPropForm: readonly ["default", "brick", "round"];
|
|
16
|
+
export declare type ListPropForm = typeof listPropForm[number];
|
|
17
|
+
export declare const defaultListPropForm: "default";
|
|
11
18
|
export declare type DefaultListGroup = {
|
|
12
19
|
id: string | number;
|
|
13
|
-
label
|
|
20
|
+
label?: string;
|
|
14
21
|
rightSide?: React.ReactNode;
|
|
15
22
|
};
|
|
16
23
|
export declare type DefaultListItem = {
|
|
17
|
-
|
|
18
|
-
label: string;
|
|
24
|
+
label: React.ReactNode;
|
|
19
25
|
disabled?: boolean;
|
|
20
26
|
active?: boolean;
|
|
27
|
+
checked?: boolean;
|
|
28
|
+
status?: ListPropStatus;
|
|
21
29
|
groupId?: string | number;
|
|
22
30
|
leftSide?: React.ReactNode;
|
|
23
31
|
leftIcon?: IconComponent;
|
|
24
32
|
rightSide?: React.ReactNode;
|
|
25
33
|
rightIcon?: IconComponent;
|
|
26
34
|
onClick?: React.MouseEventHandler;
|
|
27
|
-
as?: keyof JSX.IntrinsicElements;
|
|
28
|
-
attributes?: JSX.IntrinsicElements[keyof JSX.IntrinsicElements];
|
|
29
35
|
};
|
|
30
|
-
export declare type ListPropOnItemClick<ITEM> = (params: {
|
|
36
|
+
export declare type ListPropOnItemClick<ITEM> = (item: ITEM, params: {
|
|
31
37
|
e: React.MouseEvent;
|
|
32
38
|
item: ITEM;
|
|
33
39
|
}) => void;
|
|
34
40
|
export declare type ListPropRenderItem<ITEM> = (item: ITEM) => React.ReactElement | null;
|
|
35
|
-
export declare type
|
|
36
|
-
export declare type
|
|
41
|
+
export declare type ListPropGetItemLabel<ITEM> = (item: ITEM) => React.ReactNode;
|
|
42
|
+
export declare type ListPropGetItemAdditionalClassName<ITEM> = (item: ITEM) => string;
|
|
37
43
|
export declare type ListPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;
|
|
38
44
|
export declare type ListPropGetItemActive<ITEM> = (item: ITEM) => boolean | undefined;
|
|
45
|
+
export declare type ListPropGetItemChecked<ITEM> = (item: ITEM) => boolean | undefined;
|
|
46
|
+
export declare type ListPropGetItemStatus<ITEM> = (item: ITEM) => ListPropStatus | undefined;
|
|
39
47
|
export declare type ListPropGetItemGroupId<ITEM> = (item: ITEM) => string | number | undefined;
|
|
40
48
|
export declare type ListPropGetItemLeftSide<ITEM> = (item: ITEM) => React.ReactNode | undefined;
|
|
41
49
|
export declare type ListPropGetItemLeftIcon<ITEM> = (item: ITEM) => IconComponent | undefined;
|
|
@@ -44,45 +52,47 @@ export declare type ListPropGetItemRightIcon<ITEM> = (item: ITEM) => IconCompone
|
|
|
44
52
|
export declare type ListPropGetItemAs<ITEM> = (item: ITEM) => keyof JSX.IntrinsicElements | undefined;
|
|
45
53
|
export declare type ListPropGetItemAttributes<ITEM> = (item: ITEM) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;
|
|
46
54
|
export declare type ListPropGetItemOnClick<ITEM> = (item: ITEM) => React.MouseEventHandler | undefined;
|
|
55
|
+
export declare type ListPropSortGroup<ITEM, GROUP> = (a: Group<ITEM, GROUP>, b: Group<ITEM, GROUP>) => number;
|
|
47
56
|
export declare type ListPropGetGroupKey<GROUP> = (item: GROUP) => string | number;
|
|
48
|
-
export declare type
|
|
57
|
+
export declare type ListPropGetGroupAdditionalClassName<GROUP> = (item: GROUP) => string;
|
|
58
|
+
export declare type ListPropGetGroupLabel<GROUP> = (item: GROUP) => string | undefined;
|
|
49
59
|
export declare type ListPropGetGroupRightSide<GROUP> = (item: GROUP) => React.ReactNode | undefined;
|
|
50
|
-
export declare type
|
|
60
|
+
export declare type ListPropGetItemRef<ITEM> = (item: ITEM) => React.RefObject<HTMLElement> | undefined;
|
|
61
|
+
export declare type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup> = {
|
|
51
62
|
size?: ListPropSize;
|
|
52
63
|
items: ITEM[];
|
|
53
|
-
|
|
64
|
+
innerOffset?: ListPropInnerOffset;
|
|
65
|
+
itemSpase?: MixSpaceProps;
|
|
66
|
+
groupLabelSpase?: MixSpaceProps;
|
|
67
|
+
dividerSpase?: MixSpaceProps;
|
|
54
68
|
onItemClick?: ListPropOnItemClick<ITEM>;
|
|
55
|
-
getItemKey?: ListPropGetItemKey<ITEM>;
|
|
56
69
|
getItemLabel?: ListPropGetItemLabel<ITEM>;
|
|
57
70
|
getItemDisabled?: ListPropGetItemDisabled<ITEM>;
|
|
58
71
|
getItemActive?: ListPropGetItemActive<ITEM>;
|
|
72
|
+
getItemChecked?: ListPropGetItemActive<ITEM>;
|
|
59
73
|
getItemLeftSide?: ListPropGetItemLeftSide<ITEM>;
|
|
60
74
|
getItemLeftIcon?: ListPropGetItemLeftIcon<ITEM>;
|
|
61
75
|
getItemRightSide?: ListPropGetItemRightSide<ITEM>;
|
|
62
76
|
getItemRightIcon?: ListPropGetItemRightIcon<ITEM>;
|
|
63
77
|
getItemGroupKey?: ListPropGetItemGroupId<ITEM>;
|
|
64
78
|
getItemOnClick?: ListPropGetItemOnClick<ITEM>;
|
|
79
|
+
getItemStatus?: ListPropGetItemStatus<ITEM>;
|
|
65
80
|
getItemAs?: ListPropGetItemAs<ITEM>;
|
|
66
81
|
getItemAttributes?: ListPropGetItemAttributes<ITEM>;
|
|
82
|
+
getItemRef?: ListPropGetItemRef<ITEM>;
|
|
83
|
+
getItemAdditionalClassName?: ListPropGetItemAdditionalClassName<ITEM>;
|
|
67
84
|
renderItem?: ListPropRenderItem<ITEM>;
|
|
68
85
|
groups?: GROUP[];
|
|
69
86
|
getGroupKey?: ListPropGetGroupKey<GROUP>;
|
|
70
87
|
getGroupLabel?: ListPropGetGroupLabel<GROUP>;
|
|
71
88
|
getGroupRightSide?: ListPropGetGroupRightSide<GROUP>;
|
|
72
|
-
|
|
89
|
+
sortGroup?: ListPropSortGroup<ITEM, GROUP>;
|
|
90
|
+
getGroupAdditionalClassName?: ListPropGetGroupAdditionalClassName<GROUP>;
|
|
73
91
|
disabled?: boolean;
|
|
74
|
-
}
|
|
92
|
+
} & (ITEM extends {
|
|
75
93
|
label: DefaultListItem['label'];
|
|
76
94
|
} ? {} : {
|
|
77
95
|
getItemLabel: ListPropGetItemLabel<ITEM>;
|
|
78
|
-
}) & (ITEM extends {
|
|
79
|
-
id: DefaultListItem['id'];
|
|
80
|
-
} ? {} : {
|
|
81
|
-
getItemKey: ListPropGetItemKey<ITEM>;
|
|
82
|
-
}) & (GROUP extends {
|
|
83
|
-
label: DefaultListGroup['label'];
|
|
84
|
-
} ? {} : {
|
|
85
|
-
getGroupLabel: ListPropGetGroupLabel<GROUP>;
|
|
86
96
|
}) & (GROUP extends {
|
|
87
97
|
id: DefaultListGroup['id'];
|
|
88
98
|
} ? {} : {
|
|
@@ -90,19 +100,33 @@ export declare type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup>
|
|
|
90
100
|
});
|
|
91
101
|
export declare type ListComponent = <ITEM = DefaultListItem, GROUP = DefaultListGroup>(props: ListProps<ITEM, GROUP>) => React.ReactElement | null;
|
|
92
102
|
export declare type ListItemProps<AS extends keyof JSX.IntrinsicElements = 'div'> = PropsWithAsAttributes<Omit<DefaultListItem, 'id' | 'groupId' | 'attributes' | 'onClick'> & {
|
|
93
|
-
active?: boolean;
|
|
94
103
|
size?: ListPropSize;
|
|
95
|
-
|
|
104
|
+
innerOffset?: 'normal' | 'increased';
|
|
105
|
+
space?: MixSpaceProps;
|
|
96
106
|
}, AS> & React.RefAttributes<HTMLDivElement>;
|
|
97
107
|
export declare type ListItemComponent = <AS extends keyof JSX.IntrinsicElements = 'div'>(props: ListItemProps<AS>, ref: React.Ref<HTMLElement>) => React.ReactElement | null;
|
|
98
108
|
export declare type ListGroupLabelProps = PropsWithHTMLAttributesAndRef<{
|
|
99
109
|
size?: ListPropSize;
|
|
100
|
-
label
|
|
110
|
+
label: string;
|
|
111
|
+
innerOffset?: ListPropInnerOffset;
|
|
101
112
|
rightSide?: React.ReactNode;
|
|
113
|
+
space?: MixSpaceProps;
|
|
114
|
+
}, HTMLDivElement>;
|
|
115
|
+
export declare type ListDividerProps = PropsWithHTMLAttributesAndRef<{
|
|
116
|
+
size?: ListPropSize;
|
|
117
|
+
innerOffset?: ListPropInnerOffset;
|
|
118
|
+
space?: MixSpaceProps;
|
|
119
|
+
}, HTMLDivElement>;
|
|
120
|
+
export declare type ListBoxProps = PropsWithHTMLAttributesAndRef<{
|
|
121
|
+
size?: ListPropSize;
|
|
122
|
+
form?: ListPropForm;
|
|
123
|
+
border?: boolean;
|
|
124
|
+
shadow?: boolean;
|
|
102
125
|
}, HTMLDivElement>;
|
|
103
126
|
export declare type ListAddItemProps = PropsWithHTMLAttributesAndRef<{
|
|
104
127
|
size?: ListPropSize;
|
|
105
|
-
label
|
|
106
|
-
|
|
107
|
-
|
|
128
|
+
label: React.ReactNode;
|
|
129
|
+
innerOffset?: ListPropInnerOffset;
|
|
130
|
+
active?: boolean;
|
|
131
|
+
underLine?: boolean;
|
|
108
132
|
}, HTMLDivElement>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var listPropSize=["m","xs","s","l"];export var defaultListPropSize=listPropSize[0];export var
|
|
1
|
+
export var listPropSize=["m","xs","s","l"];export var defaultListPropSize=listPropSize[0];export var listPropInnerOffset=["normal","increased"];export var defaultListPropInnerOffset=listPropInnerOffset[0];export var listPropStatus=["alert","success","warning"];export var listPropForm=["default","brick","round"];export var defaultListPropForm=listPropForm[0];
|
|
2
2
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["listPropSize","defaultListPropSize","
|
|
1
|
+
{"version":3,"file":"types.js","names":["listPropSize","defaultListPropSize","listPropInnerOffset","defaultListPropInnerOffset","listPropStatus","listPropForm","defaultListPropForm"],"sources":["../../../../../src/components/ListCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport { MixSpaceProps } from '##/mixs/MixSpace';\nimport { Group } from '##/utils/getGroups';\nimport { PropsWithAsAttributes } from '##/utils/types/PropsWithAsAttributes';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport const listPropSize = ['m', 'xs', 's', 'l'] as const;\nexport type ListPropSize = typeof listPropSize[number];\nexport const defaultListPropSize = listPropSize[0];\n\nexport const listPropInnerOffset = ['normal', 'increased'] as const;\nexport type ListPropInnerOffset = typeof listPropInnerOffset[number];\nexport const defaultListPropInnerOffset = listPropInnerOffset[0];\n\nexport const listPropStatus = ['alert', 'success', 'warning'] as const;\nexport type ListPropStatus = typeof listPropStatus[number];\n\nexport const listPropForm = ['default', 'brick', 'round'] as const;\nexport type ListPropForm = typeof listPropForm[number];\nexport const defaultListPropForm = listPropForm[0];\n\nexport type DefaultListGroup = {\n id: string | number;\n label?: string;\n rightSide?: React.ReactNode;\n};\n\nexport type DefaultListItem = {\n label: React.ReactNode;\n disabled?: boolean;\n active?: boolean;\n checked?: boolean;\n status?: ListPropStatus;\n groupId?: string | number;\n leftSide?: React.ReactNode;\n leftIcon?: IconComponent;\n rightSide?: React.ReactNode;\n rightIcon?: IconComponent;\n onClick?: React.MouseEventHandler;\n};\n\nexport type ListPropOnItemClick<ITEM> = (\n item: ITEM,\n params: {\n e: React.MouseEvent;\n item: ITEM;\n },\n) => void;\n\nexport type ListPropRenderItem<ITEM> = (\n item: ITEM,\n) => React.ReactElement | null;\n\n// ITEMS\n\nexport type ListPropGetItemLabel<ITEM> = (item: ITEM) => React.ReactNode;\n\nexport type ListPropGetItemAdditionalClassName<ITEM> = (item: ITEM) => string;\n\nexport type ListPropGetItemDisabled<ITEM> = (item: ITEM) => boolean | undefined;\n\nexport type ListPropGetItemActive<ITEM> = (item: ITEM) => boolean | undefined;\n\nexport type ListPropGetItemChecked<ITEM> = (item: ITEM) => boolean | undefined;\n\nexport type ListPropGetItemStatus<ITEM> = (\n item: ITEM,\n) => ListPropStatus | undefined;\n\nexport type ListPropGetItemGroupId<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\n\nexport type ListPropGetItemLeftSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ListPropGetItemLeftIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ListPropGetItemRightSide<ITEM> = (\n item: ITEM,\n) => React.ReactNode | undefined;\n\nexport type ListPropGetItemRightIcon<ITEM> = (\n item: ITEM,\n) => IconComponent | undefined;\n\nexport type ListPropGetItemAs<ITEM> = (\n item: ITEM,\n) => keyof JSX.IntrinsicElements | undefined;\n\nexport type ListPropGetItemAttributes<ITEM> = (\n item: ITEM,\n) => JSX.IntrinsicElements[keyof JSX.IntrinsicElements] | undefined;\n\nexport type ListPropGetItemOnClick<ITEM> = (\n item: ITEM,\n) => React.MouseEventHandler | undefined;\n\nexport type ListPropSortGroup<ITEM, GROUP> = (\n a: Group<ITEM, GROUP>,\n b: Group<ITEM, GROUP>,\n) => number;\n\n// GROUPS\nexport type ListPropGetGroupKey<GROUP> = (item: GROUP) => string | number;\nexport type ListPropGetGroupAdditionalClassName<GROUP> = (\n item: GROUP,\n) => string;\n\nexport type ListPropGetGroupLabel<GROUP> = (item: GROUP) => string | undefined;\nexport type ListPropGetGroupRightSide<GROUP> = (\n item: GROUP,\n) => React.ReactNode | undefined;\n\nexport type ListPropGetItemRef<ITEM> = (\n item: ITEM,\n) => React.RefObject<HTMLElement> | undefined;\n\nexport type ListProps<ITEM = DefaultListItem, GROUP = DefaultListGroup> = {\n size?: ListPropSize;\n items: ITEM[];\n innerOffset?: ListPropInnerOffset;\n itemSpase?: MixSpaceProps;\n groupLabelSpase?: MixSpaceProps;\n dividerSpase?: MixSpaceProps;\n onItemClick?: ListPropOnItemClick<ITEM>;\n getItemLabel?: ListPropGetItemLabel<ITEM>;\n getItemDisabled?: ListPropGetItemDisabled<ITEM>;\n getItemActive?: ListPropGetItemActive<ITEM>;\n getItemChecked?: ListPropGetItemActive<ITEM>;\n getItemLeftSide?: ListPropGetItemLeftSide<ITEM>;\n getItemLeftIcon?: ListPropGetItemLeftIcon<ITEM>;\n getItemRightSide?: ListPropGetItemRightSide<ITEM>;\n getItemRightIcon?: ListPropGetItemRightIcon<ITEM>;\n getItemGroupKey?: ListPropGetItemGroupId<ITEM>;\n getItemOnClick?: ListPropGetItemOnClick<ITEM>;\n getItemStatus?: ListPropGetItemStatus<ITEM>;\n getItemAs?: ListPropGetItemAs<ITEM>;\n getItemAttributes?: ListPropGetItemAttributes<ITEM>;\n getItemRef?: ListPropGetItemRef<ITEM>;\n getItemAdditionalClassName?: ListPropGetItemAdditionalClassName<ITEM>;\n renderItem?: ListPropRenderItem<ITEM>;\n groups?: GROUP[];\n getGroupKey?: ListPropGetGroupKey<GROUP>;\n getGroupLabel?: ListPropGetGroupLabel<GROUP>;\n getGroupRightSide?: ListPropGetGroupRightSide<GROUP>;\n sortGroup?: ListPropSortGroup<ITEM, GROUP>;\n getGroupAdditionalClassName?: ListPropGetGroupAdditionalClassName<GROUP>;\n disabled?: boolean;\n} & (ITEM extends { label: DefaultListItem['label'] }\n ? {}\n : { getItemLabel: ListPropGetItemLabel<ITEM> }) &\n (GROUP extends { id: DefaultListGroup['id'] }\n ? {}\n : { getGroupKey: ListPropGetGroupKey<GROUP> });\n\nexport type ListComponent = <ITEM = DefaultListItem, GROUP = DefaultListGroup>(\n props: ListProps<ITEM, GROUP>,\n) => React.ReactElement | null;\n\nexport type ListItemProps<AS extends keyof JSX.IntrinsicElements = 'div'> =\n PropsWithAsAttributes<\n Omit<DefaultListItem, 'id' | 'groupId' | 'attributes' | 'onClick'> & {\n size?: ListPropSize;\n innerOffset?: 'normal' | 'increased';\n space?: MixSpaceProps;\n },\n AS\n > &\n React.RefAttributes<HTMLDivElement>;\n\nexport type ListItemComponent = <\n AS extends keyof JSX.IntrinsicElements = 'div',\n>(\n props: ListItemProps<AS>,\n ref: React.Ref<HTMLElement>,\n) => React.ReactElement | null;\n\nexport type ListGroupLabelProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n label: string;\n innerOffset?: ListPropInnerOffset;\n rightSide?: React.ReactNode;\n space?: MixSpaceProps;\n },\n HTMLDivElement\n>;\n\nexport type ListDividerProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n innerOffset?: ListPropInnerOffset;\n space?: MixSpaceProps;\n },\n HTMLDivElement\n>;\n\nexport type ListBoxProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n form?: ListPropForm;\n border?: boolean;\n shadow?: boolean;\n },\n HTMLDivElement\n>;\n\nexport type ListAddItemProps = PropsWithHTMLAttributesAndRef<\n {\n size?: ListPropSize;\n label: React.ReactNode;\n innerOffset?: ListPropInnerOffset;\n active?: boolean;\n underLine?: boolean;\n },\n HTMLDivElement\n>;\n"],"mappings":"AAQA,MAAO,IAAMA,aAAY,CAAG,CAAC,GAAD,CAAM,IAAN,CAAY,GAAZ,CAAiB,GAAjB,CAArB,CAEP,MAAO,IAAMC,oBAAmB,CAAGD,YAAY,CAAC,CAAD,CAAxC,CAEP,MAAO,IAAME,oBAAmB,CAAG,CAAC,QAAD,CAAW,WAAX,CAA5B,CAEP,MAAO,IAAMC,2BAA0B,CAAGD,mBAAmB,CAAC,CAAD,CAAtD,CAEP,MAAO,IAAME,eAAc,CAAG,CAAC,OAAD,CAAU,SAAV,CAAqB,SAArB,CAAvB,CAGP,MAAO,IAAMC,aAAY,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAArB,CAEP,MAAO,IAAMC,oBAAmB,CAAGD,YAAY,CAAC,CAAD,CAAxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Direction, Position } from './Popover';
|
|
2
|
-
declare type Size = Pick<
|
|
2
|
+
declare type Size = Pick<DOMRect, 'width' | 'height'>;
|
|
3
3
|
declare type PositionsByDirection = Record<Direction, NonNullable<Position>>;
|
|
4
4
|
export declare const getPositionsByDirection: ({ contentSize, anchorSize, position: { x, y }, arrowOffset, offset, }: {
|
|
5
5
|
contentSize: Size;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["getPosition","x","y","Math","round","getPositionsByDirection","contentSize","anchorSize","position","arrowOffset","offset","contentWidth","width","contentHeight","height","anchorWidth","anchorHeight","anchorCenter","xForRightDirections","xForLeftDirections","xForVerticalDirections","right","center","left","yForDownDirections","yForUpDirections","yForHorizontalDirections","up","down","xForStartLeftDirections","xForStartRightDirections","yForStartUpDirections","yForStartDownDirections","upLeft","upCenter","upRight","downLeft","downCenter","downRight","rightUp","rightCenter","rightDown","leftUp","leftCenter","leftDown","downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown","getComputedPositionAndDirection","initialPosition","viewportSize","initialDirection","direction","possibleDirections","bannedDirections","spareDirection","positionsByDirection","filter","dir","includes","find","pos","isFittingDown","isFittingUp","isFittingLeft","isFittingRight"],"sources":["../../../../../src/components/Popover/helpers.ts"],"sourcesContent":["import { Direction, Position } from './Popover';\n\ntype Size = Pick<ClientRect, 'width' | 'height'>;\n\ntype PositionsByDirection = Record<Direction, NonNullable<Position>>;\n\nconst getPosition = (x: number, y: number): NonNullable<Position> => ({\n x: Math.round(x),\n y: Math.round(y),\n});\n\nexport const getPositionsByDirection = ({\n contentSize,\n anchorSize,\n position: { x, y },\n arrowOffset = 0,\n offset = 0,\n}: {\n contentSize: Size;\n anchorSize: Size;\n position: NonNullable<Position>;\n arrowOffset?: number;\n offset?: number;\n}): PositionsByDirection => {\n const { width: contentWidth, height: contentHeight } = contentSize;\n const { width: anchorWidth, height: anchorHeight } = anchorSize;\n const anchorCenter = {\n x: x + anchorWidth / 2,\n y: y + anchorHeight / 2,\n };\n\n const xForRightDirections = x + anchorWidth + offset;\n const xForLeftDirections = x - contentWidth - offset;\n const xForVerticalDirections = {\n right: anchorCenter.x - arrowOffset,\n center: anchorCenter.x - contentWidth / 2,\n left: anchorCenter.x - contentWidth + arrowOffset,\n };\n\n const yForDownDirections = y + anchorHeight + offset;\n const yForUpDirections = y - contentHeight - offset;\n const yForHorizontalDirections = {\n up: anchorCenter.y - contentHeight + arrowOffset,\n center: anchorCenter.y - contentHeight / 2,\n down: anchorCenter.y - arrowOffset,\n };\n\n const xForStartLeftDirections = x;\n const xForStartRightDirections = x - contentWidth + anchorWidth;\n\n const yForStartUpDirections = y;\n const yForStartDownDirections = y - contentHeight + anchorHeight;\n\n return {\n upLeft: getPosition(xForVerticalDirections.left, yForUpDirections),\n upCenter: getPosition(xForVerticalDirections.center, yForUpDirections),\n upRight: getPosition(xForVerticalDirections.right, yForUpDirections),\n\n downLeft: getPosition(xForVerticalDirections.left, yForDownDirections),\n downCenter: getPosition(xForVerticalDirections.center, yForDownDirections),\n downRight: getPosition(xForVerticalDirections.right, yForDownDirections),\n\n rightUp: getPosition(xForRightDirections, yForHorizontalDirections.up),\n rightCenter: getPosition(\n xForRightDirections,\n yForHorizontalDirections.center,\n ),\n rightDown: getPosition(xForRightDirections, yForHorizontalDirections.down),\n\n leftUp: getPosition(xForLeftDirections, yForHorizontalDirections.up),\n leftCenter: getPosition(\n xForLeftDirections,\n yForHorizontalDirections.center,\n ),\n leftDown: getPosition(xForLeftDirections, yForHorizontalDirections.down),\n\n downStartLeft: getPosition(xForStartLeftDirections, yForDownDirections),\n downStartRight: getPosition(xForStartRightDirections, yForDownDirections),\n\n upStartLeft: getPosition(xForStartLeftDirections, yForUpDirections),\n upStartRight: getPosition(xForStartRightDirections, yForUpDirections),\n\n leftStartUp: getPosition(xForLeftDirections, yForStartUpDirections),\n leftStartDown: getPosition(xForLeftDirections, yForStartDownDirections),\n\n rightStartUp: getPosition(xForRightDirections, yForStartUpDirections),\n rightStartDown: getPosition(xForRightDirections, yForStartDownDirections),\n };\n};\n\ntype ComputedPositionAndDirectionParams = {\n // Координата точки, к которой крепится поповер. Для якоря — координата левой верхней точки якоря\n position: Position;\n contentSize: Size;\n viewportSize: Size;\n anchorSize?: Size;\n offset?: number;\n arrowOffset?: number;\n direction: Direction;\n spareDirection: Direction;\n possibleDirections: readonly Direction[];\n bannedDirections: readonly Direction[];\n};\n\nexport const getComputedPositionAndDirection = ({\n position: initialPosition,\n contentSize,\n viewportSize,\n anchorSize = { width: 0, height: 0 },\n arrowOffset,\n direction: initialDirection,\n possibleDirections,\n bannedDirections,\n spareDirection,\n offset = 0,\n}: ComputedPositionAndDirectionParams): {\n direction: Direction;\n position: Position;\n} => {\n if (!initialPosition) {\n return { position: initialPosition, direction: initialDirection };\n }\n\n const positionsByDirection = getPositionsByDirection({\n contentSize,\n anchorSize,\n position: initialPosition,\n arrowOffset,\n offset,\n });\n\n const direction =\n [initialDirection, ...possibleDirections]\n .filter((dir) => !bannedDirections.includes(dir))\n .find((dir) => {\n const pos = positionsByDirection[dir];\n const { width, height } = contentSize;\n\n const isFittingDown = pos.y + height <= viewportSize.height;\n const isFittingUp = pos.y >= 0;\n\n const isFittingLeft = pos.x >= 0;\n const isFittingRight = pos.x + width <= viewportSize.width;\n\n return isFittingUp && isFittingDown && isFittingLeft && isFittingRight;\n }) || spareDirection;\n\n return {\n direction,\n position: positionsByDirection[direction],\n };\n};\n"],"mappings":"yEAMA,GAAMA,YAAW,CAAG,SAACC,CAAD,CAAYC,CAAZ,QAAkD,CACpED,CAAC,CAAEE,IAAI,CAACC,KAAL,CAAWH,CAAX,CADiE,CAEpEC,CAAC,CAAEC,IAAI,CAACC,KAAL,CAAWF,CAAX,CAFiE,CAAlD,CAApB,CAKA,MAAO,IAAMG,wBAAuB,CAAG,WAYX,IAX1BC,EAW0B,GAX1BA,WAW0B,CAV1BC,CAU0B,GAV1BA,UAU0B,KAT1BC,QAS0B,CATdP,CASc,GATdA,CASc,CATXC,CASW,GATXA,CASW,KAR1BO,WAQ0B,CAR1BA,CAQ0B,YARZ,CAQY,OAP1BC,MAO0B,CAP1BA,CAO0B,YAPjB,CAOiB,GACXC,CADW,CAC6BL,CAD7B,CAClBM,KADkB,CACWC,CADX,CAC6BP,CAD7B,CACGQ,MADH,CAEXC,CAFW,CAE2BR,CAF3B,CAElBK,KAFkB,CAEUI,CAFV,CAE2BT,CAF3B,CAEEO,MAFF,CAGpBG,CAAY,CAAG,CACnBhB,CAAC,CAAEA,CAAC,CAAGc,CAAW,CAAG,CADF,CAEnBb,CAAC,CAAEA,CAAC,CAAGc,CAAY,CAAG,CAFH,CAHK,CAQpBE,CA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bH,GAaQV,CA3BP,CA6BH,MAAO,CACLH,SAAS,CAATA,CADK,CAELjD,QAAQ,CAAEqD,CAAoB,CAACJ,CAAD,CAFzB,CAIR,CA/CM"}
|
|
1
|
+
{"version":3,"file":"helpers.js","names":["getPosition","x","y","Math","round","getPositionsByDirection","contentSize","anchorSize","position","arrowOffset","offset","contentWidth","width","contentHeight","height","anchorWidth","anchorHeight","anchorCenter","xForRightDirections","xForLeftDirections","xForVerticalDirections","right","center","left","yForDownDirections","yForUpDirections","yForHorizontalDirections","up","down","xForStartLeftDirections","xForStartRightDirections","yForStartUpDirections","yForStartDownDirections","upLeft","upCenter","upRight","downLeft","downCenter","downRight","rightUp","rightCenter","rightDown","leftUp","leftCenter","leftDown","downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartUp","leftStartDown","rightStartUp","rightStartDown","getComputedPositionAndDirection","initialPosition","viewportSize","initialDirection","direction","possibleDirections","bannedDirections","spareDirection","positionsByDirection","filter","dir","includes","find","pos","isFittingDown","isFittingUp","isFittingLeft","isFittingRight"],"sources":["../../../../../src/components/Popover/helpers.ts"],"sourcesContent":["import { Direction, Position } from './Popover';\n\ntype Size = Pick<DOMRect, 'width' | 'height'>;\n\ntype PositionsByDirection = Record<Direction, NonNullable<Position>>;\n\nconst getPosition = (x: number, y: number): NonNullable<Position> => ({\n x: Math.round(x),\n y: Math.round(y),\n});\n\nexport const getPositionsByDirection = ({\n contentSize,\n anchorSize,\n position: { x, y },\n arrowOffset = 0,\n offset = 0,\n}: {\n contentSize: Size;\n anchorSize: Size;\n position: NonNullable<Position>;\n arrowOffset?: number;\n offset?: number;\n}): PositionsByDirection => {\n const { width: contentWidth, height: contentHeight } = contentSize;\n const { width: anchorWidth, height: anchorHeight } = anchorSize;\n const anchorCenter = {\n x: x + anchorWidth / 2,\n y: y + anchorHeight / 2,\n };\n\n const xForRightDirections = x + anchorWidth + offset;\n const xForLeftDirections = x - contentWidth - offset;\n const xForVerticalDirections = {\n right: anchorCenter.x - arrowOffset,\n center: anchorCenter.x - contentWidth / 2,\n left: anchorCenter.x - contentWidth + arrowOffset,\n };\n\n const yForDownDirections = y + anchorHeight + offset;\n const yForUpDirections = y - contentHeight - offset;\n const yForHorizontalDirections = {\n up: anchorCenter.y - contentHeight + arrowOffset,\n center: anchorCenter.y - contentHeight / 2,\n down: anchorCenter.y - arrowOffset,\n };\n\n const xForStartLeftDirections = x;\n const xForStartRightDirections = x - contentWidth + anchorWidth;\n\n const yForStartUpDirections = y;\n const yForStartDownDirections = y - contentHeight + anchorHeight;\n\n return {\n upLeft: getPosition(xForVerticalDirections.left, yForUpDirections),\n upCenter: getPosition(xForVerticalDirections.center, yForUpDirections),\n upRight: getPosition(xForVerticalDirections.right, yForUpDirections),\n\n downLeft: getPosition(xForVerticalDirections.left, yForDownDirections),\n downCenter: getPosition(xForVerticalDirections.center, yForDownDirections),\n downRight: getPosition(xForVerticalDirections.right, yForDownDirections),\n\n rightUp: getPosition(xForRightDirections, yForHorizontalDirections.up),\n rightCenter: getPosition(\n xForRightDirections,\n yForHorizontalDirections.center,\n ),\n rightDown: getPosition(xForRightDirections, yForHorizontalDirections.down),\n\n leftUp: getPosition(xForLeftDirections, yForHorizontalDirections.up),\n leftCenter: getPosition(\n xForLeftDirections,\n yForHorizontalDirections.center,\n ),\n leftDown: getPosition(xForLeftDirections, yForHorizontalDirections.down),\n\n downStartLeft: getPosition(xForStartLeftDirections, yForDownDirections),\n downStartRight: getPosition(xForStartRightDirections, yForDownDirections),\n\n upStartLeft: getPosition(xForStartLeftDirections, yForUpDirections),\n upStartRight: getPosition(xForStartRightDirections, yForUpDirections),\n\n leftStartUp: getPosition(xForLeftDirections, yForStartUpDirections),\n leftStartDown: getPosition(xForLeftDirections, yForStartDownDirections),\n\n rightStartUp: getPosition(xForRightDirections, yForStartUpDirections),\n rightStartDown: getPosition(xForRightDirections, yForStartDownDirections),\n };\n};\n\ntype ComputedPositionAndDirectionParams = {\n // Координата точки, к которой крепится поповер. Для якоря — координата левой верхней точки якоря\n position: Position;\n contentSize: Size;\n viewportSize: Size;\n anchorSize?: Size;\n offset?: number;\n arrowOffset?: number;\n direction: Direction;\n spareDirection: Direction;\n possibleDirections: readonly Direction[];\n bannedDirections: readonly Direction[];\n};\n\nexport const getComputedPositionAndDirection = ({\n position: initialPosition,\n contentSize,\n viewportSize,\n anchorSize = { width: 0, height: 0 },\n arrowOffset,\n direction: initialDirection,\n possibleDirections,\n bannedDirections,\n spareDirection,\n offset = 0,\n}: ComputedPositionAndDirectionParams): {\n direction: Direction;\n position: Position;\n} => {\n if (!initialPosition) {\n return { position: initialPosition, direction: initialDirection };\n }\n\n const positionsByDirection = getPositionsByDirection({\n contentSize,\n anchorSize,\n position: initialPosition,\n arrowOffset,\n offset,\n });\n\n const direction =\n [initialDirection, ...possibleDirections]\n .filter((dir) => !bannedDirections.includes(dir))\n .find((dir) => {\n const pos = positionsByDirection[dir];\n const { width, height } = contentSize;\n\n const isFittingDown = pos.y + height <= viewportSize.height;\n const isFittingUp = pos.y >= 0;\n\n const isFittingLeft = pos.x >= 0;\n const isFittingRight = pos.x + width <= viewportSize.width;\n\n return isFittingUp && isFittingDown && isFittingLeft && isFittingRight;\n }) || spareDirection;\n\n return {\n direction,\n position: positionsByDirection[direction],\n };\n};\n"],"mappings":"yEAMA,GAAMA,YAAW,CAAG,SAACC,CAAD,CAAYC,CAAZ,QAAkD,CACpED,CAAC,CAAEE,IAAI,CAACC,KAAL,CAAWH,CAAX,CADiE,CAEpEC,CAAC,CAAEC,IAAI,CAACC,KAAL,CAAWF,CAAX,CAFiE,CAAlD,CAApB,CAKA,MAAO,IAAMG,wBAAuB,CAAG,WAYX,IAX1BC,EAW0B,GAX1BA,WAW0B,CAV1BC,CAU0B,GAV1BA,UAU0B,KAT1BC,QAS0B,CATdP,CASc,GATdA,CASc,CATXC,CASW,GATXA,CASW,KAR1BO,WAQ0B,CAR1BA,CAQ0B,YARZ,CAQY,OAP1BC,MAO0B,CAP1BA,CAO0B,YAPjB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,CAAChE,CAAJ,CAAQY,CAAR,EAAkByC,CAAY,CAACzC,MAJxC,CAKPsD,CAAW,CAAY,CAAT,EAAAF,CAAG,CAAChE,CALX,CAOPmE,CAAa,CAAY,CAAT,EAAAH,CAAG,CAACjE,CAPb,CAQPqE,CAAc,CAAGJ,CAAG,CAACjE,CAAJ,CAAQW,CAAR,EAAiB2C,CAAY,CAAC3C,KARxC,CAUb,MAAOwD,EAAW,EAAID,CAAf,EAAgCE,CAAhC,EAAiDC,CACzD,CAbH,GAaQV,CA3BP,CA6BH,MAAO,CACLH,SAAS,CAATA,CADK,CAELjD,QAAQ,CAAEqD,CAAoB,CAACJ,CAAD,CAFzB,CAIR,CA/CM"}
|
package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.SelectCreateButton
|
|
1
|
+
.ListItem.SelectCreateButton:hover:not(.ListItem_active){background:transparent}
|
package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './SelectCreateButton.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { PropsWithHTMLAttributes } from
|
|
3
|
+
import { PropsWithHTMLAttributes } from "../../../utils/types/PropsWithHTMLAttributes";
|
|
4
4
|
import { PropSize } from '../types';
|
|
5
5
|
declare type SelectCreateButtonProps = PropsWithHTMLAttributes<{
|
|
6
6
|
labelForCreate?: string;
|
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 from"react";import{cn}from"../../../utils/bem";export var cnSelectCreateButton=cn("SelectCreateButton");export var SelectCreateButton=function(a){var b=a.className,c=a.labelForCreate,d=a.inputValue,e=a.active,f=a.hovered,g=a.size,h=a.indent,i=_objectWithoutProperties(a,_excluded);return React.createElement(
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","labelForCreate","inputValue","active","hovered","size","indent"];import"./SelectCreateButton.css";import React from"react";import{ListAddItem}from"../../ListCanary";import{cn}from"../../../utils/bem";export var cnSelectCreateButton=cn("SelectCreateButton");export var SelectCreateButton=function(a){var b=a.className,c=a.labelForCreate,d=a.inputValue,e=a.active,f=a.hovered,g=a.size,h=a.indent,i=_objectWithoutProperties(a,_excluded);return React.createElement(ListAddItem,Object.assign({},i,{className:cnSelectCreateButton(null,[b]),"aria-selected":e,role:"option",active:f,size:g,innerOffset:h,label:React.createElement(React.Fragment,null,c," \xAB",React.createElement("b",null,d),"\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","cn","cnSelectCreateButton","SelectCreateButton","props","className","labelForCreate","inputValue","active","hovered","size","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectCreateButton/SelectCreateButton.tsx"],"sourcesContent":["import './SelectCreateButton.css';\n\nimport React from 'react';\n\nimport { cn } from '
|
|
1
|
+
{"version":3,"file":"SelectCreateButton.js","names":["React","ListAddItem","cn","cnSelectCreateButton","SelectCreateButton","props","className","labelForCreate","inputValue","active","hovered","size","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectCreateButton/SelectCreateButton.tsx"],"sourcesContent":["import './SelectCreateButton.css';\n\nimport React from 'react';\n\nimport { ListAddItem } from '##/components/ListCanary';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { PropSize } from '../types';\n\ntype SelectCreateButtonProps = PropsWithHTMLAttributes<\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> = (\n props,\n) => {\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 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"],"mappings":"kLAAA,iCAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,WAAT,wBACA,OAASC,EAAT,0BAiBA,MAAO,IAAMC,qBAAoB,CAAGD,EAAE,CAAC,oBAAD,CAA/B,CAEP,MAAO,IAAME,mBAAqD,CAAG,SACnEC,CADmE,CAEhE,CACH,GACEC,EADF,CASID,CATJ,CACEC,SADF,CAEEC,CAFF,CASIF,CATJ,CAEEE,cAFF,CAGEC,CAHF,CASIH,CATJ,CAGEG,UAHF,CAIEC,CAJF,CASIJ,CATJ,CAIEI,MAJF,CAKEC,CALF,CASIL,CATJ,CAKEK,OALF,CAMEC,CANF,CASIN,CATJ,CAMEM,IANF,CAOEC,CAPF,CASIP,CATJ,CAOEO,MAPF,CAQKC,CARL,0BASIR,CATJ,YAWA,MACE,qBAAC,WAAD,kBACMQ,CADN,EAEE,SAAS,CAAEV,oBAAoB,CAAC,IAAD,CAAO,CAACG,CAAD,CAAP,CAFjC,CAGE,gBAAeG,CAHjB,CAIE,IAAI,CAAC,QAJP,CAKE,MAAM,CAAEC,CALV,CAME,IAAI,CAAEC,CANR,CAOE,WAAW,CAAEC,CAPf,CAQE,KAAK,CACH,wCACGL,CADH,SACoB,6BAAIC,CAAJ,CADpB,QATJ,GAeH,CA9BM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.SelectDropdown{
|
|
1
|
+
.SelectDropdown{min-width:220px;outline:none}.SelectDropdown-List{max-height:200px;overflow:auto}
|
|
@@ -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","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{isOptionForCreate}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{
|
|
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","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}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{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.renderItem,o=a.visibleItems,p=a.isLoading,q=a.getGroupLabel,r=a.notFound,s=_objectWithoutProperties(a,_excluded),t="round"===l?"increased":"normal",u=useRef(null),v=useMemo(function(){return 0<o.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[o]);return React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:u,timeout:animateTimeout},function(a){var j=fabricIndex(-1);return React.createElement(Popover,Object.assign({},s,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:"2xs",ref:u,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},p&&React.createElement(SelectLoader,{mode:v?"blur":"empty"}),o.map(function(a){return isOptionForCreate(a)?React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:t},d({index:j(),item:a}))):React.createElement(Fragment,{key:a.key},a.group&&q&&React.createElement(SelectGroupLabel,{label:q(a.group),size:c,indent:t}),a.items.map(function(b,c){return React.createElement(Fragment,{key:"".concat(a.key,"-").concat(c)},n(_objectSpread({item:b},d({index:j(),item:b}))))}))}),!p&&k&&r&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:t},h),!p&&!k&&i&&React.createElement(ListItem,{size:c,label:h,innerOffset:t},i)))})};
|
|
2
2
|
//# sourceMappingURL=SelectDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useMemo","useRef","Transition","isOptionForCreate","animateTimeout","cnMixPopoverAnimate","cn","fabricIndex","Popover","Text","SelectCreateButton","SelectGroupLabel","SelectLoader","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","renderItem","visibleItems","isLoading","getGroupLabel","notFound","otherProps","indent","popoverRef","isListShowed","filter","group","Array","isArray","items","length","animate","getIndex","map","label","index","item","key","i"],"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 GetOptionPropsResult,\n isOptionForCreate,\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 } from '../../Popover/Popover';\nimport { Text } from '../../Text/Text';\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\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.MutableRefObject<HTMLDivElement | null>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => JSX.Element | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n groupIndex: 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 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 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=\"2xs\"\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown({ form, size }, [\n className,\n cnMixPopoverAnimate({ animate }),\n ])}\n equalAnchorWidth\n >\n <div\n className={cnSelectDropdown('List', { size, form })}\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 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 <Text className={cnSelectDropdown('LabelForNotFound')}>\n {labelForNotFound}\n </Text>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <Text className={cnSelectDropdown('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,CAyCG,CAAClB,CAAD,EAAcL,CAAd,EAA0BO,CAA1B,EAAsCT,CAAtC,EACC,oBAAC,IAAD,EAAM,SAAS,CAAET,gBAAgB,CAAC,kBAAD,CAAjC,EACGS,CADH,CA1CJ,CA8CG,CAACO,CAAD,EAAc,CAACL,CAAf,EAA2BD,CAA3B,EACC,oBAAC,IAAD,EAAM,SAAS,CAAEV,gBAAgB,CAAC,oBAAD,CAAjC,EACGU,CADH,CA/CJ,CAnBF,CAyEH,CAlFH,CAqFH,CAzHM"}
|
|
1
|
+
{"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useMemo","useRef","Transition","cnListBox","ListItem","mapVerticalSpase","cnMixSpace","isOptionForCreate","animateTimeout","cnMixPopoverAnimate","cn","fabricIndex","Popover","SelectCreateButton","SelectGroupLabel","SelectLoader","selectDropdownform","defaultSelectDropdownPropForm","cnSelectDropdown","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","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"],"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';\n\nimport {\n GetOptionPropsResult,\n isOptionForCreate,\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 } from '../../Popover/Popover';\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\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.MutableRefObject<HTMLDivElement | null>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => JSX.Element | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n groupIndex: 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 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 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=\"2xs\"\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 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":"g+BAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,OAA1B,CAAmCC,MAAnC,K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d,EAA0BO,CAA1B,EAAsCT,CAAtC,EACC,oBAAC,QAAD,EACE,IAAI,CAAEL,CADR,CAEE,KAAK,CAAEK,CAFT,CAGE,WAAW,CAAEW,CAHf,EAKGX,CALH,CA9CJ,CAsDG,CAACO,CAAD,EAAc,CAACL,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEN,CADR,CAEE,KAAK,CAAEK,CAFT,CAGE,WAAW,CAAEW,CAHf,EAKGV,CALH,CAvDJ,CApBF,CAsFH,CA/FH,CAkGH,CAtIM"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import './SelectGroupLabel.css';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
4
3
|
import { PropSize } from '../types';
|
|
5
4
|
declare type SelectGroupLabelProps = PropsWithHTMLAttributes<{
|
|
6
|
-
label
|
|
5
|
+
label: string;
|
|
7
6
|
size: PropSize;
|
|
8
7
|
indent: 'normal' | 'increased';
|
|
9
8
|
}, HTMLDivElement>;
|
|
10
|
-
export declare const cnSelectGroupLabel: import("@bem-react/classname").ClassNameFormatter;
|
|
11
9
|
export declare const SelectGroupLabel: React.FC<SelectGroupLabelProps>;
|
|
12
10
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["indent"];import React from"react";import{ListGroupLabel}from"../../ListCanary";export var SelectGroupLabel=function(a){var b=a.indent,c=_objectWithoutProperties(a,_excluded);return React.createElement(ListGroupLabel,Object.assign({},c,{innerOffset:b}))};
|
|
2
2
|
//# sourceMappingURL=SelectGroupLabel.js.map
|
package/__internal__/src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectGroupLabel.js","names":["React","
|
|
1
|
+
{"version":3,"file":"SelectGroupLabel.js","names":["React","ListGroupLabel","SelectGroupLabel","props","indent","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectGroupLabel/SelectGroupLabel.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ListGroupLabel } from '##/components/ListCanary';\n\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { PropSize } from '../types';\n\ntype SelectGroupLabelProps = PropsWithHTMLAttributes<\n {\n label: string;\n size: PropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const SelectGroupLabel: React.FC<SelectGroupLabelProps> = (props) => {\n const { indent, ...otherProps } = props;\n\n return <ListGroupLabel {...otherProps} innerOffset={indent} />;\n};\n"],"mappings":"8GAAA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,cAAT,wBAcA,MAAO,IAAMC,iBAAiD,CAAG,SAACC,CAAD,CAAW,CAC1E,GAAQC,EAAR,CAAkCD,CAAlC,CAAQC,MAAR,CAAmBC,CAAnB,0BAAkCF,CAAlC,YAEA,MAAO,qBAAC,cAAD,kBAAoBE,CAApB,EAAgC,WAAW,CAAED,CAA7C,GACR,CAJM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.SelectItem
|
|
1
|
+
.ListItem.SelectItem:hover:not(.ListItem_active){background:transparent}
|
|
@@ -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 from"react";import{
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","active","hovered","multiple","size","indent","disabled"];import"./SelectItem.css";import React from"react";import{ListItem}from"../../ListCanary";import{cn}from"../../../utils/bem";import{Checkbox}from"../../Checkbox/Checkbox";var sizeCheckboxMap={xs:"m",s:"m",m:"l",l:"l"};export var cnSelectItem=cn("SelectItem");export var SelectItem=function(a){var b=a.className,c=a.label,d=a.active,e=a.hovered,f=a.multiple,g=a.size,h=a.indent,i=a.disabled,j=_objectWithoutProperties(a,_excluded);return React.createElement(ListItem,Object.assign({},j,{className:cnSelectItem(null,[b]),"aria-selected":d,"aria-disabled":i,role:"option",label:c,innerOffset:h,size:g,active:e,checked:!f&&d,disabled:i,leftSide:f&&React.createElement(Checkbox,{checked:d,size:sizeCheckboxMap[g]})}),c)};
|
|
2
2
|
//# sourceMappingURL=SelectItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectItem.js","names":["React","
|
|
1
|
+
{"version":3,"file":"SelectItem.js","names":["React","ListItem","cn","Checkbox","sizeCheckboxMap","xs","s","m","l","cnSelectItem","SelectItem","props","className","label","active","hovered","multiple","size","indent","disabled","otherProps"],"sources":["../../../../../../src/components/SelectComponents/SelectItem/SelectItem.tsx"],"sourcesContent":["import './SelectItem.css';\n\nimport React from 'react';\n\nimport { ListItem } from '##/components/ListCanary';\nimport { cn } from '##/utils/bem';\n\nimport { PropsWithHTMLAttributes } from '../../../utils/types/PropsWithHTMLAttributes';\nimport { Checkbox, CheckboxPropSize } from '../../Checkbox/Checkbox';\nimport { PropSize } from '../types';\n\nexport type SelectItemProps = PropsWithHTMLAttributes<\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\nconst 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> = (props) => {\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 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 && <Checkbox checked={active} size={sizeCheckboxMap[size]} />\n }\n >\n {label}\n </ListItem>\n );\n};\n"],"mappings":"kLAAA,yBAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,QAAT,wBACA,OAASC,EAAT,0BAGA,OAASC,QAAT,+BAgBA,GAAMC,gBAAmD,CAAG,CAC1DC,EAAE,CAAE,GADsD,CAE1DC,CAAC,CAAE,GAFuD,CAG1DC,CAAC,CAAE,GAHuD,CAI1DC,CAAC,CAAE,GAJuD,CAA5D,CAOA,MAAO,IAAMC,aAAY,CAAGP,EAAE,CAAC,YAAD,CAAvB,CAEP,MAAO,IAAMQ,WAAqC,CAAG,SAACC,CAAD,CAAW,CAC9D,GACEC,EADF,CAUID,CAVJ,CACEC,SADF,CAEEC,CAFF,CAUIF,CAVJ,CAEEE,KAFF,CAGEC,CAHF,CAUIH,CAVJ,CAGEG,MAHF,CAIEC,CAJF,CAUIJ,CAVJ,CAIEI,OAJF,CAKEC,CALF,CAUIL,CAVJ,CAKEK,QALF,CAMEC,CANF,CAUIN,CAVJ,CAMEM,IANF,CAOEC,CAPF,CAUIP,CAVJ,CAOEO,MAPF,CAQEC,CARF,CAUIR,CAVJ,CAQEQ,QARF,CASKC,CATL,0BAUIT,CAVJ,YAYA,MACE,qBAAC,QAAD,kBACMS,CADN,EAEE,SAAS,CAAEX,YAAY,CAAC,IAAD,CAAO,CAACG,CAAD,CAAP,CAFzB,CAGE,gBAAeE,CAHjB,CAIE,gBAAeK,CAJjB,CAKE,IAAI,CAAC,QALP,CAME,KAAK,CAAEN,CANT,CAOE,WAAW,CAAEK,CAPf,CAQE,IAAI,CAAED,CARR,CASE,MAAM,CAAEF,CATV,CAUE,OAAO,CAAE,CAACC,CAAD,EAAaF,CAVxB,CAWE,QAAQ,CAAEK,CAXZ,CAYE,QAAQ,CACNH,CAAQ,EAAI,oBAAC,QAAD,EAAU,OAAO,CAAEF,CAAnB,CAA2B,IAAI,CAAEV,eAAe,CAACa,CAAD,CAAhD,EAbhB,GAgBGJ,CAhBH,CAmBH,CAjCM"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const defaultlabelForNotFound = "\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E";
|
|
2
|
-
export declare const defaultlabelForCreate = "
|
|
2
|
+
export declare const defaultlabelForCreate = "";
|
|
3
3
|
export declare const defaultLabelForEmptyItems = "\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442";
|
|
4
4
|
export declare const getInputWidth: (controlInnerRef: React.RefObject<HTMLDivElement>, helperInputFakeElement: React.RefObject<HTMLDivElement>) => number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export var defaultlabelForNotFound="\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E";export var defaultlabelForCreate="
|
|
1
|
+
export var defaultlabelForNotFound="\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E";export var defaultlabelForCreate="";export var defaultLabelForEmptyItems="\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442";export var getInputWidth=function(a,b){if(!a.current||!b.current)return 20;var c=b.current.offsetWidth+20,d=a.current?a.current.offsetWidth-15:2,e=c>d?d:c;return e};
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|