@chayns-components/core 5.0.0-beta.1155 → 5.0.0-beta.1159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.styles.js.map +1 -1
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js +0 -2
- package/lib/cjs/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.js +95 -221
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +18 -49
- package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/cjs/components/combobox/combobox-item/ComboBoxItem.js +16 -13
- package/lib/cjs/components/combobox/combobox-item/ComboBoxItem.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.js +0 -2
- package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/cjs/components/dropdown-body-wrapper/DropdownBodyWrapper.js +86 -0
- package/lib/cjs/components/dropdown-body-wrapper/DropdownBodyWrapper.js.map +1 -0
- package/lib/cjs/components/dropdown-body-wrapper/DropdownBodyWrapper.styles.js +50 -0
- package/lib/cjs/components/dropdown-body-wrapper/DropdownBodyWrapper.styles.js.map +1 -0
- package/lib/cjs/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.js +104 -0
- package/lib/cjs/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.js.map +1 -0
- package/lib/cjs/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.js +37 -0
- package/lib/cjs/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.js.map +1 -0
- package/lib/cjs/components/file-input/FileInput.styles.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-body/ListItemBody.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-body/ListItemBody.styles.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/cjs/components/popup/Popup.js +0 -3
- package/lib/cjs/components/popup/Popup.js.map +1 -1
- package/lib/cjs/components/search-box/SearchBox.js +77 -172
- package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.js +8 -28
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.styles.js +2 -20
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.styles.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/cjs/hooks/container.js +9 -5
- package/lib/cjs/hooks/container.js.map +1 -1
- package/lib/cjs/hooks/dropdown.js +128 -0
- package/lib/cjs/hooks/dropdown.js.map +1 -0
- package/lib/cjs/hooks/element.js +16 -25
- package/lib/cjs/hooks/element.js.map +1 -1
- package/lib/cjs/index.js +7 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types/dropdown.js +18 -0
- package/lib/cjs/types/dropdown.js.map +1 -0
- package/lib/cjs/utils/calculate.js.map +1 -1
- package/lib/esm/components/accordion/accordion-head/AccordionHead.styles.js.map +1 -1
- package/lib/esm/components/button/Button.styles.js.map +1 -1
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js +0 -3
- package/lib/esm/components/color-scheme-provider/ColorSchemeProvider.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +61 -187
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +24 -71
- package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/esm/components/combobox/combobox-item/ComboBoxItem.js +14 -11
- package/lib/esm/components/combobox/combobox-item/ComboBoxItem.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.js +0 -2
- package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/esm/components/dropdown-body-wrapper/DropdownBodyWrapper.js +79 -0
- package/lib/esm/components/dropdown-body-wrapper/DropdownBodyWrapper.js.map +1 -0
- package/lib/esm/components/dropdown-body-wrapper/DropdownBodyWrapper.styles.js +59 -0
- package/lib/esm/components/dropdown-body-wrapper/DropdownBodyWrapper.styles.js.map +1 -0
- package/lib/esm/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.js +98 -0
- package/lib/esm/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.js.map +1 -0
- package/lib/esm/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.js +42 -0
- package/lib/esm/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.js.map +1 -0
- package/lib/esm/components/file-input/FileInput.styles.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-body/ListItemBody.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-body/ListItemBody.styles.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.styles.js.map +1 -1
- package/lib/esm/components/popup/Popup.js +0 -3
- package/lib/esm/components/popup/Popup.js.map +1 -1
- package/lib/esm/components/search-box/SearchBox.js +26 -121
- package/lib/esm/components/search-box/SearchBox.js.map +1 -1
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.js +9 -29
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.js.map +1 -1
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.styles.js +13 -40
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.styles.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/esm/hooks/container.js +9 -5
- package/lib/esm/hooks/container.js.map +1 -1
- package/lib/esm/hooks/dropdown.js +122 -0
- package/lib/esm/hooks/dropdown.js.map +1 -0
- package/lib/esm/hooks/element.js +16 -24
- package/lib/esm/hooks/element.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/types/dropdown.js +12 -0
- package/lib/esm/types/dropdown.js.map +1 -0
- package/lib/esm/utils/calculate.js.map +1 -1
- package/lib/types/components/accordion/accordion-head/AccordionHead.styles.d.ts +12 -24
- package/lib/types/components/button/Button.styles.d.ts +4 -8
- package/lib/types/components/color-scheme-provider/ColorSchemeProvider.d.ts +0 -1
- package/lib/types/components/combobox/ComboBox.d.ts +9 -5
- package/lib/types/components/combobox/ComboBox.styles.d.ts +5 -12
- package/lib/types/components/combobox/combobox-item/ComboBoxItem.d.ts +2 -12
- package/lib/types/components/dropdown-body-wrapper/DropdownBodyWrapper.d.ts +51 -0
- package/lib/types/components/dropdown-body-wrapper/DropdownBodyWrapper.styles.d.ts +11 -0
- package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.d.ts +26 -0
- package/lib/types/components/dropdown-body-wrapper/delayed-dropdown-content/DelayedDropdownContent.styles.d.ts +11 -0
- package/lib/types/components/file-input/FileInput.styles.d.ts +2 -4
- package/lib/types/components/file-select/FileSelect.styles.d.ts +2 -4
- package/lib/types/components/grouped-image/GroupedImage.d.ts +4 -4
- package/lib/types/components/list/list-item/list-item-body/ListItemBody.d.ts +2 -2
- package/lib/types/components/list/list-item/list-item-body/ListItemBody.styles.d.ts +2 -4
- package/lib/types/components/list/list-item/list-item-head/ListItemHead.styles.d.ts +2 -4
- package/lib/types/components/search-box/search-box-body/SearchBoxBody.d.ts +0 -7
- package/lib/types/components/search-box/search-box-body/SearchBoxBody.styles.d.ts +1 -6
- package/lib/types/components/search-input/SearchInput.styles.d.ts +2 -4
- package/lib/types/components/truncation/Truncation.styles.d.ts +2 -4
- package/lib/types/hooks/container.d.ts +3 -2
- package/lib/types/hooks/dropdown.d.ts +42 -0
- package/lib/types/index.d.ts +3 -2
- package/lib/types/types/dropdown.d.ts +26 -0
- package/lib/types/utils/calculate.d.ts +1 -1
- package/package.json +2 -3
- package/lib/cjs/types/comboBox.js +0 -18
- package/lib/cjs/types/comboBox.js.map +0 -1
- package/lib/esm/types/comboBox.js +0 -12
- package/lib/esm/types/comboBox.js.map +0 -1
- package/lib/types/types/comboBox.d.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionHead.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionAccordionHead","exports","styled","motion","div","theme","text","StyledMotionIconWrapper","onClick","StyledAccordionIcon","headline","$icon","StyledMotionContentWrapper","$isWrapped","css","StyledMotionTitleWrapper","StyledMotionTitle","$isOpen","undefined","$hasSearch","$color","StyledMotionTitleElementWrapper","StyledRightWrapper","$isSearchActive","StyledMotionSearchWrapper","StyledMotionRightElementWrapper","StyledMotionRightInput","input","$hasIcon","StyledMotionRightInputIconWrapper"],"sources":["../../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type {
|
|
1
|
+
{"version":3,"file":"AccordionHead.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionAccordionHead","exports","styled","motion","div","theme","text","StyledMotionIconWrapper","onClick","StyledAccordionIcon","headline","$icon","StyledMotionContentWrapper","$isWrapped","css","StyledMotionTitleWrapper","StyledMotionTitle","$isOpen","undefined","$hasSearch","$color","StyledMotionTitleElementWrapper","StyledRightWrapper","$isSearchActive","StyledMotionSearchWrapper","StyledMotionRightElementWrapper","StyledMotionRightInput","input","$hasIcon","StyledMotionRightInputIconWrapper"],"sources":["../../../../../src/components/accordion/accordion-head/AccordionHead.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport type { CSSProperties } from 'react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionAccordionHeadProps = WithTheme<unknown>;\n\nexport const StyledMotionAccordionHead = styled(motion.div)<StyledMotionAccordionHeadProps>`\n align-items: center;\n color: ${({ theme }: StyledMotionAccordionHeadProps) => theme.text};\n display: flex;\n overflow: hidden;\n padding: 4px 0;\n`;\n\nexport const StyledMotionIconWrapper = styled(motion.div)`\n align-items: center;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 0 0 auto;\n height: 25px;\n justify-content: center;\n width: 25px;\n`;\n\ntype StyledAccordionIconProps = WithTheme<{ $icon: string }>;\n\nexport const StyledAccordionIcon = styled.i<StyledAccordionIconProps>`\n align-items: center;\n justify-content: center;\n display: flex;\n color: ${({ theme }: StyledAccordionIconProps) => theme.headline};\n\n &:before {\n content: ${({ $icon }) => `\"\\\\${$icon}\"`};\n font-family: 'Font Awesome 6 Pro', Fontawesome !important;\n }\n`;\n\ntype StyledMotionContentWrapperProps = WithTheme<{ $isWrapped: boolean }>;\n\nexport const StyledMotionContentWrapper = styled(motion.div)<StyledMotionContentWrapperProps>`\n align-self: flex-start;\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n display: flex;\n flex: 1 1 auto;\n height: 100%;\n overflow: hidden;\n margin-right: 10px;\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n align-items: center;\n `}\n`;\n\nexport const StyledMotionTitleWrapper = styled(motion.div)`\n display: grid;\n flex: 0 1 auto;\n grid-template-areas: 'header';\n`;\n\ntype StyledMotionTitleProps = WithTheme<{\n $isOpen: boolean;\n $isWrapped: boolean;\n $color?: CSSProperties['color'];\n $hasSearch: boolean;\n}>;\n\nexport const StyledMotionTitle = styled(motion.div)<StyledMotionTitleProps>`\n font-size: ${({ $isOpen, $isWrapped }) => ($isOpen && !$isWrapped ? '1.3rem' : undefined)};\n font-weight: ${({ $isOpen, $isWrapped }) => ($isOpen && $isWrapped ? 700 : 'normal')};\n grid-area: header;\n height: ${({ $isWrapped, $hasSearch }) => ($isWrapped || $hasSearch ? '100%' : undefined)};\n overflow: hidden;\n text-overflow: ellipsis;\n transform-origin: top left;\n user-select: none;\n color: ${({ $color, theme }: StyledMotionTitleProps) => $color ?? theme.text};\n white-space: ${({ $isOpen, $isWrapped, $hasSearch }) =>\n $isOpen && !$isWrapped && !$hasSearch ? 'normal' : 'nowrap'};\n\n will-change: unset !important;\n\n ${({ $isWrapped }) =>\n $isWrapped &&\n css`\n align-content: center;\n `}\n`;\n\nexport const StyledMotionTitleElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n flex: 1 1 auto;\n margin-left: 8px;\n min-width: 0;\n`;\n\ntype StyledRightWrapperProps = {\n $isSearchActive: boolean;\n};\n\nexport const StyledRightWrapper = styled.div<StyledRightWrapperProps>`\n display: flex;\n flex: 0 0 auto;\n gap: 8px;\n margin-right: 5px;\n overflow: hidden;\n position: relative;\n\n width: ${({ $isSearchActive }) => ($isSearchActive ? '40%' : undefined)};\n`;\n\nexport const StyledMotionSearchWrapper = styled(motion.div)`\n align-items: center;\n justify-content: end;\n position: relative;\n display: flex;\n width: 100%;\n`;\n\nexport const StyledMotionRightElementWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n\n cursor: ${({ onClick }) => (typeof onClick === 'function' ? 'pointer' : 'default')};\n\n will-change: unset !important;\n`;\n\ntype StyledMotionRightInputProps = WithTheme<{\n $hasIcon: boolean;\n}>;\n\nexport const StyledMotionRightInput = styled(motion.input)<StyledMotionRightInputProps>`\n background-color: transparent;\n border: 1px solid transparent;\n border-bottom-color: rgba(\n ${({ theme }: StyledMotionRightInputProps) => theme['headline-rgb']},\n 0.45\n );\n color: ${({ theme }: StyledMotionRightInputProps) => theme.text};\n grid-area: header;\n padding: ${({ $hasIcon }) => ($hasIcon ? '5px 23px 5px 1px' : '5px 1px')};\n`;\n\nexport const StyledMotionRightInputIconWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n position: absolute;\n right: 4px;\n top: 0;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CA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AAAvB,OAAA,CAAAuB,yBAAA,GAAG,IAAAtB,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AAC3D;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMqB,+BAA+B,GAAAxB,OAAA,CAAAwB,+BAAA,GAAG,IAAAvB,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AACjE;AACA;AACA;AACA,cAAc,CAAC;EAAEI;AAAQ,CAAC,KAAM,OAAOA,OAAO,KAAK,UAAU,GAAG,SAAS,GAAG,SAAU;AACtF;AACA;AACA,CAAC;AAMM,MAAMkB,sBAAsB,GAAAzB,OAAA,CAAAyB,sBAAA,GAAG,IAAAxB,yBAAM,EAACC,aAAM,CAACwB,KAAK,CAA8B;AACvF;AACA;AACA;AACA,UAAU,CAAC;EAAEtB;AAAmC,CAAC,KAAKA,KAAK,CAAC,cAAc,CAAC;AAC3E;AACA;AACA,aAAa,CAAC;EAAEA;AAAmC,CAAC,KAAKA,KAAK,CAACC,IAAI;AACnE;AACA,eAAe,CAAC;EAAEsB;AAAS,CAAC,KAAMA,QAAQ,GAAG,kBAAkB,GAAG,SAAU;AAC5E,CAAC;AAEM,MAAMC,iCAAiC,GAAA5B,OAAA,CAAA4B,iCAAA,GAAG,IAAA3B,yBAAM,EAACC,aAAM,CAACC,GAAG,CAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionButton","exports","styled","motion","button","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","css","$isSecondary","theme","text","buttonDesign","buttonColor","buttonBackgroundColor","$isDisabled","$hasIcon","$hasChildren","$shouldShowWaitCursor","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type {
|
|
1
|
+
{"version":3,"file":"Button.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionButton","exports","styled","motion","button","$shouldShowTextAsRobotoMedium","$shouldShowAsSelectButton","css","$isSecondary","theme","text","buttonDesign","buttonColor","buttonBackgroundColor","$isDisabled","$hasIcon","$hasChildren","$shouldShowWaitCursor","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledButtonProps = WithTheme<{\n $hasIcon: boolean;\n $hasChildren: boolean;\n $isDisabled?: boolean;\n $isSecondary?: boolean;\n $shouldShowTextAsRobotoMedium: boolean;\n $shouldShowAsSelectButton: boolean;\n $shouldShowWaitCursor?: boolean;\n}>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n ${({ $shouldShowTextAsRobotoMedium, $shouldShowAsSelectButton }) =>\n $shouldShowTextAsRobotoMedium &&\n !$shouldShowAsSelectButton &&\n css`\n font-size: 110%;\n font-family: 'Roboto Medium', serif;\n `}\n\n align-items: center;\n\n ${({ $isSecondary, $shouldShowAsSelectButton, theme }: StyledButtonProps) => {\n if ($isSecondary || $shouldShowAsSelectButton) {\n return css`\n color: ${theme.text};\n `;\n }\n\n return css`\n color: ${theme.buttonDesign === '2'\n ? (theme.buttonColor ?? theme.buttonBackgroundColor ?? 'white')\n : (theme.buttonColor ?? 'white')};\n `;\n }}\n\n ${({ theme, $isSecondary, $shouldShowAsSelectButton }: StyledButtonProps) => {\n if (theme.buttonDesign === '2' && !$shouldShowAsSelectButton) {\n return css`\n border: 1px solid ${$isSecondary ? theme['202'] : theme.buttonBackgroundColor};\n box-shadow: none;\n `;\n }\n\n return css`\n border: none;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n `;\n }}\n\n border-radius: 3px;\n cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n line-height: 22px;\n min-height: 32px;\n position: relative;\n user-select: none;\n\n ${({ $hasIcon, $hasChildren, $shouldShowWaitCursor }) => {\n if ($shouldShowWaitCursor) {\n return css`\n padding: 4px 12px;\n `;\n }\n\n if ($hasIcon) {\n if ($hasChildren) {\n return css`\n padding: 6px 12px 6px 42px;\n `;\n }\n return css`\n padding: 6px 12px 6px 18px;\n `;\n }\n return css`\n padding: 6px 12px 6px 12px;\n `;\n }}\n`;\n//\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)`\n will-change: unset !important;\n`;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CA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C","ignoreList":[]}
|
|
@@ -10,8 +10,6 @@ var _styledComponents = require("styled-components");
|
|
|
10
10
|
var _ColorSchemeProvider = require("./ColorSchemeProvider.styles");
|
|
11
11
|
var _useChaynsTheme = require("./hooks/useChaynsTheme");
|
|
12
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
-
// ToDo remove type after the framer-motion bug is Fixed
|
|
14
|
-
|
|
15
13
|
const GlobalStyle = (0, _styledComponents.createGlobalStyle)`
|
|
16
14
|
.ellipsis {
|
|
17
15
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorSchemeProvider.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_styledComponents","_ColorSchemeProvider","_useChaynsTheme","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GlobalStyle","createGlobalStyle","ColorSchemeContext","exports","createContext","undefined","useColorScheme","useContext","ColorSchemeProvider","children","color","colorProp","colorMode","colorModeProp","secondaryColor","siteId","style","customVariables","internalColor","internalColorMode","useSite","overrideParagraphFormat","paragraphFormat","useMemo","contextValue","useChaynsTheme","createElement","ThemeProvider","theme","Provider","value","StyledColorSchemeProvider","className","displayName","_default"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { ChaynsDesignSettings, ChaynsParagraphFormat, ColorMode, useSite } from 'chayns-api';\nimport React, { createContext, FC, ReactNode, useContext, useMemo } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { StyledColorSchemeProvider } from './ColorSchemeProvider.styles';\nimport { useChaynsTheme } from './hooks/useChaynsTheme';\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 color mode to be used for the children\n */\n colorMode?: ColorMode;\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 * Additional variables to extend the theme\n */\n customVariables?: Record<string, string>;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\
|
|
1
|
+
{"version":3,"file":"ColorSchemeProvider.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_styledComponents","_ColorSchemeProvider","_useChaynsTheme","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GlobalStyle","createGlobalStyle","ColorSchemeContext","exports","createContext","undefined","useColorScheme","useContext","ColorSchemeProvider","children","color","colorProp","colorMode","colorModeProp","secondaryColor","siteId","style","customVariables","internalColor","internalColorMode","useSite","overrideParagraphFormat","paragraphFormat","useMemo","contextValue","useChaynsTheme","createElement","ThemeProvider","theme","Provider","value","StyledColorSchemeProvider","className","displayName","_default"],"sources":["../../../../src/components/color-scheme-provider/ColorSchemeProvider.tsx"],"sourcesContent":["import { ChaynsDesignSettings, ChaynsParagraphFormat, ColorMode, useSite } from 'chayns-api';\nimport React, { createContext, FC, ReactNode, useContext, useMemo } from 'react';\nimport { createGlobalStyle, ThemeProvider } from 'styled-components';\nimport { StyledColorSchemeProvider } from './ColorSchemeProvider.styles';\nimport { useChaynsTheme } from './hooks/useChaynsTheme';\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 color mode to be used for the children\n */\n colorMode?: ColorMode;\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 * Additional variables to extend the theme\n */\n customVariables?: Record<string, string>;\n};\n\nexport interface Theme {\n [key: string]: string;\n}\n\nexport type WithTheme<T> = T & {\n theme: Theme;\n};\n\nconst GlobalStyle = createGlobalStyle`\n .ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n footer {\n font-size: 0.85rem;\n color: #888;\n margin: 10px 0 0;\n\n & a {\n color: #888;\n letter-spacing: -0.3px;\n }\n }\n`;\n\nexport interface ColorSchemeContextProps {\n designSettings?: ChaynsDesignSettings;\n paragraphFormat: ChaynsParagraphFormat[];\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: colorProp,\n colorMode: colorModeProp,\n secondaryColor,\n siteId,\n style = {},\n customVariables,\n}) => {\n const { color: internalColor, colorMode: internalColorMode } = useSite();\n\n const color = colorProp ?? internalColor;\n const colorMode = colorModeProp ?? internalColorMode;\n const overrideParagraphFormat =\n (color && color !== internalColor) || colorMode !== internalColorMode;\n const paragraphFormat = useMemo(\n () => (overrideParagraphFormat ? [] : undefined),\n [overrideParagraphFormat],\n );\n\n const contextValue = useChaynsTheme({\n color,\n colorMode,\n secondaryColor,\n siteId,\n customVariables,\n // Overrides the paragraphFormat on changed color or colorMode\n paragraphFormat,\n });\n\n return (\n <ThemeProvider theme={contextValue.theme}>\n <ColorSchemeContext.Provider value={contextValue}>\n <StyledColorSchemeProvider className=\"color-scheme-provider\" style={style}>\n {children}\n </StyledColorSchemeProvider>\n <GlobalStyle />\n </ColorSchemeContext.Provider>\n </ThemeProvider>\n );\n};\n\nColorSchemeProvider.displayName = 'ColorSchemeProvider';\n\nexport default ColorSchemeProvider;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AAAwD,SAAAE,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IA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AACC,KAAK,EAAEJ,YAAY,CAACI;EAAM,gBACrCpD,MAAA,CAAAe,OAAA,CAAAmC,aAAA,CAACxB,kBAAkB,CAAC2B,QAAQ;IAACC,KAAK,EAAEN;EAAa,gBAC7ChD,MAAA,CAAAe,OAAA,CAAAmC,aAAA,CAAC/C,oBAAA,CAAAoD,yBAAyB;IAACC,SAAS,EAAC,uBAAuB;IAAChB,KAAK,EAAEA;EAAM,GACrEP,QACsB,CAAC,eAC5BjC,MAAA,CAAAe,OAAA,CAAAmC,aAAA,CAAC1B,WAAW,MAAE,CACW,CAClB,CAAC;AAExB,CAAC;AAEDQ,mBAAmB,CAACyB,WAAW,GAAG,qBAAqB;AAAC,IAAAC,QAAA,GAAA/B,OAAA,CAAAZ,OAAA,GAEzCiB,mBAAmB","ignoreList":[]}
|
|
@@ -5,24 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _chaynsApi = require("chayns-api");
|
|
8
|
-
var _react = require("
|
|
9
|
-
var _react2 = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _reactDom = require("react-dom");
|
|
11
|
-
var _comboBox = require("../../types/comboBox");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
9
|
var _calculate = require("../../utils/calculate");
|
|
13
10
|
var _environment = require("../../utils/environment");
|
|
14
11
|
var _AreaContextProvider = require("../area-provider/AreaContextProvider");
|
|
15
12
|
var _Icon = _interopRequireDefault(require("../icon/Icon"));
|
|
16
13
|
var _ComboBoxItem = _interopRequireDefault(require("./combobox-item/ComboBoxItem"));
|
|
17
14
|
var _ComboBox = require("./ComboBox.styles");
|
|
15
|
+
var _DropdownBodyWrapper = _interopRequireDefault(require("../dropdown-body-wrapper/DropdownBodyWrapper"));
|
|
16
|
+
var _dropdown = require("../../types/dropdown");
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
19
|
const ComboBox = ({
|
|
21
20
|
bodyWidth,
|
|
22
|
-
direction =
|
|
21
|
+
direction = _dropdown.DropdownDirection.RIGHT,
|
|
23
22
|
isDisabled = false,
|
|
24
23
|
lists,
|
|
25
|
-
maxHeight =
|
|
24
|
+
maxHeight = 280,
|
|
26
25
|
onSelect,
|
|
27
26
|
placeholder,
|
|
28
27
|
prefix,
|
|
@@ -38,130 +37,59 @@ const ComboBox = ({
|
|
|
38
37
|
onInputBlur,
|
|
39
38
|
inputValue
|
|
40
39
|
}) => {
|
|
41
|
-
const [internalSelectedItem, setInternalSelectedItem] = (0,
|
|
42
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
43
|
-
const [minWidth, setMinWidth] = (0,
|
|
44
|
-
const [bodyMinWidth, setBodyMinWidth] = (0,
|
|
45
|
-
const [focusedIndex, setFocusedIndex] = (0,
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const [portal, setPortal] = (0, _react2.useState)();
|
|
50
|
-
const [internalCoordinates, setInternalCoordinates] = (0, _react2.useState)({
|
|
51
|
-
x: 0,
|
|
52
|
-
y: 0
|
|
53
|
-
});
|
|
54
|
-
const [newContainer, setNewContainer] = (0, _react2.useState)(container ?? null);
|
|
55
|
-
const [shouldUseTopAlignment, setShouldUseTopAlignment] = (0, _react2.useState)(false);
|
|
56
|
-
const isInputFocused = (0, _react2.useRef)(false);
|
|
57
|
-
const styledComboBoxElementRef = (0, _react2.useRef)(null);
|
|
58
|
-
const contentRef = (0, _react2.useRef)(null);
|
|
40
|
+
const [internalSelectedItem, setInternalSelectedItem] = (0, _react.useState)();
|
|
41
|
+
const [isAnimating, setIsAnimating] = (0, _react.useState)(false);
|
|
42
|
+
const [minWidth, setMinWidth] = (0, _react.useState)(undefined);
|
|
43
|
+
const [bodyMinWidth, setBodyMinWidth] = (0, _react.useState)(0);
|
|
44
|
+
const [focusedIndex, setFocusedIndex] = (0, _react.useState)(null);
|
|
45
|
+
const isInputFocused = (0, _react.useRef)(false);
|
|
46
|
+
const styledComboBoxElementRef = (0, _react.useRef)(null);
|
|
47
|
+
const contentRef = (0, _react.useRef)(null);
|
|
59
48
|
const functions = (0, _chaynsApi.useFunctions)();
|
|
60
49
|
const values = (0, _chaynsApi.useValues)();
|
|
50
|
+
const isTouch = (0, _environment.getIsTouch)();
|
|
61
51
|
const {
|
|
62
52
|
browser
|
|
63
53
|
} = (0, _chaynsApi.useDevice)();
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
const shouldDisableActions = (0, _react2.useMemo)(() => {
|
|
54
|
+
const areaProvider = (0, _react.useContext)(_AreaContextProvider.AreaContext);
|
|
55
|
+
const shouldChangeColor = (0, _react.useMemo)(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]);
|
|
56
|
+
const shouldDisableActions = (0, _react.useMemo)(() => {
|
|
68
57
|
if (!selectedItem) {
|
|
69
58
|
return false;
|
|
70
59
|
}
|
|
71
60
|
const combinedLists = lists.flatMap(list => list.list);
|
|
72
61
|
return combinedLists.length === 1 && combinedLists.some(item => item.value === selectedItem.value);
|
|
73
62
|
}, [lists, selectedItem]);
|
|
74
|
-
const contentHeight = (0,
|
|
63
|
+
const contentHeight = (0, _react.useMemo)(() => {
|
|
75
64
|
const flatItems = lists.flatMap(list => list.list);
|
|
76
65
|
let result = flatItems.length * 36;
|
|
77
66
|
if (lists.length > 1) {
|
|
78
67
|
result += lists.length * 36;
|
|
79
68
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (maxHeight.toString().includes('px')) {
|
|
83
|
-
const maxHeightValue = parseInt(maxHeight.toString().replace('px', ''), 10);
|
|
84
|
-
if (maxHeightValue < result) {
|
|
85
|
-
result = maxHeightValue;
|
|
86
|
-
}
|
|
69
|
+
if (maxHeight < result) {
|
|
70
|
+
result = maxHeight;
|
|
87
71
|
}
|
|
88
72
|
return result;
|
|
89
73
|
}, [lists, maxHeight]);
|
|
90
|
-
(0,
|
|
91
|
-
if (styledComboBoxElementRef.current && !container) {
|
|
92
|
-
const el = styledComboBoxElementRef.current;
|
|
93
|
-
const element = el.closest('.dialog-inner') || el.closest('.page-provider') || el.closest('body');
|
|
94
|
-
setNewContainer(element);
|
|
95
|
-
}
|
|
96
|
-
}, [container]);
|
|
97
|
-
(0, _react2.useEffect)(() => {
|
|
98
|
-
if (container instanceof Element) {
|
|
99
|
-
setNewContainer(container);
|
|
100
|
-
}
|
|
101
|
-
}, [container]);
|
|
102
|
-
const handleInputFocus = (0, _react2.useCallback)(event => {
|
|
74
|
+
const handleInputFocus = (0, _react.useCallback)(event => {
|
|
103
75
|
isInputFocused.current = true;
|
|
104
76
|
onInputFocus === null || onInputFocus === void 0 || onInputFocus(event);
|
|
105
77
|
}, [onInputFocus]);
|
|
106
|
-
const handleInputBlur = (0,
|
|
78
|
+
const handleInputBlur = (0, _react.useCallback)(event => {
|
|
107
79
|
isInputFocused.current = false;
|
|
108
80
|
onInputBlur === null || onInputBlur === void 0 || onInputBlur(event);
|
|
109
81
|
}, [onInputBlur]);
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}, [styledComboBoxElementRef]);
|
|
115
|
-
const handleOpen = (0, _react2.useCallback)(() => {
|
|
116
|
-
if (shouldDisableActions) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (styledComboBoxElementRef.current && newContainer) {
|
|
120
|
-
const {
|
|
121
|
-
left: comboBoxLeft,
|
|
122
|
-
top: comboBoxTop,
|
|
123
|
-
height
|
|
124
|
-
} = styledComboBoxElementRef.current.getBoundingClientRect();
|
|
125
|
-
const {
|
|
126
|
-
left,
|
|
127
|
-
top,
|
|
128
|
-
height: containerHeight
|
|
129
|
-
} = newContainer.getBoundingClientRect();
|
|
130
|
-
const x = comboBoxLeft - left + newContainer.scrollLeft;
|
|
131
|
-
const y = comboBoxTop - top + newContainer.scrollTop;
|
|
132
|
-
let useTopAlignment = [_comboBox.ComboBoxDirection.TOP, _comboBox.ComboBoxDirection.TOP_LEFT, _comboBox.ComboBoxDirection.TOP_RIGHT].includes(direction);
|
|
133
|
-
const hasBottomAlignment = [_comboBox.ComboBoxDirection.BOTTOM, _comboBox.ComboBoxDirection.BOTTOM_LEFT, _comboBox.ComboBoxDirection.BOTTOM_RIGHT].includes(direction);
|
|
134
|
-
if (!hasBottomAlignment && y + height + contentHeight > containerHeight) {
|
|
135
|
-
useTopAlignment = true;
|
|
136
|
-
setShouldUseTopAlignment(true);
|
|
137
|
-
} else {
|
|
138
|
-
setShouldUseTopAlignment(false);
|
|
139
|
-
}
|
|
140
|
-
setInternalCoordinates({
|
|
141
|
-
x,
|
|
142
|
-
y: useTopAlignment ? y : y + height
|
|
143
|
-
});
|
|
144
|
-
setIsAnimating(true);
|
|
145
|
-
}
|
|
146
|
-
}, [shouldDisableActions, newContainer, contentHeight, direction]);
|
|
147
|
-
const handleClose = (0, _react2.useCallback)(() => {
|
|
82
|
+
const handleOpen = (0, _react.useCallback)(() => {
|
|
83
|
+
setIsAnimating(true);
|
|
84
|
+
}, []);
|
|
85
|
+
const handleClose = (0, _react.useCallback)(() => {
|
|
148
86
|
setIsAnimating(false);
|
|
149
87
|
}, []);
|
|
150
88
|
|
|
151
|
-
/**
|
|
152
|
-
* This function adds an event listener to the document to close the combobox when the user clicks outside of it
|
|
153
|
-
*/
|
|
154
|
-
(0, _react2.useEffect)(() => {
|
|
155
|
-
document.addEventListener('click', handleClick);
|
|
156
|
-
return () => {
|
|
157
|
-
document.removeEventListener('click', handleClick);
|
|
158
|
-
};
|
|
159
|
-
}, [handleClick, styledComboBoxElementRef]);
|
|
160
|
-
|
|
161
89
|
/**
|
|
162
90
|
* This function sets the selected item
|
|
163
91
|
*/
|
|
164
|
-
const handleSetSelectedItem = (0,
|
|
92
|
+
const handleSetSelectedItem = (0, _react.useCallback)(itemToSelect => {
|
|
165
93
|
if (typeof onSelect === 'function') {
|
|
166
94
|
const onSelectResult = onSelect(itemToSelect);
|
|
167
95
|
if (onSelectResult === false) {
|
|
@@ -179,45 +107,44 @@ const ComboBox = ({
|
|
|
179
107
|
setInternalSelectedItem(itemToSelect);
|
|
180
108
|
setIsAnimating(false);
|
|
181
109
|
}, [onSelect]);
|
|
182
|
-
const handleClear = (0,
|
|
110
|
+
const handleClear = (0, _react.useCallback)(event => {
|
|
183
111
|
event.preventDefault();
|
|
184
112
|
event.stopPropagation();
|
|
185
113
|
handleSetSelectedItem(undefined);
|
|
186
114
|
}, [handleSetSelectedItem]);
|
|
187
|
-
(0,
|
|
188
|
-
const currentContent = contentRef.current;
|
|
189
|
-
if (portal && isAnimating && currentContent) {
|
|
190
|
-
const scrollHeight = currentContent.scrollHeight ?? 0;
|
|
191
|
-
const maxHeightInPixels = (0, _calculate.getMaxHeightInPixels)(maxHeight, styledComboBoxElementRef.current ?? document.body);
|
|
192
|
-
setOverflowY(scrollHeight > maxHeightInPixels ? 'scroll' : 'hidden');
|
|
193
|
-
}
|
|
194
|
-
}, [isAnimating, maxHeight, portal]);
|
|
195
|
-
(0, _react2.useEffect)(() => {
|
|
115
|
+
(0, _react.useEffect)(() => {
|
|
196
116
|
const handleKeyDown = e => {
|
|
197
|
-
if (!isAnimating)
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
117
|
+
if (!isAnimating) return;
|
|
200
118
|
if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
|
|
201
119
|
var _contentRef$current;
|
|
202
120
|
e.preventDefault();
|
|
203
121
|
const children = (_contentRef$current = contentRef.current) === null || _contentRef$current === void 0 ? void 0 : _contentRef$current.children;
|
|
204
|
-
if (children
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
setFocusedIndex(newIndex);
|
|
122
|
+
if (!children || children.length === 0) return;
|
|
123
|
+
const stepDirection = e.key === 'ArrowUp' ? -1 : 1;
|
|
124
|
+
let newIndex = focusedIndex ?? -1;
|
|
125
|
+
let attempts = 0;
|
|
126
|
+
do {
|
|
127
|
+
newIndex = (newIndex + stepDirection + children.length) % children.length;
|
|
211
128
|
const newElement = children[newIndex];
|
|
212
|
-
|
|
213
|
-
newElement.
|
|
129
|
+
let shouldSkip = false;
|
|
130
|
+
if (newElement.id.startsWith('combobox-group--') || newElement.id.endsWith('--disabled-item')) {
|
|
131
|
+
shouldSkip = true;
|
|
132
|
+
}
|
|
133
|
+
if (!shouldSkip) break;
|
|
134
|
+
attempts++;
|
|
135
|
+
} while (attempts < children.length);
|
|
136
|
+
if (focusedIndex !== null) {
|
|
137
|
+
const prevElement = children[focusedIndex];
|
|
138
|
+
prevElement.tabIndex = -1;
|
|
214
139
|
}
|
|
140
|
+
setFocusedIndex(newIndex);
|
|
141
|
+
const focusedElement = children[newIndex];
|
|
142
|
+
focusedElement.tabIndex = 0;
|
|
143
|
+
focusedElement.focus();
|
|
215
144
|
} else if (e.key === 'Enter' && focusedIndex !== null) {
|
|
216
145
|
var _contentRef$current2;
|
|
217
146
|
const element = (_contentRef$current2 = contentRef.current) === null || _contentRef$current2 === void 0 ? void 0 : _contentRef$current2.children[focusedIndex];
|
|
218
|
-
if (!element)
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
147
|
+
if (!element) return;
|
|
221
148
|
const {
|
|
222
149
|
id
|
|
223
150
|
} = element;
|
|
@@ -228,22 +155,19 @@ const ComboBox = ({
|
|
|
228
155
|
}) => String(value) === id.replace('combobox-item__', ''));
|
|
229
156
|
return !!newSelectedItem;
|
|
230
157
|
});
|
|
231
|
-
if (
|
|
232
|
-
|
|
158
|
+
if (newSelectedItem) {
|
|
159
|
+
handleSetSelectedItem(newSelectedItem);
|
|
233
160
|
}
|
|
234
|
-
handleSetSelectedItem(newSelectedItem);
|
|
235
161
|
}
|
|
236
162
|
};
|
|
237
163
|
document.addEventListener('keydown', handleKeyDown);
|
|
238
|
-
return () =>
|
|
239
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
240
|
-
};
|
|
164
|
+
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
241
165
|
}, [focusedIndex, handleSetSelectedItem, isAnimating, lists]);
|
|
242
166
|
|
|
243
167
|
/**
|
|
244
168
|
* This function calculates the greatest width
|
|
245
169
|
*/
|
|
246
|
-
(0,
|
|
170
|
+
(0, _react.useEffect)(() => {
|
|
247
171
|
var _styledComboBoxElemen;
|
|
248
172
|
const allItems = lists.flatMap(list => list.list);
|
|
249
173
|
const hasImage = [selectedItem, ...allItems].some(item => item === null || item === void 0 ? void 0 : item.imageUrl);
|
|
@@ -294,19 +218,11 @@ const ComboBox = ({
|
|
|
294
218
|
/**
|
|
295
219
|
* This function sets the external selected item
|
|
296
220
|
*/
|
|
297
|
-
(0,
|
|
221
|
+
(0, _react.useEffect)(() => {
|
|
298
222
|
setIsAnimating(false);
|
|
299
223
|
setInternalSelectedItem(selectedItem);
|
|
300
224
|
}, [selectedItem]);
|
|
301
|
-
(0,
|
|
302
|
-
if ([_comboBox.ComboBoxDirection.BOTTOM_LEFT, _comboBox.ComboBoxDirection.TOP_LEFT, _comboBox.ComboBoxDirection.LEFT].includes(direction) && typeof bodyWidth === 'number' && typeof minWidth === 'number') {
|
|
303
|
-
const difference = minWidth - bodyWidth;
|
|
304
|
-
setTranslateX(`${difference}px`);
|
|
305
|
-
} else {
|
|
306
|
-
setTranslateX('0px');
|
|
307
|
-
}
|
|
308
|
-
}, [bodyWidth, direction, minWidth]);
|
|
309
|
-
const placeholderImageUrl = (0, _react2.useMemo)(() => {
|
|
225
|
+
const placeholderImageUrl = (0, _react.useMemo)(() => {
|
|
310
226
|
if (selectedItem) {
|
|
311
227
|
return selectedItem.imageUrl;
|
|
312
228
|
}
|
|
@@ -315,7 +231,7 @@ const ComboBox = ({
|
|
|
315
231
|
}
|
|
316
232
|
return undefined;
|
|
317
233
|
}, [internalSelectedItem, selectedItem]);
|
|
318
|
-
const placeholderIcon = (0,
|
|
234
|
+
const placeholderIcon = (0, _react.useMemo)(() => {
|
|
319
235
|
if (selectedItem) {
|
|
320
236
|
return selectedItem.icons;
|
|
321
237
|
}
|
|
@@ -328,7 +244,7 @@ const ComboBox = ({
|
|
|
328
244
|
/**
|
|
329
245
|
* This function resets the placeholder
|
|
330
246
|
*/
|
|
331
|
-
const placeholderText = (0,
|
|
247
|
+
const placeholderText = (0, _react.useMemo)(() => {
|
|
332
248
|
let text = placeholder;
|
|
333
249
|
if (selectedItem) {
|
|
334
250
|
text = selectedItem.text;
|
|
@@ -337,7 +253,7 @@ const ComboBox = ({
|
|
|
337
253
|
}
|
|
338
254
|
return text;
|
|
339
255
|
}, [internalSelectedItem, placeholder, selectedItem]);
|
|
340
|
-
const shouldShowRoundPlaceholderImage = (0,
|
|
256
|
+
const shouldShowRoundPlaceholderImage = (0, _react.useMemo)(() => {
|
|
341
257
|
const selectedItemList = lists.find(list => list.list.some(({
|
|
342
258
|
value
|
|
343
259
|
}) => value === ((selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.value) ?? (internalSelectedItem === null || internalSelectedItem === void 0 ? void 0 : internalSelectedItem.value))));
|
|
@@ -347,7 +263,7 @@ const ComboBox = ({
|
|
|
347
263
|
/**
|
|
348
264
|
* This function opens the content of the combobox
|
|
349
265
|
*/
|
|
350
|
-
const handleHeaderClick = (0,
|
|
266
|
+
const handleHeaderClick = (0, _react.useCallback)(() => {
|
|
351
267
|
if (!isDisabled && !isInputFocused.current) {
|
|
352
268
|
if (isAnimating) {
|
|
353
269
|
handleClose();
|
|
@@ -356,82 +272,23 @@ const ComboBox = ({
|
|
|
356
272
|
}
|
|
357
273
|
}
|
|
358
274
|
}, [handleClose, handleOpen, isAnimating, isDisabled]);
|
|
359
|
-
const comboBoxGroups = (0,
|
|
275
|
+
const comboBoxGroups = (0, _react.useMemo)(() => lists.map(list => /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
360
276
|
key: list.groupName ?? 'default-group'
|
|
361
|
-
}, list.groupName && lists.length > 1 && /*#__PURE__*/
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
icons: item.icons,
|
|
366
|
-
id: item.value,
|
|
367
|
-
imageBackground: item.imageBackground,
|
|
368
|
-
imageUrl: item.imageUrl,
|
|
369
|
-
isDisabled: item.isDisabled,
|
|
277
|
+
}, list.groupName && lists.length > 1 && /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxTopic, {
|
|
278
|
+
id: `combobox-group--${list.groupName}`
|
|
279
|
+
}, list.groupName), list.list.map(item => /*#__PURE__*/_react.default.createElement(_ComboBoxItem.default, {
|
|
280
|
+
item: item,
|
|
370
281
|
isSelected: selectedItem ? item.value === selectedItem.value : false,
|
|
371
|
-
key: item.value,
|
|
372
282
|
onSelect: handleSetSelectedItem,
|
|
373
|
-
rightElement: item.rightElement,
|
|
374
283
|
shouldShowBigImage: shouldShowBigImage,
|
|
375
|
-
shouldShowRoundImage: list.shouldShowRoundImage ?? shouldShowRoundImage
|
|
376
|
-
subtext: item.subtext,
|
|
377
|
-
suffixElement: item.suffixElement,
|
|
378
|
-
text: item.text,
|
|
379
|
-
value: item.value,
|
|
380
|
-
textStyles: item.textStyles
|
|
284
|
+
shouldShowRoundImage: list.shouldShowRoundImage ?? shouldShowRoundImage
|
|
381
285
|
})))), [handleSetSelectedItem, lists, selectedItem, shouldShowBigImage, shouldShowRoundImage]);
|
|
382
|
-
|
|
383
|
-
left: internalCoordinates.x,
|
|
384
|
-
top: internalCoordinates.y
|
|
385
|
-
}), [internalCoordinates.x, internalCoordinates.y]);
|
|
386
|
-
(0, _react2.useEffect)(() => {
|
|
387
|
-
const useTopAlignment = shouldUseTopAlignment || [_comboBox.ComboBoxDirection.TOP, _comboBox.ComboBoxDirection.TOP_LEFT, _comboBox.ComboBoxDirection.TOP_RIGHT].includes(direction);
|
|
388
|
-
if (useTopAlignment) {
|
|
389
|
-
setTranslateY('-100%');
|
|
390
|
-
} else {
|
|
391
|
-
setTranslateY('0px');
|
|
392
|
-
}
|
|
393
|
-
}, [direction, shouldUseTopAlignment]);
|
|
394
|
-
(0, _react2.useEffect)(() => {
|
|
395
|
-
if (!newContainer) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
setPortal(() => /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react2.default.createElement(_react.AnimatePresence, {
|
|
399
|
-
initial: false
|
|
400
|
-
}, isAnimating && /*#__PURE__*/_react2.default.createElement(_ComboBox.StyledMotionComboBoxBody, {
|
|
401
|
-
$browser: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
402
|
-
animate: {
|
|
403
|
-
height: 'fit-content',
|
|
404
|
-
opacity: 1
|
|
405
|
-
},
|
|
406
|
-
$overflowY: overflowY,
|
|
407
|
-
$translateX: translateX,
|
|
408
|
-
$translateY: translateY,
|
|
409
|
-
initial: {
|
|
410
|
-
height: 0,
|
|
411
|
-
opacity: 0
|
|
412
|
-
},
|
|
413
|
-
exit: {
|
|
414
|
-
height: 0,
|
|
415
|
-
opacity: 0
|
|
416
|
-
},
|
|
417
|
-
$maxHeight: maxHeight,
|
|
418
|
-
$minWidth: bodyWidth ?? bodyMinWidth,
|
|
419
|
-
style: bodyStyles,
|
|
420
|
-
$direction: direction,
|
|
421
|
-
$shouldUseCurrentItemWidth: shouldUseCurrentItemWidth,
|
|
422
|
-
transition: {
|
|
423
|
-
duration: 0.2
|
|
424
|
-
},
|
|
425
|
-
tabIndex: 0,
|
|
426
|
-
ref: contentRef
|
|
427
|
-
}, comboBoxGroups)), newContainer));
|
|
428
|
-
}, [bodyWidth, bodyMinWidth, bodyStyles, browser === null || browser === void 0 ? void 0 : browser.name, comboBoxGroups, newContainer, direction, isAnimating, maxHeight, minWidth, overflowY, shouldUseCurrentItemWidth, translateX, translateY]);
|
|
429
|
-
return (0, _react2.useMemo)(() => /*#__PURE__*/_react2.default.createElement(_ComboBox.StyledComboBox, {
|
|
286
|
+
return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBox, {
|
|
430
287
|
ref: styledComboBoxElementRef,
|
|
431
288
|
$minWidth: minWidth,
|
|
432
289
|
$shouldUseFullWidth: shouldUseFullWidth,
|
|
433
290
|
$shouldUseCurrentItemWidth: shouldUseCurrentItemWidth
|
|
434
|
-
}, /*#__PURE__*/
|
|
291
|
+
}, /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxHeader, {
|
|
435
292
|
$direction: direction,
|
|
436
293
|
onClick: handleHeaderClick,
|
|
437
294
|
$isOpen: isAnimating,
|
|
@@ -439,30 +296,47 @@ const ComboBox = ({
|
|
|
439
296
|
$isDisabled: isDisabled,
|
|
440
297
|
$shouldChangeColor: shouldChangeColor,
|
|
441
298
|
$shouldShowBigImage: shouldShowBigImage
|
|
442
|
-
}, /*#__PURE__*/
|
|
299
|
+
}, /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxPrefixAndPlaceholderWrapper, null, prefix && /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxPrefix, null, prefix), /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxPlaceholder, {
|
|
443
300
|
$shouldReduceOpacity: !selectedItem && !internalSelectedItem
|
|
444
|
-
}, placeholderImageUrl && /*#__PURE__*/
|
|
301
|
+
}, placeholderImageUrl && /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxPlaceholderImage, {
|
|
445
302
|
src: placeholderImageUrl,
|
|
446
303
|
$shouldShowBigImage: shouldShowBigImage,
|
|
447
304
|
$shouldShowRoundImage: shouldShowRoundPlaceholderImage
|
|
448
|
-
}), placeholderIcon && /*#__PURE__*/
|
|
305
|
+
}), placeholderIcon && /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
449
306
|
icons: placeholderIcon
|
|
450
|
-
}), typeof inputValue === 'string' ? /*#__PURE__*/
|
|
307
|
+
}), typeof inputValue === 'string' ? /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxInput, {
|
|
451
308
|
disabled: isDisabled,
|
|
452
309
|
value: inputValue,
|
|
453
310
|
onChange: onInputChange,
|
|
454
311
|
onBlur: handleInputBlur,
|
|
455
312
|
onFocus: handleInputFocus,
|
|
456
313
|
placeholder: placeholderText
|
|
457
|
-
}) : /*#__PURE__*/
|
|
314
|
+
}) : /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxPlaceholderText, null, placeholderText), internalSelectedItem && internalSelectedItem.suffixElement && internalSelectedItem.suffixElement)), shouldShowClearIcon && internalSelectedItem && /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxClearIconWrapper, {
|
|
458
315
|
onClick: handleClear
|
|
459
|
-
}, /*#__PURE__*/
|
|
316
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
460
317
|
icons: ['fa fa-times']
|
|
461
|
-
})), !shouldDisableActions && /*#__PURE__*/
|
|
318
|
+
})), !shouldDisableActions && /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxIconWrapper, {
|
|
462
319
|
$shouldShowBorderLeft: shouldShowClearIcon === true && internalSelectedItem !== undefined
|
|
463
|
-
}, /*#__PURE__*/
|
|
320
|
+
}, /*#__PURE__*/_react.default.createElement(_Icon.default, {
|
|
464
321
|
icons: ['fa fa-chevron-down']
|
|
465
|
-
}))),
|
|
322
|
+
}))), styledComboBoxElementRef.current && /*#__PURE__*/_react.default.createElement(_DropdownBodyWrapper.default, {
|
|
323
|
+
anchorElement: styledComboBoxElementRef.current,
|
|
324
|
+
bodyWidth: bodyWidth,
|
|
325
|
+
contentHeight: contentHeight,
|
|
326
|
+
onClose: handleClose,
|
|
327
|
+
direction: direction,
|
|
328
|
+
container: container,
|
|
329
|
+
shouldShowDropdown: isAnimating,
|
|
330
|
+
minBodyWidth: bodyWidth ?? bodyMinWidth,
|
|
331
|
+
maxHeight: maxHeight
|
|
332
|
+
}, /*#__PURE__*/_react.default.createElement(_ComboBox.StyledComboBoxBody, {
|
|
333
|
+
$shouldUseCurrentItemWidth: shouldUseCurrentItemWidth,
|
|
334
|
+
$maxHeight: maxHeight,
|
|
335
|
+
$minWidth: bodyWidth ?? bodyMinWidth,
|
|
336
|
+
$browser: browser === null || browser === void 0 ? void 0 : browser.name,
|
|
337
|
+
ref: contentRef,
|
|
338
|
+
tabIndex: 0
|
|
339
|
+
}, comboBoxGroups))), [minWidth, shouldUseFullWidth, shouldUseCurrentItemWidth, direction, handleHeaderClick, isAnimating, isTouch, isDisabled, shouldChangeColor, shouldShowBigImage, prefix, selectedItem, internalSelectedItem, placeholderImageUrl, shouldShowRoundPlaceholderImage, placeholderIcon, inputValue, onInputChange, handleInputBlur, handleInputFocus, placeholderText, shouldShowClearIcon, handleClear, shouldDisableActions, bodyWidth, contentHeight, handleClose, container, bodyMinWidth, maxHeight, browser === null || browser === void 0 ? void 0 : browser.name, comboBoxGroups]);
|
|
466
340
|
};
|
|
467
341
|
ComboBox.displayName = 'ComboBox';
|
|
468
342
|
var _default = exports.default = ComboBox;
|