@chayns-components/core 5.6.11 → 5.6.14
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/AGENTS.md +13 -0
- package/lib/cjs/components/popup/Popup.js +52 -38
- package/lib/cjs/components/popup/Popup.js.map +1 -1
- package/lib/cjs/components/popup/Popup.styles.js +11 -1
- package/lib/cjs/components/popup/Popup.styles.js.map +1 -1
- package/lib/cjs/components/popup/Popup.test.js +259 -0
- package/lib/cjs/components/popup/Popup.test.js.map +1 -0
- package/lib/cjs/components/popup/Popup.types.js.map +1 -1
- package/lib/cjs/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js +2 -2
- package/lib/cjs/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js.map +1 -1
- package/lib/cjs/components/popup/popupPosition.js +33 -0
- package/lib/cjs/components/popup/popupPosition.js.map +1 -0
- package/lib/cjs/components/popup/popupPosition.test.js +47 -0
- package/lib/cjs/components/popup/popupPosition.test.js.map +1 -0
- package/lib/cjs/components/search-box/SearchBox.js +1 -2
- package/lib/cjs/components/search-box/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-box/search-box-item/SearchBoxItem.js +2 -1
- package/lib/cjs/components/search-box/search-box-item/SearchBoxItem.js.map +1 -1
- package/lib/cjs/utils/searchBox.js +3 -1
- package/lib/cjs/utils/searchBox.js.map +1 -1
- package/lib/cjs/utils/searchBox.test.js +13 -0
- package/lib/cjs/utils/searchBox.test.js.map +1 -1
- package/lib/esm/components/popup/Popup.js +54 -40
- package/lib/esm/components/popup/Popup.js.map +1 -1
- package/lib/esm/components/popup/Popup.styles.js +10 -0
- package/lib/esm/components/popup/Popup.styles.js.map +1 -1
- package/lib/esm/components/popup/Popup.test.js +254 -0
- package/lib/esm/components/popup/Popup.test.js.map +1 -0
- package/lib/esm/components/popup/Popup.types.js.map +1 -1
- package/lib/esm/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js +2 -2
- package/lib/esm/components/popup/popup-content-wrapper/PopupContentWrapper.styles.js.map +1 -1
- package/lib/esm/components/popup/popupPosition.js +26 -0
- package/lib/esm/components/popup/popupPosition.js.map +1 -0
- package/lib/esm/components/popup/popupPosition.test.js +45 -0
- package/lib/esm/components/popup/popupPosition.test.js.map +1 -0
- package/lib/esm/components/search-box/SearchBox.js +2 -3
- package/lib/esm/components/search-box/SearchBox.js.map +1 -1
- package/lib/esm/components/search-box/search-box-item/SearchBoxItem.js +2 -1
- package/lib/esm/components/search-box/search-box-item/SearchBoxItem.js.map +1 -1
- package/lib/esm/utils/searchBox.js +1 -0
- package/lib/esm/utils/searchBox.js.map +1 -1
- package/lib/esm/utils/searchBox.test.js +14 -1
- package/lib/esm/utils/searchBox.test.js.map +1 -1
- package/lib/types/components/popup/Popup.styles.d.ts +3 -0
- package/lib/types/components/popup/Popup.types.d.ts +16 -0
- package/lib/types/components/popup/popupPosition.d.ts +15 -0
- package/lib/types/utils/searchBox.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popup.test.js","names":["_react","require","_react2","_interopRequireWildcard","_vitest","_popup","_Popup","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","measurement","vi","hoisted","width","height","mock","useMeasuredClone","measuredElement","useSite","colorMode","PopupSurface","React","forwardRef","children","coordinates","offset","alignment","ref","createElement","x","y","displayName","container","triggerLeft","containerWidth","containerLeft","zoom","getRect","content","surface","element","document","querySelector","Error","number","name","Number","dataset","popup","props","isControlled","StrictMode","isOpen","undefined","shouldUseChildrenWidth","boundaryInsets","shouldScrollWithContent","onShow","onHide","type","beforeEach","body","append","value","spyOn","HTMLElement","prototype","mockImplementation","getFixtureRect","DOMRect","afterEach","remove","restoreAllMocks","describe","it","rerender","render","waitFor","expect","toBe","before","left","right","toEqual","fn","PopupAlignment","BottomLeft","firstElementChild","toHaveStyle","maxWidth","toHaveBeenCalledTimes","not","toHaveBeenCalled","BottomRight","unmount","act","scrollLeft","fireEvent","scroll","resize","window","toHaveBeenCalledWith","any","Function","configurable","getBodyRect","getByRole","click","_surface$firstElement","paragraph","getAttribute","toContain"],"sources":["../../../../src/components/popup/Popup.test.tsx"],"sourcesContent":["import { act, fireEvent, render, waitFor } from '@testing-library/react';\nimport React, { type ReactNode, StrictMode } from 'react';\nimport { afterEach, beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest';\nimport { PopupAlignment } from '../../types/popup';\nimport Popup, { type PopupProps } from './Popup';\n\nconst measurement = vi.hoisted(() => ({ width: 250, height: 90 }));\nvi.mock('../../hooks/element', () => ({\n useMeasuredClone: () => ({ ...measurement, measuredElement: null }),\n}));\nvi.mock('chayns-api', () => ({ useSite: () => ({ colorMode: 0 }) }));\nvi.mock('./popup-content-wrapper/PopupContentWrapper', () => {\n const PopupSurface = React.forwardRef<\n HTMLDivElement,\n {\n children: ReactNode;\n coordinates: { x: number; y: number };\n offset: number;\n alignment: PopupAlignment;\n width: number;\n }\n >(({ children, coordinates, offset, alignment, width }, ref) => (\n <div\n ref={ref}\n data-surface\n data-x={coordinates.x}\n data-y={coordinates.y}\n data-offset={offset}\n data-alignment={alignment}\n data-width={width}\n >\n {children}\n </div>\n ));\n PopupSurface.displayName = 'PopupSurface';\n return { default: PopupSurface };\n});\n\nlet container: HTMLDivElement;\nlet triggerLeft: number;\nlet containerWidth: number;\nlet containerLeft: number;\nlet zoom: number;\nlet getRect: MockInstance<[], DOMRect>;\nconst content = <p>Popup hint</p>;\nconst surface = () => {\n const element = document.querySelector<HTMLElement>('[data-surface]');\n if (!element) throw new Error('Popup surface missing');\n return element;\n};\nconst number = (name: string) => Number(surface().dataset[name]);\nconst popup = (props: Partial<PopupProps> = {}, isControlled = true) => (\n <StrictMode>\n <Popup\n content={content}\n container={container}\n isOpen={isControlled ? true : undefined}\n shouldUseChildrenWidth\n alignment={props.alignment}\n boundaryInsets={props.boundaryInsets}\n shouldScrollWithContent={props.shouldScrollWithContent}\n onShow={props.onShow}\n onHide={props.onHide}\n >\n <button type=\"button\">Trigger</button>\n </Popup>\n </StrictMode>\n);\n\nbeforeEach(() => {\n triggerLeft = 270;\n containerWidth = 390;\n containerLeft = 0;\n zoom = 1;\n measurement.width = 250;\n measurement.height = 90;\n container = document.createElement('div');\n document.body.append(container);\n Object.defineProperty(container, 'offsetWidth', { get: () => containerWidth / zoom });\n Object.defineProperty(container, 'offsetHeight', { value: 800 });\n Object.defineProperty(container, 'clientHeight', { value: 800 });\n getRect = vi\n .spyOn(HTMLElement.prototype, 'getBoundingClientRect')\n .mockImplementation(function getFixtureRect(this: HTMLElement) {\n if (this === container) return new DOMRect(containerLeft, 0, containerWidth, 800);\n return new DOMRect(triggerLeft, 20, 26, 26);\n });\n});\n\nafterEach(() => {\n container.remove();\n vi.restoreAllMocks();\n});\n\ndescribe('Popup boundary insets', () => {\n it('preserves the legacy position when omitted or zero', async () => {\n const { rerender } = render(popup());\n await waitFor(() => expect(number('x')).toBe(283));\n expect(number('offset')).toBe(0);\n const before = { ...surface().dataset };\n rerender(popup({ boundaryInsets: { left: 0, right: 0 } }));\n expect({ ...surface().dataset }).toEqual(before);\n });\n\n it('updates an open popup when only its insets change and restores its position', async () => {\n triggerLeft = 320;\n const onShow = vi.fn();\n const onHide = vi.fn();\n const { rerender } = render(popup({ onShow, onHide }));\n await waitFor(() => expect(number('x')).toBe(333));\n rerender(popup({ boundaryInsets: { left: 17, right: 43 }, onShow, onHide }));\n await waitFor(() => expect(number('x')).toBe(311));\n expect(number('alignment')).toBe(PopupAlignment.BottomLeft);\n expect(number('offset')).toBe(-22);\n expect(surface().firstElementChild).toHaveStyle({ maxWidth: '284px' });\n rerender(popup({ onShow, onHide }));\n await waitFor(() => expect(number('x')).toBe(333));\n expect(onShow).toHaveBeenCalledTimes(1);\n expect(onHide).not.toHaveBeenCalled();\n });\n\n it('shifts right-aligned popups left and keeps the arrow at the trigger', async () => {\n render(popup({ boundaryInsets: { right: 59 }, alignment: PopupAlignment.BottomRight }));\n await waitFor(() => expect(number('x')).toBe(71));\n expect(number('offset')).toBe(212);\n expect(number('x') + number('offset')).toBe(283);\n });\n\n it('repositions on scrolling and rotation in scaled, offset containers', async () => {\n zoom = 2;\n containerLeft = 100;\n containerWidth = 780;\n triggerLeft = 700;\n const { unmount } = render(popup({ boundaryInsets: { right: 59 } }));\n await waitFor(() => expect(number('x')).toBe(295));\n act(() => {\n container.scrollLeft = 80;\n fireEvent.scroll(container);\n });\n await waitFor(() => expect(number('x')).toBe(375));\n act(() => {\n containerWidth = 1000;\n fireEvent.resize(window);\n });\n await waitFor(() => expect(surface().firstElementChild).toHaveStyle({ maxWidth: '395px' }));\n const remove = vi.spyOn(window, 'removeEventListener');\n unmount();\n expect(remove).toHaveBeenCalledWith('resize', expect.any(Function));\n expect(remove).toHaveBeenCalledWith('scroll', expect.any(Function), true);\n });\n\n it('uses body geometry for fixed popups', async () => {\n Object.defineProperty(document.body, 'offsetWidth', { configurable: true, value: 390 });\n Object.defineProperty(document.body, 'offsetHeight', { configurable: true, value: 800 });\n getRect.mockImplementation(function getBodyRect(this: HTMLElement) {\n return this === document.body\n ? new DOMRect(0, 0, 390, 800)\n : new DOMRect(320, 20, 26, 26);\n });\n render(popup({ shouldScrollWithContent: false, boundaryInsets: { right: 59 } }));\n await waitFor(() => expect(number('x')).toBe(295));\n });\n\n it('updates an uncontrolled open popup when insets change or are removed', async () => {\n triggerLeft = 320;\n const { getByRole, rerender } = render(popup({}, false));\n fireEvent.click(getByRole('button', { name: 'Trigger' }));\n await waitFor(() => expect(number('x')).toBe(333));\n rerender(popup({ boundaryInsets: { right: 59 } }, false));\n await waitFor(() => expect(number('x')).toBe(295));\n rerender(popup({}, false));\n await waitFor(() => expect(number('x')).toBe(333));\n });\n\n it('retains content when configured insets change between zero and nonzero', async () => {\n const { rerender } = render(popup({ boundaryInsets: { left: 0, right: 0 } }));\n await waitFor(() => expect(number('x')).toBe(283));\n const paragraph = surface().querySelector('p');\n rerender(popup({ boundaryInsets: { right: 59 } }));\n expect(surface().querySelector('p')).toBe(paragraph);\n rerender(popup({ boundaryInsets: { right: 0 } }));\n expect(surface().querySelector('p')).toBe(paragraph);\n expect(surface().firstElementChild?.getAttribute('style') ?? '').not.toContain('max-width');\n });\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAC,sBAAA,CAAAN,OAAA;AAAiD,SAAAM,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAK,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAS,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,C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AJ,cAAM,EAACvC,OAAO,CAAC,CAAC,CAACG,aAAa,CAAC,GAAG,CAAC,CAAC,CAACqC,IAAI,CAAC8B,SAAS,CAAC;IACpDlC,QAAQ,CAAC3B,KAAK,CAAC;MAAEO,cAAc,EAAE;QAAE2B,KAAK,EAAE;MAAE;IAAE,CAAC,CAAC,CAAC;IACjD,IAAAJ,cAAM,EAACvC,OAAO,CAAC,CAAC,CAACG,aAAa,CAAC,GAAG,CAAC,CAAC,CAACqC,IAAI,CAAC8B,SAAS,CAAC;IACpD,IAAA/B,cAAM,EAAC,EAAA8B,qBAAA,GAAArE,OAAO,CAAC,CAAC,CAACgD,iBAAiB,cAAAqB,qBAAA,uBAA3BA,qBAAA,CAA6BE,YAAY,CAAC,OAAO,CAAC,KAAI,EAAE,CAAC,CAACnB,GAAG,CAACoB,SAAS,CAAC,WAAW,CAAC;EAC/F,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popup.types.js","names":[],"sources":["../../../../src/components/popup/Popup.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { PopupAlignment } from '../../types/popup';\n\nexport type PopupProps = {\n /**\n * The preferred alignment of the popup relative to its trigger element.\n * @description\n * Use this prop to influence where the popup should appear around its trigger. If no alignment is provided,\n * the component automatically chooses a suitable position based on the available space.\n * @example\n * <Popup alignment={PopupAlignment.BottomRight} content=\"Details\">Open</Popup>\n * @optional\n */\n alignment?: PopupAlignment;\n /**\n * The trigger element that the popup is attached to.\n * @description\n * This content is rendered in place and acts as the interactive anchor for the popup.\n * Depending on the configured behavior, clicking or hovering this element can show or hide the popup.\n * @example\n * <Popup content=\"Details\"><button type=\"button\">Open</button></Popup>\n * @optional\n */\n children?: ReactNode;\n /**\n * The DOM element that should receive the popup portal.\n * @description\n * By default, the popup resolves a suitable container automatically. Use this prop when the popup should be rendered\n * into a specific element instead, for example to keep it inside a dialog or another scrollable area.\n * @example\n * <Popup container={document.body} content=\"Details\">Open</Popup>\n * @optional\n */\n container?: Element;\n /**\n * The content rendered inside the popup.\n * @description\n * This can be any React node, such as text, markup, or a fully custom component tree.\n * @example\n * <Popup content={<div>Additional information</div>}>Open</Popup>\n */\n content: ReactNode;\n /**\n * Fully controls whether the popup is visible.\n * @description\n * When this prop receives a boolean value, the popup becomes fully controlled from the outside.\n * Internal triggers such as click, hover, outside click, blur handling, or imperative `show` and `hide`\n * calls no longer change the visibility state. The popup is then shown only when `isOpen` is `true`\n * and hidden only when `isOpen` is `false`.\n * @example\n * <Popup isOpen={isPopupOpen} content=\"Details\">Open</Popup>\n * @optional\n */\n isOpen?: boolean;\n /**\n * Callback that is called after the popup becomes hidden.\n * @description\n * Use this callback to react to the popup closing, for example to synchronize external UI state.\n * It is called when the effective popup visibility changes from open to closed.\n * @example\n * <Popup onHide={() => console.log('Popup hidden')} content=\"Details\">Open</Popup>\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Callback that is called after the popup becomes visible.\n * @description\n * Use this callback to react to the popup opening, for example to start related UI behavior or analytics.\n * It is called when the effective popup visibility changes from closed to open.\n * @example\n * <Popup onShow={() => console.log('Popup shown')} content=\"Details\">Open</Popup>\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Hides the popup when the pointer leaves the trigger element.\n * @description\n * This prop is only relevant when `shouldShowOnHover` is enabled. When set to `true`, the popup closes immediately\n * after the pointer leaves the trigger element instead of waiting for the delayed hide behavior.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover shouldHideOnChildrenLeave content=\"Details\">Open</Popup>\n * @optional\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Keeps the popup aligned within the scrolling content container.\n * @description\n * When set to `true`, the popup uses the resolved container for positioning and scroll synchronization.\n * When set to `false`, it is positioned relative to the document body instead.\n * @default true\n * @example\n * <Popup shouldScrollWithContent={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldScrollWithContent?: boolean;\n /**\n * Opens the popup when the trigger element is hovered instead of clicked.\n * @description\n * By default, the popup opens on click. Set this prop to `true` to switch to hover-based interaction.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover content=\"Details\">Open</Popup>\n * @optional\n */\n shouldShowOnHover?: boolean;\n /**\n * Uses the trigger element width as the popup width reference.\n * @description\n * When enabled, the popup measurement and layout respect the width of the trigger element.\n * Disable this when the popup should size itself more freely based on its content.\n * @default true\n * @example\n * <Popup shouldUseChildrenWidth={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Stretches the trigger element to the full available width.\n * @description\n * This affects the wrapper around the popup trigger and is useful when the trigger should behave like a block-level element.\n * @default false\n * @example\n * <Popup shouldUseFullWidth content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Requests that the popup should be opened from outside.\n * @description\n * Unlike `isOpen`, this prop does not fully control visibility. It acts as an external open trigger and keeps compatibility\n * with the existing behavior, while other internal interactions may still influence the popup state.\n * Use `isOpen` when you need full external control over showing and hiding the popup.\n * @default false\n * @example\n * <Popup shouldBeOpen={shouldOpenInitially} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldBeOpen?: boolean;\n /**\n * Vertical offset between the trigger element and the popup.\n * @description\n * Use this prop to fine-tune the popup position on the Y axis. Positive and negative values can be used depending on the desired spacing.\n * @default 0\n * @example\n * <Popup yOffset={8} content=\"Details\">Open</Popup>\n * @optional\n */\n yOffset?: number;\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Popup.types.js","names":[],"sources":["../../../../src/components/popup/Popup.types.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport { PopupAlignment } from '../../types/popup';\n\nexport type PopupProps = {\n /**\n * The preferred alignment of the popup relative to its trigger element.\n * @description\n * Use this prop to influence where the popup should appear around its trigger. If no alignment is provided,\n * the component automatically chooses a suitable position based on the available space.\n * @example\n * <Popup alignment={PopupAlignment.BottomRight} content=\"Details\">Open</Popup>\n * @optional\n */\n alignment?: PopupAlignment;\n /**\n * The trigger element that the popup is attached to.\n * @description\n * This content is rendered in place and acts as the interactive anchor for the popup.\n * Depending on the configured behavior, clicking or hovering this element can show or hide the popup.\n * @example\n * <Popup content=\"Details\"><button type=\"button\">Open</button></Popup>\n * @optional\n */\n children?: ReactNode;\n /**\n * Additional horizontal insets inside the positioning container, in CSS pixels.\n * @description\n * Reserve space for safe areas or host controls without moving the trigger. Each side defaults\n * to zero and is added to the standard popup edge spacing. Insets use the positioning container's\n * unscaled coordinate space; fixed popups use the document body. Updating the values repositions\n * an open popup. Oversized content is constrained to the remaining width and allowed to wrap.\n * @default { left: 0, right: 0 }\n * @example\n * <Popup boundaryInsets={{ left: 17, right: 43 }} content=\"Details\">Open</Popup>\n * @optional\n */\n boundaryInsets?: { left?: number; right?: number };\n /**\n * The DOM element that should receive the popup portal.\n * @description\n * By default, the popup resolves a suitable container automatically. Use this prop when the popup should be rendered\n * into a specific element instead, for example to keep it inside a dialog or another scrollable area.\n * @example\n * <Popup container={document.body} content=\"Details\">Open</Popup>\n * @optional\n */\n container?: Element;\n /**\n * The content rendered inside the popup.\n * @description\n * This can be any React node, such as text, markup, or a fully custom component tree.\n * @example\n * <Popup content={<div>Additional information</div>}>Open</Popup>\n */\n content: ReactNode;\n /**\n * Fully controls whether the popup is visible.\n * @description\n * When this prop receives a boolean value, the popup becomes fully controlled from the outside.\n * Internal triggers such as click, hover, outside click, blur handling, or imperative `show` and `hide`\n * calls no longer change the visibility state. The popup is then shown only when `isOpen` is `true`\n * and hidden only when `isOpen` is `false`.\n * @example\n * <Popup isOpen={isPopupOpen} content=\"Details\">Open</Popup>\n * @optional\n */\n isOpen?: boolean;\n /**\n * Callback that is called after the popup becomes hidden.\n * @description\n * Use this callback to react to the popup closing, for example to synchronize external UI state.\n * It is called when the effective popup visibility changes from open to closed.\n * @example\n * <Popup onHide={() => console.log('Popup hidden')} content=\"Details\">Open</Popup>\n * @optional\n */\n onHide?: VoidFunction;\n /**\n * Callback that is called after the popup becomes visible.\n * @description\n * Use this callback to react to the popup opening, for example to start related UI behavior or analytics.\n * It is called when the effective popup visibility changes from closed to open.\n * @example\n * <Popup onShow={() => console.log('Popup shown')} content=\"Details\">Open</Popup>\n * @optional\n */\n onShow?: VoidFunction;\n /**\n * Hides the popup when the pointer leaves the trigger element.\n * @description\n * This prop is only relevant when `shouldShowOnHover` is enabled. When set to `true`, the popup closes immediately\n * after the pointer leaves the trigger element instead of waiting for the delayed hide behavior.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover shouldHideOnChildrenLeave content=\"Details\">Open</Popup>\n * @optional\n */\n shouldHideOnChildrenLeave?: boolean;\n /**\n * Keeps the popup aligned within the scrolling content container.\n * @description\n * When set to `true`, the popup uses the resolved container for positioning and scroll synchronization.\n * When set to `false`, it is positioned relative to the document body instead.\n * @default true\n * @example\n * <Popup shouldScrollWithContent={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldScrollWithContent?: boolean;\n /**\n * Opens the popup when the trigger element is hovered instead of clicked.\n * @description\n * By default, the popup opens on click. Set this prop to `true` to switch to hover-based interaction.\n * This prop has no effect while `isOpen` is used as a controlled prop.\n * @default false\n * @example\n * <Popup shouldShowOnHover content=\"Details\">Open</Popup>\n * @optional\n */\n shouldShowOnHover?: boolean;\n /**\n * Uses the trigger element width as the popup width reference.\n * @description\n * When enabled, the popup measurement and layout respect the width of the trigger element.\n * Disable this when the popup should size itself more freely based on its content.\n * @default true\n * @example\n * <Popup shouldUseChildrenWidth={false} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseChildrenWidth?: boolean;\n /**\n * Stretches the trigger element to the full available width.\n * @description\n * This affects the wrapper around the popup trigger and is useful when the trigger should behave like a block-level element.\n * @default false\n * @example\n * <Popup shouldUseFullWidth content=\"Details\">Open</Popup>\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Requests that the popup should be opened from outside.\n * @description\n * Unlike `isOpen`, this prop does not fully control visibility. It acts as an external open trigger and keeps compatibility\n * with the existing behavior, while other internal interactions may still influence the popup state.\n * Use `isOpen` when you need full external control over showing and hiding the popup.\n * @default false\n * @example\n * <Popup shouldBeOpen={shouldOpenInitially} content=\"Details\">Open</Popup>\n * @optional\n */\n shouldBeOpen?: boolean;\n /**\n * Vertical offset between the trigger element and the popup.\n * @description\n * Use this prop to fine-tune the popup position on the Y axis. Positive and negative values can be used depending on the desired spacing.\n * @default 0\n * @example\n * <Popup yOffset={8} content=\"Details\">Open</Popup>\n * @optional\n */\n yOffset?: number;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -54,13 +54,13 @@ const StyledMotionPopupContentWrapper = exports.StyledMotionPopupContentWrapper
|
|
|
54
54
|
case _popup.PopupAlignment.TopCenter:
|
|
55
55
|
return (0, _styledComponents.css)`
|
|
56
56
|
bottom: -7px;
|
|
57
|
-
left: calc(50% - 7px);
|
|
57
|
+
left: calc(50% - 7px + ${$offset}px);
|
|
58
58
|
transform: rotate(45deg);
|
|
59
59
|
`;
|
|
60
60
|
case _popup.PopupAlignment.BottomCenter:
|
|
61
61
|
return (0, _styledComponents.css)`
|
|
62
62
|
top: -7px;
|
|
63
|
-
left: calc(50% - 7px);
|
|
63
|
+
left: calc(50% - 7px + ${$offset}px);
|
|
64
64
|
transform: rotate(225deg);
|
|
65
65
|
`;
|
|
66
66
|
case _popup.PopupAlignment.TopRight:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupContentWrapper.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_popup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionPopupContentWrapper","exports","styled","motion","div","theme","text","$shouldScrollWithContent","$position","$offset","PopupAlignment","TopLeft","css","BottomLeft","TopCenter","BottomCenter","TopRight","BottomRight","undefined","StyledPopupContentWrapperContent","$maxHeight"],"sources":["../../../../../src/components/popup/popup-content-wrapper/PopupContentWrapper.styles.ts"],"sourcesContent":["import { ColorMode } from 'chayns-api';\nimport { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { PopupAlignment } from '../../../types/popup';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionPopupContentWrapperProps = WithTheme<{\n $position: PopupAlignment;\n $colorMode: ColorMode;\n $offset: number;\n $shouldScrollWithContent: boolean;\n}>;\n\nexport const StyledMotionPopupContentWrapper = styled(\n motion.div,\n)<StyledMotionPopupContentWrapperProps>`\n background-color: ${({ theme }: StyledMotionPopupContentWrapperProps) => theme['000']};\n border-radius: 3px;\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n color: ${({ theme }: StyledMotionPopupContentWrapperProps) => theme.text};\n z-index: 100;\n position: ${({ $shouldScrollWithContent }) =>\n $shouldScrollWithContent ? 'absolute' : 'fixed'};\n pointer-events: all;\n\n &::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ $position, $offset }) => {\n switch ($position) {\n case PopupAlignment.TopLeft:\n return css`\n bottom: -7px;\n right: ${5 + $offset}px;\n transform: rotate(45deg);\n `;\n case PopupAlignment.BottomLeft:\n return css`\n top: -7px;\n right: ${5 + $offset}px;\n transform: rotate(225deg);\n `;\n case PopupAlignment.TopCenter:\n return css`\n bottom: -7px;\n left: calc(50% - 7px);\n transform: rotate(45deg);\n `;\n case PopupAlignment.BottomCenter:\n return css`\n top: -7px;\n left: calc(50% - 7px);\n transform: rotate(225deg);\n `;\n case PopupAlignment.TopRight:\n return css`\n transform: rotate(45deg);\n bottom: -7px;\n left: ${5 + $offset}px;\n `;\n case PopupAlignment.BottomRight:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: ${5 + $offset}px;\n `;\n default:\n return undefined;\n }\n }}\n }\n\n &::before {\n background-color: inherit;\n border-radius: 3px;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n }\n`;\n\ntype StyledPopupContentWrapperContentProps = WithTheme<{\n $maxHeight?: number;\n}>;\n\nexport const StyledPopupContentWrapperContent = styled.div<StyledPopupContentWrapperContentProps>`\n height: 100%;\n width: 100%;\n\n ${({ $maxHeight }) =>\n $maxHeight &&\n css`\n max-height: ${$maxHeight}px;\n overflow-y: auto;\n overflow-x: hidden;\n `}\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAsD,SAAAE,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,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAU/C,MAAMkB,+BAA+B,GAAAC,OAAA,CAAAD,+BAAA,GAAG,IAAAE,yBAAM,EACjDC,aAAM,CAACC,GACX,CAAuC;AACvC,wBAAwB,CAAC;EAAEC;AAA4C,CAAC,KAAKA,KAAK,CAAC,KAAK,CAAC;AACzF;AACA;AACA,aAAa,CAAC;EAAEA;AAA4C,CAAC,KAAKA,KAAK,CAACC,IAAI;AAC5E;AACA,gBAAgB,CAAC;EAAEC;AAAyB,CAAC,KACrCA,wBAAwB,GAAG,UAAU,GAAG,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,CAAC;EAAEC,SAAS;EAAEC;AAAQ,CAAC,KAAK;EAC1B,QAAQD,SAAS;IACb,KAAKE,qBAAc,CAACC,OAAO;MACvB,OAAO,IAAAC,qBAAG;AAC9B;AACA,iCAAiC,CAAC,GAAGH,OAAO;AAC5C;AACA,qBAAqB;IACL,KAAKC,qBAAc,CAACG,UAAU;MAC1B,OAAO,IAAAD,qBAAG;AAC9B;AACA,iCAAiC,CAAC,GAAGH,OAAO;AAC5C;AACA,qBAAqB;IACL,KAAKC,qBAAc,CAACI,SAAS;MACzB,OAAO,IAAAF,qBAAG;AAC9B;AACA;
|
|
1
|
+
{"version":3,"file":"PopupContentWrapper.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_popup","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledMotionPopupContentWrapper","exports","styled","motion","div","theme","text","$shouldScrollWithContent","$position","$offset","PopupAlignment","TopLeft","css","BottomLeft","TopCenter","BottomCenter","TopRight","BottomRight","undefined","StyledPopupContentWrapperContent","$maxHeight"],"sources":["../../../../../src/components/popup/popup-content-wrapper/PopupContentWrapper.styles.ts"],"sourcesContent":["import { ColorMode } from 'chayns-api';\nimport { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { PopupAlignment } from '../../../types/popup';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledMotionPopupContentWrapperProps = WithTheme<{\n $position: PopupAlignment;\n $colorMode: ColorMode;\n $offset: number;\n $shouldScrollWithContent: boolean;\n}>;\n\nexport const StyledMotionPopupContentWrapper = styled(\n motion.div,\n)<StyledMotionPopupContentWrapperProps>`\n background-color: ${({ theme }: StyledMotionPopupContentWrapperProps) => theme['000']};\n border-radius: 3px;\n box-shadow: 1px 3px 8px rgb(0 0 0 / 30%);\n color: ${({ theme }: StyledMotionPopupContentWrapperProps) => theme.text};\n z-index: 100;\n position: ${({ $shouldScrollWithContent }) =>\n $shouldScrollWithContent ? 'absolute' : 'fixed'};\n pointer-events: all;\n\n &::after {\n background-color: inherit;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n border-right: 1px solid rgba(0, 0, 0, 0.1);\n box-shadow: 2px 2px 8px rgb(4 3 4 / 10%);\n content: '';\n height: 14px;\n position: absolute;\n width: 14px;\n z-index: -2;\n\n ${({ $position, $offset }) => {\n switch ($position) {\n case PopupAlignment.TopLeft:\n return css`\n bottom: -7px;\n right: ${5 + $offset}px;\n transform: rotate(45deg);\n `;\n case PopupAlignment.BottomLeft:\n return css`\n top: -7px;\n right: ${5 + $offset}px;\n transform: rotate(225deg);\n `;\n case PopupAlignment.TopCenter:\n return css`\n bottom: -7px;\n left: calc(50% - 7px + ${$offset}px);\n transform: rotate(45deg);\n `;\n case PopupAlignment.BottomCenter:\n return css`\n top: -7px;\n left: calc(50% - 7px + ${$offset}px);\n transform: rotate(225deg);\n `;\n case PopupAlignment.TopRight:\n return css`\n transform: rotate(45deg);\n bottom: -7px;\n left: ${5 + $offset}px;\n `;\n case PopupAlignment.BottomRight:\n return css`\n transform: rotate(225deg);\n top: -7px;\n left: ${5 + $offset}px;\n `;\n default:\n return undefined;\n }\n }}\n }\n\n &::before {\n background-color: inherit;\n border-radius: 3px;\n bottom: 0;\n content: '';\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n }\n`;\n\ntype StyledPopupContentWrapperContentProps = WithTheme<{\n $maxHeight?: number;\n}>;\n\nexport const StyledPopupContentWrapperContent = styled.div<StyledPopupContentWrapperContentProps>`\n height: 100%;\n width: 100%;\n\n ${({ $maxHeight }) =>\n $maxHeight &&\n css`\n max-height: ${$maxHeight}px;\n overflow-y: auto;\n overflow-x: hidden;\n `}\n`;\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAsD,SAAAE,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,gB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AAc,CAACK,YAAY;MAC5B,OAAO,IAAAH,qBAAG;AAC9B;AACA,iDAAiDH,OAAO;AACxD;AACA,qBAAqB;IACL,KAAKC,qBAAc,CAACM,QAAQ;MACxB,OAAO,IAAAJ,qBAAG;AAC9B;AACA;AACA,gCAAgC,CAAC,GAAGH,OAAO;AAC3C,qBAAqB;IACL,KAAKC,qBAAc,CAACO,WAAW;MAC3B,OAAO,IAAAL,qBAAG;AAC9B;AACA;AACA,gCAAgC,CAAC,GAAGH,OAAO;AAC3C,qBAAqB;IACL;MACI,OAAOS,SAAS;EACxB;AACJ,CAAC;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAMM,MAAMC,gCAAgC,GAAAlB,OAAA,CAAAkB,gCAAA,GAAGjB,yBAAM,CAACE,GAA0C;AACjG;AACA;AACA;AACA,MAAM,CAAC;EAAEgB;AAAW,CAAC,KACbA,UAAU,IACV,IAAAR,qBAAG;AACX,0BAA0BQ,UAAU;AACpC;AACA;AACA,SAAS;AACT,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPopupInsetPosition = exports.POPUP_HORIZONTAL_PADDING = void 0;
|
|
7
|
+
var _popup = require("../../types/popup");
|
|
8
|
+
const POPUP_HORIZONTAL_PADDING = exports.POPUP_HORIZONTAL_PADDING = 23;
|
|
9
|
+
const POPUP_ANCHOR_OFFSET = 13;
|
|
10
|
+
/** Constrain the popup surface while keeping its arrow attached to the trigger. */
|
|
11
|
+
const getPopupInsetPosition = ({
|
|
12
|
+
alignment,
|
|
13
|
+
anchorX,
|
|
14
|
+
boundaryLeft,
|
|
15
|
+
boundaryWidth,
|
|
16
|
+
width
|
|
17
|
+
}) => {
|
|
18
|
+
const isLeft = alignment === _popup.PopupAlignment.TopLeft || alignment === _popup.PopupAlignment.BottomLeft;
|
|
19
|
+
const isCenter = alignment === _popup.PopupAlignment.TopCenter || alignment === _popup.PopupAlignment.BottomCenter;
|
|
20
|
+
let surfaceOffset = -POPUP_ANCHOR_OFFSET;
|
|
21
|
+
if (isLeft) surfaceOffset = POPUP_ANCHOR_OFFSET - width;
|
|
22
|
+
if (isCenter) surfaceOffset = -width / 2;
|
|
23
|
+
const minLeft = boundaryLeft + POPUP_HORIZONTAL_PADDING;
|
|
24
|
+
const maxLeft = Math.max(minLeft, boundaryLeft + boundaryWidth - POPUP_HORIZONTAL_PADDING - width);
|
|
25
|
+
const surfaceLeft = Math.max(minLeft, Math.min(maxLeft, anchorX + surfaceOffset));
|
|
26
|
+
const x = surfaceLeft - surfaceOffset;
|
|
27
|
+
return {
|
|
28
|
+
x,
|
|
29
|
+
offset: isLeft ? x - anchorX : anchorX - x
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.getPopupInsetPosition = getPopupInsetPosition;
|
|
33
|
+
//# sourceMappingURL=popupPosition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popupPosition.js","names":["_popup","require","POPUP_HORIZONTAL_PADDING","exports","POPUP_ANCHOR_OFFSET","getPopupInsetPosition","alignment","anchorX","boundaryLeft","boundaryWidth","width","isLeft","PopupAlignment","TopLeft","BottomLeft","isCenter","TopCenter","BottomCenter","surfaceOffset","minLeft","maxLeft","Math","max","surfaceLeft","min","x","offset"],"sources":["../../../../src/components/popup/popupPosition.ts"],"sourcesContent":["import { PopupAlignment } from '../../types/popup';\n\nexport const POPUP_HORIZONTAL_PADDING = 23;\nconst POPUP_ANCHOR_OFFSET = 13;\n\ninterface PopupInsetPositionOptions {\n alignment: PopupAlignment;\n anchorX: number;\n boundaryLeft: number;\n boundaryWidth: number;\n width: number;\n}\n\n/** Constrain the popup surface while keeping its arrow attached to the trigger. */\nexport const getPopupInsetPosition = ({\n alignment,\n anchorX,\n boundaryLeft,\n boundaryWidth,\n width,\n}: PopupInsetPositionOptions): { x: number; offset: number } => {\n const isLeft = alignment === PopupAlignment.TopLeft || alignment === PopupAlignment.BottomLeft;\n const isCenter =\n alignment === PopupAlignment.TopCenter || alignment === PopupAlignment.BottomCenter;\n let surfaceOffset = -POPUP_ANCHOR_OFFSET;\n if (isLeft) surfaceOffset = POPUP_ANCHOR_OFFSET - width;\n if (isCenter) surfaceOffset = -width / 2;\n\n const minLeft = boundaryLeft + POPUP_HORIZONTAL_PADDING;\n const maxLeft = Math.max(\n minLeft,\n boundaryLeft + boundaryWidth - POPUP_HORIZONTAL_PADDING - width,\n );\n const surfaceLeft = Math.max(minLeft, Math.min(maxLeft, anchorX + surfaceOffset));\n const x = surfaceLeft - surfaceOffset;\n\n return { x, offset: isLeft ? x - anchorX : anchorX - x };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,EAAE;AAC1C,MAAME,mBAAmB,GAAG,EAAE;AAU9B;AACO,MAAMC,qBAAqB,GAAGA,CAAC;EAClCC,SAAS;EACTC,OAAO;EACPC,YAAY;EACZC,aAAa;EACbC;AACuB,CAAC,KAAoC;EAC5D,MAAMC,MAAM,GAAGL,SAAS,KAAKM,qBAAc,CAACC,OAAO,IAAIP,SAAS,KAAKM,qBAAc,CAACE,UAAU;EAC9F,MAAMC,QAAQ,GACVT,SAAS,KAAKM,qBAAc,CAACI,SAAS,IAAIV,SAAS,KAAKM,qBAAc,CAACK,YAAY;EACvF,IAAIC,aAAa,GAAG,CAACd,mBAAmB;EACxC,IAAIO,MAAM,EAAEO,aAAa,GAAGd,mBAAmB,GAAGM,KAAK;EACvD,IAAIK,QAAQ,EAAEG,aAAa,GAAG,CAACR,KAAK,GAAG,CAAC;EAExC,MAAMS,OAAO,GAAGX,YAAY,GAAGN,wBAAwB;EACvD,MAAMkB,OAAO,GAAGC,IAAI,CAACC,GAAG,CACpBH,OAAO,EACPX,YAAY,GAAGC,aAAa,GAAGP,wBAAwB,GAAGQ,KAC9D,CAAC;EACD,MAAMa,WAAW,GAAGF,IAAI,CAACC,GAAG,CAACH,OAAO,EAAEE,IAAI,CAACG,GAAG,CAACJ,OAAO,EAAEb,OAAO,GAAGW,aAAa,CAAC,CAAC;EACjF,MAAMO,CAAC,GAAGF,WAAW,GAAGL,aAAa;EAErC,OAAO;IAAEO,CAAC;IAAEC,MAAM,EAAEf,MAAM,GAAGc,CAAC,GAAGlB,OAAO,GAAGA,OAAO,GAAGkB;EAAE,CAAC;AAC5D,CAAC;AAACtB,OAAA,CAAAE,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _popup = require("../../types/popup");
|
|
5
|
+
var _popupPosition = require("./popupPosition");
|
|
6
|
+
const alignments = Object.values(_popup.PopupAlignment).filter(value => typeof value === 'number');
|
|
7
|
+
(0, _vitest.describe)('popup inset positioning', () => {
|
|
8
|
+
_vitest.it.each(alignments)('keeps the surface and arrow aligned within asymmetric bounds for alignment %s', alignment => {
|
|
9
|
+
const isLeft = alignment === _popup.PopupAlignment.TopLeft || alignment === _popup.PopupAlignment.BottomLeft;
|
|
10
|
+
const isCenter = alignment === _popup.PopupAlignment.TopCenter || alignment === _popup.PopupAlignment.BottomCenter;
|
|
11
|
+
[30, 100, 250, 350].forEach(anchorX => {
|
|
12
|
+
const width = 240;
|
|
13
|
+
const position = (0, _popupPosition.getPopupInsetPosition)({
|
|
14
|
+
alignment,
|
|
15
|
+
anchorX,
|
|
16
|
+
width,
|
|
17
|
+
boundaryLeft: 17,
|
|
18
|
+
boundaryWidth: 330
|
|
19
|
+
});
|
|
20
|
+
let surfaceLeft = position.x - 13;
|
|
21
|
+
if (isLeft) surfaceLeft = position.x - width + 13;
|
|
22
|
+
if (isCenter) surfaceLeft = position.x - width / 2;
|
|
23
|
+
(0, _vitest.expect)(surfaceLeft).toBeGreaterThanOrEqual(40);
|
|
24
|
+
(0, _vitest.expect)(surfaceLeft + width).toBeLessThanOrEqual(324);
|
|
25
|
+
const arrowAnchor = isLeft ? position.x - position.offset : position.x + position.offset;
|
|
26
|
+
(0, _vitest.expect)(arrowAnchor).toBe(anchorX);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
(0, _vitest.it)('keeps scroll offsets in the same coordinate space', () => {
|
|
30
|
+
const options = {
|
|
31
|
+
alignment: _popup.PopupAlignment.BottomRight,
|
|
32
|
+
anchorX: 350,
|
|
33
|
+
width: 240,
|
|
34
|
+
boundaryLeft: 17,
|
|
35
|
+
boundaryWidth: 330
|
|
36
|
+
};
|
|
37
|
+
const position = (0, _popupPosition.getPopupInsetPosition)(options);
|
|
38
|
+
const scrolled = (0, _popupPosition.getPopupInsetPosition)({
|
|
39
|
+
...options,
|
|
40
|
+
anchorX: options.anchorX + 120,
|
|
41
|
+
boundaryLeft: options.boundaryLeft + 120
|
|
42
|
+
});
|
|
43
|
+
(0, _vitest.expect)(scrolled.x).toBe(position.x + 120);
|
|
44
|
+
(0, _vitest.expect)(scrolled.offset).toBe(position.offset);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=popupPosition.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popupPosition.test.js","names":["_vitest","require","_popup","_popupPosition","alignments","Object","values","PopupAlignment","filter","value","describe","it","each","alignment","isLeft","TopLeft","BottomLeft","isCenter","TopCenter","BottomCenter","forEach","anchorX","width","position","getPopupInsetPosition","boundaryLeft","boundaryWidth","surfaceLeft","x","expect","toBeGreaterThanOrEqual","toBeLessThanOrEqual","arrowAnchor","offset","toBe","options","BottomRight","scrolled"],"sources":["../../../../src/components/popup/popupPosition.test.ts"],"sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { PopupAlignment } from '../../types/popup';\nimport { getPopupInsetPosition } from './popupPosition';\n\nconst alignments = Object.values(PopupAlignment).filter(\n (value): value is PopupAlignment => typeof value === 'number',\n);\n\ndescribe('popup inset positioning', () => {\n it.each(alignments)(\n 'keeps the surface and arrow aligned within asymmetric bounds for alignment %s',\n (alignment) => {\n const isLeft =\n alignment === PopupAlignment.TopLeft || alignment === PopupAlignment.BottomLeft;\n const isCenter =\n alignment === PopupAlignment.TopCenter || alignment === PopupAlignment.BottomCenter;\n [30, 100, 250, 350].forEach((anchorX) => {\n const width = 240;\n const position = getPopupInsetPosition({\n alignment,\n anchorX,\n width,\n boundaryLeft: 17,\n boundaryWidth: 330,\n });\n let surfaceLeft = position.x - 13;\n if (isLeft) surfaceLeft = position.x - width + 13;\n if (isCenter) surfaceLeft = position.x - width / 2;\n expect(surfaceLeft).toBeGreaterThanOrEqual(40);\n expect(surfaceLeft + width).toBeLessThanOrEqual(324);\n const arrowAnchor = isLeft\n ? position.x - position.offset\n : position.x + position.offset;\n expect(arrowAnchor).toBe(anchorX);\n });\n },\n );\n\n it('keeps scroll offsets in the same coordinate space', () => {\n const options = {\n alignment: PopupAlignment.BottomRight,\n anchorX: 350,\n width: 240,\n boundaryLeft: 17,\n boundaryWidth: 330,\n };\n const position = getPopupInsetPosition(options);\n const scrolled = getPopupInsetPosition({\n ...options,\n anchorX: options.anchorX + 120,\n boundaryLeft: options.boundaryLeft + 120,\n });\n expect(scrolled.x).toBe(position.x + 120);\n expect(scrolled.offset).toBe(position.offset);\n });\n});\n"],"mappings":";;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,MAAMG,UAAU,GAAGC,MAAM,CAACC,MAAM,CAACC,qBAAc,CAAC,CAACC,MAAM,CAClDC,KAAK,IAA8B,OAAOA,KAAK,KAAK,QACzD,CAAC;AAED,IAAAC,gBAAQ,EAAC,yBAAyB,EAAE,MAAM;EACtCC,UAAE,CAACC,IAAI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,EAAEN,qBAAc,CAAC6B,WAAW;MACrCf,OAAO,EAAE,GAAG;MACZC,KAAK,EAAE,GAAG;MACVG,YAAY,EAAE,EAAE;MAChBC,aAAa,EAAE;IACnB,CAAC;IACD,MAAMH,QAAQ,GAAG,IAAAC,oCAAqB,EAACW,OAAO,CAAC;IAC/C,MAAME,QAAQ,GAAG,IAAAb,oCAAqB,EAAC;MACnC,GAAGW,OAAO;MACVd,OAAO,EAAEc,OAAO,CAACd,OAAO,GAAG,GAAG;MAC9BI,YAAY,EAAEU,OAAO,CAACV,YAAY,GAAG;IACzC,CAAC,CAAC;IACF,IAAAI,cAAM,EAACQ,QAAQ,CAACT,CAAC,CAAC,CAACM,IAAI,CAACX,QAAQ,CAACK,CAAC,GAAG,GAAG,CAAC;IACzC,IAAAC,cAAM,EAACQ,QAAQ,CAACJ,MAAM,CAAC,CAACC,IAAI,CAACX,QAAQ,CAACU,MAAM,CAAC;EACjD,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -589,7 +589,6 @@ const SearchBox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
589
589
|
return;
|
|
590
590
|
}
|
|
591
591
|
const {
|
|
592
|
-
id,
|
|
593
592
|
textContent
|
|
594
593
|
} = element;
|
|
595
594
|
let imageUrl;
|
|
@@ -604,7 +603,7 @@ const SearchBox = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
|
604
603
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
605
604
|
imageUrl = (_element$children$2 = element.children[0]) === null || _element$children$2 === void 0 ? void 0 : _element$children$2.attributes.src.nodeValue;
|
|
606
605
|
}
|
|
607
|
-
const newId =
|
|
606
|
+
const newId = (0, _searchBox.getSearchBoxItemId)(element);
|
|
608
607
|
handleSelect({
|
|
609
608
|
id: newId === 'input-value' ? textContent : newId,
|
|
610
609
|
text: textContent ?? '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBox.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_styledComponents","_calculate","_searchBox","_Icon","_interopRequireDefault","_Input","_GroupName","_SearchBoxBody","_SearchBoxItem","_SearchBoxItem2","_SearchBox","_uuid","_DropdownBodyWrapper","_TagInput","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","filterSearchBoxItems","customFilter","customSortFunction","items","searchString","shouldUseCustomFilterOnly","filteredItems","filter","item","sortSearchBoxItems","searchList","exports","getDropdownSearchString","selectedId","shouldKeepSelectedItemPosition","value","SearchBox","forwardRef","container","dropdownDirection","inputProps","isInvalid","leftIcons","lists","maxHeight","onBlur","onChange","onKeyDown","onSelect","placeholder","presetValue","hintText","shouldAddInputToList","shouldHideFilterButtons","shouldShowContentOnEmptyInput","shouldShowSmallItems","shouldShowRoundImage","shouldShowToggleIcon","tagInputSettings","shouldEnableKeyboardHighlighting","ref","matchingListsItems","setMatchingListsItems","useState","selectedImage","setSelectedImage","internalValue","setInternalValue","inputValue","setValue","useCallback","nextValue","height","setHeight","focusedIndex","setFocusedIndex","hasMultipleGroups","setHasMultipleGroups","filteredChildrenArray","setFilteredChildrenArray","inputToListValue","setInputToListValue","groups","setGroups","shouldShowBody","setShouldShowBody","uuid","useUuid","boxRef","useRef","contentRef","inputRef","tagInputRef","hasFocusRef","isAnimatingRef","shouldShowPresetValue","theme","useTheme","dropdownSearchString","isTouch","useDevice","useEffect","filterButtons","useMemo","forEach","groupName","push","id","text","activeList","newLists","list","includes","newMatchingItems","newList","undefined","filteredMatchingListItems","map","handleOpen","handleClose","handleFilterButtonsGroupSelect","keys","textArray","calculateContentHeight","selectedItem","find","imageUrl","createElement","StyledSearchBoxItemImage","src","$shouldShowRoundImage","current","handleFocus","event","onFocus","handleKeyDown","toLowerCase","handleClick","rightElement","StyledSearchBoxIcon","onClick","icons","color","leftElement","StyledSearchBoxLeftWrapper","handleChange","filteredLists","target","handleBlur","handleDropdownOutsideClick","_tagInputRef$current","blur","handleContainerBlur","_contentRef$current","nextFocusedElement","relatedTarget","currentContainer","currentTarget","contains","handleSelect","newItem","replace","_tagInputRef$current2","resetValue","content","StyledSearchBoxHintText","index","key","name","listIndex","tabIndex","_contentRef$current2","_childrenArray$find","children","childrenArray","Array","from","newChildren","child","startsWith","filteredChildren","dataset","isgroupname","preventDefault","newIndex","prevElement","newElement","stopPropagation","_element$children$","element","textContent","attributes","_element$children$2","nodeValue","newId","document","addEventListener","removeEventListener","handleKeyPress","keyCode","useImperativeHandle","clear","shouldShowDropdown","trim","StyledSearchBox","onAdd","onRemove","size","shouldAllowMultiple","shouldPreventEnter","tags","anchorElement","direction","onClose","onOutsideClick","shouldShow","onGroupSelect","selectedGroups","displayName","_default"],"sources":["../../../../src/components/search-box/SearchBox.tsx"],"sourcesContent":["import { useDevice } from 'chayns-api';\nimport React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n FocusEvent,\n FocusEventHandler,\n forwardRef,\n KeyboardEventHandler,\n ReactElement,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport type { IFilterButtonItem } from '../../types/filterButtons';\nimport type { ISearchBoxItem, ISearchBoxItems } from '../../types/searchBox';\nimport { calculateContentHeight } from '../../utils/calculate';\nimport { searchList, sortSearchBoxItems, type SearchBoxSortFunction } from '../../utils/searchBox';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport Input, { type InputProps } from '../input/Input';\nimport GroupName from './group-name/GroupName';\nimport SearchBoxBody from './search-box-body/SearchBoxBody';\nimport SearchBoxItem from './search-box-item/SearchBoxItem';\nimport { StyledSearchBoxItemImage } from './search-box-item/SearchBoxItem.styles';\nimport {\n StyledSearchBox,\n StyledSearchBoxHintText,\n StyledSearchBoxIcon,\n StyledSearchBoxLeftWrapper,\n} from './SearchBox.styles';\nimport { useUuid } from '../../hooks/uuid';\nimport DropdownBodyWrapper from '../dropdown-body-wrapper/DropdownBodyWrapper';\nimport TagInput, { TagInputProps, TagInputRef } from '../tag-input/TagInput';\nimport type { DropdownDirection } from '../../types/dropdown';\n\nexport interface SearchBoxRef {\n clear: VoidFunction;\n}\n\nexport interface TagInputSettings {\n onAdd?: TagInputProps['onAdd'];\n onRemove?: TagInputProps['onRemove'];\n size?: TagInputProps['size'];\n shouldAllowMultiple?: TagInputProps['shouldAllowMultiple'];\n tags?: TagInputProps['tags'];\n}\n\nexport const filterSearchBoxItems = ({\n customFilter,\n customSortFunction,\n items,\n searchString,\n shouldUseCustomFilterOnly,\n}: {\n customFilter?: (item: ISearchBoxItem, value: string) => boolean;\n customSortFunction?: SearchBoxSortFunction;\n items: ISearchBoxItem[];\n searchString: string;\n shouldUseCustomFilterOnly?: boolean;\n}) => {\n if (shouldUseCustomFilterOnly) {\n const filteredItems =\n typeof customFilter === 'function'\n ? items.filter((item) => customFilter(item, searchString))\n : items;\n\n return sortSearchBoxItems({ customSortFunction, items: filteredItems, searchString });\n }\n\n if (typeof customFilter !== 'function') {\n return searchList({ customSortFunction, items, searchString });\n }\n\n return searchList({ customSortFunction, items, searchString }).filter((item) =>\n customFilter(item, searchString),\n );\n};\n\nconst getDropdownSearchString = ({\n selectedId,\n shouldKeepSelectedItemPosition,\n value,\n}: {\n selectedId?: string;\n shouldKeepSelectedItemPosition?: boolean;\n value: string;\n}) => (shouldKeepSelectedItemPosition && selectedId ? '' : value);\n\nexport type SearchBoxProps = {\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * An optional callback function to filter the elements to be displayed\n * @param item The item to filter.\n * @param value The current input value.\n */\n customFilter?: (item: ISearchBoxItem, value: string) => boolean;\n /**\n * An optional callback function to sort the filtered elements to be displayed\n */\n customSortFunction?: SearchBoxSortFunction;\n /**\n * If true, the custom filter replaces the built-in text search instead of narrowing its results.\n */\n shouldUseCustomFilterOnly?: boolean;\n /**\n * The direction in which the dropdown should be displayed. By default, it is displayed below the input.\n */\n dropdownDirection?: DropdownDirection;\n /**\n * If true, the input field is marked as invalid\n */\n isInvalid?: boolean;\n /**\n * An optional icon that is displayed inside the left side of the input.\n */\n leftIcons?: string[];\n /**\n * Props that are passed to the underlying Input component.\n */\n inputProps?: InputProps;\n /**\n * List of groups with items that can be searched. It is possible to give only one list; if multiple lists are provided, the 'group name' parameter becomes mandatory.\n */\n lists: ISearchBoxItems[];\n /**\n * The maximum height of the dropdown body in pixels.\n */\n maxHeight?: number;\n /**\n * Function to be executed when the input lost focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the input is changed.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when a letter is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when an item is selected.\n */\n onSelect?: (item: ISearchBoxItem) => void;\n /**\n * The placeholder that should be displayed.\n */\n placeholder?: string;\n /**\n * Set an input for the search box - it is not an item of a list, just a string.\n */\n presetValue?: string;\n /**\n * Control the selected item. If you use this prop, make sure to update it when the user selects an item.\n */\n selectedId?: string;\n /**\n * If true, the selected item keeps its original position in the dropdown list.\n */\n shouldKeepSelectedItemPosition?: boolean;\n /**\n * If true, the value in the Input is displayed in the list.\n */\n shouldAddInputToList: boolean;\n /**\n * If true, the filter buttons are hidden.\n */\n shouldHideFilterButtons?: boolean;\n /**\n * Whether the full list of items should be displayed if the input is empty.\n */\n shouldShowContentOnEmptyInput?: boolean;\n /**\n * If true, the dropdown items are displayed more compactly.\n */\n shouldShowSmallItems?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the icon to open and close the list should be displayed.\n */\n shouldShowToggleIcon?: boolean;\n /**\n * Settings for the TagInput.\n */\n tagInputSettings?: TagInputSettings;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * A text that should be displayed if no results are found.\n */\n hintText?: string;\n};\n\nconst SearchBox: FC<SearchBoxProps> = forwardRef<SearchBoxRef, SearchBoxProps>(\n (\n {\n container,\n customFilter,\n customSortFunction,\n dropdownDirection,\n inputProps,\n isInvalid = false,\n leftIcons,\n lists,\n maxHeight = 300,\n onBlur,\n onChange,\n onKeyDown,\n onSelect,\n placeholder,\n presetValue,\n hintText,\n selectedId,\n shouldAddInputToList = true,\n shouldKeepSelectedItemPosition = false,\n shouldUseCustomFilterOnly = false,\n shouldHideFilterButtons = false,\n shouldShowContentOnEmptyInput = true,\n shouldShowSmallItems = false,\n shouldShowRoundImage,\n shouldShowToggleIcon = false,\n tagInputSettings,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const [matchingListsItems, setMatchingListsItems] = useState<ISearchBoxItems[]>(lists);\n const [selectedImage, setSelectedImage] = useState<ReactElement>();\n const [internalValue, setInternalValue] = useState(\n typeof presetValue === 'string' && presetValue !== '' ? presetValue : '',\n );\n const inputValue = inputProps?.value;\n const value = inputValue ?? internalValue;\n const setValue = useCallback(\n (nextValue: string) => {\n if (typeof inputValue !== 'string') {\n setInternalValue(nextValue);\n }\n },\n [inputValue],\n );\n const [height, setHeight] = useState<number>(0);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n const [hasMultipleGroups, setHasMultipleGroups] = useState<boolean>(lists.length > 1);\n const [filteredChildrenArray, setFilteredChildrenArray] = useState<Element[]>();\n const [inputToListValue, setInputToListValue] = useState<string>('');\n const [groups, setGroups] = useState<string[]>(['all']);\n const [shouldShowBody, setShouldShowBody] = useState(false);\n\n const uuid = useUuid();\n\n const boxRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const tagInputRef = useRef<TagInputRef>(null);\n\n const hasFocusRef = useRef<boolean>(false);\n const isAnimatingRef = useRef<boolean>(false);\n const shouldShowPresetValue = useRef<boolean>(\n typeof presetValue === 'string' && presetValue !== '',\n );\n\n const theme = useTheme() as Theme;\n const dropdownSearchString = getDropdownSearchString({\n selectedId,\n shouldKeepSelectedItemPosition,\n value,\n });\n\n const { isTouch } = useDevice();\n\n /**\n * Checks if there are multiple groups in the lists\n */\n useEffect(() => {\n setHasMultipleGroups(lists.length > 1);\n }, [lists]);\n\n const filterButtons = useMemo(() => {\n const items: IFilterButtonItem[] = [];\n\n if (lists.length <= 1) {\n return items;\n }\n\n lists.forEach(({ groupName }) => {\n if (groupName) {\n items.push({\n id: groupName,\n text: groupName,\n });\n }\n });\n\n return items;\n }, [lists]);\n\n /**\n * Filters the lists by the FilterButtons\n */\n const activeList = useMemo(() => {\n let newLists: ISearchBoxItems[] = [];\n\n if (groups[0] === 'all') {\n newLists = lists;\n } else {\n lists.forEach((list) => {\n if (list.groupName && groups.includes(list.groupName)) {\n newLists.push(list);\n }\n });\n }\n\n const newMatchingItems: ISearchBoxItems[] = [];\n\n newLists.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: dropdownSearchString,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n newMatchingItems.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (newMatchingItems.length === 0 && shouldAddInputToList) {\n newMatchingItems.push({\n groupName: undefined,\n list: [],\n });\n }\n\n const filteredMatchingListItems = newMatchingItems.map(({ list, groupName }) => ({\n groupName,\n list: list.filter((item) => {\n if (typeof customFilter === 'function' && shouldUseCustomFilterOnly) {\n return true;\n }\n\n return !(newMatchingItems.length === 1 && item.text === dropdownSearchString);\n }),\n }));\n\n setMatchingListsItems(filteredMatchingListItems);\n\n return newLists;\n }, [\n groups,\n lists,\n customFilter,\n customSortFunction,\n dropdownSearchString,\n shouldAddInputToList,\n shouldUseCustomFilterOnly,\n ]);\n\n const handleOpen = useCallback(() => {\n setShouldShowBody(true);\n }, []);\n\n const handleClose = useCallback(() => {\n setShouldShowBody(false);\n }, []);\n\n const handleFilterButtonsGroupSelect = (keys: string[]) => {\n setGroups(keys.length === 0 ? ['all'] : keys);\n };\n\n /**\n * This hook calculates the height\n */\n useEffect(() => {\n const textArray: string[] = [];\n\n activeList.forEach(({ list, groupName }) => {\n list.forEach(({ text }) => textArray.push(text));\n if (!groupName) {\n return;\n }\n textArray.push(groupName);\n });\n\n if (shouldAddInputToList && inputToListValue !== '') {\n textArray.push(inputToListValue);\n }\n\n setHeight(calculateContentHeight(textArray));\n }, [inputToListValue, activeList, placeholder, shouldAddInputToList]);\n\n useEffect(() => {\n if (selectedId) {\n activeList.forEach(({ list }) => {\n const selectedItem = list.find(({ id }) => id === selectedId);\n if (selectedItem) {\n setValue(selectedItem.text);\n\n if (selectedItem.imageUrl) {\n setSelectedImage(\n <StyledSearchBoxItemImage\n src={selectedItem.imageUrl}\n $shouldShowRoundImage={shouldShowRoundImage}\n />,\n );\n }\n }\n });\n }\n }, [activeList, selectedId, shouldShowRoundImage]);\n\n /**\n * This hook resets the value if the selectedId changes to undefined. This is an own useEffect because the value\n * should not be reset if the list changes and the selectedId is still undefined.\n */\n useEffect(() => {\n if (!selectedId && !shouldShowPresetValue.current) {\n setValue('');\n }\n }, [selectedId]);\n\n useEffect(() => {\n isAnimatingRef.current = shouldShowBody;\n }, [shouldShowBody]);\n\n useEffect(() => {\n if (\n (matchingListsItems.length !== 0 || hintText) &&\n !isAnimatingRef.current &&\n hasFocusRef.current\n ) {\n handleOpen();\n }\n }, [handleOpen, hintText, matchingListsItems.length]);\n\n /**\n * This function handles the focus event of the input and opens the dropdown if the input\n * should show content on an empty input\n */\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n hasFocusRef.current = true;\n\n if (typeof inputProps?.onFocus === 'function') {\n inputProps.onFocus(event);\n }\n\n if (shouldShowContentOnEmptyInput) {\n const newMatchingItems: ISearchBoxItems[] = [];\n\n activeList.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: dropdownSearchString,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n newMatchingItems.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (newMatchingItems.length === 0 && shouldAddInputToList) {\n newMatchingItems.push({\n groupName: undefined,\n list: [],\n });\n }\n\n const filteredMatchingListItems = newMatchingItems.map(\n ({ list, groupName }) => ({\n groupName,\n list: list.filter((item) => {\n if (\n typeof customFilter === 'function' &&\n shouldUseCustomFilterOnly\n ) {\n return true;\n }\n\n return !(\n newMatchingItems.length === 1 &&\n item.text === dropdownSearchString\n );\n }),\n }),\n );\n\n setMatchingListsItems(filteredMatchingListItems);\n\n if (filteredMatchingListItems.length !== 0 || hintText) {\n handleOpen();\n }\n }\n },\n [\n shouldShowContentOnEmptyInput,\n activeList,\n shouldAddInputToList,\n hintText,\n dropdownSearchString,\n customFilter,\n customSortFunction,\n shouldUseCustomFilterOnly,\n handleOpen,\n inputProps,\n ],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(\n (event) => {\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n\n if (typeof inputProps?.onKeyDown === 'function') {\n inputProps.onKeyDown(event);\n }\n },\n [inputProps, onKeyDown],\n );\n\n /**\n * This function filters the lists by input\n */\n\n useEffect(() => {\n const newMatchingItems: ISearchBoxItems[] = [];\n\n activeList.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: dropdownSearchString,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n newMatchingItems.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (newMatchingItems.length === 0 && shouldAddInputToList) {\n newMatchingItems.push({\n groupName: undefined,\n list: [],\n });\n }\n\n if (shouldAddInputToList && inputToListValue !== '') {\n newMatchingItems.forEach(({ list }) => {\n list.forEach(({ text }) => {\n if (text.toLowerCase() === inputToListValue.toLowerCase()) {\n setInputToListValue('');\n }\n });\n });\n }\n }, [\n inputToListValue,\n activeList,\n shouldAddInputToList,\n shouldShowContentOnEmptyInput,\n dropdownSearchString,\n customFilter,\n customSortFunction,\n shouldUseCustomFilterOnly,\n ]);\n\n const handleClick = useCallback(() => {\n if (shouldShowBody) {\n handleClose();\n } else {\n handleOpen();\n }\n }, [handleClose, handleOpen, shouldShowBody]);\n\n const rightElement = useMemo(() => {\n if (!shouldShowToggleIcon) {\n return undefined;\n }\n\n return (\n <StyledSearchBoxIcon onClick={handleClick}>\n <Icon icons={['fa fa-chevron-down']} color={theme['006'] as string} />\n </StyledSearchBoxIcon>\n );\n }, [handleClick, shouldShowToggleIcon, theme]);\n\n const leftElement = useMemo(\n () =>\n (leftIcons || selectedImage) && (\n <StyledSearchBoxLeftWrapper>\n {leftIcons && <Icon icons={leftIcons} />}\n {selectedImage && selectedImage}\n </StyledSearchBoxLeftWrapper>\n ),\n [leftIcons, selectedImage],\n );\n\n /**\n * This function handles changes of the input\n */\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const filteredLists: ISearchBoxItems[] = [];\n shouldShowPresetValue.current = false;\n\n activeList.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: event.target.value,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n filteredLists.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (filteredLists.length === 0 && shouldAddInputToList) {\n filteredLists.push({\n groupName: undefined,\n list: [],\n });\n }\n\n setSelectedImage(undefined);\n\n if (!shouldShowContentOnEmptyInput && !event.target.value) {\n setMatchingListsItems([]);\n } else {\n setMatchingListsItems(filteredLists);\n }\n\n if (filteredLists.length !== 0) {\n handleOpen();\n }\n\n setValue(event.target.value);\n setInputToListValue(event.target.value);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n\n if (typeof inputProps?.onChange === 'function') {\n inputProps.onChange(event);\n }\n },\n [\n activeList,\n customFilter,\n customSortFunction,\n handleOpen,\n inputProps,\n onChange,\n shouldAddInputToList,\n shouldShowContentOnEmptyInput,\n shouldUseCustomFilterOnly,\n ],\n );\n\n /**\n * This function handles the blur event of the input\n */\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n hasFocusRef.current = false;\n\n if (typeof onBlur === 'function') {\n onBlur(event);\n }\n\n if (typeof inputProps?.onBlur === 'function') {\n inputProps.onBlur(event);\n }\n },\n [inputProps, onBlur],\n );\n\n const handleDropdownOutsideClick = useCallback(() => {\n tagInputRef.current?.blur();\n\n return hasFocusRef.current && isTouch;\n }, [isTouch]);\n\n const handleContainerBlur = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n const nextFocusedElement = event.relatedTarget as Node | null;\n const currentContainer = event.currentTarget as HTMLElement;\n\n // Check if focus is moving outside the SearchBox container\n // Also check the dropdown content (contentRef) since it's rendered in a portal\n if (\n !nextFocusedElement ||\n (!currentContainer.contains(nextFocusedElement) &&\n !contentRef.current?.contains(nextFocusedElement))\n ) {\n handleClose();\n }\n },\n [handleClose],\n );\n\n /**\n * This function handles the item selection\n */\n const handleSelect = useCallback(\n (item: ISearchBoxItem) => {\n const newItem = {\n ...item,\n text: item.text.replace('<b>', '').replace('</b>', '').replace('</b', ''),\n };\n\n if (tagInputSettings) {\n setValue('');\n setInputToListValue('');\n tagInputRef.current?.resetValue();\n } else {\n setValue(newItem.text);\n }\n\n handleClose();\n\n setSelectedImage(\n newItem.imageUrl ? (\n <StyledSearchBoxItemImage\n src={newItem.imageUrl}\n $shouldShowRoundImage={shouldShowRoundImage}\n />\n ) : undefined,\n );\n\n setMatchingListsItems([]);\n\n if (typeof onSelect === 'function') {\n onSelect(newItem);\n }\n },\n [handleClose, onSelect, shouldShowRoundImage, tagInputSettings],\n );\n\n const content = useMemo(() => {\n if (hintText && matchingListsItems.length === 0) {\n return (\n <StyledSearchBoxHintText>\n {hintText.replace('##value##', value)}\n </StyledSearchBoxHintText>\n );\n }\n\n const items: ReactElement[] = [];\n\n matchingListsItems.forEach(({ groupName, list }, index) => {\n if (hasMultipleGroups) {\n if (list.length <= 0) {\n return;\n }\n\n if (index !== 0) {\n items.push(<GroupName key={groupName} name={groupName ?? ''} />);\n }\n }\n\n list.forEach(({ id, text, imageUrl }, listIndex) => {\n items.push(\n <SearchBoxItem\n key={`${id}_${groupName ?? ''}`}\n id={id}\n text={text}\n imageUrl={imageUrl}\n shouldShowSmallItems={shouldShowSmallItems}\n shouldShowRoundImage={shouldShowRoundImage}\n onSelect={handleSelect}\n groupName={groupName}\n tabIndex={index === 0 && listIndex === 0 ? 0 : -1}\n />,\n );\n });\n });\n\n if (shouldAddInputToList && inputToListValue !== '') {\n items.push(\n <SearchBoxItem\n id=\"input-value\"\n onSelect={handleSelect}\n shouldShowSmallItems={shouldShowSmallItems}\n text={`<b>${inputToListValue}</b`}\n tabIndex={items.length === 0 ? 0 : -1}\n />,\n );\n }\n\n return items;\n }, [\n hintText,\n matchingListsItems,\n shouldAddInputToList,\n inputToListValue,\n value,\n hasMultipleGroups,\n shouldShowSmallItems,\n shouldShowRoundImage,\n handleSelect,\n ]);\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!shouldShowBody || matchingListsItems.length === 0) {\n return;\n }\n\n const children = contentRef.current?.children;\n\n if (!children) {\n return;\n }\n\n const childrenArray = Array.from(children);\n\n const newChildren = childrenArray.find((child) =>\n child.id.startsWith('searchBoxContent__'),\n )?.children;\n\n if (!(newChildren && newChildren.length > 0)) {\n return;\n }\n\n const filteredChildren = Array.from(newChildren).filter(\n (child) => (child as HTMLElement).dataset.isgroupname !== 'true',\n );\n\n setFilteredChildrenArray(filteredChildren);\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n\n if (newChildren && newChildren.length > 0) {\n const newIndex =\n focusedIndex !== null\n ? (focusedIndex +\n (e.key === 'ArrowUp' ? -1 : 1) +\n filteredChildren.length) %\n filteredChildren.length\n : 0;\n\n if (focusedIndex !== null) {\n const prevElement = filteredChildren[focusedIndex] as HTMLDivElement;\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const newElement = filteredChildren[newIndex] as HTMLDivElement;\n\n newElement.tabIndex = 0;\n }\n } else if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n\n if (filteredChildren) {\n const element = filteredChildren[focusedIndex ?? 0];\n\n if (!element) {\n return;\n }\n\n const { id, textContent } = element;\n\n let imageUrl: string | undefined;\n\n // Just Ignore, it works\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (element.children[0]?.attributes.src) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n imageUrl = element.children[0]?.attributes.src.nodeValue as string;\n }\n\n const newId = id.replace('search-box-item__', '');\n\n handleSelect({\n id: newId === 'input-value' ? textContent : newId,\n text: textContent ?? '',\n imageUrl,\n });\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [\n filteredChildrenArray,\n focusedIndex,\n handleSelect,\n matchingListsItems.length,\n shouldShowBody,\n ]);\n\n const handleKeyPress = useCallback((event: KeyboardEvent) => {\n if (event.keyCode === 27) {\n setMatchingListsItems([]);\n }\n }, []);\n\n useImperativeHandle(\n ref,\n () => ({\n clear: () => setValue(''),\n }),\n [setValue],\n );\n\n useEffect(() => {\n document.addEventListener('keydown', handleKeyPress);\n\n return () => {\n document.addEventListener('keydown', handleKeyPress);\n };\n }, [handleKeyPress]);\n\n /**\n * Update the value if preset value changes\n */\n useEffect(() => {\n if (presetValue) {\n setValue(presetValue);\n }\n }, [presetValue, setValue]);\n\n const shouldShowDropdown =\n shouldShowBody &&\n (matchingListsItems.length !== 0 || !!hintText) &&\n (value.trim() !== '' || shouldShowContentOnEmptyInput);\n\n return useMemo(\n () => (\n <StyledSearchBox\n ref={boxRef}\n key={`search-box-${uuid}`}\n onBlur={handleContainerBlur}\n >\n <div id={`search_box_input${uuid}`}>\n {tagInputSettings ? (\n <TagInput\n leftElement={leftElement}\n onAdd={tagInputSettings.onAdd}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onRemove={tagInputSettings.onRemove}\n placeholder={placeholder}\n ref={tagInputRef}\n size={tagInputSettings.size}\n shouldAllowMultiple={tagInputSettings.shouldAllowMultiple}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n shouldPreventEnter\n tags={tagInputSettings.tags}\n />\n ) : (\n <Input\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...inputProps}\n isInvalid={isInvalid}\n leftElement={leftElement}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n rightElement={rightElement}\n shouldEnableKeyboardHighlighting={\n inputProps?.shouldEnableKeyboardHighlighting ??\n shouldEnableKeyboardHighlighting\n }\n value={value}\n />\n )}\n </div>\n {boxRef.current && (\n <DropdownBodyWrapper\n anchorElement={boxRef.current}\n container={container}\n direction={dropdownDirection}\n onClose={handleClose}\n onOutsideClick={handleDropdownOutsideClick}\n shouldShowDropdown={shouldShowDropdown}\n >\n <SearchBoxBody\n filterButtons={filterButtons}\n height={height}\n maxHeight={maxHeight}\n shouldShow={shouldShowDropdown}\n key={`search-box-body-${uuid}`}\n onGroupSelect={handleFilterButtonsGroupSelect}\n ref={contentRef}\n selectedGroups={groups}\n shouldHideFilterButtons={shouldHideFilterButtons}\n >\n {content}\n </SearchBoxBody>\n </DropdownBodyWrapper>\n )}\n </StyledSearchBox>\n ),\n [\n container,\n content,\n dropdownDirection,\n filterButtons,\n groups,\n handleBlur,\n handleChange,\n handleClose,\n handleDropdownOutsideClick,\n handleFocus,\n handleKeyDown,\n height,\n inputProps,\n isInvalid,\n leftElement,\n maxHeight,\n onKeyDown,\n placeholder,\n rightElement,\n shouldHideFilterButtons,\n shouldShowDropdown,\n shouldEnableKeyboardHighlighting,\n tagInputSettings,\n uuid,\n value,\n ],\n );\n },\n);\n\nSearchBox.displayName = 'SearchBox';\n\nexport default SearchBox;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAgBA,IAAAG,iBAAA,GAAAH,OAAA;AAGA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAEA,IAAAM,KAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,UAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,cAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,cAAA,GAAAJ,sBAAA,CAAAP,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAMA,IAAAc,KAAA,GAAAd,OAAA;AACA,IAAAe,oBAAA,GAAAR,sBAAA,CAAAP,OAAA;AACA,IAAAgB,SAAA,GAAAT,sBAAA,CAAAP,OAAA;AAA6E,SAAAO,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAf,wBAAAe,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAnB,uBAAA,YAAAA,CAAAe,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SA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AEA;EAAwB,GAEhD+G,OACU,CACE,CAEZ,CACpB,EACD,CACI9H,SAAS,EACT8H,OAAO,EACP7H,iBAAiB,EACjB+D,aAAa,EACbpB,MAAM,EACNkE,UAAU,EACVH,YAAY,EACZ1B,WAAW,EACX8B,0BAA0B,EAC1BjB,WAAW,EACXG,aAAa,EACb/D,MAAM,EACNhC,UAAU,EACVC,SAAS,EACTsG,WAAW,EACXnG,SAAS,EACTG,SAAS,EACTE,WAAW,EACXyF,YAAY,EACZrF,uBAAuB,EACvBqJ,kBAAkB,EAClB/I,gCAAgC,EAChCD,gBAAgB,EAChB4B,IAAI,EACJnD,KAAK,CAEb,CAAC;AACL,CACJ,CAAC;AAEDC,SAAS,CAACsL,WAAW,GAAG,WAAW;AAAC,IAAAC,QAAA,GAAA5L,OAAA,CAAAlC,OAAA,GAErBuC,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SearchBox.js","names":["_chaynsApi","require","_react","_interopRequireWildcard","_styledComponents","_calculate","_searchBox","_Icon","_interopRequireDefault","_Input","_GroupName","_SearchBoxBody","_SearchBoxItem","_SearchBoxItem2","_SearchBox","_uuid","_DropdownBodyWrapper","_TagInput","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","filterSearchBoxItems","customFilter","customSortFunction","items","searchString","shouldUseCustomFilterOnly","filteredItems","filter","item","sortSearchBoxItems","searchList","exports","getDropdownSearchString","selectedId","shouldKeepSelectedItemPosition","value","SearchBox","forwardRef","container","dropdownDirection","inputProps","isInvalid","leftIcons","lists","maxHeight","onBlur","onChange","onKeyDown","onSelect","placeholder","presetValue","hintText","shouldAddInputToList","shouldHideFilterButtons","shouldShowContentOnEmptyInput","shouldShowSmallItems","shouldShowRoundImage","shouldShowToggleIcon","tagInputSettings","shouldEnableKeyboardHighlighting","ref","matchingListsItems","setMatchingListsItems","useState","selectedImage","setSelectedImage","internalValue","setInternalValue","inputValue","setValue","useCallback","nextValue","height","setHeight","focusedIndex","setFocusedIndex","hasMultipleGroups","setHasMultipleGroups","filteredChildrenArray","setFilteredChildrenArray","inputToListValue","setInputToListValue","groups","setGroups","shouldShowBody","setShouldShowBody","uuid","useUuid","boxRef","useRef","contentRef","inputRef","tagInputRef","hasFocusRef","isAnimatingRef","shouldShowPresetValue","theme","useTheme","dropdownSearchString","isTouch","useDevice","useEffect","filterButtons","useMemo","forEach","groupName","push","id","text","activeList","newLists","list","includes","newMatchingItems","newList","undefined","filteredMatchingListItems","map","handleOpen","handleClose","handleFilterButtonsGroupSelect","keys","textArray","calculateContentHeight","selectedItem","find","imageUrl","createElement","StyledSearchBoxItemImage","src","$shouldShowRoundImage","current","handleFocus","event","onFocus","handleKeyDown","toLowerCase","handleClick","rightElement","StyledSearchBoxIcon","onClick","icons","color","leftElement","StyledSearchBoxLeftWrapper","handleChange","filteredLists","target","handleBlur","handleDropdownOutsideClick","_tagInputRef$current","blur","handleContainerBlur","_contentRef$current","nextFocusedElement","relatedTarget","currentContainer","currentTarget","contains","handleSelect","newItem","replace","_tagInputRef$current2","resetValue","content","StyledSearchBoxHintText","index","key","name","listIndex","tabIndex","_contentRef$current2","_childrenArray$find","children","childrenArray","Array","from","newChildren","child","startsWith","filteredChildren","dataset","isgroupname","preventDefault","newIndex","prevElement","newElement","stopPropagation","_element$children$","element","textContent","attributes","_element$children$2","nodeValue","newId","getSearchBoxItemId","document","addEventListener","removeEventListener","handleKeyPress","keyCode","useImperativeHandle","clear","shouldShowDropdown","trim","StyledSearchBox","onAdd","onRemove","size","shouldAllowMultiple","shouldPreventEnter","tags","anchorElement","direction","onClose","onOutsideClick","shouldShow","onGroupSelect","selectedGroups","displayName","_default"],"sources":["../../../../src/components/search-box/SearchBox.tsx"],"sourcesContent":["import { useDevice } from 'chayns-api';\nimport React, {\n ChangeEvent,\n ChangeEventHandler,\n FC,\n FocusEvent,\n FocusEventHandler,\n forwardRef,\n KeyboardEventHandler,\n ReactElement,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport type { IFilterButtonItem } from '../../types/filterButtons';\nimport type { ISearchBoxItem, ISearchBoxItems } from '../../types/searchBox';\nimport { calculateContentHeight } from '../../utils/calculate';\nimport {\n getSearchBoxItemId,\n searchList,\n sortSearchBoxItems,\n type SearchBoxSortFunction,\n} from '../../utils/searchBox';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport Input, { type InputProps } from '../input/Input';\nimport GroupName from './group-name/GroupName';\nimport SearchBoxBody from './search-box-body/SearchBoxBody';\nimport SearchBoxItem from './search-box-item/SearchBoxItem';\nimport { StyledSearchBoxItemImage } from './search-box-item/SearchBoxItem.styles';\nimport {\n StyledSearchBox,\n StyledSearchBoxHintText,\n StyledSearchBoxIcon,\n StyledSearchBoxLeftWrapper,\n} from './SearchBox.styles';\nimport { useUuid } from '../../hooks/uuid';\nimport DropdownBodyWrapper from '../dropdown-body-wrapper/DropdownBodyWrapper';\nimport TagInput, { TagInputProps, TagInputRef } from '../tag-input/TagInput';\nimport type { DropdownDirection } from '../../types/dropdown';\n\nexport interface SearchBoxRef {\n clear: VoidFunction;\n}\n\nexport interface TagInputSettings {\n onAdd?: TagInputProps['onAdd'];\n onRemove?: TagInputProps['onRemove'];\n size?: TagInputProps['size'];\n shouldAllowMultiple?: TagInputProps['shouldAllowMultiple'];\n tags?: TagInputProps['tags'];\n}\n\nexport const filterSearchBoxItems = ({\n customFilter,\n customSortFunction,\n items,\n searchString,\n shouldUseCustomFilterOnly,\n}: {\n customFilter?: (item: ISearchBoxItem, value: string) => boolean;\n customSortFunction?: SearchBoxSortFunction;\n items: ISearchBoxItem[];\n searchString: string;\n shouldUseCustomFilterOnly?: boolean;\n}) => {\n if (shouldUseCustomFilterOnly) {\n const filteredItems =\n typeof customFilter === 'function'\n ? items.filter((item) => customFilter(item, searchString))\n : items;\n\n return sortSearchBoxItems({ customSortFunction, items: filteredItems, searchString });\n }\n\n if (typeof customFilter !== 'function') {\n return searchList({ customSortFunction, items, searchString });\n }\n\n return searchList({ customSortFunction, items, searchString }).filter((item) =>\n customFilter(item, searchString),\n );\n};\n\nconst getDropdownSearchString = ({\n selectedId,\n shouldKeepSelectedItemPosition,\n value,\n}: {\n selectedId?: string;\n shouldKeepSelectedItemPosition?: boolean;\n value: string;\n}) => (shouldKeepSelectedItemPosition && selectedId ? '' : value);\n\nexport type SearchBoxProps = {\n /**\n * The element where the content of the `ComboBox` should be rendered via React Portal.\n */\n container?: Element;\n /**\n * An optional callback function to filter the elements to be displayed\n * @param item The item to filter.\n * @param value The current input value.\n */\n customFilter?: (item: ISearchBoxItem, value: string) => boolean;\n /**\n * An optional callback function to sort the filtered elements to be displayed\n */\n customSortFunction?: SearchBoxSortFunction;\n /**\n * If true, the custom filter replaces the built-in text search instead of narrowing its results.\n */\n shouldUseCustomFilterOnly?: boolean;\n /**\n * The direction in which the dropdown should be displayed. By default, it is displayed below the input.\n */\n dropdownDirection?: DropdownDirection;\n /**\n * If true, the input field is marked as invalid\n */\n isInvalid?: boolean;\n /**\n * An optional icon that is displayed inside the left side of the input.\n */\n leftIcons?: string[];\n /**\n * Props that are passed to the underlying Input component.\n */\n inputProps?: InputProps;\n /**\n * List of groups with items that can be searched. It is possible to give only one list; if multiple lists are provided, the 'group name' parameter becomes mandatory.\n */\n lists: ISearchBoxItems[];\n /**\n * The maximum height of the dropdown body in pixels.\n */\n maxHeight?: number;\n /**\n * Function to be executed when the input lost focus.\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when the input is changed.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when a letter is pressed\n */\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n /**\n * Function to be executed when an item is selected.\n */\n onSelect?: (item: ISearchBoxItem) => void;\n /**\n * The placeholder that should be displayed.\n */\n placeholder?: string;\n /**\n * Set an input for the search box - it is not an item of a list, just a string.\n */\n presetValue?: string;\n /**\n * Control the selected item. If you use this prop, make sure to update it when the user selects an item.\n */\n selectedId?: string;\n /**\n * If true, the selected item keeps its original position in the dropdown list.\n */\n shouldKeepSelectedItemPosition?: boolean;\n /**\n * If true, the value in the Input is displayed in the list.\n */\n shouldAddInputToList: boolean;\n /**\n * If true, the filter buttons are hidden.\n */\n shouldHideFilterButtons?: boolean;\n /**\n * Whether the full list of items should be displayed if the input is empty.\n */\n shouldShowContentOnEmptyInput?: boolean;\n /**\n * If true, the dropdown items are displayed more compactly.\n */\n shouldShowSmallItems?: boolean;\n /**\n * If true, the images of the items are displayed in a round shape.\n */\n shouldShowRoundImage?: boolean;\n /**\n * Whether the icon to open and close the list should be displayed.\n */\n shouldShowToggleIcon?: boolean;\n /**\n * Settings for the TagInput.\n */\n tagInputSettings?: TagInputSettings;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * A text that should be displayed if no results are found.\n */\n hintText?: string;\n};\n\nconst SearchBox: FC<SearchBoxProps> = forwardRef<SearchBoxRef, SearchBoxProps>(\n (\n {\n container,\n customFilter,\n customSortFunction,\n dropdownDirection,\n inputProps,\n isInvalid = false,\n leftIcons,\n lists,\n maxHeight = 300,\n onBlur,\n onChange,\n onKeyDown,\n onSelect,\n placeholder,\n presetValue,\n hintText,\n selectedId,\n shouldAddInputToList = true,\n shouldKeepSelectedItemPosition = false,\n shouldUseCustomFilterOnly = false,\n shouldHideFilterButtons = false,\n shouldShowContentOnEmptyInput = true,\n shouldShowSmallItems = false,\n shouldShowRoundImage,\n shouldShowToggleIcon = false,\n tagInputSettings,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const [matchingListsItems, setMatchingListsItems] = useState<ISearchBoxItems[]>(lists);\n const [selectedImage, setSelectedImage] = useState<ReactElement>();\n const [internalValue, setInternalValue] = useState(\n typeof presetValue === 'string' && presetValue !== '' ? presetValue : '',\n );\n const inputValue = inputProps?.value;\n const value = inputValue ?? internalValue;\n const setValue = useCallback(\n (nextValue: string) => {\n if (typeof inputValue !== 'string') {\n setInternalValue(nextValue);\n }\n },\n [inputValue],\n );\n const [height, setHeight] = useState<number>(0);\n const [focusedIndex, setFocusedIndex] = useState<number | null>(null);\n const [hasMultipleGroups, setHasMultipleGroups] = useState<boolean>(lists.length > 1);\n const [filteredChildrenArray, setFilteredChildrenArray] = useState<Element[]>();\n const [inputToListValue, setInputToListValue] = useState<string>('');\n const [groups, setGroups] = useState<string[]>(['all']);\n const [shouldShowBody, setShouldShowBody] = useState(false);\n\n const uuid = useUuid();\n\n const boxRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n const tagInputRef = useRef<TagInputRef>(null);\n\n const hasFocusRef = useRef<boolean>(false);\n const isAnimatingRef = useRef<boolean>(false);\n const shouldShowPresetValue = useRef<boolean>(\n typeof presetValue === 'string' && presetValue !== '',\n );\n\n const theme = useTheme() as Theme;\n const dropdownSearchString = getDropdownSearchString({\n selectedId,\n shouldKeepSelectedItemPosition,\n value,\n });\n\n const { isTouch } = useDevice();\n\n /**\n * Checks if there are multiple groups in the lists\n */\n useEffect(() => {\n setHasMultipleGroups(lists.length > 1);\n }, [lists]);\n\n const filterButtons = useMemo(() => {\n const items: IFilterButtonItem[] = [];\n\n if (lists.length <= 1) {\n return items;\n }\n\n lists.forEach(({ groupName }) => {\n if (groupName) {\n items.push({\n id: groupName,\n text: groupName,\n });\n }\n });\n\n return items;\n }, [lists]);\n\n /**\n * Filters the lists by the FilterButtons\n */\n const activeList = useMemo(() => {\n let newLists: ISearchBoxItems[] = [];\n\n if (groups[0] === 'all') {\n newLists = lists;\n } else {\n lists.forEach((list) => {\n if (list.groupName && groups.includes(list.groupName)) {\n newLists.push(list);\n }\n });\n }\n\n const newMatchingItems: ISearchBoxItems[] = [];\n\n newLists.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: dropdownSearchString,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n newMatchingItems.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (newMatchingItems.length === 0 && shouldAddInputToList) {\n newMatchingItems.push({\n groupName: undefined,\n list: [],\n });\n }\n\n const filteredMatchingListItems = newMatchingItems.map(({ list, groupName }) => ({\n groupName,\n list: list.filter((item) => {\n if (typeof customFilter === 'function' && shouldUseCustomFilterOnly) {\n return true;\n }\n\n return !(newMatchingItems.length === 1 && item.text === dropdownSearchString);\n }),\n }));\n\n setMatchingListsItems(filteredMatchingListItems);\n\n return newLists;\n }, [\n groups,\n lists,\n customFilter,\n customSortFunction,\n dropdownSearchString,\n shouldAddInputToList,\n shouldUseCustomFilterOnly,\n ]);\n\n const handleOpen = useCallback(() => {\n setShouldShowBody(true);\n }, []);\n\n const handleClose = useCallback(() => {\n setShouldShowBody(false);\n }, []);\n\n const handleFilterButtonsGroupSelect = (keys: string[]) => {\n setGroups(keys.length === 0 ? ['all'] : keys);\n };\n\n /**\n * This hook calculates the height\n */\n useEffect(() => {\n const textArray: string[] = [];\n\n activeList.forEach(({ list, groupName }) => {\n list.forEach(({ text }) => textArray.push(text));\n if (!groupName) {\n return;\n }\n textArray.push(groupName);\n });\n\n if (shouldAddInputToList && inputToListValue !== '') {\n textArray.push(inputToListValue);\n }\n\n setHeight(calculateContentHeight(textArray));\n }, [inputToListValue, activeList, placeholder, shouldAddInputToList]);\n\n useEffect(() => {\n if (selectedId) {\n activeList.forEach(({ list }) => {\n const selectedItem = list.find(({ id }) => id === selectedId);\n if (selectedItem) {\n setValue(selectedItem.text);\n\n if (selectedItem.imageUrl) {\n setSelectedImage(\n <StyledSearchBoxItemImage\n src={selectedItem.imageUrl}\n $shouldShowRoundImage={shouldShowRoundImage}\n />,\n );\n }\n }\n });\n }\n }, [activeList, selectedId, shouldShowRoundImage]);\n\n /**\n * This hook resets the value if the selectedId changes to undefined. This is an own useEffect because the value\n * should not be reset if the list changes and the selectedId is still undefined.\n */\n useEffect(() => {\n if (!selectedId && !shouldShowPresetValue.current) {\n setValue('');\n }\n }, [selectedId]);\n\n useEffect(() => {\n isAnimatingRef.current = shouldShowBody;\n }, [shouldShowBody]);\n\n useEffect(() => {\n if (\n (matchingListsItems.length !== 0 || hintText) &&\n !isAnimatingRef.current &&\n hasFocusRef.current\n ) {\n handleOpen();\n }\n }, [handleOpen, hintText, matchingListsItems.length]);\n\n /**\n * This function handles the focus event of the input and opens the dropdown if the input\n * should show content on an empty input\n */\n const handleFocus = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n hasFocusRef.current = true;\n\n if (typeof inputProps?.onFocus === 'function') {\n inputProps.onFocus(event);\n }\n\n if (shouldShowContentOnEmptyInput) {\n const newMatchingItems: ISearchBoxItems[] = [];\n\n activeList.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: dropdownSearchString,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n newMatchingItems.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (newMatchingItems.length === 0 && shouldAddInputToList) {\n newMatchingItems.push({\n groupName: undefined,\n list: [],\n });\n }\n\n const filteredMatchingListItems = newMatchingItems.map(\n ({ list, groupName }) => ({\n groupName,\n list: list.filter((item) => {\n if (\n typeof customFilter === 'function' &&\n shouldUseCustomFilterOnly\n ) {\n return true;\n }\n\n return !(\n newMatchingItems.length === 1 &&\n item.text === dropdownSearchString\n );\n }),\n }),\n );\n\n setMatchingListsItems(filteredMatchingListItems);\n\n if (filteredMatchingListItems.length !== 0 || hintText) {\n handleOpen();\n }\n }\n },\n [\n shouldShowContentOnEmptyInput,\n activeList,\n shouldAddInputToList,\n hintText,\n dropdownSearchString,\n customFilter,\n customSortFunction,\n shouldUseCustomFilterOnly,\n handleOpen,\n inputProps,\n ],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(\n (event) => {\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n\n if (typeof inputProps?.onKeyDown === 'function') {\n inputProps.onKeyDown(event);\n }\n },\n [inputProps, onKeyDown],\n );\n\n /**\n * This function filters the lists by input\n */\n\n useEffect(() => {\n const newMatchingItems: ISearchBoxItems[] = [];\n\n activeList.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: dropdownSearchString,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n newMatchingItems.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (newMatchingItems.length === 0 && shouldAddInputToList) {\n newMatchingItems.push({\n groupName: undefined,\n list: [],\n });\n }\n\n if (shouldAddInputToList && inputToListValue !== '') {\n newMatchingItems.forEach(({ list }) => {\n list.forEach(({ text }) => {\n if (text.toLowerCase() === inputToListValue.toLowerCase()) {\n setInputToListValue('');\n }\n });\n });\n }\n }, [\n inputToListValue,\n activeList,\n shouldAddInputToList,\n shouldShowContentOnEmptyInput,\n dropdownSearchString,\n customFilter,\n customSortFunction,\n shouldUseCustomFilterOnly,\n ]);\n\n const handleClick = useCallback(() => {\n if (shouldShowBody) {\n handleClose();\n } else {\n handleOpen();\n }\n }, [handleClose, handleOpen, shouldShowBody]);\n\n const rightElement = useMemo(() => {\n if (!shouldShowToggleIcon) {\n return undefined;\n }\n\n return (\n <StyledSearchBoxIcon onClick={handleClick}>\n <Icon icons={['fa fa-chevron-down']} color={theme['006'] as string} />\n </StyledSearchBoxIcon>\n );\n }, [handleClick, shouldShowToggleIcon, theme]);\n\n const leftElement = useMemo(\n () =>\n (leftIcons || selectedImage) && (\n <StyledSearchBoxLeftWrapper>\n {leftIcons && <Icon icons={leftIcons} />}\n {selectedImage && selectedImage}\n </StyledSearchBoxLeftWrapper>\n ),\n [leftIcons, selectedImage],\n );\n\n /**\n * This function handles changes of the input\n */\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const filteredLists: ISearchBoxItems[] = [];\n shouldShowPresetValue.current = false;\n\n activeList.forEach(({ list, groupName }) => {\n const newList = filterSearchBoxItems({\n customFilter,\n customSortFunction,\n items: list,\n searchString: event.target.value,\n shouldUseCustomFilterOnly,\n });\n\n if (newList.length > 0) {\n filteredLists.push({\n groupName,\n list: newList,\n });\n }\n });\n\n if (filteredLists.length === 0 && shouldAddInputToList) {\n filteredLists.push({\n groupName: undefined,\n list: [],\n });\n }\n\n setSelectedImage(undefined);\n\n if (!shouldShowContentOnEmptyInput && !event.target.value) {\n setMatchingListsItems([]);\n } else {\n setMatchingListsItems(filteredLists);\n }\n\n if (filteredLists.length !== 0) {\n handleOpen();\n }\n\n setValue(event.target.value);\n setInputToListValue(event.target.value);\n\n if (typeof onChange === 'function') {\n onChange(event);\n }\n\n if (typeof inputProps?.onChange === 'function') {\n inputProps.onChange(event);\n }\n },\n [\n activeList,\n customFilter,\n customSortFunction,\n handleOpen,\n inputProps,\n onChange,\n shouldAddInputToList,\n shouldShowContentOnEmptyInput,\n shouldUseCustomFilterOnly,\n ],\n );\n\n /**\n * This function handles the blur event of the input\n */\n const handleBlur = useCallback(\n (event: FocusEvent<HTMLInputElement>) => {\n hasFocusRef.current = false;\n\n if (typeof onBlur === 'function') {\n onBlur(event);\n }\n\n if (typeof inputProps?.onBlur === 'function') {\n inputProps.onBlur(event);\n }\n },\n [inputProps, onBlur],\n );\n\n const handleDropdownOutsideClick = useCallback(() => {\n tagInputRef.current?.blur();\n\n return hasFocusRef.current && isTouch;\n }, [isTouch]);\n\n const handleContainerBlur = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n const nextFocusedElement = event.relatedTarget as Node | null;\n const currentContainer = event.currentTarget as HTMLElement;\n\n // Check if focus is moving outside the SearchBox container\n // Also check the dropdown content (contentRef) since it's rendered in a portal\n if (\n !nextFocusedElement ||\n (!currentContainer.contains(nextFocusedElement) &&\n !contentRef.current?.contains(nextFocusedElement))\n ) {\n handleClose();\n }\n },\n [handleClose],\n );\n\n /**\n * This function handles the item selection\n */\n const handleSelect = useCallback(\n (item: ISearchBoxItem) => {\n const newItem = {\n ...item,\n text: item.text.replace('<b>', '').replace('</b>', '').replace('</b', ''),\n };\n\n if (tagInputSettings) {\n setValue('');\n setInputToListValue('');\n tagInputRef.current?.resetValue();\n } else {\n setValue(newItem.text);\n }\n\n handleClose();\n\n setSelectedImage(\n newItem.imageUrl ? (\n <StyledSearchBoxItemImage\n src={newItem.imageUrl}\n $shouldShowRoundImage={shouldShowRoundImage}\n />\n ) : undefined,\n );\n\n setMatchingListsItems([]);\n\n if (typeof onSelect === 'function') {\n onSelect(newItem);\n }\n },\n [handleClose, onSelect, shouldShowRoundImage, tagInputSettings],\n );\n\n const content = useMemo(() => {\n if (hintText && matchingListsItems.length === 0) {\n return (\n <StyledSearchBoxHintText>\n {hintText.replace('##value##', value)}\n </StyledSearchBoxHintText>\n );\n }\n\n const items: ReactElement[] = [];\n\n matchingListsItems.forEach(({ groupName, list }, index) => {\n if (hasMultipleGroups) {\n if (list.length <= 0) {\n return;\n }\n\n if (index !== 0) {\n items.push(<GroupName key={groupName} name={groupName ?? ''} />);\n }\n }\n\n list.forEach(({ id, text, imageUrl }, listIndex) => {\n items.push(\n <SearchBoxItem\n key={`${id}_${groupName ?? ''}`}\n id={id}\n text={text}\n imageUrl={imageUrl}\n shouldShowSmallItems={shouldShowSmallItems}\n shouldShowRoundImage={shouldShowRoundImage}\n onSelect={handleSelect}\n groupName={groupName}\n tabIndex={index === 0 && listIndex === 0 ? 0 : -1}\n />,\n );\n });\n });\n\n if (shouldAddInputToList && inputToListValue !== '') {\n items.push(\n <SearchBoxItem\n id=\"input-value\"\n onSelect={handleSelect}\n shouldShowSmallItems={shouldShowSmallItems}\n text={`<b>${inputToListValue}</b`}\n tabIndex={items.length === 0 ? 0 : -1}\n />,\n );\n }\n\n return items;\n }, [\n hintText,\n matchingListsItems,\n shouldAddInputToList,\n inputToListValue,\n value,\n hasMultipleGroups,\n shouldShowSmallItems,\n shouldShowRoundImage,\n handleSelect,\n ]);\n\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n if (!shouldShowBody || matchingListsItems.length === 0) {\n return;\n }\n\n const children = contentRef.current?.children;\n\n if (!children) {\n return;\n }\n\n const childrenArray = Array.from(children);\n\n const newChildren = childrenArray.find((child) =>\n child.id.startsWith('searchBoxContent__'),\n )?.children;\n\n if (!(newChildren && newChildren.length > 0)) {\n return;\n }\n\n const filteredChildren = Array.from(newChildren).filter(\n (child) => (child as HTMLElement).dataset.isgroupname !== 'true',\n );\n\n setFilteredChildrenArray(filteredChildren);\n\n if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {\n e.preventDefault();\n\n if (newChildren && newChildren.length > 0) {\n const newIndex =\n focusedIndex !== null\n ? (focusedIndex +\n (e.key === 'ArrowUp' ? -1 : 1) +\n filteredChildren.length) %\n filteredChildren.length\n : 0;\n\n if (focusedIndex !== null) {\n const prevElement = filteredChildren[focusedIndex] as HTMLDivElement;\n prevElement.tabIndex = -1;\n }\n\n setFocusedIndex(newIndex);\n\n const newElement = filteredChildren[newIndex] as HTMLDivElement;\n\n newElement.tabIndex = 0;\n }\n } else if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n\n if (filteredChildren) {\n const element = filteredChildren[focusedIndex ?? 0];\n\n if (!element) {\n return;\n }\n\n const { textContent } = element;\n\n let imageUrl: string | undefined;\n\n // Just Ignore, it works\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (element.children[0]?.attributes.src) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n imageUrl = element.children[0]?.attributes.src.nodeValue as string;\n }\n\n const newId = getSearchBoxItemId(element);\n\n handleSelect({\n id: newId === 'input-value' ? textContent : newId,\n text: textContent ?? '',\n imageUrl,\n });\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [\n filteredChildrenArray,\n focusedIndex,\n handleSelect,\n matchingListsItems.length,\n shouldShowBody,\n ]);\n\n const handleKeyPress = useCallback((event: KeyboardEvent) => {\n if (event.keyCode === 27) {\n setMatchingListsItems([]);\n }\n }, []);\n\n useImperativeHandle(\n ref,\n () => ({\n clear: () => setValue(''),\n }),\n [setValue],\n );\n\n useEffect(() => {\n document.addEventListener('keydown', handleKeyPress);\n\n return () => {\n document.addEventListener('keydown', handleKeyPress);\n };\n }, [handleKeyPress]);\n\n /**\n * Update the value if preset value changes\n */\n useEffect(() => {\n if (presetValue) {\n setValue(presetValue);\n }\n }, [presetValue, setValue]);\n\n const shouldShowDropdown =\n shouldShowBody &&\n (matchingListsItems.length !== 0 || !!hintText) &&\n (value.trim() !== '' || shouldShowContentOnEmptyInput);\n\n return useMemo(\n () => (\n <StyledSearchBox\n ref={boxRef}\n key={`search-box-${uuid}`}\n onBlur={handleContainerBlur}\n >\n <div id={`search_box_input${uuid}`}>\n {tagInputSettings ? (\n <TagInput\n leftElement={leftElement}\n onAdd={tagInputSettings.onAdd}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onRemove={tagInputSettings.onRemove}\n placeholder={placeholder}\n ref={tagInputRef}\n size={tagInputSettings.size}\n shouldAllowMultiple={tagInputSettings.shouldAllowMultiple}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n shouldPreventEnter\n tags={tagInputSettings.tags}\n />\n ) : (\n <Input\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...inputProps}\n isInvalid={isInvalid}\n leftElement={leftElement}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n rightElement={rightElement}\n shouldEnableKeyboardHighlighting={\n inputProps?.shouldEnableKeyboardHighlighting ??\n shouldEnableKeyboardHighlighting\n }\n value={value}\n />\n )}\n </div>\n {boxRef.current && (\n <DropdownBodyWrapper\n anchorElement={boxRef.current}\n container={container}\n direction={dropdownDirection}\n onClose={handleClose}\n onOutsideClick={handleDropdownOutsideClick}\n shouldShowDropdown={shouldShowDropdown}\n >\n <SearchBoxBody\n filterButtons={filterButtons}\n height={height}\n maxHeight={maxHeight}\n shouldShow={shouldShowDropdown}\n key={`search-box-body-${uuid}`}\n onGroupSelect={handleFilterButtonsGroupSelect}\n ref={contentRef}\n selectedGroups={groups}\n shouldHideFilterButtons={shouldHideFilterButtons}\n >\n {content}\n </SearchBoxBody>\n </DropdownBodyWrapper>\n )}\n </StyledSearchBox>\n ),\n [\n container,\n content,\n dropdownDirection,\n filterButtons,\n groups,\n handleBlur,\n handleChange,\n handleClose,\n handleDropdownOutsideClick,\n handleFocus,\n handleKeyDown,\n height,\n inputProps,\n isInvalid,\n leftElement,\n maxHeight,\n onKeyDown,\n placeholder,\n rightElement,\n shouldHideFilterButtons,\n shouldShowDropdown,\n shouldEnableKeyboardHighlighting,\n tagInputSettings,\n uuid,\n value,\n ],\n );\n },\n);\n\nSearchBox.displayName = 'SearchBox';\n\nexport default SearchBox;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAgBA,IAAAG,iBAAA,GAAAH,OAAA;AAGA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AAOA,IAAAM,KAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,UAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,cAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,cAAA,GAAAJ,sBAAA,CAAAP,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA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