@chayns-components/core 5.0.0-beta.883 → 5.0.0-beta.886

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +5 -3
  2. package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  3. package/lib/cjs/components/combobox/ComboBox.js +4 -3
  4. package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
  5. package/lib/cjs/components/combobox/combobox-item/ComboBoxItem.js +5 -1
  6. package/lib/cjs/components/combobox/combobox-item/ComboBoxItem.js.map +1 -1
  7. package/lib/cjs/components/mention-finder/MentionFinder.js.map +1 -1
  8. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.js +4 -3
  9. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.js.map +1 -1
  10. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js +3 -1
  11. package/lib/cjs/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/cjs/utils/calculate.js +8 -2
  14. package/lib/cjs/utils/calculate.js.map +1 -1
  15. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +5 -3
  16. package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
  17. package/lib/esm/components/combobox/ComboBox.js +4 -3
  18. package/lib/esm/components/combobox/ComboBox.js.map +1 -1
  19. package/lib/esm/components/combobox/combobox-item/ComboBoxItem.js +5 -1
  20. package/lib/esm/components/combobox/combobox-item/ComboBoxItem.js.map +1 -1
  21. package/lib/esm/components/mention-finder/MentionFinder.js.map +1 -1
  22. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.js +4 -3
  23. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.js.map +1 -1
  24. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js +10 -5
  25. package/lib/esm/components/mention-finder/mention-finder-item/MentionFinderItem.styles.js.map +1 -1
  26. package/lib/esm/index.js.map +1 -1
  27. package/lib/esm/utils/calculate.js +8 -2
  28. package/lib/esm/utils/calculate.js.map +1 -1
  29. package/lib/types/components/combobox/ComboBox.d.ts +6 -1
  30. package/lib/types/components/combobox/combobox-item/ComboBoxItem.d.ts +1 -0
  31. package/lib/types/components/mention-finder/MentionFinder.d.ts +1 -0
  32. package/lib/types/components/mention-finder/mention-finder-item/MentionFinderItem.styles.d.ts +4 -1
  33. package/lib/types/index.d.ts +1 -1
  34. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type IComboBoxItem as ComboBoxItem,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu, type ContextMenuRef } from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { ColorSchemeContextProps } from './components/color-scheme-provider/ColorSchemeProvider';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,oBAAA,GAAAC,uBAAA,CAAAP,OAAA;AAIA,IAAAQ,MAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,SAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,oBAAA,GAAAJ,uBAAA,CAAAP,OAAA;AAKA,IAAAY,SAAA,GAAA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AA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAAA,SAAAtE,uBAAA8D,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAI,UAAA,GAAAJ,CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_Accordion","_interopRequireDefault","require","_AccordionContent","_AccordionGroup","_AccordionIntro","_AccordionItem","_AmountControl","_AreaContextProvider","_interopRequireWildcard","_Badge","_Button","_Checkbox","_ColorSchemeProvider","_ComboBox","_ContentCard","_ContextMenu","_ExpandableContent","_FileInput","_FilterButton","_FilterButtons","_GridImage","_Icon","_Input","_List","_ListItemContent","_ListItem","_MentionFinder","_NumberInput","_PageProvider","_Popup","_PopupContent","_ProgressBar","_RadioButtonGroup","_RadioButton","_ScrollView","_SearchBox","_SearchInput","_SelectButton","_SetupWizardItem","_SetupWizard","_SharingBar","_Signature","_SliderButton","_Slider","_SmallWaitCursor","_TagInput","_TextArea","_Tooltip","_Truncation","_mentionFinder","_useElementSize","_comboBox","_contentCard","_contextMenu","_filterButtons","_truncation","_environment","_fileDialog","_isTobitEmployee","_pageProvider","_uploadFile","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set"],"sources":["../../src/index.ts"],"sourcesContent":["// noinspection JSUnusedGlobalSymbols\nexport { default as Accordion } from './components/accordion/Accordion';\nexport { default as AccordionContent } from './components/accordion/accordion-content/AccordionContent';\nexport { default as AccordionGroup } from './components/accordion/accordion-group/AccordionGroup';\nexport { default as AccordionIntro } from './components/accordion/accordion-intro/AccordionIntro';\nexport { default as AccordionItem } from './components/accordion/accordion-item/AccordionItem';\nexport { default as AmountControl } from './components/amount-control/AmountControl';\nexport {\n AreaContext,\n default as AreaProvider,\n} from './components/area-provider/AreaContextProvider';\nexport { default as Badge } from './components/badge/Badge';\nexport { default as Button } from './components/button/Button';\nexport { default as Checkbox } from './components/checkbox/Checkbox';\nexport { default as ColorSchemeProvider } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type {\n FramerMotionBugFix,\n WithTheme,\n} from './components/color-scheme-provider/ColorSchemeProvider';\nexport {\n default as ComboBox,\n type IComboBoxItem as ComboBoxItem,\n type ComboBoxTextStyles,\n type IComboBoxItems as ComboBoxItems,\n} from './components/combobox/ComboBox';\nexport { default as ContentCard } from './components/content-card/ContentCard';\nexport { default as ContextMenu, type ContextMenuRef } from './components/context-menu/ContextMenu';\nexport { default as ExpandableContent } from './components/expandable-content/ExpandableContent';\nexport { default as FileInput, type FileInputRef } from './components/file-input/FileInput';\nexport { default as FilterButton } from './components/filter-buttons/filter-button/FilterButton';\nexport { default as FilterButtons } from './components/filter-buttons/FilterButtons';\nexport { default as GridImage } from './components/grid-image/GridImage';\nexport { default as Icon } from './components/icon/Icon';\nexport { default as Input } from './components/input/Input';\nexport { default as List } from './components/list/List';\nexport { default as ListItemContent } from './components/list/list-item/list-item-content/ListItemContent';\nexport {\n default as ListItem,\n type ListItemElements,\n type ListItemProps,\n} from './components/list/list-item/ListItem';\nexport { default as MentionFinder } from './components/mention-finder/MentionFinder';\nexport type { MentionMember } from './components/mention-finder/MentionFinder';\nexport { default as NumberInput } from './components/number-input/NumberInput';\nexport { default as PageProvider } from './components/page-provider/PageProvider';\nexport { default as Popup } from './components/popup/Popup';\nexport { default as PopupContent } from './components/popup/popup-content/PopupContent';\nexport { default as ProgressBar } from './components/progress-bar/ProgressBar';\nexport {\n default as RadioButtonGroup,\n type RadioButtonGroupRef,\n} from './components/radio-button/radio-button-group/RadioButtonGroup';\nexport { default as RadioButton } from './components/radio-button/RadioButton';\nexport { default as ScrollView } from './components/scroll-view/ScrollView';\nexport { default as SearchBox } from './components/search-box/SearchBox';\nexport { default as SearchInput } from './components/search-input/SearchInput';\nexport { default as SelectButton } from './components/select-button/SelectButton';\nexport { default as SetupWizardItem } from './components/setup-wizard/setup-wizard-item/SetupWizardItem';\nexport { default as SetupWizard } from './components/setup-wizard/SetupWizard';\nexport type { SetupWizardRef } from './components/setup-wizard/SetupWizard';\nexport { default as SharingBar } from './components/sharing-bar/SharingBar';\nexport { default as Signature } from './components/signature/Signature';\nexport type { SignatureRef } from './components/signature/Signature';\nexport { default as SliderButton } from './components/slider-button/SliderButton';\nexport { default as Slider } from './components/slider/Slider';\nexport {\n default as SmallWaitCursor,\n SmallWaitCursorSize,\n SmallWaitCursorSpeed,\n} from './components/small-wait-cursor/SmallWaitCursor';\nexport { default as TagInput } from './components/tag-input/TagInput';\nexport { default as TextArea } from './components/text-area/TextArea';\nexport { default as Tooltip } from './components/tooltip/Tooltip';\nexport { default as Truncation } from './components/truncation/Truncation';\nexport { MentionFinderPopupAlignment } from './constants/mentionFinder';\nexport { useElementSize } from './hooks/useElementSize';\nexport { ComboBoxDirection } from './types/comboBox';\nexport { ContentCardType } from './types/contentCard';\nexport { ContextMenuAlignment } from './types/contextMenu';\nexport type { FileItem, Image, InternalFileItem, Meta, Video } from './types/file';\nexport type { FileInputFileItem } from './types/fileInput';\nexport { FilterButtonItemShape, FilterButtonSize } from './types/filterButtons';\nexport type { IFilterButtonItem as FilterButtonItem } from './types/filterButtons';\nexport type { IListItemRightElements } from './types/list';\nexport type { PopupRef } from './types/popup';\nexport type { RadioButtonItem } from './types/radioButton';\nexport type {\n ISearchBoxItem as SearchBoxItem,\n ISearchBoxItems as SearchBoxItems,\n} from './types/searchBox';\nexport type { SelectButtonItem } from './types/selectButton';\nexport type { SliderButtonItem } from './types/slider-button';\nexport { ClampPosition } from './types/truncation';\nexport { getIsTouch } from './utils/environment';\nexport { getFileAsArrayBuffer, selectFiles } from './utils/fileDialog';\nexport { isTobitEmployee } from './utils/isTobitEmployee';\nexport { getUsableHeight } from './utils/pageProvider';\nexport { uploadFile } from './utils/uploadFile';\nexport { useColorScheme } from './components/color-scheme-provider/ColorSchemeProvider';\nexport type { ColorSchemeContextProps } from './components/color-scheme-provider/ColorSchemeProvider';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAA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A,CAAA,IAAAA,CAAA,CAAAI,UAAA,GAAAJ,CAAA,KAAAK,OAAA,EAAAL,CAAA","ignoreList":[]}
