@chayns-components/core 5.0.46 → 5.0.48

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 (35) hide show
  1. package/AGENTS.md +60 -0
  2. package/lib/cjs/components/filter/Filter.js +24 -8
  3. package/lib/cjs/components/filter/Filter.js.map +1 -1
  4. package/lib/cjs/components/filter/filter-content/FIlterContent.js +3 -2
  5. package/lib/cjs/components/filter/filter-content/FIlterContent.js.map +1 -1
  6. package/lib/cjs/components/filter/filter-content/FilterContent.styles.js +9 -3
  7. package/lib/cjs/components/filter/filter-content/FilterContent.styles.js.map +1 -1
  8. package/lib/cjs/components/popup/Popup.js +59 -22
  9. package/lib/cjs/components/popup/Popup.js.map +1 -1
  10. package/lib/cjs/components/popup/Popup.types.js +6 -0
  11. package/lib/cjs/components/popup/Popup.types.js.map +1 -0
  12. package/lib/cjs/index.js.map +1 -1
  13. package/lib/cjs/types/filter.js +2 -1
  14. package/lib/cjs/types/filter.js.map +1 -1
  15. package/lib/esm/components/filter/Filter.js +24 -8
  16. package/lib/esm/components/filter/Filter.js.map +1 -1
  17. package/lib/esm/components/filter/filter-content/FIlterContent.js +4 -3
  18. package/lib/esm/components/filter/filter-content/FIlterContent.js.map +1 -1
  19. package/lib/esm/components/filter/filter-content/FilterContent.styles.js +8 -2
  20. package/lib/esm/components/filter/filter-content/FilterContent.styles.js.map +1 -1
  21. package/lib/esm/components/popup/Popup.js +59 -22
  22. package/lib/esm/components/popup/Popup.js.map +1 -1
  23. package/lib/esm/components/popup/Popup.types.js +2 -0
  24. package/lib/esm/components/popup/Popup.types.js.map +1 -0
  25. package/lib/esm/index.js.map +1 -1
  26. package/lib/esm/types/filter.js +2 -1
  27. package/lib/esm/types/filter.js.map +1 -1
  28. package/lib/types/components/filter/Filter.d.ts +2 -1
  29. package/lib/types/components/filter/filter-content/FIlterContent.d.ts +2 -1
  30. package/lib/types/components/filter/filter-content/FilterContent.styles.d.ts +1 -0
  31. package/lib/types/components/popup/Popup.d.ts +4 -56
  32. package/lib/types/components/popup/Popup.types.d.ts +151 -0
  33. package/lib/types/index.d.ts +1 -0
  34. package/lib/types/types/filter.d.ts +6 -1
  35. package/package.json +2 -2
package/AGENTS.md CHANGED
@@ -1698,6 +1698,32 @@ import { Filter } from '@chayns-components/core';
1698
1698
  selectedItem: { text: 'alphanumerisch', id: 'alphanumerisch' },
1699
1699
  onSortChange: () => {},
1700
1700
  }}
1701
+ comboboxConfig={{
1702
+ label: 'Kategorie wählen',
1703
+ placeholder: 'Keine Kategorie gewählt',
1704
+ lists: [
1705
+ {
1706
+ list: [
1707
+ { text: 'Alle Kategorien', value: 'all', icons: ['fa fa-list'] },
1708
+ {
1709
+ text: 'Lebensmittel',
1710
+ value: 'food',
1711
+ icons: ['fa fa-burger'],
1712
+ subtext: 'Frisch & regional',
1713
+ },
1714
+ { text: 'Getränke', value: 'drinks', icons: ['fa fa-bottle-water'] },
1715
+ { text: 'Haushalt', value: 'household', icons: ['fa fa-soap'] },
1716
+ {
1717
+ text: 'Elektronik',
1718
+ value: 'electronics',
1719
+ icons: ['fa fa-bolt'],
1720
+ subtext: 'Smartphones, TV & mehr',
1721
+ },
1722
+ { text: 'Bekleidung', value: 'clothing', icons: ['fa fa-tshirt'] },
1723
+ ],
1724
+ },
1725
+ ],
1726
+ }}
1701
1727
  />
1702
1728
  ```
1703
1729
 
@@ -1782,6 +1808,40 @@ import { Filter } from '@chayns-components/core';
1782
1808
  />
1783
1809
  ```
1784
1810
 
1811
+ #### Only Combobox
1812
+
1813
+ ```tsx
1814
+ <Filter
1815
+ headline={'Combobox'}
1816
+ comboboxConfig={{
1817
+ label: 'Kategorie wählen',
1818
+ placeholder: 'Keine Kategorie gewählt',
1819
+ lists: [
1820
+ {
1821
+ list: [
1822
+ { text: 'Alle Kategorien', value: 'all', icons: ['fa fa-list'] },
1823
+ {
1824
+ text: 'Lebensmittel',
1825
+ value: 'food',
1826
+ icons: ['fa fa-burger'],
1827
+ subtext: 'Frisch & regional',
1828
+ },
1829
+ { text: 'Getränke', value: 'drinks', icons: ['fa fa-bottle-water'] },
1830
+ { text: 'Haushalt', value: 'household', icons: ['fa fa-soap'] },
1831
+ {
1832
+ text: 'Elektronik',
1833
+ value: 'electronics',
1834
+ icons: ['fa fa-bolt'],
1835
+ subtext: 'Smartphones, TV & mehr',
1836
+ },
1837
+ { text: 'Bekleidung', value: 'clothing', icons: ['fa fa-tshirt'] },
1838
+ ],
1839
+ },
1840
+ ],
1841
+ }}
1842
+ />
1843
+ ```
1844
+
1785
1845
  ### Props
1786
1846
 
1787
1847
  No prop documentation available.
@@ -9,6 +9,7 @@ var _Filter = require("./Filter.styles");
9
9
  var _ExpandableContent = _interopRequireDefault(require("../expandable-content/ExpandableContent"));
10
10
  var _Icon = _interopRequireDefault(require("../icon/Icon"));
11
11
  var _FIlterContent = _interopRequireDefault(require("./filter-content/FIlterContent"));
12
+ var _ComboBox = _interopRequireDefault(require("../combobox/ComboBox"));
12
13
  var _filter = require("../../types/filter");
13
14
  var _SearchInput = _interopRequireDefault(require("../search-input/SearchInput"));
14
15
  var _ContextMenu = _interopRequireDefault(require("../context-menu/ContextMenu"));
