@salutejs/plasma-new-hope 0.175.1-dev.0 → 0.175.2-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. package/cjs/components/Combobox/ComboboxNew/Combobox.js +27 -22
  2. package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  3. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +21 -0
  4. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +1 -0
  5. package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +9 -5
  6. package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  7. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  8. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  9. package/cjs/components/Select/Select.js +13 -25
  10. package/cjs/components/Select/Select.js.map +1 -1
  11. package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  12. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  13. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  14. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  15. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  16. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  17. package/cjs/components/Select/utils/getButtonLabel.js +1 -1
  18. package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
  19. package/cjs/components/Select/utils/getInitialValue.js +21 -0
  20. package/cjs/components/Select/utils/getInitialValue.js.map +1 -0
  21. package/cjs/components/Select/utils/initialItemsTransform.js +9 -6
  22. package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
  23. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +26 -22
  24. package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +20 -0
  25. package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +8 -1
  26. package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
  27. package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  28. package/emotion/cjs/components/Select/Select.js +12 -25
  29. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  30. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  31. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  32. package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
  33. package/emotion/cjs/components/Select/utils/getInitialValue.js +20 -0
  34. package/emotion/cjs/components/Select/utils/index.js +8 -1
  35. package/emotion/cjs/components/Select/utils/initialItemsTransform.js +19 -6
  36. package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +6 -0
  37. package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +6 -0
  38. package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +27 -23
  39. package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +14 -0
  40. package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +2 -1
  41. package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
  42. package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  43. package/emotion/es/components/Select/Select.js +13 -26
  44. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  45. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  46. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  47. package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
  48. package/emotion/es/components/Select/utils/getInitialValue.js +14 -0
  49. package/emotion/es/components/Select/utils/index.js +2 -1
  50. package/emotion/es/components/Select/utils/initialItemsTransform.js +19 -6
  51. package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +6 -0
  52. package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +6 -0
  53. package/es/components/Combobox/ComboboxNew/Combobox.js +27 -22
  54. package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  55. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +17 -0
  56. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +1 -0
  57. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +9 -5
  58. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  59. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  60. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  61. package/es/components/Select/Select.js +14 -26
  62. package/es/components/Select/Select.js.map +1 -1
  63. package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  64. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  65. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  66. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  67. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  68. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  69. package/es/components/Select/utils/getButtonLabel.js +1 -1
  70. package/es/components/Select/utils/getButtonLabel.js.map +1 -1
  71. package/es/components/Select/utils/getInitialValue.js +17 -0
  72. package/es/components/Select/utils/getInitialValue.js.map +1 -0
  73. package/es/components/Select/utils/initialItemsTransform.js +9 -6
  74. package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
  75. package/package.json +2 -2
  76. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +26 -22
  77. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +20 -0
  78. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +8 -1
  79. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
  80. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  81. package/styled-components/cjs/components/Select/Select.js +12 -25
  82. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  83. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  84. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  85. package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
  86. package/styled-components/cjs/components/Select/utils/getInitialValue.js +20 -0
  87. package/styled-components/cjs/components/Select/utils/index.js +8 -1
  88. package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +19 -6
  89. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +6 -0
  90. package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +6 -0
  91. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +27 -23
  92. package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +14 -0
  93. package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +2 -1
  94. package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +19 -5
  95. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  96. package/styled-components/es/components/Select/Select.js +13 -26
  97. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  98. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  99. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  100. package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
  101. package/styled-components/es/components/Select/utils/getInitialValue.js +14 -0
  102. package/styled-components/es/components/Select/utils/index.js +2 -1
  103. package/styled-components/es/components/Select/utils/initialItemsTransform.js +19 -6
  104. package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +6 -0
  105. package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +6 -0
  106. package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
  107. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +14 -3
  108. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
  109. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +4 -0
  110. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +1 -0
  111. package/types/components/Combobox/ComboboxNew/utils/index.d.ts +1 -0
  112. package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
  113. package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
  114. package/types/components/Select/Select.d.ts.map +1 -1
  115. package/types/components/Select/Select.types.d.ts +1 -0
  116. package/types/components/Select/Select.types.d.ts.map +1 -1
  117. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
  118. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  119. package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
  120. package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
  121. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
  122. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
  123. package/types/components/Select/utils/getInitialValue.d.ts +4 -0
  124. package/types/components/Select/utils/getInitialValue.d.ts.map +1 -0
  125. package/types/components/Select/utils/index.d.ts +1 -0
  126. package/types/components/Select/utils/index.d.ts.map +1 -1
  127. package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
  128. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +30 -6
  129. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
  130. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +30 -6
  131. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { forwardRef, useState, useReducer, useMemo, createContext, useLayoutEffect } from 'react';\n\nimport { RootProps } from '../../engines';\nimport { isEmpty, getPlacements } from '../../utils';\nimport { useOutsideClick } from '../../hooks';\n\nimport { useKeyNavigation } from './hooks/useKeyboardNavigation';\nimport { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';\nimport { Inner, Target } from './ui';\nimport { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';\nimport { usePathMaps } from './hooks/usePathMaps';\nimport { StyledPopover, Ul, base, OuterLabel, HelperText } from './Select.styles';\nimport type { ItemContext, MergedSelectProps } from './Select.types';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport type { MergedDropdownNodeTransformed } from './ui/Inner/ui/Item/Item.types';\n\nexport const Context = createContext<ItemContext>({} as ItemContext);\n\n/**\n * Выпадающий список. Поддерживает выбор одного или нескольких значений.\n */\nexport const selectRoot = (Root: RootProps<HTMLButtonElement, Omit<MergedSelectProps, 'items'>>) =>\n forwardRef<HTMLButtonElement, MergedSelectProps>((props, ref) => {\n const {\n value: outerValue,\n onChange: outerOnChange,\n target = 'textfield-like',\n items,\n placement = 'bottom',\n label,\n labelPlacement = 'outer',\n placeholder,\n helperText,\n disabled = false,\n view,\n size,\n listOverflow,\n listHeight,\n listWidth,\n contentLeft,\n onScrollBottom,\n chipView,\n variant = 'normal',\n portal,\n renderValue,\n renderItem,\n status,\n onItemSelect,\n separator,\n closeAfterSelect: outerCloseAfterSelect,\n ...rest\n } = props;\n\n const [internalValue, setInternalValue] = useState<string | number | Array<string | number>>(\n outerValue || props.multiselect ? [] : '',\n );\n\n const value = outerValue || internalValue;\n\n const onChange = (e: string | number | Array<string | number>) => {\n if (outerOnChange) {\n outerOnChange(e as any);\n }\n\n setInternalValue(e);\n };\n\n const transformedItems = useMemo(() => initialItemsTransform(items || []), [items]);\n\n const [pathMap, focusedToValueMap, valueToCheckedMap, valueToItemMap] = usePathMaps(transformedItems);\n\n const [path, dispatchPath] = useReducer(pathReducer, []);\n const [focusedPath, dispatchFocusedPath] = useReducer(focusedPathReducer, []);\n const [focusedChipIndex, dispatchFocusedChipIndex] = useReducer(focusedChipIndexReducer, null);\n const [checked, setChecked] = useState(valueToCheckedMap);\n\n const closeAfterSelect = outerCloseAfterSelect ?? !props.multiselect;\n\n const targetRef = useOutsideClick<HTMLDivElement>(() => {\n if (focusedChipIndex != null) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n });\n\n const handleToggle = (opened: boolean) => {\n if (opened) {\n dispatchPath({ type: 'opened_first_level' });\n } else {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n };\n\n const handleCheckboxChange = (item: MergedDropdownNodeTransformed) => {\n if (props.multiselect) {\n const checkedCopy = new Map(checked);\n\n if (!checkedCopy.get(item.value)) {\n checkedCopy.set(item.value, true);\n updateDescendants(item, checkedCopy, true);\n } else {\n checkedCopy.set(item.value, false);\n updateDescendants(item, checkedCopy, false);\n }\n\n updateAncestors(item, checkedCopy);\n\n const newValues: Array<string | number> = [];\n\n valueToItemMap.forEach((item, key) => {\n if (checkedCopy.get(key)) {\n newValues.push(item.value);\n }\n });\n\n if (closeAfterSelect) {\n dispatchPath({ type: 'reset' });\n dispatchFocusedPath({ type: 'reset' });\n }\n\n if (onChange) {\n onChange(newValues);\n }\n }\n };\n\n const handleItemClick = (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => {\n if (!isEmpty(item?.items)) {\n return;\n }\n\n if (props.multiselect) {\n handleCheckboxChange(item);\n } else {\n if (e) {\n e.stopPropagation();\n }\n\n const checkedCopy = new Map(checked);\n\n const isCurrentChecked = checkedCopy.get(item.value);\n\n checkedCopy.forEach((_, key) => {\n checkedCopy.set(key, false);\n });\n\n if (!isCurrentChecked) {\n checkedCopy.set(item.value, 'done');\n updateSingleAncestors(item, checkedCopy, 'dot');\n }\n\n if (closeAfterSelect) {\n dispatchPath({ type: 'reset' });\n dispatchFocusedPath({ type: 'reset' });\n }\n\n if (onChange) {\n onChange(isCurrentChecked ? '' : item.value);\n }\n\n if (onItemSelect) {\n onItemSelect(item, e!);\n }\n }\n };\n\n const handleChipClick = (currentValue: string) => {\n handleCheckboxChange(valueToItemMap.get(currentValue)!);\n };\n\n const handlePressDown = (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => {\n if (isEmpty(item.items)) {\n handleItemClick(item, e);\n } else if (props.multiselect) {\n handleCheckboxChange(item);\n }\n };\n\n const handleScroll = (e: React.UIEvent<HTMLUListElement>) => {\n if (!onScrollBottom) return;\n\n const { target } = e;\n\n if (\n (target as HTMLElement).scrollHeight - (target as HTMLElement).scrollTop ===\n (target as HTMLElement).clientHeight\n ) {\n onScrollBottom(e);\n }\n };\n\n const { onKeyDown } = useKeyNavigation({\n value,\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleToggle,\n handlePressDown,\n focusedChipIndex,\n dispatchFocusedChipIndex,\n valueToItemMap,\n multiselect: props.multiselect,\n isTargetAmount: props.isTargetAmount,\n });\n\n const isCurrentListOpen = Boolean(path[0]);\n\n // В данном эффекте мы следим за изменениями value и вносим коррективы в дерево чекбоксов.\n useLayoutEffect(() => {\n const checkedCopy = new Map(checked);\n\n checkedCopy.forEach((_, key) => {\n checkedCopy.set(key, false);\n });\n\n if (!isEmpty(value) || typeof value === 'number') {\n if (Array.isArray(value)) {\n value.forEach((val) => {\n checkedCopy.set(val, true);\n updateDescendants(valueToItemMap.get(val)!, checkedCopy, true);\n updateAncestors(valueToItemMap.get(val)!, checkedCopy);\n });\n } else {\n checkedCopy.set(value, 'done');\n updateSingleAncestors(valueToItemMap.get(value)!, checkedCopy, 'dot');\n }\n }\n\n setChecked(checkedCopy);\n }, [value]);\n\n return (\n <Root ref={ref} size={size} view={status ? getView(status) : view} chipView={chipView} {...(rest as any)}>\n {label && labelPlacement === 'outer' && target !== 'button-like' && <OuterLabel>{label}</OuterLabel>}\n <Context.Provider\n value={{\n focusedPath,\n checked,\n multiselect: props.multiselect,\n size,\n handleCheckboxChange,\n handleItemClick,\n variant,\n renderItem,\n valueToItemMap,\n }}\n >\n <StyledPopover\n ref={targetRef}\n opened={isCurrentListOpen}\n placement={getPlacements(placement)}\n usePortal={Boolean(portal)}\n frame={portal}\n onToggle={handleToggle}\n trigger=\"click\"\n target={\n <Target\n opened={isCurrentListOpen}\n value={value}\n valueToItemMap={valueToItemMap}\n focusedPath={focusedPath}\n focusedToValueMap={focusedToValueMap}\n onChipClick={handleChipClick}\n label={label}\n placeholder={placeholder}\n onKeyDown={onKeyDown}\n focusedChipIndex={focusedChipIndex}\n labelPlacement={labelPlacement}\n selectProps={props}\n size={size}\n contentLeft={contentLeft}\n disabled={disabled}\n renderValue={renderValue}\n />\n }\n preventOverflow={false}\n closeOnOverlayClick\n listWidth={listWidth}\n >\n {items && (\n <Root size={size} {...(rest as any)}>\n <Ul\n role=\"tree\"\n id=\"tree_level_1\"\n listHeight={listHeight}\n listOverflow={listOverflow}\n onScroll={handleScroll}\n listWidth={listWidth}\n >\n {transformedItems.map((item, index) => (\n <Inner\n key={`${index}/0`}\n item={item}\n currentLevel={0}\n path={path}\n dispatchPath={dispatchPath}\n index={index}\n listWidth={listWidth}\n />\n ))}\n </Ul>\n </Root>\n )}\n </StyledPopover>\n </Context.Provider>\n {helperText && target === 'textfield-like' && <HelperText>{helperText}</HelperText>}\n </Root>\n );\n });\n\nexport const selectConfig = {\n name: 'Select',\n tag: 'div',\n layout: selectRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n chipView: 'default',\n size: 'm',\n },\n};\n"],"names":["Context","createContext","selectRoot","Root","forwardRef","props","ref","outerValue","value","outerOnChange","onChange","_props$target","target","items","_props$placement","placement","label","_props$labelPlacement","labelPlacement","placeholder","helperText","_props$disabled","disabled","view","size","listOverflow","listHeight","listWidth","contentLeft","onScrollBottom","chipView","_props$variant","variant","portal","renderValue","renderItem","status","onItemSelect","outerCloseAfterSelect","closeAfterSelect","rest","_objectWithoutProperties","_excluded","_useState","useState","multiselect","_useState2","_slicedToArray","internalValue","setInternalValue","e","transformedItems","useMemo","initialItemsTransform","_usePathMaps","usePathMaps","_usePathMaps2","pathMap","focusedToValueMap","valueToCheckedMap","valueToItemMap","_useReducer","useReducer","pathReducer","_useReducer2","path","dispatchPath","_useReducer3","focusedPathReducer","_useReducer4","focusedPath","dispatchFocusedPath","_useReducer5","focusedChipIndexReducer","_useReducer6","focusedChipIndex","dispatchFocusedChipIndex","_useState3","_useState4","checked","setChecked","targetRef","useOutsideClick","type","handleToggle","opened","handleCheckboxChange","item","checkedCopy","Map","get","set","updateDescendants","updateAncestors","newValues","forEach","key","push","handleItemClick","isEmpty","stopPropagation","isCurrentChecked","_","updateSingleAncestors","handleChipClick","currentValue","handlePressDown","handleScroll","scrollHeight","scrollTop","clientHeight","_useKeyNavigation","useKeyNavigation","isTargetAmount","onKeyDown","isCurrentListOpen","Boolean","useLayoutEffect","Array","isArray","val","React","createElement","_extends","getView","OuterLabel","Provider","StyledPopover","getPlacements","usePortal","frame","onToggle","trigger","Target","onChipClick","selectProps","preventOverflow","closeOnOverlayClick","Ul","role","id","onScroll","map","index","Inner","concat","currentLevel","HelperText","selectConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAiBaA,OAAO,gBAAGC,mBAAa,CAAc,EAAiB,EAAC;;AAEpE;AACA;AACA;IACaC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAoE,EAAA;AAAA,EAAA,oBAC3FC,gBAAU,CAAuC,UAACC,KAAK,EAAEC,GAAG,EAAK;AAC7D,I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CAACsB,WAAK,EAAA;AACFhD,QAAAA,GAAG,EAAAiD,EAAAA,CAAAA,MAAA,CAAKF,KAAK,EAAK,IAAA,CAAA;AAClBxD,QAAAA,IAAI,EAAEA,IAAK;AACX2D,QAAAA,YAAY,EAAE,CAAE;AAChBjF,QAAAA,IAAI,EAAEA,IAAK;AACXC,QAAAA,YAAY,EAAEA,YAAa;AAC3B6E,QAAAA,KAAK,EAAEA,KAAM;AACbpH,QAAAA,SAAS,EAAEA,SAAAA;AAAU,OACxB,CAAC,CAAA;KACL,CACD,CACF,CAEC,CACD,CAAC,EAClBP,UAAU,IAAIR,MAAM,KAAK,gBAAgB,iBAAI6G,KAAA,CAAAC,aAAA,CAACyB,wBAAU,EAAE/H,IAAAA,EAAAA,UAAuB,CAChF,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAMgI,YAAY,GAAG;AACxBC,EAAAA,IAAI,EAAE,QAAQ;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAErJ,UAAU;AAClBsJ,EAAAA,IAAI,EAAJA,kBAAI;AACJC,EAAAA,UAAU,EAAE;AACRlI,IAAAA,IAAI,EAAE;AACFmI,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDnI,IAAAA,IAAI,EAAE;AACFkI,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNtI,IAAAA,IAAI,EAAE,SAAS;AACfO,IAAAA,QAAQ,EAAE,SAAS;AACnBN,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React, { forwardRef, useState, useReducer, useMemo, createContext, useLayoutEffect } from 'react';\n\nimport { RootProps } from '../../engines';\nimport { isEmpty, getPlacements } from '../../utils';\nimport { useOutsideClick } from '../../hooks';\n\nimport { useKeyNavigation } from './hooks/useKeyboardNavigation';\nimport {\n initialItemsTransform,\n updateAncestors,\n updateDescendants,\n updateSingleAncestors,\n getView,\n getInitialValue,\n} from './utils';\nimport { Inner, Target } from './ui';\nimport { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';\nimport { usePathMaps } from './hooks/usePathMaps';\nimport { StyledPopover, Ul, base, OuterLabel, HelperText } from './Select.styles';\nimport type { ItemContext, MergedSelectProps } from './Select.types';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as sizeCSS } from './variations/_size/base';\nimport type { MergedDropdownNodeTransformed } from './ui/Inner/ui/Item/Item.types';\n\nexport const Context = createContext<ItemContext>({} as ItemContext);\n\n/**\n * Выпадающий список. Поддерживает выбор одного или нескольких значений.\n */\nexport const selectRoot = (Root: RootProps<HTMLButtonElement, Omit<MergedSelectProps, 'items'>>) =>\n forwardRef<HTMLButtonElement, MergedSelectProps>((props, ref) => {\n const {\n value: outerValue,\n onChange: outerOnChange,\n target = 'textfield-like',\n items,\n placement = 'bottom',\n label,\n labelPlacement = 'outer',\n placeholder,\n helperText,\n disabled = false,\n view,\n size,\n listOverflow,\n listHeight,\n listWidth,\n contentLeft,\n onScrollBottom,\n chipView,\n variant = 'normal',\n portal,\n renderValue,\n renderItem,\n status,\n onItemSelect,\n separator,\n closeAfterSelect: outerCloseAfterSelect,\n ...rest\n } = props;\n\n const transformedItems = useMemo(() => initialItemsTransform(items || []), [items]);\n const [pathMap, focusedToValueMap, valueToCheckedMap, valueToItemMap] = usePathMaps(transformedItems);\n\n const value = getInitialValue(outerValue, valueToItemMap);\n\n const onChange = (e: string | number | Array<string | number>) => {\n if (outerOnChange) {\n outerOnChange(e as any);\n }\n };\n\n const [path, dispatchPath] = useReducer(pathReducer, []);\n const [focusedPath, dispatchFocusedPath] = useReducer(focusedPathReducer, []);\n const [focusedChipIndex, dispatchFocusedChipIndex] = useReducer(focusedChipIndexReducer, null);\n const [checked, setChecked] = useState(valueToCheckedMap);\n\n const closeAfterSelect = outerCloseAfterSelect ?? !props.multiselect;\n\n const targetRef = useOutsideClick<HTMLDivElement>(() => {\n if (focusedChipIndex != null) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n });\n\n const handleToggle = (opened: boolean) => {\n if (opened) {\n dispatchPath({ type: 'opened_first_level' });\n } else {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n };\n\n const handleCheckboxChange = (item: MergedDropdownNodeTransformed) => {\n if (props.multiselect) {\n const checkedCopy = new Map(checked);\n\n if (!checkedCopy.get(item.value)) {\n checkedCopy.set(item.value, true);\n updateDescendants(item, checkedCopy, true);\n } else {\n checkedCopy.set(item.value, false);\n updateDescendants(item, checkedCopy, false);\n }\n\n updateAncestors(item, checkedCopy);\n\n const newValues: Array<string | number> = [];\n\n valueToItemMap.forEach((item, key) => {\n if (checkedCopy.get(key)) {\n newValues.push(item.value);\n }\n });\n\n if (closeAfterSelect) {\n dispatchPath({ type: 'reset' });\n dispatchFocusedPath({ type: 'reset' });\n }\n\n if (onChange) {\n onChange(newValues);\n }\n }\n };\n\n const handleItemClick = (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => {\n if (!isEmpty(item?.items)) {\n return;\n }\n\n if (props.multiselect) {\n handleCheckboxChange(item);\n } else {\n if (e) {\n e.stopPropagation();\n }\n\n const isCurrentChecked = checked.get(item.value);\n\n if (closeAfterSelect) {\n dispatchPath({ type: 'reset' });\n dispatchFocusedPath({ type: 'reset' });\n }\n\n if (onChange) {\n onChange(isCurrentChecked ? '' : item.value);\n }\n\n if (onItemSelect) {\n onItemSelect(item, e!);\n }\n }\n };\n\n const handleChipClick = (currentValue: string) => {\n handleCheckboxChange(valueToItemMap.get(currentValue)!);\n };\n\n const handlePressDown = (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => {\n if (isEmpty(item.items)) {\n handleItemClick(item, e);\n } else if (props.multiselect) {\n handleCheckboxChange(item);\n }\n };\n\n const handleScroll = (e: React.UIEvent<HTMLUListElement>) => {\n if (!onScrollBottom) return;\n\n const { target } = e;\n\n if (\n (target as HTMLElement).scrollHeight - (target as HTMLElement).scrollTop ===\n (target as HTMLElement).clientHeight\n ) {\n onScrollBottom(e);\n }\n };\n\n const { onKeyDown } = useKeyNavigation({\n value,\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleToggle,\n handlePressDown,\n focusedChipIndex,\n dispatchFocusedChipIndex,\n valueToItemMap,\n multiselect: props.multiselect,\n isTargetAmount: props.isTargetAmount,\n });\n\n const isCurrentListOpen = Boolean(path[0]);\n\n // В данном эффекте мы следим за изменениями value и вносим коррективы в дерево чекбоксов.\n useLayoutEffect(() => {\n const checkedCopy = new Map(checked);\n\n checkedCopy.forEach((_, key) => {\n checkedCopy.set(key, false);\n });\n\n if (!isEmpty(value) || typeof value === 'number') {\n if (Array.isArray(value)) {\n value.forEach((val) => {\n checkedCopy.set(val, true);\n updateDescendants(valueToItemMap.get(val)!, checkedCopy, true);\n updateAncestors(valueToItemMap.get(val)!, checkedCopy);\n });\n } else {\n checkedCopy.set(value, 'done');\n updateSingleAncestors(valueToItemMap.get(value)!, checkedCopy, 'dot');\n }\n }\n\n setChecked(checkedCopy);\n }, [outerValue, items]);\n\n return (\n <Root ref={ref} size={size} view={status ? getView(status) : view} chipView={chipView} {...(rest as any)}>\n {label && labelPlacement === 'outer' && target !== 'button-like' && <OuterLabel>{label}</OuterLabel>}\n <Context.Provider\n value={{\n focusedPath,\n checked,\n multiselect: props.multiselect,\n size,\n handleCheckboxChange,\n handleItemClick,\n variant,\n renderItem,\n valueToItemMap,\n }}\n >\n <StyledPopover\n ref={targetRef}\n opened={isCurrentListOpen}\n placement={getPlacements(placement)}\n usePortal={Boolean(portal)}\n frame={portal}\n onToggle={handleToggle}\n trigger=\"click\"\n target={\n <Target\n opened={isCurrentListOpen}\n value={value}\n valueToItemMap={valueToItemMap}\n focusedPath={focusedPath}\n focusedToValueMap={focusedToValueMap}\n onChipClick={handleChipClick}\n label={label}\n placeholder={placeholder}\n onKeyDown={onKeyDown}\n focusedChipIndex={focusedChipIndex}\n labelPlacement={labelPlacement}\n selectProps={props}\n size={size}\n contentLeft={contentLeft}\n disabled={disabled}\n renderValue={renderValue}\n />\n }\n preventOverflow={false}\n closeOnOverlayClick\n listWidth={listWidth}\n >\n {items && (\n <Root size={size} {...(rest as any)}>\n <Ul\n role=\"tree\"\n id=\"tree_level_1\"\n listHeight={listHeight}\n listOverflow={listOverflow}\n onScroll={handleScroll}\n listWidth={listWidth}\n >\n {transformedItems.map((item, index) => (\n <Inner\n key={`${index}/0`}\n item={item}\n currentLevel={0}\n path={path}\n dispatchPath={dispatchPath}\n index={index}\n listWidth={listWidth}\n />\n ))}\n </Ul>\n </Root>\n )}\n </StyledPopover>\n </Context.Provider>\n\n {helperText && target === 'textfield-like' && <HelperText>{helperText}</HelperText>}\n </Root>\n );\n });\n\nexport const selectConfig = {\n name: 'Select',\n tag: 'div',\n layout: selectRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n },\n defaults: {\n view: 'default',\n chipView: 'default',\n size: 'm',\n },\n};\n"],"names":["Context","createContext","selectRoot","Root","forwardRef","props","ref","outerValue","value","outerOnChange","onChange","_props$target","target","items","_props$placement","placement","label","_props$labelPlacement","labelPlacement","placeholder","helperText","_props$disabled","disabled","view","size","listOverflow","listHeight","listWidth","contentLeft","onScrollBottom","chipView","_props$variant","variant","portal","renderValue","renderItem","status","onItemSelect","outerCloseAfterSelect","closeAfterSelect","rest","_objectWithoutProperties","_excluded","transformedItems","useMemo","initialItemsTransform","_usePathMaps","usePathMaps","_usePathMaps2","_slicedToArray","pathMap","focusedToValueMap","valueToCheckedMap","valueToItemMap","getInitialValue","e","_useReducer","useReducer","pathReducer","_useReducer2","path","dispatchPath","_useReducer3","focusedPathReducer","_useReducer4","focusedPath","dispatchFocusedPath","_useReducer5","focusedChipIndexReducer","_useReducer6","focusedChipIndex","dispatchFocusedChipIndex","_useState","useState","_useState2","checked","setChecked","multiselect","targetRef","useOutsideClick","type","handleToggle","opened","handleCheckboxChange","item","checkedCopy","Map","get","set","updateDescendants","updateAncestors","newValues","forEach","key","push","handleItemClick","isEmpty","stopPropagation","isCurrentChecked","handleChipClick","currentValue","handlePressDown","handleScroll","scrollHeight","scrollTop","clientHeight","_useKeyNavigation","useKeyNavigation","isTargetAmount","onKeyDown","isCurrentListOpen","Boolean","useLayoutEffect","_","Array","isArray","val","updateSingleAncestors","React","createElement","_extends","getView","OuterLabel","Provider","StyledPopover","getPlacements","usePortal","frame","onToggle","trigger","Target","onChipClick","selectProps","preventOverflow","closeOnOverlayClick","Ul","role","id","onScroll","map","index","Inner","concat","currentLevel","HelperText","selectConfig","name","tag","layout","base","variations","css","viewCSS","sizeCSS","defaults"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBaA,OAAO,gBAAGC,mBAAa,CAAc,EAAiB,EAAC;;AAEpE;AACA;AACA;IACaC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAoE,EAAA;AAAA,EAAA,oBAC3FC,gBAAU,CAAuC,UAACC,KAAK,EAAEC,GAAG,EAAK;AAC7D,IAAA,IACWC,UAAU,GA2BjBF,KAAK,CA3BLG,KAAK,CAAA;MACKC,aAAa,GA0BvBJ,KAAK,CA1BLK,QAAQ,CAAA;MAAAC,aAAA,GA0BRN,KAAK,CAzBLO,MAAM,CAAA;AAANA,MAAAA,MAAM,GAAAD,aAAA,KAAG,KAAA,CAAA,GAAA,gBAAgB,GAAAA,aAAA,CAAA;MACzBE,KAAK,GAwBLR,KAAK,CAxBLQ,KAAK,CAAA;MAAAC,gBAAA,GAwBLT,KAAK,CAvBLU,SAAS,CAAA;AAATA,MAAAA,SAAS,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,gBAAA,CAAA;MACpBE,KAAK,GAsBLX,KAAK,C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,KAAK,EAAA;AAAA,MAAA,oBAC9BtB,KAAA,CAAAC,aAAA,CAACsB,WAAK,EAAA;AACFhD,QAAAA,GAAG,EAAAiD,EAAAA,CAAAA,MAAA,CAAKF,KAAK,EAAK,IAAA,CAAA;AAClBxD,QAAAA,IAAI,EAAEA,IAAK;AACX2D,QAAAA,YAAY,EAAE,CAAE;AAChBnF,QAAAA,IAAI,EAAEA,IAAK;AACXC,QAAAA,YAAY,EAAEA,YAAa;AAC3B+E,QAAAA,KAAK,EAAEA,KAAM;AACbjH,QAAAA,SAAS,EAAEA,SAAAA;AAAU,OACxB,CAAC,CAAA;KACL,CACD,CACF,CAEC,CACD,CAAC,EAElBP,UAAU,IAAIR,MAAM,KAAK,gBAAgB,iBAAI0G,KAAA,CAAAC,aAAA,CAACyB,wBAAU,EAAE5H,IAAAA,EAAAA,UAAuB,CAChF,CAAC,CAAA;AAEf,GAAC,CAAC,CAAA;AAAA,EAAA;AAEC,IAAM6H,YAAY,GAAG;AACxBC,EAAAA,IAAI,EAAE,QAAQ;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAElJ,UAAU;AAClBmJ,EAAAA,IAAI,EAAJA,kBAAI;AACJC,EAAAA,UAAU,EAAE;AACR/H,IAAAA,IAAI,EAAE;AACFgI,MAAAA,GAAG,EAAEC,SAAAA;KACR;AACDhI,IAAAA,IAAI,EAAE;AACF+H,MAAAA,GAAG,EAAEE,WAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACNnI,IAAAA,IAAI,EAAE,SAAS;AACfO,IAAAA,QAAQ,EAAE,SAAS;AACnBN,IAAAA,IAAI,EAAE,GAAA;AACV,GAAA;AACJ;;;;;;"}
@@ -157,7 +157,7 @@ var useKeyNavigation = function useKeyNavigation(_ref) {
157
157
  }
158
158
  case keys.Backspace:
159
159
  {
160
- if (!multiselect) break;
160
+ if (!multiselect || !Array.isArray(value)) break;
161
161
  if (focusedChipIndex !== null) {
162
162
  var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
163
163
  handlePressDown(_currentItem);
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyboardNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyboardNavigation.ts"],"sourcesContent":["import type { KeyboardEvent, Dispatch } from 'react';\nimport React from 'react';\n\nimport {\n PathAction,\n PathState,\n FocusedPathAction,\n FocusedPathState,\n FocusedChipIndexState,\n FocusedChipIndexAction,\n} from '../reducers';\nimport { SelectProps } from '../Select.types';\nimport type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\nimport { PathMapType, FocusedToValueMapType, ValueToItemMapType } from './usePathMaps';\n\nconst JUMP_SIZE = 10;\n\nexport const keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n Backspace: 'Backspace',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n};\n\nconst getFurtherPath = (focusedPath: FocusedPathState, focusedToValueMap: FocusedToValueMapType) => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n\n return focusedToValueMap.get(focusedPathAsString);\n};\n\ntype Props = {\n focusedPath: FocusedPathState;\n dispatchFocusedPath: Dispatch<FocusedPathAction>;\n path: PathState;\n dispatchPath: Dispatch<PathAction>;\n pathMap: PathMapType;\n focusedToValueMap: FocusedToValueMapType;\n handleToggle: (opened: boolean) => void;\n handlePressDown: (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => void;\n focusedChipIndex: FocusedChipIndexState;\n dispatchFocusedChipIndex: Dispatch<FocusedChipIndexAction>;\n value: string | string[];\n valueToItemMap: ValueToItemMapType;\n multiselect: SelectProps['multiselect'];\n isTargetAmount: SelectProps['isTargetAmount'];\n};\n\ntype ReturnedProps = {\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n};\n\nexport const useKeyNavigation = ({\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleToggle,\n handlePressDown,\n focusedChipIndex,\n dispatchFocusedChipIndex,\n value,\n valueToItemMap,\n multiselect,\n isTargetAmount,\n}: Props): ReturnedProps => {\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n const currentLength: number = pathMap.get(path?.[focusedPath.length - 1]) || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case keys.ArrowUp: {\n if (focusedPath.length) {\n if (currentIndex > 0) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleToggle(true);\n }\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n break;\n }\n\n case keys.ArrowDown: {\n if (focusedPath.length) {\n if (currentIndex + 1 < currentLength) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleToggle(true);\n }\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n break;\n }\n\n case keys.ArrowLeft: {\n if (path[0]) {\n if (focusedPath.length) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n } else {\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n }\n\n if (path.length === 1) {\n handleToggle(false);\n }\n } else if (Array.isArray(value) && !isTargetAmount) {\n dispatchFocusedChipIndex({ type: 'moveLeft' });\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (path[0]) {\n if (!focusedPath.length) {\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n }\n } else if (Array.isArray(value) && !isTargetAmount) {\n dispatchFocusedChipIndex({ type: 'moveRight', total: value.length });\n }\n\n break;\n }\n\n case keys.Backspace: {\n if (!multiselect) break;\n\n if (focusedChipIndex !== null) {\n const currentItem = valueToItemMap.get(value[focusedChipIndex])!;\n\n handlePressDown(currentItem);\n\n if (value.length === 1) {\n dispatchFocusedChipIndex({ type: 'reset' });\n\n break;\n }\n\n if (focusedChipIndex === value.length - 1) {\n dispatchFocusedChipIndex({ type: 'moveLeft' });\n\n break;\n }\n }\n\n break;\n }\n\n case keys.Space: {\n event.preventDefault();\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (!currentItem || currentItem?.disabled) {\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Enter: {\n event.preventDefault();\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap)!;\n\n if (currentItem?.disabled) {\n break;\n }\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Tab:\n case keys.Escape: {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n dispatchFocusedChipIndex({ type: 'reset' });\n handleToggle(false);\n\n break;\n }\n\n case keys.Home: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n\n handleToggle(true);\n }\n\n break;\n }\n\n case keys.End: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'change_last_focus', value: (pathMap.get('root') || 0) - 1 });\n\n handleToggle(true);\n }\n\n break;\n }\n\n case keys.PageUp: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - JUMP_SIZE });\n }\n\n break;\n }\n\n case keys.PageDown: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentLength - currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + JUMP_SIZE });\n }\n\n break;\n }\n\n default: {\n break;\n }\n }\n };\n\n return { onKeyDown };\n};\n"],"names":["JUMP_SIZE","keys","Enter","Space","Tab","Escape","Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","getFurtherPath","focusedPath","focusedToValueMap","focusedPathAsString","reduce","acc","n","concat","replace","get","useKeyNavigation","_ref","dispatchFocusedPath","path","dispatchPath","pathMap","handleToggle","handlePressDown","focusedChipIndex","dispatchFocusedChipIndex","value","valueToItemMap","multiselect","isTargetAmount","currentIndex","length","currentLength","onKeyDown","event","code","type","Array","isArray","currentItem","items","toString","total","preventDefault","disabled"],"mappings":";;;;AAgBA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACd,EAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,WAA6B,EAAEC,iBAAwC,EAAK;EAChG,IAAMC,mBAAmB,GAAGF,WAAW,CAACG,MAAM,CAAC,UAACC,GAAG,EAAEC,CAAC,EAAA;AAAA,IAAA,OAAA,EAAA,CAAAC,MAAA,CAAQF,GAAG,EAAAE,GAAAA,CAAAA,CAAAA,MAAA,CAAID,CAAC,CAAA,CAAA;GAAE,EAAE,EAAE,CAAC,CAACE,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;AAElG,EAAA,OAAON,iBAAiB,CAACO,GAAG,CAACN,mBAAmB,CAAC,CAAA;AACrD,CAAC,CAAA;IAuBYO,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAAC,IAAA,EAeD;AAAA,EAAA,IAdxBV,WAAW,GAAAU,IAAA,CAAXV,WAAW;IACXW,mBAAmB,GAAAD,IAAA,CAAnBC,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F,YAAY,IAAIvC,SAAS,EAAE;AAC3C2B,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEM,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHd,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEI,YAAY,GAAGvC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;AAKJ,KAAA;GACH,CAAA;EAED,OAAO;AAAE0C,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACxB;;;;;"}
1
+ {"version":3,"file":"useKeyboardNavigation.js","sources":["../../../../src/components/Select/hooks/useKeyboardNavigation.ts"],"sourcesContent":["import type { KeyboardEvent, Dispatch } from 'react';\nimport React from 'react';\n\nimport {\n PathAction,\n PathState,\n FocusedPathAction,\n FocusedPathState,\n FocusedChipIndexState,\n FocusedChipIndexAction,\n} from '../reducers';\nimport { SelectProps, DefaultValueType } from '../Select.types';\nimport type { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\nimport { PathMapType, FocusedToValueMapType, ValueToItemMapType } from './usePathMaps';\n\nconst JUMP_SIZE = 10;\n\nexport const keys = {\n Enter: 'Enter',\n Space: 'Space',\n Tab: 'Tab',\n Escape: 'Escape',\n Backspace: 'Backspace',\n ArrowLeft: 'ArrowLeft',\n ArrowRight: 'ArrowRight',\n ArrowUp: 'ArrowUp',\n ArrowDown: 'ArrowDown',\n Home: 'Home',\n End: 'End',\n PageUp: 'PageUp',\n PageDown: 'PageDown',\n};\n\nconst getFurtherPath = (focusedPath: FocusedPathState, focusedToValueMap: FocusedToValueMapType) => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n\n return focusedToValueMap.get(focusedPathAsString);\n};\n\ntype Props = {\n focusedPath: FocusedPathState;\n dispatchFocusedPath: Dispatch<FocusedPathAction>;\n path: PathState;\n dispatchPath: Dispatch<PathAction>;\n pathMap: PathMapType;\n focusedToValueMap: FocusedToValueMapType;\n handleToggle: (opened: boolean) => void;\n handlePressDown: (item: MergedDropdownNodeTransformed, e?: React.MouseEvent<HTMLElement>) => void;\n focusedChipIndex: FocusedChipIndexState;\n dispatchFocusedChipIndex: Dispatch<FocusedChipIndexAction>;\n value: DefaultValueType;\n valueToItemMap: ValueToItemMapType;\n multiselect: SelectProps['multiselect'];\n isTargetAmount: SelectProps['isTargetAmount'];\n};\n\ntype ReturnedProps = {\n onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;\n};\n\nexport const useKeyNavigation = ({\n focusedPath,\n dispatchFocusedPath,\n path,\n dispatchPath,\n pathMap,\n focusedToValueMap,\n handleToggle,\n handlePressDown,\n focusedChipIndex,\n dispatchFocusedChipIndex,\n value,\n valueToItemMap,\n multiselect,\n isTargetAmount,\n}: Props): ReturnedProps => {\n const currentIndex: number = focusedPath?.[focusedPath.length - 1] || 0;\n const currentLength: number = pathMap.get(path?.[focusedPath.length - 1]) || 0;\n\n const onKeyDown = (event: KeyboardEvent<HTMLElement>) => {\n switch (event.code) {\n case keys.ArrowUp: {\n if (focusedPath.length) {\n if (currentIndex > 0) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleToggle(true);\n }\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n break;\n }\n\n case keys.ArrowDown: {\n if (focusedPath.length) {\n if (currentIndex + 1 < currentLength) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + 1 });\n }\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n handleToggle(true);\n }\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n break;\n }\n\n case keys.ArrowLeft: {\n if (path[0]) {\n if (focusedPath.length) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n } else {\n dispatchFocusedPath({ type: 'return_prev_focus' });\n }\n }\n\n if (path.length === 1) {\n handleToggle(false);\n }\n } else if (Array.isArray(value) && !isTargetAmount) {\n dispatchFocusedChipIndex({ type: 'moveLeft' });\n }\n\n break;\n }\n\n case keys.ArrowRight: {\n if (path[0]) {\n if (!focusedPath.length) {\n break;\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n }\n } else if (Array.isArray(value) && !isTargetAmount) {\n dispatchFocusedChipIndex({ type: 'moveRight', total: value.length });\n }\n\n break;\n }\n\n case keys.Backspace: {\n if (!multiselect || !Array.isArray(value)) break;\n\n if (focusedChipIndex !== null) {\n const currentItem = valueToItemMap.get(value[focusedChipIndex])!;\n\n handlePressDown(currentItem);\n\n if (value.length === 1) {\n dispatchFocusedChipIndex({ type: 'reset' });\n\n break;\n }\n\n if (focusedChipIndex === value.length - 1) {\n dispatchFocusedChipIndex({ type: 'moveLeft' });\n\n break;\n }\n }\n\n break;\n }\n\n case keys.Space: {\n event.preventDefault();\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap);\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (!currentItem || currentItem?.disabled) {\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Enter: {\n event.preventDefault();\n\n if (Array.isArray(value)) {\n dispatchFocusedChipIndex({ type: 'reset' });\n }\n\n const currentItem = getFurtherPath(focusedPath, focusedToValueMap)!;\n\n if (currentItem?.disabled) {\n break;\n }\n\n if (!path[0]) {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n break;\n }\n\n if (currentItem?.items) {\n if (path.length > focusedPath.length) {\n dispatchFocusedPath({ type: 'add_focus', value: 0 });\n } else {\n dispatchPath({ type: 'added_next_level', value: currentItem.value.toString() });\n }\n\n break;\n }\n\n handlePressDown(currentItem);\n\n break;\n }\n\n case keys.Tab:\n case keys.Escape: {\n dispatchFocusedPath({ type: 'reset' });\n dispatchPath({ type: 'reset' });\n dispatchFocusedChipIndex({ type: 'reset' });\n handleToggle(false);\n\n break;\n }\n\n case keys.Home: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'set_initial_focus' });\n\n handleToggle(true);\n }\n\n break;\n }\n\n case keys.End: {\n if (path[0]) {\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchPath({ type: 'opened_first_level' });\n dispatchFocusedPath({ type: 'change_last_focus', value: (pathMap.get('root') || 0) - 1 });\n\n handleToggle(true);\n }\n\n break;\n }\n\n case keys.PageUp: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: 0 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex - JUMP_SIZE });\n }\n\n break;\n }\n\n case keys.PageDown: {\n if (!path[0]) {\n break;\n }\n\n if (path.length > focusedPath.length) {\n dispatchPath({ type: 'removed_last_level' });\n }\n\n if (currentLength - currentIndex <= JUMP_SIZE) {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentLength - 1 });\n } else {\n dispatchFocusedPath({ type: 'change_last_focus', value: currentIndex + JUMP_SIZE });\n }\n\n break;\n }\n\n default: {\n break;\n }\n }\n };\n\n return { onKeyDown };\n};\n"],"names":["JUMP_SIZE","keys","Enter","Space","Tab","Escape","Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","getFurtherPath","focusedPath","focusedToValueMap","focusedPathAsString","reduce","acc","n","concat","replace","get","useKeyNavigation","_ref","dispatchFocusedPath","path","dispatchPath","pathMap","handleToggle","handlePressDown","focusedChipIndex","dispatchFocusedChipIndex","value","valueToItemMap","multiselect","isTargetAmount","currentIndex","length","currentLength","onKeyDown","event","code","type","Array","isArray","currentItem","items","toString","total","preventDefault","disabled"],"mappings":";;;;AAgBA,IAAMA,SAAS,GAAG,EAAE,CAAA;AAEb,IAAMC,IAAI,GAAG;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAA;AACd,EAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,WAA6B,EAAEC,iBAAwC,EAAK;EAChG,IAAMC,mBAAmB,GAAGF,WAAW,CAACG,MAAM,CAAC,UAACC,GAAG,EAAEC,CAAC,EAAA;AAAA,IAAA,O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AAE,mBAAmB;cAAEV,KAAK,EAAEI,YAAY,GAAGvC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;MAEA,KAAKC,IAAI,CAACa,QAAQ;AAAE,QAAA;AAChB,UAAA,IAAI,CAACc,IAAI,CAAC,CAAC,CAAC,EAAE;AACV,YAAA,MAAA;AACJ,WAAA;AAEA,UAAA,IAAIA,IAAI,CAACY,MAAM,GAAGxB,WAAW,CAACwB,MAAM,EAAE;AAClCX,YAAAA,YAAY,CAAC;AAAEgB,cAAAA,IAAI,EAAE,oBAAA;AAAqB,aAAC,CAAC,CAAA;AAChD,WAAA;AAEA,UAAA,IAAIJ,aAAa,GAAGF,YAAY,IAAIvC,SAAS,EAAE;AAC3C2B,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEM,aAAa,GAAG,CAAA;AAAE,aAAC,CAAC,CAAA;AAChF,WAAC,MAAM;AACHd,YAAAA,mBAAmB,CAAC;AAAEkB,cAAAA,IAAI,EAAE,mBAAmB;cAAEV,KAAK,EAAEI,YAAY,GAAGvC,SAAAA;AAAU,aAAC,CAAC,CAAA;AACvF,WAAA;AAEA,UAAA,MAAA;AACJ,SAAA;AAKJ,KAAA;GACH,CAAA;EAED,OAAO;AAAE0C,IAAAA,SAAS,EAATA,SAAAA;GAAW,CAAA;AACxB;;;;;"}
@@ -40,7 +40,7 @@ var getLabel = function getLabel(_ref) {
40
40
  text: renderValue ? renderValue(valueToItemMap.get(currentValue)) : itemLabel,
41
41
  onClick: function onClick(e) {
42
42
  e.stopPropagation();
43
- onChipClick(currentValue);
43
+ onChipClick(currentValue.toString());
44
44
  },
45
45
  focused: focusedChipIndex === index
46
46
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Textfield.js","sources":["../../../../../../../src/components/Select/ui/Target/ui/Textfield/Textfield.tsx"],"sourcesContent":["import React from 'react';\n\nimport { cx, isEmpty } from '../../../../../../utils';\nimport { classes } from '../../../../Select.tokens';\nimport { sizeToIconSize } from '../../../../utils';\n\nimport { TextfieldProps, GetTextfieldLabelProps } from './Textfield.types';\nimport { Chip } from './ui';\nimport {\n StyledButton,\n StyledArrow,\n Wrapper,\n ChipWrapper,\n TextfieldWrapper,\n IconArrowWrapper,\n Label,\n Placeholder,\n InnerLabel,\n InnerLabelWrapper,\n ContentLeftWrapper,\n Value,\n} from './Textfield.styles';\n\nconst getLabel = ({\n value,\n isTargetAmount,\n valueToItemMap,\n onChipClick,\n label,\n placeholder,\n focusedChipIndex,\n labelPlacement,\n size,\n renderValue,\n}: GetTextfieldLabelProps) => {\n if (isEmpty(value) && typeof value !== 'number') {\n if (!label || labelPlacement === 'outer') {\n return <Placeholder>{placeholder}</Placeholder>;\n }\n\n return <Label>{label}</Label>;\n }\n\n if (Array.isArray(value) && isTargetAmount) {\n return <Chip text={`Выбрано: ${value.length}`} isTargetAmount={isTargetAmount} />;\n }\n\n if (Array.isArray(value)) {\n return value.map((currentValue, index) => {\n const itemLabel = valueToItemMap.get(currentValue)!.label;\n\n return (\n <Chip\n text={renderValue ? renderValue(valueToItemMap.get(currentValue)!) : itemLabel}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n onChipClick(currentValue);\n }}\n focused={focusedChipIndex === index}\n />\n );\n });\n }\n\n const itemLabel = valueToItemMap.get(value)!.label;\n\n if (!label || labelPlacement === 'outer') {\n return <Value>{renderValue ? renderValue(valueToItemMap.get(value)!) : itemLabel}</Value>;\n }\n\n return (\n <InnerLabelWrapper>\n {size !== 'xs' && <InnerLabel>{label}</InnerLabel>}\n <Value>{renderValue ? renderValue(valueToItemMap.get(value)!) : itemLabel}</Value>\n </InnerLabelWrapper>\n );\n};\n\nexport const Textfield: React.FC<TextfieldProps> = ({\n opened,\n value,\n valueToItemMap,\n onChipClick,\n label,\n placeholder,\n onKeyDown,\n focusedChipIndex,\n labelPlacement,\n size,\n contentLeft,\n disabled,\n renderValue,\n focusedPath,\n focusedToValueMap,\n selectProps,\n}) => {\n const withArrowInverse = opened ? classes.arrowInverse : undefined;\n\n const getActiveDescendant = () => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n return focusedToValueMap?.get(focusedPathAsString)?.value.toString();\n };\n\n return (\n <TextfieldWrapper opened={opened} value={value}>\n <StyledButton\n stretching=\"filled\"\n className={cx(\n classes.textfieldTarget,\n opened || focusedChipIndex !== null ? classes.selectWithoutBoxShadow : undefined,\n )}\n onKeyDown={onKeyDown}\n disabled={disabled}\n role=\"combobox\"\n aria-controls=\"tree_level_1\"\n aria-expanded={opened}\n aria-activedescendant={getActiveDescendant()}\n aria-label={label}\n renderTarget={Boolean(selectProps.renderTarget)}\n >\n <Wrapper>\n {selectProps?.renderTarget ? (\n selectProps.renderTarget(\n Array.isArray(value)\n ? value.map((value) => valueToItemMap.get(value)!)\n : valueToItemMap.get(value)!,\n )\n ) : (\n <>\n {contentLeft && (!selectProps.multiselect || isEmpty(value)) && (\n <ContentLeftWrapper>{contentLeft}</ContentLeftWrapper>\n )}\n\n <ChipWrapper multiselect={selectProps.multiselect} value={value}>\n {getLabel({\n value,\n valueToItemMap,\n onChipClick,\n focusedChipIndex,\n label,\n labelPlacement,\n placeholder,\n isTargetAmount: selectProps.isTargetAmount,\n renderValue,\n size,\n })}\n </ChipWrapper>\n </>\n )}\n\n <IconArrowWrapper>\n <StyledArrow\n size={sizeToIconSize(size)}\n color=\"inherit\"\n className={cx(classes.selectTargetArrow, withArrowInverse)}\n />\n </IconArrowWrapper>\n </Wrapper>\n </StyledButton>\n </TextfieldWrapper>\n );\n};\n"],"names":["getLabel","_ref","value","isTargetAmount","valueToItemMap","onChipClick","label","placeholder","focusedChipIndex","labelPlacement","size","renderValue","isEmpty","React","createElement","Placeholder","Label","Array","isArray","Chip","text","concat","length","map","currentValue","index","itemLabel","get","onClick","e","stopPropagation","focused","Value","InnerLabelWrapper","InnerLabel","Textfield","_ref2","opened","onKeyDown","contentLeft","disabled","focusedPath","focusedToValueMap","selectProps","withArrowInverse","classes","arrowInverse","undefined","getActiveDescendant","_focusedToValueMap$ge","focusedPathAsString","reduce","acc","n","replace","toString","TextfieldWrapper","StyledButton","stretching","className","cx","textfieldTarget","selectWithoutBoxShadow","role","renderTarget","Boolean","Wrapper","Fragment","multiselect","ContentLeftWrapper","ChipWrapper","IconArrowWrapper","StyledArrow","sizeToIconSize","color","selectTargetArrow"],"mappings":";;;;;;;;;;;;AAuBA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAWgB;AAAA,EAAA,IAV1BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IACXC,gBAAgB,GAAAP,IAAA,CAAhBO,gBAAgB;IAChBC,cAAc,GAAAR,IAAA,CAAdQ,cAAc;IACdC,IAAI,GAAAT,IAAA,CAAJS,IAAI;IACJC,WAAW,GAAAV,IAAA,CAAXU,WAAW,CAAA;EAEX,IAAIC,eAAO,CAACV,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC7C,IAAA,IAAI,CAACI,KAAK,IAAIG,cAAc,KAAK,OAAO,EAAE;AACtC,MAAA,oBAAOI,KAAA,CAAAC,aAAA,CAACC,4BAAW,EAAA,IAAA,EAAER,WAAyB,CAAC,CAAA;AACnD,KAAA;AAEA,IAAA,oBAAOM,KAAA,CAAAC,aAAA,CAACE,sBAAK,EAAA,IAAA,EAAEV,KAAa,CAAC,CAAA;AACjC,GAAA;EAEA,IAAIW,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,IAAIC,cAAc,EAAE;AACxC,IAAA,o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AAC3BgE,IAAAA,KAAK,EAAC,SAAS;AACff,IAAAA,SAAS,EAAEC,QAAE,CAACf,qBAAO,CAAC8B,iBAAiB,EAAE/B,gBAAgB,CAAA;AAAE,GAC9D,CACa,CACb,CACC,CACA,CAAC,CAAA;AAE3B;;;;"}
1
+ {"version":3,"file":"Textfield.js","sources":["../../../../../../../src/components/Select/ui/Target/ui/Textfield/Textfield.tsx"],"sourcesContent":["import React from 'react';\n\nimport { cx, isEmpty } from '../../../../../../utils';\nimport { classes } from '../../../../Select.tokens';\nimport { sizeToIconSize } from '../../../../utils';\n\nimport { TextfieldProps, GetTextfieldLabelProps } from './Textfield.types';\nimport { Chip } from './ui';\nimport {\n StyledButton,\n StyledArrow,\n Wrapper,\n ChipWrapper,\n TextfieldWrapper,\n IconArrowWrapper,\n Label,\n Placeholder,\n InnerLabel,\n InnerLabelWrapper,\n ContentLeftWrapper,\n Value,\n} from './Textfield.styles';\n\nconst getLabel = ({\n value,\n isTargetAmount,\n valueToItemMap,\n onChipClick,\n label,\n placeholder,\n focusedChipIndex,\n labelPlacement,\n size,\n renderValue,\n}: GetTextfieldLabelProps) => {\n if (isEmpty(value) && typeof value !== 'number') {\n if (!label || labelPlacement === 'outer') {\n return <Placeholder>{placeholder}</Placeholder>;\n }\n\n return <Label>{label}</Label>;\n }\n\n if (Array.isArray(value) && isTargetAmount) {\n return <Chip text={`Выбрано: ${value.length}`} isTargetAmount={isTargetAmount} />;\n }\n\n if (Array.isArray(value)) {\n return value.map((currentValue, index) => {\n const itemLabel = valueToItemMap.get(currentValue)!.label;\n\n return (\n <Chip\n text={renderValue ? renderValue(valueToItemMap.get(currentValue)!) : itemLabel}\n onClick={(e: React.MouseEvent<HTMLElement>) => {\n e.stopPropagation();\n onChipClick(currentValue.toString());\n }}\n focused={focusedChipIndex === index}\n />\n );\n });\n }\n\n const itemLabel = valueToItemMap.get(value)!.label;\n\n if (!label || labelPlacement === 'outer') {\n return <Value>{renderValue ? renderValue(valueToItemMap.get(value)!) : itemLabel}</Value>;\n }\n\n return (\n <InnerLabelWrapper>\n {size !== 'xs' && <InnerLabel>{label}</InnerLabel>}\n <Value>{renderValue ? renderValue(valueToItemMap.get(value)!) : itemLabel}</Value>\n </InnerLabelWrapper>\n );\n};\n\nexport const Textfield: React.FC<TextfieldProps> = ({\n opened,\n value,\n valueToItemMap,\n onChipClick,\n label,\n placeholder,\n onKeyDown,\n focusedChipIndex,\n labelPlacement,\n size,\n contentLeft,\n disabled,\n renderValue,\n focusedPath,\n focusedToValueMap,\n selectProps,\n}) => {\n const withArrowInverse = opened ? classes.arrowInverse : undefined;\n\n const getActiveDescendant = () => {\n const focusedPathAsString = focusedPath.reduce((acc, n) => `${acc}/${n}`, '').replace(/^(\\/)/, '');\n return focusedToValueMap?.get(focusedPathAsString)?.value.toString();\n };\n\n return (\n <TextfieldWrapper opened={opened} value={value}>\n <StyledButton\n stretching=\"filled\"\n className={cx(\n classes.textfieldTarget,\n opened || focusedChipIndex !== null ? classes.selectWithoutBoxShadow : undefined,\n )}\n onKeyDown={onKeyDown}\n disabled={disabled}\n role=\"combobox\"\n aria-controls=\"tree_level_1\"\n aria-expanded={opened}\n aria-activedescendant={getActiveDescendant()}\n aria-label={label}\n renderTarget={Boolean(selectProps.renderTarget)}\n >\n <Wrapper>\n {selectProps?.renderTarget ? (\n selectProps.renderTarget(\n Array.isArray(value)\n ? value.map((value) => valueToItemMap.get(value)!)\n : valueToItemMap.get(value)!,\n )\n ) : (\n <>\n {contentLeft && (!selectProps.multiselect || isEmpty(value)) && (\n <ContentLeftWrapper>{contentLeft}</ContentLeftWrapper>\n )}\n\n <ChipWrapper multiselect={selectProps.multiselect} value={value}>\n {getLabel({\n value,\n valueToItemMap,\n onChipClick,\n focusedChipIndex,\n label,\n labelPlacement,\n placeholder,\n isTargetAmount: selectProps.isTargetAmount,\n renderValue,\n size,\n })}\n </ChipWrapper>\n </>\n )}\n\n <IconArrowWrapper>\n <StyledArrow\n size={sizeToIconSize(size)}\n color=\"inherit\"\n className={cx(classes.selectTargetArrow, withArrowInverse)}\n />\n </IconArrowWrapper>\n </Wrapper>\n </StyledButton>\n </TextfieldWrapper>\n );\n};\n"],"names":["getLabel","_ref","value","isTargetAmount","valueToItemMap","onChipClick","label","placeholder","focusedChipIndex","labelPlacement","size","renderValue","isEmpty","React","createElement","Placeholder","Label","Array","isArray","Chip","text","concat","length","map","currentValue","index","itemLabel","get","onClick","e","stopPropagation","toString","focused","Value","InnerLabelWrapper","InnerLabel","Textfield","_ref2","opened","onKeyDown","contentLeft","disabled","focusedPath","focusedToValueMap","selectProps","withArrowInverse","classes","arrowInverse","undefined","getActiveDescendant","_focusedToValueMap$ge","focusedPathAsString","reduce","acc","n","replace","TextfieldWrapper","StyledButton","stretching","className","cx","textfieldTarget","selectWithoutBoxShadow","role","renderTarget","Boolean","Wrapper","Fragment","multiselect","ContentLeftWrapper","ChipWrapper","IconArrowWrapper","StyledArrow","sizeToIconSize","color","selectTargetArrow"],"mappings":";;;;;;;;;;;;AAuBA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAWgB;AAAA,EAAA,IAV1BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IACXC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,WAAW,GAAAN,IAAA,CAAXM,WAAW;IACXC,gBAAgB,GAAAP,IAAA,CAAhBO,gBAAgB;IAChBC,cAAc,GAAAR,IAAA,CAAdQ,cAAc;IACdC,IAAI,GAAAT,IAAA,CAAJS,IAAI;IACJC,WAAW,GAAAV,IAAA,CAAXU,WAAW,CAAA;EAEX,IAAIC,eAAO,CAACV,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AAC7C,IAAA,IAAI,CAACI,KAAK,IAAIG,cAAc,KAAK,OAAO,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AAW,EAAXA,WAAW;IACXJ,cAAc,EAAEyC,WAAW,CAACzC,cAAc;AAC1CQ,IAAAA,WAAW,EAAXA,WAAW;AACXD,IAAAA,IAAI,EAAJA,IAAAA;AACJ,GAAC,CACQ,CACf,CACL,eAEDG,KAAA,CAAAC,aAAA,CAACyD,iCAAgB,EACb1D,IAAAA,eAAAA,KAAA,CAAAC,aAAA,CAAC0D,4BAAW,EAAA;AACR9D,IAAAA,IAAI,EAAE+D,6BAAc,CAAC/D,IAAI,CAAE;AAC3BgE,IAAAA,KAAK,EAAC,SAAS;AACff,IAAAA,SAAS,EAAEC,QAAE,CAACd,qBAAO,CAAC6B,iBAAiB,EAAE9B,gBAAgB,CAAA;AAAE,GAC9D,CACa,CACb,CACC,CACA,CAAC,CAAA;AAE3B;;;;"}
@@ -86,7 +86,7 @@ var _exp47 = function _exp47() {
86
86
  return function (_ref6) {
87
87
  var multiselect = _ref6.multiselect,
88
88
  value = _ref6.value;
89
- return "calc(".concat(Select_tokens.constants.focusSize, " + ").concat(multiselect && value && value.length > 0 ? "var(".concat(Select_tokens.tokens.focusOffset, ")") : 0, ")");
89
+ return "calc(".concat(Select_tokens.constants.focusSize, " + ").concat(multiselect && value && value.toString().length > 0 ? "var(".concat(Select_tokens.tokens.focusOffset, ")") : 0, ")");
90
90
  };
91
91
  };
