@consta/uikit 5.28.4 → 5.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/TextAreaAutoSize/index.d.ts +1 -0
  2. package/TextAreaAutoSize/index.js +1 -0
  3. package/__internal__/src/components/AutoComplete/AutoComplete.js +1 -1
  4. package/__internal__/src/components/AutoComplete/AutoComplete.js.map +1 -1
  5. package/__internal__/src/components/AutoComplete/helpers.d.ts +1 -0
  6. package/__internal__/src/components/AutoComplete/types.d.ts +1 -0
  7. package/__internal__/src/components/AutoComplete/types.js.map +1 -1
  8. package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeText/AutoCompleteTypeText.js +1 -1
  9. package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeText/AutoCompleteTypeText.js.map +1 -1
  10. package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeTextArray/AutoCompleteTypeTextArray.js +1 -1
  11. package/__internal__/src/components/AutoCompleteCanary/AutoCompleteTypeTextArray/AutoCompleteTypeTextArray.js.map +1 -1
  12. package/__internal__/src/components/AutoCompleteCanary/helpers.d.ts +1 -0
  13. package/__internal__/src/components/AutoCompleteCanary/types.d.ts +1 -0
  14. package/__internal__/src/components/AutoCompleteCanary/types.js.map +1 -1
  15. package/__internal__/src/components/Combobox/Combobox.js +1 -1
  16. package/__internal__/src/components/Combobox/Combobox.js.map +1 -1
  17. package/__internal__/src/components/Combobox/helpers.d.ts +3 -1
  18. package/__internal__/src/components/Combobox/helpers.js.map +1 -1
  19. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js +1 -1
  20. package/__internal__/src/components/ContextMenu/ContextMenuLevel/ContextMenuLevel.js.map +1 -1
  21. package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js +1 -1
  22. package/__internal__/src/components/ContextMenu/ContextMenuLevelWrapper/ContextMenuLevelWrapper.js.map +1 -1
  23. package/__internal__/src/components/ContextMenu/helpers.d.ts +4 -2
  24. package/__internal__/src/components/ContextMenu/types.d.ts +2 -0
  25. package/__internal__/src/components/ContextMenu/types.js.map +1 -1
  26. package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.d.ts +1 -0
  27. package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js +1 -1
  28. package/__internal__/src/components/DatePicker/DatePickerDropdown/DatePickerDropdown.js.map +1 -1
  29. package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js +1 -1
  30. package/__internal__/src/components/DatePicker/DatePickerTypeDate/DatePickerTypeDate.js.map +1 -1
  31. package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js +1 -1
  32. package/__internal__/src/components/DatePicker/DatePickerTypeDateRange/DatePickerTypeDateRange.js.map +1 -1
  33. package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js +1 -1
  34. package/__internal__/src/components/DatePicker/DatePickerTypeDateTime/DatePickerTypeDateTime.js.map +1 -1
  35. package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js +1 -1
  36. package/__internal__/src/components/DatePicker/DatePickerTypeDateTimeRange/DatePickerTypeDateTimeRange.js.map +1 -1
  37. package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js +1 -1
  38. package/__internal__/src/components/DatePicker/DatePickerTypeMonth/DatePickerTypeMonth.js.map +1 -1
  39. package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js +1 -1
  40. package/__internal__/src/components/DatePicker/DatePickerTypeMonthRange/DatePickerTypeMonthRange.js.map +1 -1
  41. package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js +1 -1
  42. package/__internal__/src/components/DatePicker/DatePickerTypeTime/DatePickerTypeTime.js.map +1 -1
  43. package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js +1 -1
  44. package/__internal__/src/components/DatePicker/DatePickerTypeYear/DatePickerTypeYear.js.map +1 -1
  45. package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js +1 -1
  46. package/__internal__/src/components/DatePicker/DatePickerTypeYearRange/DatePickerTypeYearRange.js.map +1 -1
  47. package/__internal__/src/components/DatePicker/types.d.ts +1 -0
  48. package/__internal__/src/components/DatePicker/types.js.map +1 -1
  49. package/__internal__/src/components/FieldComponents/FieldControlLayout/FieldControlLayout.css +1 -1
  50. package/__internal__/src/components/FieldComponents/FieldControlLayout/FieldControlLayout.js +1 -1
  51. package/__internal__/src/components/FieldComponents/FieldControlLayout/FieldControlLayout.js.map +1 -1
  52. package/__internal__/src/components/FieldComponents/FieldControlLayout/helpers.js +1 -1
  53. package/__internal__/src/components/FieldComponents/FieldControlLayout/helpers.js.map +1 -1
  54. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.d.ts +1 -0
  55. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js +1 -1
  56. package/__internal__/src/components/FlatSelect/FlatSelectRoot/FlatSelectRoot.js.map +1 -1
  57. package/__internal__/src/components/FlatSelect/types.d.ts +1 -0
  58. package/__internal__/src/components/FlatSelect/types.js.map +1 -1
  59. package/__internal__/src/components/Select/Select.js +1 -1
  60. package/__internal__/src/components/Select/Select.js.map +1 -1
  61. package/__internal__/src/components/Select/helpers.d.ts +3 -1
  62. package/__internal__/src/components/Select/helpers.js.map +1 -1
  63. package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.d.ts +1 -0
  64. package/__internal__/src/components/SelectCanary/SelectDropdown/SelectDropdown.js.map +1 -1
  65. package/__internal__/src/components/SelectCanary/SelectMultiple/SelectMultiple.js +1 -1
  66. package/__internal__/src/components/SelectCanary/SelectMultiple/SelectMultiple.js.map +1 -1
  67. package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.d.ts +1 -0
  68. package/__internal__/src/components/SelectCanary/SelectPopover/SelectPopover.js.map +1 -1
  69. package/__internal__/src/components/SelectCanary/SelectSingle/SelectSingle.js +1 -1
  70. package/__internal__/src/components/SelectCanary/SelectSingle/SelectSingle.js.map +1 -1
  71. package/__internal__/src/components/SelectCanary/helpers.d.ts +2 -1
  72. package/__internal__/src/components/SelectCanary/types.d.ts +1 -0
  73. package/__internal__/src/components/SelectCanary/types.js.map +1 -1
  74. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.d.ts +1 -0
  75. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js +1 -1
  76. package/__internal__/src/components/SelectComponents/SelectDropdown/SelectDropdown.js.map +1 -1
  77. package/__internal__/src/components/TagBase/TagBase.d.ts +1 -1
  78. package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.css +1 -0
  79. package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.d.ts +11 -0
  80. package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.js +2 -0
  81. package/__internal__/src/components/TextAreaAutoSize/TextAreaAutoSize.js.map +1 -0
  82. package/__internal__/src/components/TextAreaAutoSize/index.d.ts +1 -0
  83. package/__internal__/src/components/TextAreaAutoSize/index.js +2 -0
  84. package/__internal__/src/components/TextAreaAutoSize/index.js.map +1 -0
  85. package/__internal__/src/components/TextField/TextField.js +1 -1
  86. package/__internal__/src/components/TextField/TextField.js.map +1 -1
  87. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArea/TextFieldTypeTextArea.css +1 -1
  88. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArea/TextFieldTypeTextArea.js +1 -1
  89. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArea/TextFieldTypeTextArea.js.map +1 -1
  90. package/__internal__/src/components/TextFieldCanary/TextFieldTypeTextArray/TextFieldTypeTextArray.css +1 -1
  91. package/__internal__/src/components/UserSelect/UserSelect.js +1 -1
  92. package/__internal__/src/components/UserSelect/UserSelect.js.map +1 -1
  93. package/__internal__/src/components/UserSelect/helpers.d.ts +3 -1
  94. package/__internal__/src/components/UserSelect/helpers.js.map +1 -1
  95. package/__internal__/src/utils/objectCompare.d.ts +7 -0
  96. package/__internal__/src/utils/objectCompare.js +2 -0
  97. package/__internal__/src/utils/objectCompare.js.map +1 -0
  98. package/__internal__/src/utils/state/index.d.ts +3 -0
  99. package/__internal__/src/utils/state/index.js +1 -1
  100. package/__internal__/src/utils/state/index.js.map +1 -1
  101. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDropdown.js","names":["useAtom","React","Fragment","memo","useMemo","ListItem","ListLoader","mapVerticalSpace","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","forkRef","useForkRef","useVirtualScroll","cnMixScrollBar","cnMixSpace","cnCanary","cn","fabricIndex","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","SelectPopover","SelectRenderItem","selectDropdownForm","defaultSelectDropdownPropForm","cnSelectDropdown","getLengthElements","elements","length","index","element","items","isVisible","slice","SelectDropdown","props","controlRef","size","getOptionActions","dropdownRefProp","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItemsAtom","form","openAtom","offset","offsetProp","renderItem","visibleItemsAtom","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","highlightedIndexAtom","valueAtom","getItemKeyAtom","highlightIndex","onCreate","onChange","onChangeAll","inputValueAtom","groupsCounterAtom","dropdownZIndexAtom","selectAllLabel","otherProps","visibleItems","hasItems","isListMount","setIsListMount","getItemKey","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","listRefs","scrollElementRef","scrollContainerRef","getIndex","getVirtualIndex","zIndex","pV","marginTop","map","key","virtualIndex","item"],"sources":["../../../../../../src/components/SelectCanary/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.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 {\n ListItem,\n ListLoader,\n mapVerticalSpace,\n} from '##/components/ListCanary';\nimport { PopoverPropOffset } from '##/components/Popover';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '##/components/SelectCanary/useSelect';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectItemAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { SelectPopover } from '../SelectPopover';\nimport { SelectRenderItem } from '../SelectRenderItem';\nimport { CountedGroup } from '../types';\n\nexport const selectDropdownForm = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownForm[number];\nexport const defaultSelectDropdownPropForm = selectDropdownForm[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 controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.Ref<HTMLDivElement>;\n getOptionActions(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\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 highlightIndex: (index: number) => void;\n onCreate: (e: React.SyntheticEvent) => 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}>;\n\ntype SelectDropdownComponent = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\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 SelectDropdown: SelectDropdownComponent = memo((props) => {\n const {\n controlRef,\n size,\n getOptionActions,\n dropdownRef: dropdownRefProp,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItemsAtom,\n form,\n openAtom,\n offset: offsetProp = 'none',\n renderItem,\n visibleItemsAtom,\n isLoading,\n getGroupLabel,\n notFound,\n itemsRefs,\n virtualScroll,\n onScrollToBottom,\n highlightedIndexAtom,\n valueAtom,\n getItemKeyAtom,\n highlightIndex,\n onCreate,\n onChange,\n onChangeAll,\n inputValueAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n selectAllLabel,\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 && isListMount,\n onScrollToBottom,\n });\n\n const scrollContainerRef = useForkRef([scrollElementRef, dropdownRefProp]);\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 <SelectPopover\n {...otherProps}\n anchorRef={controlRef}\n offset={offset}\n role=\"listbox\"\n className={cnSelectDropdown()}\n size={size}\n controlRef={controlRef}\n openAtom={openAtom}\n form={form}\n onMount={setIsListMount}\n style={{ zIndex }}\n >\n {isListMount && (\n <div\n className={cnSelectDropdown('ScrollContainer', [\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixScrollBar({ size: 'xs' }),\n ])}\n ref={scrollContainerRef}\n >\n {isLoading && !isListShowed && <SelectLoader />}\n <div\n className={cnSelectDropdown('List')}\n key={cnSelectDropdown('List')}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <SelectCreateButton\n size={size}\n key={cnSelectDropdown('List', { key: 'CreateButton' })}\n labelForCreate={labelForCreate}\n indent={indent}\n ref={itemsRefs[index]}\n onClick={onCreate}\n highlightedIndexAtom={highlightedIndexAtom}\n inputValueAtom={inputValueAtom}\n highlightIndex={highlightIndex}\n index={index}\n />\n );\n }\n\n const virtualIndex =\n visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group-${group.key}-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 <SelectItemAll\n label={selectAllLabel}\n groupId={group.key}\n highlightedIndexAtom={highlightedIndexAtom}\n groupsCounterAtom={groupsCounterAtom}\n key={cnSelectDropdown('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 />\n );\n }\n } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <SelectRenderItem\n key={cnSelectDropdown('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\n size={size}\n label={labelForEmptyItems}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n )}\n </SelectPopover>\n );\n});\n"],"mappings":"onBAAA,6BAGA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,QAAhB,CAA0BC,IAA1B,CAAgCC,OAAhC,KAA+C,OAA/C,CAGA,OACEC,QADF,CAEEC,UAFF,CAGEC,gBAHF,wBAMA,OAEEC,oBAFF,CAGEC,iBAHF,CAIEC,oBAJF,oBAQA,OAASC,OAAT,CAAkBC,UAAlB,iCACA,OAASC,gBAAT,uCACA,OAASC,cAAT,kCACA,OAASC,UAAT,8BACA,OAASC,QAAQ,GAAIC,GAArB,0BACA,OAASC,WAAT,kCAIA,OAASC,kBAAT,gDACA,OAASC,gBAAT,4CACA,OAASC,aAAT,sCACA,OAASC,YAAT,oCACA,OAASC,aAAT,wBACA,OAASC,gBAAT,2BAGA,MAAO,IAAMC,mBAAkB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAA3B,CAEP,MAAO,IAAMC,8BAA6B,CAAGD,kBAAkB,CAAC,CAAD,CAAxD,C,GAkDDE,iBAAgB,CAAGV,EAAE,CAAC,gBAAD,C,CAErBW,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,CAA6CC,CAAK,EAAlD,C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GAsBL,CA5BD,IA4BO,IACCkE,EAAY,CAAGN,EAAe,EAD/B,CAEC5D,CAAK,CAAG2D,EAAQ,EAFjB,CAGL,GAAIxD,SAAS,CAACC,EAAD,CAAQ8D,CAAR,CAAb,CACE,MACE,qBAAC,gBAAD,gBACE,GAAG,CAAEtE,gBAAgB,CAAC,kBAAD,CAAqB,CACxCqD,KAAK,CAAEA,CAAK,CAACgB,GAD2B,CAExCE,IAAI,CAAEtB,CAAU,CAACsB,CAAD,CAFwB,CAArB,CADvB,CAKE,cAAc,CAAEpC,CALlB,CAME,oBAAoB,CAAEF,CANxB,CAOE,OAAO,CAAEjD,OAAO,CAAC,CACf4E,EAAQ,CAACU,CAAD,CADO,CAEfxC,CAAS,CAAC1B,CAAD,CAFM,CAAD,CAPlB,CAWE,UAAU,CAAEqB,CAXd,CAYE,IAAI,CAAE8C,CAZR,EAaM1D,CAAgB,CAAC,CACnBT,KAAK,CAALA,CADmB,CAEnBmE,IAAI,CAAJA,CAFmB,CAAD,CAbtB,EAiBE,KAAK,CAAEnE,CAjBT,CAkBE,SAAS,CAAE8B,CAlBb,GAsBL,CACF,CAzDA,CAZH,CAwEH,CA/FA,CALH,CAqGGP,CAAS,EAAIwB,CAAb,EACC,oBAAC,UAAD,EAAY,IAAI,CAAEvC,CAAlB,CAAwB,WAAW,CAAEsC,CAArC,EAtGJ,CAVF,CAmHG,CAACvB,CAAD,EAAc,CAACmB,CAAf,EAA2B3B,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEP,CADR,CAEE,KAAK,CAAEO,CAFT,CAGE,WAAW,CAAE+B,CAHf,EAKG/B,CALH,CApHJ,CAdJ,CA8IH,CA/N0D,CAApD"}