@@ -25,6 +26,7 @@ const Filter = /*#__PURE__*/(0, _react.forwardRef)(({
25
26
  shouldShowRoundedHoverEffect = false,
26
27
  filterButtonConfig,
27
28
  checkboxConfig,
29
+ comboboxConfig,
28
30
  onActiveChange,
29
31
  rightIcons
30
32
  }, ref) => {
@@ -42,20 +44,23 @@ const Filter = /*#__PURE__*/(0, _react.forwardRef)(({
42
44
  const searchRef = (0, _react.useRef)(null);
43
45
  const contextMenuRef = (0, _react.useRef)(null);
44
46
  const type = (0, _react.useMemo)(() => {
45
- if (filterButtonConfig && !searchConfig && !sortConfig && !checkboxConfig) {
47
+ if (filterButtonConfig && !searchConfig && !sortConfig && !checkboxConfig && !comboboxConfig) {
46
48
  return _filter.FilterType.ONLY_FILTER;
47
49
  }
48
- if (!filterButtonConfig && !searchConfig && sortConfig && !checkboxConfig) {
50
+ if (!filterButtonConfig && !searchConfig && sortConfig && !checkboxConfig && !comboboxConfig) {
49
51
  return _filter.FilterType.ONLY_SORT;
50
52
  }
51
- if (!filterButtonConfig && searchConfig && !sortConfig && !checkboxConfig) {
53
+ if (!filterButtonConfig && searchConfig && !sortConfig && !checkboxConfig && !comboboxConfig) {
52
54
  return _filter.FilterType.ONLY_SEARCH;
53
55
  }
54
- if (!filterButtonConfig && !searchConfig && !sortConfig && checkboxConfig) {
56
+ if (!filterButtonConfig && !searchConfig && !sortConfig && checkboxConfig && !comboboxConfig) {
55
57
  return _filter.FilterType.ONLY_CHECKBOX;
56
58
  }
59
+ if (!filterButtonConfig && !searchConfig && !sortConfig && !checkboxConfig && comboboxConfig) {
60
+ return _filter.FilterType.ONLY_COMBOBOX;
61
+ }
57
62
  return _filter.FilterType.MULTIPLE;
58
- }, [checkboxConfig, filterButtonConfig, searchConfig, sortConfig]);
63
+ }, [checkboxConfig, comboboxConfig, filterButtonConfig, searchConfig, sortConfig]);
59
64
  const icons = (0, _react.useMemo)(() => {
60
65
  switch (type) {
61
66
  case _filter.FilterType.ONLY_FILTER:
@@ -174,6 +179,16 @@ const Filter = /*#__PURE__*/(0, _react.forwardRef)(({
174
179
  })
175
180
  }));
176
181
  }, [sortConfig]);
182
+ const comboboxElement = (0, _react.useMemo)(() => {
183
+ if (!comboboxConfig) {
184
+ return null;
185
+ }
186
+ return (
187
+ /*#__PURE__*/
188
+ // eslint-disable-next-line react/jsx-props-no-spreading
189
+ _react.default.createElement(_ComboBox.default, comboboxConfig)
190
+ );
191
+ }, [comboboxConfig]);
177
192
  return (0, _react.useMemo)(() => /*#__PURE__*/_react.default.createElement(_Filter.StyledFilter, {
178
193
  ref: filterRef
179
194
  }, /*#__PURE__*/_react.default.createElement(_Filter.StyledFilterHead, null, ! /*#__PURE__*/(0, _react.isValidElement)(headline) ? /*#__PURE__*/_react.default.createElement(_Filter.StyledFilterHeadline, {
@@ -205,7 +220,7 @@ const Filter = /*#__PURE__*/(0, _react.forwardRef)(({
205
220
  }, iconElement), type === _filter.FilterType.ONLY_CHECKBOX && checkboxConfig &&
206
221
  /*#__PURE__*/
207
222
  // eslint-disable-next-line react/jsx-props-no-spreading
208
- _react.default.createElement(_Checkbox.default, checkboxConfig)), [_filter.FilterType.MULTIPLE, _filter.FilterType.ONLY_FILTER].includes(type) && /*#__PURE__*/_react.default.createElement(_Filter.StyledFilterContentWrapper, {
223
+ _react.default.createElement(_Checkbox.default, checkboxConfig), type === _filter.FilterType.ONLY_COMBOBOX && comboboxElement), [_filter.FilterType.MULTIPLE, _filter.FilterType.ONLY_FILTER].includes(type) && /*#__PURE__*/_react.default.createElement(_Filter.StyledFilterContentWrapper, {
209
224
  ref: contentRef
210
225
  }, /*#__PURE__*/_react.default.createElement(_ExpandableContent.default, {
211
226
  isOpen: isOpen,
@@ -215,8 +230,9 @@ const Filter = /*#__PURE__*/(0, _react.forwardRef)(({
215
230
  searchConfig: searchConfig,
216
231
  filterButtonConfig: filterButtonConfig,
217
232
  sortConfig: sortConfig,
218
- checkboxConfig: checkboxConfig
219
- })))), [headline, isSearchActive, type, rightIcons, iconElement, backgroundDistance, backgroundElement, searchConfig, sortConfig, sortItems, checkboxConfig, isOpen, shouldFocus, filterButtonConfig, shouldShowRoundedHoverEffect]);
233
+ checkboxConfig: checkboxConfig,
234
+ comboboxConfig: comboboxConfig
235
+ })))), [headline, isSearchActive, type, rightIcons, iconElement, backgroundDistance, backgroundElement, searchConfig, sortConfig, sortItems, checkboxConfig, isOpen, shouldFocus, filterButtonConfig, comboboxConfig, comboboxElement, shouldShowRoundedHoverEffect]);
220
236
  });
221
237
  Filter.displayName = 'Filter';
222
238
  var _default = exports.default = Filter;
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","names":["_react","_interopRequireWildcard","require","_Filter","_ExpandableContent","_interopRequireDefault","_Icon","_FIlterContent","_filter","_SearchInput","_ContextMenu","_Checkbox","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Filter","forwardRef","headline","searchConfig","sortConfig","shouldAutoFocus","shouldShowRoundedHoverEffect","filterButtonConfig","checkboxConfig","onActiveChange","rightIcons","ref","isOpen","setIsOpen","useState","isSearchActive","setIsSearchActive","shouldFocus","setShouldFocus","backgroundDistance","setBackgroundDistance","backgroundCoordinates","setBackgroundCoordinates","top","left","contentRef","useRef","iconRef","filterRef","searchRef","contextMenuRef","type","useMemo","FilterType","ONLY_FILTER","ONLY_SORT","ONLY_SEARCH","ONLY_CHECKBOX","MULTIPLE","icons","useEffect","handleHide","useCallback","current","hide","_searchRef$current","focus","window","setTimeout","handleShow","useImperativeHandle","show","handleIconClick","iconRect","getBoundingClientRect","filterRect","contentRect","relativeTop","bottom","relativeLeft","iconElement","createElement","StyledFilterIcon","onClick","$isOpen","$shouldShowRoundedHoverEffect","size","backgroundElement","StyledMotionFilterBackground","$top","$left","animate","height","transition","duration","delay","sortItems","selectedItem","onSortChange","items","map","id","text","key","toString","isSelected","StyledFilter","StyledFilterHead","isValidElement","StyledFilterHeadline","$isSearchActive","StyledFilterHeadlineElement","includes","Fragment","StyledFilterIconWrapper","rIcons","StyledFilterSearch","isActive","value","searchValue","onChange","ev","onSearchChange","target","StyledFilterContentWrapper","startDelay","displayName","_default","exports"],"sources":["../../../../src/components/filter/Filter.tsx"],"sourcesContent":["import React, {\n forwardRef,\n isValidElement,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n StyledFilter,\n StyledFilterContentWrapper,\n StyledFilterHead,\n StyledFilterHeadline,\n StyledFilterHeadlineElement,\n StyledFilterIcon,\n StyledFilterIconWrapper,\n StyledFilterSearch,\n StyledMotionFilterBackground,\n} from './Filter.styles';\nimport ExpandableContent from '../expandable-content/ExpandableContent';\nimport Icon from '../icon/Icon';\nimport FilterContent from './filter-content/FIlterContent';\nimport {\n CheckboxConfig,\n FilterButtonConfig,\n FilterRef,\n FilterType,\n SearchConfig,\n SortConfig,\n} from '../../types/filter';\nimport SearchInput from '../search-input/SearchInput';\nimport ContextMenu from '../context-menu/ContextMenu';\nimport Checkbox from '../checkbox/Checkbox';\nimport { InputRef } from '../input/Input';\nimport type { ContextMenuItem, ContextMenuRef } from '../context-menu/ContextMenu.types';\n\nexport interface FilterRightIcon {\n icons: string[];\n onClick: VoidFunction;\n}\n\n//\nexport type FilterProps = {\n headline: ReactNode;\n searchConfig?: SearchConfig;\n filterButtonConfig?: FilterButtonConfig;\n sortConfig?: SortConfig;\n checkboxConfig?: CheckboxConfig;\n onActiveChange?: (isActive: boolean) => void;\n shouldShowRoundedHoverEffect?: boolean;\n rightIcons?: FilterRightIcon[];\n shouldAutoFocus?: boolean;\n};\n\nconst Filter = forwardRef<FilterRef, FilterProps>(\n (\n {\n headline,\n searchConfig,\n sortConfig,\n shouldAutoFocus = false,\n shouldShowRoundedHoverEffect = false,\n filterButtonConfig,\n checkboxConfig,\n onActiveChange,\n rightIcons,\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const [isSearchActive, setIsSearchActive] = useState(false);\n const [shouldFocus, setShouldFocus] = useState(false);\n const [backgroundDistance, setBackgroundDistance] = useState(0);\n const [backgroundCoordinates, setBackgroundCoordinates] = useState({ top: 0, left: 0 });\n\n const contentRef = useRef<HTMLDivElement | null>(null);\n const iconRef = useRef<HTMLDivElement | null>(null);\n const filterRef = useRef<HTMLDivElement | null>(null);\n const searchRef = useRef<InputRef | null>(null);\n\n const contextMenuRef = useRef<ContextMenuRef>(null);\n\n const type = useMemo(() => {\n if (filterButtonConfig && !searchConfig && !sortConfig && !checkboxConfig) {\n return FilterType.ONLY_FILTER;\n }\n\n if (!filterButtonConfig && !searchConfig && sortConfig && !checkboxConfig) {\n return FilterType.ONLY_SORT;\n }\n\n if (!filterButtonConfig && searchConfig && !sortConfig && !checkboxConfig) {\n return FilterType.ONLY_SEARCH;\n }\n\n if (!filterButtonConfig && !searchConfig && !sortConfig && checkboxConfig) {\n return FilterType.ONLY_CHECKBOX;\n }\n\n return FilterType.MULTIPLE;\n }, [checkboxConfig, filterButtonConfig, searchConfig, sortConfig]);\n\n const icons = useMemo(() => {\n switch (type) {\n case FilterType.ONLY_FILTER:\n return ['fa fa-filter'];\n case FilterType.ONLY_SORT:\n return ['fa fa-arrow-up-arrow-down'];\n default:\n return ['fa fa-search'];\n }\n }, [type]);\n\n useEffect(() => {\n if (typeof onActiveChange === 'function') {\n onActiveChange(isOpen);\n }\n }, [isOpen, onActiveChange]);\n\n const handleHide = useCallback(() => {\n setIsOpen(false);\n\n if (type === FilterType.ONLY_SORT && contextMenuRef.current) {\n contextMenuRef.current.hide();\n }\n\n if (type === FilterType.ONLY_SEARCH) {\n setIsSearchActive(false);\n }\n }, [type]);\n\n useEffect(() => {\n if (shouldFocus) {\n searchRef.current?.focus();\n\n window.setTimeout(() => {\n setShouldFocus(false);\n }, 200);\n }\n }, [shouldFocus]);\n\n const handleShow = useCallback(() => {\n setIsOpen(true);\n\n if (shouldAutoFocus) {\n setShouldFocus(true);\n }\n\n if (type === FilterType.ONLY_SORT && contextMenuRef.current) {\n contextMenuRef.current.hide();\n }\n\n if (type === FilterType.ONLY_SEARCH) {\n setIsSearchActive(true);\n }\n }, [shouldAutoFocus, type]);\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n const handleIconClick = useCallback(() => {\n if (isOpen) {\n handleHide();\n } else {\n handleShow();\n }\n }, [handleHide, handleShow, isOpen]);\n\n useEffect(() => {\n if (headline && iconRef.current && contentRef.current && filterRef.current) {\n const iconRect = iconRef.current.getBoundingClientRect();\n const filterRect = filterRef.current.getBoundingClientRect();\n const contentRect = contentRef.current.getBoundingClientRect();\n\n const relativeTop = iconRect.bottom - filterRect.top;\n const relativeLeft = iconRect.left - filterRect.left;\n\n setBackgroundDistance(contentRect.top - iconRect.bottom);\n setBackgroundCoordinates({\n top: relativeTop,\n left: relativeLeft,\n });\n } else {\n setBackgroundDistance(0);\n setBackgroundCoordinates({ top: 0, left: 0 });\n }\n }, [headline]);\n\n const iconElement = useMemo(\n () => (\n <StyledFilterIcon\n onClick={handleIconClick}\n $isOpen={isOpen}\n ref={iconRef}\n $shouldShowRoundedHoverEffect={shouldShowRoundedHoverEffect}\n >\n <Icon icons={icons} size={18} />\n </StyledFilterIcon>\n ),\n [handleIconClick, icons, isOpen, shouldShowRoundedHoverEffect],\n );\n\n const backgroundElement = useMemo(\n () => (\n <StyledMotionFilterBackground\n $top={backgroundCoordinates.top}\n $left={backgroundCoordinates.left}\n animate={{ height: isOpen ? `${backgroundDistance}px` : 0 }}\n transition={{ duration: 0.1, delay: isOpen ? 0 : 0.2 }}\n />\n ),\n [backgroundDistance, isOpen, backgroundCoordinates],\n );\n\n const sortItems: ContextMenuItem[] = useMemo(() => {\n if (!sortConfig) {\n return [];\n }\n\n const { selectedItem, onSortChange } = sortConfig;\n\n return sortConfig.items.map(({ id, text }) => ({\n text,\n key: id.toString(),\n isSelected: id === selectedItem.id,\n icons: id === selectedItem.id ? ['fas fa-circle-small'] : [],\n onClick: () => onSortChange({ text, id }),\n }));\n }, [sortConfig]);\n\n return useMemo(\n () => (\n <StyledFilter ref={filterRef}>\n <StyledFilterHead>\n {!isValidElement(headline) ? (\n <StyledFilterHeadline $isSearchActive={isSearchActive}>\n {headline}\n </StyledFilterHeadline>\n ) : (\n <StyledFilterHeadlineElement $isSearchActive={isSearchActive}>\n {headline}\n </StyledFilterHeadlineElement>\n )}\n {[FilterType.MULTIPLE, FilterType.ONLY_FILTER].includes(type) && (\n <>\n <StyledFilterIconWrapper>\n {rightIcons &&\n rightIcons.map(({ icons: rIcons, onClick }) => (\n <StyledFilterIcon\n onClick={onClick}\n $isOpen={false}\n $shouldShowRoundedHoverEffect={\n shouldShowRoundedHoverEffect\n }\n >\n <Icon icons={rIcons} size={18} />\n </StyledFilterIcon>\n ))}\n {iconElement}\n </StyledFilterIconWrapper>\n {backgroundDistance > 0 && backgroundElement}\n </>\n )}\n {type === FilterType.ONLY_SEARCH && searchConfig && (\n <StyledFilterSearch>\n <SearchInput\n onActiveChange={(isActive) => {\n setIsSearchActive(isActive);\n setIsOpen(isActive);\n }}\n ref={searchRef}\n isActive={isSearchActive}\n value={searchConfig.searchValue}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n />\n </StyledFilterSearch>\n )}\n {type === FilterType.ONLY_SORT && sortConfig && (\n <ContextMenu ref={contextMenuRef} items={sortItems}>\n {iconElement}\n </ContextMenu>\n )}\n {type === FilterType.ONLY_CHECKBOX && checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n </StyledFilterHead>\n {[FilterType.MULTIPLE, FilterType.ONLY_FILTER].includes(type) && (\n <StyledFilterContentWrapper ref={contentRef}>\n <ExpandableContent\n isOpen={isOpen}\n startDelay={backgroundDistance > 0 ? 0.1 : 0}\n >\n <FilterContent\n shouldAutoFocus={shouldFocus}\n searchConfig={searchConfig}\n filterButtonConfig={filterButtonConfig}\n sortConfig={sortConfig}\n checkboxConfig={checkboxConfig}\n />\n </ExpandableContent>\n </StyledFilterContentWrapper>\n )}\n </StyledFilter>\n ),\n [\n headline,\n isSearchActive,\n type,\n rightIcons,\n iconElement,\n backgroundDistance,\n backgroundElement,\n searchConfig,\n sortConfig,\n sortItems,\n checkboxConfig,\n isOpen,\n shouldFocus,\n filterButtonConfig,\n shouldShowRoundedHoverEffect,\n ],\n );\n },\n);\n\nFilter.displayName = 'Filter';\n\nexport default Filter;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,OAAA,GAAAD,OAAA;AAWA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,c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a;IACVsB,eAAe,EAAEY,WAAY;IAC7Bd,YAAY,EAAEA,YAAa;IAC3BI,kBAAkB,EAAEA,kBAAmB;IACvCH,UAAU,EAAEA,UAAW;IACvBI,cAAc,EAAEA;EAAe,CAClC,CACc,CACK,CAEtB,CACjB,EACD,CACIN,QAAQ,EACRa,cAAc,EACdgB,IAAI,EACJrB,UAAU,EACVkD,WAAW,EACXzC,kBAAkB,EAClBgD,iBAAiB,EACjBhE,YAAY,EACZC,UAAU,EACVwE,SAAS,EACTpE,cAAc,EACdI,MAAM,EACNK,WAAW,EACXV,kBAAkB,EAClBD,4BAA4B,CAEpC,CAAC;AACL,CACJ,CAAC;AAEDN,MAAM,CAAC0G,WAAW,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA7H,OAAA,GAEfiB,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Filter.js","names":["_react","_interopRequireWildcard","require","_Filter","_ExpandableContent","_interopRequireDefault","_Icon","_FIlterContent","_ComboBox","_filter","_SearchInput","_ContextMenu","_Checkbox","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Filter","forwardRef","headline","searchConfig","sortConfig","shouldAutoFocus","shouldShowRoundedHoverEffect","filterButtonConfig","checkboxConfig","comboboxConfig","onActiveChange","rightIcons","ref","isOpen","setIsOpen","useState","isSearchActive","setIsSearchActive","shouldFocus","setShouldFocus","backgroundDistance","setBackgroundDistance","backgroundCoordinates","setBackgroundCoordinates","top","left","contentRef","useRef","iconRef","filterRef","searchRef","contextMenuRef","type","useMemo","FilterType","ONLY_FILTER","ONLY_SORT","ONLY_SEARCH","ONLY_CHECKBOX","ONLY_COMBOBOX","MULTIPLE","icons","useEffect","handleHide","useCallback","current","hide","_searchRef$current","focus","window","setTimeout","handleShow","useImperativeHandle","show","handleIconClick","iconRect","getBoundingClientRect","filterRect","contentRect","relativeTop","bottom","relativeLeft","iconElement","createElement","StyledFilterIcon","onClick","$isOpen","$shouldShowRoundedHoverEffect","size","backgroundElement","StyledMotionFilterBackground","$top","$left","animate","height","transition","duration","delay","sortItems","selectedItem","onSortChange","items","map","id","text","key","toString","isSelected","comboboxElement","StyledFilter","StyledFilterHead","isValidElement","StyledFilterHeadline","$isSearchActive","StyledFilterHeadlineElement","includes","Fragment","StyledFilterIconWrapper","rIcons","StyledFilterSearch","isActive","value","searchValue","onChange","ev","onSearchChange","target","StyledFilterContentWrapper","startDelay","displayName","_default","exports"],"sources":["../../../../src/components/filter/Filter.tsx"],"sourcesContent":["import React, {\n forwardRef,\n isValidElement,\n ReactNode,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n StyledFilter,\n StyledFilterContentWrapper,\n StyledFilterHead,\n StyledFilterHeadline,\n StyledFilterHeadlineElement,\n StyledFilterIcon,\n StyledFilterIconWrapper,\n StyledFilterSearch,\n StyledMotionFilterBackground,\n} from './Filter.styles';\nimport ExpandableContent from '../expandable-content/ExpandableContent';\nimport Icon from '../icon/Icon';\nimport FilterContent from './filter-content/FIlterContent';\nimport ComboBox from '../combobox/ComboBox';\nimport {\n CheckboxConfig,\n ComboboxConfig,\n FilterButtonConfig,\n FilterRef,\n FilterType,\n SearchConfig,\n SortConfig,\n} from '../../types/filter';\nimport SearchInput from '../search-input/SearchInput';\nimport ContextMenu from '../context-menu/ContextMenu';\nimport Checkbox from '../checkbox/Checkbox';\nimport { InputRef } from '../input/Input';\nimport type { ContextMenuItem, ContextMenuRef } from '../context-menu/ContextMenu.types';\n\nexport interface FilterRightIcon {\n icons: string[];\n onClick: VoidFunction;\n}\n\n//\nexport type FilterProps = {\n headline: ReactNode;\n searchConfig?: SearchConfig;\n filterButtonConfig?: FilterButtonConfig;\n sortConfig?: SortConfig;\n checkboxConfig?: CheckboxConfig;\n comboboxConfig?: ComboboxConfig;\n onActiveChange?: (isActive: boolean) => void;\n shouldShowRoundedHoverEffect?: boolean;\n rightIcons?: FilterRightIcon[];\n shouldAutoFocus?: boolean;\n};\n\nconst Filter = forwardRef<FilterRef, FilterProps>(\n (\n {\n headline,\n searchConfig,\n sortConfig,\n shouldAutoFocus = false,\n shouldShowRoundedHoverEffect = false,\n filterButtonConfig,\n checkboxConfig,\n comboboxConfig,\n onActiveChange,\n rightIcons,\n },\n ref,\n ) => {\n const [isOpen, setIsOpen] = useState(false);\n const [isSearchActive, setIsSearchActive] = useState(false);\n const [shouldFocus, setShouldFocus] = useState(false);\n const [backgroundDistance, setBackgroundDistance] = useState(0);\n const [backgroundCoordinates, setBackgroundCoordinates] = useState({ top: 0, left: 0 });\n\n const contentRef = useRef<HTMLDivElement | null>(null);\n const iconRef = useRef<HTMLDivElement | null>(null);\n const filterRef = useRef<HTMLDivElement | null>(null);\n const searchRef = useRef<InputRef | null>(null);\n\n const contextMenuRef = useRef<ContextMenuRef>(null);\n\n const type = useMemo(() => {\n if (\n filterButtonConfig &&\n !searchConfig &&\n !sortConfig &&\n !checkboxConfig &&\n !comboboxConfig\n ) {\n return FilterType.ONLY_FILTER;\n }\n\n if (\n !filterButtonConfig &&\n !searchConfig &&\n sortConfig &&\n !checkboxConfig &&\n !comboboxConfig\n ) {\n return FilterType.ONLY_SORT;\n }\n\n if (\n !filterButtonConfig &&\n searchConfig &&\n !sortConfig &&\n !checkboxConfig &&\n !comboboxConfig\n ) {\n return FilterType.ONLY_SEARCH;\n }\n\n if (\n !filterButtonConfig &&\n !searchConfig &&\n !sortConfig &&\n checkboxConfig &&\n !comboboxConfig\n ) {\n return FilterType.ONLY_CHECKBOX;\n }\n\n if (\n !filterButtonConfig &&\n !searchConfig &&\n !sortConfig &&\n !checkboxConfig &&\n comboboxConfig\n ) {\n return FilterType.ONLY_COMBOBOX;\n }\n\n return FilterType.MULTIPLE;\n }, [checkboxConfig, comboboxConfig, filterButtonConfig, searchConfig, sortConfig]);\n\n const icons = useMemo(() => {\n switch (type) {\n case FilterType.ONLY_FILTER:\n return ['fa fa-filter'];\n case FilterType.ONLY_SORT:\n return ['fa fa-arrow-up-arrow-down'];\n default:\n return ['fa fa-search'];\n }\n }, [type]);\n\n useEffect(() => {\n if (typeof onActiveChange === 'function') {\n onActiveChange(isOpen);\n }\n }, [isOpen, onActiveChange]);\n\n const handleHide = useCallback(() => {\n setIsOpen(false);\n\n if (type === FilterType.ONLY_SORT && contextMenuRef.current) {\n contextMenuRef.current.hide();\n }\n\n if (type === FilterType.ONLY_SEARCH) {\n setIsSearchActive(false);\n }\n }, [type]);\n\n useEffect(() => {\n if (shouldFocus) {\n searchRef.current?.focus();\n\n window.setTimeout(() => {\n setShouldFocus(false);\n }, 200);\n }\n }, [shouldFocus]);\n\n const handleShow = useCallback(() => {\n setIsOpen(true);\n\n if (shouldAutoFocus) {\n setShouldFocus(true);\n }\n\n if (type === FilterType.ONLY_SORT && contextMenuRef.current) {\n contextMenuRef.current.hide();\n }\n\n if (type === FilterType.ONLY_SEARCH) {\n setIsSearchActive(true);\n }\n }, [shouldAutoFocus, type]);\n\n useImperativeHandle(\n ref,\n () => ({\n hide: handleHide,\n show: handleShow,\n }),\n [handleHide, handleShow],\n );\n\n const handleIconClick = useCallback(() => {\n if (isOpen) {\n handleHide();\n } else {\n handleShow();\n }\n }, [handleHide, handleShow, isOpen]);\n\n useEffect(() => {\n if (headline && iconRef.current && contentRef.current && filterRef.current) {\n const iconRect = iconRef.current.getBoundingClientRect();\n const filterRect = filterRef.current.getBoundingClientRect();\n const contentRect = contentRef.current.getBoundingClientRect();\n\n const relativeTop = iconRect.bottom - filterRect.top;\n const relativeLeft = iconRect.left - filterRect.left;\n\n setBackgroundDistance(contentRect.top - iconRect.bottom);\n setBackgroundCoordinates({\n top: relativeTop,\n left: relativeLeft,\n });\n } else {\n setBackgroundDistance(0);\n setBackgroundCoordinates({ top: 0, left: 0 });\n }\n }, [headline]);\n\n const iconElement = useMemo(\n () => (\n <StyledFilterIcon\n onClick={handleIconClick}\n $isOpen={isOpen}\n ref={iconRef}\n $shouldShowRoundedHoverEffect={shouldShowRoundedHoverEffect}\n >\n <Icon icons={icons} size={18} />\n </StyledFilterIcon>\n ),\n [handleIconClick, icons, isOpen, shouldShowRoundedHoverEffect],\n );\n\n const backgroundElement = useMemo(\n () => (\n <StyledMotionFilterBackground\n $top={backgroundCoordinates.top}\n $left={backgroundCoordinates.left}\n animate={{ height: isOpen ? `${backgroundDistance}px` : 0 }}\n transition={{ duration: 0.1, delay: isOpen ? 0 : 0.2 }}\n />\n ),\n [backgroundDistance, isOpen, backgroundCoordinates],\n );\n\n const sortItems: ContextMenuItem[] = useMemo(() => {\n if (!sortConfig) {\n return [];\n }\n\n const { selectedItem, onSortChange } = sortConfig;\n\n return sortConfig.items.map(({ id, text }) => ({\n text,\n key: id.toString(),\n isSelected: id === selectedItem.id,\n icons: id === selectedItem.id ? ['fas fa-circle-small'] : [],\n onClick: () => onSortChange({ text, id }),\n }));\n }, [sortConfig]);\n\n const comboboxElement = useMemo(() => {\n if (!comboboxConfig) {\n return null;\n }\n\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <ComboBox {...comboboxConfig} />\n );\n }, [comboboxConfig]);\n\n return useMemo(\n () => (\n <StyledFilter ref={filterRef}>\n <StyledFilterHead>\n {!isValidElement(headline) ? (\n <StyledFilterHeadline $isSearchActive={isSearchActive}>\n {headline}\n </StyledFilterHeadline>\n ) : (\n <StyledFilterHeadlineElement $isSearchActive={isSearchActive}>\n {headline}\n </StyledFilterHeadlineElement>\n )}\n {[FilterType.MULTIPLE, FilterType.ONLY_FILTER].includes(type) && (\n <>\n <StyledFilterIconWrapper>\n {rightIcons &&\n rightIcons.map(({ icons: rIcons, onClick }) => (\n <StyledFilterIcon\n onClick={onClick}\n $isOpen={false}\n $shouldShowRoundedHoverEffect={\n shouldShowRoundedHoverEffect\n }\n >\n <Icon icons={rIcons} size={18} />\n </StyledFilterIcon>\n ))}\n {iconElement}\n </StyledFilterIconWrapper>\n {backgroundDistance > 0 && backgroundElement}\n </>\n )}\n {type === FilterType.ONLY_SEARCH && searchConfig && (\n <StyledFilterSearch>\n <SearchInput\n onActiveChange={(isActive) => {\n setIsSearchActive(isActive);\n setIsOpen(isActive);\n }}\n ref={searchRef}\n isActive={isSearchActive}\n value={searchConfig.searchValue}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n />\n </StyledFilterSearch>\n )}\n {type === FilterType.ONLY_SORT && sortConfig && (\n <ContextMenu ref={contextMenuRef} items={sortItems}>\n {iconElement}\n </ContextMenu>\n )}\n {type === FilterType.ONLY_CHECKBOX && checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n {type === FilterType.ONLY_COMBOBOX && comboboxElement}\n </StyledFilterHead>\n {[FilterType.MULTIPLE, FilterType.ONLY_FILTER].includes(type) && (\n <StyledFilterContentWrapper ref={contentRef}>\n <ExpandableContent\n isOpen={isOpen}\n startDelay={backgroundDistance > 0 ? 0.1 : 0}\n >\n <FilterContent\n shouldAutoFocus={shouldFocus}\n searchConfig={searchConfig}\n filterButtonConfig={filterButtonConfig}\n sortConfig={sortConfig}\n checkboxConfig={checkboxConfig}\n comboboxConfig={comboboxConfig}\n />\n </ExpandableContent>\n </StyledFilterContentWrapper>\n )}\n </StyledFilter>\n ),\n [\n headline,\n isSearchActive,\n type,\n rightIcons,\n iconElement,\n backgroundDistance,\n backgroundElement,\n searchConfig,\n sortConfig,\n sortItems,\n checkboxConfig,\n isOpen,\n shouldFocus,\n filterButtonConfig,\n comboboxConfig,\n comboboxElement,\n shouldShowRoundedHoverEffect,\n ],\n );\n },\n);\n\nFilter.displayName = 'Filter';\n\nexport default Filter;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,OAAA,GAAAD,OAAA;AAWA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,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
20
  checkboxConfig,
21
+ comboboxConfig,
21
22
  shouldAutoFocus
22
23
  }) => {
23
24
  const sortTextRef = (0, _react.useRef)(null);
@@ -78,10 +79,10 @@ const FilterContent = ({
78
79
  value: sortConfig.selectedItem.id
79
80
  },
80
81
  onSelect: handleSelectSortItem
81
- }))), checkboxConfig &&
82
+ }))), comboboxConfig && /*#__PURE__*/_react.default.createElement(_FilterContent.StyledFilterComboboxInline, null, comboboxConfig.label, /*#__PURE__*/_react.default.createElement(_ComboBox.default, comboboxConfig)), checkboxConfig &&
82
83
  /*#__PURE__*/