@@ -12,9 +12,15 @@ const calculateContentWidth = list => {
12
12
  const length = [];
13
13
  list.forEach(({
14
14
  suffixElement,
15
- text
15
+ text,
16
+ textStyles
16
17
  }) => {
17
- const div = document.createElement('div');
18
+ const tagName = (textStyles === null || textStyles === void 0 ? void 0 : textStyles.tagName) ?? 'div';
19
+ const styles = textStyles === null || textStyles === void 0 ? void 0 : textStyles.styles;
20
+ const div = document.createElement(tagName);
21
+ if (styles) {
22
+ Object.assign(div.style, styles);
23
+ }
18
24
  div.style.display = 'flex';
19
25
  div.style.gap = '10px';
20
26
  div.style.position = 'absolute';
@@ -1 +1 @@
1
- {"version":3,"file":"calculate.js","names":["_react","_interopRequireDefault","require","_server","_ColorSchemeProvider","e","__esModule","default","calculateContentWidth","list","length","forEach","suffixElement","text","div","document","createElement","style","display","gap","position","visibility","whiteSpace","width","body","appendChild","innerText","innerHTML","renderToString","color","colorMode","push","offsetWidth","removeChild","Math","max","apply","exports","calculateBiggestWidth","elements","container","padding","id","element","accessKey","calculateContentHeight","heights","offsetHeight","reduce","partialSum","a","getHeightOfSingleTextLine","span","height","getMaxHeightInPixels","maxHeight","rootElement","tempElement","getBoundingClientRect"],"sources":["../../../src/utils/calculate.tsx"],"sourcesContent":["import React, { type CSSProperties } from 'react';\nimport { renderToString } from 'react-dom/server';\nimport ColorSchemeProvider from '../components/color-scheme-provider/ColorSchemeProvider';\nimport type { IComboBoxItem } from '../components/combobox/ComboBox';\nimport type { SliderButtonItem } from '../types/slider-button';\n\nexport const calculateContentWidth = (list: IComboBoxItem[]) => {\n const length: number[] = [];\n\n list.forEach(({ suffixElement, text }) => {\n const div = document.createElement('div');\n\n div.style.display = 'flex';\n div.style.gap = '10px';\n div.style.position = 'absolute';\n div.style.visibility = 'hidden';\n div.style.whiteSpace = 'nowrap';\n div.style.width = 'auto';\n\n document.body.appendChild(div);\n\n div.innerText = text;\n\n if (suffixElement) {\n // ColorSchemeProvider is used to prevent missing scheme context error.\n // Due to the fact that the element is never rendered visible, the values are irrelevant.\n div.innerHTML += renderToString(\n <ColorSchemeProvider color=\"#005EB8\" colorMode={0}>\n {suffixElement}\n </ColorSchemeProvider>,\n );\n }\n\n length.push(div.offsetWidth);\n\n document.body.removeChild(div);\n });\n\n return Math.max.apply(null, length);\n};\n\nexport const calculateBiggestWidth = (elements: SliderButtonItem[]) => {\n const container = document.createElement('div');\n\n container.style.visibility = 'hidden';\n container.style.position = 'absolute';\n container.style.width = 'auto';\n container.style.whiteSpace = 'nowrap';\n container.style.padding = '7px 12px';\n container.style.display = 'block';\n\n elements.forEach(({ text, id }) => {\n const element = document.createElement('div');\n\n element.accessKey = `slider-button-pseudo--${id}`;\n element.innerText = text;\n\n container.appendChild(element);\n });\n\n document.body.appendChild(container);\n\n const width = container.offsetWidth;\n\n document.body.removeChild(container);\n\n return width;\n};\n\nexport const calculateContentHeight = (elements: string[]) => {\n const heights: number[] = [];\n\n elements.forEach((element: string) => {\n const div = document.createElement('div');\n\n div.style.visibility = 'hidden';\n div.style.position = 'absolute';\n div.style.width = 'auto';\n div.style.padding = '4px 10px';\n div.style.whiteSpace = 'nowrap';\n\n document.body.appendChild(div);\n\n div.innerText = element;\n\n heights.push(div.offsetHeight);\n\n document.body.removeChild(div);\n });\n\n return heights.reduce((partialSum, a) => partialSum + a, 0);\n};\n\nexport const getHeightOfSingleTextLine = () => {\n const span = document.createElement('span');\n\n span.innerText = 'A';\n\n document.body.appendChild(span);\n\n const height = span.offsetHeight;\n\n document.body.removeChild(span);\n\n return height;\n};\n\nexport const getMaxHeightInPixels = (\n maxHeight: CSSProperties['maxHeight'],\n rootElement: HTMLElement,\n): number => {\n const tempElement = document.createElement('div');\n\n tempElement.style.position = 'absolute';\n tempElement.style.visibility = 'hidden';\n tempElement.style.height = '100vh';\n tempElement.style.maxHeight = maxHeight as string;\n\n rootElement.appendChild(tempElement);\n\n const { height } = tempElement.getBoundingClientRect();\n\n rootElement.removeChild(tempElement);\n\n return height;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA0F,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAInF,MAAMG,qBAAqB,GAAIC,IAAqB,IAAK;EAC5D,MAAMC,MAAgB,GAAG,EAAE;EAE3BD,IAAI,CAACE,OAAO,CAAC,CAAC;IAAEC,aAAa;IAAEC;EAAK,CAAC,KAAK;IACtC,MAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAEzCF,GAAG,CAACG,KAAK,CAACC,OAAO,GAAG,MAAM;IAC1BJ,GAAG,CAACG,KAAK,CAACE,GAAG,GAAG,MAAM;IACtBL,GAAG,CAACG,KAAK,CAACG,QAAQ,GAAG,UAAU;IAC/BN,GAAG,CAACG,KAAK,CAACI,UAAU,GAAG,QAAQ;IAC/BP,GAAG,CAACG,KAAK,CAACK,UAAU,GAAG,QAAQ;IAC/BR,GAAG,CAACG,KAAK,CAACM,KAAK,GAAG,MAAM;IAExBR,QAAQ,CAACS,IAAI,CAACC,WAAW,CAACX,GAAG,CAAC;IAE9BA,GAAG,CAACY,SAAS,GAAGb,IAAI;IAEpB,IAAID,aAAa,EAAE;MACf;MACA;MACAE,GAAG,CAACa,SAAS,IAAI,IAAAC,sBAAc,eAC3B5B,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACZ,oBAAA,CAAAG,OAAmB;QAACsB,KAAK,EAAC,SAAS;QAACC,SAAS,EAAE;MAAE,GAC7ClB,aACgB,CACzB,CAAC;IACL;IAEAF,MAAM,CAACqB,IAAI,CAACjB,GAAG,CAACkB,WAAW,CAAC;IAE5BjB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AAwB,KACf;EACT,MAAMC,WAAW,GAAG1C,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAEjDyC,WAAW,CAACxC,KAAK,CAACG,QAAQ,GAAG,UAAU;EACvCqC,WAAW,CAACxC,KAAK,CAACI,UAAU,GAAG,QAAQ;EACvCoC,WAAW,CAACxC,KAAK,CAACoC,MAAM,GAAG,OAAO;EAClCI,WAAW,CAACxC,KAAK,CAACsC,SAAS,GAAGA,SAAmB;EAEjDC,WAAW,CAAC/B,WAAW,CAACgC,WAAW,CAAC;EAEpC,MAAM;IAAEJ;EAAO,CAAC,GAAGI,WAAW,CAACC,qBAAqB,CAAC,CAAC;EAEtDF,WAAW,CAACvB,WAAW,CAACwB,WAAW,CAAC;EAEpC,OAAOJ,MAAM;AACjB,CAAC;AAAChB,OAAA,CAAAiB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"file":"calculate.js","names":["_react","_interopRequireDefault","require","_server","_ColorSchemeProvider","e","__esModule","default","calculateContentWidth","list","length","forEach","suffixElement","text","textStyles","tagName","styles","div","document","createElement","Object","assign","style","display","gap","position","visibility","whiteSpace","width","body","appendChild","innerText","innerHTML","renderToString","color","colorMode","push","offsetWidth","removeChild","Math","max","apply","exports","calculateBiggestWidth","elements","container","padding","id","element","accessKey","calculateContentHeight","heights","offsetHeight","reduce","partialSum","a","getHeightOfSingleTextLine","span","height","getMaxHeightInPixels","maxHeight","rootElement","tempElement","getBoundingClientRect"],"sources":["../../../src/utils/calculate.tsx"],"sourcesContent":["import React, { type CSSProperties } from 'react';\nimport { renderToString } from 'react-dom/server';\nimport ColorSchemeProvider from '../components/color-scheme-provider/ColorSchemeProvider';\nimport type { IComboBoxItem } from '../components/combobox/ComboBox';\nimport type { SliderButtonItem } from '../types/slider-button';\n\nexport const calculateContentWidth = (list: IComboBoxItem[]) => {\n const length: number[] = [];\n\n list.forEach(({ suffixElement, text, textStyles }) => {\n const tagName = textStyles?.tagName ?? 'div';\n const styles = textStyles?.styles;\n\n const div = document.createElement(tagName);\n\n if (styles) {\n Object.assign(div.style, styles);\n }\n\n div.style.display = 'flex';\n div.style.gap = '10px';\n div.style.position = 'absolute';\n div.style.visibility = 'hidden';\n div.style.whiteSpace = 'nowrap';\n div.style.width = 'auto';\n\n document.body.appendChild(div);\n\n div.innerText = text;\n\n if (suffixElement) {\n // ColorSchemeProvider is used to prevent missing scheme context error.\n // Due to the fact that the element is never rendered visible, the values are irrelevant.\n div.innerHTML += renderToString(\n <ColorSchemeProvider color=\"#005EB8\" colorMode={0}>\n {suffixElement}\n </ColorSchemeProvider>,\n );\n }\n\n length.push(div.offsetWidth);\n\n document.body.removeChild(div);\n });\n\n return Math.max.apply(null, length);\n};\n\nexport const calculateBiggestWidth = (elements: SliderButtonItem[]) => {\n const container = document.createElement('div');\n\n container.style.visibility = 'hidden';\n container.style.position = 'absolute';\n container.style.width = 'auto';\n container.style.whiteSpace = 'nowrap';\n container.style.padding = '7px 12px';\n container.style.display = 'block';\n\n elements.forEach(({ text, id }) => {\n const element = document.createElement('div');\n\n element.accessKey = `slider-button-pseudo--${id}`;\n element.innerText = text;\n\n container.appendChild(element);\n });\n\n document.body.appendChild(container);\n\n const width = container.offsetWidth;\n\n document.body.removeChild(container);\n\n return width;\n};\n\nexport const calculateContentHeight = (elements: string[]) => {\n const heights: number[] = [];\n\n elements.forEach((element: string) => {\n const div = document.createElement('div');\n\n div.style.visibility = 'hidden';\n div.style.position = 'absolute';\n div.style.width = 'auto';\n div.style.padding = '4px 10px';\n div.style.whiteSpace = 'nowrap';\n\n document.body.appendChild(div);\n\n div.innerText = element;\n\n heights.push(div.offsetHeight);\n\n document.body.removeChild(div);\n });\n\n return heights.reduce((partialSum, a) => partialSum + a, 0);\n};\n\nexport const getHeightOfSingleTextLine = () => {\n const span = document.createElement('span');\n\n span.innerText = 'A';\n\n document.body.appendChild(span);\n\n const height = span.offsetHeight;\n\n document.body.removeChild(span);\n\n return height;\n};\n\nexport const getMaxHeightInPixels = (\n maxHeight: CSSProperties['maxHeight'],\n rootElement: HTMLElement,\n): number => {\n const tempElement = document.createElement('div');\n\n tempElement.style.position = 'absolute';\n tempElement.style.visibility = 'hidden';\n tempElement.style.height = '100vh';\n tempElement.style.maxHeight = maxHeight as string;\n\n rootElement.appendChild(tempElement);\n\n const { height } = tempElement.getBoundingClientRect();\n\n rootElement.removeChild(tempElement);\n\n return height;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAA0F,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAInF,MAAMG,qBAAqB,GAAIC,IAAqB,IAAK;EAC5D,MAAMC,MAAgB,GAAG,EAAE;EAE3BD,IAAI,CAACE,OAAO,CAAC,CAAC;IAAEC,aAAa;IAAEC,IAAI;IAAEC;EAAW,CAAC,KAAK;IAClD,MAAMC,OAAO,GAAG,CAAAD,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEC,OAAO,KAAI,KAAK;IAC5C,MAAMC,MAAM,GAAGF,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEE,MAAM;IAEjC,MAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAa,CAACJ,OAAO,CAAC;IAE3C,IAAIC,MAAM,EAAE;MACRI,MAAM,CAACC,MAAM,CAACJ,GAAG,CAACK,KAAK,EAAEN,MAAM,CAAC;IACpC;IAEAC,GAAG,CAACK,KAAK,CAACC,OAAO,GAAG,MAAM;IAC1BN,GAAG,CAACK,KAAK,CAACE,GAAG,GAAG,MAAM;IACtBP,GAAG,CAACK,KAAK,CAACG,QAAQ,GAAG,UAAU;IAC/BR,GAAG,CAACK,KAAK,CAACI,UAAU,GAAG,QAAQ;IAC/BT,GAAG,CAACK,KAAK,CAAC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AAQ,sBAAA,GAAAA,sBAAA;AAEK,MAAMM,yBAAyB,GAAGA,CAAA,KAAM;EAC3C,MAAMC,IAAI,GAAGvC,QAAQ,CAACC,aAAa,CAAC,MAAM,CAAC;EAE3CsC,IAAI,CAAC1B,SAAS,GAAG,GAAG;EAEpBb,QAAQ,CAACW,IAAI,CAACC,WAAW,CAAC2B,IAAI,CAAC;EAE/B,MAAMC,MAAM,GAAGD,IAAI,CAACL,YAAY;EAEhClC,QAAQ,CAACW,IAAI,CAACS,WAAW,CAACmB,IAAI,CAAC;EAE/B,OAAOC,MAAM;AACjB,CAAC;AAAChB,OAAA,CAAAc,yBAAA,GAAAA,yBAAA;AAEK,MAAMG,oBAAoB,GAAGA,CAChCC,SAAqC,EACrCC,WAAwB,KACf;EACT,MAAMC,WAAW,GAAG5C,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAEjD2C,WAAW,CAACxC,KAAK,CAACG,QAAQ,GAAG,UAAU;EACvCqC,WAAW,CAACxC,KAAK,CAACI,UAAU,GAAG,QAAQ;EACvCoC,WAAW,CAACxC,KAAK,CAACoC,MAAM,GAAG,OAAO;EAClCI,WAAW,CAACxC,KAAK,CAACsC,SAAS,GAAGA,SAAmB;EAEjDC,WAAW,CAAC/B,WAAW,CAACgC,WAAW,CAAC;EAEpC,MAAM;IAAEJ;EAAO,CAAC,GAAGI,WAAW,CAACC,qBAAqB,CAAC,CAAC;EAEtDF,WAAW,CAACvB,WAAW,CAACwB,WAAW,CAAC;EAEpC,OAAOJ,MAAM;AACjB,CAAC;AAAChB,OAAA,CAAAiB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -47,19 +47,21 @@ const ColorSchemeProvider = _ref => {
47
47
  useEffect(() => {
48
48
  if (designSettings) {
49
49
  setInternalDesignSettings(designSettings);
50
- } else {
50
+ } else if (!internalDesignSettings) {
51
51
  void getDesignSettings(siteId).then(result => {
52
52
  setInternalDesignSettings(result);
53
53
  });
54
54
  }
55
+ }, [designSettings, internalDesignSettings, siteId]);
56
+ useEffect(() => {
55
57
  if (paragraphFormat) {
56
58
  setInternalParagraphFormat(paragraphFormat);
57
- } else {
59
+ } else if (!internalParagraphFormat) {
58
60
  void getParagraphFormat(siteId).then(result => {
59
61
  setInternalParagraphFormat(result);
60
62
  });
61
63
  }
62
- }, [designSettings, paragraphFormat, siteId]);
64
+ }, [internalParagraphFormat, paragraphFormat, siteId]);
63
65
  useEffect(() => {
64
66
  let newColors = {};
65
67
  let newTheme = {};
@@ -1 +1 @@
1
- {"version":3,"file":"ColorSchemeProvider.js","names":["getAvailableColorList","getColorFromPalette","hexToRgb255","useSite","React","createContext","useContext","useEffect","useMemo","useState","Helmet","createGlobalStyle","ThemeProvider","getDesignSettings","getParagraphFormat","convertIconStyle","getFontSize","getHeadlineColorSelector","ColorMode","GlobalStyle","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","_ref","children","color","colorMode","cssVariables","secondaryColor","siteId","style","paragraphFormat","designSettings","theme","colors","internalColors","setInternalColors","internalTheme","setInternalTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","then","result","newColors","newTheme","availableColors","forEach","colorName","hexColor","rgbColor","r","g","b","Light","Dark","Object","keys","key","iconStyle","colorResult","themeResult","fontSize","contextValue","createElement","Provider","value","rel","href","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, {\n createContext,\n FC,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { Helmet } from 'react-helmet';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, getFontSize, getHeadlineColorSelector } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The colors of the components\n */\n colors?: Theme;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The general format settings.\n */\n paragraphFormat?: ParagraphFormat[];\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * The theme for the components\n */\n theme?: Theme;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings: DesignSettings;\n paragraphFormat: ParagraphFormat[];\n colors: Theme;\n theme: Theme;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n siteId,\n style = {},\n paragraphFormat,\n designSettings,\n theme,\n colors,\n}) => {\n const [internalColors, setInternalColors] = useState<Theme>(colors ?? {});\n const [internalTheme, setInternalTheme] = useState<Theme>(theme ?? {});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n } else {\n void getDesignSettings(siteId).then((result) => {\n setInternalDesignSettings(result);\n });\n }\n\n if (paragraphFormat) {\n setInternalParagraphFormat(paragraphFormat);\n } else {\n void getParagraphFormat(siteId).then((result) => {\n setInternalParagraphFormat(result);\n });\n }\n }, [designSettings, paragraphFormat, siteId]);\n\n useEffect(() => {\n let newColors: Theme = {};\n let newTheme: Theme = {};\n\n const availableColors = getAvailableColorList();\n\n if (!colors || !theme) {\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n if (!theme) {\n newTheme[colorName] = hexColor;\n }\n\n if (!colors) {\n newColors[`--chayns-color--${colorName}`] = hexColor;\n }\n\n if (rgbColor) {\n if (!theme) {\n newTheme[`${colorName}-rgb`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n\n if (!colors) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n }\n });\n }\n\n if (colors) {\n newColors = colors;\n }\n\n if (!theme) {\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } =\n getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n } else {\n newTheme = theme;\n }\n\n setInternalTheme(newTheme);\n setInternalColors(newColors);\n }, [\n color,\n colorMode,\n colors,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n theme,\n ]);\n\n const contextValue: ColorSchemeContextProps | undefined = useMemo(() => {\n if (internalDesignSettings && internalParagraphFormat) {\n return {\n paragraphFormat: internalParagraphFormat,\n designSettings: internalDesignSettings,\n colors: internalColors,\n theme: internalTheme,\n };\n }\n\n return undefined;\n }, [internalColors, internalDesignSettings, internalParagraphFormat, internalTheme]);\n\n return (\n <ThemeProvider theme={internalTheme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <Helmet>\n <link\n rel=\"stylesheet\"\n href=\"https://api.chayns-static.space/font/NotoColorEmoji/v1/font.css\"\n />\n </Helmet>\n <div\n className=\"color-scheme-provider\"\n style={{\n ...internalColors,\n ...cssVariables,\n ...style,\n color: 'var(--chayns-color--text)',\n }}\n >\n {children}\n </div>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAASA,qBAAqB,EAAEC,mBAAmB,EAAEC,WAA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,KAAK,EAAEI;EAAc,gBAChClC,KAAA,CAAAgE,aAAA,CAAChD,kBAAkB,CAACiD,QAAQ;IAACC,KAAK,EAAEH;EAAa,gBAC7C/D,KAAA,CAAAgE,aAAA,CAAC1D,MAAM,qBACHN,KAAA,CAAAgE,aAAA;IACIG,GAAG,EAAC,YAAY;IAChBC,IAAI,EAAC;EAAiE,CACzE,CACG,CAAC,eACTpE,KAAA,CAAAgE,aAAA;IACIK,SAAS,EAAC,uBAAuB;IACjC1C,KAAK,EAAE;MACH,GAAGK,cAAc;MACjB,GAAGR,YAAY;MACf,GAAGG,KAAK;MACRL,KAAK,EAAE;IACX;EAAE,GAEDD,QACA,CAAC,eACNrB,KAAA,CAAAgE,aAAA,CAACjD,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDI,mBAAmB,CAACmD,WAAW,GAAG,qBAAqB;AAEvD,eAAenD,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"ColorSchemeProvider.js","names":["getAvailableColorList","getColorFromPalette","hexToRgb255","useSite","React","createContext","useContext","useEffect","useMemo","useState","Helmet","createGlobalStyle","ThemeProvider","getDesignSettings","getParagraphFormat","convertIconStyle","getFontSize","getHeadlineColorSelector","ColorMode","GlobalStyle","ColorSchemeContext","undefined","useColorScheme","ColorSchemeProvider","_ref","children","color","colorMode","cssVariables","secondaryColor","siteId","style","paragraphFormat","designSettings","theme","colors","internalColors","setInternalColors","internalTheme","setInternalTheme","internalDesignSettings","setInternalDesignSettings","internalParagraphFormat","setInternalParagraphFormat","internalColor","internalColorMode","then","result","newColors","newTheme","availableColors","forEach","colorName","hexColor","rgbColor","r","g","b","Light","Dark","Object","keys","key","iconStyle","colorResult","themeResult","fontSize","contextValue","createElement","Provider","value","rel","href","className","displayName"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { getAvailableColorList, getColorFromPalette, hexToRgb255 } from '@chayns/colors';\nimport { useSite } from 'chayns-api';\nimport React, {\n createContext,\n FC,\n ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport { Helmet } from 'react-helmet';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { getDesignSettings, getParagraphFormat } from '../../api/theme/get';\nimport type { DesignSettings, ParagraphFormat } from '../../types/colorSchemeProvider';\nimport { convertIconStyle, getFontSize, getHeadlineColorSelector } from '../../utils/font';\n\nenum ColorMode {\n Classic,\n Dark,\n Light,\n}\n\nexport type ColorSchemeProviderProps = {\n /**\n * The content of the application or the components for which the styles should be set\n */\n children: ReactNode;\n /**\n * The hex color to be used for the children\n */\n color?: string;\n /**\n * The colors of the components\n */\n colors?: Theme;\n /**\n * The color mode to be used for the children\n */\n colorMode?: ColorMode;\n /**\n * Css variables to be added in addition to the chayns variables\n */\n cssVariables?: { [key: string]: string | number };\n /**\n * The design settings of a page.\n */\n designSettings?: DesignSettings;\n /**\n * The general format settings.\n */\n paragraphFormat?: ParagraphFormat[];\n /**\n * The secondary hex color to be used for the children\n */\n secondaryColor?: string;\n /**\n * The site id of the page for which the design settings should be fetched\n */\n siteId?: string;\n /**\n * Additional styles set on the root element\n */\n style?: { [key: string]: string | number };\n /**\n * The theme for the components\n */\n theme?: Theme;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\n// ToDo remove type after the framer-motion bug is Fixed\nexport type FramerMotionBugFix = WithTheme<unknown>;\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings: DesignSettings;\n paragraphFormat: ParagraphFormat[];\n colors: Theme;\n theme: Theme;\n}\n\nexport const ColorSchemeContext = createContext<ColorSchemeContextProps | undefined>(undefined);\n\nexport const useColorScheme = () => useContext(ColorSchemeContext);\n\nconst ColorSchemeProvider: FC<ColorSchemeProviderProps> = ({\n children,\n color,\n colorMode,\n cssVariables = {},\n secondaryColor,\n siteId,\n style = {},\n paragraphFormat,\n designSettings,\n theme,\n colors,\n}) => {\n const [internalColors, setInternalColors] = useState<Theme>(colors ?? {});\n const [internalTheme, setInternalTheme] = useState<Theme>(theme ?? {});\n const [internalDesignSettings, setInternalDesignSettings] = useState<DesignSettings>();\n const [internalParagraphFormat, setInternalParagraphFormat] = useState<ParagraphFormat[]>();\n\n // Empty object is used to prevent error if ColorSchemeProvider is rendered on server\n const { color: internalColor, colorMode: internalColorMode } = useSite() ?? {};\n\n useEffect(() => {\n if (designSettings) {\n setInternalDesignSettings(designSettings);\n } else if (!internalDesignSettings) {\n void getDesignSettings(siteId).then((result) => {\n setInternalDesignSettings(result);\n });\n }\n }, [designSettings, internalDesignSettings, siteId]);\n\n useEffect(() => {\n if (paragraphFormat) {\n setInternalParagraphFormat(paragraphFormat);\n } else if (!internalParagraphFormat) {\n void getParagraphFormat(siteId).then((result) => {\n setInternalParagraphFormat(result);\n });\n }\n }, [internalParagraphFormat, paragraphFormat, siteId]);\n\n useEffect(() => {\n let newColors: Theme = {};\n let newTheme: Theme = {};\n\n const availableColors = getAvailableColorList();\n\n if (!colors || !theme) {\n availableColors.forEach((colorName: string) => {\n const hexColor = getColorFromPalette(colorName, {\n color: color ?? internalColor,\n colorMode: colorMode ?? internalColorMode,\n secondaryColor,\n });\n\n if (hexColor) {\n const rgbColor = hexToRgb255(hexColor);\n\n if (!theme) {\n newTheme[colorName] = hexColor;\n }\n\n if (!colors) {\n newColors[`--chayns-color--${colorName}`] = hexColor;\n }\n\n if (rgbColor) {\n if (!theme) {\n newTheme[`${colorName}-rgb`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n\n if (!colors) {\n newColors[`--chayns-color-rgb--${colorName}`] =\n `${rgbColor.r}, ${rgbColor.g}, ${rgbColor.b}`;\n }\n }\n }\n });\n }\n\n if (colors) {\n newColors = colors;\n }\n\n if (!theme) {\n switch (colorMode ?? internalColorMode) {\n case ColorMode.Light:\n newTheme.colorMode = 'light';\n break;\n case ColorMode.Dark:\n newTheme.colorMode = 'dark';\n break;\n default:\n newTheme.colorMode = 'classic';\n break;\n }\n\n if (internalDesignSettings) {\n Object.keys(internalDesignSettings).forEach((key) => {\n if (key === 'iconStyle') {\n newTheme[key] = convertIconStyle(internalDesignSettings.iconStyle);\n\n return;\n }\n\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = internalDesignSettings[key];\n });\n }\n\n if (internalParagraphFormat) {\n const { colorResult, themeResult } =\n getHeadlineColorSelector(internalParagraphFormat);\n\n // Update chayns-colors\n Object.keys(colorResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newColors[key] = colorResult[key];\n });\n\n // Update Theme\n Object.keys(themeResult).forEach((key) => {\n // ToDo: Find better solution\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n newTheme[key] = themeResult[key];\n });\n }\n\n newTheme.fontSize = getFontSize();\n } else {\n newTheme = theme;\n }\n\n setInternalTheme(newTheme);\n setInternalColors(newColors);\n }, [\n color,\n colorMode,\n colors,\n internalColor,\n internalColorMode,\n internalDesignSettings,\n internalParagraphFormat,\n secondaryColor,\n theme,\n ]);\n\n const contextValue: ColorSchemeContextProps | undefined = useMemo(() => {\n if (internalDesignSettings && internalParagraphFormat) {\n return {\n paragraphFormat: internalParagraphFormat,\n designSettings: internalDesignSettings,\n colors: internalColors,\n theme: internalTheme,\n };\n }\n\n return undefined;\n }, [internalColors, internalDesignSettings, internalParagraphFormat, internalTheme]);\n\n return (\n <ThemeProvider theme={internalTheme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <Helmet>\n <link\n rel=\"stylesheet\"\n href=\"https://api.chayns-static.space/font/NotoColorEmoji/v1/font.css\"\n />\n </Helmet>\n <div\n className=\"color-scheme-provider\"\n style={{\n ...internalColors,\n ...cssVariables,\n ...style,\n color: 'var(--chayns-color--text)',\n }}\n >\n {children}\n </div>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":"AAAA,SAASA,qBAAqB,EAAEC,mBAAmB,EAAEC,WAAW,QAAQ,gBAAgB;AACxF,SAASC,OAAO,QAAQ,YAAY;AACpC,OAAOC,KAAK,IACRC,aAAa,EAGbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACL,OAAO;AACd,SAASC,MAAM,QAAQ,cAAc;AACrC,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACpE,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,qBAAqB;AAE3E,SAASC,gBAAgB,EAAEC,WAAW,EAAEC,wBAAwB,QAAQ,kBAAkB;AAAC,IAEtFC,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA,EAATA,SAAS,SA6Dd;AAGA,MAAMC,WAAW,GAAGR,iBAAiB;AACrC;AACA;AACA;AACA;AACA;AACA,CAAC;AASD,OAAO,MAAMS,kBAAkB,gBAAGf,aAAa,CAAsCgB,SAAS,CAAC;AAE/F,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAMhB,UAAU,CAACc,kBAAkB,CAAC;AAElE,MAAMG,mBAAiD,GAAGC,IAAA,IAYpD;EAAA,IAZqD;IACvDC,QAAQ;IACRC,KAAK;IACLC,SAAS;IACTC,YAAY,GAAG,CAAC,CAAC;IACjBC,cAAc;IACdC,MAAM;IACNC,KAAK,GAAG,CAAC,CAAC;IACVC,eAAe;IACfC,cA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ACTQ,MAAM,EACNS,aAAa,EACbC,iBAAiB,EACjBL,sBAAsB,EACtBE,uBAAuB,EACvBb,cAAc,EACdK,KAAK,CACR,CAAC;EAEF,MAAMiC,YAAiD,GAAG3D,OAAO,CAAC,MAAM;IACpE,IAAIgC,sBAAsB,IAAIE,uBAAuB,EAAE;MACnD,OAAO;QACHV,eAAe,EAAEU,uBAAuB;QACxCT,cAAc,EAAEO,sBAAsB;QACtCL,MAAM,EAAEC,cAAc;QACtBF,KAAK,EAAEI;MACX,CAAC;IACL;IAEA,OAAOjB,SAAS;EACpB,CAAC,EAAE,CAACe,cAAc,EAAEI,sBAAsB,EAAEE,uBAAuB,EAAEJ,aAAa,CAAC,CAAC;EAEpF,oBACIlC,KAAA,CAAAgE,aAAA,CAACxD,aAAa;IAACsB,KAAK,EAAEI;EAAc,gBAChClC,KAAA,CAAAgE,aAAA,CAAChD,kBAAkB,CAACiD,QAAQ;IAACC,KAAK,EAAEH;EAAa,gBAC7C/D,KAAA,CAAAgE,aAAA,CAAC1D,MAAM,qBACHN,KAAA,CAAAgE,aAAA;IACIG,GAAG,EAAC,YAAY;IAChBC,IAAI,EAAC;EAAiE,CACzE,CACG,CAAC,eACTpE,KAAA,CAAAgE,aAAA;IACIK,SAAS,EAAC,uBAAuB;IACjC1C,KAAK,EAAE;MACH,GAAGK,cAAc;MACjB,GAAGR,YAAY;MACf,GAAGG,KAAK;MACRL,KAAK,EAAE;IACX;EAAE,GAEDD,QACA,CAAC,eACNrB,KAAA,CAAAgE,aAAA,CAACjD,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDI,mBAAmB,CAACmD,WAAW,GAAG,qBAAqB;AAEvD,eAAenD,mBAAmB","ignoreList":[]}
@@ -183,14 +183,14 @@ const ComboBox = _ref => {
183
183
  // Full width settings
184
184
  if (shouldUseFullWidth) {
185
185
  tmpMinWidth = parentWidth;
186
- tmpBodyMinWidth = calculatedWidth > parentWidth + 25 ? calculatedWidth : parentWidth;
186
+ tmpBodyMinWidth = parentWidth < calculatedWidth - 20 ? calculatedWidth - 20 : parentWidth;
187
187
  }
188
188
 
189
189
  // Current item width settings
190
190
  else if (shouldUseCurrentItemWidth && internalSelectedItem) {
191
191
  const itemWidth = calculateContentWidth([internalSelectedItem]) + paddingWidth + imageWidth + iconWidth;
192
192
  tmpMinWidth = itemWidth;
193
- tmpBodyMinWidth = itemWidth + 25 < calculatedWidth ? calculatedWidth : itemWidth;
193
+ tmpBodyMinWidth = itemWidth < calculatedWidth - 20 ? calculatedWidth - 20 : itemWidth;
194
194
  }
195
195
  setMinWidth(tmpMinWidth);
196
196
  setBodyMinWidth(tmpBodyMinWidth);
@@ -271,7 +271,8 @@ const ComboBox = _ref => {
271
271
  subtext: item.subtext,
272
272
  suffixElement: item.suffixElement,
273
273
  text: item.text,
274
- value: item.value
274
+ value: item.value,
275
+ textStyles: item.textStyles
275
276
  })));
276
277
  }), [handleSetSelectedItem, lists, selectedItem, shouldShowBigImage, shouldShowRoundImage]);
277
278
  const bodyStyles = useMemo(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.js","names":["useDevice","AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","createPortal","ComboBoxDirection","calculateContentWidth","getMaxHeightInPixels","getIsTouch","Icon","ComboBoxItem","StyledComboBox","StyledComboBoxHeader","StyledComboBoxIconWrapper","StyledComboBoxInput","StyledComboBoxPlaceholder","StyledComboBoxPlaceholderImage","StyledComboBoxTopic","StyledMotionComboBoxBody","ComboBox","_ref","direction","BOTTOM","isDisabled","lists","maxHeight","onSelect","placeholder","container","document","body","selectedItem","shouldShowBigImage","shouldShowRoundImage","onInputFocus","shouldUseFullWidth","onInputChange","shouldUseCurrentItemWidth","onInputBlur","inputValue","internalSelectedItem","setInternalSelectedItem","isAnimating","setIsAnimating","minWidth","setMinWidth","bodyMinWidth","setBodyMinWidth","focusedIndex","setFocusedIndex","overflowY","setOverflowY","portal","setPortal","internalCoordinates","setInternalCoordinates","x","y","styledComboBoxElementRef","contentRef","browser","isTouch","handleClick","event","current","contains","target","handleOpen","left","comboBoxLeft","top","comboBoxTop","height","getBoundingClientRect","containerLeft","containerTop","scrollLeft","scrollTop","TOP","handleClose","addEventListener","removeEventListener","handleSetSelectedItem","itemToSelect","currentContent","scrollHeight","maxHeightInPixels","handleKeyDown","e","key","preventDefault","children","length","newIndex","prevElement","tabIndex","newElement","focus","element","id","newSelectedItem","some","list","find","_ref2","value","String","replace","allItems","flatMap","hasImage","_ref3","imageUrl","hasIcon","_ref4","icons","parentWidth","parentElement","width","paddingWidth","imageWidth","iconWidth","baseWidth","text","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","itemWidth","placeholderImageUrl","undefined","placeholderIcon","placeholderText","handleHeaderClick","comboBoxGroups","map","_ref5","groupName","createElement","item","isSelected","rightElement","subtext","suffixElement","bodyStyles","styles","transform","initial","$browser","name","animate","opacity","$overflowY","exit","$maxHeight","$minWidth","style","$direction","transition","duration","ref","$shouldUseFullWidth","onClick","$isOpen","$isTouch","$isDisabled","disabled","onChange","onBlur","onFocus","$shouldReduceOpacity","src","displayName"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useDevice } from 'chayns-api';\nimport { AnimatePresence } from 'framer-motion';\nimport React, {\n FC,\n ReactPortal,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n ChangeEventHandler,\n FocusEventHandler,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { ComboBoxDirection } from '../../types/comboBox';\nimport { calculateContentWidth, getMaxHeightInPixels } from '../../utils/calculate';\nimport { getIsTouch } from '../../utils/environment';\nimport type { ContextMenuCoordinates } from '../context-menu/ContextMenu';\nimport Icon from '../icon/Icon';\nimport ComboBoxItem from './combobox-item/ComboBoxItem';\nimport {\n StyledComboBox,\n StyledComboBoxHeader,\n StyledComboBoxIconWrapper,\n StyledComboBoxInput,\n StyledComboBoxPlaceholder,\n StyledComboBoxPlaceholderImage,\n StyledComboBoxTopic,\n StyledMotionComboBoxBody,\n} from './ComboBox.styles';\n\nexport interface IComboBoxItems {\n groupName?: string;\n list: Array<IComboBoxItem>;\n}\n\nexport interface IComboBoxItem {\n icons?: string[];\n imageUrl?: string;\n isDisabled?: boolean;\n rightElement?: ReactNode;\n subtext?: string;\n suffixElement?: ReactNode;\n text: string;\n value: string | number;\n}\n\nexport type ComboBoxProps = {\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The direction in which the combobox should open.\n */\n direction?: ComboBoxDirection;\n /**\n * The value of the optional input.\n */\n inputValue?: string;\n /**\n * Whether the combobox should be disabled.\n */\n isDisabled?: boolean;\n /**\n * The list of the items that should be displayed.\n */\n lists: IComboBoxItems[];\n /**\n * The maximum height of the combobox content.\n */\n maxHeight?: CSSProperties['maxHeight'];\n /**\n * Function to be executed when the value of the optional input is changed.\n */\n onInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input lost its focus.\n */\n onInputBlur?: FocusEventHandler<HTMLInputElement> /**\n * Function to be executed when the optional input gets its focus.\n */;\n onInputFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that should be executed when an item is selected.\n */\n onSelect?: (comboboxItem: IComboBoxItem) => void;\n /**\n * A text that should be displayed when no item is selected.\n */\n placeholder: string;\n /**\n * An item that should be preselected.\n */\n selectedItem?: IComboBoxItem;\n /**\n * If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.\n */\n shouldShowBigImage?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the width of the ComboBox should be the width of the current item.\n */\n shouldUseCurrentItemWidth?: boolean;\n /**\n * Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.\n */\n shouldUseFullWidth?: boolean;\n};\n\nconst ComboBox: FC<ComboBoxProps> = ({\n direction = ComboBoxDirection.BOTTOM,\n isDisabled = false,\n lists,\n maxHeight = '280px',\n onSelect,\n placeholder,\n container = document.body,\n selectedItem,\n shouldShowBigImage,\n shouldShowRoundImage,\n onInputFocus,\n shouldUseFullWidth = false,\n onInputChange,\n shouldUseCurrentItemWidth = false,\n onInputBlur,\n inputValue,\n}) => {\n const [internalSelectedItem, setInternalSelectedItem] = useState<IComboBoxItem>();\n const [isAnimating, setIsAnimating] = useState(false);\n const [minWidth, setMinWidth] = useState(0);\n const [bodyMinWidth, setBodyMinWidth] = useState(0);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n const [overflowY, setOverflowY] = useState<CSSProperties['overflowY']>('hidden');\n const [portal, setPortal] = useState<ReactPortal>();\n const [internalCoordinates, setInternalCoordinates] = useState<ContextMenuCoordinates>({\n x: 0,\n y: 0,\n });\n\n const styledComboBoxElementRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const { browser } = useDevice();\n\n const isTouch = getIsTouch();\n\n const handleClick = useCallback(\n (event: MouseEvent) => {\n if (\n styledComboBoxElementRef.current &&\n !styledComboBoxElementRef.current.contains(event.target as Node) &&\n contentRef.current &&\n !contentRef.current.contains(event.target as Node)\n ) {\n setIsAnimating(false);\n }\n },\n [styledComboBoxElementRef],\n );\n\n const handleOpen = useCallback(() => {\n if (styledComboBoxElementRef.current) {\n const {\n left: comboBoxLeft,\n top: comboBoxTop,\n height,\n } = styledComboBoxElementRef.current.getBoundingClientRect();\n const { left: containerLeft, top: containerTop } = container.getBoundingClientRect();\n\n const x = comboBoxLeft - containerLeft + container.scrollLeft;\n const y = comboBoxTop - containerTop + container.scrollTop;\n\n setInternalCoordinates({\n x,\n y: direction === ComboBoxDirection.TOP ? y : y + height,\n });\n\n setIsAnimating(true);\n }\n }, [container, direction]);\n\n const handleClose = useCallback(() => {\n setIsAnimating(false);\n }, []);\n\n /**\n * This function adds an event listener to the document to close the combobox when the user clicks outside of it\n */\n useEffect(() => {\n document.addEventListener('click', handleClick);\n\n return () => {\n document.removeEventListener('click', handleClick);\n };\n }, [handleClick, styledComboBoxElementRef]);\n\n /**\n * This function sets the selected item\n */\n const handleSetSelectedItem = useCallback(\n (itemToSelect: IComboBoxItem) => {\n setInternalSelectedItem(itemToSelect);\n setIsAnimating(false);\n\n if (onSelect) {\n onSelect(itemToSelect);\n }\n },\n [onSelect],\n );\n\n useEffect(() => {\n const currentContent = contentRef.current;\n\n if (portal && isAnimating && currentContent) {\n const scrollHeight = currentContent.scrollHeight ?? 0;\n\n const maxHeightInPixels = getMaxHeightInPixels(\n maxHeight,\n styledComboBoxElementRef.current ?? document.body,\n );\n\n setOverflowY(scrollHeight > maxHeightInPixels ? 'scroll' : 'hidden');\n }\n }, [isAnimating, maxHeight, portal]);\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isAnimating) {\n return;\n }\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n const children = contentRef.current?.children;\n if (children && children.length > 0) {\n const newIndex =\n focusedIndex !== null\n ? (focusedIndex + (e.key === 'ArrowUp' ? -1 : 1) + children.length) %\n children.length\n : 0;\n\n if (focusedIndex !== null) {\n const prevElement = children[focusedIndex] as HTMLDivElement;\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const newElement = children[newIndex] as HTMLDivElement;\n newElement.tabIndex = 0;\n newElement.focus();\n }\n } else if (e.key === 'Enter' && focusedIndex !== null) {\n const element = contentRef.current?.children[focusedIndex];\n\n if (!element) {\n return;\n }\n\n const { id } = element;\n\n let newSelectedItem: IComboBoxItem | undefined;\n\n lists.some((list) => {\n newSelectedItem = list.list.find(\n ({ value }) => String(value) === id.replace('combobox-item__', ''),\n );\n return !!newSelectedItem;\n });\n\n if (!newSelectedItem) {\n return;\n }\n\n handleSetSelectedItem(newSelectedItem);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [focusedIndex, handleSetSelectedItem, isAnimating, lists]);\n\n /**\n * This function calculates the greatest width\n */\n useEffect(() => {\n const allItems = lists.flatMap((list) => list.list);\n const hasImage = allItems.some(({ imageUrl }) => imageUrl);\n const hasIcon = allItems.some(({ icons }) => icons);\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 45; // padding + border + arrow icon\n const imageWidth = hasImage ? 32 : 0; // image width + gap if images present\n const iconWidth = hasIcon ? 40 : 0; // icon width + gap if icons present\n\n const baseWidth = calculateContentWidth([\n ...allItems,\n { text: placeholder, value: 'placeholder' },\n ]);\n const calculatedWidth = baseWidth + paddingWidth + imageWidth + iconWidth;\n\n let tmpMinWidth = calculatedWidth;\n let tmpBodyMinWidth = calculatedWidth;\n\n // Full width settings\n if (shouldUseFullWidth) {\n tmpMinWidth = parentWidth;\n tmpBodyMinWidth = calculatedWidth > parentWidth + 25 ? calculatedWidth : parentWidth;\n }\n\n // Current item width settings\n else if (shouldUseCurrentItemWidth && internalSelectedItem) {\n const itemWidth =\n calculateContentWidth([internalSelectedItem]) +\n paddingWidth +\n imageWidth +\n iconWidth;\n\n tmpMinWidth = itemWidth;\n\n tmpBodyMinWidth = itemWidth + 25 < calculatedWidth ? calculatedWidth : itemWidth;\n }\n\n setMinWidth(tmpMinWidth);\n setBodyMinWidth(tmpBodyMinWidth);\n }, [lists, placeholder, shouldUseFullWidth, shouldUseCurrentItemWidth, internalSelectedItem]);\n\n /**\n * This function sets the external selected item\n */\n useEffect(() => {\n setIsAnimating(false);\n setInternalSelectedItem(selectedItem);\n }, [selectedItem]);\n\n const placeholderImageUrl = useMemo(() => {\n if (selectedItem) {\n return selectedItem.imageUrl;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.imageUrl;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n const placeholderIcon = useMemo(() => {\n if (selectedItem) {\n return selectedItem.icons;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.icons;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n /**\n * This function resets the placeholder\n */\n const placeholderText = useMemo(() => {\n let text = placeholder;\n\n if (selectedItem) {\n text = selectedItem.text;\n } else if (internalSelectedItem) {\n text = internalSelectedItem.text;\n }\n\n return text;\n }, [internalSelectedItem, placeholder, selectedItem]);\n\n /**\n * This function opens the content of the combobox\n */\n const handleHeaderClick = useCallback(() => {\n if (!isDisabled) {\n if (isAnimating) {\n handleClose();\n } else {\n handleOpen();\n }\n }\n }, [handleClose, handleOpen, isAnimating, isDisabled]);\n\n const comboBoxGroups = useMemo(\n () =>\n lists.map(({ groupName, list }) => (\n <div key={groupName ?? 'default-group'}>\n {groupName && lists.length > 1 && (\n <StyledComboBoxTopic>{groupName}</StyledComboBoxTopic>\n )}\n {list.map((item) => (\n // ToDo: Cleanup this - item should be given as a prop to avoid full spreading\n <ComboBoxItem\n icons={item.icons}\n id={item.value}\n imageUrl={item.imageUrl}\n isDisabled={item.isDisabled}\n isSelected={selectedItem ? item.value === selectedItem.value : false}\n key={item.value}\n onSelect={handleSetSelectedItem}\n rightElement={item.rightElement}\n shouldShowBigImage={shouldShowBigImage}\n shouldShowRoundImage={shouldShowRoundImage}\n subtext={item.subtext}\n suffixElement={item.suffixElement}\n text={item.text}\n value={item.value}\n />\n ))}\n </div>\n )),\n [handleSetSelectedItem, lists, selectedItem, shouldShowBigImage, shouldShowRoundImage],\n );\n\n const bodyStyles = useMemo(() => {\n let styles: CSSProperties = { left: internalCoordinates.x, top: internalCoordinates.y };\n\n if (direction === ComboBoxDirection.TOP) {\n styles = { ...styles, transform: 'translateY(-100%)' };\n }\n\n return styles;\n }, [direction, internalCoordinates.x, internalCoordinates.y]);\n\n useEffect(() => {\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isAnimating && (\n <StyledMotionComboBoxBody\n $browser={browser?.name}\n animate={{ height: 'fit-content', opacity: 1 }}\n $overflowY={overflowY}\n initial={{ height: 0, opacity: 0 }}\n exit={{ height: 0, opacity: 0 }}\n $maxHeight={maxHeight}\n $minWidth={bodyMinWidth}\n style={bodyStyles}\n $direction={direction}\n transition={{ duration: 0.2 }}\n tabIndex={0}\n ref={contentRef}\n >\n {comboBoxGroups}\n </StyledMotionComboBoxBody>\n )}\n </AnimatePresence>,\n container,\n ),\n );\n }, [\n bodyMinWidth,\n bodyStyles,\n browser?.name,\n comboBoxGroups,\n container,\n direction,\n isAnimating,\n maxHeight,\n minWidth,\n overflowY,\n ]);\n\n return useMemo(\n () => (\n <StyledComboBox\n ref={styledComboBoxElementRef}\n $shouldUseFullWidth={shouldUseFullWidth}\n $minWidth={minWidth}\n >\n <StyledComboBoxHeader\n $direction={direction}\n onClick={handleHeaderClick}\n $isOpen={isAnimating}\n $isTouch={isTouch}\n $isDisabled={isDisabled}\n >\n {typeof inputValue === 'string' ? (\n <StyledComboBoxInput\n disabled={isDisabled}\n value={inputValue}\n onChange={onInputChange}\n onBlur={onInputBlur}\n onFocus={onInputFocus}\n placeholder={placeholderText}\n />\n ) : (\n <StyledComboBoxPlaceholder\n $shouldReduceOpacity={!selectedItem && !internalSelectedItem}\n >\n {placeholderImageUrl && (\n <StyledComboBoxPlaceholderImage\n src={placeholderImageUrl}\n shouldShowRoundImage={shouldShowRoundImage}\n />\n )}\n {placeholderIcon && <Icon icons={placeholderIcon} />}\n {placeholderText}\n {internalSelectedItem &&\n internalSelectedItem.suffixElement &&\n internalSelectedItem.suffixElement}\n </StyledComboBoxPlaceholder>\n )}\n <StyledComboBoxIconWrapper>\n <Icon icons={['fa fa-chevron-down']} />\n </StyledComboBoxIconWrapper>\n </StyledComboBoxHeader>\n {portal}\n </StyledComboBox>\n ),\n [\n shouldUseFullWidth,\n minWidth,\n direction,\n handleHeaderClick,\n isAnimating,\n isTouch,\n isDisabled,\n inputValue,\n onInputChange,\n onInputBlur,\n onInputFocus,\n placeholderText,\n selectedItem,\n internalSelectedItem,\n placeholderImageUrl,\n shouldShowRoundImage,\n placeholderIcon,\n port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oBAAoB,IACjBA,oBAAoB,CAACsG,aAAa,IAClCtG,oBAAoB,CAACsG,aACF,CAC9B,eACDhJ,KAAA,CAAA2I,aAAA,CAAC5H,yBAAyB,qBACtBf,KAAA,CAAA2I,aAAA,CAAChI,IAAI;IAAC0G,KAAK,EAAE,CAAC,oBAAoB;EAAE,CAAE,CACf,CACT,CAAC,EACtB/D,MACW,CACnB,EACD,CACIjB,kBAAkB,EAClBS,QAAQ,EACRvB,SAAS,EACT+G,iBAAiB,EACjB1F,WAAW,EACXmB,OAAO,EACPtC,UAAU,EACVgB,UAAU,EACVH,aAAa,EACbE,WAAW,EACXJ,YAAY,EACZiG,eAAe,EACfpG,YAAY,EACZS,oBAAoB,EACpBwF,mBAAmB,EACnB/F,oBAAoB,EACpBiG,eAAe,EACf9E,MAAM,CAEd,CAAC;AACL,CAAC;AAEDjC,QAAQ,CAACwJ,WAAW,GAAG,UAAU;AAEjC,eAAexJ,QAAQ","ignoreList":[]}
1
+ {"version":3,"file":"ComboBox.js","names":["useDevice","AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","createPortal","ComboBoxDirection","calculateContentWidth","getMaxHeightInPixels","getIsTouch","Icon","ComboBoxItem","StyledComboBox","StyledComboBoxHeader","StyledComboBoxIconWrapper","StyledComboBoxInput","StyledComboBoxPlaceholder","StyledComboBoxPlaceholderImage","StyledComboBoxTopic","StyledMotionComboBoxBody","ComboBox","_ref","direction","BOTTOM","isDisabled","lists","maxHeight","onSelect","placeholder","container","document","body","selectedItem","shouldShowBigImage","shouldShowRoundImage","onInputFocus","shouldUseFullWidth","onInputChange","shouldUseCurrentItemWidth","onInputBlur","inputValue","internalSelectedItem","setInternalSelectedItem","isAnimating","setIsAnimating","minWidth","setMinWidth","bodyMinWidth","setBodyMinWidth","focusedIndex","setFocusedIndex","overflowY","setOverflowY","portal","setPortal","internalCoordinates","setInternalCoordinates","x","y","styledComboBoxElementRef","contentRef","browser","isTouch","handleClick","event","current","contains","target","handleOpen","left","comboBoxLeft","top","comboBoxTop","height","getBoundingClientRect","containerLeft","containerTop","scrollLeft","scrollTop","TOP","handleClose","addEventListener","removeEventListener","handleSetSelectedItem","itemToSelect","currentContent","scrollHeight","maxHeightInPixels","handleKeyDown","e","key","preventDefault","children","length","newIndex","prevElement","tabIndex","newElement","focus","element","id","newSelectedItem","some","list","find","_ref2","value","String","replace","allItems","flatMap","hasImage","_ref3","imageUrl","hasIcon","_ref4","icons","parentWidth","parentElement","width","paddingWidth","imageWidth","iconWidth","baseWidth","text","calculatedWidth","tmpMinWidth","tmpBodyMinWidth","itemWidth","placeholderImageUrl","undefined","placeholderIcon","placeholderText","handleHeaderClick","comboBoxGroups","map","_ref5","groupName","createElement","item","isSelected","rightElement","subtext","suffixElement","textStyles","bodyStyles","styles","transform","initial","$browser","name","animate","opacity","$overflowY","exit","$maxHeight","$minWidth","style","$direction","transition","duration","ref","$shouldUseFullWidth","onClick","$isOpen","$isTouch","$isDisabled","disabled","onChange","onBlur","onFocus","$shouldReduceOpacity","src","displayName"],"sources":["../../../../src/components/combobox/ComboBox.tsx"],"sourcesContent":["import { useDevice } from 'chayns-api';\nimport { AnimatePresence } from 'framer-motion';\nimport React, {\n FC,\n ReactPortal,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n ChangeEventHandler,\n FocusEventHandler,\n ReactHTML,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { ComboBoxDirection } from '../../types/comboBox';\nimport { calculateContentWidth, getMaxHeightInPixels } from '../../utils/calculate';\nimport { getIsTouch } from '../../utils/environment';\nimport type { ContextMenuCoordinates } from '../context-menu/ContextMenu';\nimport Icon from '../icon/Icon';\nimport ComboBoxItem from './combobox-item/ComboBoxItem';\nimport {\n StyledComboBox,\n StyledComboBoxHeader,\n StyledComboBoxIconWrapper,\n StyledComboBoxInput,\n StyledComboBoxPlaceholder,\n StyledComboBoxPlaceholderImage,\n StyledComboBoxTopic,\n StyledMotionComboBoxBody,\n} from './ComboBox.styles';\n\nexport interface IComboBoxItems {\n groupName?: string;\n list: Array<IComboBoxItem>;\n}\n\nexport interface ComboBoxTextStyles {\n tagName?: keyof ReactHTML;\n styles?: CSSProperties;\n}\n\nexport interface IComboBoxItem {\n icons?: string[];\n imageUrl?: string;\n isDisabled?: boolean;\n rightElement?: ReactNode;\n subtext?: string;\n suffixElement?: ReactNode;\n text: string;\n value: string | number;\n textStyles?: ComboBoxTextStyles;\n}\n\nexport type ComboBoxProps = {\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * The direction in which the combobox should open.\n */\n direction?: ComboBoxDirection;\n /**\n * The value of the optional input.\n */\n inputValue?: string;\n /**\n * Whether the combobox should be disabled.\n */\n isDisabled?: boolean;\n /**\n * The list of the items that should be displayed.\n */\n lists: IComboBoxItems[];\n /**\n * The maximum height of the combobox content.\n */\n maxHeight?: CSSProperties['maxHeight'];\n /**\n * Function to be executed when the value of the optional input is changed.\n */\n onInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the optional input lost its focus.\n */\n onInputBlur?: FocusEventHandler<HTMLInputElement> /**\n * Function to be executed when the optional input gets its focus.\n */;\n onInputFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function that should be executed when an item is selected.\n */\n onSelect?: (comboboxItem: IComboBoxItem) => void;\n /**\n * A text that should be displayed when no item is selected.\n */\n placeholder: string;\n /**\n * An item that should be preselected.\n */\n selectedItem?: IComboBoxItem;\n /**\n * If true, the images of the items are displayed in a bigger shape. This prop will automatically be set to true if the subtext of an item is given.\n */\n shouldShowBigImage?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the width of the ComboBox should be the width of the current item.\n */\n shouldUseCurrentItemWidth?: boolean;\n /**\n * Whether the width of the 'ComboBox' should be the width of the parent or of the widest item.\n */\n shouldUseFullWidth?: boolean;\n};\n\nconst ComboBox: FC<ComboBoxProps> = ({\n direction = ComboBoxDirection.BOTTOM,\n isDisabled = false,\n lists,\n maxHeight = '280px',\n onSelect,\n placeholder,\n container = document.body,\n selectedItem,\n shouldShowBigImage,\n shouldShowRoundImage,\n onInputFocus,\n shouldUseFullWidth = false,\n onInputChange,\n shouldUseCurrentItemWidth = false,\n onInputBlur,\n inputValue,\n}) => {\n const [internalSelectedItem, setInternalSelectedItem] = useState<IComboBoxItem>();\n const [isAnimating, setIsAnimating] = useState(false);\n const [minWidth, setMinWidth] = useState(0);\n const [bodyMinWidth, setBodyMinWidth] = useState(0);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n const [overflowY, setOverflowY] = useState<CSSProperties['overflowY']>('hidden');\n const [portal, setPortal] = useState<ReactPortal>();\n const [internalCoordinates, setInternalCoordinates] = useState<ContextMenuCoordinates>({\n x: 0,\n y: 0,\n });\n\n const styledComboBoxElementRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n\n const { browser } = useDevice();\n\n const isTouch = getIsTouch();\n\n const handleClick = useCallback(\n (event: MouseEvent) => {\n if (\n styledComboBoxElementRef.current &&\n !styledComboBoxElementRef.current.contains(event.target as Node) &&\n contentRef.current &&\n !contentRef.current.contains(event.target as Node)\n ) {\n setIsAnimating(false);\n }\n },\n [styledComboBoxElementRef],\n );\n\n const handleOpen = useCallback(() => {\n if (styledComboBoxElementRef.current) {\n const {\n left: comboBoxLeft,\n top: comboBoxTop,\n height,\n } = styledComboBoxElementRef.current.getBoundingClientRect();\n const { left: containerLeft, top: containerTop } = container.getBoundingClientRect();\n\n const x = comboBoxLeft - containerLeft + container.scrollLeft;\n const y = comboBoxTop - containerTop + container.scrollTop;\n\n setInternalCoordinates({\n x,\n y: direction === ComboBoxDirection.TOP ? y : y + height,\n });\n\n setIsAnimating(true);\n }\n }, [container, direction]);\n\n const handleClose = useCallback(() => {\n setIsAnimating(false);\n }, []);\n\n /**\n * This function adds an event listener to the document to close the combobox when the user clicks outside of it\n */\n useEffect(() => {\n document.addEventListener('click', handleClick);\n\n return () => {\n document.removeEventListener('click', handleClick);\n };\n }, [handleClick, styledComboBoxElementRef]);\n\n /**\n * This function sets the selected item\n */\n const handleSetSelectedItem = useCallback(\n (itemToSelect: IComboBoxItem) => {\n setInternalSelectedItem(itemToSelect);\n setIsAnimating(false);\n\n if (onSelect) {\n onSelect(itemToSelect);\n }\n },\n [onSelect],\n );\n\n useEffect(() => {\n const currentContent = contentRef.current;\n\n if (portal && isAnimating && currentContent) {\n const scrollHeight = currentContent.scrollHeight ?? 0;\n\n const maxHeightInPixels = getMaxHeightInPixels(\n maxHeight,\n styledComboBoxElementRef.current ?? document.body,\n );\n\n setOverflowY(scrollHeight > maxHeightInPixels ? 'scroll' : 'hidden');\n }\n }, [isAnimating, maxHeight, portal]);\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!isAnimating) {\n return;\n }\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n const children = contentRef.current?.children;\n if (children && children.length > 0) {\n const newIndex =\n focusedIndex !== null\n ? (focusedIndex + (e.key === 'ArrowUp' ? -1 : 1) + children.length) %\n children.length\n : 0;\n\n if (focusedIndex !== null) {\n const prevElement = children[focusedIndex] as HTMLDivElement;\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const newElement = children[newIndex] as HTMLDivElement;\n newElement.tabIndex = 0;\n newElement.focus();\n }\n } else if (e.key === 'Enter' && focusedIndex !== null) {\n const element = contentRef.current?.children[focusedIndex];\n\n if (!element) {\n return;\n }\n\n const { id } = element;\n\n let newSelectedItem: IComboBoxItem | undefined;\n\n lists.some((list) => {\n newSelectedItem = list.list.find(\n ({ value }) => String(value) === id.replace('combobox-item__', ''),\n );\n return !!newSelectedItem;\n });\n\n if (!newSelectedItem) {\n return;\n }\n\n handleSetSelectedItem(newSelectedItem);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [focusedIndex, handleSetSelectedItem, isAnimating, lists]);\n\n /**\n * This function calculates the greatest width\n */\n useEffect(() => {\n const allItems = lists.flatMap((list) => list.list);\n const hasImage = allItems.some(({ imageUrl }) => imageUrl);\n const hasIcon = allItems.some(({ icons }) => icons);\n\n const parentWidth =\n styledComboBoxElementRef.current?.parentElement?.getBoundingClientRect().width ?? 0;\n\n const paddingWidth = 45; // padding + border + arrow icon\n const imageWidth = hasImage ? 32 : 0; // image width + gap if images present\n const iconWidth = hasIcon ? 40 : 0; // icon width + gap if icons present\n\n const baseWidth = calculateContentWidth([\n ...allItems,\n { text: placeholder, value: 'placeholder' },\n ]);\n const calculatedWidth = baseWidth + paddingWidth + imageWidth + iconWidth;\n\n let tmpMinWidth = calculatedWidth;\n let tmpBodyMinWidth = calculatedWidth;\n\n // Full width settings\n if (shouldUseFullWidth) {\n tmpMinWidth = parentWidth;\n\n tmpBodyMinWidth =\n parentWidth < calculatedWidth - 20 ? calculatedWidth - 20 : parentWidth;\n }\n\n // Current item width settings\n else if (shouldUseCurrentItemWidth && internalSelectedItem) {\n const itemWidth =\n calculateContentWidth([internalSelectedItem]) +\n paddingWidth +\n imageWidth +\n iconWidth;\n\n tmpMinWidth = itemWidth;\n\n tmpBodyMinWidth = itemWidth < calculatedWidth - 20 ? calculatedWidth - 20 : itemWidth;\n }\n\n setMinWidth(tmpMinWidth);\n setBodyMinWidth(tmpBodyMinWidth);\n }, [lists, placeholder, shouldUseFullWidth, shouldUseCurrentItemWidth, internalSelectedItem]);\n\n /**\n * This function sets the external selected item\n */\n useEffect(() => {\n setIsAnimating(false);\n setInternalSelectedItem(selectedItem);\n }, [selectedItem]);\n\n const placeholderImageUrl = useMemo(() => {\n if (selectedItem) {\n return selectedItem.imageUrl;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.imageUrl;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n const placeholderIcon = useMemo(() => {\n if (selectedItem) {\n return selectedItem.icons;\n }\n\n if (internalSelectedItem) {\n return internalSelectedItem.icons;\n }\n\n return undefined;\n }, [internalSelectedItem, selectedItem]);\n\n /**\n * This function resets the placeholder\n */\n const placeholderText = useMemo(() => {\n let text = placeholder;\n\n if (selectedItem) {\n text = selectedItem.text;\n } else if (internalSelectedItem) {\n text = internalSelectedItem.text;\n }\n\n return text;\n }, [internalSelectedItem, placeholder, selectedItem]);\n\n /**\n * This function opens the content of the combobox\n */\n const handleHeaderClick = useCallback(() => {\n if (!isDisabled) {\n if (isAnimating) {\n handleClose();\n } else {\n handleOpen();\n }\n }\n }, [handleClose, handleOpen, isAnimating, isDisabled]);\n\n const comboBoxGroups = useMemo(\n () =>\n lists.map(({ groupName, list }) => (\n <div key={groupName ?? 'default-group'}>\n {groupName && lists.length > 1 && (\n <StyledComboBoxTopic>{groupName}</StyledComboBoxTopic>\n )}\n {list.map((item) => (\n // ToDo: Cleanup this - item should be given as a prop to avoid full spreading\n <ComboBoxItem\n icons={item.icons}\n id={item.value}\n imageUrl={item.imageUrl}\n isDisabled={item.isDisabled}\n isSelected={selectedItem ? item.value === selectedItem.value : false}\n key={item.value}\n onSelect={handleSetSelectedItem}\n rightElement={item.rightElement}\n shouldShowBigImage={shouldShowBigImage}\n shouldShowRoundImage={shouldShowRoundImage}\n subtext={item.subtext}\n suffixElement={item.suffixElement}\n text={item.text}\n value={item.value}\n textStyles={item.textStyles}\n />\n ))}\n </div>\n )),\n [handleSetSelectedItem, lists, selectedItem, shouldShowBigImage, shouldShowRoundImage],\n );\n\n const bodyStyles = useMemo(() => {\n let styles: CSSProperties = { left: internalCoordinates.x, top: internalCoordinates.y };\n\n if (direction === ComboBoxDirection.TOP) {\n styles = { ...styles, transform: 'translateY(-100%)' };\n }\n\n return styles;\n }, [direction, internalCoordinates.x, internalCoordinates.y]);\n\n useEffect(() => {\n setPortal(() =>\n createPortal(\n <AnimatePresence initial={false}>\n {isAnimating && (\n <StyledMotionComboBoxBody\n $browser={browser?.name}\n animate={{ height: 'fit-content', opacity: 1 }}\n $overflowY={overflowY}\n initial={{ height: 0, opacity: 0 }}\n exit={{ height: 0, opacity: 0 }}\n $maxHeight={maxHeight}\n $minWidth={bodyMinWidth}\n style={bodyStyles}\n $direction={direction}\n transition={{ duration: 0.2 }}\n tabIndex={0}\n ref={contentRef}\n >\n {comboBoxGroups}\n </StyledMotionComboBoxBody>\n )}\n </AnimatePresence>,\n container,\n ),\n );\n }, [\n bodyMinWidth,\n bodyStyles,\n browser?.name,\n comboBoxGroups,\n container,\n direction,\n isAnimating,\n maxHeight,\n minWidth,\n overflowY,\n ]);\n\n return useMemo(\n () => (\n <StyledComboBox\n ref={styledComboBoxElementRef}\n $shouldUseFullWidth={shouldUseFullWidth}\n $minWidth={minWidth}\n >\n <StyledComboBoxHeader\n $direction={direction}\n onClick={handleHeaderClick}\n $isOpen={isAnimating}\n $isTouch={isTouch}\n $isDisabled={isDisabled}\n >\n {typeof inputValue === 'string' ? (\n <StyledComboBoxInput\n disabled={isDisabled}\n value={inputValue}\n onChange={onInputChange}\n onBlur={onInputBlur}\n onFocus={onInputFocus}\n placeholder={placeholderText}\n />\n ) : (\n <StyledComboBoxPlaceholder\n $shouldReduceOpacity={!selectedItem && !internalSelectedItem}\n >\n {placeholderImageUrl && (\n <StyledComboBoxPlaceholderImage\n src={placeholderImageUrl}\n shouldShowRoundImage={shouldShowRoundImage}\n />\n )}\n {placeholderIcon && <Icon icons={placeholderIcon} />}\n {placeholderText}\n {internalSelectedItem &&\n internalSelectedItem.suffixElement &&\n internalSelectedItem.suffixElement}\n </StyledComboBoxPlaceholder>\n )}\n <StyledComboBoxIconWrapper>\n <Icon icons={['fa fa-chevron-down']} />\n </StyledComboBoxIconWrapper>\n </StyledComboBoxHeader>\n {portal}\n </StyledComboBox>\n ),\n [\n shouldUseFullWidth,\n minWidth,\n direction,\n handleHeaderClick,\n isAnimating,\n isTouch,\n isDisabled,\n inputValue,\n onInputChange,\n onInputBlur,\n onInputFocus,\n placeholderText,\n selectedItem,\n internalSelectedItem,\n placeholderImageUrl,\n shouldShowRoundImage,\n placeholderIcon,\n portal,\n ],\n );\n};\n\nComboBox.displayName = 'ComboBox';\n\nexport default ComboBox;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,YAAY;AACtC,SAASC,eAAe,QAAQ,eAAe;AAC/C,OAAOC,KAAK,IAGRC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAML,OAAO;AACd,SAASC,YAAY,QAAQ,WAAW;AACxC,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,uBAAuB;AACnF,SAASC,UAAU,QAAQ,yBAAyB;AAEpD,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,YAAY,MAAM,8BAA8B;AACvD,SACIC,cAAc,EACdC,oBAAoB,EACpBC,yBAAyB,EACzBC,mBAAmB,EACnBC,yBAAyB,EACzBC,8BAA8B,EAC9BC,mBAAmB,EACnBC,wBAAwB,QACrB,mBAAmB;AA0F1B,MAAMC,QAA2B,GAAGC,IAAA,IAiB9B;EAAA,IAjB+B;IACjCC,SAAS,GAAGhB,iBAAiB,CAACiB,MAAM;IACpCC,UAAU,GAAG,KAAK;IAClBC,KAAK;IACLC,SAAS,GAAG,OAAO;IACnBC,QAAQ;IACRC,WAAW;IACXC,SAAS,GAAGC,QAAQ,CAACC,IAAI;IACzBC,YAAY;IACZC,kBAAkB;IAClBC,oBAAoB;IACpBC,YAAY;IACZC,kBAAkB,GAAG,KAAK;IAC1BC,aAAa;IACbC,yBAAyB,GAAG,KAAK;IACjCC,WAAW;IACXC;EACJ,CAAC,GAAAnB,IAAA;EACG,MAAM,CAACoB,oBAAoB,EAAEC,uBAAuB,CAAC,GAAGtC,QAAQ,CAAgB,CAAC;EACjF,MAAM,CAACuC,WAAW,EAAEC,cAAc,CAAC,GAAGxC,QAAQ,CAAC,KAAK,CAAC;EACrD,MAAM,CAAC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AAEA;EAAqB,CAC9C,CACJ,EACAiG,eAAe,iBAAIpI,KAAA,CAAA2I,aAAA,CAAChI,IAAI;IAAC0G,KAAK,EAAEe;EAAgB,CAAE,CAAC,EACnDC,eAAe,EACf3F,oBAAoB,IACjBA,oBAAoB,CAACsG,aAAa,IAClCtG,oBAAoB,CAACsG,aACF,CAC9B,eACDhJ,KAAA,CAAA2I,aAAA,CAAC5H,yBAAyB,qBACtBf,KAAA,CAAA2I,aAAA,CAAChI,IAAI;IAAC0G,KAAK,EAAE,CAAC,oBAAoB;EAAE,CAAE,CACf,CACT,CAAC,EACtB/D,MACW,CACnB,EACD,CACIjB,kBAAkB,EAClBS,QAAQ,EACRvB,SAAS,EACT+G,iBAAiB,EACjB1F,WAAW,EACXmB,OAAO,EACPtC,UAAU,EACVgB,UAAU,EACVH,aAAa,EACbE,WAAW,EACXJ,YAAY,EACZiG,eAAe,EACfpG,YAAY,EACZS,oBAAoB,EACpBwF,mBAAmB,EACnB/F,oBAAoB,EACpBiG,eAAe,EACf9E,MAAM,CAEd,CAAC;AACL,CAAC;AAEDjC,QAAQ,CAACyJ,WAAW,GAAG,UAAU;AAEjC,eAAezJ,QAAQ","ignoreList":[]}
@@ -15,6 +15,7 @@ const ComboBoxItem = _ref => {
15
15
  shouldShowRoundImage,
16
16
  subtext,
17
17
  suffixElement,
18
+ textStyles,
18
19
  text,
19
20
  value
20
21
  } = _ref;
@@ -41,7 +42,10 @@ const ComboBoxItem = _ref => {
41
42
  $shouldShowRoundImage: shouldShowRoundImage
42
43
  }), icons && /*#__PURE__*/React.createElement(Icon, {
43
44
  icons: icons
44
- }), /*#__PURE__*/React.createElement(StyledComboBoxItemContent, null, /*#__PURE__*/React.createElement(StyledComboBoxItemContentHeader, null, /*#__PURE__*/React.createElement(StyledComboBoxItemContentHeaderText, null, text, suffixElement), rightElement && /*#__PURE__*/React.createElement(StyledComboBoxItemContentHeaderRightElement, null, rightElement)), subtext && /*#__PURE__*/React.createElement(StyledComboBoxItemContentSubtext, null, subtext))), [handleItemClick, icons, id, imageUrl, isDisabled, isSelected, isTouch, rightElement, shouldShowBigImage, shouldShowRoundImage, subtext, suffixElement, text]);
45
+ }), /*#__PURE__*/React.createElement(StyledComboBoxItemContent, null, /*#__PURE__*/React.createElement(StyledComboBoxItemContentHeader, null, /*#__PURE__*/React.createElement(StyledComboBoxItemContentHeaderText, {
46
+ as: textStyles?.tagName,
47
+ style: textStyles?.styles
48
+ }, text, suffixElement), rightElement && /*#__PURE__*/React.createElement(StyledComboBoxItemContentHeaderRightElement, null, rightElement)), subtext && /*#__PURE__*/React.createElement(StyledComboBoxItemContentSubtext, null, subtext))), [handleItemClick, icons, id, imageUrl, isDisabled, isSelected, isTouch, rightElement, shouldShowBigImage, shouldShowRoundImage, subtext, suffixElement, text]);
45
49
  };