1
+ {"version":3,"file":"SelectDropdown.js","names":["useAtom","React","Fragment","memo","useMemo","ListItem","ListLoader","mapVerticalSpace","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","forkRef","useForkRef","useVirtualScroll","cnMixScrollBar","cnMixSpace","cnCanary","cn","fabricIndex","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","SelectPopover","SelectRenderItem","selectDropdownForm","defaultSelectDropdownPropForm","cnSelectDropdown","getLengthElements","elements","length","index","element","items","isVisible","slice","SelectDropdown","props","controlRef","size","getOptionActions","dropdownRefProp","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItemsAtom","form","openAtom","offset","offsetProp","renderItem","visibleItemsAtom","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","highlightedIndexAtom","valueAtom","getItemKeyAtom","highlightIndex","onCreate","onChange","onChangeAll","inputValueAtom","groupsCounterAtom","dropdownZIndexAtom","selectAllLabel","otherProps","visibleItems","hasItems","isListMount","setIsListMount","getItemKey","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","listRefs","scrollElementRef","scrollContainerRef","getIndex","getVirtualIndex","zIndex","pV","marginTop","map","key","virtualIndex","item"],"sources":["../../../../../../src/components/SelectCanary/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.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 {\n ListItem,\n ListLoader,\n mapVerticalSpace,\n} from '##/components/ListCanary';\nimport { PopoverPropOffset } from '##/components/Popover';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '##/components/SelectCanary/useSelect';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectItemAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { SelectPopover } from '../SelectPopover';\nimport { SelectRenderItem } from '../SelectRenderItem';\nimport { CountedGroup } from '../types';\n\nexport const selectDropdownForm = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownForm[number];\nexport const defaultSelectDropdownPropForm = selectDropdownForm[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 controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.Ref<HTMLDivElement>;\n getOptionActions(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\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 highlightIndex: (index: number) => void;\n onCreate: (e: React.SyntheticEvent) => 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 viewportRef?: React.RefObject<HTMLElement>;\n}>;\n\ntype SelectDropdownComponent = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\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 SelectDropdown: SelectDropdownComponent = memo((props) => {\n const {\n controlRef,\n size,\n getOptionActions,\n dropdownRef: dropdownRefProp,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItemsAtom,\n form,\n openAtom,\n offset: offsetProp = 'none',\n renderItem,\n visibleItemsAtom,\n isLoading,\n getGroupLabel,\n notFound,\n itemsRefs,\n virtualScroll,\n onScrollToBottom,\n highlightedIndexAtom,\n valueAtom,\n getItemKeyAtom,\n highlightIndex,\n onCreate,\n onChange,\n onChangeAll,\n inputValueAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n selectAllLabel,\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 && isListMount,\n onScrollToBottom,\n });\n\n const scrollContainerRef = useForkRef([scrollElementRef, dropdownRefProp]);\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 <SelectPopover\n {...otherProps}\n anchorRef={controlRef}\n offset={offset}\n role=\"listbox\"\n className={cnSelectDropdown()}\n size={size}\n controlRef={controlRef}\n openAtom={openAtom}\n form={form}\n onMount={setIsListMount}\n style={{ zIndex }}\n >\n {isListMount && (\n <div\n className={cnSelectDropdown('ScrollContainer', [\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixScrollBar({ size: 'xs' }),\n ])}\n ref={scrollContainerRef}\n >\n {isLoading && !isListShowed && <SelectLoader />}\n <div\n className={cnSelectDropdown('List')}\n key={cnSelectDropdown('List')}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <SelectCreateButton\n size={size}\n key={cnSelectDropdown('List', { key: 'CreateButton' })}\n labelForCreate={labelForCreate}\n indent={indent}\n ref={itemsRefs[index]}\n onClick={onCreate}\n highlightedIndexAtom={highlightedIndexAtom}\n inputValueAtom={inputValueAtom}\n highlightIndex={highlightIndex}\n index={index}\n />\n );\n }\n\n const virtualIndex =\n visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group-${group.key}-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 <SelectItemAll\n label={selectAllLabel}\n groupId={group.key}\n highlightedIndexAtom={highlightedIndexAtom}\n groupsCounterAtom={groupsCounterAtom}\n key={cnSelectDropdown('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 />\n );\n }\n } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <SelectRenderItem\n key={cnSelectDropdown('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\n size={size}\n label={labelForEmptyItems}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n )}\n </SelectPopover>\n );\n});\n"],"mappings":"onBAAA,6BAGA,OAASA,OAAT,KAAwB,mBAAxB,CACA,MAAOC,MAAP,EAAgBC,QAAhB,CAA0BC,IAA1B,CAAgCC,OAAhC,KAA+C,OAA/C,CAGA,OACEC,QADF,CAEEC,UAFF,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AWE,UAAU,CAAEqB,CAXd,CAYE,IAAI,CAAE8C,CAZR,EAaM1D,CAAgB,CAAC,CACnBT,KAAK,CAALA,CADmB,CAEnBmE,IAAI,CAAJA,CAFmB,CAAD,CAbtB,EAiBE,KAAK,CAAEnE,CAjBT,CAkBE,SAAS,CAAE8B,CAlBb,GAsBL,CACF,CAzDA,CAZH,CAwEH,CA/FA,CALH,CAqGGP,CAAS,EAAIwB,CAAb,EACC,oBAAC,UAAD,EAAY,IAAI,CAAEvC,CAAlB,CAAwB,WAAW,CAAEsC,CAArC,EAtGJ,CAVF,CAmHG,CAACvB,CAAD,EAAc,CAACmB,CAAf,EAA2B3B,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEP,CADR,CAEE,KAAK,CAAEO,CAFT,CAGE,WAAW,CAAE+B,CAHf,EAKG/B,CALH,CApHJ,CAdJ,CA8IH,CA/N0D,CAApD"}
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","status","size","disabled","value","renderValue","isLoading","dropdownRef","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRef","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","dropdownClassName","onFocus","onBlur","onCreate","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel"];import"./SelectMultiple.css";import{useAction}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{FieldArrayValueItem}from"../../FieldComponents";import{SelectDropdown}from"../SelectDropdown";import{SelectItem}from"../SelectItem";import{useForkRef}from"../../../hooks/useForkRef";import{cnCanary as cn}from"../../../utils/bem";import{useSendToAtom}from"../../../utils/state";import{withCtx}from"../../../utils/state/withCtx";import{withDefault}from"../defaultProps";import{SelectControlLayout}from"../SelectControlLayout";import{SelectMultipleValue}from"../SelectMultipleValue";import{useSelect}from"../useSelect";var cnSelectMultiple=cn("SelectMultiple"),SelectMultipleRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.status,g=c.size,h=c.disabled,i=c.value,j=c.renderValue,k=c.isLoading,l=c.dropdownRef,m=c.dropdownForm,n=c.renderItem,o=c.getGroupLabel,p=c.labelForCreate,q=c.labelForEmptyItems,r=c.virtualScroll,s=c.onScrollToBottom,t=c.style,u=c.className,v=c.placeholder,w=c.view,x=c.iconClear,y=c.input,z=c.inputValue,A=c.inputDefaultValue,B=c.inputRef,C=c.getGroupKey,D=c.getItemDisabled,E=c.getItemGroupKey,F=c.getItemKey,G=c.getItemLabel,H=c.items,I=c.onChange,J=c.dropdownClassName,K=c.onFocus,L=c.onBlur,M=c.onCreate,N=c.onInput,O=c.multiple,P=c.groups,Q=c.onDropdownOpen,R=c.ignoreOutsideClicksRefs,S=c.clearButton,T=c.selectAll,U=c.selectAllLabel,V=_objectWithoutProperties(c,_excluded),W=useSelect({propsAtom:d}),X=W.getOptionActions,Y=W.openAtom,Z=W.visibleItemsAtom,$=W.focusAtom,_=W.handleInputFocus,aa=W.handleInputBlur,ba=W.handleToggleDropdown,ca=W.inputRef,da=W.handleInputClick,ea=W.handleInputChange,fa=W.clearValue,ga=W.optionsRefs,ha=W.controlRef,ia=W.dropdownRef,ja=W.clearButtonAtom,ka=W.highlightedIndexAtom,la=W.getItemKeyAtom,ma=W.valueAtom,na=W.onChangeAll,oa=W.highlightIndex,pa=W.onCreate,qa=W.onChange,ra=W.inputValueAtom,sa=W.getHandleRemoveValue,ta=W.hasItemsAtom,ua=W.groupsCounterAtom,va=W.dropdownZIndexAtom,wa=useRef(null),xa=useAction(function(a,b){var c=b.item,d=b.active,e=b.hovered,f=b.onClick,h=b.onMouseEnter,i=b.ref;return React.createElement(SelectItem,{label:G(c),active:d,hovered:e,size:g,indent:"round"===m?"increased":"normal",onClick:f,onMouseEnter:h,disabled:D(c),ref:i,multiple:!0})},[D,g,G,m]),ya=useAction(function(a,b){return(j||function renderValueDefault(a){var b=a.value,c=a.getRemove;return b.map(function(a){var b=h||D(a);return React.createElement(FieldArrayValueItem,{key:F(a),size:g,label:G(a),disabled:b,onRemove:b?void 0:c(a)})})})({value:b,getRemove:sa})},[h,D,F,g,G,j]);return React.createElement(React.Fragment,null,React.createElement(SelectControlLayout,Object.assign({},V,{style:t,className:cnSelectMultiple(null,[u]),form:e,status:f,size:g,disabled:h,separator:!0,onClear:fa,onDropdownButton:ba,openAtom:Y,focusAtom:$,view:w,iconClear:x,clearButtonAtom:ja,ref:useForkRef([b,ha])}),React.createElement(SelectMultipleValue,{propsAtom:d,onFocus:_,onBlur:aa,onClick:da,onChange:ea,renderValue:ya,inputRef:useForkRef([ca,B]),ref:wa})),React.createElement(SelectDropdown,{valueAtom:ma,getItemKeyAtom:la,openAtom:Y,size:g,controlRef:ha,getOptionActions:X,dropdownRef:useForkRef([ia,l]),form:m,className:J,renderItem:n||xa,getGroupLabel:o,visibleItemsAtom:Z,labelForCreate:p,isLoading:k,labelForEmptyItems:q,itemsRefs:ga,virtualScroll:r,onScrollToBottom:s,highlightedIndexAtom:ka,highlightIndex:oa,onChangeAll:na,onCreate:pa,onChange:qa,inputValueAtom:ra,hasItemsAtom:ta,groupsCounterAtom:ua,dropdownZIndexAtom:va,selectAllLabel:U}))};export var SelectMultiple=withCtx(forwardRef(SelectMultipleRender));
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","status","size","disabled","value","renderValue","isLoading","dropdownRef","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRef","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","dropdownClassName","onFocus","onBlur","onCreate","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","dropdownViewportRef"];import"./SelectMultiple.css";import{useAction}from"@reatom/npm-react";import React,{forwardRef,useRef}from"react";import{FieldArrayValueItem}from"../../FieldComponents";import{SelectDropdown}from"../SelectDropdown";import{SelectItem}from"../SelectItem";import{useForkRef}from"../../../hooks/useForkRef";import{cnCanary as cn}from"../../../utils/bem";import{useSendToAtom}from"../../../utils/state";import{withCtx}from"../../../utils/state/withCtx";import{withDefault}from"../defaultProps";import{SelectControlLayout}from"../SelectControlLayout";import{SelectMultipleValue}from"../SelectMultipleValue";import{useSelect}from"../useSelect";var cnSelectMultiple=cn("SelectMultiple"),SelectMultipleRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.status,g=c.size,h=c.disabled,i=c.value,j=c.renderValue,k=c.isLoading,l=c.dropdownRef,m=c.dropdownForm,n=c.renderItem,o=c.getGroupLabel,p=c.labelForCreate,q=c.labelForEmptyItems,r=c.virtualScroll,s=c.onScrollToBottom,t=c.style,u=c.className,v=c.placeholder,w=c.view,x=c.iconClear,y=c.input,z=c.inputValue,A=c.inputDefaultValue,B=c.inputRef,C=c.getGroupKey,D=c.getItemDisabled,E=c.getItemGroupKey,F=c.getItemKey,G=c.getItemLabel,H=c.items,I=c.onChange,J=c.dropdownClassName,K=c.onFocus,L=c.onBlur,M=c.onCreate,N=c.onInput,O=c.multiple,P=c.groups,Q=c.onDropdownOpen,R=c.ignoreOutsideClicksRefs,S=c.clearButton,T=c.selectAll,U=c.selectAllLabel,V=c.dropdownViewportRef,W=_objectWithoutProperties(c,_excluded),X=useSelect({propsAtom:d}),Y=X.getOptionActions,Z=X.openAtom,$=X.visibleItemsAtom,_=X.focusAtom,aa=X.handleInputFocus,ba=X.handleInputBlur,ca=X.handleToggleDropdown,da=X.inputRef,ea=X.handleInputClick,fa=X.handleInputChange,ga=X.clearValue,ha=X.optionsRefs,ia=X.controlRef,ja=X.dropdownRef,ka=X.clearButtonAtom,la=X.highlightedIndexAtom,ma=X.getItemKeyAtom,na=X.valueAtom,oa=X.onChangeAll,pa=X.highlightIndex,qa=X.onCreate,ra=X.onChange,sa=X.inputValueAtom,ta=X.getHandleRemoveValue,ua=X.hasItemsAtom,va=X.groupsCounterAtom,wa=X.dropdownZIndexAtom,xa=useRef(null),ya=useAction(function(a,b){var c=b.item,d=b.active,e=b.hovered,f=b.onClick,h=b.onMouseEnter,i=b.ref;return React.createElement(SelectItem,{label:G(c),active:d,hovered:e,size:g,indent:"round"===m?"increased":"normal",onClick:f,onMouseEnter:h,disabled:D(c),ref:i,multiple:!0})},[D,g,G,m]),za=useAction(function(a,b){return(j||function renderValueDefault(a){var b=a.value,c=a.getRemove;return b.map(function(a){var b=h||D(a);return React.createElement(FieldArrayValueItem,{key:F(a),size:g,label:G(a),disabled:b,onRemove:b?void 0:c(a)})})})({value:b,getRemove:ta})},[h,D,F,g,G,j]);return React.createElement(React.Fragment,null,React.createElement(SelectControlLayout,Object.assign({},W,{style:t,className:cnSelectMultiple(null,[u]),form:e,status:f,size:g,disabled:h,separator:!0,onClear:ga,onDropdownButton:ca,openAtom:Z,focusAtom:_,view:w,iconClear:x,clearButtonAtom:ka,ref:useForkRef([b,ia])}),React.createElement(SelectMultipleValue,{propsAtom:d,onFocus:aa,onBlur:ba,onClick:ea,onChange:fa,renderValue:za,inputRef:useForkRef([da,B]),ref:xa})),React.createElement(SelectDropdown,{valueAtom:na,getItemKeyAtom:ma,openAtom:Z,size:g,controlRef:ia,getOptionActions:Y,dropdownRef:useForkRef([ja,l]),form:m,className:J,renderItem:n||ya,getGroupLabel:o,visibleItemsAtom:$,labelForCreate:p,isLoading:k,labelForEmptyItems:q,itemsRefs:ha,virtualScroll:r,onScrollToBottom:s,highlightedIndexAtom:la,highlightIndex:pa,onChangeAll:oa,onCreate:qa,onChange:ra,inputValueAtom:sa,hasItemsAtom:ua,groupsCounterAtom:va,dropdownZIndexAtom:wa,selectAllLabel:U,viewportRef:V}))};export var SelectMultiple=withCtx(forwardRef(SelectMultipleRender));
2
2
  //# sourceMappingURL=SelectMultiple.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectMultiple.js","names":["useAction","React","forwardRef","useRef","FieldArrayValueItem","SelectDropdown","SelectItem","useForkRef","cnCanary","cn","useSendToAtom","withCtx","withDefault","SelectControlLayout","SelectMultipleValue","useSelect","cnSelectMultiple","SelectMultipleRender","props","ref","propsWithDefault","propsAtom","form","status","size","disabled","value","renderValue","isLoading","dropdownRefProp","dropdownRef","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRefProp","inputRef","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","onChange","dropdownClassName","onFocus","onBlur","onCreateProp","onCreate","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","otherProps","getOptionActions","openAtom","visibleItemsAtom","focusAtom","handleInputFocus","handleInputBlur","handleToggleDropdown","handleInputClick","handleInputChange","clearValue","optionsRefs","controlRef","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","highlightIndex","inputValueAtom","getHandleRemoveValue","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","valueContainerRef","renderItemDefault","ctx","item","active","hovered","onClick","onMouseEnter","inlineControlRender","renderValueDefault","getRemove","map","itemDisabled","SelectMultiple"],"sources":["../../../../../../src/components/SelectCanary/SelectMultiple/SelectMultiple.tsx"],"sourcesContent":["import './SelectMultiple.css';\n\nimport { useAction } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { FieldArrayValueItem } from '##/components/FieldComponents';\nimport { SelectDropdown } from '##/components/SelectCanary/SelectDropdown';\nimport { SelectItem } from '##/components/SelectCanary/SelectItem';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { useSendToAtom } from '##/utils/state';\nimport { withCtx } from '##/utils/state/withCtx';\n\nimport {\n RenderItemProps,\n SelectComponent,\n SelectGroupDefault,\n SelectItemDefault,\n SelectPropRenderItem,\n SelectProps,\n} from '..';\nimport { withDefault } from '../defaultProps';\nimport { SelectControlLayout } from '../SelectControlLayout';\nimport { SelectMultipleValue } from '../SelectMultipleValue';\nimport { useSelect } from '../useSelect';\n\nconst cnSelectMultiple = cn('SelectMultiple');\n\nconst SelectMultipleRender = <\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n>(\n props: SelectProps<ITEM, GROUP, true>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const propsWithDefault = withDefault(props);\n\n const propsAtom = useSendToAtom(propsWithDefault);\n\n const {\n form,\n status,\n size,\n disabled,\n value,\n renderValue,\n isLoading,\n dropdownRef: dropdownRefProp,\n dropdownForm,\n renderItem,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n view,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n inputRef: inputRefProp,\n\n // исключаем из otherProps\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n onChange: onChangeProp,\n dropdownClassName,\n onFocus,\n onBlur,\n onCreate: onCreateProp,\n onInput,\n multiple,\n groups,\n onDropdownOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n ...otherProps\n } = propsWithDefault;\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n focusAtom,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n clearValue,\n optionsRefs,\n controlRef,\n dropdownRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n highlightIndex,\n onCreate,\n onChange,\n inputValueAtom,\n getHandleRemoveValue,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n } = useSelect<ITEM, GROUP, true>({\n propsAtom,\n });\n\n const valueContainerRef = useRef<HTMLDivElement>(null);\n\n const renderItemDefault: SelectPropRenderItem<ITEM> = useAction(\n (\n ctx,\n {\n item,\n active,\n hovered,\n onClick,\n onMouseEnter,\n ref,\n }: RenderItemProps<ITEM>,\n ) => {\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n multiple\n />\n );\n },\n [getItemDisabled, size, getItemLabel, dropdownForm],\n );\n\n const inlineControlRender = useAction(\n (ctx, value: ITEM[]) => {\n const renderValueDefault = ({\n value,\n getRemove,\n }: {\n value: ITEM[];\n getRemove: (\n item: ITEM,\n ) => (e: React.SyntheticEvent<Element, Event>) => void;\n }) => {\n return value.map((item) => {\n const itemDisabled = disabled || getItemDisabled(item);\n return (\n <FieldArrayValueItem\n key={getItemKey(item)}\n size={size}\n label={getItemLabel(item)}\n disabled={itemDisabled}\n onRemove={itemDisabled ? undefined : getRemove(item)}\n />\n );\n });\n };\n\n return (renderValue || renderValueDefault)({\n value,\n getRemove: getHandleRemoveValue,\n });\n },\n [disabled, getItemDisabled, getItemKey, size, getItemLabel, renderValue],\n );\n\n return (\n <>\n <SelectControlLayout\n {...otherProps}\n style={style}\n className={cnSelectMultiple(null, [className])}\n form={form}\n status={status}\n size={size}\n disabled={disabled}\n separator\n onClear={clearValue}\n onDropdownButton={handleToggleDropdown}\n openAtom={openAtom}\n focusAtom={focusAtom}\n view={view}\n iconClear={iconClear}\n clearButtonAtom={clearButtonAtom}\n ref={useForkRef([ref, controlRef])}\n >\n <SelectMultipleValue\n propsAtom={propsAtom}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onClick={handleInputClick}\n onChange={handleInputChange}\n renderValue={inlineControlRender}\n inputRef={useForkRef([inputRef, inputRefProp])}\n ref={valueContainerRef}\n />\n </SelectControlLayout>\n <SelectDropdown\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n size={size}\n controlRef={controlRef}\n getOptionActions={getOptionActions}\n dropdownRef={useForkRef([dropdownRef, dropdownRefProp])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n highlightIndex={highlightIndex}\n onChangeAll={onChangeAll}\n onCreate={onCreate}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n />\n </>\n );\n};\n\nexport const SelectMultiple = withCtx(\n forwardRef(SelectMultipleRender),\n) as SelectComponent;\n"],"mappings":"4pBAAA,6BAEA,OAASA,SAAT,KAA0B,mBAA1B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,mBAAT,6BACA,OAASC,cAAT,yBACA,OAASC,UAAT,qBACA,OAASC,UAAT,iCACA,OAASC,QAAQ,GAAIC,GAArB,0BACA,OAASC,aAAT,4BACA,OAASC,OAAT,oCAUA,OAASC,WAAT,uBACA,OAASC,mBAAT,8BACA,OAASC,mBAAT,8BACA,OAASC,SAAT,oB,GAEMC,iBAAgB,CAAGP,EAAE,CAAC,gBAAD,C,CAErBQ,oBAAoB,CAAG,SAI3BC,CAJ2B,CAK3BC,CAL2B,CAMxB,IACGC,EAAgB,CAAGR,WAAW,CAACM,CAAD,CADjC,CAGGG,CAAS,CAAGX,aAAa,CAACU,CAAD,CAH5B,CAMDE,CANC,CAoDCF,CApDD,CAMDE,IAN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version":3,"file":"SelectMultiple.js","names":["useAction","React","forwardRef","useRef","FieldArrayValueItem","SelectDropdown","SelectItem","useForkRef","cnCanary","cn","useSendToAtom","withCtx","withDefault","SelectControlLayout","SelectMultipleValue","useSelect","cnSelectMultiple","SelectMultipleRender","props","ref","propsWithDefault","propsAtom","form","status","size","disabled","value","renderValue","isLoading","dropdownRefProp","dropdownRef","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRefProp","inputRef","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","onChange","dropdownClassName","onFocus","onBlur","onCreateProp","onCreate","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","dropdownViewportRef","otherProps","getOptionActions","openAtom","visibleItemsAtom","focusAtom","handleInputFocus","handleInputBlur","handleToggleDropdown","handleInputClick","handleInputChange","clearValue","optionsRefs","controlRef","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","highlightIndex","inputValueAtom","getHandleRemoveValue","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","valueContainerRef","renderItemDefault","ctx","item","active","hovered","onClick","onMouseEnter","inlineControlRender","renderValueDefault","getRemove","map","itemDisabled","SelectMultiple"],"sources":["../../../../../../src/components/SelectCanary/SelectMultiple/SelectMultiple.tsx"],"sourcesContent":["import './SelectMultiple.css';\n\nimport { useAction } from '@reatom/npm-react';\nimport React, { forwardRef, useRef } from 'react';\n\nimport { FieldArrayValueItem } from '##/components/FieldComponents';\nimport { SelectDropdown } from '##/components/SelectCanary/SelectDropdown';\nimport { SelectItem } from '##/components/SelectCanary/SelectItem';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { useSendToAtom } from '##/utils/state';\nimport { withCtx } from '##/utils/state/withCtx';\n\nimport {\n RenderItemProps,\n SelectComponent,\n SelectGroupDefault,\n SelectItemDefault,\n SelectPropRenderItem,\n SelectProps,\n} from '..';\nimport { withDefault } from '../defaultProps';\nimport { SelectControlLayout } from '../SelectControlLayout';\nimport { SelectMultipleValue } from '../SelectMultipleValue';\nimport { useSelect } from '../useSelect';\n\nconst cnSelectMultiple = cn('SelectMultiple');\n\nconst SelectMultipleRender = <\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n>(\n props: SelectProps<ITEM, GROUP, true>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const propsWithDefault = withDefault(props);\n\n const propsAtom = useSendToAtom(propsWithDefault);\n\n const {\n form,\n status,\n size,\n disabled,\n value,\n renderValue,\n isLoading,\n dropdownRef: dropdownRefProp,\n dropdownForm,\n renderItem,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n view,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n inputRef: inputRefProp,\n\n // исключаем из otherProps\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n onChange: onChangeProp,\n dropdownClassName,\n onFocus,\n onBlur,\n onCreate: onCreateProp,\n onInput,\n multiple,\n groups,\n onDropdownOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n dropdownViewportRef,\n ...otherProps\n } = propsWithDefault;\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n focusAtom,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n clearValue,\n optionsRefs,\n controlRef,\n dropdownRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n highlightIndex,\n onCreate,\n onChange,\n inputValueAtom,\n getHandleRemoveValue,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n } = useSelect<ITEM, GROUP, true>({\n propsAtom,\n });\n\n const valueContainerRef = useRef<HTMLDivElement>(null);\n\n const renderItemDefault: SelectPropRenderItem<ITEM> = useAction(\n (\n ctx,\n {\n item,\n active,\n hovered,\n onClick,\n onMouseEnter,\n ref,\n }: RenderItemProps<ITEM>,\n ) => {\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n multiple\n />\n );\n },\n [getItemDisabled, size, getItemLabel, dropdownForm],\n );\n\n const inlineControlRender = useAction(\n (ctx, value: ITEM[]) => {\n const renderValueDefault = ({\n value,\n getRemove,\n }: {\n value: ITEM[];\n getRemove: (\n item: ITEM,\n ) => (e: React.SyntheticEvent<Element, Event>) => void;\n }) => {\n return value.map((item) => {\n const itemDisabled = disabled || getItemDisabled(item);\n return (\n <FieldArrayValueItem\n key={getItemKey(item)}\n size={size}\n label={getItemLabel(item)}\n disabled={itemDisabled}\n onRemove={itemDisabled ? undefined : getRemove(item)}\n />\n );\n });\n };\n\n return (renderValue || renderValueDefault)({\n value,\n getRemove: getHandleRemoveValue,\n });\n },\n [disabled, getItemDisabled, getItemKey, size, getItemLabel, renderValue],\n );\n\n return (\n <>\n <SelectControlLayout\n {...otherProps}\n style={style}\n className={cnSelectMultiple(null, [className])}\n form={form}\n status={status}\n size={size}\n disabled={disabled}\n separator\n onClear={clearValue}\n onDropdownButton={handleToggleDropdown}\n openAtom={openAtom}\n focusAtom={focusAtom}\n view={view}\n iconClear={iconClear}\n clearButtonAtom={clearButtonAtom}\n ref={useForkRef([ref, controlRef])}\n >\n <SelectMultipleValue\n propsAtom={propsAtom}\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n onClick={handleInputClick}\n onChange={handleInputChange}\n renderValue={inlineControlRender}\n inputRef={useForkRef([inputRef, inputRefProp])}\n ref={valueContainerRef}\n />\n </SelectControlLayout>\n <SelectDropdown\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n size={size}\n controlRef={controlRef}\n getOptionActions={getOptionActions}\n dropdownRef={useForkRef([dropdownRef, dropdownRefProp])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n highlightIndex={highlightIndex}\n onChangeAll={onChangeAll}\n onCreate={onCreate}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n viewportRef={dropdownViewportRef}\n />\n </>\n );\n};\n\nexport const SelectMultiple = withCtx(\n forwardRef(SelectMultipleRender),\n) as SelectComponent;\n"],"mappings":"krBAAA,6BAEA,OAASA,SAAT,KAA0B,mBAA1B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,CAA4BC,MAA5B,KAA0C,OAA1C,CAEA,OAASC,mBAAT,6BACA,OAASC,cAAT,yBACA,OAASC,UAAT,qBACA,OAASC,UAAT,iCACA,OAASC,QAAQ,GAAIC,GAArB,0BACA,OAASC,aAAT,4BACA,OAASC,OAAT,oCAUA,OAASC,WAAT,uBACA,OAASC,mBAAT,8BACA,OAASC,mBAAT,8BACA,OAASC,SAAT,oB,GAEMC,iBAAgB,CAAGP,EAAE,CAAC,gBAAD,C,CAErBQ,oBAAoB,CAAG,SAI3BC,CAJ2B,CAK3BC,CAL2B,CAMxB,IACGC,EAAgB,CAAGR,WAAW,CAACM,CAAD,CADjC,CAGGG,CAAS,CAAGX,aAAa,CAACU,CAAD,CAH5B,CAMDE,CANC,CA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DH,C,CAED,MAAO,IAAMsC,eAAc,CAAGhG,OAAO,CACnCT,UAAU,CAACe,oBAAD,CADyB,CAA9B"}