83
84
  // eslint-disable-next-line react/jsx-props-no-spreading
84
- _react.default.createElement(_Checkbox.default, checkboxConfig)), [checkboxConfig, filterButtonConfig, handleSelectSortItem, searchConfig, sortConfig, sortTextWidth]);
85
+ _react.default.createElement(_Checkbox.default, checkboxConfig)), [checkboxConfig, comboboxConfig, filterButtonConfig, handleSelectSortItem, searchConfig, sortConfig, sortTextWidth]);
85
86
  };
86
87
  FilterContent.displayName = 'FilterContent';
87
88
  var _default = exports.default = FilterContent;
@@ -1 +1 @@
1
- {"version":3,"file":"FIlterContent.js","names":["_react","_interopRequireWildcard","require","_FilterContent","_Input","_interopRequireDefault","_Icon","_FilterButtons","_ComboBox","_Checkbox","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","shouldAutoFocus","sortTextRef","useRef","searchRef","sortTextWidth","setSortTextWidth","useState","handleSelectSortItem","useCallback","item","text","value","onSortChange","id","useEffect","current","clientWidth","_searchRef$current","focus","useMemo","createElement","StyledFilterContent","ref","onChange","ev","onSearchChange","target","placeholder","searchValue","shouldShowClearIcon","length","leftElement","icons","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","lists","list","items","map","selectedItem","onSelect","displayName","_default","exports"],"sources":["../../../../../src/components/filter/filter-content/FIlterContent.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledFilterComboboxWrapper,\n StyledFilterContent,\n StyledFilterSort,\n StyledFilterSortText,\n} from './FilterContent.styles';\nimport Input, { InputRef } from '../../input/Input';\nimport Icon from '../../icon/Icon';\nimport FilterButtons from '../../filter-buttons/FilterButtons';\nimport {\n CheckboxConfig,\n FilterButtonConfig,\n SearchConfig,\n SortConfig,\n} from '../../../types/filter';\nimport ComboBox from '../../combobox/ComboBox';\nimport Checkbox from '../../checkbox/Checkbox';\nimport { IComboBoxItem } from '../../combobox/ComboBox.types';\n\nexport type FilterContentProps = {\n searchConfig?: SearchConfig;\n filterButtonConfig?: FilterButtonConfig;\n sortConfig?: SortConfig;\n checkboxConfig?: CheckboxConfig;\n shouldAutoFocus: boolean;\n};\n\nconst FilterContent: FC<FilterContentProps> = ({\n searchConfig,\n sortConfig,\n filterButtonConfig,\n checkboxConfig,\n shouldAutoFocus,\n}) => {\n const sortTextRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<InputRef>(null);\n\n const [sortTextWidth, setSortTextWidth] = useState(0);\n\n const handleSelectSortItem = useCallback(\n (item: IComboBoxItem | undefined) => {\n if (!item) {\n return;\n }\n\n const { text, value } = item;\n\n if (sortConfig) {\n sortConfig.onSortChange({ text, id: value });\n }\n },\n [sortConfig],\n );\n\n useEffect(() => {\n if (sortTextRef.current) {\n setSortTextWidth(sortTextRef.current.clientWidth + 20);\n }\n }, []);\n\n useEffect(() => {\n if (shouldAutoFocus) {\n searchRef.current?.focus();\n }\n }, [shouldAutoFocus]);\n\n return useMemo(\n () => (\n <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder=\"Suche\"\n value={searchConfig.searchValue}\n shouldShowClearIcon={searchConfig.searchValue.length > 0}\n leftElement={<Icon icons={['fa fa-search']} />}\n />\n )}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {filterButtonConfig && <FilterButtons {...filterButtonConfig} />}\n {sortConfig && (\n <StyledFilterSort>\n <StyledFilterSortText ref={sortTextRef}>Sortierung</StyledFilterSortText>\n <StyledFilterComboboxWrapper $textWidth={sortTextWidth}>\n <ComboBox\n lists={[\n {\n list: sortConfig.items.map(({ text, id }) => ({\n text,\n value: id,\n })),\n },\n ]}\n placeholder=\"\"\n selectedItem={{\n text: sortConfig.selectedItem.text,\n value: sortConfig.selectedItem.id,\n }}\n onSelect={handleSelectSortItem}\n />\n </StyledFilterComboboxWrapper>\n </StyledFilterSort>\n )}\n {checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n </StyledFilterContent>\n ),\n [\n checkboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n sortConfig,\n sortTextWidth,\n ],\n );\n};\n\nFilterContent.displayName = 'FilterContent';\n\nexport default FilterContent;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,cAAA,GAAAF,sBAAA,CAAAH,OAAA;AAOA,IAAAM,SAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,SAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAA+C,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAb,uBAAA,YAAAA,CAAAS,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC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EAAKoB,kBAAqB,CAAC,EAC/DD,UAAU,iBACP/B,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAACnD,cAAA,CAAAgE,gBAAgB,qBACbnE,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAACnD,cAAA,CAAAiE,oBAAoB;IAACZ,GAAG,EAAErB;EAAY,GAAC,YAAgC,CAAC,eACzEnC,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAACnD,cAAA,CAAAkE,2BAA2B;IAACC,UAAU,EAAEhC;EAAc,gBACnDtC,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAAC9C,SAAA,CAAAI,OAAQ;IACL2D,KAAK,EAAE,CACH;MACIC,IAAI,EAAEzC,UAAU,CAAC0C,KAAK,CAACC,GAAG,CAAC,CAAC;QAAE9B,IAAI;QAAEG;MAAG,CAAC,MAAM;QAC1CH,IAAI;QACJC,KAAK,EAAEE;MACX,CAAC,CAAC;IACN,CAAC,CACH;IACFc,WAAW,EAAC,EAAE;IACdc,YAAY,EAAE;MACV/B,IAAI,EAAEb,UAAU,CAAC4C,YAAY,CAAC/B,IAAI;MAClCC,KAAK,EAAEd,UAAU,CAAC4C,YAAY,CAAC5B;IACnC,CAAE;IACF6B,QAAQ,EAAEnC;EAAqB,CAClC,CACwB,CACf,CACrB,EACAR,cAAc;EAAA;EACX;EACAjC,MAAA,CAAAY,OAAA,CAAA0C,aAAA,CAAC7C,SAAA,CAAAG,OAAQ,EAAKqB,cAAiB,CAElB,CACxB,EACD,CACIA,cAAc,EACdD,kBAAkB,EAClBS,oBAAoB,EACpBX,YAAY,EACZC,UAAU,EACVO,aAAa,CAErB,CAAC;AACL,CAAC;AAEDT,aAAa,CAACgD,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnE,OAAA,GAE7BiB,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"FIlterContent.js","names":["_react","_interopRequireWildcard","require","_FilterContent","_Input","_interopRequireDefault","_Icon","_FilterButtons","_ComboBox","_Checkbox","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FilterContent","searchConfig","sortConfig","filterButtonConfig","checkboxConfig","comboboxConfig","shouldAutoFocus","sortTextRef","useRef","searchRef","sortTextWidth","setSortTextWidth","useState","handleSelectSortItem","useCallback","item","text","value","onSortChange","id","useEffect","current","clientWidth","_searchRef$current","focus","useMemo","createElement","StyledFilterContent","ref","onChange","ev","onSearchChange","target","placeholder","searchValue","shouldShowClearIcon","length","leftElement","icons","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","lists","list","items","map","selectedItem","onSelect","StyledFilterComboboxInline","label","displayName","_default","exports"],"sources":["../../../../../src/components/filter/filter-content/FIlterContent.tsx"],"sourcesContent":["import React, { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledFilterComboboxInline,\n StyledFilterComboboxWrapper,\n StyledFilterContent,\n StyledFilterSort,\n StyledFilterSortText,\n} from './FilterContent.styles';\nimport Input, { InputRef } from '../../input/Input';\nimport Icon from '../../icon/Icon';\nimport FilterButtons from '../../filter-buttons/FilterButtons';\nimport {\n CheckboxConfig,\n ComboboxConfig,\n FilterButtonConfig,\n SearchConfig,\n SortConfig,\n} from '../../../types/filter';\nimport ComboBox from '../../combobox/ComboBox';\nimport Checkbox from '../../checkbox/Checkbox';\nimport { IComboBoxItem } from '../../combobox/ComboBox.types';\n\nexport type FilterContentProps = {\n searchConfig?: SearchConfig;\n filterButtonConfig?: FilterButtonConfig;\n sortConfig?: SortConfig;\n checkboxConfig?: CheckboxConfig;\n comboboxConfig?: ComboboxConfig;\n shouldAutoFocus: boolean;\n};\n\nconst FilterContent: FC<FilterContentProps> = ({\n searchConfig,\n sortConfig,\n filterButtonConfig,\n checkboxConfig,\n comboboxConfig,\n shouldAutoFocus,\n}) => {\n const sortTextRef = useRef<HTMLDivElement>(null);\n const searchRef = useRef<InputRef>(null);\n\n const [sortTextWidth, setSortTextWidth] = useState(0);\n\n const handleSelectSortItem = useCallback(\n (item: IComboBoxItem | undefined) => {\n if (!item) {\n return;\n }\n\n const { text, value } = item;\n\n if (sortConfig) {\n sortConfig.onSortChange({ text, id: value });\n }\n },\n [sortConfig],\n );\n\n useEffect(() => {\n if (sortTextRef.current) {\n setSortTextWidth(sortTextRef.current.clientWidth + 20);\n }\n }, []);\n\n useEffect(() => {\n if (shouldAutoFocus) {\n searchRef.current?.focus();\n }\n }, [shouldAutoFocus]);\n\n return useMemo(\n () => (\n <StyledFilterContent>\n {searchConfig && (\n <Input\n ref={searchRef}\n onChange={(ev) => searchConfig.onSearchChange(ev.target.value)}\n placeholder=\"Suche\"\n value={searchConfig.searchValue}\n shouldShowClearIcon={searchConfig.searchValue.length > 0}\n leftElement={<Icon icons={['fa fa-search']} />}\n />\n )}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {filterButtonConfig && <FilterButtons {...filterButtonConfig} />}\n {sortConfig && (\n <StyledFilterSort>\n <StyledFilterSortText ref={sortTextRef}>Sortierung</StyledFilterSortText>\n <StyledFilterComboboxWrapper $textWidth={sortTextWidth}>\n <ComboBox\n lists={[\n {\n list: sortConfig.items.map(({ text, id }) => ({\n text,\n value: id,\n })),\n },\n ]}\n placeholder=\"\"\n selectedItem={{\n text: sortConfig.selectedItem.text,\n value: sortConfig.selectedItem.id,\n }}\n onSelect={handleSelectSortItem}\n />\n </StyledFilterComboboxWrapper>\n </StyledFilterSort>\n )}\n {comboboxConfig && (\n <StyledFilterComboboxInline>\n {comboboxConfig.label}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <ComboBox {...comboboxConfig} />\n </StyledFilterComboboxInline>\n )}\n {checkboxConfig && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <Checkbox {...checkboxConfig} />\n )}\n </StyledFilterContent>\n ),\n [\n checkboxConfig,\n comboboxConfig,\n filterButtonConfig,\n handleSelectSortItem,\n searchConfig,\n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AG,CAAC,MAAM;QAC1CH,IAAI;QACJC,KAAK,EAAEE;MACX,CAAC,CAAC;IACN,CAAC,CACH;IACFc,WAAW,EAAC,EAAE;IACdc,YAAY,EAAE;MACV/B,IAAI,EAAEd,UAAU,CAAC6C,YAAY,CAAC/B,IAAI;MAClCC,KAAK,EAAEf,UAAU,CAAC6C,YAAY,CAAC5B;IACnC,CAAE;IACF6B,QAAQ,EAAEnC;EAAqB,CAClC,CACwB,CACf,CACrB,EACAR,cAAc,iBACXlC,MAAA,CAAAY,OAAA,CAAA2C,aAAA,CAACpD,cAAA,CAAA2E,0BAA0B,QACtB5C,cAAc,CAAC6C,KAAK,eAErB/E,MAAA,CAAAY,OAAA,CAAA2C,aAAA,CAAC/C,SAAA,CAAAI,OAAQ,EAAKsB,cAAiB,CACP,CAC/B,EACAD,cAAc;EAAA;EACX;EACAjC,MAAA,CAAAY,OAAA,CAAA2C,aAAA,CAAC9C,SAAA,CAAAG,OAAQ,EAAKqB,cAAiB,CAElB,CACxB,EACD,CACIA,cAAc,EACdC,cAAc,EACdF,kBAAkB,EAClBU,oBAAoB,EACpBZ,YAAY,EACZC,UAAU,EACVQ,aAAa,CAErB,CAAC;AACL,CAAC;AAEDV,aAAa,CAACmD,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAtE,OAAA,GAE7BiB,aAAa","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StyledFilterSortText = exports.StyledFilterSort = exports.StyledFilterContent = exports.StyledFilterComboboxWrapper = void 0;
6
+ exports.StyledFilterSortText = exports.StyledFilterSort = exports.StyledFilterContent = exports.StyledFilterComboboxWrapper = exports.StyledFilterComboboxInline = void 0;
7
7
  var _styledComponents = _interopRequireDefault(require("styled-components"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const StyledFilterContent = exports.StyledFilterContent = _styledComponents.default.div`
@@ -15,12 +15,13 @@ const StyledFilterContent = exports.StyledFilterContent = _styledComponents.defa
15
15
 
16
16
  display: flex;
17
17
  flex-direction: column;
18
- gap: 20px;
18
+ gap: 10px;
19
19
  `;
20
20
  const StyledFilterSort = exports.StyledFilterSort = _styledComponents.default.div`
21
21
  display: flex;
22
22
  align-items: center;
23
- gap: 20px;
23
+ justify-content: space-between;
24
+ gap: 10px;
24
25
  `;
25
26
  const StyledFilterSortText = exports.StyledFilterSortText = _styledComponents.default.div`
26
27
  flex: 0 0 auto;
@@ -33,4 +34,9 @@ const StyledFilterComboboxWrapper = exports.StyledFilterComboboxWrapper = _style
33
34
  $textWidth
34
35
  }) => `calc(100% - ${$textWidth}px)`}}
35
36
  `;
37
+ const StyledFilterComboboxInline = exports.StyledFilterComboboxInline = _styledComponents.default.div`
38
+ display: flex;
39
+ justify-content: space-between;
40
+ align-items: center;
41
+ `;
36
42
  //# sourceMappingURL=FilterContent.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterContent.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledFilterContent","exports","styled","div","theme","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledFilterContentProps = WithTheme<unknown>;\n\nexport const StyledFilterContent = styled.div<StyledFilterContentProps>`\n background-color: ${({ theme }) => theme['100']};\n\n padding: 12px;\n\n display: flex;\n flex-direction: column;\n gap: 20px;\n`;\n\nexport const StyledFilterSort = styled.div`\n display: flex;\n align-items: center;\n gap: 20px;\n`;\n\nexport const StyledFilterSortText = styled.div`\n flex: 0 0 auto;\n`;\n\ntype StyledFilterComboboxWrapperProps = WithTheme<{\n $textWidth: number;\n}>;\n\nexport const StyledFilterComboboxWrapper = styled.div<StyledFilterComboboxWrapperProps>`\n display: flex;\n justify-content: end;\n \n width: ${({ $textWidth }) => `calc(100% - ${$textWidth}px)`}}\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAGH,yBAAM,CAACC,GAAG;AAC1C;AACA;AACA;AACA,CAAC;AAEM,MAAMG,oBAAoB,GAAAL,OAAA,CAAAK,oBAAA,GAAGJ,yBAAM,CAACC,GAAG;AAC9C;AACA,CAAC;AAMM,MAAMI,2BAA2B,GAAAN,OAAA,CAAAM,2BAAA,GAAGL,yBAAM,CAACC,GAAqC;AACvF;AACA;AACA;AACA,aAAa,CAAC;EAAEK;AAAW,CAAC,KAAK,eAAeA,UAAU,KAAK;AAC/D,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"FilterContent.styles.js","names":["_styledComponents","_interopRequireDefault","require","e","__esModule","default","StyledFilterContent","exports","styled","div","theme","StyledFilterSort","StyledFilterSortText","StyledFilterComboboxWrapper","$textWidth","StyledFilterComboboxInline"],"sources":["../../../../../src/components/filter/filter-content/FilterContent.styles.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledFilterContentProps = WithTheme<unknown>;\n\nexport const StyledFilterContent = styled.div<StyledFilterContentProps>`\n background-color: ${({ theme }) => theme['100']};\n\n padding: 12px;\n\n display: flex;\n flex-direction: column;\n gap: 10px;\n`;\n\nexport const StyledFilterSort = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n`;\n\nexport const StyledFilterSortText = styled.div`\n flex: 0 0 auto;\n`;\n\ntype StyledFilterComboboxWrapperProps = WithTheme<{\n $textWidth: number;\n}>;\n\nexport const StyledFilterComboboxWrapper = styled.div<StyledFilterComboboxWrapperProps>`\n display: flex;\n justify-content: end;\n \n width: ${({ $textWidth }) => `calc(100% - ${$textWidth}px)`}}\n`;\n\nexport const StyledFilterComboboxInline = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAuC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKhC,MAAMG,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAGE,yBAAM,CAACC,GAA6B;AACvE,wBAAwB,CAAC;EAAEC;AAAM,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMC,gBAAgB,GAAAJ,OAAA,CAAAI,gBAAA,GAAGH,yBAAM,CAACC,GAAG;AAC1C;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMG,oBAAoB,GAAAL,OAAA,CAAAK,oBAAA,GAAGJ,yBAAM,CAACC,GAAG;AAC9C;AACA,CAAC;AAMM,MAAMI,2BAA2B,GAAAN,OAAA,CAAAM,2BAAA,GAAGL,yBAAM,CAACC,GAAqC;AACvF;AACA;AACA;AACA,aAAa,CAAC;EAAEK;AAAW,CAAC,KAAK,eAAeA,UAAU,KAAK;AAC/D,CAAC;AAEM,MAAMC,0BAA0B,GAAAR,OAAA,CAAAQ,0BAAA,GAAGP,yBAAM,CAACC,GAAG;AACpD;AACA;AACA;AACA,CAAC","ignoreList":[]}
@@ -22,6 +22,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
22
22
  container,
23
23
  onHide,
24
24
  children,
25
+ isOpen,
25
26
  shouldHideOnChildrenLeave,
26
27
  shouldShowOnHover = false,
27
28
  shouldUseChildrenWidth = true,
@@ -36,13 +37,16 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
36
37
  });
37
38
  const [internalAlignment, setInternalAlignment] = (0, _react2.useState)(_popup.PopupAlignment.TopLeft);
38
39
  const [offset, setOffset] = (0, _react2.useState)(0);
39
- const [isOpen, setIsOpen] = (0, _react2.useState)(shouldBeOpen);
40
+ const [isInternallyOpen, setIsInternallyOpen] = (0, _react2.useState)(shouldBeOpen);
40
41
  const [portal, setPortal] = (0, _react2.useState)();
41
42
  const [pseudoSize, setPseudoSize] = (0, _react2.useState)();
42
43
  const [newContainer, setNewContainer] = (0, _react2.useState)(container ?? null);
43
44
  const [contentMaxHeight, setContentMaxHeight] = (0, _react2.useState)(undefined);
44
45
  const timeout = (0, _react2.useRef)();
46
+ const previousIsVisibleRef = (0, _react2.useRef)(false);
45
47
  const uuid = (0, _uuid.useUuid)();
48
+ const isControlled = typeof isOpen === 'boolean';
49
+ const isPopupOpen = isControlled ? isOpen : isInternallyOpen;
46
50
  const {
47
51
  height,
48
52
  width,
@@ -71,7 +75,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
71
75
  width
72
76
  });
73
77
  }, [height, width]);
74
- const handleShow = (0, _react2.useCallback)(() => {
78
+ const updatePopupPosition = (0, _react2.useCallback)(() => {
75
79
  if (popupRef.current && pseudoSize) {
76
80
  if (!newContainer) {
77
81
  return;
@@ -137,21 +141,33 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
137
141
  y
138
142
  });
139
143
  }
140
- setIsOpen(true);
141
144
  }
142
145
  }, [alignment, newContainer, pseudoSize, shouldScrollWithContent, yOffset]);
146
+ const handleShow = (0, _react2.useCallback)(() => {
147
+ updatePopupPosition();
148
+ if (isControlled) {
149
+ return;
150
+ }
151
+ setIsInternallyOpen(true);
152
+ }, [isControlled, updatePopupPosition]);
143
153
  (0, _react2.useEffect)(() => {
154
+ if (isControlled) {
155
+ if (isOpen) {
156
+ updatePopupPosition();
157
+ }
158
+ return;
159
+ }
144
160
  if (shouldBeOpen) {
145
161
  handleShow();
146
162
  }
147
- }, [handleShow, shouldBeOpen]);
163
+ }, [handleShow, isControlled, isOpen, shouldBeOpen, updatePopupPosition]);
148
164
  const handleReposition = (0, _react2.useCallback)(() => {
149
- if (isOpen) {
150
- handleShow();
165
+ if (isPopupOpen) {
166
+ updatePopupPosition();
151
167
  }
152
- }, [handleShow, isOpen]);
168
+ }, [isPopupOpen, updatePopupPosition]);
153
169
  (0, _react2.useEffect)(() => {
154
- if (!isOpen) {
170
+ if (!isPopupOpen) {
155
171
  return;
156
172
  }
157
173
  window.addEventListener('resize', handleReposition);
@@ -160,7 +176,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
160
176
  window.removeEventListener('resize', handleReposition);
161
177
  window.removeEventListener('scroll', handleReposition, true);
162
178
  };
163
- }, [handleReposition, isOpen]);
179
+ }, [handleReposition, isPopupOpen]);
164
180
  (0, _react2.useEffect)(() => {
165
181
  if (!newContainer || !popupRef.current) return;
166
182
  const viewHeight = newContainer.clientHeight;
@@ -172,18 +188,30 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
172
188
  }
173
189
  }, [coordinates.y, internalAlignment, newContainer]);
