@consta/uikit 5.25.1 → 5.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FlatSelect/index.d.ts +1 -0
- package/FlatSelect/index.js +1 -0
- package/__internal__/src/components/Combobox/Combobox.js +1 -1
- package/__internal__/src/components/Combobox/Combobox.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/ContextMenuLevels/ContextMenuLevels.d.ts +2 -2
- 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/helpers.d.ts +2 -2
- package/__internal__/src/components/ContextMenu/types.d.ts +5 -5
- package/__internal__/src/components/ContextMenu/types.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldButton/FieldButton.d.ts +1 -1
- package/__internal__/src/components/FieldComponents/FieldButton/FieldButton.js.map +1 -1
- package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.d.ts +1 -0
- package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.js +1 -1
- package/__internal__/src/components/FieldComponents/FieldClearButton/FieldClearButton.js.map +1 -1
- package/__internal__/src/components/FlatSelect/FlatSelect.css +9 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.d.ts +4 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelect.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.d.ts +16 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/FlatSelectControlLayout.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectControlLayout/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.d.ts +19 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.d.ts +12 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectFooter/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.d.ts +10 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.d.ts +17 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/FlatSelectItem.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItem/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.d.ts +17 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectItemAll/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.d.ts +53 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/FlatSelectList.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectList/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.d.ts +3 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectLoader/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.d.ts +24 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.css +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.d.ts +14 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.js +2 -0
- package/__internal__/src/components/FlatSelect/FlatSelectRoot/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/defaultProps.d.ts +22 -0
- package/__internal__/src/components/FlatSelect/defaultProps.js +2 -0
- package/__internal__/src/components/FlatSelect/defaultProps.js.map +1 -0
- package/__internal__/src/components/FlatSelect/index.d.ts +2 -0
- package/__internal__/src/components/FlatSelect/index.js +2 -0
- package/__internal__/src/components/FlatSelect/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/types.d.ts +133 -0
- package/__internal__/src/components/FlatSelect/types.js +2 -0
- package/__internal__/src/components/FlatSelect/types.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.d.ts +4 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.js +2 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/helpers.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/index.js +2 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.d.ts +52 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.js +2 -0
- package/__internal__/src/components/FlatSelect/useFlatSelect/useFlatSelect.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/index.d.ts +1 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/index.js +2 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/index.js.map +1 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.d.ts +10 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.js +2 -0
- package/__internal__/src/components/FlatSelect/useRenderItem/useRenderItem.js.map +1 -0
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js +1 -1
- package/__internal__/src/components/ListCanary/ListBox/ListBox.js.map +1 -1
- package/__internal__/src/components/ListCanary/types.d.ts +1 -0
- package/__internal__/src/components/ListCanary/types.js.map +1 -1
- package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.d.ts +1 -0
- package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.js +1 -1
- package/__internal__/src/components/Pagination/PaginationArrow/PaginationArrow.js.map +1 -1
- package/__internal__/src/components/Popover/Popover.d.ts +2 -2
- package/__internal__/src/components/Popover/Popover.js.map +1 -1
- package/__internal__/src/components/SelectCanary/helpers.d.ts +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.d.ts +1 -1
- package/__internal__/src/components/Sidebar/Sidebar.js.map +1 -1
- package/__internal__/src/components/ThemeToggler/helpers.d.ts +1 -1
- package/__internal__/src/components/ThemeToggler/types.d.ts +1 -1
- package/__internal__/src/components/ThemeToggler/types.js.map +1 -1
- package/__internal__/src/components/Tooltip/types.d.ts +1 -1
- package/__internal__/src/components/Tooltip/types.js.map +1 -1
- package/__internal__/src/components/TooltipDeprecated/TooltipDeprecated.d.ts +1 -1
- package/__internal__/src/components/TooltipDeprecated/TooltipDeprecated.js.map +1 -1
- package/__internal__/src/utils/state/useClickOutsideAtom/index.d.ts +1 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/index.js +2 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/index.js.map +1 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.d.ts +9 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.js +2 -0
- package/__internal__/src/utils/state/useClickOutsideAtom/useClickOutside.js.map +1 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/index.d.ts +1 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/index.js +2 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/index.js.map +1 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.d.ts +2 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.js +2 -0
- package/__internal__/src/utils/state/useElementAtomEventListener/useElementAtomEventListener.js.map +1 -0
- package/__internal__/src/utils/state/useKeysAtom/index.d.ts +1 -0
- package/__internal__/src/utils/state/useKeysAtom/index.js +2 -0
- package/__internal__/src/utils/state/useKeysAtom/index.js.map +1 -0
- package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.d.ts +14 -0
- package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.js +2 -0
- package/__internal__/src/utils/state/useKeysAtom/useKeysAtom.js.map +1 -0
- package/__internal__/src/utils/state/useRefAtom/useRefAtom.d.ts +1 -1
- package/__internal__/src/utils/state/useRefAtom/useRefAtom.js.map +1 -1
- package/__internal__/src/utils/state/withCtx/withCtx.js +1 -1
- package/__internal__/src/utils/state/withCtx/withCtx.js.map +1 -1
- package/package.json +1 -1
package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ListItem.FlatSelectCreateButton .ListItemGrid-Slot_position_center{overflow:hidden}.FlatSelectCreateButton-CreateLabel{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './FlatSelectCreateButton.css';
|
|
2
|
+
import { AtomMut } from '@reatom/framework';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { FieldPropSize } from '../../FieldComponents';
|
|
5
|
+
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
6
|
+
type LabelForCreate = ((label: string | undefined) => React.ReactNode) | React.ReactNode;
|
|
7
|
+
type FlatSelectCreateButtonProps = PropsWithHTMLAttributesAndRef<{
|
|
8
|
+
labelForCreate?: LabelForCreate;
|
|
9
|
+
inputValueAtom: AtomMut<string>;
|
|
10
|
+
size: FieldPropSize;
|
|
11
|
+
indent: 'normal' | 'increased';
|
|
12
|
+
index: number;
|
|
13
|
+
highlightedIndexAtom: AtomMut<number>;
|
|
14
|
+
disabledAtom: AtomMut<boolean>;
|
|
15
|
+
}, HTMLDivElement>;
|
|
16
|
+
export declare const cnFlatSelectCreateButton: import("@bem-react/classname").ClassNameFormatter;
|
|
17
|
+
type FlatSelectCreateButtonComponent = (props: FlatSelectCreateButtonProps) => React.ReactNode | null;
|
|
18
|
+
export declare const FlatSelectCreateButton: FlatSelectCreateButtonComponent;
|
|
19
|
+
export {};
|
package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","labelForCreate","inputValueAtom","index","size","highlightedIndexAtom","disabledAtom"];import"./FlatSelectCreateButton.css";import{useAtom}from"@reatom/npm-react";import React,{forwardRef}from"react";import{ListAddItem}from"../../ListCanary";import{cn}from"../../../utils/bem";export var cnFlatSelectCreateButton=cn("FlatSelectCreateButton");var labelForCreateDefault=function(a){return React.createElement("span",{className:cnFlatSelectCreateButton("CreateLabel")},a?React.createElement(React.Fragment,null,"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C ",React.createElement("b",null,"\xAB",a,"\xBB")):"\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u044D\u043B\u0435\u043C\u0435\u043D\u0442")};export var FlatSelectCreateButton=forwardRef(function(a,b){var c=a.className,d=a.labelForCreate,e=void 0===d?labelForCreateDefault:d,f=a.inputValueAtom,g=a.index,h=a.size,i=a.highlightedIndexAtom,j=a.disabledAtom,k=_objectWithoutProperties(a,_excluded),l=useAtom(function(a){var b=a.spy(i),c=a.spy(j);return!c&&g===b}),m=_slicedToArray(l,1),n=m[0],o=useAtom(f),p=_slicedToArray(o,1),q=p[0],r=useAtom(j),s=_slicedToArray(r,1),t=s[0];return React.createElement(ListAddItem,Object.assign({},k,{ref:b,className:cnFlatSelectCreateButton(null,[c]),role:"option",active:n,size:h,disabled:t,label:"function"==typeof e?e(q):e,underLine:!0}))});
|
|
2
|
+
//# sourceMappingURL=FlatSelectCreateButton.js.map
|
package/__internal__/src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectCreateButton.js","names":["useAtom","React","forwardRef","ListAddItem","cn","cnFlatSelectCreateButton","labelForCreateDefault","label","FlatSelectCreateButton","props","ref","className","labelForCreate","inputValueAtom","index","size","highlightedIndexAtom","disabledAtom","otherProps","ctx","highlightedIndex","spy","disabled","active","inputValue"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectCreateButton/FlatSelectCreateButton.tsx"],"sourcesContent":["import './FlatSelectCreateButton.css';\n\nimport { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { forwardRef } from 'react';\n\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { ListAddItem } from '##/components/ListCanary';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\ntype LabelForCreate =\n | ((label: string | undefined) => React.ReactNode)\n | React.ReactNode;\n\ntype FlatSelectCreateButtonProps = PropsWithHTMLAttributesAndRef<\n {\n labelForCreate?: LabelForCreate;\n inputValueAtom: AtomMut<string>;\n size: FieldPropSize;\n indent: 'normal' | 'increased';\n index: number;\n highlightedIndexAtom: AtomMut<number>;\n disabledAtom: AtomMut<boolean>;\n },\n HTMLDivElement\n>;\n\nexport const cnFlatSelectCreateButton = cn('FlatSelectCreateButton');\n\nconst labelForCreateDefault: LabelForCreate = (label) => (\n <span className={cnFlatSelectCreateButton('CreateLabel')}>\n {label ? (\n <>\n Добавить <b>«{label}»</b>\n </>\n ) : (\n 'Добавить элемент'\n )}\n </span>\n);\n\ntype FlatSelectCreateButtonComponent = (\n props: FlatSelectCreateButtonProps,\n) => React.ReactNode | null;\n\nexport const FlatSelectCreateButton: FlatSelectCreateButtonComponent =\n forwardRef((props, ref) => {\n const {\n className,\n labelForCreate = labelForCreateDefault,\n inputValueAtom,\n index,\n size,\n\n highlightedIndexAtom,\n disabledAtom,\n ...otherProps\n } = props;\n\n const [active] = useAtom((ctx) => {\n const highlightedIndex = ctx.spy(highlightedIndexAtom);\n const disabled = ctx.spy(disabledAtom);\n if (disabled) {\n return false;\n }\n return index === highlightedIndex;\n });\n\n const [inputValue] = useAtom(inputValueAtom);\n const [disabled] = useAtom(disabledAtom);\n\n return (\n <ListAddItem\n {...otherProps}\n ref={ref}\n className={cnFlatSelectCreateButton(null, [className])}\n role=\"option\"\n active={active}\n size={size}\n disabled={disabled}\n label={\n typeof labelForCreate === 'function'\n ? labelForCreate(inputValue)\n : labelForCreate\n }\n underLine\n />\n );\n });\n"],"mappings":"yQAAA,qCAGA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAGA,OAASC,WAAT,wBACA,OAASC,EAAT,0BAoBA,MAAO,IAAMC,yBAAwB,CAAGD,EAAE,CAAC,wBAAD,CAAnC,CAEP,GAAME,sBAAqC,CAAG,SAACC,CAAD,QAC5C,6BAAM,SAAS,CAAEF,wBAAwB,CAAC,aAAD,CAAzC,EACGE,CAAK,CACJ,4FACW,oCAAKA,CAAL,QADX,CADI,CAKJ,6FANJ,CAD4C,CAA9C,CAgBA,MAAO,IAAMC,uBAAuD,CAClEN,UAAU,CAAC,SAACO,CAAD,CAAQC,CAAR,CAAgB,IAEvBC,EAFuB,CAWrBF,CAXqB,CAEvBE,SAFuB,GAWrBF,CAXqB,CAGvBG,cAHuB,CAGvBA,CAHuB,YAGNN,qBAHM,GAIvBO,CAJuB,CAWrBJ,CAXqB,CAIvBI,cAJuB,CAKvBC,CALuB,CAWrBL,CAXqB,CAKvBK,KALuB,CAMvBC,CANuB,CAWrBN,CAXqB,CAMvBM,IANuB,CAQvBC,CARuB,CAWrBP,CAXqB,CAQvBO,oBARuB,CASvBC,CATuB,CAWrBR,CAXqB,CASvBQ,YATuB,CAUpBC,CAVoB,0BAWrBT,CAXqB,cAaRT,OAAO,CAAC,SAACmB,CAAD,CAAS,IAC1BC,EAAgB,CAAGD,CAAG,CAACE,GAAJ,CAAQL,CAAR,CADO,CAE1BM,CAAQ,CAAGH,CAAG,CAACE,GAAJ,CAAQJ,CAAR,CAFe,QAG5BK,CAH4B,EAMzBR,CAAK,GAAKM,CAClB,CAPuB,CAbC,uBAalBG,CAbkB,QAsBJvB,OAAO,CAACa,CAAD,CAtBH,uBAsBlBW,CAtBkB,QAuBNxB,OAAO,CAACiB,CAAD,CAvBD,uBAuBlBK,CAvBkB,MAyBzB,MACE,qBAAC,WAAD,kBACMJ,CADN,EAEE,GAAG,CAAER,CAFP,CAGE,SAAS,CAAEL,wBAAwB,CAAC,IAAD,CAAO,CAACM,CAAD,CAAP,CAHrC,CAIE,IAAI,CAAC,QAJP,CAKE,MAAM,CAAEY,CALV,CAME,IAAI,CAAER,CANR,CAOE,QAAQ,CAAEO,CAPZ,CAQE,KAAK,CACuB,UAA1B,QAAOV,EAAP,CACIA,CAAc,CAACY,CAAD,CADlB,CAEIZ,CAXR,CAaE,SAAS,GAbX,GAgBH,CA1CS,CADL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectCreateButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectCreateButton/index.ts"],"sourcesContent":["export * from './FlatSelectCreateButton';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.FlatSelectFooter{border-top:1px solid var(--color-bg-border)}.FlatSelectFooter_border{border-bottom:1px solid var(--color-bg-border);border-left:1px solid var(--color-bg-border);border-right:1px solid var(--color-bg-border)}.FlatSelectFooter_form_default{border-radius:0 0 var(--control-radius) var(--control-radius)}.FlatSelectFooter_form_round{border-radius:0 0 var(--flat-select-radius-round) var(--flat-select-radius-round)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import './FlatSelectFooter.css';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FieldPropView } from '../../FieldComponents';
|
|
4
|
+
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
5
|
+
export type FlatSelectFooterProps = PropsWithHTMLAttributesAndRef<{
|
|
6
|
+
view?: FieldPropView;
|
|
7
|
+
bordered?: boolean;
|
|
8
|
+
form?: 'default' | 'brick' | 'round';
|
|
9
|
+
footer: React.ReactNode;
|
|
10
|
+
}, HTMLDivElement>;
|
|
11
|
+
export declare const cnFlatSelectFooter: import("@bem-react/classname").ClassNameFormatter;
|
|
12
|
+
export declare const FlatSelectFooter: React.FC<FlatSelectFooterProps>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","footer","view","bordered","form"];import"./FlatSelectFooter.css";import React,{forwardRef}from"react";import{cnMixFlex}from"../../../mixs/MixFlex";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{isNotNil}from"../../../utils/type-guards";export var cnFlatSelectFooter=cn("FlatSelectFooter");var renderSlot=function(a){return Array.isArray(a)?a.filter(isNotNil).map(function(a,b){return React.createElement("div",{className:cnFlatSelectFooter("Slot"),key:b},a)}):renderSlot([a])};export var FlatSelectFooter=forwardRef(function(a,b){var c=a.className,d=a.footer,e=a.view,f=a.bordered,g=a.form,h=_objectWithoutProperties(a,_excluded);return React.createElement("div",Object.assign({},h,{ref:b,className:cnFlatSelectFooter({border:"clear"===e?f:void 0,form:f?g:void 0},[Array.isArray(d)?cnMixFlex({flex:"flex",justify:"flex-end",gap:"xs"}):void 0,cnMixSpace({pV:"xs",pH:"s"}),c])}),renderSlot(d))});
|
|
2
|
+
//# sourceMappingURL=FlatSelectFooter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectFooter.js","names":["React","forwardRef","cnMixFlex","cnMixSpace","cn","isNotNil","cnFlatSelectFooter","renderSlot","slot","Array","isArray","filter","map","item","index","FlatSelectFooter","props","ref","className","footer","view","bordered","form","otherProps","border","flex","justify","gap","pV","pH"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectFooter/FlatSelectFooter.tsx"],"sourcesContent":["import './FlatSelectFooter.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { FieldPropView } from '##/components/FieldComponents';\nimport { cnMixFlex } from '##/mixs/MixFlex';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { isNotNil } from '##/utils/type-guards';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type FlatSelectFooterProps = PropsWithHTMLAttributesAndRef<\n {\n view?: FieldPropView;\n bordered?: boolean;\n form?: 'default' | 'brick' | 'round';\n footer: React.ReactNode;\n },\n HTMLDivElement\n>;\n\nexport const cnFlatSelectFooter = cn('FlatSelectFooter');\n\nconst renderSlot = (slot: React.ReactNode) => {\n if (Array.isArray(slot)) {\n return slot.filter(isNotNil).map((item, index) => (\n <div className={cnFlatSelectFooter('Slot')} key={index}>\n {item}\n </div>\n ));\n }\n return renderSlot([slot]);\n};\n\nexport const FlatSelectFooter: React.FC<FlatSelectFooterProps> = forwardRef(\n (props, ref) => {\n const { className, footer, view, bordered, form, ...otherProps } = props;\n\n return (\n <div\n {...otherProps}\n ref={ref}\n className={cnFlatSelectFooter(\n {\n border: view === 'clear' ? bordered : undefined,\n form: bordered ? form : undefined,\n },\n [\n Array.isArray(footer)\n ? cnMixFlex({ flex: 'flex', justify: 'flex-end', gap: 'xs' })\n : undefined,\n cnMixSpace({ pV: 'xs', pH: 's' }),\n className,\n ],\n )}\n >\n {renderSlot(footer)}\n </div>\n );\n },\n);\n"],"mappings":"mJAAA,+BAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAGA,OAASC,SAAT,6BACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BACA,OAASC,QAAT,kCAaA,MAAO,IAAMC,mBAAkB,CAAGF,EAAE,CAAC,kBAAD,CAA7B,CAEP,GAAMG,WAAU,CAAG,SAACC,CAAD,CAA2B,OACxCC,MAAK,CAACC,OAAN,CAAcF,CAAd,CADwC,CAEnCA,CAAI,CAACG,MAAL,CAAYN,QAAZ,EAAsBO,GAAtB,CAA0B,SAACC,CAAD,CAAOC,CAAP,QAC/B,4BAAK,SAAS,CAAER,kBAAkB,CAAC,MAAD,CAAlC,CAA4C,GAAG,CAAEQ,CAAjD,EACGD,CADH,CAD+B,CAA1B,CAFmC,CAQrCN,UAAU,CAAC,CAACC,CAAD,CAAD,CAClB,CATD,CAWA,MAAO,IAAMO,iBAAiD,CAAGd,UAAU,CACzE,SAACe,CAAD,CAAQC,CAAR,CAAgB,CACd,GAAQC,EAAR,CAAmEF,CAAnE,CAAQE,SAAR,CAAmBC,CAAnB,CAAmEH,CAAnE,CAAmBG,MAAnB,CAA2BC,CAA3B,CAAmEJ,CAAnE,CAA2BI,IAA3B,CAAiCC,CAAjC,CAAmEL,CAAnE,CAAiCK,QAAjC,CAA2CC,CAA3C,CAAmEN,CAAnE,CAA2CM,IAA3C,CAAoDC,CAApD,0BAAmEP,CAAnE,YAEA,MACE,4CACMO,CADN,EAEE,GAAG,CAAEN,CAFP,CAGE,SAAS,CAAEX,kBAAkB,CAC3B,CACEkB,MAAM,CAAW,OAAT,GAAAJ,CAAI,CAAeC,CAAf,OADd,CAEEC,IAAI,CAAED,CAAQ,CAAGC,CAAH,OAFhB,CAD2B,CAK3B,CACEb,KAAK,CAACC,OAAN,CAAcS,CAAd,EACIjB,SAAS,CAAC,CAAEuB,IAAI,CAAE,MAAR,CAAgBC,OAAO,CAAE,UAAzB,CAAqCC,GAAG,CAAE,IAA1C,CAAD,CADb,OADF,CAIExB,UAAU,CAAC,CAAEyB,EAAE,CAAE,IAAN,CAAYC,EAAE,CAAE,GAAhB,CAAD,CAJZ,CAKEX,CALF,CAL2B,CAH/B,GAiBGX,UAAU,CAACY,CAAD,CAjBb,CAoBH,CAzBwE,CAApE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectFooter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectFooter/index.ts"],"sourcesContent":["export * from './FlatSelectFooter';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FieldPropSize } from '../../FieldComponents';
|
|
3
|
+
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
4
|
+
type SelectGroupLabelProps = PropsWithHTMLAttributesAndRef<{
|
|
5
|
+
label: string;
|
|
6
|
+
size: FieldPropSize;
|
|
7
|
+
indent: 'normal' | 'increased';
|
|
8
|
+
}, HTMLDivElement>;
|
|
9
|
+
export declare const FlatSelectGroupLabel: React.FC<SelectGroupLabelProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["indent"];import React,{forwardRef}from"react";import{ListGroupLabel}from"../../ListCanary";export var FlatSelectGroupLabel=forwardRef(function(a,b){var c=a.indent,d=_objectWithoutProperties(a,_excluded);return React.createElement(ListGroupLabel,Object.assign({},d,{ref:b,innerOffset:c}))});
|
|
2
|
+
//# sourceMappingURL=FlatSelectGroupLabel.js.map
|
package/__internal__/src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectGroupLabel.js","names":["React","forwardRef","ListGroupLabel","FlatSelectGroupLabel","ref","indent","otherProps"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectGroupLabel/FlatSelectGroupLabel.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { ListGroupLabel } from '##/components/ListCanary';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\ntype SelectGroupLabelProps = PropsWithHTMLAttributesAndRef<\n {\n label: string;\n size: FieldPropSize;\n indent: 'normal' | 'increased';\n },\n HTMLDivElement\n>;\n\nexport const FlatSelectGroupLabel: React.FC<SelectGroupLabelProps> = forwardRef(\n ({ indent, ...otherProps }, ref) => {\n return <ListGroupLabel {...otherProps} ref={ref} innerOffset={indent} />;\n },\n);\n"],"mappings":"8GAAA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAGA,OAASC,cAAT,wBAYA,MAAO,IAAMC,qBAAqD,CAAGF,UAAU,CAC7E,WAA4BG,CAA5B,CAAoC,IAAjCC,EAAiC,GAAjCA,MAAiC,CAAtBC,CAAsB,uCAClC,MAAO,qBAAC,cAAD,kBAAoBA,CAApB,EAAgC,GAAG,CAAEF,CAArC,CAA0C,WAAW,CAAEC,CAAvD,GACR,CAH4E,CAAxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectGroupLabel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectGroupLabel/index.ts"],"sourcesContent":["export * from './FlatSelectGroupLabel';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ListItem.FlatSelectItem:hover:not(.ListItem_active){background:transparent}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './FlatSelectItem.css';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { CheckboxPropSize } from '../../Checkbox';
|
|
4
|
+
import { FieldPropSize } from '../../FieldComponents';
|
|
5
|
+
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
6
|
+
export type FlatSelectItemProps = PropsWithHTMLAttributesAndRef<{
|
|
7
|
+
label: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
hovered: boolean;
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
size: FieldPropSize;
|
|
12
|
+
indent: 'normal' | 'increased';
|
|
13
|
+
disabled: boolean | undefined;
|
|
14
|
+
}, HTMLDivElement>;
|
|
15
|
+
export declare const sizeCheckboxMap: Record<FieldPropSize, CheckboxPropSize>;
|
|
16
|
+
export declare const cnFlatSelectItem: import("@bem-react/classname").ClassNameFormatter;
|
|
17
|
+
export declare const FlatSelectItem: React.FC<FlatSelectItemProps>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","label","active","hovered","multiple","size","indent","disabled","onClick"];import"./FlatSelectItem.css";import React,{forwardRef}from"react";import{Checkbox}from"../../Checkbox";import{ListItem}from"../../ListCanary";import{cnCanary as cn}from"../../../utils/bem";export var sizeCheckboxMap={xs:"s",s:"s",m:"m",l:"l"};export var cnFlatSelectItem=cn("FlatSelectItem");export var FlatSelectItem=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=a.onClick,l=_objectWithoutProperties(a,_excluded);return React.createElement(ListItem,Object.assign({},l,{ref:b,className:cnFlatSelectItem(null,[c]),"aria-selected":e,"aria-disabled":j,role:"option",label:d,innerOffset:i,size:h,active:f,checked:!g&&e,disabled:j,onClick:k,leftSide:g&&React.createElement(Checkbox,{checked:e,disabled:j,size:sizeCheckboxMap[h]})}),d)});
|
|
2
|
+
//# sourceMappingURL=FlatSelectItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectItem.js","names":["React","forwardRef","Checkbox","ListItem","cnCanary","cn","sizeCheckboxMap","xs","s","m","l","cnFlatSelectItem","FlatSelectItem","props","ref","className","label","active","hovered","multiple","size","indent","disabled","onClick","otherProps"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectItem/FlatSelectItem.tsx"],"sourcesContent":["import './FlatSelectItem.css';\n\nimport React, { forwardRef } from 'react';\n\nimport { Checkbox, CheckboxPropSize } from '##/components/Checkbox';\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { ListItem } from '##/components/ListCanary';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type FlatSelectItemProps = PropsWithHTMLAttributesAndRef<\n {\n label: string;\n active: boolean;\n hovered: boolean;\n multiple?: boolean;\n size: FieldPropSize;\n indent: 'normal' | 'increased';\n disabled: boolean | undefined;\n },\n HTMLDivElement\n>;\n\nexport const sizeCheckboxMap: Record<FieldPropSize, CheckboxPropSize> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nexport const cnFlatSelectItem = cn('FlatSelectItem');\n\nexport const FlatSelectItem: React.FC<FlatSelectItemProps> = forwardRef(\n (props, ref) => {\n const {\n className,\n label,\n active,\n hovered,\n multiple,\n size,\n indent,\n disabled,\n onClick,\n ...otherProps\n } = props;\n\n return (\n <ListItem\n {...otherProps}\n ref={ref}\n className={cnFlatSelectItem(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 onClick={onClick}\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":"4LAAA,6BAEA,MAAOA,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,sBAEA,OAASC,QAAT,wBACA,OAASC,QAAQ,GAAIC,GAArB,0BAgBA,MAAO,IAAMC,gBAAwD,CAAG,CACtEC,EAAE,CAAE,GADkE,CAEtEC,CAAC,CAAE,GAFmE,CAGtEC,CAAC,CAAE,GAHmE,CAItEC,CAAC,CAAE,GAJmE,CAAjE,CAOP,MAAO,IAAMC,iBAAgB,CAAGN,EAAE,CAAC,gBAAD,CAA3B,CAEP,MAAO,IAAMO,eAA6C,CAAGX,UAAU,CACrE,SAACY,CAAD,CAAQC,CAAR,CAAgB,CACd,GACEC,EADF,CAWIF,CAXJ,CACEE,SADF,CAEEC,CAFF,CAWIH,CAXJ,CAEEG,KAFF,CAGEC,CAHF,CAWIJ,CAXJ,CAGEI,MAHF,CAIEC,CAJF,CAWIL,CAXJ,CAIEK,OAJF,CAKEC,CALF,CAWIN,CAXJ,CAKEM,QALF,CAMEC,CANF,CAWIP,CAXJ,CAMEO,IANF,CAOEC,CAPF,CAWIR,CAXJ,CAOEQ,MAPF,CAQEC,CARF,CAWIT,CAXJ,CAQES,QARF,CASEC,CATF,CAWIV,CAXJ,CASEU,OATF,CAUKC,CAVL,0BAWIX,CAXJ,YAaA,MACE,qBAAC,QAAD,kBACMW,CADN,EAEE,GAAG,CAAEV,CAFP,CAGE,SAAS,CAAEH,gBAAgB,CAAC,IAAD,CAAO,CAACI,CAAD,CAAP,CAH7B,CAIE,gBAAeE,CAJjB,CAKE,gBAAeK,CALjB,CAME,IAAI,CAAC,QANP,CAOE,KAAK,CAAEN,CAPT,CAQE,WAAW,CAAEK,CARf,CASE,IAAI,CAAED,CATR,CAUE,MAAM,CAAEF,CAVV,CAWE,OAAO,CAAE,CAACC,CAAD,EAAaF,CAXxB,CAYE,QAAQ,CAAEK,CAZZ,CAaE,OAAO,CAAEC,CAbX,CAcE,QAAQ,CACNJ,CAAQ,EACN,oBAAC,QAAD,EACE,OAAO,CAAEF,CADX,CAEE,QAAQ,CAAEK,CAFZ,CAGE,IAAI,CAAEhB,eAAe,CAACc,CAAD,CAHvB,EAhBN,GAwBGJ,CAxBH,CA2BH,CA3CoE,CAAhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectItem/index.ts"],"sourcesContent":["export * from './FlatSelectItem';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ListItem.FlatSelectItemAll:hover:not(.ListItem_active){background:transparent}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AtomMut } from '@reatom/framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FieldPropSize } from '../../FieldComponents';
|
|
4
|
+
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
5
|
+
export type FlatFlatSelectItemAllProps = PropsWithHTMLAttributesAndRef<{
|
|
6
|
+
size: FieldPropSize;
|
|
7
|
+
hovered?: boolean;
|
|
8
|
+
indent?: 'normal' | 'increased';
|
|
9
|
+
groupsCounterAtom: AtomMut<Record<string, [number, number]>>;
|
|
10
|
+
groupId: string | number;
|
|
11
|
+
highlightedIndexAtom: AtomMut<number>;
|
|
12
|
+
index: number;
|
|
13
|
+
label: string;
|
|
14
|
+
disabledAtom: AtomMut<boolean>;
|
|
15
|
+
}, HTMLDivElement>;
|
|
16
|
+
export declare const cnFlatSelectItemAll: import("@bem-react/classname").ClassNameFormatter;
|
|
17
|
+
export declare const FlatSelectItemAll: React.FC<FlatFlatSelectItemAllProps>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _excluded=["size","className","groupsCounterAtom","groupId","highlightedIndexAtom","disabledAtom","index","label"];import{useAtom}from"@reatom/npm-react";import React,{forwardRef}from"react";import{Checkbox}from"../../Checkbox";import{ListItem}from"../../ListCanary";import{Text}from"../../Text";import{cn}from"../../../utils/bem";import{sizeCheckboxMap}from"../FlatSelectItem";export var cnFlatSelectItemAll=cn("FlatSelectItemAll");var textSizeMap={xs:"s",s:"s",m:"m",l:"l"},FlatSelectItemAllCounter=function(a){var b=a.groupsCounterAtom,c=a.groupId,d=a.size,e=useAtom(function(a){var d,e=a.spy(b);return(null===(d=e[c])||void 0===d?void 0:d[1])||0}),f=_slicedToArray(e,1),g=f[0],h=useAtom(function(a){var d,e=a.spy(b);return(null===(d=e[c])||void 0===d?void 0:d[0])||0}),i=_slicedToArray(h,1),j=i[0];return React.createElement(Text,{size:textSizeMap[d],lineHeight:"xs",view:"ghost"},"".concat(j," \u0438\u0437 ").concat(g))},FlatSelectItemAllCounterCheckbox=function(a){var b=a.groupsCounterAtom,c=a.groupId,d=a.size,e=a.disabledAtom,f=useAtom(function(a){var d=a.spy(b);return void 0!==d[c]&&d[c][0]===d[c][1]}),g=_slicedToArray(f,1),h=g[0],i=useAtom(function(a){var d=a.spy(b);return void 0!==d[c]&&0<d[c][0]&&d[c][0]<d[c][1]}),j=_slicedToArray(i,1),k=j[0],l=useAtom(e),m=_slicedToArray(l,1),n=m[0];return React.createElement(Checkbox,{checked:h,intermediate:k,size:sizeCheckboxMap[d],tabIndex:-1,disabled:n})};export var FlatSelectItemAll=forwardRef(function(a,b){var c=a.size,d=a.className,e=a.groupsCounterAtom,f=a.groupId,g=a.highlightedIndexAtom,h=a.disabledAtom,i=a.index,j=a.label,k=_objectWithoutProperties(a,_excluded),l=useAtom(function(a){return a.spy(g)===i}),m=_slicedToArray(l,1),n=m[0],o=useAtom(h),p=_slicedToArray(o,1),q=p[0];return React.createElement(ListItem,Object.assign({},k,{ref:b,className:cnFlatSelectItemAll(null,[d]),role:"option",label:j,size:c,active:n,disabled:q,rightSide:React.createElement(FlatSelectItemAllCounter,{size:c,groupsCounterAtom:e,groupId:f}),leftSide:React.createElement(FlatSelectItemAllCounterCheckbox,{size:c,groupsCounterAtom:e,groupId:f,disabledAtom:h})}))});
|
|
2
|
+
//# sourceMappingURL=FlatSelectItemAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectItemAll.js","names":["useAtom","React","forwardRef","Checkbox","ListItem","Text","cn","sizeCheckboxMap","cnFlatSelectItemAll","textSizeMap","xs","s","m","l","FlatSelectItemAllCounter","groupsCounterAtom","groupId","size","ctx","counter","spy","total","selected","FlatSelectItemAllCounterCheckbox","disabledAtom","checked","intermediate","disabled","FlatSelectItemAll","props","ref","className","highlightedIndexAtom","index","label","otherProps","hovered"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectItemAll/FlatSelectItemAll.tsx"],"sourcesContent":["import { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { forwardRef } from 'react';\n\nimport { Checkbox } from '##/components/Checkbox';\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { ListItem } from '##/components/ListCanary';\nimport { Text, TextPropSize } from '##/components/Text';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nimport { sizeCheckboxMap } from '../FlatSelectItem';\n\nexport type FlatFlatSelectItemAllProps = PropsWithHTMLAttributesAndRef<\n {\n size: FieldPropSize;\n hovered?: boolean;\n indent?: 'normal' | 'increased';\n groupsCounterAtom: AtomMut<Record<string, [number, number]>>;\n groupId: string | number;\n highlightedIndexAtom: AtomMut<number>;\n index: number;\n label: string;\n disabledAtom: AtomMut<boolean>;\n },\n HTMLDivElement\n>;\n\nexport const cnFlatSelectItemAll = cn('FlatSelectItemAll');\n\nconst textSizeMap: Record<FieldPropSize, TextPropSize> = {\n xs: 's',\n s: 's',\n m: 'm',\n l: 'l',\n};\n\nconst FlatSelectItemAllCounter: React.FC<{\n groupsCounterAtom: AtomMut<Record<string, [number, number]>>;\n groupId: string | number;\n size: FieldPropSize;\n}> = ({ groupsCounterAtom, groupId, size }) => {\n const [total] = useAtom((ctx) => {\n const counter = ctx.spy(groupsCounterAtom);\n return counter[groupId]?.[1] || 0;\n });\n const [selected] = useAtom((ctx) => {\n const counter = ctx.spy(groupsCounterAtom);\n return counter[groupId]?.[0] || 0;\n });\n\n return (\n <Text\n size={textSizeMap[size]}\n lineHeight=\"xs\"\n view=\"ghost\"\n >{`${selected} из ${total}`}</Text>\n );\n};\n\nconst FlatSelectItemAllCounterCheckbox: React.FC<{\n groupsCounterAtom: AtomMut<Record<string, [number, number]>>;\n disabledAtom: AtomMut<boolean>;\n groupId: string | number;\n size: FieldPropSize;\n}> = ({ groupsCounterAtom, groupId, size, disabledAtom }) => {\n const [checked] = useAtom((ctx) => {\n const counter = ctx.spy(groupsCounterAtom);\n if (counter[groupId] === undefined) {\n return false;\n }\n return counter[groupId][0] === counter[groupId][1];\n });\n const [intermediate] = useAtom((ctx) => {\n const counter = ctx.spy(groupsCounterAtom);\n if (counter[groupId] === undefined) {\n return false;\n }\n return counter[groupId][0] > 0 && counter[groupId][0] < counter[groupId][1];\n });\n const [disabled] = useAtom(disabledAtom);\n\n return (\n <Checkbox\n checked={checked}\n intermediate={intermediate}\n size={sizeCheckboxMap[size]}\n tabIndex={-1}\n disabled={disabled}\n />\n );\n};\n\nexport const FlatSelectItemAll: React.FC<FlatFlatSelectItemAllProps> =\n forwardRef((props, ref) => {\n const {\n size,\n className,\n groupsCounterAtom,\n groupId,\n highlightedIndexAtom,\n disabledAtom,\n index,\n label,\n ...otherProps\n } = props;\n\n const [hovered] = useAtom((ctx) => ctx.spy(highlightedIndexAtom) === index);\n const [disabled] = useAtom(disabledAtom);\n\n return (\n <ListItem\n {...otherProps}\n ref={ref}\n className={cnFlatSelectItemAll(null, [className])}\n role=\"option\"\n label={label}\n size={size}\n active={hovered}\n disabled={disabled}\n rightSide={\n <FlatSelectItemAllCounter\n size={size}\n groupsCounterAtom={groupsCounterAtom}\n groupId={groupId}\n />\n }\n leftSide={\n <FlatSelectItemAllCounterCheckbox\n size={size}\n groupsCounterAtom={groupsCounterAtom}\n groupId={groupId}\n disabledAtom={disabledAtom}\n />\n }\n />\n );\n });\n"],"mappings":"6QACA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,QAAT,sBAEA,OAASC,QAAT,wBACA,OAASC,IAAT,kBACA,OAASC,EAAT,0BAGA,OAASC,eAAT,yBAiBA,MAAO,IAAMC,oBAAmB,CAAGF,EAAE,CAAC,mBAAD,CAA9B,C,GAEDG,YAAgD,CAAG,CACvDC,EAAE,CAAE,GADmD,CAEvDC,CAAC,CAAE,GAFoD,CA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S,CAAEtB,mBAAmB,CAAC,IAAD,CAAO,CAACuB,CAAD,CAAP,CAHhC,CAIE,IAAI,CAAC,QAJP,CAKE,KAAK,CAAEG,CALT,CAME,IAAI,CAAEjB,CANR,CAOE,MAAM,CAAEmB,CAPV,CAQE,QAAQ,CAAET,CARZ,CASE,SAAS,CACP,oBAAC,wBAAD,EACE,IAAI,CAAEV,CADR,CAEE,iBAAiB,CAAEF,CAFrB,CAGE,OAAO,CAAEC,CAHX,EAVJ,CAgBE,QAAQ,CACN,oBAAC,gCAAD,EACE,IAAI,CAAEC,CADR,CAEE,iBAAiB,CAAEF,CAFrB,CAGE,OAAO,CAAEC,CAHX,CAIE,YAAY,CAAEQ,CAJhB,EAjBJ,GA0BH,CA3CS,CADL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectItemAll';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectItemAll/index.ts"],"sourcesContent":["export * from './FlatSelectItemAll';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ListBox.FlatSelectList{background:transparent}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import './FlatSelectList.css';
|
|
2
|
+
import { AtomMut } from '@reatom/framework';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { FieldPropSize } from '../../FieldComponents';
|
|
5
|
+
import { PopoverPropOffset } from '../../Popover';
|
|
6
|
+
import { PropsWithJsxAttributes } from '../../../utils/types/PropsWithJsxAttributes';
|
|
7
|
+
import { CountedGroup } from '../types';
|
|
8
|
+
import { GetOptionPropsResult, OptionForCreate, OptionProps } from '../useFlatSelect';
|
|
9
|
+
export declare const FlatSelectListForm: readonly ["default", "brick", "round"];
|
|
10
|
+
export type FlatSelectListPropForm = typeof FlatSelectListForm[number];
|
|
11
|
+
export declare const defaultFlatSelectListPropForm: "default";
|
|
12
|
+
type RenderItemProps<ITEM> = {
|
|
13
|
+
item: ITEM;
|
|
14
|
+
active: boolean;
|
|
15
|
+
hovered: boolean;
|
|
16
|
+
onClick: (e: React.MouseEvent) => void;
|
|
17
|
+
onMouseEnter: (e: React.MouseEvent) => void;
|
|
18
|
+
ref: React.Ref<HTMLDivElement>;
|
|
19
|
+
};
|
|
20
|
+
type Props<ITEM, GROUP> = PropsWithJsxAttributes<{
|
|
21
|
+
size: FieldPropSize;
|
|
22
|
+
listRef: React.Ref<HTMLDivElement>;
|
|
23
|
+
getOptionActions(props: OptionProps<ITEM>): GetOptionPropsResult;
|
|
24
|
+
openAtom: AtomMut<boolean>;
|
|
25
|
+
offset?: PopoverPropOffset | 'none';
|
|
26
|
+
isLoading?: boolean;
|
|
27
|
+
renderItem: (props: RenderItemProps<ITEM>) => React.ReactNode | null;
|
|
28
|
+
highlightedIndexAtom: AtomMut<number>;
|
|
29
|
+
visibleItemsAtom: AtomMut<(OptionForCreate | CountedGroup<ITEM, GROUP>)[]>;
|
|
30
|
+
getGroupLabel?: (group: GROUP) => string;
|
|
31
|
+
labelForCreate?: ((label: string | undefined) => React.ReactNode) | React.ReactNode;
|
|
32
|
+
labelForNotFound?: string;
|
|
33
|
+
labelForEmptyItems?: string;
|
|
34
|
+
notFound?: boolean;
|
|
35
|
+
hasItemsAtom: AtomMut<boolean>;
|
|
36
|
+
itemsRefs: React.RefObject<HTMLDivElement>[];
|
|
37
|
+
virtualScroll?: boolean;
|
|
38
|
+
onScrollToBottom?: (length: number) => void;
|
|
39
|
+
valueAtom: AtomMut<ITEM[]>;
|
|
40
|
+
getItemKeyAtom: AtomMut<(item: ITEM) => string | number>;
|
|
41
|
+
onChangeAll: (e: React.SyntheticEvent, items: ITEM[]) => void;
|
|
42
|
+
onChange: (e: React.SyntheticEvent, item: ITEM) => void;
|
|
43
|
+
inputValueAtom: AtomMut<string>;
|
|
44
|
+
groupsCounterAtom: AtomMut<Record<string, [number, number]>>;
|
|
45
|
+
dropdownZIndexAtom: AtomMut<number | undefined>;
|
|
46
|
+
selectAllLabel: string;
|
|
47
|
+
view: 'default' | 'clear';
|
|
48
|
+
form: 'default' | 'brick' | 'round';
|
|
49
|
+
disabledAtom: AtomMut<boolean>;
|
|
50
|
+
}>;
|
|
51
|
+
type FlatSelectListComponent = <ITEM, GROUP>(props: Props<ITEM, GROUP>) => React.ReactNode | null;
|
|
52
|
+
export declare const FlatSelectList: FlatSelectListComponent;
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["size","getOptionActions","listRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItemsAtom","form","openAtom","renderItem","visibleItemsAtom","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","highlightedIndexAtom","valueAtom","getItemKeyAtom","onChange","onChangeAll","inputValueAtom","groupsCounterAtom","dropdownZIndexAtom","selectAllLabel","view","disabledAtom"];import"./FlatSelectList.css";import{useAtom}from"@reatom/npm-react";import React,{Fragment,memo,useMemo}from"react";import{ListBox,ListItem,ListLoader}from"../../ListCanary";import{forkRef,useForkRef}from"../../../hooks/useForkRef";import{useVirtualScroll}from"../../../hooks/useVirtualScroll";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{FlatSelectCreateButton}from"../FlatSelectCreateButton";import{FlatSelectGroupLabel}from"../FlatSelectGroupLabel/FlatSelectGroupLabel";import{FlatSelectItemAll}from"../FlatSelectItemAll/FlatSelectItemAll";import{FlatSelectLoader}from"../FlatSelectLoader/FlatSelectLoader";import{FlatSelectRenderItem}from"../FlatSelectRenderItem";import{isNotOptionForCreate,isOptionForCreate,isOptionForSelectAll}from"../useFlatSelect";export var FlatSelectListForm=["default","brick","round"];export var defaultFlatSelectListPropForm=FlatSelectListForm[0];var cnFlatSelectList=cn("FlatSelectList"),getLengthElements=function(a){for(var b=1>=a.length?0:a.length,c=0;c<a.length;c++){var d,e=a[c];isNotOptionForCreate(e)&&null!==e&&void 0!==e&&null!==(d=e.items)&&void 0!==d&&d.length&&(b+=e.items.length)}return b},isVisible=function(a,b){return b>=a[0]&&b<a[1]};export var FlatSelectList=memo(function(a){var b=a.size,c=a.getOptionActions,d=a.listRef,e=a.labelForCreate,f=a.className,g=a.labelForNotFound,h=a.labelForEmptyItems,i=a.hasItemsAtom,j=a.form,k=a.openAtom,l=a.renderItem,m=a.visibleItemsAtom,n=a.isLoading,o=a.getGroupLabel,p=a.notFound,q=a.itemsRefs,r=a.virtualScroll,s=a.onScrollToBottom,t=a.highlightedIndexAtom,u=a.valueAtom,v=a.getItemKeyAtom,w=a.onChange,x=a.onChangeAll,y=a.inputValueAtom,z=a.groupsCounterAtom,A=a.dropdownZIndexAtom,B=a.selectAllLabel,C=a.view,D=a.disabledAtom,E=_objectWithoutProperties(a,_excluded),F=useAtom(m),G=_slicedToArray(F,1),H=G[0],I=useAtom(i),J=_slicedToArray(I,1),K=J[0],L=useAtom(v),M=_slicedToArray(L,1),N=M[0],O="round"===j?"increased":"normal",P=useMemo(function(){return 0<H.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[H]),Q=useMemo(function(){return getLengthElements(H)},[H]),R=useVirtualScroll({length:Q,isActive:r,onScrollToBottom:s}),S=R.spaceTop,T=R.slice,U=R.listRefs,V=R.scrollElementRef,W=useForkRef([V,d]),X=0===T[0]&&r?[0,50]:T,Y=fabricIndex(),Z=fabricIndex();return React.createElement(ListBox,Object.assign({},E,{size:b,ref:W,className:cnFlatSelectList({view:C},[f]),tabIndex:-1}),n&&!P&&React.createElement(FlatSelectLoader,null),React.createElement("div",{className:cnFlatSelectList("List"),key:cnFlatSelectList("List"),style:{marginTop:S}},H.map(function(a){if(isOptionForCreate(a)){var f=Y();return React.createElement(FlatSelectCreateButton,Object.assign({size:b,key:cnFlatSelectList("List",{key:"CreateButton"}),labelForCreate:e,indent:O,ref:q[f],highlightedIndexAtom:t,inputValueAtom:y,disabledAtom:D,index:f},c({index:f,item:a})))}var d=1<H.length?Z():0;return React.createElement(Fragment,{key:a.key},a.group&&o&&isVisible(X,d)&&React.createElement(FlatSelectGroupLabel,{label:o(a.group),size:b,indent:O,ref:U[d],key:"group-".concat(a.key,"-Label")}),a.items.map(function(d){if(isOptionForSelectAll(d)){var e=Z(),f=Y();if(isVisible(X,e))return React.createElement(FlatSelectItemAll,Object.assign({label:B,groupId:a.key,highlightedIndexAtom:t,groupsCounterAtom:z,key:cnFlatSelectList("SelectItemAll",{group:a.key}),ref:forkRef([U[e],q[f]]),indent:O,size:b},c({index:f,item:d}),{index:f,disabledAtom:D}))}else{var g=Z(),h=Y();if(isVisible(X,g))return React.createElement(FlatSelectRenderItem,Object.assign({key:cnFlatSelectList("SelectRenderItem",{group:a.key,item:N(d)}),getItemKeyAtom:v,highlightedIndexAtom:t,rootRef:forkRef([U[g],q[h]]),renderItem:l,item:d},c({index:h,item:d}),{index:h,valueAtom:u}))}}))}),n&&P&&React.createElement(ListLoader,{size:b,innerOffset:O})),!n&&!K&&h&&React.createElement(ListItem,{size:b,label:h,innerOffset:O},h))});
|
|
2
|
+
//# sourceMappingURL=FlatSelectList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectList.js","names":["useAtom","React","Fragment","memo","useMemo","ListBox","ListItem","ListLoader","forkRef","useForkRef","useVirtualScroll","cn","fabricIndex","FlatSelectCreateButton","FlatSelectGroupLabel","FlatSelectItemAll","FlatSelectLoader","FlatSelectRenderItem","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","FlatSelectListForm","defaultFlatSelectListPropForm","cnFlatSelectList","getLengthElements","elements","length","index","element","items","isVisible","slice","FlatSelectList","props","size","getOptionActions","listRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItemsAtom","form","openAtom","renderItem","visibleItemsAtom","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","highlightedIndexAtom","valueAtom","getItemKeyAtom","onChange","onChangeAll","inputValueAtom","groupsCounterAtom","dropdownZIndexAtom","selectAllLabel","view","disabledAtom","otherProps","visibleItems","hasItems","getItemKey","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","listRefs","scrollElementRef","scrollContainerRef","getIndex","getVirtualIndex","marginTop","map","key","item","virtualIndex"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectList/FlatSelectList.tsx"],"sourcesContent":["import './FlatSelectList.css';\n\nimport { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { Fragment, memo, useMemo } from 'react';\n\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { ListBox, ListItem, ListLoader } from '##/components/ListCanary';\nimport { PopoverPropOffset } from '##/components/Popover';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport { cn } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { FlatSelectCreateButton } from '../FlatSelectCreateButton';\nimport { FlatSelectGroupLabel } from '../FlatSelectGroupLabel/FlatSelectGroupLabel';\nimport { FlatSelectItemAll } from '../FlatSelectItemAll/FlatSelectItemAll';\nimport { FlatSelectLoader } from '../FlatSelectLoader/FlatSelectLoader';\n// import { SelectPopover } from '../SelectPopover';\nimport { FlatSelectRenderItem } from '../FlatSelectRenderItem';\nimport { CountedGroup } from '../types';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../useFlatSelect';\n\nexport const FlatSelectListForm = ['default', 'brick', 'round'] as const;\nexport type FlatSelectListPropForm = typeof FlatSelectListForm[number];\nexport const defaultFlatSelectListPropForm = FlatSelectListForm[0];\n\ntype RenderItemProps<ITEM> = {\n item: ITEM;\n active: boolean;\n hovered: boolean;\n onClick: (e: React.MouseEvent) => void;\n onMouseEnter: (e: React.MouseEvent) => void;\n ref: React.Ref<HTMLDivElement>;\n};\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: FieldPropSize;\n listRef: React.Ref<HTMLDivElement>;\n getOptionActions(props: OptionProps<ITEM>): GetOptionPropsResult;\n // form: FlatSelectListPropForm;\n openAtom: AtomMut<boolean>;\n offset?: PopoverPropOffset | 'none';\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => React.ReactNode | null;\n highlightedIndexAtom: AtomMut<number>;\n visibleItemsAtom: AtomMut<(OptionForCreate | CountedGroup<ITEM, GROUP>)[]>;\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?:\n | ((label: string | undefined) => React.ReactNode)\n | React.ReactNode;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItemsAtom: AtomMut<boolean>;\n itemsRefs: React.RefObject<HTMLDivElement>[];\n virtualScroll?: boolean;\n onScrollToBottom?: (length: number) => void;\n valueAtom: AtomMut<ITEM[]>;\n getItemKeyAtom: AtomMut<(item: ITEM) => string | number>;\n onChangeAll: (e: React.SyntheticEvent, items: ITEM[]) => void;\n onChange: (e: React.SyntheticEvent, item: ITEM) => void;\n inputValueAtom: AtomMut<string>;\n groupsCounterAtom: AtomMut<Record<string, [number, number]>>;\n dropdownZIndexAtom: AtomMut<number | undefined>;\n selectAllLabel: string;\n view: 'default' | 'clear';\n form: 'default' | 'brick' | 'round';\n disabledAtom: AtomMut<boolean>;\n}>;\n\ntype FlatSelectListComponent = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nconst cnFlatSelectList = cn('FlatSelectList');\n\nconst getLengthElements = <ITEM, GROUP>(\n elements: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n }\n )[],\n) => {\n let length = 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 length += element.items.length;\n }\n }\n\n return length;\n};\n\nconst isVisible = (slice: [number, number], index: number) => {\n return index >= slice[0] && index < slice[1];\n};\n\nexport const FlatSelectList: FlatSelectListComponent = memo((props) => {\n const {\n size,\n getOptionActions,\n listRef,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItemsAtom,\n form,\n openAtom,\n renderItem,\n visibleItemsAtom,\n isLoading,\n getGroupLabel,\n notFound,\n itemsRefs,\n virtualScroll,\n onScrollToBottom,\n highlightedIndexAtom,\n valueAtom,\n getItemKeyAtom,\n onChange,\n onChangeAll,\n inputValueAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n selectAllLabel,\n view,\n disabledAtom,\n ...otherProps\n } = props;\n\n const [visibleItems] = useAtom(visibleItemsAtom);\n\n const [hasItems] = useAtom(hasItemsAtom);\n // const [isListMount, setIsListMount] = useAtom(false);\n const [getItemKey] = useAtom(getItemKeyAtom);\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 () => getLengthElements(visibleItems),\n [visibleItems],\n );\n\n const {\n spaceTop,\n slice: sliceHookProp,\n listRefs,\n scrollElementRef,\n } = useVirtualScroll({\n length: lengthForVirtualScroll,\n isActive: virtualScroll,\n onScrollToBottom,\n });\n\n const scrollContainerRef = useForkRef([scrollElementRef, listRef]);\n\n const slice: [number, number] =\n sliceHookProp[0] === 0 && virtualScroll ? [0, 50] : sliceHookProp;\n\n const getIndex = fabricIndex();\n const getVirtualIndex = fabricIndex();\n // const [zIndex] = useAtom(dropdownZIndexAtom);\n\n return (\n <ListBox\n {...otherProps}\n size={size}\n ref={scrollContainerRef}\n className={cnFlatSelectList({ view }, [className])}\n tabIndex={-1}\n >\n {isLoading && !isListShowed && <FlatSelectLoader />}\n <div\n className={cnFlatSelectList('List')}\n key={cnFlatSelectList('List')}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <FlatSelectCreateButton\n size={size}\n key={cnFlatSelectList('List', { key: 'CreateButton' })}\n labelForCreate={labelForCreate}\n indent={indent}\n ref={itemsRefs[index]}\n highlightedIndexAtom={highlightedIndexAtom}\n inputValueAtom={inputValueAtom}\n disabledAtom={disabledAtom}\n index={index}\n {...getOptionActions({\n index,\n item: group,\n })}\n />\n );\n }\n\n const virtualIndex = visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <FlatSelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group-${group.key}-Label`}\n />\n )}\n {group.items.map((item) => {\n if (isOptionForSelectAll(item)) {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n\n if (isVisible(slice, virtualIndex)) {\n return (\n <FlatSelectItemAll\n label={selectAllLabel}\n groupId={group.key}\n highlightedIndexAtom={highlightedIndexAtom}\n groupsCounterAtom={groupsCounterAtom}\n key={cnFlatSelectList('SelectItemAll', {\n group: group.key,\n })}\n ref={forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ])}\n indent={indent}\n size={size}\n {...getOptionActions({\n index,\n item,\n })}\n index={index}\n disabledAtom={disabledAtom}\n />\n );\n }\n } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <FlatSelectRenderItem\n key={cnFlatSelectList('SelectRenderItem', {\n group: group.key,\n item: getItemKey(item),\n })}\n getItemKeyAtom={getItemKeyAtom}\n highlightedIndexAtom={highlightedIndexAtom}\n rootRef={forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ])}\n renderItem={renderItem}\n item={item}\n {...getOptionActions({\n index,\n item,\n })}\n index={index}\n valueAtom={valueAtom}\n />\n );\n }\n }\n })}\n </Fragment>\n );\n })}\n {isLoading && isListShowed && (\n <ListLoader size={size} innerOffset={indent} />\n )}\n </div>\n {!isLoading && !hasItems && labelForEmptyItems && (\n <ListItem size={size} label={labelForEmptyItems} innerOffset={indent}>\n {labelForEmptyItems}\n </ListItem>\n )}\n </ListBox>\n );\n});\n"],"mappings":"olBAAA,6BAGA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,QAAhB,CAA0BC,IAA1B,CAAgCC,OAAhC,KAA+C,OAA/C,CAGA,OAASC,OAAT,CAAkBC,QAAlB,CAA4BC,UAA5B,wBAEA,OAASC,OAAT,CAAkBC,UAAlB,iCACA,OAASC,gBAAT,uCACA,OAASC,EAAT,0BACA,OAASC,WAAT,kCAIA,OAASC,sBAAT,iCACA,OAASC,oBAAT,oDACA,OAASC,iBAAT,8CACA,OAASC,gBAAT,4CAEA,OAASC,oBAAT,+BAEA,OAEEC,oBAFF,CAGEC,iBAHF,CAIEC,oBAJF,wBASA,MAAO,IAAMC,mBAAkB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAA3B,CAEP,MAAO,IAAMC,8BAA6B,CAAGD,kBAAkB,CAAC,CAAD,CAAxD,C,GAkDDE,iBAAgB,CAAGZ,EAAE,CAAC,gBAAD,C,CAErBa,iBAAiB,CAAG,SACxBC,CADwB,CASrB,CAGH,OAFIC,EAAM,CAAsB,CAAnB,EAAAD,CAAQ,CAACC,MAAT,CAAuB,CAAvB,CAA2BD,CAAQ,CAACC,MAEjD,CAASC,CAAK,CAAG,CAAjB,CAAoBA,CAAK,CAAGF,CAAQ,CAACC,MAArC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nB0D,IAAI,CAAJA,CAFmB,CAAD,CAbtB,EAiBE,KAAK,CAAE1D,CAjBT,CAkBE,SAAS,CAAE0B,CAlBb,GAsBL,CACF,CA1DA,CAZH,CAyEH,CAlGA,CALH,CAwGGP,CAAS,EAAIsB,CAAb,EACC,oBAAC,UAAD,EAAY,IAAI,CAAElC,CAAlB,CAAwB,WAAW,CAAEiC,CAArC,EAzGJ,CARF,CAoHG,CAACrB,CAAD,EAAc,CAACmB,CAAf,EAA2BzB,CAA3B,EACC,oBAAC,QAAD,EAAU,IAAI,CAAEN,CAAhB,CAAsB,KAAK,CAAEM,CAA7B,CAAiD,WAAW,CAAE2B,CAA9D,EACG3B,CADH,CArHJ,CA2HH,CA1M0D,CAApD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectList';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectList/index.ts"],"sourcesContent":["export * from './FlatSelectList';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.FlatSelectLoader{--loader-height:0;cursor:wait;height:100%;min-height:calc(var(--flat-select-control-height)*2);position:relative}.FlatSelectLoader-Loader.Loader{--loader-color:var(--color-control-typo-disable);left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import"./FlatSelectLoader.css";import React from"react";import{Loader}from"../../Loader";import{cn}from"../../../utils/bem";export var cnFlatSelectLoader=cn("FlatSelectLoader");export var FlatSelectLoader=function(){return React.createElement("div",{className:cnFlatSelectLoader()},React.createElement(Loader,{className:cnFlatSelectLoader("Loader"),size:"s"}))};
|
|
2
|
+
//# sourceMappingURL=FlatSelectLoader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectLoader.js","names":["React","Loader","cn","cnFlatSelectLoader","FlatSelectLoader"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectLoader/FlatSelectLoader.tsx"],"sourcesContent":["import './FlatSelectLoader.css';\n\nimport React from 'react';\n\nimport { Loader } from '##/components/Loader';\nimport { cn } from '##/utils/bem';\n\nexport const cnFlatSelectLoader = cn('FlatSelectLoader');\n\nexport const FlatSelectLoader = () => {\n return (\n <div className={cnFlatSelectLoader()}>\n <Loader className={cnFlatSelectLoader('Loader')} size=\"s\" />\n </div>\n );\n};\n"],"mappings":"AAAA,+BAEA,MAAOA,MAAP,KAAkB,OAAlB,CAEA,OAASC,MAAT,oBACA,OAASC,EAAT,0BAEA,MAAO,IAAMC,mBAAkB,CAAGD,EAAE,CAAC,kBAAD,CAA7B,CAEP,MAAO,IAAME,iBAAgB,CAAG,UAAM,CACpC,MACE,4BAAK,SAAS,CAAED,kBAAkB,EAAlC,EACE,oBAAC,MAAD,EAAQ,SAAS,CAAEA,kBAAkB,CAAC,QAAD,CAArC,CAAiD,IAAI,CAAC,GAAtD,EADF,CAIH,CANM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectLoader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectLoader/index.ts"],"sourcesContent":["export * from './FlatSelectLoader';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AtomMut } from '@reatom/framework';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type RenderItemProps<ITEM> = {
|
|
4
|
+
item: ITEM;
|
|
5
|
+
active: boolean;
|
|
6
|
+
hovered: boolean;
|
|
7
|
+
onClick: (e: React.MouseEvent) => void;
|
|
8
|
+
onMouseEnter: (e: React.MouseEvent) => void;
|
|
9
|
+
ref: React.Ref<HTMLDivElement>;
|
|
10
|
+
};
|
|
11
|
+
type SelectRenderItemProps<ITEM> = {
|
|
12
|
+
item: ITEM;
|
|
13
|
+
rootRef: React.Ref<HTMLDivElement>;
|
|
14
|
+
onClick: (e: React.MouseEvent) => void;
|
|
15
|
+
onMouseEnter: (e: React.MouseEvent) => void;
|
|
16
|
+
renderItem: (props: RenderItemProps<ITEM>) => React.ReactNode | null;
|
|
17
|
+
highlightedIndexAtom: AtomMut<number>;
|
|
18
|
+
index: number;
|
|
19
|
+
valueAtom: AtomMut<ITEM[]>;
|
|
20
|
+
getItemKeyAtom: AtomMut<(item: ITEM) => string | number>;
|
|
21
|
+
};
|
|
22
|
+
type SelectRenderItemComponent = <ITEM>(props: SelectRenderItemProps<ITEM>) => React.ReactNode;
|
|
23
|
+
export declare const FlatSelectRenderItem: SelectRenderItemComponent;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useAtom}from"@reatom/npm-react";import React from"react";export var FlatSelectRenderItem=function(a){var b=a.renderItem,c=a.item,d=a.rootRef,e=a.onClick,f=a.onMouseEnter,g=a.highlightedIndexAtom,h=a.index,i=a.valueAtom,j=a.getItemKeyAtom,k=useAtom(function(a){var b=a.spy(i),d=a.get(j);return!!b.find(function(a){return d(a)===d(c)})}),l=_slicedToArray(k,1),m=l[0],n=useAtom(function(a){var b=a.spy(g);return h===b}),o=_slicedToArray(n,1),p=o[0];return React.createElement(React.Fragment,null,b({ref:d,onClick:e,onMouseEnter:f,item:c,active:m,hovered:p}))};
|
|
2
|
+
//# sourceMappingURL=FlatSelectRenderItem.js.map
|
package/__internal__/src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectRenderItem.js","names":["useAtom","React","FlatSelectRenderItem","props","renderItem","item","rootRef","onClick","onMouseEnter","highlightedIndexAtom","index","valueAtom","getItemKeyAtom","ctx","value","spy","getItemKey","get","find","valueItem","active","highlightedIndex","hovered","ref"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectRenderItem/FlatSelectRenderItem.tsx"],"sourcesContent":["import { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React from 'react';\n\ntype RenderItemProps<ITEM> = {\n item: ITEM;\n active: boolean;\n hovered: boolean;\n onClick: (e: React.MouseEvent) => void;\n onMouseEnter: (e: React.MouseEvent) => void;\n ref: React.Ref<HTMLDivElement>;\n};\n\ntype SelectRenderItemProps<ITEM> = {\n item: ITEM;\n rootRef: React.Ref<HTMLDivElement>;\n onClick: (e: React.MouseEvent) => void;\n onMouseEnter: (e: React.MouseEvent) => void;\n renderItem: (props: RenderItemProps<ITEM>) => React.ReactNode | null;\n highlightedIndexAtom: AtomMut<number>;\n index: number;\n valueAtom: AtomMut<ITEM[]>;\n getItemKeyAtom: AtomMut<(item: ITEM) => string | number>;\n};\n\ntype SelectRenderItemComponent = <ITEM>(\n props: SelectRenderItemProps<ITEM>,\n) => React.ReactNode;\n\nexport const FlatSelectRenderItem: SelectRenderItemComponent = (props) => {\n const {\n renderItem,\n item,\n rootRef,\n onClick,\n onMouseEnter,\n highlightedIndexAtom,\n index,\n valueAtom,\n getItemKeyAtom,\n } = props;\n\n const [active] = useAtom((ctx) => {\n const value = ctx.spy(valueAtom);\n\n const getItemKey = ctx.get(getItemKeyAtom);\n\n return !!value.find(\n (valueItem) => getItemKey(valueItem) === getItemKey(item),\n );\n });\n\n const [hovered] = useAtom((ctx) => {\n const highlightedIndex = ctx.spy(highlightedIndexAtom);\n return index === highlightedIndex;\n });\n\n return (\n <>\n {renderItem({\n ref: rootRef,\n onClick,\n onMouseEnter,\n item,\n active,\n hovered,\n })}\n </>\n );\n};\n"],"mappings":"iEACA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,KAAkB,OAAlB,CA2BA,MAAO,IAAMC,qBAA+C,CAAG,SAACC,CAAD,CAAW,IAEtEC,EAFsE,CAWpED,CAXoE,CAEtEC,UAFsE,CAGtEC,CAHsE,CAWpEF,CAXoE,CAGtEE,IAHsE,CAItEC,CAJsE,CAWpEH,CAXoE,CAItEG,OAJsE,CAKtEC,CALsE,CAWpEJ,CAXoE,CAKtEI,OALsE,CAMtEC,CANsE,CAWpEL,CAXoE,CAMtEK,YANsE,CAOtEC,CAPsE,CAWpEN,CAXoE,CAOtEM,oBAPsE,CAQtEC,CARsE,CAWpEP,CAXoE,CAQtEO,KARsE,CAStEC,CATsE,CAWpER,CAXoE,CAStEQ,SATsE,CAUtEC,CAVsE,CAWpET,CAXoE,CAUtES,cAVsE,GAavDZ,OAAO,CAAC,SAACa,CAAD,CAAS,IAC1BC,EAAK,CAAGD,CAAG,CAACE,GAAJ,CAAQJ,CAAR,CADkB,CAG1BK,CAAU,CAAGH,CAAG,CAACI,GAAJ,CAAQL,CAAR,CAHa,CAKhC,MAAO,CAAC,CAACE,CAAK,CAACI,IAAN,CACP,SAACC,CAAD,QAAeH,EAAU,CAACG,CAAD,CAAV,GAA0BH,CAAU,CAACX,CAAD,CAAnD,CADO,CAGV,CARuB,CAbgD,uBAajEe,CAbiE,QAuBtDpB,OAAO,CAAC,SAACa,CAAD,CAAS,CACjC,GAAMQ,EAAgB,CAAGR,CAAG,CAACE,GAAJ,CAAQN,CAAR,CAAzB,CACA,MAAOC,EAAK,GAAKW,CAClB,CAHwB,CAvB+C,uBAuBjEC,CAvBiE,MA4BxE,MACE,yCACGlB,CAAU,CAAC,CACVmB,GAAG,CAAEjB,CADK,CAEVC,OAAO,CAAPA,CAFU,CAGVC,YAAY,CAAZA,CAHU,CAIVH,IAAI,CAAJA,CAJU,CAKVe,MAAM,CAANA,CALU,CAMVE,OAAO,CAAPA,CANU,CAAD,CADb,CAWH,CAxCM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FlatSelectRenderItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../src/components/FlatSelect/FlatSelectRenderItem/index.ts"],"sourcesContent":["export * from './FlatSelectRenderItem';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.FlatSelectRoot_withAnchor{background:var(--color-bg-default);box-shadow:var(--shadow-layer);min-width:280px}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import './FlatSelectRoot.css';
|
|
2
|
+
import { AtomMut } from '@reatom/framework';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Direction } from '../../Popover';
|
|
5
|
+
import { PropsWithHTMLAttributesAndRef } from '../../../utils/types/PropsWithHTMLAttributes';
|
|
6
|
+
export type FlatSelectRootProps = PropsWithHTMLAttributesAndRef<{
|
|
7
|
+
anchorRef?: React.RefObject<HTMLElement>;
|
|
8
|
+
openAtom: AtomMut<boolean>;
|
|
9
|
+
direction?: Direction;
|
|
10
|
+
spareDirection?: Direction;
|
|
11
|
+
possibleDirections?: Direction[];
|
|
12
|
+
}, HTMLDivElement>;
|
|
13
|
+
export declare const cnFlatSelectRoot: import("@bem-react/classname").ClassNameFormatter;
|
|
14
|
+
export declare const FlatSelectRoot: React.FC<FlatSelectRootProps>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["className","anchorRef","openAtom","direction","spareDirection","possibleDirections"];import"./FlatSelectRoot.css";import{useAtom}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{Transition}from"react-transition-group";import{Popover}from"../../Popover";import{useForkRef}from"../../../hooks/useForkRef";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate";import{cn}from"../../../utils/bem";export var cnFlatSelectRoot=cn("FlatSelectRoot");export var FlatSelectRoot=forwardRef(function(a,b){var c=a.className,d=a.anchorRef,e=a.openAtom,f=a.direction,g=void 0===f?"downStartLeft":f,h=a.spareDirection,i=void 0===h?"downStartLeft":h,j=a.possibleDirections,k=void 0===j?["downStartLeft","downStartRight","upStartLeft","upStartRight","leftStartDown","leftStartUp"]:j,l=_objectWithoutProperties(a,_excluded),m=useRef(null),n=useForkRef([m,b]),o=!!d,p=useAtom(e),q=_slicedToArray(p,1),r=q[0];return o?React.createElement(Transition,{in:r,unmountOnExit:!0,timeout:animateTimeout,nodeRef:m},function(a){return React.createElement(Popover,Object.assign({},l,{className:cnFlatSelectRoot({withAnchor:o},[c,cnMixPopoverAnimate({animate:a})]),ref:n,anchorRef:d,equalAnchorWidth:!0,offset:"2xs",direction:g,spareDirection:i,possibleDirections:k}))}):React.createElement("div",Object.assign({},l,{className:cnFlatSelectRoot(null,[c]),ref:b}))});
|
|
2
|
+
//# sourceMappingURL=FlatSelectRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatSelectRoot.js","names":["useAtom","React","forwardRef","useRef","Transition","Popover","useForkRef","animateTimeout","cnMixPopoverAnimate","cn","cnFlatSelectRoot","FlatSelectRoot","props","ref","className","anchorRef","openAtom","direction","spareDirection","possibleDirections","otherProps","contentRef","contentForkedRef","withAnchor","open","animate"],"sources":["../../../../../../src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.tsx"],"sourcesContent":["import './FlatSelectRoot.css';\n\nimport { AtomMut } from '@reatom/framework';\nimport { useAtom } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { Direction, Popover } from '##/components/Popover';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { animateTimeout, cnMixPopoverAnimate } from '##/mixs/MixPopoverAnimate';\nimport { cn } from '##/utils/bem';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type FlatSelectRootProps = PropsWithHTMLAttributesAndRef<\n {\n anchorRef?: React.RefObject<HTMLElement>;\n openAtom: AtomMut<boolean>;\n direction?: Direction;\n spareDirection?: Direction;\n possibleDirections?: Direction[];\n },\n HTMLDivElement\n>;\n\nexport const cnFlatSelectRoot = cn('FlatSelectRoot');\n\nexport const FlatSelectRoot: React.FC<FlatSelectRootProps> = forwardRef(\n (props, ref) => {\n const {\n className,\n anchorRef,\n openAtom,\n direction = 'downStartLeft',\n spareDirection = 'downStartLeft',\n possibleDirections = [\n 'downStartLeft',\n 'downStartRight',\n 'upStartLeft',\n 'upStartRight',\n 'leftStartDown',\n 'leftStartUp',\n ],\n ...otherProps\n } = props;\n const contentRef = useRef(null);\n const contentForkedRef = useForkRef([contentRef, ref]);\n const withAnchor = !!anchorRef;\n const [open] = useAtom(openAtom);\n\n if (withAnchor) {\n return (\n <Transition\n in={open}\n unmountOnExit\n timeout={animateTimeout}\n nodeRef={contentRef}\n >\n {(animate) => (\n <Popover\n {...otherProps}\n className={cnFlatSelectRoot({ withAnchor }, [\n className,\n cnMixPopoverAnimate({ animate }),\n ])}\n ref={contentForkedRef}\n anchorRef={anchorRef}\n equalAnchorWidth\n offset=\"2xs\"\n direction={direction}\n spareDirection={spareDirection}\n possibleDirections={possibleDirections}\n />\n )}\n </Transition>\n );\n }\n\n return (\n <div\n {...otherProps}\n className={cnFlatSelectRoot(null, [className])}\n ref={ref}\n />\n );\n },\n);\n"],"mappings":"2PAAA,6BAGA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OAAoBC,OAApB,qBACA,OAASC,UAAT,iCACA,OAASC,cAAT,CAAyBC,mBAAzB,uCACA,OAASC,EAAT,0BAcA,MAAO,IAAMC,iBAAgB,CAAGD,EAAE,CAAC,gBAAD,CAA3B,CAEP,MAAO,IAAME,eAA6C,CAAGT,UAAU,CACrE,SAACU,CAAD,CAAQC,CAAR,CAAgB,IAEZC,EAFY,CAgBVF,CAhBU,CAEZE,SAFY,CAGZC,CAHY,CAgBVH,CAhBU,CAGZG,SAHY,CAIZC,CAJY,CAgBVJ,CAhBU,CAIZI,QAJY,GAgBVJ,CAhBU,CAKZK,SALY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],"sources":["../../../../../../src/components/FlatSelect/FlatSelectRoot/index.ts"],"sourcesContent":["export * from './FlatSelectRoot';\n"],"mappings":"AAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { WithDefaultReturn } from '@consta/uikit/__internal__/src/utils/object';
|
|
2
|
+
import { FlatSelectGroupDefault, FlatSelectItemDefault, FlatSelectPropsInit } from '.';
|
|
3
|
+
export declare const defaultLabelForEmptyItems = "\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442";
|
|
4
|
+
export declare const defaultSelectAllLabel = "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435";
|
|
5
|
+
declare const defaultProps: {
|
|
6
|
+
readonly form: "default";
|
|
7
|
+
readonly getItemKey: (item: FlatSelectItemDefault) => string | number;
|
|
8
|
+
readonly getGroupKey: (group: FlatSelectGroupDefault) => string | number;
|
|
9
|
+
readonly getGroupLabel: (group: FlatSelectGroupDefault) => string;
|
|
10
|
+
readonly getItemDisabled: (item: FlatSelectItemDefault) => boolean | undefined;
|
|
11
|
+
readonly getItemGroupKey: (item: FlatSelectItemDefault) => string | number | undefined;
|
|
12
|
+
readonly getItemLabel: (item: FlatSelectItemDefault) => string;
|
|
13
|
+
readonly labelForEmptyItems: "Список пуст";
|
|
14
|
+
readonly selectAllLabel: "Выбрать все";
|
|
15
|
+
readonly view: "default";
|
|
16
|
+
readonly size: "m";
|
|
17
|
+
};
|
|
18
|
+
export declare const withDefault: <ITEM = FlatSelectItemDefault, GROUP = FlatSelectGroupDefault, MULTIPLE extends boolean = false>(props: FlatSelectPropsInit<ITEM, GROUP, MULTIPLE>) => PropsWithDefault<ITEM, GROUP, MULTIPLE>;
|
|
19
|
+
export type PropsWithDefaultMultiple = WithDefaultReturn<FlatSelectPropsInit<FlatSelectItemDefault, FlatSelectGroupDefault, true>, keyof typeof defaultProps>;
|
|
20
|
+
export type PropsWithDefaultSingle = WithDefaultReturn<FlatSelectPropsInit<FlatSelectItemDefault, FlatSelectGroupDefault, false>, keyof typeof defaultProps>;
|
|
21
|
+
export type PropsWithDefault<ITEM = FlatSelectItemDefault, GROUP = FlatSelectGroupDefault, MULTIPLE extends boolean = false> = WithDefaultReturn<FlatSelectPropsInit<ITEM, GROUP, MULTIPLE>, keyof typeof defaultProps>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{objectWithDefault}from"@consta/uikit/__internal__/src/utils/object";export var defaultLabelForEmptyItems="\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442";export var defaultSelectAllLabel="\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435";var getItemKey=function(a){return a.id},getGroupKey=function(a){return a.id},getGroupLabel=function(a){return a.label},getItemDisabled=function(a){return a.disabled},getItemGroupKey=function(a){return a.groupId},getItemLabel=function(a){return a.label},defaultProps={form:"default",getItemKey:getItemKey,getGroupKey:getGroupKey,getGroupLabel:getGroupLabel,getItemDisabled:getItemDisabled,getItemGroupKey:getItemGroupKey,getItemLabel:getItemLabel,labelForEmptyItems:"\u0421\u043F\u0438\u0441\u043E\u043A \u043F\u0443\u0441\u0442",selectAllLabel:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",view:"default",size:"m"};export var withDefault=function(a){return objectWithDefault(defaultProps,a)};
|
|
2
|
+
//# sourceMappingURL=defaultProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultProps.js","names":["objectWithDefault","defaultLabelForEmptyItems","defaultSelectAllLabel","getItemKey","item","id","getGroupKey","group","getGroupLabel","label","getItemDisabled","disabled","getItemGroupKey","groupId","getItemLabel","defaultProps","form","labelForEmptyItems","selectAllLabel","view","size","withDefault","props"],"sources":["../../../../../src/components/FlatSelect/defaultProps.ts"],"sourcesContent":["import {\n objectWithDefault,\n WithDefaultReturn,\n} from '@consta/uikit/__internal__/src/utils/object';\n\nimport {\n FlatSelectGroupDefault,\n FlatSelectItemDefault,\n FlatSelectPropsInit,\n} from '.';\n\n// import { objectWithDefault, WithDefaultReturn } from '##/utils/object';\n\n// import { FlatSelectGroupDefault, FlatSelectItemDefault, FlatSelectPropsInit } from '.';\n\nexport const defaultLabelForEmptyItems = 'Список пуст';\nexport const defaultSelectAllLabel = 'Выбрать все';\n\nconst getItemKey = (item: FlatSelectItemDefault) => item.id;\nconst getGroupKey = (group: FlatSelectGroupDefault) => group.id;\nconst getGroupLabel = (group: FlatSelectGroupDefault) => group.label;\nconst getItemDisabled = (item: FlatSelectItemDefault) => item.disabled;\nconst getItemGroupKey = (item: FlatSelectItemDefault) => item.groupId;\nconst getItemLabel = (item: FlatSelectItemDefault) => item.label;\n\nconst defaultProps = {\n form: 'default',\n getItemKey,\n getGroupKey,\n getGroupLabel,\n getItemDisabled,\n getItemGroupKey,\n getItemLabel,\n labelForEmptyItems: defaultLabelForEmptyItems,\n selectAllLabel: defaultSelectAllLabel,\n view: 'default',\n size: 'm',\n} as const;\n\nexport const withDefault = <\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: FlatSelectPropsInit<ITEM, GROUP, MULTIPLE>,\n): PropsWithDefault<ITEM, GROUP, MULTIPLE> =>\n objectWithDefault(defaultProps as any, props);\n\nexport type PropsWithDefaultMultiple = WithDefaultReturn<\n FlatSelectPropsInit<FlatSelectItemDefault, FlatSelectGroupDefault, true>,\n keyof typeof defaultProps\n>;\n\nexport type PropsWithDefaultSingle = WithDefaultReturn<\n FlatSelectPropsInit<FlatSelectItemDefault, FlatSelectGroupDefault, false>,\n keyof typeof defaultProps\n>;\n\nexport type PropsWithDefault<\n ITEM = FlatSelectItemDefault,\n GROUP = FlatSelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = WithDefaultReturn<\n FlatSelectPropsInit<ITEM, GROUP, MULTIPLE>,\n keyof typeof defaultProps\n>;\n"],"mappings":"AAAA,OACEA,iBADF,KAGO,6CAHP,CAeA,MAAO,IAAMC,0BAAyB,CAAG,+DAAlC,CACP,MAAO,IAAMC,sBAAqB,CAAG,+DAA9B,C,GAEDC,WAAU,CAAG,SAACC,CAAD,QAAiCA,EAAI,CAACC,EAAtC,C,CACbC,WAAW,CAAG,SAACC,CAAD,QAAmCA,EAAK,CAACF,EAAzC,C,CACdG,aAAa,CAAG,SAACD,CAAD,QAAmCA,EAAK,CAACE,KAAzC,C,CAChBC,eAAe,CAAG,SAACN,CAAD,QAAiCA,EAAI,CAACO,QAAtC,C,CAClBC,eAAe,CAAG,SAACR,CAAD,QAAiCA,EAAI,CAACS,OAAtC,C,CAClBC,YAAY,CAAG,SAACV,CAAD,QAAiCA,EAAI,CAACK,KAAtC,C,CAEfM,YAAY,CAAG,CACnBC,IAAI,CAAE,SADa,CAEnBb,UAAU,CAAVA,UAFmB,CAGnBG,WAAW,CAAXA,WAHmB,CAInBE,aAAa,CAAbA,aAJmB,CAKnBE,eAAe,CAAfA,eALmB,CAMnBE,eAAe,CAAfA,eANmB,CAOnBE,YAAY,CAAZA,YAPmB,CAQnBG,kBAAkB,gEARC,CASnBC,cAAc,gEATK,CAUnBC,IAAI,CAAE,SAVa,CAWnBC,IAAI,CAAE,GAXa,C,CAcrB,MAAO,IAAMC,YAAW,CAAG,SAKzBC,CALyB,QAOzBtB,kBAAiB,CAACe,YAAD,CAAsBO,CAAtB,CAPQ,CAApB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/components/FlatSelect/index.ts"],"sourcesContent":["export * from './FlatSelect';\nexport * from './types';\n"],"mappings":"AAAA,0BACA"}
|