46
50
  ComboBoxItem.displayName = 'ComboBoxItem';
47
51
  export default ComboBoxItem;
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBoxItem.js","names":["React","useCallback","useMemo","getIsTouch","Icon","StyledComboBoxItem","StyledComboBoxItemContent","StyledComboBoxItemContentHeader","StyledComboBoxItemContentHeaderRightElement","StyledComboBoxItemContentHeaderText","StyledComboBoxItemContentSubtext","StyledComboBoxItemImage","ComboBoxItem","_ref","icons","id","imageUrl","isDisabled","isSelected","onSelect","rightElement","shouldShowBigImage","shouldShowRoundImage","subtext","suffixElement","text","value","handleItemClick","isTouch","createElement","String","onClick","$isDisabled","$isSelected","$isTouch","src","$shouldShowBigImage","trim","$shouldShowRoundImage","displayName"],"sources":["../../../../../src/components/combobox/combobox-item/ComboBoxItem.tsx"],"sourcesContent":["import React, { FC, ReactNode, useCallback, useMemo } from 'react';\nimport { getIsTouch } from '../../../utils/environment';\nimport Icon from '../../icon/Icon';\nimport type { ComboBoxProps, IComboBoxItem } from '../ComboBox';\nimport {\n StyledComboBoxItem,\n StyledComboBoxItemContent,\n StyledComboBoxItemContentHeader,\n StyledComboBoxItemContentHeaderRightElement,\n StyledComboBoxItemContentHeaderText,\n StyledComboBoxItemContentSubtext,\n StyledComboBoxItemImage,\n} from './ComboBoxItem.styles';\n\nexport type ComboBoxItemProps = {\n icons?: IComboBoxItem['icons'];\n id: IComboBoxItem['value'];\n imageUrl: IComboBoxItem['imageUrl'];\n isDisabled?: IComboBoxItem['isDisabled'];\n isSelected: boolean;\n onSelect: (itemToSelect: IComboBoxItem) => void;\n rightElement: IComboBoxItem['rightElement'];\n shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n shouldShowRoundImage: ComboBoxProps['shouldShowRoundImage'];\n subtext: IComboBoxItem['subtext'];\n suffixElement?: ReactNode;\n text: IComboBoxItem['text'];\n value: IComboBoxItem['value'];\n};\n\nconst ComboBoxItem: FC<ComboBoxItemProps> = ({\n icons,\n id,\n imageUrl,\n isDisabled,\n isSelected,\n onSelect,\n rightElement,\n shouldShowBigImage,\n shouldShowRoundImage,\n subtext,\n suffixElement,\n text,\n value,\n}) => {\n const handleItemClick = useCallback(() => {\n if (!isDisabled) {\n onSelect({ text, value, suffixElement, imageUrl });\n }\n }, [imageUrl, isDisabled, onSelect, suffixElement, text, value]);\n\n const isTouch = getIsTouch();\n\n return useMemo(\n () => (\n <StyledComboBoxItem\n id={`combobox-item__${typeof id === 'number' ? String(id) : id}`}\n onClick={handleItemClick}\n $isDisabled={isDisabled}\n $isSelected={isSelected}\n $isTouch={isTouch}\n >\n {imageUrl && (\n <StyledComboBoxItemImage\n src={imageUrl}\n $shouldShowBigImage={\n shouldShowBigImage ||\n (typeof subtext === 'string' && subtext.trim() !== '')\n }\n $shouldShowRoundImage={shouldShowRoundImage}\n />\n )}\n {icons && <Icon icons={icons} />}\n <StyledComboBoxItemContent>\n <StyledComboBoxItemContentHeader>\n <StyledComboBoxItemContentHeaderText>\n {text}\n {suffixElement}\n </StyledComboBoxItemContentHeaderText>\n {rightElement && (\n <StyledComboBoxItemContentHeaderRightElement>\n {rightElement}\n </StyledComboBoxItemContentHeaderRightElement>\n )}\n </StyledComboBoxItemContentHeader>\n {subtext && (\n <StyledComboBoxItemContentSubtext>\n {subtext}\n </StyledComboBoxItemContentSubtext>\n )}\n </StyledComboBoxItemContent>\n </StyledComboBoxItem>\n ),\n [\n handleItemClick,\n icons,\n id,\n imageUrl,\n isDisabled,\n isSelected,\n isTouch,\n rightElement,\n shouldShowBigImage,\n shouldShowRoundImage,\n subtext,\n suffixElement,\n text,\n ],\n );\n};\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport default ComboBoxItem;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAmBC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAClE,SAASC,UAAU,QAAQ,4BAA4B;AACvD,OAAOC,IAAI,MAAM,iBAAiB;AAElC,SACIC,kBAAkB,EAClBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,2CAA2C,EAC3CC,mCAAmC,EACnCC,gCAAgC,EAChCC,uBAAuB,QACpB,uBAAuB;AAkB9B,MAAMC,YAAmC,GAAGC,IAAA,IActC;EAAA,IAduC;IACzCC,KAAK;IACLC,EAAE;IACFC,QAAQ;IACRC,UAAU;IACVC,UAAU;IACVC,QAAQ;IACRC,YAAY;IACZC,kBAAkB;IAClBC,oBAAoB;IACpBC,OAAO;IACPC,aAAa;IACbC,IAAI;IACJC;EACJ,CAAC,GAAAb,IAAA;EACG,MAAMc,eAAe,GAAG1B,WAAW,CAAC,MAAM;IACtC,IAAI,CAACgB,UAAU,EAAE;MACbE,QAAQ,CAAC;QAAEM,IAAI;QAAEC,KAAK;QAAEF,aAAa;QAAER;MAAS,CAAC,CAAC;IACtD;EACJ,CAAC,EAAE,CAACA,QAAQ,EAAEC,UAAU,EAAEE,QAAQ,EAAEK,aAAa,EAAEC,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEhE,MAAME,OAAO,GAAGzB,UAAU,CAAC,CAAC;EAE5B,OAAOD,OAAO,CACV,mBACIF,KAAA,CAAA6B,aAAA,CAACxB,kBAAkB;IACfU,EAAE,EAAE,kBAAkB,OAAOA,EAAE,KAAK,QAAQ,GAAGe,MAAM,CAACf,EAAE,CAAC,GAAGA,EAAE,EAAG;IACjEgB,OAAO,EAAEJ,eAAgB;IACzBK,WAAW,EAAEf,UAAW;IACxBgB,WAAW,EAAEf,UAAW;IACxBgB,QAAQ,EAAEN;EAAQ,GAEjBZ,QAAQ,iBACLhB,KAAA,CAAA6B,aAAA,CAAClB,uBAAuB;IACpBwB,GAAG,EAAEnB,QAAS;IACdoB,mBAAmB,EACff,kBAAkB,IACjB,OAAOE,OAAO,KAAK,QAAQ,IAAIA,OAAO,CAACc,IAAI,CAAC,CAAC,KAAK,EACtD;IACDC,qBAAqB,EAAEhB;EAAqB,CAC/C,CACJ,EACAR,KAAK,iBAAId,KAAA,CAAA6B,aAAA,CAACzB,IAAI;IAACU,KAAK,EAAEA;EAAM,CAAE,CAAC,eAChCd,KAAA,CAAA6B,aAAA,CAACvB,yBAAyB,qBACtBN,KAAA,CAAA6B,aAAA,CAACtB,+BAA+B,qBAC5BP,KAAA,CAAA6B,aAAA,CAACpB,mCAAmC,QAC/BgB,IAAI,EACJD,aACgC,CAAC,EACrCJ,YAAY,iBACTpB,KAAA,CAAA6B,aAAA,CAACrB,2CAA2C,QACvCY,YACwC,CAEpB,CAAC,EACjCG,OAAO,iBACJvB,KAAA,CAAA6B,aAAA,CAACnB,gCAAgC,QAC5Ba,OAC6B,CAEf,CACX,CACvB,EACD,CACII,eAAe,EACfb,KAAK,EACLC,EAAE,EACFC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVU,OAAO,EACPR,YAAY,EACZC,kBAAkB,EAClBC,oBAAoB,EACpBC,OAAO,EACPC,aAAa,EACbC,IAAI,CAEZ,CAAC;AACL,CAAC;AAEDb,YAAY,CAAC2B,WAAW,GAAG,cAAc;AAEzC,eAAe3B,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"ComboBoxItem.js","names":["React","useCallback","useMemo","getIsTouch","Icon","StyledComboBoxItem","StyledComboBoxItemContent","StyledComboBoxItemContentHeader","StyledComboBoxItemContentHeaderRightElement","StyledComboBoxItemContentHeaderText","StyledComboBoxItemContentSubtext","StyledComboBoxItemImage","ComboBoxItem","_ref","icons","id","imageUrl","isDisabled","isSelected","onSelect","rightElement","shouldShowBigImage","shouldShowRoundImage","subtext","suffixElement","textStyles","text","value","handleItemClick","isTouch","createElement","String","onClick","$isDisabled","$isSelected","$isTouch","src","$shouldShowBigImage","trim","$shouldShowRoundImage","as","tagName","style","styles","displayName"],"sources":["../../../../../src/components/combobox/combobox-item/ComboBoxItem.tsx"],"sourcesContent":["import React, { FC, ReactNode, useCallback, useMemo } from 'react';\nimport { getIsTouch } from '../../../utils/environment';\nimport Icon from '../../icon/Icon';\nimport type { ComboBoxProps, IComboBoxItem } from '../ComboBox';\nimport {\n StyledComboBoxItem,\n StyledComboBoxItemContent,\n StyledComboBoxItemContentHeader,\n StyledComboBoxItemContentHeaderRightElement,\n StyledComboBoxItemContentHeaderText,\n StyledComboBoxItemContentSubtext,\n StyledComboBoxItemImage,\n} from './ComboBoxItem.styles';\n\nexport type ComboBoxItemProps = {\n icons?: IComboBoxItem['icons'];\n id: IComboBoxItem['value'];\n imageUrl: IComboBoxItem['imageUrl'];\n isDisabled?: IComboBoxItem['isDisabled'];\n isSelected: boolean;\n onSelect: (itemToSelect: IComboBoxItem) => void;\n rightElement: IComboBoxItem['rightElement'];\n shouldShowBigImage: ComboBoxProps['shouldShowBigImage'];\n shouldShowRoundImage: ComboBoxProps['shouldShowRoundImage'];\n subtext: IComboBoxItem['subtext'];\n suffixElement?: ReactNode;\n text: IComboBoxItem['text'];\n value: IComboBoxItem['value'];\n textStyles?: IComboBoxItem['textStyles'];\n};\n\nconst ComboBoxItem: FC<ComboBoxItemProps> = ({\n icons,\n id,\n imageUrl,\n isDisabled,\n isSelected,\n onSelect,\n rightElement,\n shouldShowBigImage,\n shouldShowRoundImage,\n subtext,\n suffixElement,\n textStyles,\n text,\n value,\n}) => {\n const handleItemClick = useCallback(() => {\n if (!isDisabled) {\n onSelect({ text, value, suffixElement, imageUrl });\n }\n }, [imageUrl, isDisabled, onSelect, suffixElement, text, value]);\n\n const isTouch = getIsTouch();\n\n return useMemo(\n () => (\n <StyledComboBoxItem\n id={`combobox-item__${typeof id === 'number' ? String(id) : id}`}\n onClick={handleItemClick}\n $isDisabled={isDisabled}\n $isSelected={isSelected}\n $isTouch={isTouch}\n >\n {imageUrl && (\n <StyledComboBoxItemImage\n src={imageUrl}\n $shouldShowBigImage={\n shouldShowBigImage ||\n (typeof subtext === 'string' && subtext.trim() !== '')\n }\n $shouldShowRoundImage={shouldShowRoundImage}\n />\n )}\n {icons && <Icon icons={icons} />}\n <StyledComboBoxItemContent>\n <StyledComboBoxItemContentHeader>\n <StyledComboBoxItemContentHeaderText\n as={textStyles?.tagName}\n style={textStyles?.styles}\n >\n {text}\n {suffixElement}\n </StyledComboBoxItemContentHeaderText>\n {rightElement && (\n <StyledComboBoxItemContentHeaderRightElement>\n {rightElement}\n </StyledComboBoxItemContentHeaderRightElement>\n )}\n </StyledComboBoxItemContentHeader>\n {subtext && (\n <StyledComboBoxItemContentSubtext>\n {subtext}\n </StyledComboBoxItemContentSubtext>\n )}\n </StyledComboBoxItemContent>\n </StyledComboBoxItem>\n ),\n [\n handleItemClick,\n icons,\n id,\n imageUrl,\n isDisabled,\n isSelected,\n isTouch,\n rightElement,\n shouldShowBigImage,\n shouldShowRoundImage,\n subtext,\n suffixElement,\n text,\n ],\n );\n};\n\nComboBoxItem.displayName = 'ComboBoxItem';\n\nexport default ComboBoxItem;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAmBC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAClE,SAASC,UAAU,QAAQ,4BAA4B;AACvD,OAAOC,IAAI,MAAM,iBAAiB;AAElC,SACIC,kBAAkB,EAClBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,2CAA2C,EAC3CC,mCAAmC,EACnCC,gCAAgC,EAChCC,uBAAuB,QACpB,uBAAu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CAACxB,yBAAyB,qBACtBN,KAAA,CAAA8B,aAAA,CAACvB,+BAA+B,qBAC5BP,KAAA,CAAA8B,aAAA,CAACrB,mCAAmC;IAChC+B,EAAE,EAAEf,UAAU,EAAEgB,OAAQ;IACxBC,KAAK,EAAEjB,UAAU,EAAEkB;EAAO,GAEzBjB,IAAI,EACJF,aACgC,CAAC,EACrCJ,YAAY,iBACTpB,KAAA,CAAA8B,aAAA,CAACtB,2CAA2C,QACvCY,YACwC,CAEpB,CAAC,EACjCG,OAAO,iBACJvB,KAAA,CAAA8B,aAAA,CAACpB,gCAAgC,QAC5Ba,OAC6B,CAEf,CACX,CACvB,EACD,CACIK,eAAe,EACfd,KAAK,EACLC,EAAE,EACFC,QAAQ,EACRC,UAAU,EACVC,UAAU,EACVW,OAAO,EACPT,YAAY,EACZC,kBAAkB,EAClBC,oBAAoB,EACpBC,OAAO,EACPC,aAAa,EACbE,IAAI,CAEZ,CAAC;AACL,CAAC;AAEDd,YAAY,CAACgC,WAAW,GAAG,cAAc;AAEzC,eAAehC,YAAY","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"MentionFinder.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","MentionFinderItem","StyledMentionFinder","StyledMotionMentionFinderPopup","MentionFinder","_ref","inputValue","members","onSelect","popupAlignment","activeMember","setActiveMember","focusedIndex","setFocusedIndex","ref","fullMatch","searchString","regExpMatchArray","match","toLowerCase","filteredMembers","filter","_ref2","id","info","name","includes","replace","handleKeyDown","event","key","preventDefault","children","current","length","newIndex","prevElement","tabIndex","member","newElement","focus","stopPropagation","handleMemberClick","handleMemberHover","isActiveMemberShown","some","_ref3","items","map","createElement","isActive","onClick","onHover","shouldShowPopup","window","addEventListener","removeEventListener","className","initial","animate","height","opacity","exit","$popupAlignment","transition","duration","displayName"],"sources":["../../../../src/components/mention-finder/MentionFinder.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { MentionFinderPopupAlignment } from '../../constants/mentionFinder';\nimport MentionFinderItem from './mention-finder-item/MentionFinderItem';\nimport { StyledMentionFinder, StyledMotionMentionFinderPopup } from './MentionFinder.styles';\n\nexport type MentionMember = {\n id: string;\n info: string;\n imageUrl: string;\n name: string;\n};\n\nexport type MentionFinderProps = {\n /**\n * The text from the input field\n */\n inputValue: string;\n /**\n * Members that can be selected\n */\n members: MentionMember[];\n /**\n * Function to be executed when a member is selected\n */\n onSelect: ({ fullMatch, member }: { fullMatch: string; member: MentionMember }) => void;\n /**\n * Alignment of the popup\n */\n popupAlignment: MentionFinderPopupAlignment;\n};\n\nconst MentionFinder: FC<MentionFinderProps> = ({\n inputValue,\n members,\n onSelect,\n popupAlignment,\n}) => {\n const [activeMember, setActiveMember] = useState(members[0]);\n const [focusedIndex, setFocusedIndex] = useState(0);\n\n const ref = useRef<HTMLDivElement>(null);\n\n const [fullMatch, searchString] = useMemo(() => {\n // eslint-disable-next-line no-irregular-whitespace\n const regExpMatchArray = inputValue.match(/@([^\\s​]*)/);\n\n return [regExpMatchArray?.[0], regExpMatchArray?.[1]?.toLowerCase() ?? ''];\n }, [inputValue]);\n\n const filteredMembers = useMemo(\n () =>\n searchString !== ''\n ? members.filter(\n ({ id, info, name }) =>\n id.toLowerCase().includes(searchString) ||\n info.replace('chayns', '').toLowerCase().includes(searchString) ||\n name.toLowerCase().includes(searchString),\n )\n : members,\n [members, searchString],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n\n const children = ref.current?.children;\n\n if (children && children.length > 0) {\n const newIndex =\n focusedIndex !== null\n ? (focusedIndex +\n (event.key === 'ArrowUp' ? -1 : 1) +\n children.length) %\n children.length\n : 0;\n\n if (focusedIndex !== null) {\n const prevElement = children[focusedIndex] as HTMLDivElement;\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const member = filteredMembers[newIndex];\n\n setActiveMember(member);\n\n const newElement = children[newIndex] as HTMLDivElement;\n newElement.tabIndex = 0;\n newElement.focus();\n }\n } else if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n\n if (fullMatch && activeMember) {\n onSelect({ fullMatch, member: activeMember });\n }\n }\n },\n [activeMember, filteredMembers, focusedIndex, fullMatch, onSelect],\n );\n\n const handleMemberClick = useCallback(\n (member: MentionMember) => {\n if (fullMatch) {\n onSelect({ fullMatch, member });\n }\n },\n [fullMatch, onSelect],\n );\n\n const handleMemberHover = useCallback((member: MentionMember) => {\n setActiveMember(member);\n }, []);\n\n useEffect(() => {\n if (filteredMembers.length > 0) {\n const isActiveMemberShown = filteredMembers.some(({ id }) => id === activeMember?.id);\n\n if (!isActiveMemberShown) {\n setActiveMember(filteredMembers[0]);\n }\n }\n }, [activeMember?.id, filteredMembers]);\n\n const items = useMemo(\n () =>\n filteredMembers.map((member) => (\n <MentionFinderItem\n isActive={member.id === activeMember?.id}\n key={member.id}\n member={member}\n onClick={handleMemberClick}\n onHover={handleMemberHover}\n />\n )),\n [activeMember, filteredMembers, handleMemberClick, handleMemberHover],\n );\n\n const shouldShowPopup = useMemo(() => fullMatch && items.length > 0, [fullMatch, items.length]);\n\n useEffect(() => {\n if (shouldShowPopup) {\n window.addEventListener('keydown', handleKeyDown, true);\n }\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown, true);\n };\n }, [handleKeyDown, shouldShowPopup]);\n\n return (\n <StyledMentionFinder className=\"beta-chayns-mention-finder\">\n <AnimatePresence initial={false}>\n {shouldShowPopup && (\n <StyledMotionMentionFinderPopup\n ref={ref}\n animate={{ height: 'auto', opacity: 1 }}\n className=\"prevent-lose-focus\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n $popupAlignment={popupAlignment}\n transition={{ duration: 0.15 }}\n tabIndex={0}\n >\n {items}\n </StyledMotionMentionFinderPopup>\n )}\n </AnimatePresence>\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E;EAAE,GAEXU,KAC2B,CAEvB,CACA,CAAC;AAE9B,CAAC;AAED3C,aAAa,CAAC8D,WAAW,GAAG,eAAe;AAE3C,eAAe9D,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"MentionFinder.js","names":["AnimatePresence","React","useCallback","useEffect","useMemo","useRef","useState","MentionFinderItem","StyledMentionFinder","StyledMotionMentionFinderPopup","MentionFinder","_ref","inputValue","members","onSelect","popupAlignment","activeMember","setActiveMember","focusedIndex","setFocusedIndex","ref","fullMatch","searchString","regExpMatchArray","match","toLowerCase","filteredMembers","filter","_ref2","id","info","name","includes","replace","handleKeyDown","event","key","preventDefault","children","current","length","newIndex","prevElement","tabIndex","member","newElement","focus","stopPropagation","handleMemberClick","handleMemberHover","isActiveMemberShown","some","_ref3","items","map","createElement","isActive","onClick","onHover","shouldShowPopup","window","addEventListener","removeEventListener","className","initial","animate","height","opacity","exit","$popupAlignment","transition","duration","displayName"],"sources":["../../../../src/components/mention-finder/MentionFinder.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport type { MentionFinderPopupAlignment } from '../../constants/mentionFinder';\nimport MentionFinderItem from './mention-finder-item/MentionFinderItem';\nimport { StyledMentionFinder, StyledMotionMentionFinderPopup } from './MentionFinder.styles';\n\nexport type MentionMember = {\n id: string;\n info: string;\n imageUrl: string;\n name: string;\n shouldShowRoundImage?: boolean;\n};\n\nexport type MentionFinderProps = {\n /**\n * The text from the input field\n */\n inputValue: string;\n /**\n * Members that can be selected\n */\n members: MentionMember[];\n /**\n * Function to be executed when a member is selected\n */\n onSelect: ({ fullMatch, member }: { fullMatch: string; member: MentionMember }) => void;\n /**\n * Alignment of the popup\n */\n popupAlignment: MentionFinderPopupAlignment;\n};\n\nconst MentionFinder: FC<MentionFinderProps> = ({\n inputValue,\n members,\n onSelect,\n popupAlignment,\n}) => {\n const [activeMember, setActiveMember] = useState(members[0]);\n const [focusedIndex, setFocusedIndex] = useState(0);\n\n const ref = useRef<HTMLDivElement>(null);\n\n const [fullMatch, searchString] = useMemo(() => {\n // eslint-disable-next-line no-irregular-whitespace\n const regExpMatchArray = inputValue.match(/@([^\\s​]*)/);\n\n return [regExpMatchArray?.[0], regExpMatchArray?.[1]?.toLowerCase() ?? ''];\n }, [inputValue]);\n\n const filteredMembers = useMemo(\n () =>\n searchString !== ''\n ? members.filter(\n ({ id, info, name }) =>\n id.toLowerCase().includes(searchString) ||\n info.replace('chayns', '').toLowerCase().includes(searchString) ||\n name.toLowerCase().includes(searchString),\n )\n : members,\n [members, searchString],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n event.preventDefault();\n\n const children = ref.current?.children;\n\n if (children && children.length > 0) {\n const newIndex =\n focusedIndex !== null\n ? (focusedIndex +\n (event.key === 'ArrowUp' ? -1 : 1) +\n children.length) %\n children.length\n : 0;\n\n if (focusedIndex !== null) {\n const prevElement = children[focusedIndex] as HTMLDivElement;\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const member = filteredMembers[newIndex];\n\n setActiveMember(member);\n\n const newElement = children[newIndex] as HTMLDivElement;\n newElement.tabIndex = 0;\n newElement.focus();\n }\n } else if (event.key === 'Enter') {\n event.preventDefault();\n event.stopPropagation();\n\n if (fullMatch && activeMember) {\n onSelect({ fullMatch, member: activeMember });\n }\n }\n },\n [activeMember, filteredMembers, focusedIndex, fullMatch, onSelect],\n );\n\n const handleMemberClick = useCallback(\n (member: MentionMember) => {\n if (fullMatch) {\n onSelect({ fullMatch, member });\n }\n },\n [fullMatch, onSelect],\n );\n\n const handleMemberHover = useCallback((member: MentionMember) => {\n setActiveMember(member);\n }, []);\n\n useEffect(() => {\n if (filteredMembers.length > 0) {\n const isActiveMemberShown = filteredMembers.some(({ id }) => id === activeMember?.id);\n\n if (!isActiveMemberShown) {\n setActiveMember(filteredMembers[0]);\n }\n }\n }, [activeMember?.id, filteredMembers]);\n\n const items = useMemo(\n () =>\n filteredMembers.map((member) => (\n <MentionFinderItem\n isActive={member.id === activeMember?.id}\n key={member.id}\n member={member}\n onClick={handleMemberClick}\n onHover={handleMemberHover}\n />\n )),\n [activeMember, filteredMembers, handleMemberClick, handleMemberHover],\n );\n\n const shouldShowPopup = useMemo(() => fullMatch && items.length > 0, [fullMatch, items.length]);\n\n useEffect(() => {\n if (shouldShowPopup) {\n window.addEventListener('keydown', handleKeyDown, true);\n }\n\n return () => {\n window.removeEventListener('keydown', handleKeyDown, true);\n };\n }, [handleKeyDown, shouldShowPopup]);\n\n return (\n <StyledMentionFinder className=\"beta-chayns-mention-finder\">\n <AnimatePresence initial={false}>\n {shouldShowPopup && (\n <StyledMotionMentionFinderPopup\n ref={ref}\n animate={{ height: 'auto', opacity: 1 }}\n className=\"prevent-lose-focus\"\n exit={{ height: 0, opacity: 0 }}\n initial={{ height: 0, opacity: 0 }}\n $popupAlignment={popupAlignment}\n transition={{ duration: 0.15 }}\n tabIndex={0}\n >\n {items}\n </StyledMotionMentionFinderPopup>\n )}\n </AnimatePresence>\n </StyledMentionFinder>\n );\n};\n\nMentionFinder.displayName = 'MentionFinder';\n\nexport default MentionFinder;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,KAAK,IAAQC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEpF,OAAOC,iBAAiB,MAAM,yCAAyC;AACvE,SAASC,mBAAmB,EAAEC,8BAA8B,QAAQ,wBAAwB;AA6B5F,MAAMC,aAAqC,GAAGC,IAAA,IAKxC;EAAA,IALyC;IAC3CC,UAAU;IACVC,OAAO;IACPC,QAAQ;IACRC;EACJ,CAAC,GAAAJ,IAAA;EACG,MAAM,CAACK,YAAY,EAAEC,eAAe,CAAC,GAAGX,QAAQ,CAACO,OAAO,CAAC,CAAC,CAAC,CAAC;EAC5D,MA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AAS,EAAE5B,aAAa,EAAE,IAAI,CAAC;IAC9D,CAAC;EACL,CAAC,EAAE,CAACA,aAAa,EAAEyB,eAAe,CAAC,CAAC;EAEpC,oBACI1D,KAAA,CAAAsD,aAAA,CAAC/C,mBAAmB;IAACuD,SAAS,EAAC;EAA4B,gBACvD9D,KAAA,CAAAsD,aAAA,CAACvD,eAAe;IAACgE,OAAO,EAAE;EAAM,GAC3BL,eAAe,iBACZ1D,KAAA,CAAAsD,aAAA,CAAC9C,8BAA8B;IAC3BW,GAAG,EAAEA,GAAI;IACT6C,OAAO,EAAE;MAAEC,MAAM,EAAE,MAAM;MAAEC,OAAO,EAAE;IAAE,CAAE;IACxCJ,SAAS,EAAC,oBAAoB;IAC9BK,IAAI,EAAE;MAAEF,MAAM,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAE,CAAE;IAChCH,OAAO,EAAE;MAAEE,MAAM,EAAE,CAAC;MAAEC,OAAO,EAAE;IAAE,CAAE;IACnCE,eAAe,EAAEtD,cAAe;IAChCuD,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAK,CAAE;IAC/B5B,QAAQ,EAAE;EAAE,GAEXU,KAC2B,CAEvB,CACA,CAAC;AAE9B,CAAC;AAED3C,aAAa,CAAC8D,WAAW,GAAG,eAAe;AAE3C,eAAe9D,aAAa","ignoreList":[]}
@@ -11,11 +11,12 @@ const MentionFinderItem = _ref => {
11
11
  const handleItemMouseEnter = useCallback(() => onHover(member), [member, onHover]);
12
12
  return /*#__PURE__*/React.createElement(StyledMentionFinderItem, {
13
13
  className: "prevent-lose-focus",
14
- $isActive: isActive,
15
14
  onClick: handleItemClick,
16
- onMouseEnter: handleItemMouseEnter
15
+ onMouseEnter: handleItemMouseEnter,
16
+ $isActive: isActive
17
17
  }, /*#__PURE__*/React.createElement(StyledMentionFinderItemImage, {
18
- src: member.imageUrl
18
+ src: member.imageUrl,
19
+ $shouldShowRoundImage: member.shouldShowRoundImage
19
20
  }), /*#__PURE__*/React.createElement(StyledMentionFinderItemContent, null, /*#__PURE__*/React.createElement(StyledMentionFinderItemContentName, null, member.name), /*#__PURE__*/React.createElement(StyledMentionFinderItemContentInfo, null, member.info)));
20
21
  };
21
22
  MentionFinderItem.displayName = 'MentionFinderItem';