174
190
  const handleChildrenClick = () => {
191
+ if (isControlled) {
192
+ return;
193
+ }
175
194
  handleShow();
176
195
  };
177
196
  const handleHide = (0, _react2.useCallback)(() => {
178
- setIsOpen(false);
179
- }, []);
197
+ if (isControlled) {
198
+ return;
199
+ }
200
+ setIsInternallyOpen(false);
201
+ }, [isControlled]);
180
202
  const handleMouseEnter = (0, _react2.useCallback)(() => {
203
+ if (isControlled) {
204
+ return;
205
+ }
181
206
  if (shouldShowOnHover) {
182
207
  window.clearTimeout(timeout.current);
183
208
  handleShow();
184
209
  }
185
- }, [handleShow, shouldShowOnHover]);
210
+ }, [handleShow, isControlled, shouldShowOnHover]);
186
211
  const handleMouseLeave = (0, _react2.useCallback)(() => {
212
+ if (isControlled) {
213
+ return;
214
+ }
187
215
  if (!shouldShowOnHover) {
188
216
  return;
189
217
  }
@@ -194,7 +222,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
194
222
  timeout.current = window.setTimeout(() => {
195
223
  handleHide();
196
224
  }, 500);
197
- }, [handleHide, shouldHideOnChildrenLeave, shouldShowOnHover]);
225
+ }, [handleHide, isControlled, shouldHideOnChildrenLeave, shouldShowOnHover]);
198
226
  const handleDocumentClick = (0, _react2.useCallback)(event => {
199
227
  var _popupContentRef$curr;
200
228
  if (!((_popupContentRef$curr = popupContentRef.current) !== null && _popupContentRef$curr !== void 0 && _popupContentRef$curr.contains(event.target))) {
@@ -206,27 +234,36 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
206
234
  show: handleShow
207
235
  }), [handleHide, handleShow]);