@@ -15,6 +15,7 @@ type Props = PropsWithJsxAttributes<{
15
15
  anchorRef: React.RefObject<HTMLElement> | undefined;
16
16
  children: React.ReactNode;
17
17
  onMount: (isMount: boolean) => void;
18
+ viewportRef?: React.RefObject<HTMLElement>;
18
19
  }>;
19
20
  export declare const SelectPopover: (props: Props) => JSX.Element;
20
21
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"SelectPopover.js","names":["classnames","reatomComponent","React","useCallback","useRef","Transition","cnListBox","Popover","animateTimeout","cnMixPopoverAnimate","SelectPopoverForm","defaultSelectPopoverPropForm","SelectPopover","props","ctx","size","className","openAtom","offset","offsetProp","controlRef","form","anchorRef","children","onMount","otherProps","popoverRef","spy","animate","border","shadow"],"sources":["../../../../../../src/components/SelectCanary/SelectPopover/SelectPopover.tsx"],"sourcesContent":["import { classnames } from '@bem-react/classnames';\nimport { AtomMut } from '@reatom/framework';\nimport { reatomComponent } from '@reatom/npm-react';\nimport React, { useCallback, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { cnListBox } from '##/components/ListCanary';\nimport { Popover, PopoverPropOffset } from '##/components/Popover';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '##/mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nexport const SelectPopoverForm = ['default', 'brick', 'round'] as const;\nexport type SelectPopoverPropForm = typeof SelectPopoverForm[number];\nexport const defaultSelectPopoverPropForm = SelectPopoverForm[0];\n\ntype Props = PropsWithJsxAttributes<{\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n form: SelectPopoverPropForm;\n openAtom: AtomMut<boolean>;\n size: FieldPropSize;\n offset?: PopoverPropOffset | 'none';\n anchorRef: React.RefObject<HTMLElement> | undefined;\n children: React.ReactNode;\n onMount: (isMount: boolean) => void;\n}>;\n\nexport const SelectPopover = reatomComponent<Props>((props) => {\n const {\n ctx,\n size,\n className,\n openAtom,\n offset: offsetProp = 'none',\n controlRef,\n form,\n anchorRef,\n children,\n onMount,\n ...otherProps\n } = props;\n\n const offset = offsetProp === 'none' ? undefined : offsetProp;\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n return (\n <Transition\n in={ctx.spy(openAtom)}\n nodeRef={popoverRef}\n timeout={animateTimeout}\n unmountOnExit\n onEntering={useCallback(() => onMount(true), [])}\n onExited={useCallback(() => onMount(false), [])}\n >\n {(animate) => {\n return (\n <Popover\n {...otherProps}\n anchorRef={anchorRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset={offset}\n ref={popoverRef}\n role=\"listbox\"\n className={classnames(\n className,\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n )}\n equalAnchorWidth\n >\n {children}\n </Popover>\n );\n }}\n </Transition>\n );\n});\n"],"mappings":"uMAAA,OAASA,UAAT,KAA2B,uBAA3B,CAEA,OAASC,eAAT,KAAgC,mBAAhC,CACA,MAAOC,MAAP,EAAgBC,WAAhB,CAA6BC,MAA7B,KAA2C,OAA3C,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAGA,OAASC,SAAT,wBACA,OAASC,OAAT,qBACA,OACEC,cADF,CAEEC,mBAFF,yDAMA,MAAO,IAAMC,kBAAiB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAA1B,CAEP,MAAO,IAAMC,6BAA4B,CAAGD,iBAAiB,CAAC,CAAD,CAAtD,CAaP,MAAO,IAAME,cAAa,CAAGX,eAAe,CAAQ,SAACY,CAAD,CAAW,IAE3DC,EAF2D,CAazDD,CAbyD,CAE3DC,GAF2D,CAG3DC,CAH2D,CAazDF,CAbyD,CAG3DE,IAH2D,CAI3DC,C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AAM,GAAlC,CAAD,CAFU,CAGnBrB,mBAAmB,CAAC,CAAEmB,OAAO,CAAPA,CAAF,CAAD,CAHA,CAbvB,CAkBE,gBAAgB,GAlBlB,GAoBGL,CApBH,CAuBH,CAjCH,CAoCH,CAxD2C,CAArC"}
1
+ {"version":3,"file":"SelectPopover.js","names":["classnames","reatomComponent","React","useCallback","useRef","Transition","cnListBox","Popover","animateTimeout","cnMixPopoverAnimate","SelectPopoverForm","defaultSelectPopoverPropForm","SelectPopover","props","ctx","size","className","openAtom","offset","offsetProp","controlRef","form","anchorRef","children","onMount","otherProps","popoverRef","spy","animate","border","shadow"],"sources":["../../../../../../src/components/SelectCanary/SelectPopover/SelectPopover.tsx"],"sourcesContent":["import { classnames } from '@bem-react/classnames';\nimport { AtomMut } from '@reatom/framework';\nimport { reatomComponent } from '@reatom/npm-react';\nimport React, { useCallback, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport { FieldPropSize } from '##/components/FieldComponents';\nimport { cnListBox } from '##/components/ListCanary';\nimport { Popover, PopoverPropOffset } from '##/components/Popover';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '##/mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nexport const SelectPopoverForm = ['default', 'brick', 'round'] as const;\nexport type SelectPopoverPropForm = typeof SelectPopoverForm[number];\nexport const defaultSelectPopoverPropForm = SelectPopoverForm[0];\n\ntype Props = PropsWithJsxAttributes<{\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n form: SelectPopoverPropForm;\n openAtom: AtomMut<boolean>;\n size: FieldPropSize;\n offset?: PopoverPropOffset | 'none';\n anchorRef: React.RefObject<HTMLElement> | undefined;\n children: React.ReactNode;\n onMount: (isMount: boolean) => void;\n viewportRef?: React.RefObject<HTMLElement>;\n}>;\n\nexport const SelectPopover = reatomComponent<Props>((props) => {\n const {\n ctx,\n size,\n className,\n openAtom,\n offset: offsetProp = 'none',\n controlRef,\n form,\n anchorRef,\n children,\n onMount,\n ...otherProps\n } = props;\n\n const offset = offsetProp === 'none' ? undefined : offsetProp;\n\n const popoverRef = useRef<HTMLDivElement>(null);\n\n return (\n <Transition\n in={ctx.spy(openAtom)}\n nodeRef={popoverRef}\n timeout={animateTimeout}\n unmountOnExit\n onEntering={useCallback(() => onMount(true), [])}\n onExited={useCallback(() => onMount(false), [])}\n >\n {(animate) => {\n return (\n <Popover\n {...otherProps}\n anchorRef={anchorRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset={offset}\n ref={popoverRef}\n role=\"listbox\"\n className={classnames(\n className,\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n )}\n equalAnchorWidth\n >\n {children}\n </Popover>\n );\n }}\n </Transition>\n );\n});\n"],"mappings":"uMAAA,OAASA,UAAT,KAA2B,uBAA3B,CAEA,OAASC,eAAT,KAAgC,mBAAhC,CACA,MAAOC,MAAP,EAAgBC,WAAhB,CAA6BC,MAA7B,KAA2C,OAA3C,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAGA,OAASC,SAAT,wBACA,OAASC,OAAT,qBACA,OACEC,cADF,CAEEC,mBAFF,yDAMA,MAAO,IAAMC,kBAAiB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAA1B,CAEP,MAAO,IAAMC,6BAA4B,CAAGD,iBAAiB,CAAC,CAAD,CAAtD,CAcP,MAAO,IAAME,cAAa,CAAGX,eAAe,CAAQ,SAACY,CAAD,CAAW,IAE3DC,EAF2D,CAazDD,CAbyD,CAE3DC,GAF2D,CAG3DC,CAH2D,CAazDF,CAbyD,CAG3DE,IAH2D,CAI3DC,CAJ2D,CAazDH,CAbyD,CAI3DG,SAJ2D,CAK3DC,CAL2D,CAazDJ,CAbyD,CAK3DI,QAL2D,GAazDJ,CAbyD,CAM3DK,MAN2D,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B,GAoBGL,CApBH,CAuBH,CAjCH,CAoCH,CAxD2C,CAArC"}
@@ -1,2 +1,2 @@
1
- import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","status","size","disabled","value","renderValue","isLoading","dropdownRef","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRef","aria-label","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","dropdownClassName","onFocus","onBlur","onCreate","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel"];import{useAction}from"@reatom/npm-react";import React,{forwardRef}from"react";import{SelectDropdown}from"../SelectDropdown";import{SelectItem}from"../SelectItem";import{useForkRef}from"../../../hooks/useForkRef";import{cnCanary as cn}from"../../../utils/bem";import{useSendToAtom}from"../../../utils/state";import{withCtx}from"../../../utils/state/withCtx";import{withDefault}from"../defaultProps";import{SelectControlLayout}from"../SelectControlLayout";import{SelectInput}from"../SelectInput";import{useSelect}from"../useSelect";var cnSelectSingle=cn("SelectSelectSingleMultiple"),SelectSingleRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.status,g=c.size,h=c.disabled,i=c.value,j=c.renderValue,k=c.isLoading,l=c.dropdownRef,m=c.dropdownForm,n=c.renderItem,o=c.getGroupLabel,p=c.labelForCreate,q=c.labelForEmptyItems,r=c.virtualScroll,s=c.onScrollToBottom,t=c.style,u=c.className,v=c.placeholder,w=c.view,x=c.iconClear,y=c.input,z=c.inputValue,A=c.inputDefaultValue,B=c.inputRef,C=c["aria-label"],D=c.getGroupKey,E=c.getItemDisabled,F=c.getItemGroupKey,G=c.getItemKey,H=c.getItemLabel,I=c.items,J=c.onChange,K=c.dropdownClassName,L=c.onFocus,M=c.onBlur,N=c.onCreate,O=c.onInput,P=c.multiple,Q=c.groups,R=c.onDropdownOpen,S=c.ignoreOutsideClicksRefs,T=c.clearButton,U=c.selectAll,V=c.selectAllLabel,W=_objectWithoutProperties(c,_excluded),X=useAction(function(a,b){var c=b.value;return a.get(d).getItemLabel(c)},[]),Y=useAction(function(a,b){var c=b.item,e=b.active,f=b.hovered,g=b.onClick,h=b.onMouseEnter,i=b.ref,j=a.get(d),k=j.getItemLabel,l=j.size,m=j.dropdownForm,n=j.getItemDisabled;return React.createElement(SelectItem,{label:k(c),active:e,hovered:f,size:l,indent:"round"===m?"increased":"normal",onClick:g,onMouseEnter:h,disabled:n(c),ref:i})},[]),Z=useSelect({propsAtom:d}),$=Z.getOptionActions,_=Z.openAtom,aa=Z.visibleItemsAtom,ba=Z.focusAtom,ca=Z.handleInputFocus,da=Z.handleInputBlur,ea=Z.handleToggleDropdown,fa=Z.inputRef,ga=Z.handleInputClick,ha=Z.handleInputChange,ia=Z.clearValue,ja=Z.optionsRefs,ka=Z.controlRef,la=Z.dropdownRef,ma=Z.clearButtonAtom,na=Z.highlightedIndexAtom,oa=Z.getItemKeyAtom,pa=Z.valueAtom,qa=Z.onChangeAll,ra=Z.highlightIndex,sa=Z.onCreate,ta=Z.onChange,ua=Z.inputValueAtom,va=Z.hasItemsAtom,wa=Z.groupsCounterAtom,xa=Z.dropdownZIndexAtom;return React.createElement(React.Fragment,null,React.createElement(SelectControlLayout,Object.assign({},W,{style:t,className:cnSelectSingle(null,[u]),form:e,status:f,size:g,disabled:h,separator:!0,onClear:ia,onDropdownButton:ea,openAtom:_,focusAtom:ba,view:w,iconClear:x,clearButtonAtom:ma,ref:useForkRef([b,ka])}),React.createElement(SelectInput,{onFocus:ca,onBlur:da,ref:useForkRef([fa,B]),onClick:ga,onChange:y?ha:void 0,value:y?z:void 0,defaultValue:y?A:void 0,readOnly:!y||void 0,disabled:h,placeholder:v,"aria-label":C},i&&(j||X)({value:i}))),React.createElement(SelectDropdown,{valueAtom:pa,getItemKeyAtom:oa,openAtom:_,size:g,controlRef:ka,getOptionActions:$,dropdownRef:useForkRef([la,l]),form:m,className:K,renderItem:n||Y,getGroupLabel:o,visibleItemsAtom:aa,labelForCreate:p,isLoading:k,labelForEmptyItems:q,itemsRefs:ja,virtualScroll:r,onScrollToBottom:s,highlightedIndexAtom:na,highlightIndex:ra,onChangeAll:qa,onCreate:sa,onChange:ta,inputValueAtom:ua,hasItemsAtom:va,groupsCounterAtom:wa,dropdownZIndexAtom:xa,selectAllLabel:V}))};export var SelectSingle=withCtx(forwardRef(SelectSingleRender));
1
+ import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["form","status","size","disabled","value","renderValue","isLoading","dropdownRef","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRef","aria-label","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChange","dropdownClassName","onFocus","onBlur","onCreate","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","dropdownViewportRef"];import{useAction}from"@reatom/npm-react";import React,{forwardRef}from"react";import{SelectDropdown}from"../SelectDropdown";import{SelectItem}from"../SelectItem";import{useForkRef}from"../../../hooks/useForkRef";import{cnCanary as cn}from"../../../utils/bem";import{useSendToAtom}from"../../../utils/state";import{withCtx}from"../../../utils/state/withCtx";import{withDefault}from"../defaultProps";import{SelectControlLayout}from"../SelectControlLayout";import{SelectInput}from"../SelectInput";import{useSelect}from"../useSelect";var cnSelectSingle=cn("SelectSelectSingleMultiple"),SelectSingleRender=function(a,b){var c=withDefault(a),d=useSendToAtom(c),e=c.form,f=c.status,g=c.size,h=c.disabled,i=c.value,j=c.renderValue,k=c.isLoading,l=c.dropdownRef,m=c.dropdownForm,n=c.renderItem,o=c.getGroupLabel,p=c.labelForCreate,q=c.labelForEmptyItems,r=c.virtualScroll,s=c.onScrollToBottom,t=c.style,u=c.className,v=c.placeholder,w=c.view,x=c.iconClear,y=c.input,z=c.inputValue,A=c.inputDefaultValue,B=c.inputRef,C=c["aria-label"],D=c.getGroupKey,E=c.getItemDisabled,F=c.getItemGroupKey,G=c.getItemKey,H=c.getItemLabel,I=c.items,J=c.onChange,K=c.dropdownClassName,L=c.onFocus,M=c.onBlur,N=c.onCreate,O=c.onInput,P=c.multiple,Q=c.groups,R=c.onDropdownOpen,S=c.ignoreOutsideClicksRefs,T=c.clearButton,U=c.selectAll,V=c.selectAllLabel,W=c.dropdownViewportRef,X=_objectWithoutProperties(c,_excluded),Y=useAction(function(a,b){var c=b.value;return a.get(d).getItemLabel(c)},[]),Z=useAction(function(a,b){var c=b.item,e=b.active,f=b.hovered,g=b.onClick,h=b.onMouseEnter,i=b.ref,j=a.get(d),k=j.getItemLabel,l=j.size,m=j.dropdownForm,n=j.getItemDisabled;return React.createElement(SelectItem,{label:k(c),active:e,hovered:f,size:l,indent:"round"===m?"increased":"normal",onClick:g,onMouseEnter:h,disabled:n(c),ref:i})},[]),$=useSelect({propsAtom:d}),_=$.getOptionActions,aa=$.openAtom,ba=$.visibleItemsAtom,ca=$.focusAtom,da=$.handleInputFocus,ea=$.handleInputBlur,fa=$.handleToggleDropdown,ga=$.inputRef,ha=$.handleInputClick,ia=$.handleInputChange,ja=$.clearValue,ka=$.optionsRefs,la=$.controlRef,ma=$.dropdownRef,na=$.clearButtonAtom,oa=$.highlightedIndexAtom,pa=$.getItemKeyAtom,qa=$.valueAtom,ra=$.onChangeAll,sa=$.highlightIndex,ta=$.onCreate,ua=$.onChange,va=$.inputValueAtom,wa=$.hasItemsAtom,xa=$.groupsCounterAtom,ya=$.dropdownZIndexAtom;return React.createElement(React.Fragment,null,React.createElement(SelectControlLayout,Object.assign({},X,{style:t,className:cnSelectSingle(null,[u]),form:e,status:f,size:g,disabled:h,separator:!0,onClear:ja,onDropdownButton:fa,openAtom:aa,focusAtom:ca,view:w,iconClear:x,clearButtonAtom:na,ref:useForkRef([b,la])}),React.createElement(SelectInput,{onFocus:da,onBlur:ea,ref:useForkRef([ga,B]),onClick:ha,onChange:y?ia:void 0,value:y?z:void 0,defaultValue:y?A:void 0,readOnly:!y||void 0,disabled:h,placeholder:v,"aria-label":C},i&&(j||Y)({value:i}))),React.createElement(SelectDropdown,{valueAtom:qa,getItemKeyAtom:pa,openAtom:aa,size:g,controlRef:la,getOptionActions:_,dropdownRef:useForkRef([ma,l]),form:m,className:K,renderItem:n||Z,getGroupLabel:o,visibleItemsAtom:ba,labelForCreate:p,isLoading:k,labelForEmptyItems:q,itemsRefs:ka,virtualScroll:r,onScrollToBottom:s,highlightedIndexAtom:oa,highlightIndex:sa,onChangeAll:ra,onCreate:ta,onChange:ua,inputValueAtom:va,hasItemsAtom:wa,groupsCounterAtom:xa,dropdownZIndexAtom:ya,selectAllLabel:V,viewportRef:W}))};export var SelectSingle=withCtx(forwardRef(SelectSingleRender));
2
2
  //# sourceMappingURL=SelectSingle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectSingle.js","names":["useAction","React","forwardRef","SelectDropdown","SelectItem","useForkRef","cnCanary","cn","useSendToAtom","withCtx","withDefault","SelectControlLayout","SelectInput","useSelect","cnSelectSingle","SelectSingleRender","props","ref","propsWithDefault","propsAtom","form","status","size","disabled","value","renderValue","isLoading","dropdownRefProp","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRefProp","ariaLabel","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","dropdownClassName","onFocus","onBlur","onCreateProp","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","otherProps","renderValueDefault","ctx","get","renderItemDefault","item","active","hovered","onClick","onMouseEnter","getOptionActions","openAtom","visibleItemsAtom","focusAtom","handleInputFocus","handleInputBlur","handleToggleDropdown","inputRef","handleInputClick","handleInputChange","clearValue","optionsRefs","controlRef","dropdownRef","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","highlightIndex","onCreate","onChange","inputValueAtom","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","SelectSingle"],"sources":["../../../../../../src/components/SelectCanary/SelectSingle/SelectSingle.tsx"],"sourcesContent":["import { useAction } from '@reatom/npm-react';\nimport React, { forwardRef } from 'react';\n\nimport { SelectDropdown } from '##/components/SelectCanary/SelectDropdown';\nimport { SelectItem } from '##/components/SelectCanary/SelectItem';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { useSendToAtom } from '##/utils/state';\nimport { withCtx } from '##/utils/state/withCtx';\n\nimport {\n RenderItemProps,\n SelectComponent,\n SelectGroupDefault,\n SelectItemDefault,\n SelectPropRenderValue,\n SelectProps,\n} from '..';\nimport { withDefault } from '../defaultProps';\nimport { SelectControlLayout } from '../SelectControlLayout';\nimport { SelectInput } from '../SelectInput';\nimport { useSelect } from '../useSelect';\n\nconst cnSelectSingle = cn('SelectSelectSingleMultiple');\n\nconst SelectSingleRender = <\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n>(\n props: SelectProps<ITEM, GROUP, false>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const propsWithDefault = withDefault(props);\n\n const propsAtom = useSendToAtom(propsWithDefault);\n\n const {\n form,\n status,\n size,\n disabled,\n value,\n renderValue,\n isLoading,\n 'dropdownRef': dropdownRefProp,\n dropdownForm,\n renderItem,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n view,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n 'inputRef': inputRefProp,\n 'aria-label': ariaLabel,\n\n // исключаем из otherProps\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n 'onChange': onChangeProp,\n dropdownClassName,\n onFocus,\n onBlur,\n 'onCreate': onCreateProp,\n onInput,\n multiple,\n groups,\n onDropdownOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n ...otherProps\n } = propsWithDefault;\n\n const renderValueDefault: SelectPropRenderValue<ITEM, false> = useAction(\n (ctx, { value }: { value: ITEM }) => ctx.get(propsAtom).getItemLabel(value),\n [],\n );\n\n const renderItemDefault = useAction(\n (\n ctx,\n {\n item,\n active,\n hovered,\n onClick,\n onMouseEnter,\n ref,\n }: RenderItemProps<ITEM>,\n ) => {\n const { getItemLabel, size, dropdownForm, getItemDisabled } =\n ctx.get(propsAtom);\n\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n />\n );\n },\n [],\n );\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n focusAtom,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n clearValue,\n optionsRefs,\n controlRef,\n dropdownRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n highlightIndex,\n onCreate,\n onChange,\n inputValueAtom,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n } = useSelect<ITEM, GROUP, false>({\n propsAtom,\n });\n\n return (\n <>\n <SelectControlLayout\n {...otherProps}\n style={style}\n className={cnSelectSingle(null, [className])}\n form={form}\n status={status}\n size={size}\n disabled={disabled}\n separator\n onClear={clearValue}\n onDropdownButton={handleToggleDropdown}\n openAtom={openAtom}\n focusAtom={focusAtom}\n view={view}\n iconClear={iconClear}\n clearButtonAtom={clearButtonAtom}\n ref={useForkRef([ref, controlRef])}\n >\n <SelectInput\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n ref={useForkRef([inputRef, inputRefProp])}\n onClick={handleInputClick}\n onChange={input ? handleInputChange : undefined}\n value={input ? inputValue : undefined}\n defaultValue={input ? inputDefaultValue : undefined}\n readOnly={input ? undefined : true}\n disabled={disabled}\n placeholder={placeholder}\n aria-label={ariaLabel}\n >\n {value && (renderValue || renderValueDefault)({ value })}\n </SelectInput>\n </SelectControlLayout>\n <SelectDropdown\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n size={size}\n controlRef={controlRef}\n getOptionActions={getOptionActions}\n dropdownRef={useForkRef([dropdownRef, dropdownRefProp])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n highlightIndex={highlightIndex}\n onChangeAll={onChangeAll}\n onCreate={onCreate}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n />\n </>\n );\n};\n\nexport const SelectSingle = withCtx(\n forwardRef(SelectSingleRender),\n) as SelectComponent;\n"],"mappings":"yqBAAA,OAASA,SAAT,KAA0B,mBAA1B,CACA,MAAOC,MAAP,EAAgBC,UAAhB,KAAkC,OAAlC,CAEA,OAASC,cAAT,yBACA,OAASC,UAAT,qBACA,OAASC,UAAT,iCACA,OAASC,QAAQ,GAAIC,GAArB,0BACA,OAASC,aAAT,4BACA,OAASC,OAAT,oCAUA,OAASC,WAAT,uBACA,OAASC,mBAAT,8BACA,OAASC,WAAT,sBACA,OAASC,SAAT,oB,GAEMC,eAAc,CAAGP,EAAE,CAAC,4BAAD,C,CAEnBQ,kBAAkB,CAAG,SAIzBC,CAJyB,CAKzBC,CAL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,CAmCE,oBAAC,cAAD,EACE,SAAS,CAAEmE,EADb,CAEE,cAAc,CAAED,EAFlB,CAGE,QAAQ,CAAEf,CAHZ,CAIE,IAAI,CAAErD,CAJR,CAKE,UAAU,CAAEgE,EALd,CAME,gBAAgB,CAAEZ,CANpB,CAOE,WAAW,CAAErE,UAAU,CAAC,CAACkF,EAAD,CAAc5D,CAAd,CAAD,CAPzB,CAQE,IAAI,CAAEC,CARR,CASE,SAAS,CAAEwB,CATb,CAUE,UAAU,CAAEvB,CAAU,EAAIuC,CAV5B,CAWE,aAAa,CAAEtC,CAXjB,CAYE,gBAAgB,CAAE8C,EAZpB,CAaE,cAAc,CAAE7C,CAblB,CAcE,SAAS,CAAEL,CAdb,CAeE,kBAAkB,CAAEM,CAftB,CAgBE,SAAS,CAAEqD,EAhBb,CAiBE,aAAa,CAAEpD,CAjBjB,CAkBE,gBAAgB,CAAEC,CAlBpB,CAmBE,oBAAoB,CAAEuD,EAnBxB,CAoBE,cAAc,CAAEI,EApBlB,CAqBE,WAAW,CAAED,EArBf,CAsBE,QAAQ,CAAEE,EAtBZ,CAuBE,QAAQ,CAAEC,EAvBZ,CAwBE,cAAc,CAAEC,EAxBlB,CAyBE,YAAY,CAAEC,EAzBhB,CA0BE,iBAAiB,CAAEC,EA1BrB,CA2BE,kBAAkB,CAAEC,EA3BtB,CA4BE,cAAc,CAAEpC,CA5BlB,EAnCF,CAmEH,C,CAED,MAAO,IAAMqC,aAAY,CAAG3F,OAAO,CACjCP,UAAU,CAACa,kBAAD,CADuB,CAA5B"}
