@chayns-components/core 5.4.8-alpha.0 → 5.4.13-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/radio-button/RadioButton.styles.js +1 -1
- package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/cjs/components/search-box/SearchBox.js +69 -20
- package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.js +3 -1
- 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 +6 -4
- package/lib/cjs/components/search-box/search-box-body/SearchBoxBody.styles.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-item/SearchBoxItem.js +3 -1
- package/lib/cjs/components/search-box/search-box-item/SearchBoxItem.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-item/SearchBoxItem.styles.js +6 -1
- package/lib/cjs/components/search-box/search-box-item/SearchBoxItem.styles.js.map +1 -1
- package/lib/cjs/utils/searchBox.js +22 -12
- package/lib/cjs/utils/searchBox.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.styles.js +1 -1
- package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/esm/components/search-box/SearchBox.js +70 -21
- package/lib/esm/components/search-box/SearchBox.js.map +1 -1
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.js +3 -1
- 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 +6 -4
- package/lib/esm/components/search-box/search-box-body/SearchBoxBody.styles.js.map +1 -1
- package/lib/esm/components/search-box/search-box-item/SearchBoxItem.js +3 -1
- package/lib/esm/components/search-box/search-box-item/SearchBoxItem.js.map +1 -1
- package/lib/esm/components/search-box/search-box-item/SearchBoxItem.styles.js +6 -1
- package/lib/esm/components/search-box/search-box-item/SearchBoxItem.styles.js.map +1 -1
- package/lib/esm/utils/searchBox.js +20 -11
- package/lib/esm/utils/searchBox.js.map +1 -1
- package/lib/types/components/radio-button/RadioButton.styles.d.ts +2 -2
- package/lib/types/components/search-box/SearchBox.d.ts +16 -0
- package/lib/types/components/search-box/search-box-body/SearchBoxBody.d.ts +1 -0
- package/lib/types/components/search-box/search-box-body/SearchBoxBody.styles.d.ts +4 -2
- package/lib/types/components/search-box/search-box-item/SearchBoxItem.d.ts +1 -0
- package/lib/types/components/search-box/search-box-item/SearchBoxItem.styles.d.ts +6 -2
- package/lib/types/utils/searchBox.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBoxBody.js","names":["_react","_interopRequireWildcard","require","_element","_uuid","_searchBox","_FilterButtons","_interopRequireDefault","_SearchBoxBody","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SearchBoxBody","forwardRef","filterButtons","selectedGroups","height","children","shouldShow","onGroupSelect","shouldHideFilterButtons","ref","hasScrolled","setHasScrolled","useState","currentGroupName","setCurrentGroupName","headRef","useRef","headSize","useElementSize","uuid","useUuid","headHeight","useMemo","useEffect","element","document","getElementById","length","getCurrentGroupName","handlePreventDefault","event","preventDefault","stopPropagation","handleScroll","useCallback","scrollTop","target","createElement","StyledSearchBoxBody","onClick","inert","undefined","StyledSearchBoxBodyHead","$hasScrolled","$hasGroupName","items","size","onSelect","selectedItemIds","StyledSearchBoxBodyHeadGroupName","replace","StyledSearchBoxBodyContent","$height","$headHeight","key","id","className","tabIndex","onScroll","displayName","_default","exports"],"sources":["../../../../../src/components/search-box/search-box-body/SearchBoxBody.tsx"],"sourcesContent":["import React, {\n forwardRef,\n MouseEvent,\n UIEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { useElementSize } from '../../../hooks/element';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IFilterButtonItem } from '../../../types/filterButtons';\nimport { getCurrentGroupName } from '../../../utils/searchBox';\nimport FilterButtons from '../../filter-buttons/FilterButtons';\nimport {\n StyledSearchBoxBody,\n StyledSearchBoxBodyContent,\n StyledSearchBoxBodyHead,\n StyledSearchBoxBodyHeadGroupName,\n} from './SearchBoxBody.styles';\n\nexport type SearchBoxBodyProps = {\n children: ReactNode;\n filterButtons?: IFilterButtonItem[];\n selectedGroups?: string[];\n height: number;\n onGroupSelect?: (keys: string[]) => void;\n shouldHideFilterButtons?: boolean;\n shouldShow: boolean;\n};\n\nconst SearchBoxBody = forwardRef<HTMLDivElement, SearchBoxBodyProps>(\n (\n {\n filterButtons,\n selectedGroups,\n height,\n children,\n shouldShow,\n onGroupSelect,\n shouldHideFilterButtons,\n },\n ref,\n ) => {\n const [hasScrolled, setHasScrolled] = useState(false);\n const [currentGroupName, setCurrentGroupName] = useState('');\n\n const headRef = useRef<HTMLDivElement>(null);\n\n const headSize = useElementSize(headRef);\n\n const uuid = useUuid();\n\n const headHeight = useMemo(\n () => (headSize?.height ? headSize.height + 15 : 0),\n [headSize?.height],\n );\n\n useEffect(() => {\n const element = document.getElementById(`searchBoxContent__${uuid}`);\n\n if (\n element &&\n ((selectedGroups?.length === 1 && selectedGroups[0] === 'all') ||\n selectedGroups?.length !== 1)\n ) {\n setCurrentGroupName(getCurrentGroupName(element));\n } else {\n setCurrentGroupName('');\n }\n }, [uuid, children, selectedGroups]);\n\n const handlePreventDefault = (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n };\n\n const handleScroll = useCallback(\n (event: UIEvent) => {\n const { scrollTop } = event.target as HTMLDivElement;\n\n setHasScrolled(scrollTop > 1);\n\n if (\n (selectedGroups?.length === 1 && selectedGroups[0] === 'all') ||\n selectedGroups?.length !== 1\n ) {\n setCurrentGroupName(getCurrentGroupName(event.target as HTMLDivElement));\n }\n },\n [selectedGroups],\n );\n\n return useMemo(\n () => (\n <StyledSearchBoxBody\n onClick={handlePreventDefault}\n ref={ref}\n inert={!shouldShow ? 'true' : undefined}\n >\n {filterButtons && filterButtons?.length > 1 && (\n <StyledSearchBoxBodyHead\n ref={headRef}\n $hasScrolled={hasScrolled}\n $hasGroupName={!!currentGroupName}\n >\n {!shouldHideFilterButtons && (\n <FilterButtons\n items={filterButtons}\n size={0}\n onSelect={onGroupSelect}\n selectedItemIds={selectedGroups}\n />\n )}\n <StyledSearchBoxBodyHeadGroupName>\n {currentGroupName.replace('_', '')}\n </StyledSearchBoxBodyHeadGroupName>\n </StyledSearchBoxBodyHead>\n )}\n <StyledSearchBoxBodyContent\n $height={height}\n $headHeight={headHeight}\n key=\"content\"\n id={`searchBoxContent__${uuid}`}\n className=\"chayns-scrollbar\"\n tabIndex={0}\n onScroll={handleScroll}\n >\n {children}\n </StyledSearchBoxBodyContent>\n </StyledSearchBoxBody>\n ),\n [\n children,\n currentGroupName,\n filterButtons,\n handleScroll,\n hasScrolled,\n headHeight,\n height,\n onGroupSelect,\n ref,\n selectedGroups,\n shouldHideFilterButtons,\n shouldShow,\n uuid,\n ],\n );\n },\n);\n\nSearchBoxBody.displayName = 'SearchBoxBody';\n\nexport default SearchBoxBody;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAKgC,SAAAK,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAA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E,EAAE,qBAAqBpC,IAAI,EAAG;IAChCqC,SAAS,EAAC,kBAAkB;IAC5BC,QAAQ,EAAE,CAAE;IACZC,QAAQ,EAAEzB;EAAa,GAEtB5B,QACuB,CACX,CACxB,EACD,CACIA,QAAQ,EACRQ,gBAAgB,EAChBX,aAAa,EACb+B,YAAY,EACZvB,WAAW,EACXW,UAAU,EACVjB,MAAM,EACNG,aAAa,EACbE,GAAG,EACHN,cAAc,EACdK,uBAAuB,EACvBF,UAAU,EACVa,IAAI,CAEZ,CAAC;AACL,CACJ,CAAC;AAEDnB,aAAa,CAAC2D,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAE7BiB,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SearchBoxBody.js","names":["_react","_interopRequireWildcard","require","_element","_uuid","_searchBox","_FilterButtons","_interopRequireDefault","_SearchBoxBody","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SearchBoxBody","forwardRef","filterButtons","selectedGroups","height","maxHeight","children","shouldShow","onGroupSelect","shouldHideFilterButtons","ref","hasScrolled","setHasScrolled","useState","currentGroupName","setCurrentGroupName","headRef","useRef","headSize","useElementSize","uuid","useUuid","headHeight","useMemo","useEffect","element","document","getElementById","length","getCurrentGroupName","handlePreventDefault","event","preventDefault","stopPropagation","handleScroll","useCallback","scrollTop","target","createElement","StyledSearchBoxBody","onClick","inert","undefined","StyledSearchBoxBodyHead","$hasScrolled","$hasGroupName","items","size","onSelect","selectedItemIds","StyledSearchBoxBodyHeadGroupName","replace","StyledSearchBoxBodyContent","$height","$headHeight","$maxHeight","key","id","className","tabIndex","onScroll","displayName","_default","exports"],"sources":["../../../../../src/components/search-box/search-box-body/SearchBoxBody.tsx"],"sourcesContent":["import React, {\n forwardRef,\n MouseEvent,\n UIEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport { useElementSize } from '../../../hooks/element';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IFilterButtonItem } from '../../../types/filterButtons';\nimport { getCurrentGroupName } from '../../../utils/searchBox';\nimport FilterButtons from '../../filter-buttons/FilterButtons';\nimport {\n StyledSearchBoxBody,\n StyledSearchBoxBodyContent,\n StyledSearchBoxBodyHead,\n StyledSearchBoxBodyHeadGroupName,\n} from './SearchBoxBody.styles';\n\nexport type SearchBoxBodyProps = {\n children: ReactNode;\n filterButtons?: IFilterButtonItem[];\n selectedGroups?: string[];\n height: number;\n maxHeight?: number;\n onGroupSelect?: (keys: string[]) => void;\n shouldHideFilterButtons?: boolean;\n shouldShow: boolean;\n};\n\nconst SearchBoxBody = forwardRef<HTMLDivElement, SearchBoxBodyProps>(\n (\n {\n filterButtons,\n selectedGroups,\n height,\n maxHeight = 300,\n children,\n shouldShow,\n onGroupSelect,\n shouldHideFilterButtons,\n },\n ref,\n ) => {\n const [hasScrolled, setHasScrolled] = useState(false);\n const [currentGroupName, setCurrentGroupName] = useState('');\n\n const headRef = useRef<HTMLDivElement>(null);\n\n const headSize = useElementSize(headRef);\n\n const uuid = useUuid();\n\n const headHeight = useMemo(\n () => (headSize?.height ? headSize.height + 15 : 0),\n [headSize?.height],\n );\n\n useEffect(() => {\n const element = document.getElementById(`searchBoxContent__${uuid}`);\n\n if (\n element &&\n ((selectedGroups?.length === 1 && selectedGroups[0] === 'all') ||\n selectedGroups?.length !== 1)\n ) {\n setCurrentGroupName(getCurrentGroupName(element));\n } else {\n setCurrentGroupName('');\n }\n }, [uuid, children, selectedGroups]);\n\n const handlePreventDefault = (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n };\n\n const handleScroll = useCallback(\n (event: UIEvent) => {\n const { scrollTop } = event.target as HTMLDivElement;\n\n setHasScrolled(scrollTop > 1);\n\n if (\n (selectedGroups?.length === 1 && selectedGroups[0] === 'all') ||\n selectedGroups?.length !== 1\n ) {\n setCurrentGroupName(getCurrentGroupName(event.target as HTMLDivElement));\n }\n },\n [selectedGroups],\n );\n\n return useMemo(\n () => (\n <StyledSearchBoxBody\n onClick={handlePreventDefault}\n ref={ref}\n inert={!shouldShow ? 'true' : undefined}\n >\n {filterButtons && filterButtons?.length > 1 && (\n <StyledSearchBoxBodyHead\n ref={headRef}\n $hasScrolled={hasScrolled}\n $hasGroupName={!!currentGroupName}\n >\n {!shouldHideFilterButtons && (\n <FilterButtons\n items={filterButtons}\n size={0}\n onSelect={onGroupSelect}\n selectedItemIds={selectedGroups}\n />\n )}\n <StyledSearchBoxBodyHeadGroupName>\n {currentGroupName.replace('_', '')}\n </StyledSearchBoxBodyHeadGroupName>\n </StyledSearchBoxBodyHead>\n )}\n <StyledSearchBoxBodyContent\n $height={height}\n $headHeight={headHeight}\n $maxHeight={maxHeight}\n key=\"content\"\n id={`searchBoxContent__${uuid}`}\n className=\"chayns-scrollbar\"\n tabIndex={0}\n onScroll={handleScroll}\n >\n {children}\n </StyledSearchBoxBodyContent>\n </StyledSearchBoxBody>\n ),\n [\n children,\n currentGroupName,\n filterButtons,\n handleScroll,\n hasScrolled,\n headHeight,\n height,\n onGroupSelect,\n maxHeight,\n ref,\n selectedGroups,\n shouldHideFilterButtons,\n shouldShow,\n uuid,\n ],\n );\n },\n);\n\nSearchBoxBody.displayName = 'SearchBoxBody';\n\nexport default SearchBoxBody;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAWA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAKgC,SAAAK,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,C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uD,aAAA,CAAC1D,cAAA,CAAAwE,0BAA0B;IACvBC,OAAO,EAAEjD,MAAO;IAChBkD,WAAW,EAAEhC,UAAW;IACxBiC,UAAU,EAAElD,SAAU;IACtBmD,GAAG,EAAC,SAAS;IACbC,EAAE,EAAE,qBAAqBrC,IAAI,EAAG;IAChCsC,SAAS,EAAC,kBAAkB;IAC5BC,QAAQ,EAAE,CAAE;IACZC,QAAQ,EAAE1B;EAAa,GAEtB5B,QACuB,CACX,CACxB,EACD,CACIA,QAAQ,EACRQ,gBAAgB,EAChBZ,aAAa,EACbgC,YAAY,EACZvB,WAAW,EACXW,UAAU,EACVlB,MAAM,EACNI,aAAa,EACbH,SAAS,EACTK,GAAG,EACHP,cAAc,EACdM,uBAAuB,EACvBF,UAAU,EACVa,IAAI,CAEZ,CAAC;AACL,CACJ,CAAC;AAEDpB,aAAa,CAAC6D,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAE7BiB,aAAa","ignoreList":[]}
|
|
@@ -39,11 +39,13 @@ const StyledSearchBoxBodyContent = exports.StyledSearchBoxBodyContent = _styledC
|
|
|
39
39
|
cursor: pointer;
|
|
40
40
|
width: 100%;
|
|
41
41
|
max-height: ${({
|
|
42
|
-
$headHeight
|
|
43
|
-
|
|
42
|
+
$headHeight,
|
|
43
|
+
$maxHeight
|
|
44
|
+
}) => $maxHeight - $headHeight}px;
|
|
44
45
|
overflow-y: ${({
|
|
45
46
|
$height,
|
|
46
|
-
$headHeight
|
|
47
|
-
|
|
47
|
+
$headHeight,
|
|
48
|
+
$maxHeight
|
|
49
|
+
}) => $height + $headHeight <= $maxHeight ? 'hidden' : 'auto'};
|
|
48
50
|
`;
|
|
49
51
|
//# sourceMappingURL=SearchBoxBody.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBoxBody.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledSearchBoxBody","exports","styled","div","StyledSearchBoxBodyHead","$hasGroupName","css","$hasScrolled","StyledSearchBoxBodyHeadGroupName","theme","text","StyledSearchBoxBodyContent","$headHeight","$height"],"sources":["../../../../../src/components/search-box/search-box-body/SearchBoxBody.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledSearchBoxBody = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nexport const StyledSearchBoxBodyHead = styled.div<StyledSearchBoxHeadProps>`\n padding: 10px 10px 5px;\n display: flex;\n flex-direction: column;\n\n ${({ $hasGroupName }) =>\n $hasGroupName &&\n css`\n gap: 15px;\n `}\n\n ${({ $hasScrolled }) =>\n $hasScrolled &&\n css`\n box-shadow: 0 1px 4px #0000001a;\n `}\n`;\n\ntype StyledSearchBoxHeadProps = WithTheme<{ $hasScrolled: boolean; $hasGroupName: boolean }>;\n\ntype StyledSearchBoxBodyHeadGroupNameNameProps = WithTheme<unknown>;\n\nexport const StyledSearchBoxBodyHeadGroupName = styled.div<StyledSearchBoxBodyHeadGroupNameNameProps>`\n color: ${({ theme }: StyledSearchBoxBodyHeadGroupNameNameProps) => theme.text};\n font-weight: bold;\n`;\n\ntype StyledSearchBoxBodyContentProps = WithTheme<{\n $height: number;\n $headHeight: number;\n}>;\n\nexport const StyledSearchBoxBodyContent = styled.div<StyledSearchBoxBodyContentProps>`\n display: flex;\n flex-direction: column;\n cursor: pointer;\n width: 100%;\n max-height: ${({ $headHeight }) =>
|
|
1
|
+
{"version":3,"file":"SearchBoxBody.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledSearchBoxBody","exports","styled","div","StyledSearchBoxBodyHead","$hasGroupName","css","$hasScrolled","StyledSearchBoxBodyHeadGroupName","theme","text","StyledSearchBoxBodyContent","$headHeight","$maxHeight","$height"],"sources":["../../../../../src/components/search-box/search-box-body/SearchBoxBody.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\nexport const StyledSearchBoxBody = styled.div`\n display: flex;\n flex-direction: column;\n`;\n\nexport const StyledSearchBoxBodyHead = styled.div<StyledSearchBoxHeadProps>`\n padding: 10px 10px 5px;\n display: flex;\n flex-direction: column;\n\n ${({ $hasGroupName }) =>\n $hasGroupName &&\n css`\n gap: 15px;\n `}\n\n ${({ $hasScrolled }) =>\n $hasScrolled &&\n css`\n box-shadow: 0 1px 4px #0000001a;\n `}\n`;\n\ntype StyledSearchBoxHeadProps = WithTheme<{ $hasScrolled: boolean; $hasGroupName: boolean }>;\n\ntype StyledSearchBoxBodyHeadGroupNameNameProps = WithTheme<unknown>;\n\nexport const StyledSearchBoxBodyHeadGroupName = styled.div<StyledSearchBoxBodyHeadGroupNameNameProps>`\n color: ${({ theme }: StyledSearchBoxBodyHeadGroupNameNameProps) => theme.text};\n font-weight: bold;\n`;\n\ntype StyledSearchBoxBodyContentProps = WithTheme<{\n $height: number;\n $headHeight: number;\n $maxHeight: number;\n}>;\n\nexport const StyledSearchBoxBodyContent = styled.div<StyledSearchBoxBodyContentProps>`\n display: flex;\n flex-direction: column;\n cursor: pointer;\n width: 100%;\n max-height: ${({ $headHeight, $maxHeight }) => $maxHeight - $headHeight}px;\n overflow-y: ${({ $height, $headHeight, $maxHeight }) =>\n $height + $headHeight <= $maxHeight ? 'hidden' : 'auto'};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,C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AO,gCAAA,GAAGN,yBAAM,CAACC,GAA8C;AACrG,aAAa,CAAC;EAAEM;AAAiD,CAAC,KAAKA,KAAK,CAACC,IAAI;AACjF;AACA,CAAC;AAQM,MAAMC,0BAA0B,GAAAV,OAAA,CAAAU,0BAAA,GAAGT,yBAAM,CAACC,GAAoC;AACrF;AACA;AACA;AACA;AACA,kBAAkB,CAAC;EAAES,WAAW;EAAEC;AAAW,CAAC,KAAKA,UAAU,GAAGD,WAAW;AAC3E,kBAAkB,CAAC;EAAEE,OAAO;EAAEF,WAAW;EAAEC;AAAW,CAAC,KAC/CC,OAAO,GAAGF,WAAW,IAAIC,UAAU,GAAG,QAAQ,GAAG,MAAM;AAC/D,CAAC","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ const SearchBoxItem = ({
|
|
|
11
11
|
id,
|
|
12
12
|
text,
|
|
13
13
|
imageUrl,
|
|
14
|
+
shouldShowSmallItems,
|
|
14
15
|
shouldShowRoundImage,
|
|
15
16
|
onSelect,
|
|
16
17
|
groupName,
|
|
@@ -37,10 +38,11 @@ const SearchBoxItem = ({
|
|
|
37
38
|
src: imageUrl,
|
|
38
39
|
$shouldShowRoundImage: shouldShowRoundImage
|
|
39
40
|
}), /*#__PURE__*/_react.default.createElement(_SearchBoxItem.StyledSearchBoxItemText, {
|
|
41
|
+
$shouldShowSmallItems: shouldShowSmallItems,
|
|
40
42
|
dangerouslySetInnerHTML: {
|
|
41
43
|
__html: text
|
|
42
44
|
}
|
|
43
|
-
})), [handleClick, idString, imageUrl, shouldShowRoundImage, text, tabIndex]);
|
|
45
|
+
})), [handleClick, idString, imageUrl, shouldShowRoundImage, shouldShowSmallItems, text, tabIndex]);
|
|
44
46
|
};
|
|
45
47
|
SearchBoxItem.displayName = 'SearchBoxItem';
|
|
46
48
|
var _default = exports.default = SearchBoxItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBoxItem.js","names":["_react","_interopRequireWildcard","require","_SearchBoxItem","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SearchBoxItem","id","text","imageUrl","shouldShowRoundImage","onSelect","groupName","tabIndex","handleClick","useCallback","event","preventDefault","stopPropagation","idString","useMemo","createElement","StyledSearchBoxItem","onClick","StyledSearchBoxItemImage","src","$shouldShowRoundImage","StyledSearchBoxItemText","dangerouslySetInnerHTML","__html","displayName","_default","exports"],"sources":["../../../../../src/components/search-box/search-box-item/SearchBoxItem.tsx"],"sourcesContent":["import React, { FC, MouseEvent, useCallback, useMemo } from 'react';\nimport type { ISearchBoxItem, ISearchBoxItems } from '../../../types/searchBox';\nimport {\n StyledSearchBoxItem,\n StyledSearchBoxItemImage,\n StyledSearchBoxItemText,\n} from './SearchBoxItem.styles';\n\nexport type SearchBoxItemProps = {\n onSelect: (item: ISearchBoxItem, groupName?: ISearchBoxItems['groupName']) => void;\n id: ISearchBoxItem['id'];\n text: ISearchBoxItem['text'];\n imageUrl?: ISearchBoxItem['imageUrl'];\n shouldShowRoundImage?: boolean;\n groupName?: ISearchBoxItems['groupName'];\n tabIndex: number;\n};\n\nconst SearchBoxItem: FC<SearchBoxItemProps> = ({\n id,\n text,\n imageUrl,\n shouldShowRoundImage,\n onSelect,\n groupName,\n tabIndex,\n}) => {\n const handleClick = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n\n onSelect({ id: id === 'input-value' ? text : id, text, imageUrl }, groupName);\n },\n [onSelect, id, text, imageUrl, groupName],\n );\n\n let idString = `search-box-item__${id}`;\n\n if (groupName) {\n idString = `_${groupName}`;\n }\n\n return useMemo(\n () => (\n <StyledSearchBoxItem id={idString} onClick={handleClick} tabIndex={tabIndex}>\n {imageUrl && (\n <StyledSearchBoxItemImage\n src={imageUrl}\n $shouldShowRoundImage={shouldShowRoundImage}\n />\n )}\n <StyledSearchBoxItemText
|
|
1
|
+
{"version":3,"file":"SearchBoxItem.js","names":["_react","_interopRequireWildcard","require","_SearchBoxItem","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SearchBoxItem","id","text","imageUrl","shouldShowSmallItems","shouldShowRoundImage","onSelect","groupName","tabIndex","handleClick","useCallback","event","preventDefault","stopPropagation","idString","useMemo","createElement","StyledSearchBoxItem","onClick","StyledSearchBoxItemImage","src","$shouldShowRoundImage","StyledSearchBoxItemText","$shouldShowSmallItems","dangerouslySetInnerHTML","__html","displayName","_default","exports"],"sources":["../../../../../src/components/search-box/search-box-item/SearchBoxItem.tsx"],"sourcesContent":["import React, { FC, MouseEvent, useCallback, useMemo } from 'react';\nimport type { ISearchBoxItem, ISearchBoxItems } from '../../../types/searchBox';\nimport {\n StyledSearchBoxItem,\n StyledSearchBoxItemImage,\n StyledSearchBoxItemText,\n} from './SearchBoxItem.styles';\n\nexport type SearchBoxItemProps = {\n onSelect: (item: ISearchBoxItem, groupName?: ISearchBoxItems['groupName']) => void;\n id: ISearchBoxItem['id'];\n text: ISearchBoxItem['text'];\n imageUrl?: ISearchBoxItem['imageUrl'];\n shouldShowSmallItems?: boolean;\n shouldShowRoundImage?: boolean;\n groupName?: ISearchBoxItems['groupName'];\n tabIndex: number;\n};\n\nconst SearchBoxItem: FC<SearchBoxItemProps> = ({\n id,\n text,\n imageUrl,\n shouldShowSmallItems,\n shouldShowRoundImage,\n onSelect,\n groupName,\n tabIndex,\n}) => {\n const handleClick = useCallback(\n (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n\n onSelect({ id: id === 'input-value' ? text : id, text, imageUrl }, groupName);\n },\n [onSelect, id, text, imageUrl, groupName],\n );\n\n let idString = `search-box-item__${id}`;\n\n if (groupName) {\n idString = `_${groupName}`;\n }\n\n return useMemo(\n () => (\n <StyledSearchBoxItem id={idString} onClick={handleClick} tabIndex={tabIndex}>\n {imageUrl && (\n <StyledSearchBoxItemImage\n src={imageUrl}\n $shouldShowRoundImage={shouldShowRoundImage}\n />\n )}\n <StyledSearchBoxItemText\n $shouldShowSmallItems={shouldShowSmallItems}\n dangerouslySetInnerHTML={{ __html: text }}\n />\n </StyledSearchBoxItem>\n ),\n [\n handleClick,\n idString,\n imageUrl,\n shouldShowRoundImage,\n shouldShowSmallItems,\n text,\n tabIndex,\n ],\n );\n};\n\nSearchBoxItem.displayName = 'SearchBoxItem';\n\nexport default SearchBoxItem;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAIgC,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,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,IAAAC,CAAA,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ACgB,CACxB,EACD,CACIO,WAAW,EACXK,QAAQ,EACRX,QAAQ,EACRE,oBAAoB,EACpBD,oBAAoB,EACpBF,IAAI,EACJM,QAAQ,CAEhB,CAAC;AACL,CAAC;AAEDR,aAAa,CAAC0B,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAE7BS,aAAa","ignoreList":[]}
|
|
@@ -42,7 +42,12 @@ const StyledSearchBoxItemText = exports.StyledSearchBoxItemText = _styledCompone
|
|
|
42
42
|
color: ${({
|
|
43
43
|
theme
|
|
44
44
|
}) => theme.text};
|
|
45
|
-
|
|
45
|
+
font-size: ${({
|
|
46
|
+
$shouldShowSmallItems
|
|
47
|
+
}) => $shouldShowSmallItems ? '14px' : undefined};
|
|
48
|
+
margin: ${({
|
|
49
|
+
$shouldShowSmallItems
|
|
50
|
+
}) => $shouldShowSmallItems ? '0 !important' : '5px 0 !important'};
|
|
46
51
|
|
|
47
52
|
b {
|
|
48
53
|
color: ${({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBoxItem.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledSearchBoxItem","exports","styled","div","theme","StyledSearchBoxItemImage","img","$shouldShowRoundImage","css","StyledSearchBoxItemText","p","text","headline"],"sources":["../../../../../src/components/search-box/search-box-item/SearchBoxItem.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledSearchBoxItemProps = WithTheme<unknown>;\nexport const StyledSearchBoxItem = styled.div<StyledSearchBoxItemProps>`\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 10px;\n\n &:hover {\n background: ${({ theme }: StyledSearchBoxItemProps) => theme['secondary-102']};\n }\n\n &[tabindex='0'] {\n background: ${({ theme }: StyledSearchBoxItemProps) => theme['secondary-102']};\n }\n`;\n\ntype StyledSearchBoxItemImageProps = WithTheme<{ $shouldShowRoundImage?: boolean }>;\n\nexport const StyledSearchBoxItemImage = styled.img<StyledSearchBoxItemImageProps>`\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledSearchBoxItemImageProps) => theme['009-rgb']}, 0.15);\n height: 22px;\n width: 22px;\n\n ${({ $shouldShowRoundImage }) =>\n $shouldShowRoundImage &&\n css`\n border-radius: 50%;\n `}\n`;\n\ntype StyledSearchBoxItemTextProps = WithTheme<
|
|
1
|
+
{"version":3,"file":"SearchBoxItem.styles.js","names":["_styledComponents","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledSearchBoxItem","exports","styled","div","theme","StyledSearchBoxItemImage","img","$shouldShowRoundImage","css","StyledSearchBoxItemText","p","text","$shouldShowSmallItems","undefined","headline"],"sources":["../../../../../src/components/search-box/search-box-item/SearchBoxItem.styles.ts"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledSearchBoxItemProps = WithTheme<unknown>;\nexport const StyledSearchBoxItem = styled.div<StyledSearchBoxItemProps>`\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 4px 10px;\n\n &:hover {\n background: ${({ theme }: StyledSearchBoxItemProps) => theme['secondary-102']};\n }\n\n &[tabindex='0'] {\n background: ${({ theme }: StyledSearchBoxItemProps) => theme['secondary-102']};\n }\n`;\n\ntype StyledSearchBoxItemImageProps = WithTheme<{ $shouldShowRoundImage?: boolean }>;\n\nexport const StyledSearchBoxItemImage = styled.img<StyledSearchBoxItemImageProps>`\n box-shadow: 0 0 0 1px\n rgba(${({ theme }: StyledSearchBoxItemImageProps) => theme['009-rgb']}, 0.15);\n height: 22px;\n width: 22px;\n\n ${({ $shouldShowRoundImage }) =>\n $shouldShowRoundImage &&\n css`\n border-radius: 50%;\n `}\n`;\n\ntype StyledSearchBoxItemTextProps = WithTheme<{ $shouldShowSmallItems?: boolean }>;\n\nexport const StyledSearchBoxItemText = styled.p<StyledSearchBoxItemTextProps>`\n color: ${({ theme }: StyledSearchBoxItemTextProps) => theme.text};\n font-size: ${({ $shouldShowSmallItems }) => ($shouldShowSmallItems ? '14px' : undefined)};\n margin: ${({ $shouldShowSmallItems }) =>\n $shouldShowSmallItems ? '0 !important' : '5px 0 !important'};\n\n b {\n color: ${({ theme }: StyledSearchBoxItemTextProps) => theme.headline};\n }\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAgD,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,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,CAAA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List = exports.getCurrentGroupName = void 0;
|
|
6
|
+
exports.sortSearchBoxItems = exports.searchList = exports.getCurrentGroupName = void 0;
|
|
7
7
|
const surroundWithBTag = (text, startIndex, length) => {
|
|
8
8
|
const before = text.substring(0, startIndex);
|
|
9
9
|
const highlighted = text.substring(startIndex, startIndex + length);
|
|
@@ -44,6 +44,24 @@ const getCurrentGroupName = element => {
|
|
|
44
44
|
return currentGroupName;
|
|
45
45
|
};
|
|
46
46
|
exports.getCurrentGroupName = getCurrentGroupName;
|
|
47
|
+
const sortSearchBoxItems = ({
|
|
48
|
+
searchString,
|
|
49
|
+
items
|
|
50
|
+
}) => {
|
|
51
|
+
const lowercaseSearchString = searchString.toLowerCase();
|
|
52
|
+
return [...items].sort((a, b) => {
|
|
53
|
+
const aStartsWithSearchString = a.text.toLowerCase().startsWith(lowercaseSearchString);
|
|
54
|
+
const bStartsWithSearchString = b.text.toLowerCase().startsWith(lowercaseSearchString);
|
|
55
|
+
if (aStartsWithSearchString && !bStartsWithSearchString) {
|
|
56
|
+
return -1;
|
|
57
|
+
}
|
|
58
|
+
if (!aStartsWithSearchString && bStartsWithSearchString) {
|
|
59
|
+
return 1;
|
|
60
|
+
}
|
|
61
|
+
return a.text.localeCompare(b.text);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
exports.sortSearchBoxItems = sortSearchBoxItems;
|
|
47
65
|
const searchList = ({
|
|
48
66
|
searchString,
|
|
49
67
|
items
|
|
@@ -65,18 +83,10 @@ const searchList = ({
|
|
|
65
83
|
}
|
|
66
84
|
}
|
|
67
85
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (aStartsWithSearchString && !bStartsWithSearchString) {
|
|
72
|
-
return -1;
|
|
73
|
-
}
|
|
74
|
-
if (!aStartsWithSearchString && bStartsWithSearchString) {
|
|
75
|
-
return 1;
|
|
76
|
-
}
|
|
77
|
-
return a.text.localeCompare(b.text);
|
|
86
|
+
return sortSearchBoxItems({
|
|
87
|
+
items: matchingItems,
|
|
88
|
+
searchString
|
|
78
89
|
});
|
|
79
|
-
return matchingItems;
|
|
80
90
|
};
|
|
81
91
|
exports.searchList = searchList;
|
|
82
92
|
//# sourceMappingURL=searchBox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchBox.js","names":["surroundWithBTag","text","startIndex","length","before","substring","highlighted","after","getCurrentGroupName","element","hasChildrenFound","currentGroupName","top","parentTop","getBoundingClientRect","children","Array","from","forEach","child","y","childrenY","height","childrenHeight","id","sum","currentGroup","startsWith","nummer","split","pop","exports","
|
|
1
|
+
{"version":3,"file":"searchBox.js","names":["surroundWithBTag","text","startIndex","length","before","substring","highlighted","after","getCurrentGroupName","element","hasChildrenFound","currentGroupName","top","parentTop","getBoundingClientRect","children","Array","from","forEach","child","y","childrenY","height","childrenHeight","id","sum","currentGroup","startsWith","nummer","split","pop","exports","sortSearchBoxItems","searchString","items","lowercaseSearchString","toLowerCase","sort","a","b","aStartsWithSearchString","bStartsWithSearchString","localeCompare","searchList","matchingItems","item","lowercaseText","includes","push","indexOf","highlightedText"],"sources":["../../../src/utils/searchBox.ts"],"sourcesContent":["import type { ISearchBoxItem } from '../types/searchBox';\n\nconst surroundWithBTag = (text: string, startIndex: number, length: number) => {\n const before = text.substring(0, startIndex);\n const highlighted = text.substring(startIndex, startIndex + length);\n const after = text.substring(startIndex + length);\n\n return `${before}<b>${highlighted}</b>${after}`;\n};\n\nexport const getCurrentGroupName = (element: HTMLElement) => {\n let hasChildrenFound = false;\n let currentGroupName = '';\n\n const { top: parentTop } = element.getBoundingClientRect();\n const { children } = element;\n\n Array.from(children).forEach((child) => {\n if (hasChildrenFound) {\n return;\n }\n\n const { y: childrenY, height: childrenHeight } = child.getBoundingClientRect();\n const { id } = child;\n\n const sum = childrenY + childrenHeight - parentTop;\n\n if (sum >= 0) {\n hasChildrenFound = true;\n let currentGroup = id;\n\n if (id.startsWith('search-box-item__')) {\n const nummer = id.split('__')[1];\n currentGroup = nummer?.split('_').pop() ?? '';\n }\n\n currentGroupName = currentGroup;\n }\n });\n\n return currentGroupName;\n};\n\ninterface SearchListOptions {\n items: ISearchBoxItem[];\n searchString: string;\n}\n\nexport const sortSearchBoxItems = ({ searchString, items }: SearchListOptions) => {\n const lowercaseSearchString = searchString.toLowerCase();\n\n return [...items].sort((a, b) => {\n const aStartsWithSearchString = a.text.toLowerCase().startsWith(lowercaseSearchString);\n const bStartsWithSearchString = b.text.toLowerCase().startsWith(lowercaseSearchString);\n\n if (aStartsWithSearchString && !bStartsWithSearchString) {\n return -1;\n }\n if (!aStartsWithSearchString && bStartsWithSearchString) {\n return 1;\n }\n return a.text.localeCompare(b.text);\n });\n};\n\nexport const searchList = ({ searchString, items }: SearchListOptions) => {\n const matchingItems: ISearchBoxItem[] = [];\n\n const lowercaseSearchString = searchString.toLowerCase();\n\n items.forEach((item) => {\n const lowercaseText = item.text.toLowerCase();\n\n if (lowercaseText.includes(lowercaseSearchString)) {\n if (searchString === '') {\n matchingItems.push(item);\n } else {\n const startIndex = lowercaseText.indexOf(lowercaseSearchString);\n const highlightedText = surroundWithBTag(\n item.text,\n startIndex,\n searchString.length,\n );\n matchingItems.push({ ...item, text: highlightedText });\n }\n }\n });\n\n return sortSearchBoxItems({ items: matchingItems, searchString });\n};\n"],"mappings":";;;;;;AAEA,MAAMA,gBAAgB,GAAGA,CAACC,IAAY,EAAEC,UAAkB,EAAEC,MAAc,KAAK;EAC3E,MAAMC,MAAM,GAAGH,IAAI,CAACI,SAAS,CAAC,CAAC,EAAEH,UAAU,CAAC;EAC5C,MAAMI,WAAW,GAAGL,IAAI,CAACI,SAAS,CAACH,UAAU,EAAEA,UAAU,GAAGC,MAAM,CAAC;EACnE,MAAMI,KAAK,GAAGN,IAAI,CAACI,SAAS,CAACH,UAAU,GAAGC,MAAM,CAAC;EAEjD,OAAO,GAAGC,MAAM,MAAME,WAAW,OAAOC,KAAK,EAAE;AACnD,CAAC;AAEM,MAAMC,mBAAmB,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AI;UAAE5C,IAAI,EAAEiD;QAAgB,CAAC,CAAC;MAC1D;IACJ;EACJ,CAAC,CAAC;EAEF,OAAOlB,kBAAkB,CAAC;IAAEE,KAAK,EAAEU,aAAa;IAAEX;EAAa,CAAC,CAAC;AACrE,CAAC;AAACF,OAAA,CAAAY,UAAA,GAAAA,UAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.styles.js","names":["motion","styled","css","keyboardFocusHighlightingCircleRingCss","StyledRadioButton","span","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","div","StyledRadioButtonPseudoCheckBox","theme","$isChecked","StyledRadioButtonCheckBox","input","$shouldShowKeyboardHighlighting","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledRadioButtonLabel","
|
|
1
|
+
{"version":3,"file":"RadioButton.styles.js","names":["motion","styled","css","keyboardFocusHighlightingCircleRingCss","StyledRadioButton","span","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","div","StyledRadioButtonPseudoCheckBox","theme","$isChecked","StyledRadioButtonCheckBox","input","$shouldShowKeyboardHighlighting","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledRadioButtonLabel","text","StyledLabelWrapper","StyledMotionRadioButtonChildren"],"sources":["../../../../src/components/radio-button/RadioButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { keyboardFocusHighlightingCircleRingCss } from '../../utils/keyboardFocusHighlighting.styles';\n\ntype StyledRadioButtonProps = WithTheme<{\n $isDisabled: boolean;\n $radioButtonRightElementMargin: RadioButtonRightElementMargin;\n}>;\n\nexport const StyledRadioButton = styled.span<StyledRadioButtonProps>`\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n opacity: ${({ $isDisabled }: StyledRadioButtonProps) => ($isDisabled ? 0.5 : 1)};\n\n ${({ $radioButtonRightElementMargin }: StyledRadioButtonProps) => {\n switch ($radioButtonRightElementMargin) {\n case 'BOTH':\n return css`\n margin: 6px 0;\n `;\n case 'TOP':\n return css`\n margin-top: 6px;\n `;\n case 'BOTTOM':\n return css`\n margin-bottom: 6px;\n `;\n case 'NONE':\n default:\n return css`\n margin: 0;\n `;\n }\n }}\n`;\n\ntype StyledRadioButtonWrapperProps = {\n $shouldShowKeyboardHighlighting: boolean;\n};\n\nexport const StyledRadioButtonWrapper = styled.div<StyledRadioButtonWrapperProps>`\n display: flex;\n align-items: center;\n position: relative;\n gap: 5px;\n user-select: none;\n`;\n\ntype StyledRadioButtonPseudoCheckBoxProps = WithTheme<{\n $isChecked: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonPseudoCheckBox = styled.div<StyledRadioButtonPseudoCheckBoxProps>`\n background-color: ${({ theme, $isChecked }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isChecked ? theme['secondary-408'] : theme['secondary-403']};\n opacity: 1;\n border: 1px solid\n rgba(${({ theme }: StyledRadioButtonPseudoCheckBoxProps) => theme['409-rgb']}, 0.5);\n width: 15px;\n height: 15px;\n position: absolute;\n border-radius: 100%;\n z-index: 1;\n cursor: ${({ $isDisabled }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\ntype StyledRadioButtonCheckBoxProps = WithTheme<{\n $isDisabled: boolean;\n $shouldShowKeyboardHighlighting: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBox = styled.input<StyledRadioButtonCheckBoxProps>`\n opacity: 0;\n height: 15px;\n width: 15px;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible + ${StyledRadioButtonPseudoCheckBox} {\n transition: none;\n ${keyboardFocusHighlightingCircleRingCss}\n }\n `}\n`;\n\ntype StyledRadioButtonCheckBoxMarkProps = WithTheme<{\n $isHovered: boolean;\n $isSelected: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBoxMark = styled.span<StyledRadioButtonCheckBoxMarkProps>`\n background-color: transparent;\n position: absolute;\n top: 1px;\n left: 3.925px;\n display: inline-block;\n transform: rotate(35deg);\n height: 9px;\n width: 5px;\n border-bottom: 2px solid white;\n border-right: 2px solid white;\n border-top: transparent;\n border-left: transparent;\n z-index: 2;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxMarkProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n\n ${({ $isHovered, $isSelected }) => {\n if ($isSelected) {\n return css`\n opacity: 1;\n `;\n }\n\n if ($isHovered) {\n return css`\n opacity: 0.5;\n `;\n }\n\n return css`\n opacity: 0;\n `;\n }}\n`;\n\ntype StyledRadioButtonLabelProps = WithTheme<{ $isDisabled: boolean }>;\n\nexport const StyledRadioButtonLabel = styled.div<StyledRadioButtonLabelProps>`\n color: ${({ theme }: StyledRadioButtonLabelProps) => theme.text};\n margin: 0;\n cursor: ${({ $isDisabled }: StyledRadioButtonLabelProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\nexport const StyledLabelWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n gap: 12px;\n`;\n\ntype StyledMotionRadioButtonChildrenProps = WithTheme<unknown>;\n\nexport const StyledMotionRadioButtonChildren = styled(\n motion.div,\n)<StyledMotionRadioButtonChildrenProps>`\n margin-left: 20px;\n cursor: text;\n overflow: hidden;\n color: ${({ theme }: StyledMotionRadioButtonChildrenProps) => theme.text};\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,SAASC,sCAAsC,QAAQ,8CAA8C;AAOrG,OAAO,MAAMC,iBAAiB,GAAGH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QD,OAAO,MAAMa,6BAA6B,GAAGf,MAAM,CAACI,IAAwC;AAC5F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,CAAC;EAAEC;AAAgD,CAAC,KAC1DA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE;AACA,MAAM,CAAC;EAAEW,UAAU;EAAEC;AAAY,CAAC,KAAK;EAC/B,IAAIA,WAAW,EAAE;IACb,OAAOhB,GAAG;AACtB;AACA,aAAa;EACL;EAEA,IAAIe,UAAU,EAAE;IACZ,OAAOf,GAAG;AACtB;AACA,aAAa;EACL;EAEA,OAAOA,GAAG;AAClB;AACA,SAAS;AACL,CAAC;AACL,CAAC;AAID,OAAO,MAAMiB,sBAAsB,GAAGlB,MAAM,CAACQ,GAAgC;AAC7E,aAAa,CAAC;EAAEE;AAAmC,CAAC,KAAKA,KAAK,CAACS,IAAI;AACnE;AACA,cAAc,CAAC;EAAEd;AAAyC,CAAC,KACnDA,WAAW,GAAG,oBAAoB,GAAG,oBAAoB;AACjE,CAAC;AAED,OAAO,MAAMe,kBAAkB,GAAGpB,MAAM,CAACQ,GAAG;AAC5C;AACA;AACA;AACA;AACA;AACA,CAAC;AAID,OAAO,MAAMa,+BAA+B,GAAGrB,MAAM,CACjDD,MAAM,CAACS,GACX,CAAuC;AACvC;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA4C,CAAC,KAAKA,KAAK,CAACS,IAAI;AAC5E,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { useDevice } from 'chayns-api';
|
|
|
2
2
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useTheme } from 'styled-components';
|
|
4
4
|
import { calculateContentHeight } from '../../utils/calculate';
|
|
5
|
-
import { searchList } from '../../utils/searchBox';
|
|
5
|
+
import { searchList, sortSearchBoxItems } from '../../utils/searchBox';
|
|
6
6
|
import Icon from '../icon/Icon';
|
|
7
7
|
import Input from '../input/Input';
|
|
8
8
|
import GroupName from './group-name/GroupName';
|
|
@@ -13,6 +13,35 @@ import { StyledSearchBox, StyledSearchBoxHintText, StyledSearchBoxIcon, StyledSe
|
|
|
13
13
|
import { useUuid } from '../../hooks/uuid';
|
|
14
14
|
import DropdownBodyWrapper from '../dropdown-body-wrapper/DropdownBodyWrapper';
|
|
15
15
|
import TagInput from '../tag-input/TagInput';
|
|
16
|
+
const filterSearchBoxItems = ({
|
|
17
|
+
customFilter,
|
|
18
|
+
items,
|
|
19
|
+
searchString,
|
|
20
|
+
shouldUseCustomFilterOnly
|
|
21
|
+
}) => {
|
|
22
|
+
if (typeof customFilter !== 'function') {
|
|
23
|
+
return searchList({
|
|
24
|
+
items,
|
|
25
|
+
searchString
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (shouldUseCustomFilterOnly) {
|
|
29
|
+
const filteredItems = items.filter(customFilter);
|
|
30
|
+
return sortSearchBoxItems({
|
|
31
|
+
items: filteredItems,
|
|
32
|
+
searchString
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return searchList({
|
|
36
|
+
items,
|
|
37
|
+
searchString
|
|
38
|
+
}).filter(customFilter);
|
|
39
|
+
};
|
|
40
|
+
const getDropdownSearchString = ({
|
|
41
|
+
selectedId,
|
|
42
|
+
shouldKeepSelectedItemPosition,
|
|
43
|
+
value
|
|
44
|
+
}) => shouldKeepSelectedItemPosition && selectedId ? '' : value;
|
|
16
45
|
const SearchBox = /*#__PURE__*/forwardRef(({
|
|
17
46
|
container,
|
|
18
47
|
customFilter,
|
|
@@ -20,6 +49,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
20
49
|
isInvalid = false,
|
|
21
50
|
leftIcons,
|
|
22
51
|
lists,
|
|
52
|
+
maxHeight = 300,
|
|
23
53
|
onBlur,
|
|
24
54
|
onChange,
|
|
25
55
|
onKeyDown,
|
|
@@ -29,8 +59,11 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
29
59
|
hintText,
|
|
30
60
|
selectedId,
|
|
31
61
|
shouldAddInputToList = true,
|
|
62
|
+
shouldKeepSelectedItemPosition = false,
|
|
63
|
+
shouldUseCustomFilterOnly = false,
|
|
32
64
|
shouldHideFilterButtons = false,
|
|
33
65
|
shouldShowContentOnEmptyInput = true,
|
|
66
|
+
shouldShowSmallItems = false,
|
|
34
67
|
shouldShowRoundImage,
|
|
35
68
|
shouldShowToggleIcon = false,
|
|
36
69
|
tagInputSettings,
|
|
@@ -55,6 +88,11 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
55
88
|
const isAnimatingRef = useRef(false);
|
|
56
89
|
const shouldShowPresetValue = useRef(typeof presetValue === 'string' && presetValue !== '');
|
|
57
90
|
const theme = useTheme();
|
|
91
|
+
const dropdownSearchString = getDropdownSearchString({
|
|
92
|
+
selectedId,
|
|
93
|
+
shouldKeepSelectedItemPosition,
|
|
94
|
+
value
|
|
95
|
+
});
|
|
58
96
|
const {
|
|
59
97
|
isTouch
|
|
60
98
|
} = useDevice();
|
|
@@ -102,9 +140,11 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
102
140
|
list,
|
|
103
141
|
groupName
|
|
104
142
|
}) => {
|
|
105
|
-
const newList =
|
|
143
|
+
const newList = filterSearchBoxItems({
|
|
144
|
+
customFilter,
|
|
106
145
|
items: list,
|
|
107
|
-
searchString:
|
|
146
|
+
searchString: dropdownSearchString,
|
|
147
|
+
shouldUseCustomFilterOnly
|
|
108
148
|
});
|
|
109
149
|
if (newList.length > 0) {
|
|
110
150
|
newMatchingItems.push({
|
|
@@ -125,15 +165,15 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
125
165
|
}) => ({
|
|
126
166
|
groupName,
|
|
127
167
|
list: list.filter(item => {
|
|
128
|
-
if (typeof customFilter === 'function') {
|
|
129
|
-
return
|
|
168
|
+
if (typeof customFilter === 'function' && shouldUseCustomFilterOnly) {
|
|
169
|
+
return true;
|
|
130
170
|
}
|
|
131
|
-
return !(newMatchingItems.length === 1 && item.text ===
|
|
171
|
+
return !(newMatchingItems.length === 1 && item.text === dropdownSearchString);
|
|
132
172
|
})
|
|
133
173
|
}));
|
|
134
174
|
setMatchingListsItems(filteredMatchingListItems);
|
|
135
175
|
return newLists;
|
|
136
|
-
}, [groups, lists, customFilter, shouldAddInputToList,
|
|
176
|
+
}, [groups, lists, customFilter, dropdownSearchString, shouldAddInputToList, shouldUseCustomFilterOnly]);
|
|
137
177
|
const handleOpen = useCallback(() => {
|
|
138
178
|
setShouldShowBody(true);
|
|
139
179
|
}, []);
|
|
@@ -217,9 +257,11 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
217
257
|
list,
|
|
218
258
|
groupName
|
|
219
259
|
}) => {
|
|
220
|
-
const newList =
|
|
260
|
+
const newList = filterSearchBoxItems({
|
|
261
|
+
customFilter,
|
|
221
262
|
items: list,
|
|
222
|
-
searchString:
|
|
263
|
+
searchString: dropdownSearchString,
|
|
264
|
+
shouldUseCustomFilterOnly
|
|
223
265
|
});
|
|
224
266
|
if (newList.length > 0) {
|
|
225
267
|
newMatchingItems.push({
|
|
@@ -240,10 +282,10 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
240
282
|
}) => ({
|
|
241
283
|
groupName,
|
|
242
284
|
list: list.filter(item => {
|
|
243
|
-
if (typeof customFilter === 'function') {
|
|
244
|
-
return
|
|
285
|
+
if (typeof customFilter === 'function' && shouldUseCustomFilterOnly) {
|
|
286
|
+
return true;
|
|
245
287
|
}
|
|
246
|
-
return !(newMatchingItems.length === 1 && item.text ===
|
|
288
|
+
return !(newMatchingItems.length === 1 && item.text === dropdownSearchString);
|
|
247
289
|
})
|
|
248
290
|
}));
|
|
249
291
|
setMatchingListsItems(filteredMatchingListItems);
|
|
@@ -251,7 +293,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
251
293
|
handleOpen();
|
|
252
294
|
}
|
|
253
295
|
}
|
|
254
|
-
}, [shouldShowContentOnEmptyInput, activeList, shouldAddInputToList, hintText,
|
|
296
|
+
}, [shouldShowContentOnEmptyInput, activeList, shouldAddInputToList, hintText, dropdownSearchString, customFilter, shouldUseCustomFilterOnly, handleOpen]);
|
|
255
297
|
|
|
256
298
|
/**
|
|
257
299
|
* This function filters the lists by input
|
|
@@ -263,9 +305,11 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
263
305
|
list,
|
|
264
306
|
groupName
|
|
265
307
|
}) => {
|
|
266
|
-
const newList =
|
|
308
|
+
const newList = filterSearchBoxItems({
|
|
309
|
+
customFilter,
|
|
267
310
|
items: list,
|
|
268
|
-
searchString:
|
|
311
|
+
searchString: dropdownSearchString,
|
|
312
|
+
shouldUseCustomFilterOnly
|
|
269
313
|
});
|
|
270
314
|
if (newList.length > 0) {
|
|
271
315
|
newMatchingItems.push({
|
|
@@ -293,7 +337,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
293
337
|
});
|
|
294
338
|
});
|
|
295
339
|
}
|
|
296
|
-
}, [inputToListValue, activeList, shouldAddInputToList, shouldShowContentOnEmptyInput,
|
|
340
|
+
}, [inputToListValue, activeList, shouldAddInputToList, shouldShowContentOnEmptyInput, dropdownSearchString, customFilter, shouldUseCustomFilterOnly]);
|
|
297
341
|
const handleClick = useCallback(() => {
|
|
298
342
|
if (shouldShowBody) {
|
|
299
343
|
handleClose();
|
|
@@ -326,9 +370,11 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
326
370
|
list,
|
|
327
371
|
groupName
|
|
328
372
|
}) => {
|
|
329
|
-
const newList =
|
|
373
|
+
const newList = filterSearchBoxItems({
|
|
374
|
+
customFilter,
|
|
330
375
|
items: list,
|
|
331
|
-
searchString: event.target.value
|
|
376
|
+
searchString: event.target.value,
|
|
377
|
+
shouldUseCustomFilterOnly
|
|
332
378
|
});
|
|
333
379
|
if (newList.length > 0) {
|
|
334
380
|
filteredLists.push({
|
|
@@ -357,7 +403,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
357
403
|
if (typeof onChange === 'function') {
|
|
358
404
|
onChange(event);
|
|
359
405
|
}
|
|
360
|
-
}, [activeList, handleOpen, onChange, shouldAddInputToList, shouldShowContentOnEmptyInput]);
|
|
406
|
+
}, [activeList, customFilter, handleOpen, onChange, shouldAddInputToList, shouldShowContentOnEmptyInput, shouldUseCustomFilterOnly]);
|
|
361
407
|
|
|
362
408
|
/**
|
|
363
409
|
* This function handles the blur event of the input
|
|
@@ -438,6 +484,7 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
438
484
|
id: id,
|
|
439
485
|
text: text,
|
|
440
486
|
imageUrl: imageUrl,
|
|
487
|
+
shouldShowSmallItems: shouldShowSmallItems,
|
|
441
488
|
shouldShowRoundImage: shouldShowRoundImage,
|
|
442
489
|
onSelect: handleSelect,
|
|
443
490
|
groupName: groupName,
|
|
@@ -449,12 +496,13 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
449
496
|
items.push(/*#__PURE__*/React.createElement(SearchBoxItem, {
|
|
450
497
|
id: "input-value",
|
|
451
498
|
onSelect: handleSelect,
|
|
499
|
+
shouldShowSmallItems: shouldShowSmallItems,
|
|
452
500
|
text: `<b>${inputToListValue}</b`,
|
|
453
501
|
tabIndex: items.length === 0 ? 0 : -1
|
|
454
502
|
}));
|
|
455
503
|
}
|
|
456
504
|
return items;
|
|
457
|
-
}, [hintText, matchingListsItems, shouldAddInputToList, inputToListValue, value, hasMultipleGroups, shouldShowRoundImage, handleSelect]);
|
|
505
|
+
}, [hintText, matchingListsItems, shouldAddInputToList, inputToListValue, value, hasMultipleGroups, shouldShowSmallItems, shouldShowRoundImage, handleSelect]);
|
|
458
506
|
useEffect(() => {
|
|
459
507
|
const handleKeyDown = e => {
|
|
460
508
|
if (!shouldShowBody || matchingListsItems.length === 0) {
|
|
@@ -585,13 +633,14 @@ const SearchBox = /*#__PURE__*/forwardRef(({
|
|
|
585
633
|
}, /*#__PURE__*/React.createElement(SearchBoxBody, {
|
|
586
634
|
filterButtons: filterButtons,
|
|
587
635
|
height: height,
|
|
636
|
+
maxHeight: maxHeight,
|
|
588
637
|
shouldShow: shouldShowDropdown,
|
|
589
638
|
key: `search-box-body-${uuid}`,
|
|
590
639
|
onGroupSelect: handleFilterButtonsGroupSelect,
|
|
591
640
|
ref: contentRef,
|
|
592
641
|
selectedGroups: groups,
|
|
593
642
|
shouldHideFilterButtons: shouldHideFilterButtons
|
|
594
|
-
}, content))), [container, content, dropdownDirection, filterButtons, groups, handleBlur, handleChange, handleClose, handleDropdownOutsideClick, handleFocus, height, isInvalid, leftElement, onKeyDown, placeholder, rightElement, shouldHideFilterButtons, shouldShowDropdown, shouldEnableKeyboardHighlighting, tagInputSettings, uuid, value]);
|
|
643
|
+
}, content))), [container, content, dropdownDirection, filterButtons, groups, handleBlur, handleChange, handleClose, handleDropdownOutsideClick, handleFocus, height, isInvalid, leftElement, maxHeight, onKeyDown, placeholder, rightElement, shouldHideFilterButtons, shouldShowDropdown, shouldEnableKeyboardHighlighting, tagInputSettings, uuid, value]);
|
|
595
644
|
});
|
|
596
645
|
SearchBox.displayName = 'SearchBox';
|
|
597
646
|
export default SearchBox;
|