208
236
  (0, _react2.useEffect)(() => {
209
- if (isOpen && !shouldBeOpen) {
237
+ if (!isPopupOpen) {
238
+ return undefined;
239
+ }
240
+ if (!isControlled && !shouldBeOpen) {
210
241
  document.addEventListener('click', handleDocumentClick, true);
211
242
  window.addEventListener('blur', handleHide);
212
- if (typeof onShow === 'function') {
213
- onShow();
214
- }
215
- } else if (typeof onHide === 'function') {
216
- onHide();
217
243
  }
218
244
  return () => {
219
245
  document.removeEventListener('click', handleDocumentClick, true);
220
246
  window.removeEventListener('blur', handleHide);
221
247
  };
222
- }, [handleDocumentClick, handleHide, isOpen, onHide, onShow, shouldBeOpen]);
248
+ }, [handleDocumentClick, handleHide, isControlled, isPopupOpen, shouldBeOpen]);
249
+ (0, _react2.useEffect)(() => {
250
+ if (previousIsVisibleRef.current === isPopupOpen) {
251
+ return;
252
+ }
253
+ previousIsVisibleRef.current = isPopupOpen;
254
+ if (isPopupOpen) {
255
+ onShow === null || onShow === void 0 || onShow();
256
+ return;
257
+ }
258
+ onHide === null || onHide === void 0 || onHide();
259
+ }, [isPopupOpen, onHide, onShow]);
223
260
  (0, _react2.useEffect)(() => {
224
261
  if (!newContainer) {
225
262
  return;
226
263
  }
227
264
  setPortal(() => /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react2.default.createElement(_react.AnimatePresence, {
228
265
  initial: false
229
- }, isOpen && /*#__PURE__*/_react2.default.createElement(_PopupContentWrapper.default, {
266
+ }, isPopupOpen && /*#__PURE__*/_react2.default.createElement(_PopupContentWrapper.default, {
230
267
  width: (pseudoSize === null || pseudoSize === void 0 ? void 0 : pseudoSize.width) ?? 0,
231
268
  offset: offset,
232
269
  shouldScrollWithContent: shouldScrollWithContent,
@@ -240,7 +277,7 @@ const Popup = /*#__PURE__*/(0, _react2.forwardRef)(({
240
277
  }, /*#__PURE__*/_react2.default.createElement(_AreaContextProvider.default, {
241
278
  shouldChangeColor: true
242
279
  }, content))), newContainer));
243
- }, [contentMaxHeight, internalAlignment, newContainer, content, coordinates, handleMouseEnter, handleMouseLeave, isOpen, offset, pseudoSize === null || pseudoSize === void 0 ? void 0 : pseudoSize.width, uuid, shouldScrollWithContent]);
280
+ }, [contentMaxHeight, internalAlignment, newContainer, content, coordinates, handleMouseEnter, handleMouseLeave, isPopupOpen, offset, pseudoSize === null || pseudoSize === void 0 ? void 0 : pseudoSize.width, uuid, shouldScrollWithContent]);
244
281
  return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, measuredElement, /*#__PURE__*/_react2.default.createElement(_Popup.StyledPopup, {
245
282
  className: "beta-chayns-popup",
246
283
  ref: popupRef,