1
+ {"version":3,"file":"SelectSingle.js","names":["useAction","React","forwardRef","SelectDropdown","SelectItem","useForkRef","cnCanary","cn","useSendToAtom","withCtx","withDefault","SelectControlLayout","SelectInput","useSelect","cnSelectSingle","SelectSingleRender","props","ref","propsWithDefault","propsAtom","form","status","size","disabled","value","renderValue","isLoading","dropdownRefProp","dropdownForm","renderItem","getGroupLabel","labelForCreate","labelForEmptyItems","virtualScroll","onScrollToBottom","style","className","placeholder","view","iconClear","input","inputValue","inputDefaultValue","inputRefProp","ariaLabel","getGroupKey","getItemDisabled","getItemGroupKey","getItemKey","getItemLabel","items","onChangeProp","dropdownClassName","onFocus","onBlur","onCreateProp","onInput","multiple","groups","onDropdownOpen","ignoreOutsideClicksRefs","clearButton","selectAll","selectAllLabel","dropdownViewportRef","otherProps","renderValueDefault","ctx","get","renderItemDefault","item","active","hovered","onClick","onMouseEnter","getOptionActions","openAtom","visibleItemsAtom","focusAtom","handleInputFocus","handleInputBlur","handleToggleDropdown","inputRef","handleInputClick","handleInputChange","clearValue","optionsRefs","controlRef","dropdownRef","clearButtonAtom","highlightedIndexAtom","getItemKeyAtom","valueAtom","onChangeAll","highlightIndex","onCreate","onChange","inputValueAtom","hasItemsAtom","groupsCounterAtom","dropdownZIndexAtom","SelectSingle"],"sources":["../../../../../../src/components/SelectCanary/SelectSingle/SelectSingle.tsx"],"sourcesContent":["import { useAction } from '@reatom/npm-react';\nimport React, { forwardRef } from 'react';\n\nimport { SelectDropdown } from '##/components/SelectCanary/SelectDropdown';\nimport { SelectItem } from '##/components/SelectCanary/SelectItem';\nimport { useForkRef } from '##/hooks/useForkRef';\nimport { cnCanary as cn } from '##/utils/bem';\nimport { useSendToAtom } from '##/utils/state';\nimport { withCtx } from '##/utils/state/withCtx';\n\nimport {\n RenderItemProps,\n SelectComponent,\n SelectGroupDefault,\n SelectItemDefault,\n SelectPropRenderValue,\n SelectProps,\n} from '..';\nimport { withDefault } from '../defaultProps';\nimport { SelectControlLayout } from '../SelectControlLayout';\nimport { SelectInput } from '../SelectInput';\nimport { useSelect } from '../useSelect';\n\nconst cnSelectSingle = cn('SelectSelectSingleMultiple');\n\nconst SelectSingleRender = <\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n>(\n props: SelectProps<ITEM, GROUP, false>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const propsWithDefault = withDefault(props);\n\n const propsAtom = useSendToAtom(propsWithDefault);\n\n const {\n form,\n status,\n size,\n disabled,\n value,\n renderValue,\n isLoading,\n 'dropdownRef': dropdownRefProp,\n dropdownForm,\n renderItem,\n getGroupLabel,\n labelForCreate,\n labelForEmptyItems,\n virtualScroll,\n onScrollToBottom,\n style,\n className,\n placeholder,\n view,\n iconClear,\n input,\n inputValue,\n inputDefaultValue,\n 'inputRef': inputRefProp,\n 'aria-label': ariaLabel,\n\n // исключаем из otherProps\n getGroupKey,\n getItemDisabled,\n getItemGroupKey,\n getItemKey,\n getItemLabel,\n items,\n 'onChange': onChangeProp,\n dropdownClassName,\n onFocus,\n onBlur,\n 'onCreate': onCreateProp,\n onInput,\n multiple,\n groups,\n onDropdownOpen,\n ignoreOutsideClicksRefs,\n clearButton,\n selectAll,\n selectAllLabel,\n dropdownViewportRef,\n ...otherProps\n } = propsWithDefault;\n\n const renderValueDefault: SelectPropRenderValue<ITEM, false> = useAction(\n (ctx, { value }: { value: ITEM }) => ctx.get(propsAtom).getItemLabel(value),\n [],\n );\n\n const renderItemDefault = useAction(\n (\n ctx,\n {\n item,\n active,\n hovered,\n onClick,\n onMouseEnter,\n ref,\n }: RenderItemProps<ITEM>,\n ) => {\n const { getItemLabel, size, dropdownForm, getItemDisabled } =\n ctx.get(propsAtom);\n\n return (\n <SelectItem\n label={getItemLabel(item)}\n active={active}\n hovered={hovered}\n size={size}\n indent={dropdownForm === 'round' ? 'increased' : 'normal'}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n disabled={getItemDisabled(item)}\n ref={ref}\n />\n );\n },\n [],\n );\n\n const {\n getOptionActions,\n openAtom,\n visibleItemsAtom,\n focusAtom,\n handleInputFocus,\n handleInputBlur,\n handleToggleDropdown,\n inputRef,\n handleInputClick,\n handleInputChange,\n clearValue,\n optionsRefs,\n controlRef,\n dropdownRef,\n clearButtonAtom,\n highlightedIndexAtom,\n getItemKeyAtom,\n valueAtom,\n onChangeAll,\n highlightIndex,\n onCreate,\n onChange,\n inputValueAtom,\n hasItemsAtom,\n groupsCounterAtom,\n dropdownZIndexAtom,\n } = useSelect<ITEM, GROUP, false>({\n propsAtom,\n });\n\n return (\n <>\n <SelectControlLayout\n {...otherProps}\n style={style}\n className={cnSelectSingle(null, [className])}\n form={form}\n status={status}\n size={size}\n disabled={disabled}\n separator\n onClear={clearValue}\n onDropdownButton={handleToggleDropdown}\n openAtom={openAtom}\n focusAtom={focusAtom}\n view={view}\n iconClear={iconClear}\n clearButtonAtom={clearButtonAtom}\n ref={useForkRef([ref, controlRef])}\n >\n <SelectInput\n onFocus={handleInputFocus}\n onBlur={handleInputBlur}\n ref={useForkRef([inputRef, inputRefProp])}\n onClick={handleInputClick}\n onChange={input ? handleInputChange : undefined}\n value={input ? inputValue : undefined}\n defaultValue={input ? inputDefaultValue : undefined}\n readOnly={input ? undefined : true}\n disabled={disabled}\n placeholder={placeholder}\n aria-label={ariaLabel}\n >\n {value && (renderValue || renderValueDefault)({ value })}\n </SelectInput>\n </SelectControlLayout>\n <SelectDropdown\n valueAtom={valueAtom}\n getItemKeyAtom={getItemKeyAtom}\n openAtom={openAtom}\n size={size}\n controlRef={controlRef}\n getOptionActions={getOptionActions}\n dropdownRef={useForkRef([dropdownRef, dropdownRefProp])}\n form={dropdownForm}\n className={dropdownClassName}\n renderItem={renderItem || renderItemDefault}\n getGroupLabel={getGroupLabel}\n visibleItemsAtom={visibleItemsAtom}\n labelForCreate={labelForCreate}\n isLoading={isLoading}\n labelForEmptyItems={labelForEmptyItems}\n itemsRefs={optionsRefs}\n virtualScroll={virtualScroll}\n onScrollToBottom={onScrollToBottom}\n highlightedIndexAtom={highlightedIndexAtom}\n highlightIndex={highlightIndex}\n onChangeAll={onChangeAll}\n onCreate={onCreate}\n onChange={onChange}\n inputValueAtom={inputValueAtom}\n hasItemsAtom={hasItemsAtom}\n groupsCounterAtom={groupsCounterAtom}\n dropdownZIndexAtom={dropdownZIndexAtom}\n selectAllLabel={selectAllLabel}\n viewportRef={dropdownViewportRef}\n />\n </>\n );\n};\n\nexport const SelectSing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EC,EAvBZ,CAwBE,cAAc,CAAEC,EAxBlB,CAyBE,YAAY,CAAEC,EAzBhB,CA0BE,iBAAiB,CAAEC,EA1BrB,CA2BE,kBAAkB,CAAEC,EA3BtB,CA4BE,cAAc,CAAErC,CA5BlB,CA6BE,WAAW,CAAEC,CA7Bf,EAnCF,CAoEH,C,CAED,MAAO,IAAMqC,aAAY,CAAG5F,OAAO,CACjCP,UAAU,CAACa,kBAAD,CADuB,CAA5B"}
@@ -48,12 +48,13 @@ export declare function withDefaultGetters<ITEM = SelectItemDefault, GROUP = Sel
48
48
  onScrollToBottom?: (length: number) => void;
49
49
  onDropdownOpen?: (isOpen: boolean) => void;
50
50
  dropdownOpen?: boolean;
51
+ dropdownViewportRef?: React.RefObject<HTMLElement>;
51
52
  ignoreOutsideClicksRefs?: ReadonlyArray<React.RefObject<HTMLElement>>;
52
53
  clearButton?: boolean;
53
54
  iconClear?: import("@consta/icons/Icon").IconComponent;
54
55
  selectAll?: (MULTIPLE extends true ? boolean : never) | undefined;
55
56
  selectAllLabel?: string;
56
- } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "onFocus" | "onBlur" | "onChange" | "onInput" | "size" | "view" | "form" | "status" | "input" | "disabled" | "value" | "multiple" | "placeholder" | "inputRef" | "items" | "dropdownForm" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "onScrollToBottom" | "labelForCreate" | "inputValue" | "selectAll" | "onDropdownOpen" | "dropdownOpen" | "ignoreOutsideClicksRefs" | "virtualScroll" | "inputDefaultValue" | "clearButton" | "iconClear" | "onCreate" | "selectAllLabel" | "aria-Label"> & import("react").RefAttributes<HTMLDivElement> & (ITEM extends {
57
+ } & Omit<import("react").HTMLAttributes<HTMLDivElement>, "css" | "onFocus" | "onBlur" | "onChange" | "onInput" | "size" | "view" | "form" | "status" | "input" | "disabled" | "value" | "multiple" | "placeholder" | "inputRef" | "items" | "dropdownForm" | "dropdownClassName" | "dropdownRef" | "isLoading" | "labelForEmptyItems" | "renderItem" | "renderValue" | "groups" | "getItemLabel" | "getItemKey" | "getItemGroupKey" | "getItemDisabled" | "getGroupLabel" | "getGroupKey" | "onScrollToBottom" | "labelForCreate" | "inputValue" | "selectAll" | "onDropdownOpen" | "dropdownOpen" | "ignoreOutsideClicksRefs" | "virtualScroll" | "dropdownViewportRef" | "inputDefaultValue" | "clearButton" | "iconClear" | "onCreate" | "selectAllLabel" | "aria-Label"> & import("react").RefAttributes<HTMLDivElement> & (ITEM extends {
57
58
  label: SelectItemDefault["label"];
58
59
  } ? {} : {
59
60
  getItemLabel: SelectPropGetItemLabel<ITEM>;
@@ -91,6 +91,7 @@ export type SelectPropsInit<ITEM = SelectItemDefault, GROUP = SelectGroupDefault
91
91
  'onScrollToBottom'?: (length: number) => void;
92
92
  'onDropdownOpen'?: (isOpen: boolean) => void;
93
93
  'dropdownOpen'?: boolean;
94
+ 'dropdownViewportRef'?: React.RefObject<HTMLElement>;
94
95
  'ignoreOutsideClicksRefs'?: ReadonlyArray<React.RefObject<HTMLElement>>;
95
96
  'clearButton'?: boolean;
96
97
  'iconClear'?: IconComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/SelectCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport {\n FieldPropForm,\n FieldPropSize,\n FieldPropStatus,\n FieldPropView,\n} from '##/components/FieldComponents';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type 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\nexport type SelectItemDefault = {\n label: string;\n id: string | number;\n groupId?: string | number;\n disabled?: boolean;\n};\n\nexport type SelectGroupDefault = {\n label: string;\n id: string | number;\n};\n\nexport type SelectPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type SelectPropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type SelectPropGetItemGroupKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type SelectPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type SelectPropGetGroupKey<GROUP> = (group: GROUP) => string | number;\nexport type SelectPropGetGroupLabel<GROUP> = (group: GROUP) => string;\n\nexport type SelectPropOnChange<ITEM, MULTIPLE extends boolean> = (\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null,\n props: {\n e: React.SyntheticEvent;\n },\n) => void;\nexport type SelectPropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type SelectPropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactNode | null;\n\nexport type SelectPropRenderValue<ITEM, MULTIPLE> = MULTIPLE extends true\n ? (props: {\n value: ITEM[];\n getRemove: (\n item: ITEM,\n ) => (e: React.SyntheticEvent<Element, Event>) => void;\n }) => React.ReactNode | null\n : (props: { value: ITEM }) => React.ReactNode | null;\n\nexport type SelectPropOnCreate = (\n label: string,\n props: { e: React.SyntheticEvent },\n) => void;\n\nexport type SelectAllItem = {\n groupKey: string | number;\n __optionSelectAll: true;\n};\n\nexport type Group<ITEM, GROUP> = {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n};\n\nexport type CountedGroup<ITEM, GROUP> = Omit<Group<ITEM, GROUP>, 'items'> & {\n items: Array<SelectAllItem | ITEM>;\n};\n\nexport type SelectPropsInit<\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n 'items': ITEM[];\n 'onChange': SelectPropOnChange<ITEM, MULTIPLE>;\n 'disabled'?: boolean;\n 'form'?: FieldPropForm;\n 'dropdownForm'?: 'default' | 'brick' | 'round';\n 'size'?: FieldPropSize;\n 'view'?: FieldPropView;\n 'placeholder'?: string;\n 'aria-Label'?: string;\n 'status'?: FieldPropStatus;\n 'isLoading'?: boolean;\n 'dropdownClassName'?: string;\n 'dropdownRef'?: React.Ref<HTMLDivElement>;\n 'renderItem'?: SelectPropRenderItem<ITEM>;\n 'renderValue'?: SelectPropRenderValue<ITEM, MULTIPLE>;\n 'onFocus'?: React.FocusEventHandler<HTMLInputElement>;\n 'onBlur'?: React.FocusEventHandler<HTMLInputElement>;\n 'onCreate'?: SelectPropOnCreate;\n 'inputRef'?: React.Ref<HTMLInputElement>;\n 'input'?: boolean;\n 'inputValue'?: string;\n 'inputDefaultValue'?: string;\n 'onInput'?: (value: string) => void;\n 'labelForCreate'?:\n | ((label: string | undefined) => React.ReactNode)\n | React.ReactNode;\n 'labelForEmptyItems'?: string;\n 'multiple'?: MULTIPLE;\n 'value'?: SelectPropValue<ITEM, MULTIPLE>;\n 'groups'?: GROUP[];\n 'getItemLabel'?: SelectPropGetItemLabel<ITEM>;\n 'getItemKey'?: SelectPropGetItemKey<ITEM>;\n 'getItemGroupKey'?: SelectPropGetItemGroupKey<ITEM>;\n 'getItemDisabled'?: SelectPropGetItemDisabled<ITEM>;\n 'getGroupLabel'?: SelectPropGetGroupLabel<GROUP>;\n 'getGroupKey'?: SelectPropGetGroupKey<GROUP>;\n 'virtualScroll'?: boolean;\n 'onScrollToBottom'?: (length: number) => void;\n 'onDropdownOpen'?: (isOpen: boolean) => void;\n 'dropdownOpen'?: boolean;\n 'ignoreOutsideClicksRefs'?: ReadonlyArray<React.RefObject<HTMLElement>>;\n 'clearButton'?: boolean;\n 'iconClear'?: IconComponent;\n 'selectAll'?: MULTIPLE extends true ? boolean : never;\n 'selectAllLabel'?: string;\n },\n HTMLDivElement\n>;\n\nexport type SelectProps<\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = SelectPropsInit<ITEM, GROUP, MULTIPLE> &\n (ITEM extends { label: SelectItemDefault['label'] }\n ? {}\n : { getItemLabel: SelectPropGetItemLabel<ITEM> }) &\n (ITEM extends { id: SelectItemDefault['id'] }\n ? {}\n : { getItemKey: SelectPropGetItemKey<ITEM> }) &\n (GROUP extends { label: SelectGroupDefault['label'] }\n ? {}\n : { getGroupLabel: SelectPropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: SelectGroupDefault['id'] }\n ? {}\n : { getGroupKey: SelectPropGetGroupKey<GROUP> });\n\nexport type SelectComponent = <\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: SelectProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactNode | null;\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/components/SelectCanary/types.ts"],"sourcesContent":["import { IconComponent } from '@consta/icons/Icon';\nimport React from 'react';\n\nimport {\n FieldPropForm,\n FieldPropSize,\n FieldPropStatus,\n FieldPropView,\n} from '##/components/FieldComponents';\nimport { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';\n\nexport type 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\nexport type SelectItemDefault = {\n label: string;\n id: string | number;\n groupId?: string | number;\n disabled?: boolean;\n};\n\nexport type SelectGroupDefault = {\n label: string;\n id: string | number;\n};\n\nexport type SelectPropGetItemLabel<ITEM> = (item: ITEM) => string;\nexport type SelectPropGetItemKey<ITEM> = (item: ITEM) => string | number;\nexport type SelectPropGetItemGroupKey<ITEM> = (\n item: ITEM,\n) => string | number | undefined;\nexport type SelectPropGetItemDisabled<ITEM> = (\n item: ITEM,\n) => boolean | undefined;\nexport type SelectPropGetGroupKey<GROUP> = (group: GROUP) => string | number;\nexport type SelectPropGetGroupLabel<GROUP> = (group: GROUP) => string;\n\nexport type SelectPropOnChange<ITEM, MULTIPLE extends boolean> = (\n value: (MULTIPLE extends true ? ITEM[] : ITEM) | null,\n props: {\n e: React.SyntheticEvent;\n },\n) => void;\nexport type SelectPropValue<ITEM, MULTIPLE extends boolean> =\n | (MULTIPLE extends true ? ITEM[] : ITEM)\n | null\n | undefined;\n\nexport type SelectPropRenderItem<ITEM> = (\n props: RenderItemProps<ITEM>,\n) => React.ReactNode | null;\n\nexport type SelectPropRenderValue<ITEM, MULTIPLE> = MULTIPLE extends true\n ? (props: {\n value: ITEM[];\n getRemove: (\n item: ITEM,\n ) => (e: React.SyntheticEvent<Element, Event>) => void;\n }) => React.ReactNode | null\n : (props: { value: ITEM }) => React.ReactNode | null;\n\nexport type SelectPropOnCreate = (\n label: string,\n props: { e: React.SyntheticEvent },\n) => void;\n\nexport type SelectAllItem = {\n groupKey: string | number;\n __optionSelectAll: true;\n};\n\nexport type Group<ITEM, GROUP> = {\n items: ITEM[];\n key: string | number;\n group?: GROUP;\n};\n\nexport type CountedGroup<ITEM, GROUP> = Omit<Group<ITEM, GROUP>, 'items'> & {\n items: Array<SelectAllItem | ITEM>;\n};\n\nexport type SelectPropsInit<\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = PropsWithHTMLAttributesAndRef<\n {\n 'items': ITEM[];\n 'onChange': SelectPropOnChange<ITEM, MULTIPLE>;\n 'disabled'?: boolean;\n 'form'?: FieldPropForm;\n 'dropdownForm'?: 'default' | 'brick' | 'round';\n 'size'?: FieldPropSize;\n 'view'?: FieldPropView;\n 'placeholder'?: string;\n 'aria-Label'?: string;\n 'status'?: FieldPropStatus;\n 'isLoading'?: boolean;\n 'dropdownClassName'?: string;\n 'dropdownRef'?: React.Ref<HTMLDivElement>;\n 'renderItem'?: SelectPropRenderItem<ITEM>;\n 'renderValue'?: SelectPropRenderValue<ITEM, MULTIPLE>;\n 'onFocus'?: React.FocusEventHandler<HTMLInputElement>;\n 'onBlur'?: React.FocusEventHandler<HTMLInputElement>;\n 'onCreate'?: SelectPropOnCreate;\n 'inputRef'?: React.Ref<HTMLInputElement>;\n 'input'?: boolean;\n 'inputValue'?: string;\n 'inputDefaultValue'?: string;\n 'onInput'?: (value: string) => void;\n 'labelForCreate'?:\n | ((label: string | undefined) => React.ReactNode)\n | React.ReactNode;\n 'labelForEmptyItems'?: string;\n 'multiple'?: MULTIPLE;\n 'value'?: SelectPropValue<ITEM, MULTIPLE>;\n 'groups'?: GROUP[];\n 'getItemLabel'?: SelectPropGetItemLabel<ITEM>;\n 'getItemKey'?: SelectPropGetItemKey<ITEM>;\n 'getItemGroupKey'?: SelectPropGetItemGroupKey<ITEM>;\n 'getItemDisabled'?: SelectPropGetItemDisabled<ITEM>;\n 'getGroupLabel'?: SelectPropGetGroupLabel<GROUP>;\n 'getGroupKey'?: SelectPropGetGroupKey<GROUP>;\n 'virtualScroll'?: boolean;\n 'onScrollToBottom'?: (length: number) => void;\n 'onDropdownOpen'?: (isOpen: boolean) => void;\n 'dropdownOpen'?: boolean;\n 'dropdownViewportRef'?: React.RefObject<HTMLElement>;\n 'ignoreOutsideClicksRefs'?: ReadonlyArray<React.RefObject<HTMLElement>>;\n 'clearButton'?: boolean;\n 'iconClear'?: IconComponent;\n 'selectAll'?: MULTIPLE extends true ? boolean : never;\n 'selectAllLabel'?: string;\n },\n HTMLDivElement\n>;\n\nexport type SelectProps<\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n MULTIPLE extends boolean = false,\n> = SelectPropsInit<ITEM, GROUP, MULTIPLE> &\n (ITEM extends { label: SelectItemDefault['label'] }\n ? {}\n : { getItemLabel: SelectPropGetItemLabel<ITEM> }) &\n (ITEM extends { id: SelectItemDefault['id'] }\n ? {}\n : { getItemKey: SelectPropGetItemKey<ITEM> }) &\n (GROUP extends { label: SelectGroupDefault['label'] }\n ? {}\n : { getGroupLabel: SelectPropGetGroupLabel<GROUP> }) &\n (GROUP extends { id: SelectGroupDefault['id'] }\n ? {}\n : { getGroupKey: SelectPropGetGroupKey<GROUP> });\n\nexport type SelectComponent = <\n ITEM = SelectItemDefault,\n GROUP = SelectGroupDefault,\n MULTIPLE extends boolean = false,\n>(\n props: SelectProps<ITEM, GROUP, MULTIPLE>,\n) => React.ReactNode | null;\n"],"mappings":""}
@@ -35,6 +35,7 @@ type Props<ITEM, GROUP> = PropsWithJsxAttributes<{
35
35
  itemsRefs: React.RefObject<HTMLDivElement>[];
36
36
  virtualScroll?: boolean;
37
37
  onScrollToBottom?: (length: number) => void;
38
+ viewportRef?: React.RefObject<HTMLElement>;
38
39
  }>;
39
40
  type SelectDropdownComponent = <ITEM, GROUP>(props: Props<ITEM, GROUP>) => React.ReactNode | null;
40
41
  export declare const SelectDropdown: SelectDropdownComponent;
@@ -1,2 +1,2 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SelectDropdown.css";import React,{Fragment,useEffect,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,ListLoader,mapVerticalSpace}from"../../ListCanary";import{Popover}from"../../Popover";import{useDebounce}from"../../../hooks/useDebounce";import{useFlag}from"../../../hooks/useFlag";import{forkRef,useForkRef}from"../../../hooks/useForkRef";import{useVirtualScroll}from"../../../hooks/useVirtualScroll";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cnMixScrollBar}from"../../../mixs/MixScrollBar";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectItemAll}from"../SelectItemAll/SelectItemAll";import{SelectLoader}from"../SelectLoader/SelectLoader";import{isNotOptionForCreate,isOptionForCreate,isOptionForSelectAll}from"../useSelect";export var selectDropdownForm=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownForm[0];var cnSelectDropdown=cn("SelectDropdown"),getLengthElements=function(a){for(var b,c=1>=a.length?0:a.length,d=0;d<a.length;d++)b=a[d],isNotOptionForCreate(b)&&b.items.length&&(c+=b.items.length);return c},isVisible=function(a,b){return b>=a[0]&&b<a[1]};export var SelectDropdown=function(a){var b=a.controlRef,c=a.size,d=a.getOptionProps,e=a.dropdownRef,f=a.labelForCreate,g=a.className,h=a.labelForNotFound,i=a.labelForEmptyItems,j=a.hasItems,k=void 0===j||j,l=a.form,m=a.isOpen,n=a.offset,o=void 0===n?"none":n,p=a.renderItem,q=a.visibleItems,r=a.isLoading,s=a.getGroupLabel,t=a.notFound,u=a.itemsRefs,v=a.virtualScroll,w=a.onScrollToBottom,x=_objectWithoutProperties(a,_excluded),y="round"===l?"increased":"normal",z=useMemo(function(){return 0<q.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[q]),A="none"===o?void 0:o,B=useMemo(function(){return getLengthElements(q)},[q]),C=useVirtualScroll({length:B,isActive:v&&m,onScrollToBottom:w}),D=C.spaceTop,E=C.slice,F=C.listRefs,G=C.scrollElementRef,H=0===E[0]&&v?[0,50]:E,I=useRef(null),J=useForkRef([G,e]),K=useFlag(),L=_slicedToArray(K,2),M=L[0],N=L[1],O=useDebounce(N.off,100);return useEffect(function(){var a,b=function(){N.on(),O()};return null===(a=G.current)||void 0===a?void 0:a.addEventListener("scroll",b),function(){var a;null===(a=G.current)||void 0===a?void 0:a.removeEventListener("scroll",b)}},[G.current]),React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:I,timeout:animateTimeout},function(a){var e=fabricIndex(),j=fabricIndex();return React.createElement(Popover,Object.assign({},x,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:A,ref:I,role:"listbox",className:cnSelectDropdown(null,[cnListBox({size:c,form:l,border:!0,shadow:!0}),cnMixPopoverAnimate({animate:a}),g]),equalAnchorWidth:!0}),React.createElement("div",{className:cnSelectDropdown("ScrollContainer",[cnMixSpace({pV:mapVerticalSpace[c]}),cnMixScrollBar()]),ref:J},r&&!z&&React.createElement(SelectLoader,null),React.createElement("div",{className:cnSelectDropdown("List",{scrolled:M}),style:{marginTop:D}},q.map(function(a,b){if(isOptionForCreate(a)){var h=e();return React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:y,ref:u[h]},d({index:h,item:a,keyPrefix:b})))}var g=1<q.length?j():0;return React.createElement(Fragment,{key:a.key},a.group&&s&&isVisible(H,g)&&React.createElement(SelectGroupLabel,{label:s(a.group),size:c,indent:y,ref:F[g],key:"group-".concat(a.key)}),a.items.map(function(b,f){if(isOptionForSelectAll(b)){var g=j(),h=e();if(isVisible(H,g))return React.createElement(SelectItemAll,Object.assign({ref:forkRef([F[g],u[h]]),indent:y,size:c},d({index:h,item:b,keyPrefix:f}),{intermediate:!!(b.checkedCount&&b.totalCount)&&b.checkedCount!==b.totalCount,checked:b.checkedCount===b.totalCount,countItems:b.checkedCount,total:b.totalCount}))}else{var i=j(),k=e();if(isVisible(H,i))return React.createElement(Fragment,{key:"".concat(a.key,"-").concat(f)},p(_objectSpread({ref:forkRef([F[i],u[k]]),item:b},d({index:k,item:b,keyPrefix:f}))))}}))}),r&&z&&React.createElement(ListLoader,{size:c,innerOffset:y})),!r&&k&&t&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:y},h),!r&&!k&&i&&React.createElement(ListItem,{size:c,label:i,innerOffset:y},i)))})};
1
+ import _defineProperty from"@babel/runtime/helpers/defineProperty";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["controlRef","size","getOptionProps","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","viewportRef"];function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import"./SelectDropdown.css";import React,{Fragment,useEffect,useMemo,useRef}from"react";import{Transition}from"react-transition-group";import{cnListBox,ListItem,ListLoader,mapVerticalSpace}from"../../ListCanary";import{Popover}from"../../Popover";import{useDebounce}from"../../../hooks/useDebounce";import{useFlag}from"../../../hooks/useFlag";import{forkRef,useForkRef}from"../../../hooks/useForkRef";import{useVirtualScroll}from"../../../hooks/useVirtualScroll";import{animateTimeout,cnMixPopoverAnimate}from"../../../mixs/MixPopoverAnimate/MixPopoverAnimate";import{cnMixScrollBar}from"../../../mixs/MixScrollBar";import{cnMixSpace}from"../../../mixs/MixSpace";import{cn}from"../../../utils/bem";import{fabricIndex}from"../../../utils/fabricIndex";import{SelectCreateButton}from"../SelectCreateButton/SelectCreateButton";import{SelectGroupLabel}from"../SelectGroupLabel/SelectGroupLabel";import{SelectItemAll}from"../SelectItemAll/SelectItemAll";import{SelectLoader}from"../SelectLoader/SelectLoader";import{isNotOptionForCreate,isOptionForCreate,isOptionForSelectAll}from"../useSelect";export var selectDropdownForm=["default","brick","round"];export var defaultSelectDropdownPropForm=selectDropdownForm[0];var cnSelectDropdown=cn("SelectDropdown"),getLengthElements=function(a){for(var b,c=1>=a.length?0:a.length,d=0;d<a.length;d++)b=a[d],isNotOptionForCreate(b)&&b.items.length&&(c+=b.items.length);return c},isVisible=function(a,b){return b>=a[0]&&b<a[1]};export var SelectDropdown=function(a){var b=a.controlRef,c=a.size,d=a.getOptionProps,e=a.dropdownRef,f=a.labelForCreate,g=a.className,h=a.labelForNotFound,i=a.labelForEmptyItems,j=a.hasItems,k=void 0===j||j,l=a.form,m=a.isOpen,n=a.offset,o=void 0===n?"none":n,p=a.renderItem,q=a.visibleItems,r=a.isLoading,s=a.getGroupLabel,t=a.notFound,u=a.itemsRefs,v=a.virtualScroll,w=a.onScrollToBottom,x=a.viewportRef,y=_objectWithoutProperties(a,_excluded),z="round"===l?"increased":"normal",A=useMemo(function(){return 0<q.filter(function(a){return isOptionForCreate(a)||Array.isArray(a.items)&&0<a.items.length}).length},[q]),B="none"===o?void 0:o,C=useMemo(function(){return getLengthElements(q)},[q]),D=useVirtualScroll({length:C,isActive:v&&m,onScrollToBottom:w}),E=D.spaceTop,F=D.slice,G=D.listRefs,H=D.scrollElementRef,I=0===F[0]&&v?[0,50]:F,J=useRef(null),K=useForkRef([H,e]),L=useFlag(),M=_slicedToArray(L,2),N=M[0],O=M[1],P=useDebounce(O.off,100);return useEffect(function(){var a,b=function(){O.on(),P()};return null===(a=H.current)||void 0===a?void 0:a.addEventListener("scroll",b),function(){var a;null===(a=H.current)||void 0===a?void 0:a.removeEventListener("scroll",b)}},[H.current]),React.createElement(Transition,{in:m,unmountOnExit:!0,nodeRef:J,timeout:animateTimeout},function(a){var e=fabricIndex(),j=fabricIndex();return React.createElement(Popover,Object.assign({},y,{anchorRef:b,direction:"downStartLeft",possibleDirections:["downStartLeft","upStartLeft","downStartRight","upStartRight"],offset:B,ref:J,role:"listbox",className:cnSelectDropdown(null,[cnListBox({size:c,form:l,border:!0,shadow:!0}),cnMixPopoverAnimate({animate:a}),g]),equalAnchorWidth:!0,viewportRef:x}),React.createElement("div",{className:cnSelectDropdown("ScrollContainer",[cnMixSpace({pV:mapVerticalSpace[c]}),cnMixScrollBar()]),ref:K},r&&!A&&React.createElement(SelectLoader,null),React.createElement("div",{className:cnSelectDropdown("List",{scrolled:N}),style:{marginTop:E}},q.map(function(a,b){if(isOptionForCreate(a)){var h=e();return React.createElement(SelectCreateButton,Object.assign({size:c,labelForCreate:f,inputValue:a.label,indent:z,ref:u[h]},d({index:h,item:a,keyPrefix:b})))}var g=1<q.length?j():0;return React.createElement(Fragment,{key:a.key},a.group&&s&&isVisible(I,g)&&React.createElement(SelectGroupLabel,{label:s(a.group),size:c,indent:z,ref:G[g],key:"group-".concat(a.key)}),a.items.map(function(b,f){if(isOptionForSelectAll(b)){var g=j(),h=e();if(isVisible(I,g))return React.createElement(SelectItemAll,Object.assign({ref:forkRef([G[g],u[h]]),indent:z,size:c},d({index:h,item:b,keyPrefix:f}),{intermediate:!!(b.checkedCount&&b.totalCount)&&b.checkedCount!==b.totalCount,checked:b.checkedCount===b.totalCount,countItems:b.checkedCount,total:b.totalCount}))}else{var i=j(),k=e();if(isVisible(I,i))return React.createElement(Fragment,{key:"".concat(a.key,"-").concat(f)},p(_objectSpread({ref:forkRef([G[i],u[k]]),item:b},d({index:k,item:b,keyPrefix:f}))))}}))}),r&&A&&React.createElement(ListLoader,{size:c,innerOffset:z})),!r&&k&&t&&h&&React.createElement(ListItem,{size:c,label:h,innerOffset:z},h),!r&&!k&&i&&React.createElement(ListItem,{size:c,label:i,innerOffset:z},i)))})};
2
2
  //# sourceMappingURL=SelectDropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useEffect","useMemo","useRef","Transition","cnListBox","ListItem","ListLoader","mapVerticalSpace","Popover","useDebounce","useFlag","forkRef","useForkRef","useVirtualScroll","animateTimeout","cnMixPopoverAnimate","cnMixScrollBar","cnMixSpace","cn","fabricIndex","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","selectDropdownForm","defaultSelectDropdownPropForm","cnSelectDropdown","getLengthElements","elements","element","length","index","items","isVisible","slice","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRefProp","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","offsetProp","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","otherProps","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","listRefs","scrollElementRef","popoverRef","scrolled","setScrolled","setScrolledOffDebounce","off","fn","on","current","addEventListener","removeEventListener","animate","getIndex","getVirtualIndex","border","shadow","pV","marginTop","map","groupIndex","label","item","keyPrefix","virtualIndex","key","i","checkedCount","totalCount","ref"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useEffect, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n ListLoader,\n mapVerticalSpace,\n} from '##/components/ListCanary';\nimport { Popover, PopoverPropOffset } from '##/components/Popover';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '##/mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectItemAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../useSelect';\n\nexport const selectDropdownForm = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownForm[number];\nexport const defaultSelectDropdownPropForm = selectDropdownForm[0];\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: PropSize;\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.Ref<HTMLDivElement>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n offset?: PopoverPropOffset | 'none';\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => React.ReactNode | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n checkedCount?: number;\n totalCount?: number;\n }\n )[];\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?: string;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItems?: boolean;\n itemsRefs: React.RefObject<HTMLDivElement>[];\n virtualScroll?: boolean;\n onScrollToBottom?: (length: number) => void;\n}>;\n\ntype SelectDropdownComponent = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nconst getLengthElements = <ITEM, GROUP>(\n elements: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n checkedCount?: number;\n totalCount?: number;\n }\n )[],\n) => {\n let 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 SelectDropdown: SelectDropdownComponent = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef: dropdownRefProp,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItems = true,\n form,\n isOpen,\n offset: offsetProp = 'none',\n renderItem,\n visibleItems,\n isLoading,\n getGroupLabel,\n notFound,\n itemsRefs,\n virtualScroll,\n onScrollToBottom,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\n\n const isListShowed = useMemo(() => {\n return (\n visibleItems.filter(\n (group) =>\n isOptionForCreate(group) ||\n (Array.isArray(group.items) && group.items.length > 0),\n ).length > 0\n );\n }, [visibleItems]);\n\n const offset = offsetProp === 'none' ? undefined : offsetProp;\n\n const lengthForVirtualScroll = useMemo(\n () => 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 && isOpen,\n onScrollToBottom,\n });\n\n const slice: [number, number] =\n sliceHookProp[0] === 0 && virtualScroll ? [0, 50] : sliceHookProp;\n\n const popoverRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useForkRef([scrollElementRef, dropdownRefProp]);\n const [scrolled, setScrolled] = useFlag();\n const setScrolledOffDebounce = useDebounce(setScrolled.off, 100);\n\n useEffect(() => {\n const fn = () => {\n setScrolled.on();\n setScrolledOffDebounce();\n };\n\n scrollElementRef.current?.addEventListener('scroll', fn);\n\n return () => {\n scrollElementRef.current?.removeEventListener('scroll', fn);\n };\n }, [scrollElementRef.current]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex();\n const getVirtualIndex = fabricIndex();\n\n return (\n <Popover\n {...otherProps}\n anchorRef={controlRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset={offset}\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown(null, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n equalAnchorWidth\n >\n <div\n className={cnSelectDropdown('ScrollContainer', [\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixScrollBar(),\n ])}\n ref={dropdownRef}\n >\n {isLoading && !isListShowed && <SelectLoader />}\n <div\n className={cnSelectDropdown('List', { scrolled })}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group, groupIndex) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n ref={itemsRefs[index]}\n {...getOptionProps({\n index,\n item: group,\n keyPrefix: groupIndex,\n })}\n />\n );\n }\n\n const virtualIndex =\n visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group-${group.key}`}\n />\n )}\n {group.items.map((item, i) => {\n if (isOptionForSelectAll(item)) {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n\n if (isVisible(slice, virtualIndex)) {\n return (\n <SelectItemAll\n ref={forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ])}\n indent={indent}\n size={size}\n {...getOptionProps({\n index,\n item,\n keyPrefix: i,\n })}\n intermediate={\n item.checkedCount && item.totalCount\n ? item.checkedCount !== item.totalCount\n : false\n }\n checked={item.checkedCount === item.totalCount}\n countItems={item.checkedCount}\n total={item.totalCount}\n />\n );\n }\n } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n ref: forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ]),\n item,\n ...getOptionProps({\n index,\n item,\n keyPrefix: i,\n }),\n })}\n </Fragment>\n );\n }\n }\n })}\n </Fragment>\n );\n })}\n {isLoading && isListShowed && (\n <ListLoader size={size} innerOffset={indent} />\n )}\n </div>\n {!isLoading && hasItems && notFound && labelForNotFound && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForNotFound}\n </ListItem>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <ListItem\n size={size}\n label={labelForEmptyItems}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n </Popover>\n );\n }}\n </Transition>\n );\n};\n"],"mappings":"ylCAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,OAArC,CAA8CC,MAA9C,KAA4D,OAA5D,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,UA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,EACC,oBAAC,UAAD,EAAY,IAAI,CAAEvB,CAAlB,CAAwB,WAAW,CAAEsB,CAArC,EAhGJ,CAVF,CA6GG,CAACP,CAAD,EAAcP,CAAd,EAA0BS,CAA1B,EAAsCX,CAAtC,EACC,oBAAC,QAAD,EACE,IAAI,CAAEN,CADR,CAEE,KAAK,CAAEM,CAFT,CAGE,WAAW,CAAEgB,CAHf,EAKGhB,CALH,CA9GJ,CAsHG,CAACS,CAAD,EAAc,CAACP,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEP,CADR,CAEE,KAAK,CAAEO,CAFT,CAGE,WAAW,CAAEe,CAHf,EAKGf,CALH,CAvHJ,CApBF,CAsJH,CAjKH,CAoKH,CAjPM"}
1
+ {"version":3,"file":"SelectDropdown.js","names":["React","Fragment","useEffect","useMemo","useRef","Transition","cnListBox","ListItem","ListLoader","mapVerticalSpace","Popover","useDebounce","useFlag","forkRef","useForkRef","useVirtualScroll","animateTimeout","cnMixPopoverAnimate","cnMixScrollBar","cnMixSpace","cn","fabricIndex","SelectCreateButton","SelectGroupLabel","SelectItemAll","SelectLoader","isNotOptionForCreate","isOptionForCreate","isOptionForSelectAll","selectDropdownForm","defaultSelectDropdownPropForm","cnSelectDropdown","getLengthElements","elements","element","length","index","items","isVisible","slice","SelectDropdown","props","controlRef","size","getOptionProps","dropdownRefProp","dropdownRef","labelForCreate","className","labelForNotFound","labelForEmptyItems","hasItems","form","isOpen","offset","offsetProp","renderItem","visibleItems","isLoading","getGroupLabel","notFound","itemsRefs","virtualScroll","onScrollToBottom","viewportRef","otherProps","indent","isListShowed","filter","group","Array","isArray","lengthForVirtualScroll","isActive","spaceTop","sliceHookProp","listRefs","scrollElementRef","popoverRef","scrolled","setScrolled","setScrolledOffDebounce","off","fn","on","current","addEventListener","removeEventListener","animate","getIndex","getVirtualIndex","border","shadow","pV","marginTop","map","groupIndex","label","item","keyPrefix","virtualIndex","key","i","checkedCount","totalCount","ref"],"sources":["../../../../../../src/components/SelectComponents/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import './SelectDropdown.css';\n\nimport React, { Fragment, useEffect, useMemo, useRef } from 'react';\nimport { Transition } from 'react-transition-group';\n\nimport {\n cnListBox,\n ListItem,\n ListLoader,\n mapVerticalSpace,\n} from '##/components/ListCanary';\nimport { Popover, PopoverPropOffset } from '##/components/Popover';\nimport { useDebounce } from '##/hooks/useDebounce';\nimport { useFlag } from '##/hooks/useFlag';\nimport { forkRef, useForkRef } from '##/hooks/useForkRef';\nimport { useVirtualScroll } from '##/hooks/useVirtualScroll';\nimport {\n animateTimeout,\n cnMixPopoverAnimate,\n} from '##/mixs/MixPopoverAnimate/MixPopoverAnimate';\nimport { cnMixScrollBar } from '##/mixs/MixScrollBar';\nimport { cnMixSpace } from '##/mixs/MixSpace';\nimport { cn } from '##/utils/bem';\nimport { fabricIndex } from '##/utils/fabricIndex';\nimport { SelectAllItem } from '##/utils/getGroups';\nimport { PropsWithJsxAttributes } from '##/utils/types/PropsWithJsxAttributes';\n\nimport { SelectCreateButton } from '../SelectCreateButton/SelectCreateButton';\nimport { SelectGroupLabel } from '../SelectGroupLabel/SelectGroupLabel';\nimport { SelectItemAll } from '../SelectItemAll/SelectItemAll';\nimport { SelectLoader } from '../SelectLoader/SelectLoader';\nimport { PropSize, RenderItemProps } from '../types';\nimport {\n GetOptionPropsResult,\n isNotOptionForCreate,\n isOptionForCreate,\n isOptionForSelectAll,\n OptionForCreate,\n OptionProps,\n} from '../useSelect';\n\nexport const selectDropdownForm = ['default', 'brick', 'round'] as const;\nexport type SelectDropdownPropForm = typeof selectDropdownForm[number];\nexport const defaultSelectDropdownPropForm = selectDropdownForm[0];\n\ntype Props<ITEM, GROUP> = PropsWithJsxAttributes<{\n size: PropSize;\n controlRef: React.MutableRefObject<HTMLDivElement | null>;\n dropdownRef: React.Ref<HTMLDivElement>;\n getOptionProps(props: OptionProps<ITEM>): GetOptionPropsResult;\n form: SelectDropdownPropForm;\n isOpen: boolean;\n offset?: PopoverPropOffset | 'none';\n isLoading?: boolean;\n renderItem: (props: RenderItemProps<ITEM>) => React.ReactNode | null;\n visibleItems: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n checkedCount?: number;\n totalCount?: number;\n }\n )[];\n getGroupLabel?: (group: GROUP) => string;\n labelForCreate?: string;\n labelForNotFound?: string;\n labelForEmptyItems?: string;\n notFound?: boolean;\n hasItems?: boolean;\n itemsRefs: React.RefObject<HTMLDivElement>[];\n virtualScroll?: boolean;\n onScrollToBottom?: (length: number) => void;\n viewportRef?: React.RefObject<HTMLElement>;\n}>;\n\ntype SelectDropdownComponent = <ITEM, GROUP>(\n props: Props<ITEM, GROUP>,\n) => React.ReactNode | null;\n\nconst cnSelectDropdown = cn('SelectDropdown');\n\nconst getLengthElements = <ITEM, GROUP>(\n elements: (\n | OptionForCreate\n | {\n items: Array<SelectAllItem | ITEM>;\n key: string | number;\n group?: GROUP;\n groupIndex: number;\n checkedCount?: number;\n totalCount?: number;\n }\n )[],\n) => {\n let 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 SelectDropdown: SelectDropdownComponent = (props) => {\n const {\n controlRef,\n size,\n getOptionProps,\n dropdownRef: dropdownRefProp,\n labelForCreate,\n className,\n labelForNotFound,\n labelForEmptyItems,\n hasItems = true,\n form,\n isOpen,\n offset: offsetProp = 'none',\n renderItem,\n visibleItems,\n isLoading,\n getGroupLabel,\n notFound,\n itemsRefs,\n virtualScroll,\n onScrollToBottom,\n viewportRef,\n ...otherProps\n } = props;\n\n const indent = form === 'round' ? 'increased' : 'normal';\n\n const isListShowed = useMemo(() => {\n return (\n visibleItems.filter(\n (group) =>\n isOptionForCreate(group) ||\n (Array.isArray(group.items) && group.items.length > 0),\n ).length > 0\n );\n }, [visibleItems]);\n\n const offset = offsetProp === 'none' ? undefined : offsetProp;\n\n const lengthForVirtualScroll = useMemo(\n () => 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 && isOpen,\n onScrollToBottom,\n });\n\n const slice: [number, number] =\n sliceHookProp[0] === 0 && virtualScroll ? [0, 50] : sliceHookProp;\n\n const popoverRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useForkRef([scrollElementRef, dropdownRefProp]);\n const [scrolled, setScrolled] = useFlag();\n const setScrolledOffDebounce = useDebounce(setScrolled.off, 100);\n\n useEffect(() => {\n const fn = () => {\n setScrolled.on();\n setScrolledOffDebounce();\n };\n\n scrollElementRef.current?.addEventListener('scroll', fn);\n\n return () => {\n scrollElementRef.current?.removeEventListener('scroll', fn);\n };\n }, [scrollElementRef.current]);\n\n return (\n <Transition\n in={isOpen}\n unmountOnExit\n nodeRef={popoverRef}\n timeout={animateTimeout}\n >\n {(animate) => {\n const getIndex = fabricIndex();\n const getVirtualIndex = fabricIndex();\n\n return (\n <Popover\n {...otherProps}\n anchorRef={controlRef}\n direction=\"downStartLeft\"\n possibleDirections={[\n 'downStartLeft',\n 'upStartLeft',\n 'downStartRight',\n 'upStartRight',\n ]}\n offset={offset}\n ref={popoverRef}\n role=\"listbox\"\n className={cnSelectDropdown(null, [\n cnListBox({ size, form, border: true, shadow: true }),\n cnMixPopoverAnimate({ animate }),\n className,\n ])}\n equalAnchorWidth\n viewportRef={viewportRef}\n >\n <div\n className={cnSelectDropdown('ScrollContainer', [\n cnMixSpace({\n pV: mapVerticalSpace[size],\n }),\n cnMixScrollBar(),\n ])}\n ref={dropdownRef}\n >\n {isLoading && !isListShowed && <SelectLoader />}\n <div\n className={cnSelectDropdown('List', { scrolled })}\n style={{ marginTop: spaceTop }}\n >\n {visibleItems.map((group, groupIndex) => {\n if (isOptionForCreate(group)) {\n const index = getIndex();\n return (\n <SelectCreateButton\n size={size}\n labelForCreate={labelForCreate}\n inputValue={group.label}\n indent={indent}\n ref={itemsRefs[index]}\n {...getOptionProps({\n index,\n item: group,\n keyPrefix: groupIndex,\n })}\n />\n );\n }\n\n const virtualIndex =\n visibleItems.length > 1 ? getVirtualIndex() : 0;\n\n return (\n <Fragment key={group.key}>\n {group.group &&\n getGroupLabel &&\n isVisible(slice, virtualIndex) && (\n <SelectGroupLabel\n label={getGroupLabel(group.group)}\n size={size}\n indent={indent}\n ref={listRefs[virtualIndex]}\n key={`group-${group.key}`}\n />\n )}\n {group.items.map((item, i) => {\n if (isOptionForSelectAll(item)) {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n\n if (isVisible(slice, virtualIndex)) {\n return (\n <SelectItemAll\n ref={forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ])}\n indent={indent}\n size={size}\n {...getOptionProps({\n index,\n item,\n keyPrefix: i,\n })}\n intermediate={\n item.checkedCount && item.totalCount\n ? item.checkedCount !== item.totalCount\n : false\n }\n checked={item.checkedCount === item.totalCount}\n countItems={item.checkedCount}\n total={item.totalCount}\n />\n );\n }\n } else {\n const virtualIndex = getVirtualIndex();\n const index = getIndex();\n if (isVisible(slice, virtualIndex)) {\n return (\n <Fragment key={`${group.key}-${i}`}>\n {renderItem({\n ref: forkRef([\n listRefs[virtualIndex],\n itemsRefs[index],\n ]),\n item,\n ...getOptionProps({\n index,\n item,\n keyPrefix: i,\n }),\n })}\n </Fragment>\n );\n }\n }\n })}\n </Fragment>\n );\n })}\n {isLoading && isListShowed && (\n <ListLoader size={size} innerOffset={indent} />\n )}\n </div>\n {!isLoading && hasItems && notFound && labelForNotFound && (\n <ListItem\n size={size}\n label={labelForNotFound}\n innerOffset={indent}\n >\n {labelForNotFound}\n </ListItem>\n )}\n {!isLoading && !hasItems && labelForEmptyItems && (\n <ListItem\n size={size}\n label={labelForEmptyItems}\n innerOffset={indent}\n >\n {labelForEmptyItems}\n </ListItem>\n )}\n </div>\n </Popover>\n );\n }}\n </Transition>\n );\n};\n"],"mappings":"umCAAA,6BAEA,MAAOA,MAAP,EAAgBC,QAAhB,CAA0BC,SAA1B,CAAqCC,OAArC,CAA8CC,MAA9C,KAA4D,OAA5D,CACA,OAASC,UAAT,KAA2B,wBAA3B,CAEA,OACEC,SADF,CAEEC,QAFF,CAGEC,UAHF,CAIEC,gBAJF,wBAMA,OAASC,OAAT,qBACA,OAASC,WAAT,kCACA,OAASC,OAAT,8BACA,OAASC,OAAT,CAAkBC,UAAlB,iCACA,OAASC,gBAAT,uCACA,OACEC,cADF,CAEEC,mBAFF,yDAIA,OAASC,cAAT,kCACA,OAASC,UAAT,8BACA,OAASC,EAAT,0BACA,OAASC,WAAT,kCAIA,OAASC,kBAAT,gDACA,OAASC,gBAAT,4CACA,OAASC,aAAT,sCACA,OAASC,YAAT,oCAEA,OAEEC,oBAFF,CAGEC,iBAHF,CAIEC,oBAJF,oBASA,MAAO,IAAMC,mBAAkB,CAAG,CAAC,SAAD,CAAY,OAAZ,CAAqB,OAArB,CAA3B,CAEP,MAAO,IAAMC,8BAA6B,CAAGD,kBAAkB,CAAC,CAAD,CAAxD,C,GAuCDE,iBAAgB,CAAGX,EAAE,CAAC,gBAAD,C,CAErBY,iBAAiB,CAAG,SACxBC,CADwB,CAYrB,CAGH,OACQC,EADR,CAFIC,CAAM,CAAsB,CAAnB,EAAAF,CAAQ,CAACE,MAAT,CAAuB,CAAvB,CAA2BF,CAAQ,CAACE,MAEjD,CAASC,CAAK,CAAG,CAAjB,CAAoBA,CAAK,CAAGH,CAAQ,CAACE,MAArC,CAA6CC,CAAK,EAAlD,CACQF,CADR,CACkBD,CAAQ,CAACG,CAAD,CAD1B,CAGMV,oBAAoB,CAACQ,CAAD,CAApB,EAAiCA,CAAO,CAACG,KAAR,CAAcF,MAHrD,GAIIA,C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AK/B,CAAK,CAACgC,GAAX,aAAkBC,CAAlB,CAAb,EACG9C,CAAU,gBACTiD,GAAG,CAAE5F,OAAO,CAAC,CACX+D,CAAQ,CAACwB,CAAD,CADG,CAEXvC,CAAS,CAACzB,CAAD,CAFE,CAAD,CADH,CAKT8D,IAAI,CAAJA,CALS,EAMNtD,CAAc,CAAC,CAChBR,KAAK,CAALA,CADgB,CAEhB8D,IAAI,CAAJA,CAFgB,CAGhBC,SAAS,CAAEG,CAHK,CAAD,CANR,EADb,CAgBL,CACF,CApDA,CAZH,CAmEH,CA1FA,CAJH,CA+FG5C,CAAS,EAAIS,CAAb,EACC,oBAAC,UAAD,EAAY,IAAI,CAAExB,CAAlB,CAAwB,WAAW,CAAEuB,CAArC,EAhGJ,CAVF,CA6GG,CAACR,CAAD,EAAcP,CAAd,EAA0BS,CAA1B,EAAsCX,CAAtC,EACC,oBAAC,QAAD,EACE,IAAI,CAAEN,CADR,CAEE,KAAK,CAAEM,CAFT,CAGE,WAAW,CAAEiB,CAHf,EAKGjB,CALH,CA9GJ,CAsHG,CAACS,CAAD,EAAc,CAACP,CAAf,EAA2BD,CAA3B,EACC,oBAAC,QAAD,EACE,IAAI,CAAEP,CADR,CAEE,KAAK,CAAEO,CAFT,CAGE,WAAW,CAAEgB,CAHf,EAKGhB,CALH,CAvHJ,CArBF,CAuJH,CAlKH,CAqKH,CAnPM"}
@@ -6,7 +6,7 @@ export declare const tagBasePropSizeDefault: "m";
6
6
  export type TagBasePropSize = typeof tagBasePropSize[number];
7
7
  export declare const tagBasePropGroupNumberValue: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9];
8
8
  export declare const tagBasePropGroupStringValue: readonly ["1", "2", "3", "4", "5", "6", "7", "8", "9"];
9
- export declare const tagBasePropGroup: (1 | 4 | 2 | "1" | 3 | 5 | 9 | "2" | 7 | 6 | "3" | 8 | "4" | "5" | "6" | "7" | "8" | "9")[];
9
+ export declare const tagBasePropGroup: (1 | 4 | 2 | "1" | 3 | 5 | 9 | "2" | "3" | 7 | 6 | 8 | "4" | "5" | "6" | "7" | "8" | "9")[];
10
10
  export type TagBasePropGroup = typeof tagBasePropGroup[number];
11
11
  export declare const tagBasePropView: readonly ["stroked", "filled"];
12
12
  export declare const tagBasePropViewDefault: "stroked";
@@ -0,0 +1 @@
1
+ .TextAreaAutoSize{line-height:1.5;resize:none}.TextAreaAutoSize-Fake{word-wrap:break-word;height:0;left:-9999px;position:absolute;top:-9999px;visibility:hidden;white-space:pre-wrap}