92
92
  var ChipWrapper = /*#__PURE__*/react.styled('div')({
@@ -1 +1 @@
1
- {"version":3,"file":"Textfield.styles.js","sources":["../../../../../../../src/components/Select/ui/Target/ui/Textfield/Textfield.styles.tsx"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { isEmpty } from '../../../../../../utils';\nimport { applyEllipsis, addFocus } from '../../../../../../mixins';\nimport { IconDisclosureDownCentered } from '../../../../../_Icon';\nimport { component, mergeConfig } from '../../../../../../engines';\nimport { buttonConfig, buttonTokens } from '../../../../../Button';\nimport { tokens, classes, constants } from '../../../../Select.tokens';\nimport type { SelectProps } from '../../../../Select.types';\n\nconst mergedButtonConfig = mergeConfig(buttonConfig);\nconst Button = component(mergedButtonConfig);\n\nexport const TextfieldWrapper = styled.div<{ opened: boolean; value: SelectProps['value'] }>`\n display: inline;\n\n .${classes.textfieldTarget} {\n transition: 100ms;\n background: ${({ opened }) =>\n opened\n ? `var(${tokens.targetTextfieldBackgroundColorOpened})`\n : `var(${tokens.targetTextfieldBackgroundColor})`};\n padding: ${({ value }) =>\n Array.isArray(value) && !isEmpty(value)\n ? `0 var(${tokens.targetTextfieldChipPadding})`\n : `0 var(${tokens.targetTextfieldPadding})`};\n border: ${({ opened }) =>\n opened\n ? `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderOpenedColor})`\n : `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderColor})`};\n }\n\n .${classes.textfieldTarget}:hover {\n transition: 100ms;\n border: ${({ opened }) =>\n opened\n ? `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderOpenedColor})`\n : `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderColorHover})`};\n }\n\n .${classes.selectWithoutBoxShadow}::before {\n box-shadow: none !important;\n }\n`;\n\nexport const StyledButton = styled(Button)<{ renderTarget: boolean }>`\n ${buttonTokens.buttonColor}: var(${constants.textfieldTargetColor});\n ${buttonTokens.buttonColorHover}: var(${constants.textfieldTargetColor});\n ${buttonTokens.buttonColorActive}: var(${constants.textfieldTargetColor});\n ${buttonTokens.buttonHeight}: ${({ renderTarget }) => (renderTarget ? 'auto' : `var(${tokens.targetHeight})`)};\n ${buttonTokens.buttonWidth}: 100%;\n ${buttonTokens.buttonPadding}: var(${tokens.targetTextfieldPadding});\n ${buttonTokens.buttonRadius}: var(${tokens.borderRadius});\n ${buttonTokens.buttonFontFamily}: var(${tokens.fontFamily});\n ${buttonTokens.buttonFontSize}: var(${tokens.fontSize});\n ${buttonTokens.buttonFontStyle}: var(${tokens.fontStyle});\n ${buttonTokens.buttonFontWeight}:var(${tokens.fontWeight});\n ${buttonTokens.buttonLetterSpacing}: var(${tokens.fontLetterSpacing});\n ${buttonTokens.buttonLineHeight}: var(${tokens.fontLineHeight});\n ${buttonTokens.buttonDisabledOpacity}: ${constants.opacity};\n ${buttonTokens.buttonFocusColor}: var(${constants.focusColor});\n box-shadow: inset 0 0 0 ${tokens.targetTextfieldBorderSize} var(${tokens.targetTextfieldBorderColor});\n text-align: left;\n\n ${addFocus({\n outlineOffset: tokens.targetTextfieldBorderSize,\n outlineSize: constants.focusSize,\n outlineRadius: `calc(var(${tokens.borderRadius}) - ${tokens.targetTextfieldBorderSize})`,\n outlineColor: `var(${constants.focusColor})`,\n })}\n`;\n\nexport const StyledArrow = styled(IconDisclosureDownCentered)``;\n\nexport const IconArrowWrapper = styled.div`\n line-height: 0;\n margin: var(${tokens.targetTextfieldArrowMargin});\n color: var(${tokens.targetTextfieldArrowColor});\n\n &:hover {\n color: var(${tokens.targetTextfieldArrowColorHover});\n }\n\n &:active {\n color: var(${tokens.targetTextfieldArrowColorActive});\n }\n`;\n\nexport const Wrapper = styled.div`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .${classes.arrowInverse} {\n transform: rotate(-180deg);\n }\n`;\n\nexport const ChipWrapper = styled.div<{ multiselect: SelectProps['multiselect']; value: SelectProps['value'] }>`\n width: 100%;\n display: flex;\n min-width: 0;\n padding: ${({ multiselect, value }) =>\n `calc(${constants.focusSize} + ${\n multiselect && value && value.length > 0 ? `var(${tokens.focusOffset})` : 0\n })`};\n gap: 0.25rem;\n overflow-x: scroll;\n border-top-right-radius: var(${tokens.chipBorderRadius});\n border-bottom-right-radius: var(${tokens.chipBorderRadius});\n\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n\nexport const Label = styled.label`\n color: var(${constants.textfieldInnerLabelColor});\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.fontLetterSpacing});\n line-height: var(${tokens.fontLineHeight});\n`;\n\nexport const Placeholder = styled.div`\n color: var(${constants.textfieldPlaceholderColor});\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.fontLetterSpacing});\n line-height: var(${tokens.fontLineHeight});\n`;\n\nexport const InnerLabelWrapper = styled.div`\n display: flex;\n flex-direction: column;\n align-items: start;\n row-gap: var(${tokens.innerLabelGap});\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.fontLetterSpacing});\n line-height: var(${tokens.fontLineHeight});\n`;\n\nexport const InnerLabel = styled.label`\n color: var(${constants.textfieldInnerLabelColor});\n font-family: var(${constants.fontFamily});\n font-size: var(${constants.fontSize});\n font-style: var(${constants.fontStyle});\n font-weight: var(${constants.fontWeight});\n letter-spacing: var(${constants.fontLetterSpacing});\n line-height: var(${constants.fontLineHeight});\n text-align: left;\n`;\n\nexport const ContentLeftWrapper = styled.div`\n flex: none;\n margin-left: -0.125rem;\n margin-right: 0.375rem;\n line-height: 0;\n`;\n\nexport const Value = styled.span`\n ${applyEllipsis()}\n`;\n"],"names":["mergedButtonConfig","mergeConfig","buttonConfig","Button","component","_exp2","_ref","opened","concat","tokens","targetTextfieldBackgroundColorOpened","targetTextfieldBackgroundColor","_exp3","_ref2","value","Array","isArray","isEmpty","targetTextfieldChipPadding","targetTextfieldPadding","_exp4","_ref3","targetTextfieldBorderSize","targetTextfieldBorderOpenedColor","targetTextfieldBorderColor","_exp6","_ref4","targetTextfieldBorderColorHover","TextfieldWrapper","styled","name","class","propsAsIs","vars","_exp8","_exp16","_ref5","renderTarget","targetHeight","StyledButton","_exp41","IconDisclosureDownCentered","StyledArrow","IconArrowWrapper","Wrapper","_exp47","_ref6","multiselect","constants","focusSize","length","focusOffset","ChipWrapper","Label","Placeholder","InnerLabelWrapper","InnerLabel","ContentLeftWrapper","Value"],"mappings":";;;;;;;;;;;AAUA,IAAMA,kBAAkB,gBAAGC,kBAAW,CAACC,qBAAY,CAAC,CAAA;AACpD,IAAMC,MAAM,gBAAGC,gBAAS,CAACJ,kBAAkB,CAAC,CAAA;AAAC,IAAAK,KAAA,GAV3BA,SAU2BA,KAAAA,GAAA;AAAA,EAAA,OAOvB,UAAAC,IAAA,EAAA;AAAA,IAAA,IAAGC,MAAAA,GAAAA,IAAAA,CAAAA,MAAAA,CAAAA;AAAAA,IAAAA,OACbA,MAAM,GAAA,MAAA,CAAAC,MAAA,CACOC,oBAAM,CAACC,oCAAqC,EAAA,GAAA,CAAA,GAAA,MAAA,CAAAF,MAAA,CAC5CC,oBAAM,CAACE,8BAA+B,EAAE,GAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAAA,IAAAC,KAAA,GApB/CA,SAoB+CA,KAAAA,GAAA;AAAA,EAAA,OAC9C,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGC,KAAAA,GAAAA,KAAAA,CAAAA,KAAAA,CAAAA;IAAAA,OACVC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAI,CAACG,eAAO,CAACH,KAAK,CAAC,YAAAN,MAAA,CACxBC,oBAAM,CAACS,0BAA2B,EAAA,GAAA,CAAA,GAAA,QAAA,CAAAV,MAAA,CAClCC,oBAAM,CAACU,sBAAuB,EAAE,GAAA,CAAA,CAAA;AAAA,GAAA,CAAA;AAAA,CAAA,CAAA;AAAA,IAAAC,KAAA,GAxBzCA,SAwByCA,KAAAA,GAAA;AAAA,EAAA,OACzC,UAAAC,KAAA,EAAA;AAAA,IAAA,IAAGd,MAAAA,GAAAA,KAAAA,CAAAA,MAAAA,CAAAA;IAAAA,OACTA,MAAM,GAAAC,MAAAA,CAAAA,MAAA,CACOC,oBAAM,CAACa,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IAAA,EAAA,mBAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAWtC,EAAA;AAEM,IAAMwB,UAAU,gBAAG3B,YAAM,CAAA,OAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,YAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAS/B,EAAA;AAEM,IAAMyB,kBAAkB,gBAAG5B,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,oBAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAKvC,EAAA;AAEM,IAAM0B,KAAK,gBAAG7B,YAAM,CAAA,MAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,OAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAE1B;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Textfield.styles.js","sources":["../../../../../../../src/components/Select/ui/Target/ui/Textfield/Textfield.styles.tsx"],"sourcesContent":["import { styled } from '@linaria/react';\n\nimport { isEmpty } from '../../../../../../utils';\nimport { applyEllipsis, addFocus } from '../../../../../../mixins';\nimport { IconDisclosureDownCentered } from '../../../../../_Icon';\nimport { component, mergeConfig } from '../../../../../../engines';\nimport { buttonConfig, buttonTokens } from '../../../../../Button';\nimport { tokens, classes, constants } from '../../../../Select.tokens';\nimport type { MergedSelectProps } from '../../../../Select.types';\n\nconst mergedButtonConfig = mergeConfig(buttonConfig);\nconst Button = component(mergedButtonConfig);\n\nexport const TextfieldWrapper = styled.div<{ opened: boolean; value: MergedSelectProps['value'] }>`\n display: inline;\n\n .${classes.textfieldTarget} {\n transition: 100ms;\n background: ${({ opened }) =>\n opened\n ? `var(${tokens.targetTextfieldBackgroundColorOpened})`\n : `var(${tokens.targetTextfieldBackgroundColor})`};\n padding: ${({ value }) =>\n Array.isArray(value) && !isEmpty(value)\n ? `0 var(${tokens.targetTextfieldChipPadding})`\n : `0 var(${tokens.targetTextfieldPadding})`};\n border: ${({ opened }) =>\n opened\n ? `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderOpenedColor})`\n : `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderColor})`};\n }\n\n .${classes.textfieldTarget}:hover {\n transition: 100ms;\n border: ${({ opened }) =>\n opened\n ? `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderOpenedColor})`\n : `var(${tokens.targetTextfieldBorderSize}) solid var(${tokens.targetTextfieldBorderColorHover})`};\n }\n\n .${classes.selectWithoutBoxShadow}::before {\n box-shadow: none !important;\n }\n`;\n\nexport const StyledButton = styled(Button)<{ renderTarget: boolean }>`\n ${buttonTokens.buttonColor}: var(${constants.textfieldTargetColor});\n ${buttonTokens.buttonColorHover}: var(${constants.textfieldTargetColor});\n ${buttonTokens.buttonColorActive}: var(${constants.textfieldTargetColor});\n ${buttonTokens.buttonHeight}: ${({ renderTarget }) => (renderTarget ? 'auto' : `var(${tokens.targetHeight})`)};\n ${buttonTokens.buttonWidth}: 100%;\n ${buttonTokens.buttonPadding}: var(${tokens.targetTextfieldPadding});\n ${buttonTokens.buttonRadius}: var(${tokens.borderRadius});\n ${buttonTokens.buttonFontFamily}: var(${tokens.fontFamily});\n ${buttonTokens.buttonFontSize}: var(${tokens.fontSize});\n ${buttonTokens.buttonFontStyle}: var(${tokens.fontStyle});\n ${buttonTokens.buttonFontWeight}:var(${tokens.fontWeight});\n ${buttonTokens.buttonLetterSpacing}: var(${tokens.fontLetterSpacing});\n ${buttonTokens.buttonLineHeight}: var(${tokens.fontLineHeight});\n ${buttonTokens.buttonDisabledOpacity}: ${constants.opacity};\n ${buttonTokens.buttonFocusColor}: var(${constants.focusColor});\n box-shadow: inset 0 0 0 ${tokens.targetTextfieldBorderSize} var(${tokens.targetTextfieldBorderColor});\n text-align: left;\n\n ${addFocus({\n outlineOffset: tokens.targetTextfieldBorderSize,\n outlineSize: constants.focusSize,\n outlineRadius: `calc(var(${tokens.borderRadius}) - ${tokens.targetTextfieldBorderSize})`,\n outlineColor: `var(${constants.focusColor})`,\n })}\n`;\n\nexport const StyledArrow = styled(IconDisclosureDownCentered)``;\n\nexport const IconArrowWrapper = styled.div`\n line-height: 0;\n margin: var(${tokens.targetTextfieldArrowMargin});\n color: var(${tokens.targetTextfieldArrowColor});\n\n &:hover {\n color: var(${tokens.targetTextfieldArrowColorHover});\n }\n\n &:active {\n color: var(${tokens.targetTextfieldArrowColorActive});\n }\n`;\n\nexport const Wrapper = styled.div`\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n .${classes.arrowInverse} {\n transform: rotate(-180deg);\n }\n`;\n\nexport const ChipWrapper = styled.div<{\n multiselect: MergedSelectProps['multiselect'];\n value: MergedSelectProps['value'];\n}>`\n width: 100%;\n display: flex;\n min-width: 0;\n padding: ${({ multiselect, value }) =>\n `calc(${constants.focusSize} + ${\n multiselect && value && value.toString().length > 0 ? `var(${tokens.focusOffset})` : 0\n })`};\n gap: 0.25rem;\n overflow-x: scroll;\n border-top-right-radius: var(${tokens.chipBorderRadius});\n border-bottom-right-radius: var(${tokens.chipBorderRadius});\n\n -ms-overflow-style: none;\n scrollbar-width: none;\n\n &::-webkit-scrollbar {\n display: none;\n }\n`;\n\nexport const Label = styled.label`\n color: var(${constants.textfieldInnerLabelColor});\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.fontLetterSpacing});\n line-height: var(${tokens.fontLineHeight});\n`;\n\nexport const Placeholder = styled.div`\n color: var(${constants.textfieldPlaceholderColor});\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.fontLetterSpacing});\n line-height: var(${tokens.fontLineHeight});\n`;\n\nexport const InnerLabelWrapper = styled.div`\n display: flex;\n flex-direction: column;\n align-items: start;\n row-gap: var(${tokens.innerLabelGap});\n font-family: var(${tokens.fontFamily});\n font-size: var(${tokens.fontSize});\n font-style: var(${tokens.fontStyle});\n font-weight: var(${tokens.fontWeight});\n letter-spacing: var(${tokens.fontLetterSpacing});\n line-height: var(${tokens.fontLineHeight});\n`;\n\nexport const InnerLabel = styled.label`\n color: var(${constants.textfieldInnerLabelColor});\n font-family: var(${constants.fontFamily});\n font-size: var(${constants.fontSize});\n font-style: var(${constants.fontStyle});\n font-weight: var(${constants.fontWeight});\n letter-spacing: var(${constants.fontLetterSpacing});\n line-height: var(${constants.fontLineHeight});\n text-align: left;\n`;\n\nexport const ContentLeftWrapper = styled.div`\n flex: none;\n margin-left: -0.125rem;\n margin-right: 0.375rem;\n line-height: 0;\n`;\n\nexport const Value = styled.span`\n ${applyEllipsis()}\n`;\n"],"names":["mergedButtonConfig","mergeConfig","buttonConfig","Button","component","_exp2","_ref","opened","concat","tokens","targetTextfieldBackgroundColorOpened","targetTextfieldBackgroundColor","_exp3","_ref2","value","Array","isArray","isEmpty","targetTextfieldChipPadding","targetTextfieldPadding","_exp4","_ref3","targetTextfieldBorderSize","targetTextfieldBorderOpenedColor","targetTextfieldBorderColor","_exp6","_ref4","targetTextfieldBorderColorHover","TextfieldWrapper","styled","name","class","propsAsIs","vars","_exp8","_exp16","_ref5","renderTarget","targetHeight","StyledButton","_exp41","IconDisclosureDownCentered","StyledArrow","IconArrowWrapper","Wrapper","_exp47","_ref6","multiselect","constants","focusSize","toString","length","focusOffset","ChipWrapper","Label","Placeholder","InnerLabelWrapper","InnerLabel","ContentLeftWrapper","Value"],"mappings":";;;;;;;;;;;AAUA,IAAMA,kBAAkB,gBAAGC,kBAAW,CAACC,qBAAY,CAAC,CAAA;AACpD,IAAMC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,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,YAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAS/B,EAAA;AAEM,IAAM0B,kBAAkB,gBAAG7B,YAAM,CAAA,KAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,oBAAA;AAAAC,EAAAA,OAAAA,EAAA,UAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAKvC,EAAA;AAEM,IAAM2B,KAAK,gBAAG9B,YAAM,CAAA,MAAA,CAAA,CAAA;AAAAC,EAAAA,IAAA,EAAA,OAAA;AAAAC,EAAAA,OAAAA,EAAA,SAAA;AAAAC,EAAAA,SAAA,EAAA,KAAA;AAAA,CAE1B;;;;;;;;;;;;;;;"}
@@ -21,7 +21,7 @@ var getButtonLabel = function getButtonLabel(_ref3) {
21
21
  if (isEmpty.isEmpty(value) && typeof value !== 'number') {
22
22
  return label || '';
23
23
  }
24
- if (selectProps.multiselect && selectProps.isTargetAmount) {
24
+ if (selectProps.multiselect && Array.isArray(value) && selectProps.isTargetAmount) {
25
25
  return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.length);
26
26
  }
27
27
  if (selectProps.multiselect && Array.isArray(value)) {
@@ -1 +1 @@
1
- {"version":3,"file":"getButtonLabel.js","sources":["../../../../src/components/Select/utils/getButtonLabel.ts"],"sourcesContent":["import { GetButtonLabelProps } from '../ui/Target/ui/Button/Button.types';\nimport { isEmpty } from '../../../utils';\n\nconst getLabel = ({\n value,\n valueToItemMap,\n renderValue,\n}: Omit<GetButtonLabelProps, 'label' | 'selectProps' | 'value'> & { value: any }): string => {\n const { label } = valueToItemMap.get(value)!;\n\n return renderValue ? renderValue(valueToItemMap.get(value)!) : label;\n};\n\nexport const getButtonLabel = ({\n value,\n valueToItemMap,\n label,\n renderValue,\n selectProps,\n}: GetButtonLabelProps): string => {\n if (isEmpty(value) && typeof value !== 'number') {\n return label || '';\n }\n\n if (selectProps.multiselect && selectProps.isTargetAmount) {\n return `Выбрано: ${value.length}`;\n }\n\n if (selectProps.multiselect && Array.isArray(value)) {\n return value\n ?.map((itemValue) =>\n getLabel({\n value: itemValue,\n valueToItemMap,\n renderValue,\n }),\n )\n .join(', ');\n }\n\n return getLabel({\n value,\n valueToItemMap,\n renderValue,\n });\n};\n"],"names":["getLabel","_ref","value","valueToItemMap","renderValue","_ref2","get","label","getButtonLabel","_ref3","selectProps","isEmpty","multiselect","isTargetAmount","concat","length","Array","isArray","map","itemValue","join"],"mappings":";;;;;;AAGA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAI+E;AAAA,EAAA,IAHzFC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW,CAAA;AAEX,EAAA,IAAAC,KAAA,GAAkBF,cAAc,CAACG,GAAG,CAACJ,KAAK,CAAC;IAAnCK,KAAK,GAAAF,KAAA,CAALE,KAAK,CAAA;AAEb,EAAA,OAAOH,WAAW,GAAGA,WAAW,CAACD,cAAc,CAACG,GAAG,CAACJ,KAAK,CAAE,CAAC,GAAGK,KAAK,CAAA;AACxE,CAAC,CAAA;IAEYC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,KAAA,EAMQ;AAAA,EAAA,IAL/BP,KAAK,GAAAO,KAAA,CAALP,KAAK;IACLC,cAAc,GAAAM,KAAA,CAAdN,cAAc;IACdI,KAAK,GAAAE,KAAA,CAALF,KAAK;IACLH,WAAW,GAAAK,KAAA,CAAXL,WAAW;IACXM,WAAW,GAAAD,KAAA,CAAXC,WAAW,CAAA;EAEX,IAAIC,eAAO,CAACT,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7C,OAAOK,KAAK,IAAI,EAAE,CAAA;AACtB,GAAA;AAEA,EAAA,IAAIG,WAAW,CAACE,WAAW,IAAIF,WAAW,CAACG,cAAc,EAAE;AACvD,IAAA,OAAA,8CAAA,CAAAC,MAAA,CAAmBZ,KAAK,CAACa,MAAM,CAAA,CAAA;AACnC,GAAA;EAEA,IAAIL,WAAW,CAACE,WAAW,IAAII,KAAK,CAACC,OAAO,CAACf,KAAK,CAAC,EAAE;IACjD,OAAOA,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CACNgB,GAAG,CAAC,UAACC,SAAS,EAAA;AAAA,MAAA,OACZnB,QAAQ,CAAC;AACLE,QAAAA,KAAK,EAAEiB,SAAS;AAChBhB,QAAAA,cAAc,EAAdA,cAAc;AACdC,QAAAA,WAAW,EAAXA,WAAAA;AACJ,OAAC,CAAC,CAAA;AAAA,KACN,CAAC,CACAgB,IAAI,CAAC,IAAI,CAAC,CAAA;AACnB,GAAA;AAEA,EAAA,OAAOpB,QAAQ,CAAC;AACZE,IAAAA,KAAK,EAALA,KAAK;AACLC,IAAAA,cAAc,EAAdA,cAAc;AACdC,IAAAA,WAAW,EAAXA,WAAAA;AACJ,GAAC,CAAC,CAAA;AACN;;;;"}
1
+ {"version":3,"file":"getButtonLabel.js","sources":["../../../../src/components/Select/utils/getButtonLabel.ts"],"sourcesContent":["import { GetButtonLabelProps } from '../ui/Target/ui/Button/Button.types';\nimport { isEmpty } from '../../../utils';\n\nconst getLabel = ({\n value,\n valueToItemMap,\n renderValue,\n}: Omit<GetButtonLabelProps, 'label' | 'selectProps' | 'value'> & { value: any }): string => {\n const { label } = valueToItemMap.get(value)!;\n\n return renderValue ? renderValue(valueToItemMap.get(value)!) : label;\n};\n\nexport const getButtonLabel = ({\n value,\n valueToItemMap,\n label,\n renderValue,\n selectProps,\n}: GetButtonLabelProps): string => {\n if (isEmpty(value) && typeof value !== 'number') {\n return label || '';\n }\n\n if (selectProps.multiselect && Array.isArray(value) && selectProps.isTargetAmount) {\n return `Выбрано: ${value.length}`;\n }\n\n if (selectProps.multiselect && Array.isArray(value)) {\n return value\n ?.map((itemValue) =>\n getLabel({\n value: itemValue,\n valueToItemMap,\n renderValue,\n }),\n )\n .join(', ');\n }\n\n return getLabel({\n value,\n valueToItemMap,\n renderValue,\n });\n};\n"],"names":["getLabel","_ref","value","valueToItemMap","renderValue","_ref2","get","label","getButtonLabel","_ref3","selectProps","isEmpty","multiselect","Array","isArray","isTargetAmount","concat","length","map","itemValue","join"],"mappings":";;;;;;AAGA,IAAMA,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAI+E;AAAA,EAAA,IAHzFC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW,CAAA;AAEX,EAAA,IAAAC,KAAA,GAAkBF,cAAc,CAACG,GAAG,CAACJ,KAAK,CAAC;IAAnCK,KAAK,GAAAF,KAAA,CAALE,KAAK,CAAA;AAEb,EAAA,OAAOH,WAAW,GAAGA,WAAW,CAACD,cAAc,CAACG,GAAG,CAACJ,KAAK,CAAE,CAAC,GAAGK,KAAK,CAAA;AACxE,CAAC,CAAA;IAEYC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,KAAA,EAMQ;AAAA,EAAA,IAL/BP,KAAK,GAAAO,KAAA,CAALP,KAAK;IACLC,cAAc,GAAAM,KAAA,CAAdN,cAAc;IACdI,KAAK,GAAAE,KAAA,CAALF,KAAK;IACLH,WAAW,GAAAK,KAAA,CAAXL,WAAW;IACXM,WAAW,GAAAD,KAAA,CAAXC,WAAW,CAAA;EAEX,IAAIC,eAAO,CAACT,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7C,OAAOK,KAAK,IAAI,EAAE,CAAA;AACtB,GAAA;AAEA,EAAA,IAAIG,WAAW,CAACE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACZ,KAAK,CAAC,IAAIQ,WAAW,CAACK,cAAc,EAAE;AAC/E,IAAA,OAAA,8CAAA,CAAAC,MAAA,CAAmBd,KAAK,CAACe,MAAM,CAAA,CAAA;AACnC,GAAA;EAEA,IAAIP,WAAW,CAACE,WAAW,IAAIC,KAAK,CAACC,OAAO,CAACZ,KAAK,CAAC,EAAE;IACjD,OAAOA,KAAK,aAALA,KAAK,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAALA,KAAK,CACNgB,GAAG,CAAC,UAACC,SAAS,EAAA;AAAA,MAAA,OACZnB,QAAQ,CAAC;AACLE,QAAAA,KAAK,EAAEiB,SAAS;AAChBhB,QAAAA,cAAc,EAAdA,cAAc;AACdC,QAAAA,WAAW,EAAXA,WAAAA;AACJ,OAAC,CAAC,CAAA;AAAA,KACN,CAAC,CACAgB,IAAI,CAAC,IAAI,CAAC,CAAA;AACnB,GAAA;AAEA,EAAA,OAAOpB,QAAQ,CAAC;AACZE,IAAAA,KAAK,EAALA,KAAK;AACLC,IAAAA,cAAc,EAAdA,cAAc;AACdC,IAAAA,WAAW,EAAXA,WAAAA;AACJ,GAAC,CAAC,CAAA;AACN;;;;"}
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ // Утилита предназначена для фильтрации элементов в value, которые отсутствуют в items.
6
+ // Эти элементы игнорируются и не участвуют в дальнейшей работе компонента.
7
+ var getInitialValue = function getInitialValue(outerValue, valueToItemMap) {
8
+ if (Array.isArray(outerValue)) {
9
+ if (outerValue.length === 0) {
10
+ return [];
11
+ }
12
+ return outerValue.filter(valueToItemMap.has.bind(valueToItemMap));
13
+ }
14
+ if (valueToItemMap.has(outerValue)) {
15
+ return outerValue;
16
+ }
17
+ return '';
18
+ };
19
+
20
+ exports.getInitialValue = getInitialValue;
21
+ //# sourceMappingURL=getInitialValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getInitialValue.js","sources":["../../../../src/components/Select/utils/getInitialValue.ts"],"sourcesContent":["import { MergedSelectProps } from '../Select.types';\nimport { ValueToItemMapType } from '../hooks/usePathMaps';\n\n// Утилита предназначена для фильтрации элементов в value, которые отсутствуют в items.\n// Эти элементы игнорируются и не участвуют в дальнейшей работе компонента.\nexport const getInitialValue = (outerValue: MergedSelectProps['value'], valueToItemMap: ValueToItemMapType) => {\n if (Array.isArray(outerValue)) {\n if (outerValue.length === 0) {\n return [];\n }\n\n return outerValue.filter(valueToItemMap.has.bind(valueToItemMap));\n }\n\n if (valueToItemMap.has(outerValue)) {\n return outerValue;\n }\n\n return '';\n};\n"],"names":["getInitialValue","outerValue","valueToItemMap","Array","isArray","length","filter","has","bind"],"mappings":";;;;AAGA;AACA;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,UAAsC,EAAEC,cAAkC,EAAK;AAC3G,EAAA,IAAIC,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,EAAE;AAC3B,IAAA,IAAIA,UAAU,CAACI,MAAM,KAAK,CAAC,EAAE;AACzB,MAAA,OAAO,EAAE,CAAA;AACb,KAAA;AAEA,IAAA,OAAOJ,UAAU,CAACK,MAAM,CAACJ,cAAc,CAACK,GAAG,CAACC,IAAI,CAACN,cAAc,CAAC,CAAC,CAAA;AACrE,GAAA;AAEA,EAAA,IAAIA,cAAc,CAACK,GAAG,CAACN,UAAU,CAAC,EAAE;AAChC,IAAA,OAAOA,UAAU,CAAA;AACrB,GAAA;AAEA,EAAA,OAAO,EAAE,CAAA;AACb;;;;"}
@@ -2,17 +2,20 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
6
+
5
7
  // Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
6
8
  // Дает возможность прохода к корневому элементу (снизу вверх).
7
-
9
+ // На выходе получаем глубокую копию исходного массива items.
8
10
  var initialItemsTransform = function initialItemsTransform(items, parent) {
9
- items.forEach(function (item) {
10
- item.parent = parent;
11
- if (item.items) {
12
- item.items = initialItemsTransform(item.items, item);
11
+ return _rollupPluginBabelHelpers.toConsumableArray(items).map(function (item) {
12
+ var itemCopy = _rollupPluginBabelHelpers.objectSpread2({}, item);
13
+ itemCopy.parent = parent;
14
+ if (itemCopy.items) {
15
+ itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);
13
16
  }
17
+ return itemCopy;
14
18
  });
15
- return items;
16
19
  };
17
20
 
18
21
  exports.initialItemsTransform = initialItemsTransform;
@@ -1 +1 @@
1
- {"version":3,"file":"initialItemsTransform.js","sources":["../../../../src/components/Select/utils/initialItemsTransform.ts"],"sourcesContent":["import { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\n// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.\n// Дает возможность прохода к корневому элементу (снизу вверх).\n\nexport const initialItemsTransform = (\n items: Array<MergedDropdownNodeTransformed>,\n parent?: MergedDropdownNodeTransformed,\n): Array<MergedDropdownNodeTransformed> => {\n items.forEach((item) => {\n item.parent = parent;\n\n if (item.items) {\n item.items = initialItemsTransform(item.items, item);\n }\n });\n\n return items;\n};\n"],"names":["initialItemsTransform","items","parent","forEach","item"],"mappings":";;;;AAEA;AACA;;AAEO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAC9BC,KAA2C,EAC3CC,MAAsC,EACC;AACvCD,EAAAA,KAAK,CAACE,OAAO,CAAC,UAACC,IAAI,EAAK;IACpBA,IAAI,CAACF,MAAM,GAAGA,MAAM,CAAA;IAEpB,IAAIE,IAAI,CAACH,KAAK,EAAE;MACZG,IAAI,CAACH,KAAK,GAAGD,qBAAqB,CAACI,IAAI,CAACH,KAAK,EAAEG,IAAI,CAAC,CAAA;AACxD,KAAA;AACJ,GAAC,CAAC,CAAA;AAEF,EAAA,OAAOH,KAAK,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"initialItemsTransform.js","sources":["../../../../src/components/Select/utils/initialItemsTransform.ts"],"sourcesContent":["import { MergedDropdownNodeTransformed } from '../ui/Inner/ui/Item/Item.types';\n\n// Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.\n// Дает возможность прохода к корневому элементу (снизу вверх).\n// На выходе получаем глубокую копию исходного массива items.\nexport const initialItemsTransform = (\n items: Array<MergedDropdownNodeTransformed>,\n parent?: MergedDropdownNodeTransformed,\n): Array<MergedDropdownNodeTransformed> => {\n return [...items].map((item) => {\n const itemCopy = { ...item };\n\n itemCopy.parent = parent;\n\n if (itemCopy.items) {\n itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);\n }\n\n return itemCopy;\n });\n};\n"],"names":["initialItemsTransform","items","parent","_toConsumableArray","map","item","itemCopy","_objectSpread"],"mappings":";;;;;;AAEA;AACA;AACA;AACO,IAAMA,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAC9BC,KAA2C,EAC3CC,MAAsC,EACC;EACvC,OAAOC,2CAAA,CAAIF,KAAK,CAAA,CAAEG,GAAG,CAAC,UAACC,IAAI,EAAK;AAC5B,IAAA,IAAMC,QAAQ,GAAAC,uCAAA,CAAA,EAAA,EAAQF,IAAI,CAAE,CAAA;IAE5BC,QAAQ,CAACJ,MAAM,GAAGA,MAAM,CAAA;IAExB,IAAII,QAAQ,CAACL,KAAK,EAAE;MAChBK,QAAQ,CAACL,KAAK,GAAGD,qBAAqB,CAACM,QAAQ,CAACL,KAAK,EAAEK,QAAQ,CAAC,CAAA;AACpE,KAAA;AAEA,IAAA,OAAOA,QAAQ,CAAA;AACnB,GAAC,CAAC,CAAA;AACN;;;;"}