@e1011/es-kit 1.1.85 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/hooks/esm/index.css +333 -333
  2. package/dist/hooks/esm/src/core/hooks/index.js +1 -1
  3. package/dist/hooks/esm/src/core/hooks/useThemePreference.js +1 -1
  4. package/dist/hooks/esm/src/core/hooks/useThemePreference.js.map +1 -1
  5. package/dist/hooks/esm/src/core/utils/helpers/ui.js +1 -1
  6. package/dist/hooks/esm/src/core/utils/helpers/ui.js.map +1 -1
  7. package/dist/hooks/index.css +333 -333
  8. package/dist/hooks/src/core/hooks/index.js +1 -1
  9. package/dist/hooks/src/core/hooks/useThemePreference.js +1 -1
  10. package/dist/hooks/src/core/hooks/useThemePreference.js.map +1 -1
  11. package/dist/hooks/src/core/utils/helpers/ui.js +1 -1
  12. package/dist/hooks/src/core/utils/helpers/ui.js.map +1 -1
  13. package/dist/lib/cjs/src/core/hooks/useThemePreference.js +1 -1
  14. package/dist/lib/cjs/src/core/hooks/useThemePreference.js.map +1 -1
  15. package/dist/lib/cjs/src/core/ui/components/atoms/icons.js +1 -1
  16. package/dist/lib/cjs/src/core/ui/components/atoms/icons.js.map +1 -1
  17. package/dist/lib/cjs/src/core/ui/components/atoms/text/Text.js +1 -1
  18. package/dist/lib/cjs/src/core/ui/components/atoms/text/Text.js.map +1 -1
  19. package/dist/lib/cjs/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
  20. package/dist/lib/cjs/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
  21. package/dist/lib/cjs/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
  22. package/dist/lib/cjs/src/core/utils/helpers/ui.js +1 -1
  23. package/dist/lib/cjs/src/core/utils/helpers/ui.js.map +1 -1
  24. package/dist/lib/cjs/src/index.js +1 -1
  25. package/dist/lib/esm/src/core/hooks/useThemePreference.js +1 -1
  26. package/dist/lib/esm/src/core/hooks/useThemePreference.js.map +1 -1
  27. package/dist/lib/esm/src/core/ui/components/atoms/icons.js +1 -1
  28. package/dist/lib/esm/src/core/ui/components/atoms/icons.js.map +1 -1
  29. package/dist/lib/esm/src/core/ui/components/atoms/text/Text.js +1 -1
  30. package/dist/lib/esm/src/core/ui/components/atoms/text/Text.js.map +1 -1
  31. package/dist/lib/esm/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
  32. package/dist/lib/esm/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
  33. package/dist/lib/esm/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
  34. package/dist/lib/esm/src/core/utils/helpers/ui.js +1 -1
  35. package/dist/lib/esm/src/core/utils/helpers/ui.js.map +1 -1
  36. package/dist/lib/esm/src/index.js +1 -1
  37. package/dist/lib/tsconfig.tsbuildinfo +1 -1
  38. package/dist/types/src/core/hooks/useThemePreference.d.ts +0 -41
  39. package/dist/types/src/core/hooks/useThemePreference.d.ts.map +1 -1
  40. package/dist/types/src/core/ui/components/atoms/icons.d.ts.map +1 -1
  41. package/dist/types/src/core/ui/components/atoms/text/Text.d.ts.map +1 -1
  42. package/dist/types/src/core/ui/components/error/ErrorBoundary.d.ts +2 -2
  43. package/dist/types/src/core/ui/components/error/ErrorBoundary.d.ts.map +1 -1
  44. package/dist/types/src/core/ui/components/molecules/popover/PopoverLite.d.ts.map +1 -1
  45. package/dist/types/src/core/utils/helpers/ui.d.ts +40 -0
  46. package/dist/types/src/core/utils/helpers/ui.d.ts.map +1 -1
  47. package/dist/ui/esm/src/core/ui/components/atoms/icons.js +1 -1
  48. package/dist/ui/esm/src/core/ui/components/atoms/icons.js.map +1 -1
  49. package/dist/ui/esm/src/core/ui/components/atoms/text/Text.js +1 -1
  50. package/dist/ui/esm/src/core/ui/components/atoms/text/Text.js.map +1 -1
  51. package/dist/ui/esm/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
  52. package/dist/ui/esm/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
  53. package/dist/ui/esm/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
  54. package/dist/ui/esm/src/core/utils/helpers/ui.js.map +1 -1
  55. package/dist/ui/src/core/ui/components/atoms/icons.js +1 -1
  56. package/dist/ui/src/core/ui/components/atoms/icons.js.map +1 -1
  57. package/dist/ui/src/core/ui/components/atoms/text/Text.js +1 -1
  58. package/dist/ui/src/core/ui/components/atoms/text/Text.js.map +1 -1
  59. package/dist/ui/src/core/ui/components/error/ErrorBoundary.js.map +1 -1
  60. package/dist/ui/src/core/ui/components/molecules/popover/PopoverLite.js +1 -1
  61. package/dist/ui/src/core/ui/components/molecules/popover/PopoverLite.js.map +1 -1
  62. package/dist/ui/src/core/utils/helpers/ui.js.map +1 -1
  63. package/dist/utils/esm/index.css +333 -333
  64. package/dist/utils/esm/src/core/utils/helpers/ui.js +1 -1
  65. package/dist/utils/esm/src/core/utils/helpers/ui.js.map +1 -1
  66. package/dist/utils/esm/src/core/utils/index.js +1 -1
  67. package/dist/utils/index.css +333 -333
  68. package/dist/utils/src/core/utils/helpers/ui.js +1 -1
  69. package/dist/utils/src/core/utils/helpers/ui.js.map +1 -1
  70. package/dist/utils/src/core/utils/index.js +1 -1
  71. package/package.json +4 -3
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./useApi.js"),s=require("./useToggle.js"),r=require("./useToggle2.js"),u=require("./useOutsideClick.js"),o=require("./useResize.js"),t=require("./useClassNames.js"),i=require("./useParseProps.js"),p=require("./useThemePreference.js"),m=require("./useAnimation.js"),a=require("./useIntersectionObserver.js"),l=require("./useSetTimeout.js");exports.useApi=e.useApi,exports.useToggle=s.useToggle,exports.useToggle2=r.useToggle2,exports.outsideClickHandler=u.outsideClickHandler,exports.useOutsideClick=u.useOutsideClick,exports.useResize=o.useResize,exports.useClassNames=t.useClassNames,exports.useParseProps=i.useParseProps,exports.getBaseThemes=p.getBaseThemes,exports.observeThemePreference=p.observeThemePreference,exports.setThemeClassNames=p.setThemeClassNames,exports.switchColorTheme=p.switchColorTheme,exports.updateColorTheme=p.updateColorTheme,exports.useThemePreference=p.useThemePreference,exports.useAnimation=m.useAnimation,exports.useIntersectionObserver=a.useIntersectionObserver,exports.useTimeoutFn=l.useTimeoutFn;
1
+ "use strict";var e=require("./useApi.js"),s=require("./useToggle.js"),r=require("./useToggle2.js"),u=require("./useOutsideClick.js"),i=require("./useResize.js"),o=require("./useClassNames.js"),t=require("./useParseProps.js"),n=require("./useThemePreference.js"),p=require("./useAnimation.js"),l=require("./useIntersectionObserver.js"),a=require("./useSetTimeout.js");exports.useApi=e.useApi,exports.useToggle=s.useToggle,exports.useToggle2=r.useToggle2,exports.outsideClickHandler=u.outsideClickHandler,exports.useOutsideClick=u.useOutsideClick,exports.useResize=i.useResize,exports.useClassNames=o.useClassNames,exports.useParseProps=t.useParseProps,exports.useThemePreference=n.useThemePreference,exports.useAnimation=p.useAnimation,exports.useIntersectionObserver=l.useIntersectionObserver,exports.useTimeoutFn=a.useTimeoutFn;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react");const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=o=>{const s=e();null==c||c(o,s),null==t||t(o)},r=e=>{s(e.matches)},d=e=>{s(!e.matches)},l=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}catch(e){}return s(null==l?void 0:l.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,d),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}};let s={dark:"theme-dark",light:"theme-light"};const c=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=e?s.light:s.dark,r=e?s.dark:s.light;o&&(o.classList.remove(c),o.classList.remove(r),o.classList.add(r)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(r)),e.classList.remove(".".concat(c))})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,s;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const d=null===(s=e.shadowRoot)||void 0===s?void 0:s.childNodes[0];d&&(d.classList.add(r),d.classList.remove(c))}))))};exports.getBaseThemes=()=>s,exports.observeThemePreference=t,exports.setThemeClassNames=e=>{s=e},exports.switchColorTheme=c,exports.updateColorTheme=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(s.dark)),c(t,o||document.body)},exports.useThemePreference=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>t(o,s)),[o,s])};
1
+ "use strict";var e=require("react"),r=require("../utils/helpers/ui.js");exports.useThemePreference=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>r.observeThemePreference(t,s)),[t,s])};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","baseThemes","dark","light","getBaseThemes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","themes","updateColorTheme","resolvedIsDark","contains","useEffect"],"mappings":"oCAGA,MAAMA,EAAkC,SAQ3BC,EAAyB,WAGrB,IAFfC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1E,MAAMC,EAA2BD,IAC/B,MAAME,EAAcT,IAEpBU,SAAAA,EAAmBH,EAAQE,GAC3BH,SAAAA,EAAiBC,EAAO,EAGpBI,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AQG,kBAAU,IAAAD,GAA+B,QAA/BA,EAAlBA,EAAoBE,cAAa,IAAAN,OAAKN,WAAW,IAAAU,GAAjDA,EAAmDR,UAAUC,OAAOH,EAAS,IAG/ErB,SAAS0B,iBAAiB,gBAAgBE,SAASC,IAAY,IAAAK,EAAAC,EAAAC,EAC3C,QAAlBF,EAAAL,EAAQG,kBAAU,IAAAE,GAA+B,QAA/BA,EAAlBA,EAAoBD,cAAa,IAAAN,OAAKN,WAAW,IAAAa,GAAjDA,EAAmDX,UAAUE,IAAIH,GAC/C,QAAlBa,EAAAN,EAAQG,kBAAU,IAAAG,GAA+B,QAA/BA,EAAlBA,EAAoBF,cAAa,IAAAN,OAAKN,WAAW,IAAAc,GAAjDA,EAAmDZ,UAAUC,OAAOH,GAEpE,MAAMgB,EAA4CD,QAArBA,EAAGP,EAAQG,sBAAUI,SAAlBA,EAAoBE,WAAW,GAE3DD,IACFA,EAAWd,UAAUE,IAAIH,GACzBe,EAAWd,UAAUC,OAAOH,GAC9B,KAIR,wBAnD6BF,IAAgBH,8DAMVuB,IACjCvB,EAAauB,CAAM,sDAmDWC,CAACrC,EAAkBE,KACjD,IAAIoC,EAA0BtC,IAAU,EAEhB,oBAAbH,eAAuCD,IAAXI,IACrCsC,EAAiBzC,SAASC,KAAKsB,UAAUmB,SAAS1B,EAAWC,OAE/DX,EAAiBmC,EAAgBpC,GAAeL,SAASC,KAAK,6BA3F9B,WAGvB,IAFTL,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EwC,EAASA,WAAC,IAAMhD,EAAuBC,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}
1
+ {"version":3,"file":"useThemePreference.js","sources":["../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { observeThemePreference } from '../utils/helpers/ui'\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n"],"names":["getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","useEffect","observeThemePreference"],"mappings":"mGASkC,WAGvB,IAFTA,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EC,EAASA,WAAC,IAAMC,EAAAA,uBAAuBT,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}
@@ -1,2 +1,2 @@
1
- "use strict";require("../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");exports.classNames=function(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return e.filter((r=>"string"==typeof r&&null!=r)).filter(Boolean).join(" ")},exports.parseProps=r=>{const e={},t={};return Object.entries(r).forEach((r=>{let[s,o]=r;"data-"===s.substr(0,5)||"data"===s.substr(0,4)?e[s]=o:t[s]=o})),{dataProps:e,restProps:t}};
1
+ "use strict";require("../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");let e="theme-dark",o="theme-light";const t=function(t,r){let s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=t?o:e,l=t?e:o;r&&(r.classList.remove(c),r.classList.remove(l),r.classList.add(l)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(l)),e.classList.remove(".".concat(c))})),s&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,r;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const s=null===(r=e.shadowRoot)||void 0===r?void 0:r.childNodes[0];s&&(s.classList.add(l),s.classList.remove(c))}))))},r="change";exports.classNames=function(){for(var e=arguments.length,o=new Array(e),t=0;t<e;t++)o[t]=arguments[t];return o.filter((e=>"string"==typeof e&&null!=e)).filter(Boolean).join(" ")},exports.observeThemePreference=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=r=>{const s=e();null==t||t(r,s),null==o||o(r)},c=e=>{s(e.matches)},l=e=>{s(!e.matches)},a=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(r,c),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(r,l)}catch(e){}return s(null==a?void 0:a.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(r,c),window.matchMedia("(prefers-color-scheme: light)").addEventListener(r,l),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(r,c),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(r,l)}},exports.parseProps=e=>{const o={},t={};return Object.entries(e).forEach((e=>{let[r,s]=e;"data-"===r.substr(0,5)||"data"===r.substr(0,4)?o[r]=s:t[r]=s})),{dataProps:o,restProps:t}},exports.switchColorTheme=t;
2
2
  //# sourceMappingURL=ui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sources":["../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n"],"names":["_len","arguments","length","classes","Array","_key","filter","className","Boolean","join","props","dataProps","restProps","Object","entries","forEach","_ref","key","value","substr"],"mappings":"oHAY0B,WAAA,IAAA,IAAAA,EAAAC,UAAAC,OAAIC,EAAOC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAAPF,EAAOE,GAAAJ,UAAAI,GAAA,OAA2BF,EAC7DG,QAAQC,GAAgD,iBAAdA,GAAP,MAAiCA,IACpED,OAAOE,SAASC,KAAK,IAAI,qBAQDC,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOC,QAAQJ,GAAOK,SAAQC,IAAkB,IAAhBC,EAAKC,GAAMF,EAChB,UAArBC,EAAIE,OAAO,EAAG,IAAuC,SAArBF,EAAIE,OAAO,EAAG,GAChDR,EAAUM,GAAOC,EAEjBN,EAAUK,GAAOC,CACnB,IAEK,CAAEP,YAAWC,YAAW"}
1
+ {"version":3,"file":"ui.js","sources":["../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\nexport type ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n"],"names":["baseThemes","switchColorTheme","isDark","htmlElement","findShadows","arguments","length","undefined","oldClass","newClass","classList","remove","add","document","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","windowMatchMediaChangeEventType","_len","classes","Array","_key","filter","className","Boolean","join","getHtmlElement","body","switchCallback","switchColorThemeHandler","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","props","dataProps","restProps","Object","entries","_ref","key","value","substr"],"mappings":"iGAsHA,IAAIA,EACI,aADJA,EAEK,cAuBF,MAAMC,EAAmB,SAACC,EAAiBC,GAAwD,IAA7BC,IAAWC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACtF,MAAMG,EAAWN,EAASF,EAAmBA,EACvCS,EAAWP,EAASF,EAAkBA,EAExCG,IACFA,EAAYO,UAAUC,OAAOH,GAC7BL,EAAYO,UAAUC,OAAOF,GAC7BN,EAAYO,UAAUE,IAAIH,IAGJ,oBAAbI,WACTA,SAASC,iBAAgBC,IAAAA,OAAKP,IAAYQ,SAASC,IACjDA,EAAQP,UAAUE,QAAGG,OAAKN,IAC1BQ,EAAQP,UAAUC,WAAMI,OAAKP,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CjC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIH,GAAAA,GAA6BA,EAE1E,MAAMqC,EAA2BrC,IAC/B,MAAMC,EAAciC,IAEpBnC,SAAAA,EAAmBC,EAAQC,GAC3BmC,SAAAA,EAAiBpC,EAAO,EAGpBsC,EAA+BC,IACnCF,EAAwBE,EAAMC,QAAQ,EAGlCC,EAAgCF,IACpCF,GAAyBE,EAAMC,QAAQ,EAGnCxC,EAAS0C,OAAOC,WAAW,gCAEjC,IACED,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAEpC,CAAC,MAAOI,GAAO,CAYhB,OARAR,EAAwBrC,eAAAA,EAAQwC,SAChCE,OAAOC,WAAW,gCAAgCG,iBAChDrB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCG,iBACjDrB,EAAiCgB,GAG5B,KACLC,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAClC,CAEL,qBApO2BM,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOC,QAAQJ,GAAOjC,SAAQsC,IAAkB,IAAhBC,EAAKC,GAAMF,EAChB,UAArBC,EAAIE,OAAO,EAAG,IAAuC,SAArBF,EAAIE,OAAO,EAAG,GAChDP,EAAUK,GAAOC,EAEjBL,EAAUI,GAAOC,CACnB,IAEK,CAAEN,YAAWC,YAAW"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react");const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const s=o=>{const s=e();null==c||c(o,s),null==t||t(o)},r=e=>{s(e.matches)},d=e=>{s(!e.matches)},l=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}catch(e){}return s(null==l?void 0:l.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,d),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,d)}};let s={dark:"theme-dark",light:"theme-light"};const c=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=e?s.light:s.dark,r=e?s.dark:s.light;o&&(o.classList.remove(c),o.classList.remove(r),o.classList.add(r)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(r)),e.classList.remove(".".concat(c))})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,s;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(r),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const d=null===(s=e.shadowRoot)||void 0===s?void 0:s.childNodes[0];d&&(d.classList.add(r),d.classList.remove(c))}))))};exports.getBaseThemes=()=>s,exports.observeThemePreference=t,exports.setThemeClassNames=e=>{s=e},exports.switchColorTheme=c,exports.updateColorTheme=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(s.dark)),c(t,o||document.body)},exports.useThemePreference=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>t(o,s)),[o,s])};
1
+ "use strict";var e=require("react"),r=require("../utils/helpers/ui.js");exports.useThemePreference=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e.useEffect((()=>r.observeThemePreference(t,s)),[t,s])};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","baseThemes","dark","light","getBaseThemes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","themes","updateColorTheme","resolvedIsDark","contains","useEffect"],"mapp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CC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EwC,EAASA,WAAC,IAAMhD,EAAuBC,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}
1
+ {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { observeThemePreference } from '../utils/helpers/ui'\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n"],"names":["getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","useEffect","observeThemePreference"],"mappings":"mGASkC,WAGvB,IAFTA,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EC,EAASA,WAAC,IAAMC,EAAAA,uBAAuBT,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&e.__esModule?e:{default:e}}var t=e(require("react"));const c=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t.default.createElement("path",{d:"M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z"})),s=t.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},t.default.createElement("path",{d:"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z"}));exports.closeIconJSX=c,exports.infoIconJSX=s;
1
+ "use strict";const e=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},React.createElement("path",{d:"M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z"})),c=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 512 512"},React.createElement("path",{d:"M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z"}));exports.closeIconJSX=e,exports.infoIconJSX=c;
2
2
  //# sourceMappingURL=icons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sources":["../../../../../../../../src/core/ui/components/atoms/icons.tsx"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React from 'react'\n\nexport const closeIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z' /></svg>\n)\nexport const infoIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z' /></svg>\n\n)\n\n\nexport const appStoreIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M255.9 120.9l9.1-15.7c5.6-9.8 18.1-13.1 27.9-7.5 9.8 5.6 13.1 18.1 7.5 27.9l-87.5 151.5h63.3c20.5 0 32 24.1 23.1 40.8H113.8c-11.3 0-20.4-9.1-20.4-20.4 0-11.3 9.1-20.4 20.4-20.4h52l66.6-115.4-20.8-36.1c-5.6-9.8-2.3-22.2 7.5-27.9 9.8-5.6 22.2-2.3 27.9 7.5l8.9 15.7zm-78.7 218l-19.6 34c-5.6 9.8-18.1 13.1-27.9 7.5-9.8-5.6-13.1-18.1-7.5-27.9l14.6-25.2c16.4-5.1 29.8-1.2 40.4 11.6zm168.9-61.7h53.1c11.3 0 20.4 9.1 20.4 20.4 0 11.3-9.1 20.4-20.4 20.4h-29.5l19.9 34.5c5.6 9.8 2.3 22.2-7.5 27.9-9.8 5.6-22.2 2.3-27.9-7.5-33.5-58.1-58.7-101.6-75.4-130.6-17.1-29.5-4.9-59.1 7.2-69.1 13.4 23 33.4 57.7 60.1 104zM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z' /></svg>\n)\n\n\nexport const batteryEmptyIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'><path d='M544 192V160c0-35.35-28.65-64-64-64H64C28.65 96 0 124.7 0 160v192c0 35.35 28.65 64 64 64h416c35.35 0 64-28.65 64-64v-32c17.67 0 32-14.33 32-32V224C576 206.3 561.7 192 544 192zM480 352H64V160h416V352z' /></svg>\n)\n\n\nexport const elementorIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M425.6 32H22.4C10 32 0 42 0 54.4v403.2C0 470 10 480 22.4 480h403.2c12.4 0 22.4-10 22.4-22.4V54.4C448 42 438 32 425.6 32M164.3 355.5h-39.8v-199h39.8v199zm159.3 0H204.1v-39.8h119.5v39.8zm0-79.6H204.1v-39.8h119.5v39.8zm0-79.7H204.1v-39.8h119.5v39.8z' /></svg>\n)\n\nexport const squareCheckIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M384 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h320c35.35 0 64-28.65 64-64V96C448 60.65 419.3 32 384 32zM400 416c0 8.836-7.164 16-16 16H64c-8.836 0-16-7.164-16-16V96c0-8.838 7.164-16 16-16h320c8.836 0 16 7.162 16 16V416zM303 175L192 286.1L144.1 239c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l64 64C179.7 341.7 185.8 344 192 344s12.28-2.344 16.97-7.031l128-128c9.375-9.375 9.375-24.56 0-33.94S312.4 165.7 303 175z' /></svg>\n)\n\nexport const pencilIcon = (\n <svg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path d='M8.91878 3.38356L6.59333 1.08219L7.35936 0.315069C7.56911 0.105023 7.82682 0 8.13251 0C8.43782 0 8.69536 0.105023 8.9051 0.315069L9.67113 1.08219C9.88088 1.29224 9.99031 1.54575 9.99943 1.84274C10.0086 2.13936 9.90824 2.39269 9.69849 2.60274L8.91878 3.38356ZM8.12539 4.19178L2.32545 10H0V7.67123L5.79994 1.86301L8.12539 4.19178Z' fill='#E2E369' />\n </svg>\n\n)\n"],"names":["closeIconJSX","React","createElement","xmlns","viewBox","default","d","infoIconJSX"],"mappings":"0FAIaA,MAAAA,EACXC,EAAAA,QAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,EAAAI,QAAAH,cAAA,OAAA,CAAMI,EAAE,ygBAE3DC,EACXN,EAAAA,QAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,EAAAI,QAAAH,cAAA,OAAA,CAAMI,EAAE"}
1
+ {"version":3,"file":"icons.js","sources":["../../../../../../../../src/core/ui/components/atoms/icons.tsx"],"sourcesContent":["\nexport const closeIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M336.1 175c-9.375-9.375-24.56-9.375-33.94 0L256 222.1L208.1 175c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l47.03 47.03L175 303c-9.375 9.375-9.375 24.56 0 33.94c9.373 9.373 24.56 9.381 33.94 0L256 289.9l47.03 47.03c9.373 9.373 24.56 9.381 33.94 0c9.375-9.375 9.375-24.56 0-33.94l-47.03-47.03l47.03-47.03C346.3 199.6 346.3 184.4 336.1 175zM256 0C114.6 0 0 114.6 0 256s114.6 256 256 256S512 397.4 512 256S397.4 0 256 0zM256 464c-114.7 0-208-93.31-208-208S141.3 48 256 48s208 93.31 208 208S370.7 464 256 464z' /></svg>\n)\nexport const infoIconJSX = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M256 0C114.6 0 0 114.6 0 256s114.6 256 256 256s256-114.6 256-256S397.4 0 256 0zM256 128c17.67 0 32 14.33 32 32c0 17.67-14.33 32-32 32S224 177.7 224 160C224 142.3 238.3 128 256 128zM296 384h-80C202.8 384 192 373.3 192 360s10.75-24 24-24h16v-64H224c-13.25 0-24-10.75-24-24S210.8 224 224 224h32c13.25 0 24 10.75 24 24v88h16c13.25 0 24 10.75 24 24S309.3 384 296 384z' /></svg>\n\n)\n\n\nexport const appStoreIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'><path d='M255.9 120.9l9.1-15.7c5.6-9.8 18.1-13.1 27.9-7.5 9.8 5.6 13.1 18.1 7.5 27.9l-87.5 151.5h63.3c20.5 0 32 24.1 23.1 40.8H113.8c-11.3 0-20.4-9.1-20.4-20.4 0-11.3 9.1-20.4 20.4-20.4h52l66.6-115.4-20.8-36.1c-5.6-9.8-2.3-22.2 7.5-27.9 9.8-5.6 22.2-2.3 27.9 7.5l8.9 15.7zm-78.7 218l-19.6 34c-5.6 9.8-18.1 13.1-27.9 7.5-9.8-5.6-13.1-18.1-7.5-27.9l14.6-25.2c16.4-5.1 29.8-1.2 40.4 11.6zm168.9-61.7h53.1c11.3 0 20.4 9.1 20.4 20.4 0 11.3-9.1 20.4-20.4 20.4h-29.5l19.9 34.5c5.6 9.8 2.3 22.2-7.5 27.9-9.8 5.6-22.2 2.3-27.9-7.5-33.5-58.1-58.7-101.6-75.4-130.6-17.1-29.5-4.9-59.1 7.2-69.1 13.4 23 33.4 57.7 60.1 104zM256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm216 248c0 118.7-96.1 216-216 216-118.7 0-216-96.1-216-216 0-118.7 96.1-216 216-216 118.7 0 216 96.1 216 216z' /></svg>\n)\n\n\nexport const batteryEmptyIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 576 512'><path d='M544 192V160c0-35.35-28.65-64-64-64H64C28.65 96 0 124.7 0 160v192c0 35.35 28.65 64 64 64h416c35.35 0 64-28.65 64-64v-32c17.67 0 32-14.33 32-32V224C576 206.3 561.7 192 544 192zM480 352H64V160h416V352z' /></svg>\n)\n\n\nexport const elementorIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M425.6 32H22.4C10 32 0 42 0 54.4v403.2C0 470 10 480 22.4 480h403.2c12.4 0 22.4-10 22.4-22.4V54.4C448 42 438 32 425.6 32M164.3 355.5h-39.8v-199h39.8v199zm159.3 0H204.1v-39.8h119.5v39.8zm0-79.6H204.1v-39.8h119.5v39.8zm0-79.7H204.1v-39.8h119.5v39.8z' /></svg>\n)\n\nexport const squareCheckIcon = (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'><path d='M384 32H64C28.65 32 0 60.65 0 96v320c0 35.35 28.65 64 64 64h320c35.35 0 64-28.65 64-64V96C448 60.65 419.3 32 384 32zM400 416c0 8.836-7.164 16-16 16H64c-8.836 0-16-7.164-16-16V96c0-8.838 7.164-16 16-16h320c8.836 0 16 7.162 16 16V416zM303 175L192 286.1L144.1 239c-9.375-9.375-24.56-9.375-33.94 0s-9.375 24.56 0 33.94l64 64C179.7 341.7 185.8 344 192 344s12.28-2.344 16.97-7.031l128-128c9.375-9.375 9.375-24.56 0-33.94S312.4 165.7 303 175z' /></svg>\n)\n\nexport const pencilIcon = (\n <svg width='10' height='10' viewBox='0 0 10 10' fill='none' xmlns='http://www.w3.org/2000/svg'>\n <path d='M8.91878 3.38356L6.59333 1.08219L7.35936 0.315069C7.56911 0.105023 7.82682 0 8.13251 0C8.43782 0 8.69536 0.105023 8.9051 0.315069L9.67113 1.08219C9.88088 1.29224 9.99031 1.54575 9.99943 1.84274C10.0086 2.13936 9.90824 2.39269 9.69849 2.60274L8.91878 3.38356ZM8.12539 4.19178L2.32545 10H0V7.67123L5.79994 1.86301L8.12539 4.19178Z' fill='#E2E369' />\n </svg>\n\n)\n"],"names":["closeIconJSX","React","createElement","xmlns","viewBox","d","infoIconJSX"],"mappings":"aACaA,MAAAA,EACXC,MAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,MAAAC,cAAA,OAAA,CAAMG,EAAE,ygBAE3DC,EACXL,MAAAC,cAAA,MAAA,CAAKC,MAAM,6BAA6BC,QAAQ,eAAcH,MAAAC,cAAA,OAAA,CAAMG,EAAE"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),r=require("../../../../hooks/useParseProps.js"),s=require("../../../../utils/helpers/text.js");function a(e){return e&&e.__esModule?e:{default:e}}var o=a(t);const l=["element","children","href","target","className","id","onClick","text"],c=t.memo((a=>{let{element:c="span",children:i,href:n,target:d,className:u="",id:p,onClick:m,text:h}=a,x=e.objectWithoutProperties(a,l);const{dataProps:P,restProps:b}=r.useParseProps(x),j=h||(null==i?void 0:i.toString()),f=t.useMemo((()=>m?{onClick:m,onKeyDown:m,role:"button",tabIndex:-1}:{}),[m]);return o.default.createElement(c,e.objectSpread2(e.objectSpread2(e.objectSpread2({id:"".concat(p||j&&s.composeId(j)),href:n,text:h,target:d,className:u},f),{},{style:b},P),{},{"data-testid":"".concat(P.dataTestId||P["data-testid"]||p||j&&s.composeId(j))}),i)}));c.displayName="Text",exports.Text=c;
1
+ "use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react"),r=require("../../../../hooks/useParseProps.js"),s=require("../../../../utils/helpers/text.js");const a=["element","children","href","target","className","id","onClick","text"],o=t.memo((o=>{let{element:l="span",children:c,href:i,target:n,className:d="",id:p,onClick:u,text:m}=o,h=e.objectWithoutProperties(o,a);const{dataProps:x,restProps:P}=r.useParseProps(h),b=m||(null==c?void 0:c.toString()),j=t.useMemo((()=>u?{onClick:u,onKeyDown:u,role:"button",tabIndex:-1}:{}),[u]);return t.createElement(l,e.objectSpread2(e.objectSpread2(e.objectSpread2({id:"".concat(p||b&&s.composeId(b)),href:i,text:m,target:n,className:d},j),{},{style:P},x),{},{"data-testid":"".concat(x.dataTestId||x["data-testid"]||p||b&&s.composeId(b))}),c)}));o.displayName="Text",exports.Text=o;
2
2
  //# sourceMappingURL=Text.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Text.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Text.tsx"],"sourcesContent":["import React, { memo, FC, useMemo } from 'react'\n\nimport { composeId } from '../../../../utils'\nimport { useParseProps } from '../../../../hooks'\n\nimport { ITextProps, TextProps } from './text.types'\n\n\nexport const Text: FC<TextProps> = memo<ITextProps>((\n { element = 'span', children, href, target, className = '', id, onClick, text, ...rest }: ITextProps,\n) => {\n const { dataProps, restProps } = useParseProps(rest)\n const textFromChildren: string | undefined = text || children?.toString()\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return React.createElement<TextProps>(\n element,\n {\n id: `${id || (textFromChildren && composeId(textFromChildren))}`,\n href,\n text,\n target,\n className,\n ...onClickProps,\n style: restProps,\n ...dataProps,\n 'data-testid':\n `${dataProps.dataTestId || dataProps['data-testid'] || id || (textFromChildren && composeId(textFromChildren))}`,\n },\n children,\n )\n})\n\nText.displayName = 'Text'\n"],"names":["Text","memo","_ref","element","children","href","target","className","id","onClick","text","rest","_objectWithoutProperties","_excluded","dataProps","restProps","useParseProps","textFromChildren","toString","onClickProps","useMemo","onKeyDown","role","tabIndex","React","createElement","_objectSpread","concat","composeId","style","dataTestId","displayName"],"mappings":"uVAQaA,EAAsBC,EAAIA,MAAaC,IAE/C,IADHC,QAAEA,EAAU,OAAMC,SAAEA,EAAQC,KAAEA,EAAIC,OAAEA,EAAMC,UAAEA,EAAY,GAAEC,GAAEA,EAAEC,QAAEA,EAASC,KAAAA,GAA2BR,EAAlBS,EAAIC,EAAAA,wBAAAV,EAAAW,GAEtF,MAAMC,UAAEA,EAASC,UAAEA,GAAcC,EAAAA,cAAcL,GACzCM,EAAuCP,IAAQN,aAAQ,EAARA,EAAUc,YAEzDC,EAAeC,WAAQ,IAAOX,EAAW,CAC7CA,UACAY,UAAWZ,EACXa,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACd,IAEX,OAAOe,EAAAA,QAAMC,cACXtB,EAAOuB,EAAAA,cAAAA,EAAAA,cAAAA,EAAAA,cAAA,CAELlB,GAAE,GAAAmB,OAAKnB,GAAOS,GAAoBW,EAAAA,UAAUX,IAC5CZ,YACAK,EACAJ,SACAC,aACGY,GAAY,GAAA,CACfU,MAAOd,GACJD,GAAS,GAAA,CACZ,iBAAaa,OACVb,EAAUgB,YAAchB,EAAU,gBAAkBN,GAAOS,GAAoBW,EAAAA,UAAUX,MAE9Fb,EACD,IAGHJ,EAAK+B,YAAc"}
1
+ {"version":3,"file":"Text.js","sources":["../../../../../../../../../src/core/ui/components/atoms/text/Text.tsx"],"sourcesContent":["import { createElement, memo, FC, useMemo } from 'react'\n\nimport { composeId } from '../../../../utils'\nimport { useParseProps } from '../../../../hooks'\n\nimport { ITextProps, TextProps } from './text.types'\n\n\nexport const Text: FC<TextProps> = memo<ITextProps>((\n { element = 'span', children, href, target, className = '', id, onClick, text, ...rest }: ITextProps,\n) => {\n const { dataProps, restProps } = useParseProps(rest)\n const textFromChildren: string | undefined = text || children?.toString()\n\n const onClickProps = useMemo(() => (onClick ? ({\n onClick,\n onKeyDown: onClick,\n role: 'button',\n tabIndex: -1,\n }) : {}), [onClick])\n\n return createElement<TextProps>(\n element,\n {\n id: `${id || (textFromChildren && composeId(textFromChildren))}`,\n href,\n text,\n target,\n className,\n ...onClickProps,\n style: restProps,\n ...dataProps,\n 'data-testid':\n `${dataProps.dataTestId || dataProps['data-testid'] || id || (textFromChildren && composeId(textFromChildren))}`,\n },\n children,\n )\n})\n\nText.displayName = 'Text'\n"],"names":["Text","memo","_ref","element","children","href","target","className","id","onClick","text","rest","_objectWithoutProperties","_excluded","dataProps","restProps","useParseProps","textFromChildren","toString","onClickProps","useMemo","onKeyDown","role","tabIndex","createElement","_objectSpread","concat","composeId","style","dataTestId","displayName"],"mappings":"yRAQaA,EAAsBC,EAAIA,MAAaC,IAE/C,IADHC,QAAEA,EAAU,OAAMC,SAAEA,EAAQC,KAAEA,EAAIC,OAAEA,EAAMC,UAAEA,EAAY,GAAEC,GAAEA,EAAEC,QAAEA,EAASC,KAAAA,GAA2BR,EAAlBS,EAAIC,EAAAA,wBAAAV,EAAAW,GAEtF,MAAMC,UAAEA,EAASC,UAAEA,GAAcC,EAAAA,cAAcL,GACzCM,EAAuCP,IAAQN,aAAQ,EAARA,EAAUc,YAEzDC,EAAeC,WAAQ,IAAOX,EAAW,CAC7CA,UACAY,UAAWZ,EACXa,KAAM,SACNC,UAAW,GACR,CAAG,GAAE,CAACd,IAEX,OAAOe,EAAaA,cAClBrB,EAAOsB,gBAAAA,EAAAA,cAAAA,EAAAA,cAAA,CAELjB,GAAE,GAAAkB,OAAKlB,GAAOS,GAAoBU,EAAAA,UAAUV,IAC5CZ,YACAK,EACAJ,SACAC,aACGY,GAAY,GAAA,CACfS,MAAOb,GACJD,GAAS,GAAA,CACZ,iBAAaY,OACVZ,EAAUe,YAAcf,EAAU,gBAAkBN,GAAOS,GAAoBU,EAAAA,UAAUV,MAE9Fb,EACD,IAGHJ,EAAK8B,YAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sources":["../../../../../../../../src/core/ui/components/error/ErrorBoundary.tsx"],"sourcesContent":["import { FC, memo, PureComponent, ReactNode } from 'react'\n\nimport { IconBase } from '../icon'\nimport { LayoutBox } from '../container/layoutBox/LayoutBox'\n\nimport classes from './errorBoundary.module.scss'\nimport { DefaultErrorComponentProps, ErrorBoundaryProps } from './errorBoundary.types'\n\n\ninterface State {\n error?: Error\n errorInfo?: unknown\n hasError: boolean\n}\n\n\nexport const DefaultErrorComponent: FC<DefaultErrorComponentProps>\n= memo(({ title, text }: DefaultErrorComponentProps) => (\n <LayoutBox className={classes.errorBoundary} direction='column' flexWrap='wrap' gap='2rem' padding='1rem'>\n {title && <h1>{title}</h1>}\n <LayoutBox align='center' justify='space-between' gap='1rem'>\n <IconBase\n className={classes.StyledIcon}\n color='#FF0000'\n width='3rem'\n height='3rem'\n >\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>\n <path d='M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z' />\n </svg>\n </IconBase>\n {text && (\n <LayoutBox flexShrink='0' width='90%'>\n {text}\n </LayoutBox>\n )}\n </LayoutBox>\n </LayoutBox>\n))\nDefaultErrorComponent.displayName = 'DefaultErrorComponent'\n\nexport class ErrorBoundary extends PureComponent<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props)\n this.state = { hasError: false }\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error }\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n // eslint-disable-next-line no-console\n !this.props.muted && error && console.error(error)\n // eslint-disable-next-line no-console\n !this.props.muted && errorInfo && console.error(errorInfo)\n\n this.props?.onError?.({ error, errorInfo })\n\n !this.props.muted && this.setState({ hasError: true, error, errorInfo })\n }\n\n render(): ReactNode {\n const { ErrorComponent = DefaultErrorComponent, title, text, muted } = this.props\n const { hasError, error, errorInfo } = this.state\n\n if (hasError && !muted) {\n return (\n <ErrorComponent\n title={title || error?.toString() || 'Error'}\n text={text || `${JSON.stringify(errorInfo, null, 2)}`}\n />\n )\n }\n\n if (hasError && muted) {\n return null\n }\n\n return this.props.children\n }\n}\n"],"names":["DefaultErrorComponent","memo","_ref","title","text","React","createElement","LayoutBox","className","classes","default","errorBoundary","direction","flexWrap","gap","padding","align","justify","IconBase","StyledIcon","color","width","height","xmlns","viewBox","d","flexShrink","displayName","ErrorBoundary","PureComponent","constructor","props","super","this","state","hasError","getDerivedStateFromError","error","componentDidCatch","errorInfo","_this$props","_this$props$onError","muted","onError","call","setState","render","ErrorComponent","toString","concat","JSON","stringify","children"],"mappings":"kKAgBaA,MAAAA,EACXC,EAAIA,MAACC,IAAA,IAACC,MAAEA,EAAKC,KAAEA,GAAkCF,EAAA,OACjDG,MAAAC,cAACC,YAAS,CAACC,UAAWC,EAAOC,QAACC,cAAeC,UAAU,SAASC,SAAS,OAAOC,IAAI,OAAOC,QAAQ,QAChGZ,GAASE,MAAAC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{"version":3,"file":"ErrorBoundary.js","sources":["../../../../../../../../src/core/ui/components/error/ErrorBoundary.tsx"],"sourcesContent":["import { ErrorInfo, FC, memo, PureComponent, ReactNode } from 'react'\n\nimport { IconBase } from '../icon'\nimport { LayoutBox } from '../container/layoutBox/LayoutBox'\n\nimport classes from './errorBoundary.module.scss'\nimport { DefaultErrorComponentProps, ErrorBoundaryProps } from './errorBoundary.types'\n\n\ninterface State {\n error?: Error\n errorInfo?: unknown\n hasError: boolean\n}\n\n\nexport const DefaultErrorComponent: FC<DefaultErrorComponentProps>\n= memo(({ title, text }: DefaultErrorComponentProps) => (\n <LayoutBox className={classes.errorBoundary} direction='column' flexWrap='wrap' gap='2rem' padding='1rem'>\n {title && <h1>{title}</h1>}\n <LayoutBox align='center' justify='space-between' gap='1rem'>\n <IconBase\n className={classes.StyledIcon}\n color='#FF0000'\n width='3rem'\n height='3rem'\n >\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>\n <path d='M506.3 417l-213.3-364c-16.33-28-57.54-28-73.98 0l-213.2 364C-10.59 444.9 9.849 480 42.74 480h426.6C502.1 480 522.6 445 506.3 417zM232 168c0-13.25 10.75-24 24-24S280 154.8 280 168v128c0 13.25-10.75 24-23.1 24S232 309.3 232 296V168zM256 416c-17.36 0-31.44-14.08-31.44-31.44c0-17.36 14.07-31.44 31.44-31.44s31.44 14.08 31.44 31.44C287.4 401.9 273.4 416 256 416z' />\n </svg>\n </IconBase>\n {text && (\n <LayoutBox flexShrink='0' width='90%'>\n {text}\n </LayoutBox>\n )}\n </LayoutBox>\n </LayoutBox>\n))\nDefaultErrorComponent.displayName = 'DefaultErrorComponent'\n\nexport class ErrorBoundary extends PureComponent<ErrorBoundaryProps, State> {\n constructor(props: ErrorBoundaryProps) {\n super(props)\n this.state = { hasError: false }\n }\n\n static getDerivedStateFromError(error: Error): State {\n return { hasError: true, error }\n }\n\n componentDidCatch(error: Error, errorInfo: ErrorInfo): void {\n // eslint-disable-next-line no-console\n !this.props.muted && error && console.error(error)\n // eslint-disable-next-line no-console\n !this.props.muted && errorInfo && console.error(errorInfo)\n\n this.props?.onError?.({ error, errorInfo })\n\n !this.props.muted && this.setState({ hasError: true, error, errorInfo })\n }\n\n render(): ReactNode {\n const { ErrorComponent = DefaultErrorComponent, title, text, muted } = this.props\n const { hasError, error, errorInfo } = this.state\n\n if (hasError && !muted) {\n return (\n <ErrorComponent\n title={title || error?.toString() || 'Error'}\n text={text || `${JSON.stringify(errorInfo, null, 2)}`}\n />\n )\n }\n\n if (hasError && muted) {\n return null\n }\n\n return this.props.children\n }\n}\n"],"names":["DefaultErrorComponent","memo","_ref","title","text","React","createElement","LayoutBox","className","classes","default","errorBoundary","direction","flexWrap","gap","padding","align","justify","IconBase","StyledIcon","color","width","height","xmlns","viewBox","d","flexShrink","displayName","ErrorBoundary","PureComponent","constructor","props","super","this","state","hasError","getDerivedStateFromError","error","componentDidCatch","errorInfo","_this$props","_this$props$onError","muted","onError","call","setState","render","ErrorComponent","toString","concat","JSON","stringify","children"],"mappings":"kKAgBaA,MAAAA,EACXC,EAAIA,MAACC,IAAA,IAACC,MAAEA,EAAKC,KAAEA,GAAkCF,EAAA,OACjDG,MAAAC,cAACC,YAAS,CAACC,UAAWC,EAAOC,QAACC,cAAeC,UAAU,SAASC,SAAS,OAAOC,IAAI,OAAOC,QAAQ,QAChGZ,GAASE,MAAAC,cAAA,KAAA,KAAKH,GACfE,MAAAC,cAACC,YAAS,CAACS,MAAM,SAASC,QAAQ,gBAAgBH,IAAI,QACpDT,MAAAC,cAACY,WAAQ,CACPV,UAAWC,EAAOC,QAACS,WACnBC,MAAM,UACNC,MAAM,OACNC,OAAO,QAEPjB,MAAAC,cAAA,MAAA,CAAKiB,MAAM,6BAA6BC,QAAQ,eAC9CnB,MAAAC,cAAA,OAAA,CAAMmB,EAAE,6WAGXrB,GACCC,MAAAC,cAACC,EAAAA,UAAS,CAACmB,WAAW,IAAIL,MAAM,OAC7BjB,IAIG,IAEdJ,EAAsB2B,YAAc,wBAE7B,MAAMC,UAAsBC,EAAAA,cACjCC,WAAAA,CAAYC,GACVC,MAAMD,GACNE,KAAKC,MAAQ,CAAEC,UAAU,EAC3B,CAEA,+BAAOC,CAAyBC,GAC9B,MAAO,CAAEF,UAAU,EAAME,QAC3B,CAEAC,iBAAAA,CAAkBD,EAAcE,GAA4B,IAAAC,EAAAC,EAEzDR,KAAKF,MAAMW,MAEXT,KAAKF,MAAMW,cAEZF,OAAKT,aAAK,IAAAS,GAAS,QAATC,EAAVD,EAAYG,eAAZF,IAAmBA,GAAnBA,EAAAG,KAAAJ,EAAsB,CAAEH,QAAOE,eAE9BN,KAAKF,MAAMW,OAAST,KAAKY,SAAS,CAAEV,UAAU,EAAME,QAAOE,aAC9D,CAEAO,MAAAA,GACE,MAAMC,eAAEA,EAAiB/C,EAAqBG,MAAEA,EAAKC,KAAEA,EAAIsC,MAAEA,GAAUT,KAAKF,OACtEI,SAAEA,EAAQE,MAAEA,EAAKE,UAAEA,GAAcN,KAAKC,MAE5C,OAAIC,IAAaO,EAEbrC,MAAAC,cAACyC,EAAc,CACb5C,MAAOA,IAASkC,aAAAA,EAAAA,EAAOW,aAAc,QACrC5C,KAAMA,GAAI6C,GAAAA,OAAOC,KAAKC,UAAUZ,EAAW,KAAM,MAKnDJ,GAAYO,EACP,KAGFT,KAAKF,MAAMqB,QACpB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js");require("../../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var t=require("react"),n=require("../../../../../../node_modules/@popperjs/core/lib/popper.js"),l=require("../../../../utils/helpers/cancelableDelayedFunction.js"),r=require("../../../../hooks/useOutsideClick.js"),o=require("../../../../constants/ui.constants.js");function a(e){return e&&e.__esModule?e:{default:e}}var u=a(t);const i=["children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape"],s=["ContentComponent"],d={modal:{zIndex:1,position:"fixed",width:"100%",height:"100%",top:"0",left:"0",background:"rgba(0 0 0 / 70%)",pointerEvents:"all",userSelect:"none",visibility:"hidden"}},c=t.memo((a=>{var c,p;let{children:v,components:m,placement:f="bottom",modifiers:b,data:h,hoverable:E,clickable:y,onOpen:C,onHide:j,isOpen:k,hideOnContentClick:w=!1,hideOnClickOutside:N=!0,hideTimeout:g=150,isPopup:O=!1,isModal:S=!1,modalOverlayClassName:M,modalContainer:R,targetRef:L,hideOnEscape:P}=a,q=e.objectWithoutProperties(a,i);const[x,H]=t.useState(null),[T,_]=t.useState(null!==(c=null==L?void 0:L.current)&&void 0!==c?c:null);t.useEffect((()=>{null!=L&&L.current&&_(null==L?void 0:L.current)}),[L]);const W=m||{},{ContentComponent:A}=W,D=e.objectWithoutProperties(W,s),K=t.useRef(null),z=t.useMemo((()=>{const t=b?{modifiers:b,placement:f}:{placement:f};return t.modifiers=t.modifiers||[],O&&(t.modifiers=[...t.modifiers,{name:"centering",phase:"beforeWrite",enabled:!0,fn:t=>{let{state:n}=t;const l=null==R?void 0:R.getBoundingClientRect(),{width:r,height:o,left:a,top:u}=l||{width:window.innerWidth,height:window.innerHeight,left:0,top:0},i=a+(r-n.elements.popper.clientWidth)/2,s=u+(o-n.elements.popper.clientHeight)/2;return e.objectSpread2(e.objectSpread2({},n),{},{styles:e.objectSpread2(e.objectSpread2({},n.styles),{},{popper:e.objectSpread2(e.objectSpread2({},n.styles.popper),{},{left:"".concat(i,"px"),top:"".concat(s,"px"),transform:"none"})})})}}]),t}),[b,f,O,R]),B=t.useRef();t.useEffect((()=>{var t;let l;return null==K||null===(t=K.current)||void 0===t||t.destroy(),T&&x&&(l=n.createPopper(T,x,e.objectSpread2({},z)),K.current=l),()=>{var e;null===(e=l)||void 0===e||e.destroy(),K.current=null}}),[x,T,z]);const F=t.useRef(),I=t.useRef(-1),G=t.useCallback((()=>{var e,t;x&&delete x.dataset.show,S&&null!=te&&te.current&&(te.current.style.visibility="hidden",delete te.current.dataset.show),null==K||null===(e=K.current)||void 0===e||e.update(),null==j||j(),null==F||null===(t=F.current)||void 0===t||t.call(F),clearTimeout(I.current)}),[x,S,j]),J=t.useCallback((()=>{B.current&&B.current(),B.current=l.cancelableSetTimeout(G,g)}),[G,g]),Q=t.useCallback((()=>{B.current&&B.current()}),[]),U=t.useCallback((e=>{var t;("true"===(null==x||null===(t=x.dataset)||void 0===t?void 0:t.show)&&N&&(null==x||!x.contains(e))||null!=x&&x.contains(e)&&w)&&G()}),[G,x,w,N]),V=t.useCallback((()=>{var e,t;x&&(x.dataset.show="true"),null==K||null===(e=K.current)||void 0===e||e.update(),S&&null!=te&&te.current&&(te.current.style.visibility="visible",te.current.dataset.show="true"),null==C||C(),null==F||null===(t=F.current)||void 0===t||t.call(F),clearTimeout(I.current),I.current=setTimeout((()=>{F.current=r.outsideClickHandler(T,U)}),250)}),[x,U,S,C,T]),X=t.useCallback((()=>{var e;"true"===(null==x||null===(e=x.dataset)||void 0===e?void 0:e.show)?G():V()}),[x,G,V]),Y=t.useCallback((e=>{P&&e.keyCode===o.KeyCode.Escape&&G()}),[P,G]);t.useEffect((()=>{var e,t;const n=null==T||null===(e=T.addEventListener)||void 0===e?void 0:e.bind(T),l=null==x||null===(t=x.addEventListener)||void 0===t?void 0:t.bind(x);return l&&n&&(E&&(n(o.EventName.MouseEnter,V),l(o.EventName.MouseEnter,Q),n(o.EventName.MouseLeave,J),l(o.EventName.MouseLeave,G)),y&&n(o.EventName.Click,X)),P&&document.addEventListener(o.EventName.KeyDown,Y),()=>{var e,t;const n=null==T||null===(e=T.removeEventListener)||void 0===e?void 0:e.bind(T),l=null==x||null===(t=x.removeEventListener)||void 0===t?void 0:t.bind(x);document.removeEventListener(o.EventName.KeyDown,Y),B.current&&B.current(),n&&(n(o.EventName.Click,X),n(o.EventName.MouseEnter,V),n(o.EventName.MouseLeave,J)),l&&(l(o.EventName.MouseLeave,G),l(o.EventName.MouseEnter,Q))}}),[T,x,y,E,V,G,X,J,Q,P,Y]),t.useEffect((()=>(!0===k&&V(),!1===k&&G(),null==F?void 0:F.current)),[G,k,V]);const Z="function"==typeof v,$="function"!=typeof v&&!Array.isArray(v),ee="function"!=typeof v&&Array.isArray(v)&&2===v.filter((e=>!!e)).length,te=t.useRef(null);return t.useEffect((()=>{S&&x&&(x.style.zIndex="2")}),[x,S]),u.default.createElement(u.default.Fragment,null,S&&u.default.createElement("span",{ref:te,style:d.modal,className:M}),!L&&Z&&(null==v?void 0:v({forwardedRef:_,data:h})),!L&&$&&u.default.createElement("span",{ref:_},v),!ee&&A&&u.default.createElement(A,e.extends({placement:f,forwardedRef:H,ref:"function"!=typeof A?H:null,data:h,hide:G,components:D},q)),!L&&ee&&u.default.createElement("span",{ref:_},v[0]),ee&&(null==v?void 0:v[1])&&"object"==typeof(null==v?void 0:v[1])&&u.default.cloneElement(v[1],e.objectSpread2(e.objectSpread2({},null==v||null===(p=v[1])||void 0===p?void 0:p.props),{},{placement:f,forwardedRef:H,ref:H,data:h,hide:G,components:D},q)))}));c.displayName="Popover",exports.Popover=c;
1
+ "use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js");require("../../../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var t=require("react"),n=require("../../../../../../node_modules/@popperjs/core/lib/popper.js"),l=require("../../../../utils/helpers/cancelableDelayedFunction.js"),r=require("../../../../hooks/useOutsideClick.js"),o=require("../../../../constants/ui.constants.js");const a=["children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape"],i=["ContentComponent"],u={modal:{zIndex:1,position:"fixed",width:"100%",height:"100%",top:"0",left:"0",background:"rgba(0 0 0 / 70%)",pointerEvents:"all",userSelect:"none",visibility:"hidden"}},s=t.memo((s=>{var c,d;let{children:p,components:v,placement:m="bottom",modifiers:f,data:b,hoverable:h,clickable:E,onOpen:y,onHide:C,isOpen:j,hideOnContentClick:k=!1,hideOnClickOutside:w=!0,hideTimeout:R=150,isPopup:N=!1,isModal:g=!1,modalOverlayClassName:O,modalContainer:S,targetRef:M,hideOnEscape:L}=s,P=e.objectWithoutProperties(s,a);const[q,x]=t.useState(null),[H,T]=t.useState(null!==(c=null==M?void 0:M.current)&&void 0!==c?c:null);t.useEffect((()=>{null!=M&&M.current&&T(null==M?void 0:M.current)}),[M]);const W=v||{},{ContentComponent:A}=W,_=e.objectWithoutProperties(W,i),D=t.useRef(null),K=t.useMemo((()=>{const t=f?{modifiers:f,placement:m}:{placement:m};return t.modifiers=t.modifiers||[],N&&(t.modifiers=[...t.modifiers,{name:"centering",phase:"beforeWrite",enabled:!0,fn:t=>{let{state:n}=t;const l=null==S?void 0:S.getBoundingClientRect(),{width:r,height:o,left:a,top:i}=l||{width:window.innerWidth,height:window.innerHeight,left:0,top:0},u=a+(r-n.elements.popper.clientWidth)/2,s=i+(o-n.elements.popper.clientHeight)/2;return e.objectSpread2(e.objectSpread2({},n),{},{styles:e.objectSpread2(e.objectSpread2({},n.styles),{},{popper:e.objectSpread2(e.objectSpread2({},n.styles.popper),{},{left:"".concat(u,"px"),top:"".concat(s,"px"),transform:"none"})})})}}]),t}),[f,m,N,S]),z=t.useRef();t.useEffect((()=>{var t;let l;return null==D||null===(t=D.current)||void 0===t||t.destroy(),H&&q&&(l=n.createPopper(H,q,e.objectSpread2({},K)),D.current=l),()=>{var e;null===(e=l)||void 0===e||e.destroy(),D.current=null}}),[q,H,K]);const B=t.useRef(),F=t.useRef(-1),I=t.useCallback((()=>{var e,t;q&&delete q.dataset.show,g&&null!=ee&&ee.current&&(ee.current.style.visibility="hidden",delete ee.current.dataset.show),null==D||null===(e=D.current)||void 0===e||e.update(),null==C||C(),null==B||null===(t=B.current)||void 0===t||t.call(B),clearTimeout(F.current)}),[q,g,C]),G=t.useCallback((()=>{z.current&&z.current(),z.current=l.cancelableSetTimeout(I,R)}),[I,R]),J=t.useCallback((()=>{z.current&&z.current()}),[]),Q=t.useCallback((e=>{var t;("true"===(null==q||null===(t=q.dataset)||void 0===t?void 0:t.show)&&w&&(null==q||!q.contains(e))||null!=q&&q.contains(e)&&k)&&I()}),[I,q,k,w]),U=t.useCallback((()=>{var e,t;q&&(q.dataset.show="true"),null==D||null===(e=D.current)||void 0===e||e.update(),g&&null!=ee&&ee.current&&(ee.current.style.visibility="visible",ee.current.dataset.show="true"),null==y||y(),null==B||null===(t=B.current)||void 0===t||t.call(B),clearTimeout(F.current),F.current=setTimeout((()=>{B.current=r.outsideClickHandler(H,Q)}),250)}),[q,Q,g,y,H]),V=t.useCallback((()=>{var e;"true"===(null==q||null===(e=q.dataset)||void 0===e?void 0:e.show)?I():U()}),[q,I,U]),X=t.useCallback((e=>{L&&e.keyCode===o.KeyCode.Escape&&I()}),[L,I]);t.useEffect((()=>{var e,t;const n=null==H||null===(e=H.addEventListener)||void 0===e?void 0:e.bind(H),l=null==q||null===(t=q.addEventListener)||void 0===t?void 0:t.bind(q);return l&&n&&(h&&(n(o.EventName.MouseEnter,U),l(o.EventName.MouseEnter,J),n(o.EventName.MouseLeave,G),l(o.EventName.MouseLeave,I)),E&&n(o.EventName.Click,V)),L&&document.addEventListener(o.EventName.KeyDown,X),()=>{var e,t;const n=null==H||null===(e=H.removeEventListener)||void 0===e?void 0:e.bind(H),l=null==q||null===(t=q.removeEventListener)||void 0===t?void 0:t.bind(q);document.removeEventListener(o.EventName.KeyDown,X),z.current&&z.current(),n&&(n(o.EventName.Click,V),n(o.EventName.MouseEnter,U),n(o.EventName.MouseLeave,G)),l&&(l(o.EventName.MouseLeave,I),l(o.EventName.MouseEnter,J))}}),[H,q,E,h,U,I,V,G,J,L,X]),t.useEffect((()=>(!0===j&&U(),!1===j&&I(),null==B?void 0:B.current)),[I,j,U]);const Y="function"==typeof p,Z="function"!=typeof p&&!Array.isArray(p),$="function"!=typeof p&&Array.isArray(p)&&2===p.filter((e=>!!e)).length,ee=t.useRef(null);return t.useEffect((()=>{g&&q&&(q.style.zIndex="2")}),[q,g]),React.createElement(React.Fragment,null,g&&React.createElement("span",{ref:ee,style:u.modal,className:O}),!M&&Y&&(null==p?void 0:p({forwardedRef:T,data:b})),!M&&Z&&React.createElement("span",{ref:T},p),!$&&A&&React.createElement(A,e.extends({placement:m,forwardedRef:x,ref:"function"!=typeof A?x:null,data:b,hide:I,components:_},P)),!M&&$&&React.createElement("span",{ref:T},p[0]),$&&(null==p?void 0:p[1])&&"object"==typeof(null==p?void 0:p[1])&&t.cloneElement(p[1],e.objectSpread2(e.objectSpread2({},null==p||null===(d=p[1])||void 0===d?void 0:d.props),{},{placement:m,forwardedRef:x,ref:x,data:b,hide:I,components:_},P)))}));s.displayName="Popover",exports.Popover=s;
2
2
  //# sourceMappingURL=PopoverLite.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverLite.js","sources":["../../../../../../../../../src/core/ui/components/molecules/popover/PopoverLite.tsx"],"sourcesContent":["\nimport React, { FC, memo, useRef, useEffect, useState, useCallback, useMemo,\n CSSProperties, ReactNode, ReactElement } from 'react'\nimport { createPopper, Instance, ModifierArguments } from '@popperjs/core'\n\nimport { EventName, KeyCode } from '../../../../constants'\nimport { cancelableSetTimeout } from '../../../../utils'\nimport { outsideClickHandler } from '../../../../hooks'\n\nimport { PopoverProps } from './popover.types'\n\n\nconst styles: Record<string, Partial<CSSProperties>> = {\n modal: {\n zIndex: 1,\n position: 'fixed',\n width: '100%',\n height: '100%',\n top: '0',\n left: '0',\n background: 'rgba(0 0 0 / 70%)',\n pointerEvents: 'all',\n userSelect: 'none',\n visibility: 'hidden',\n },\n}\n\nexport const Popover: FC<PopoverProps> = memo<PopoverProps>(\n ({\n children,\n components,\n placement = 'bottom',\n modifiers,\n data,\n hoverable,\n clickable,\n onOpen,\n onHide,\n isOpen,\n hideOnContentClick = false,\n hideOnClickOutside = true,\n hideTimeout = 150,\n isPopup = false,\n isModal = false,\n modalOverlayClassName,\n modalContainer,\n targetRef,\n hideOnEscape,\n ...props\n }: PopoverProps) => {\n const [content, setContent] = useState<HTMLElement | null>(null)\n const [target, setTarget] = useState<HTMLElement | null>(targetRef?.current ?? null)\n\n useEffect(() => {\n if (targetRef?.current) {\n setTarget(targetRef?.current)\n }\n }, [targetRef])\n\n const { ContentComponent, ...contentComponents } = components || {}\n\n const popperInstanceRef = useRef<Instance | null>(null)\n\n const options = useMemo(() => {\n const options = (modifiers ? { modifiers, placement } : { placement })\n\n options.modifiers = options.modifiers || []\n\n if (isPopup) {\n options.modifiers = [\n ...options.modifiers,\n {\n name: 'centering',\n phase: 'beforeWrite',\n enabled: true,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n fn: ({ state }): Partial<ModifierArguments> => {\n const mcBoundRect = modalContainer?.getBoundingClientRect()\n\n const { width, height, left, top } = mcBoundRect || {\n width: window.innerWidth,\n height: window.innerHeight,\n left: 0,\n top: 0,\n }\n\n const xpos = left + (width - state.elements.popper.clientWidth) / 2\n const ypos = top + (height - state.elements.popper.clientHeight) / 2\n\n return {\n ...state,\n styles: {\n ...state.styles,\n popper: {\n ...state.styles.popper,\n left: `${xpos}px`,\n top: `${ypos}px`,\n transform: 'none',\n },\n },\n }\n },\n },\n ] as PopoverProps['modifiers']\n }\n\n return options\n }, [modifiers, placement, isPopup, modalContainer])\n\n // to save cancelable setTimout\n const pendingHideRef = useRef<(() => void)>()\n\n useEffect(() => {\n popperInstanceRef?.current?.destroy()\n let popperInstance: ReturnType<typeof createPopper>\n\n if (target && content) {\n popperInstance = createPopper(target, content, { ...options })\n\n popperInstanceRef.current = popperInstance\n }\n\n return (): void => {\n popperInstance?.destroy()\n popperInstanceRef.current = null\n }\n }, [content, target, options])\n\n\n const outsideClickUnsubscriber = useRef<() => void | null>()\n const outsideClickUnsubscriberTimeout = useRef<any>(-1)\n\n const hide = useCallback(() => {\n if (content) {\n delete content.dataset.show\n }\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'hidden'\n delete modalRef.current.dataset.show\n }\n\n popperInstanceRef?.current?.update()\n onHide?.()\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n }, [content, isModal, onHide])\n\n\n const delayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n pendingHideRef.current = cancelableSetTimeout(hide, hideTimeout)\n }, [hide, hideTimeout])\n\n const cancelDelayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n }, [])\n\n const handleOutsideClick = useCallback((eventTarget: HTMLElement | null) => {\n if ((content?.dataset?.show === 'true' && hideOnClickOutside && !content?.contains(eventTarget))\n || (content?.contains(eventTarget) && hideOnContentClick)) {\n hide()\n }\n }, [hide, content, hideOnContentClick, hideOnClickOutside])\n\n const open = useCallback(() => {\n if (content) {\n content.dataset.show = 'true'\n }\n\n popperInstanceRef?.current?.update()\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'visible'\n modalRef.current.dataset.show = 'true'\n }\n\n onOpen?.()\n\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n outsideClickUnsubscriberTimeout.current = setTimeout(() => {\n outsideClickUnsubscriber.current = outsideClickHandler(target, handleOutsideClick)\n }, 250)\n }, [content, handleOutsideClick, isModal, onOpen, target])\n\n const toggleOpen = useCallback(() => {\n content?.dataset?.show === 'true' ? hide() : open()\n }, [content, hide, open])\n\n const keydownHandler = useCallback((event: Event) => {\n if (hideOnEscape && (event as unknown as KeyboardEvent).keyCode === KeyCode.Escape) {\n hide()\n }\n }, [hideOnEscape, hide])\n\n useEffect(() => {\n if (!hoverable && !clickable) {\n console.error('Popover component should have at least one of props [\"hoverable\", \"clickable\"]')\n }\n\n const targetAddListener = target?.addEventListener?.bind(target)\n const contentAddListener = content?.addEventListener?.bind(content)\n\n if (contentAddListener && targetAddListener) {\n if (hoverable) {\n targetAddListener(EventName.MouseEnter, open)\n contentAddListener(EventName.MouseEnter, cancelDelayedHide)\n targetAddListener(EventName.MouseLeave, delayedHide)\n contentAddListener(EventName.MouseLeave, hide)\n }\n\n if (clickable) {\n targetAddListener(EventName.Click, toggleOpen)\n }\n }\n\n if (hideOnEscape) {\n document.addEventListener(EventName.KeyDown, keydownHandler)\n }\n\n return (): void => {\n const targetRemoveListener = target?.removeEventListener?.bind(target)\n const contentRemoveListener = content?.removeEventListener?.bind(content)\n\n document.removeEventListener(EventName.KeyDown, keydownHandler)\n\n pendingHideRef.current && pendingHideRef.current()\n\n if (targetRemoveListener) {\n targetRemoveListener(EventName.Click, toggleOpen)\n targetRemoveListener(EventName.MouseEnter, open)\n targetRemoveListener(EventName.MouseLeave, delayedHide)\n }\n if (contentRemoveListener) {\n contentRemoveListener(EventName.MouseLeave, hide)\n contentRemoveListener(EventName.MouseEnter, cancelDelayedHide)\n }\n }\n }, [target, content, clickable, hoverable,\n open, hide, toggleOpen, delayedHide, cancelDelayedHide, hideOnEscape, keydownHandler])\n\n // open, hide based on external isOpen\n useEffect(() => {\n if (isOpen === true) {\n open()\n }\n if (isOpen === false) {\n hide()\n }\n return outsideClickUnsubscriber?.current as () => void\n }, [hide, isOpen, open])\n\n const childrenIsFunction = typeof children === 'function'\n const childrenIsElement = typeof children !== 'function' && !Array.isArray(children)\n const childrenAreElements = typeof children !== 'function' && Array.isArray(children)\n && children.filter((child: ReactNode) => !!child).length === 2\n\n // modal\n const modalRef = useRef<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (isModal && content) {\n content.style.zIndex = '2'\n }\n }, [content, isModal])\n\n return (\n <>\n {isModal && <span ref={modalRef} style={styles.modal} className={modalOverlayClassName} />}\n {(!targetRef && childrenIsFunction) && children?.({ forwardedRef: setTarget, data })}\n {(!targetRef && childrenIsElement) && <span ref={setTarget}>{children}</span>}\n {!childrenAreElements && ContentComponent && (\n <ContentComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n placement={placement}\n forwardedRef={setContent}\n ref={typeof ContentComponent !== 'function' ? setContent : null}\n data={data}\n hide={hide}\n components={contentComponents as { [key: string]: FC | React.Component<any> }}\n {...props}\n />\n )}\n {(!targetRef && childrenAreElements) && <span ref={setTarget}>{children[0]}</span>}\n {(childrenAreElements && children?.[1] && typeof children?.[1] === 'object')\n && React.cloneElement(children[1] as ReactElement, {\n ...((children?.[1] as ReactElement)?.props),\n placement,\n forwardedRef: setContent,\n // ...(typeof children[1] !== 'function' ? { ref: setContent } : {}),\n ref: setContent,\n data,\n hide,\n components: contentComponents as { [key: string]: FC | React.Component<any> },\n ...props,\n })}\n </>\n )\n },\n)\n\nPopover.displayName = 'Popover'\n"],"names":["styles","modal","zIndex","position","width","height","top","left","background","pointerEvents","userSelect","visibility","Popover","memo","_ref","_targetRef$current","_children$","children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape","props","_objectWithoutProperties","_excluded","content","setContent","useState","target","setTarget","current","useEffect","_ref2","ContentComponent","contentComponents","_excluded2","popperInstanceRef","useRef","options","useMemo","name","phase","enabled","fn","_ref3","state","mcBoundRect","getBoundingClientRect","window","innerWidth","innerHeight","xpos","elements","popper","clientWidth","ypos","clientHeight","_objectSpread","objectSpread2","concat","transform","pendingHideRef","_popperInstanceRef$cu","popperInstance","destroy","createPopper","_popperInstance","outsideClickUnsubscriber","outsideClickUnsubscriberTimeout","hide","useCallback","_popperInstanceRef$cu2","_outsideClickUnsubscr","dataset","show","modalRef","style","update","call","clearTimeout","delayedHide","cancelableSetTimeout","cancelDelayedHide","handleOutsideClick","eventTarget","_content$dataset","contains","open","_popperInstanceRef$cu3","_outsideClickUnsubscr2","setTimeout","outsideClickHandler","toggleOpen","_content$dataset2","keydownHandler","event","keyCode","KeyCode","Escape","_target$addEventListe","_content$addEventList","targetAddListener","addEventListener","bind","contentAddListener","EventName","MouseEnter","MouseLeave","Click","document","KeyDown","_target$removeEventLi","_content$removeEventL","targetRemoveListener","removeEventListener","contentRemoveListener","childrenIsFunction","childrenIsElement","Array","isArray","childrenAreElements","filter","child","length","React","default","createElement","Fragment","ref","className","forwardedRef","_extends","cloneElement","displayName"],"mappings":"kxBAYMA,EAAiD,CACrDC,MAAO,CACLC,OAAQ,EACRC,SAAU,QACVC,MAAO,OACPC,OAAQ,OACRC,IAAK,IACLC,KAAM,IACNC,WAAY,oBACZC,cAAe,MACfC,WAAY,OACZC,WAAY,WAIHC,EAA4BC,EAAIA,MAC3CC,IAqBoB,IAAAC,EAAAC,EAAA,IArBnBC,SACCA,EAAQC,WACRA,EAAUC,UACVA,EAAY,SAAQC,UACpBA,EAASC,KACTA,EAAIC,UACJA,EAASC,UACTA,EAASC,OACTA,EAAMC,OACNA,EAAMC,OACNA,EAAMC,mBACNA,GAAqB,EAAKC,mBAC1BA,GAAqB,EAAIC,YACzBA,EAAc,IAAGC,QACjBA,GAAU,EAAKC,QACfA,GAAU,EAAKC,sBACfA,EAAqBC,eACrBA,EAAcC,UACdA,EAASC,aACTA,GAEarB,EADVsB,EAAKC,EAAAA,wBAAAvB,EAAAwB,GAER,MAAOC,EAASC,GAAcC,EAAAA,SAA6B,OACpDC,EAAQC,GAAaF,EAAAA,SAA+C,QAAvC1B,EAAqBmB,aAAS,EAATA,EAAWU,eAAO7B,IAAAA,EAAAA,EAAI,MAE/E8B,EAAAA,WAAU,KACJX,SAAAA,EAAWU,SACbD,EAAUT,eAAAA,EAAWU,QACvB,GACC,CAACV,IAEJ,MAAAY,EAAmD5B,GAAc,CAAE,GAA7D6B,iBAAEA,GAAwCD,EAAnBE,EAAiBX,EAAAA,wBAAAS,EAAAG,GAExCC,EAAoBC,EAAMA,OAAkB,MAE5CC,EAAUC,EAAAA,SAAQ,KACtB,MAAMD,EAAWhC,EAAY,CAAEA,YAAWD,aAAc,CAAEA,aA2C1D,OAzCAiC,EAAQhC,UAAYgC,EAAQhC,WA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H,aAAcxG,EACdsG,IAAiC,mBAArB/F,EAAkCP,EAAa,KAC3DnB,KAAMA,EACN8D,KAAMA,EACNjE,WAAY8B,GACRZ,KAGHF,GAAaoG,IAAwBI,EAAAC,QAAAC,cAAA,OAAA,CAAME,IAAKnG,GAAY1B,EAAS,IACtEqH,KAAuBrH,aAAAA,EAAAA,EAAW,KAA+B,iBAAlBA,aAAQ,EAARA,EAAW,KACzDyH,UAAMQ,aAAajI,EAAS,GAAEsD,gBAAAA,EAAAA,cAC1BtD,CAAAA,EAAAA,SAAa,QAALD,EAARC,EAAW,UAAE,IAAAD,OAAA,EAAdA,EAAiCoB,OAAK,CAAA,EAAA,CAC1CjB,YACA6H,aAAcxG,EAEdsG,IAAKtG,EACLnB,OACA8D,OACAjE,WAAY8B,GACTZ,IAEJ,IAKTxB,EAAQuI,YAAc"}
1
+ {"version":3,"file":"PopoverLite.js","sources":["../../../../../../../../../src/core/ui/components/molecules/popover/PopoverLite.tsx"],"sourcesContent":["\nimport { FC, memo, useRef, useEffect, useState, useCallback, useMemo, cloneElement,\n CSSProperties, ReactNode, ReactElement, Component } from 'react'\nimport { createPopper, Instance, ModifierArguments } from '@popperjs/core'\n\nimport { EventName, KeyCode } from '../../../../constants'\nimport { cancelableSetTimeout } from '../../../../utils'\nimport { outsideClickHandler } from '../../../../hooks'\n\nimport { PopoverProps } from './popover.types'\n\n\nconst styles: Record<string, Partial<CSSProperties>> = {\n modal: {\n zIndex: 1,\n position: 'fixed',\n width: '100%',\n height: '100%',\n top: '0',\n left: '0',\n background: 'rgba(0 0 0 / 70%)',\n pointerEvents: 'all',\n userSelect: 'none',\n visibility: 'hidden',\n },\n}\n\nexport const Popover: FC<PopoverProps> = memo<PopoverProps>(\n ({\n children,\n components,\n placement = 'bottom',\n modifiers,\n data,\n hoverable,\n clickable,\n onOpen,\n onHide,\n isOpen,\n hideOnContentClick = false,\n hideOnClickOutside = true,\n hideTimeout = 150,\n isPopup = false,\n isModal = false,\n modalOverlayClassName,\n modalContainer,\n targetRef,\n hideOnEscape,\n ...props\n }: PopoverProps) => {\n const [content, setContent] = useState<HTMLElement | null>(null)\n const [target, setTarget] = useState<HTMLElement | null>(targetRef?.current ?? null)\n\n useEffect(() => {\n if (targetRef?.current) {\n setTarget(targetRef?.current)\n }\n }, [targetRef])\n\n const { ContentComponent, ...contentComponents } = components || {}\n\n const popperInstanceRef = useRef<Instance | null>(null)\n\n const options = useMemo(() => {\n const options = (modifiers ? { modifiers, placement } : { placement })\n\n options.modifiers = options.modifiers || []\n\n if (isPopup) {\n options.modifiers = [\n ...options.modifiers,\n {\n name: 'centering',\n phase: 'beforeWrite',\n enabled: true,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n fn: ({ state }): Partial<ModifierArguments> => {\n const mcBoundRect = modalContainer?.getBoundingClientRect()\n\n const { width, height, left, top } = mcBoundRect || {\n width: window.innerWidth,\n height: window.innerHeight,\n left: 0,\n top: 0,\n }\n\n const xpos = left + (width - state.elements.popper.clientWidth) / 2\n const ypos = top + (height - state.elements.popper.clientHeight) / 2\n\n return {\n ...state,\n styles: {\n ...state.styles,\n popper: {\n ...state.styles.popper,\n left: `${xpos}px`,\n top: `${ypos}px`,\n transform: 'none',\n },\n },\n }\n },\n },\n ] as PopoverProps['modifiers']\n }\n\n return options\n }, [modifiers, placement, isPopup, modalContainer])\n\n // to save cancelable setTimout\n const pendingHideRef = useRef<(() => void)>()\n\n useEffect(() => {\n popperInstanceRef?.current?.destroy()\n let popperInstance: ReturnType<typeof createPopper>\n\n if (target && content) {\n popperInstance = createPopper(target, content, { ...options })\n\n popperInstanceRef.current = popperInstance\n }\n\n return (): void => {\n popperInstance?.destroy()\n popperInstanceRef.current = null\n }\n }, [content, target, options])\n\n\n const outsideClickUnsubscriber = useRef<() => void | null>()\n const outsideClickUnsubscriberTimeout = useRef<any>(-1)\n\n const hide = useCallback(() => {\n if (content) {\n delete content.dataset.show\n }\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'hidden'\n delete modalRef.current.dataset.show\n }\n\n popperInstanceRef?.current?.update()\n onHide?.()\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n }, [content, isModal, onHide])\n\n\n const delayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n pendingHideRef.current = cancelableSetTimeout(hide, hideTimeout)\n }, [hide, hideTimeout])\n\n const cancelDelayedHide = useCallback(() => {\n pendingHideRef.current && pendingHideRef.current()\n }, [])\n\n const handleOutsideClick = useCallback((eventTarget: HTMLElement | null) => {\n if ((content?.dataset?.show === 'true' && hideOnClickOutside && !content?.contains(eventTarget))\n || (content?.contains(eventTarget) && hideOnContentClick)) {\n hide()\n }\n }, [hide, content, hideOnContentClick, hideOnClickOutside])\n\n const open = useCallback(() => {\n if (content) {\n content.dataset.show = 'true'\n }\n\n popperInstanceRef?.current?.update()\n\n if (isModal && modalRef?.current) {\n modalRef.current.style.visibility = 'visible'\n modalRef.current.dataset.show = 'true'\n }\n\n onOpen?.()\n\n outsideClickUnsubscriber?.current?.()\n clearTimeout(outsideClickUnsubscriberTimeout.current)\n outsideClickUnsubscriberTimeout.current = setTimeout(() => {\n outsideClickUnsubscriber.current = outsideClickHandler(target, handleOutsideClick)\n }, 250)\n }, [content, handleOutsideClick, isModal, onOpen, target])\n\n const toggleOpen = useCallback(() => {\n content?.dataset?.show === 'true' ? hide() : open()\n }, [content, hide, open])\n\n const keydownHandler = useCallback((event: Event) => {\n if (hideOnEscape && (event as unknown as KeyboardEvent).keyCode === KeyCode.Escape) {\n hide()\n }\n }, [hideOnEscape, hide])\n\n useEffect(() => {\n if (!hoverable && !clickable) {\n console.error('Popover component should have at least one of props [\"hoverable\", \"clickable\"]')\n }\n\n const targetAddListener = target?.addEventListener?.bind(target)\n const contentAddListener = content?.addEventListener?.bind(content)\n\n if (contentAddListener && targetAddListener) {\n if (hoverable) {\n targetAddListener(EventName.MouseEnter, open)\n contentAddListener(EventName.MouseEnter, cancelDelayedHide)\n targetAddListener(EventName.MouseLeave, delayedHide)\n contentAddListener(EventName.MouseLeave, hide)\n }\n\n if (clickable) {\n targetAddListener(EventName.Click, toggleOpen)\n }\n }\n\n if (hideOnEscape) {\n document.addEventListener(EventName.KeyDown, keydownHandler)\n }\n\n return (): void => {\n const targetRemoveListener = target?.removeEventListener?.bind(target)\n const contentRemoveListener = content?.removeEventListener?.bind(content)\n\n document.removeEventListener(EventName.KeyDown, keydownHandler)\n\n pendingHideRef.current && pendingHideRef.current()\n\n if (targetRemoveListener) {\n targetRemoveListener(EventName.Click, toggleOpen)\n targetRemoveListener(EventName.MouseEnter, open)\n targetRemoveListener(EventName.MouseLeave, delayedHide)\n }\n if (contentRemoveListener) {\n contentRemoveListener(EventName.MouseLeave, hide)\n contentRemoveListener(EventName.MouseEnter, cancelDelayedHide)\n }\n }\n }, [target, content, clickable, hoverable,\n open, hide, toggleOpen, delayedHide, cancelDelayedHide, hideOnEscape, keydownHandler])\n\n // open, hide based on external isOpen\n useEffect(() => {\n if (isOpen === true) {\n open()\n }\n if (isOpen === false) {\n hide()\n }\n return outsideClickUnsubscriber?.current as () => void\n }, [hide, isOpen, open])\n\n const childrenIsFunction = typeof children === 'function'\n const childrenIsElement = typeof children !== 'function' && !Array.isArray(children)\n const childrenAreElements = typeof children !== 'function' && Array.isArray(children)\n && children.filter((child: ReactNode) => !!child).length === 2\n\n // modal\n const modalRef = useRef<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (isModal && content) {\n content.style.zIndex = '2'\n }\n }, [content, isModal])\n\n return (\n <>\n {isModal && <span ref={modalRef} style={styles.modal} className={modalOverlayClassName} />}\n {(!targetRef && childrenIsFunction) && children?.({ forwardedRef: setTarget, data })}\n {(!targetRef && childrenIsElement) && <span ref={setTarget}>{children}</span>}\n {!childrenAreElements && ContentComponent && (\n <ContentComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n placement={placement}\n forwardedRef={setContent}\n ref={typeof ContentComponent !== 'function' ? setContent : null}\n data={data}\n hide={hide}\n components={contentComponents as { [key: string]: FC | Component<any> }}\n {...props}\n />\n )}\n {(!targetRef && childrenAreElements) && <span ref={setTarget}>{children[0]}</span>}\n {(childrenAreElements && children?.[1] && typeof children?.[1] === 'object')\n && cloneElement(children[1] as ReactElement, {\n ...((children?.[1] as ReactElement)?.props),\n placement,\n forwardedRef: setContent,\n // ...(typeof children[1] !== 'function' ? { ref: setContent } : {}),\n ref: setContent,\n data,\n hide,\n components: contentComponents as { [key: string]: FC | Component<any> },\n ...props,\n })}\n </>\n )\n },\n)\n\nPopover.displayName = 'Popover'\n"],"names":["styles","modal","zIndex","position","width","height","top","left","background","pointerEvents","userSelect","visibility","Popover","memo","_ref","_targetRef$current","_children$","children","components","placement","modifiers","data","hoverable","clickable","onOpen","onHide","isOpen","hideOnContentClick","hideOnClickOutside","hideTimeout","isPopup","isModal","modalOverlayClassName","modalContainer","targetRef","hideOnEscape","props","_objectWithoutProperties","_excluded","content","setContent","useState","target","setTarget","current","useEffect","_ref2","ContentComponent","contentComponents","_excluded2","popperInstanceRef","useRef","options","useMemo","name","phase","enabled","fn","_ref3","state","mcBoundRect","getBoundingClientRect","window","innerWidth","innerHeight","xpos","elements","popper","clientWidth","ypos","clientHeight","_objectSpread","objectSpread2","concat","transform","pendingHideRef","_popperInstanceRef$cu","popperInstance","destroy","createPopper","_popperInstance","outsideClickUnsubscriber","outsideClickUnsubscriberTimeout","hide","useCallback","_popperInstanceRef$cu2","_outsideClickUnsubscr","dataset","show","modalRef","style","update","call","clearTimeout","delayedHide","cancelableSetTimeout","cancelDelayedHide","handleOutsideClick","eventTarget","_content$dataset","contains","open","_popperInstanceRef$cu3","_outsideClickUnsubscr2","setTimeout","outsideClickHandler","toggleOpen","_content$dataset2","keydownHandler","event","keyCode","KeyCode","Escape","_target$addEventListe","_content$addEventList","targetAddListener","addEventListener","bind","contentAddListener","EventName","MouseEnter","MouseLeave","Click","document","KeyDown","_target$removeEventLi","_content$removeEventL","targetRemoveListener","removeEventListener","contentRemoveListener","childrenIsFunction","childrenIsElement","Array","isArray","childrenAreElements","filter","child","length","React","createElement","Fragment","ref","className","forwardedRef","_extends","cloneElement","displayName"],"mappings":"otBAYMA,EAAiD,CACrDC,MAAO,CACLC,OAAQ,EACRC,SAAU,QACVC,MAAO,OACPC,OAAQ,OACRC,IAAK,IACLC,KAAM,IACNC,WAAY,oBACZC,cAAe,MACfC,WAAY,OACZC,WAAY,WAIHC,EAA4BC,EAAIA,MAC3CC,IAqBoB,IAAAC,EAAAC,EAAA,IArBnBC,SACCA,EAAQC,WACRA,EAAUC,UACVA,EAAY,SAAQC,UACpBA,EAASC,KACTA,EAAIC,UACJA,EAASC,UACTA,EAASC,OACTA,EAAMC,OACNA,EAAMC,OACNA,EAAMC,mBACNA,GAAqB,EAAKC,mBAC1BA,GAAqB,EAAIC,YACzBA,EAAc,IAAGC,QACjBA,GAAU,EAAKC,QACfA,GAAU,EAAKC,sBACfA,EAAqBC,eACrBA,EAAcC,UACdA,EAASC,aACTA,GAEarB,EADVsB,EAAKC,EAAAA,wBAAAvB,EAAAwB,GAER,MAAOC,EAASC,GAAcC,EAAAA,SAA6B,OACpDC,EAAQC,GAAaF,EAAAA,SAA+C,QAAvC1B,EAAqBmB,aAAS,EAATA,EAAWU,eAAO7B,IAAAA,EAAAA,EAAI,MAE/E8B,EAAAA,WAAU,KACJX,SAAAA,EAAWU,SACbD,EAAUT,eAAAA,EAAWU,QACvB,GACC,CAACV,IAEJ,MAAAY,EAAmD5B,GAAc,CAAE,GAA7D6B,iBAAEA,GAAwCD,EAAnBE,EAAiBX,EAAAA,wBAAAS,EAAAG,GAExCC,EAAoBC,EAAMA,OAAkB,MAE5CC,EAAUC,EAAAA,SAAQ,KACtB,MAAMD,EAAWhC,EAAY,CAAEA,YAAWD,aAAc,CAAEA,aA2C1D,OAzCAiC,EAAQhC,UAAYgC,EAAQhC,WAAa,GAErCU,IACFsB,EAAQhC,UAA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EACN8D,KAAMA,EACNjE,WAAY8B,GACRZ,KAGHF,GAAaoG,GAAwBI,MAAAC,cAAA,OAAA,CAAME,IAAKlG,GAAY1B,EAAS,IACtEqH,IAAuBrH,aAAQ,EAARA,EAAW,KAA+B,iBAAlBA,aAAAA,EAAAA,EAAW,KACzDgI,EAAYA,aAAChI,EAAS,GAAEsD,EAAAA,cAAAA,EAAAC,cAAA,GACpBvD,SAAa,QAALD,EAARC,EAAW,UAAE,IAAAD,OAAA,EAAdA,EAAiCoB,OAAK,CAAA,EAAA,CAC1CjB,YACA4H,aAAcvG,EAEdqG,IAAKrG,EACLnB,OACA8D,OACAjE,WAAY8B,GACTZ,IAEJ,IAKTxB,EAAQsI,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";require("../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");const t=function(e){var o;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;var r;if(t.tokens=t.tokens||{},null!=l)return t.tokens[e]=l,"".concat(e).concat(null==t||null===(r=t.tokens)||void 0===r?void 0:r[e]);const a=void 0===(null==t?void 0:t.tokens[e])||null===(null==t?void 0:t.tokens[e]);return t.tokens[e]=t.tokens[e]||0,a?"".concat(e,0):n?(t.tokens[e]+=1,"".concat(e).concat(null==t||null===(s=t.tokens)||void 0===s?void 0:s[e])):"".concat(e).concat(null==t||null===(o=t.tokens)||void 0===o?void 0:o[e]);var s},e=function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_top",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e.aElement=e.aElement||document.createElement("a");const{aElement:l}=e;return l.setAttribute("href",t),l.setAttribute("target",o),l.dataset.date="".concat(Date.now()),l.click(),n&&(l.remove(),e.aElement=null),l};exports.anchorClick=e,exports.classNames=function(){for(var t=arguments.length,e=new Array(t),o=0;o<t;o++)e[o]=arguments[o];return e.filter((t=>"string"==typeof t&&null!=t)).filter(Boolean).join(" ")},exports.generateId=t,exports.mapSerReplacer=(t,e)=>e instanceof Map?{dataType:"Map",value:Array.from(e.entries())}:e,exports.noop=t=>{var e,o,n;null==t||null===(e=t.preventDefault)||void 0===e||e.call(t),null==t||null===(o=t.stopPropagation)||void 0===o||o.call(t),null==t||null===(n=t.stopImmediatePropagation)||void 0===n||n.call(t)},exports.parseProps=t=>{const e={},o={};return Object.entries(t).forEach((t=>{let[n,l]=t;"data-"===n.substr(0,5)||"data"===n.substr(0,4)?e[n]=l:o[n]=l})),{dataProps:e,restProps:o}};
1
+ "use strict";require("../../../../node_modules/core-js/modules/web.dom-collections.iterator.js");const e=function(t){var o;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;var r;if(e.tokens=e.tokens||{},null!=l)return e.tokens[t]=l,"".concat(t).concat(null==e||null===(r=e.tokens)||void 0===r?void 0:r[t]);const s=void 0===(null==e?void 0:e.tokens[t])||null===(null==e?void 0:e.tokens[t]);return e.tokens[t]=e.tokens[t]||0,s?"".concat(t,0):n?(e.tokens[t]+=1,"".concat(t).concat(null==e||null===(a=e.tokens)||void 0===a?void 0:a[t])):"".concat(t).concat(null==e||null===(o=e.tokens)||void 0===o?void 0:o[t]);var a},t=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_top",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.aElement=t.aElement||document.createElement("a");const{aElement:l}=t;return l.setAttribute("href",e),l.setAttribute("target",o),l.dataset.date="".concat(Date.now()),l.click(),n&&(l.remove(),t.aElement=null),l};let o={dark:"theme-dark",light:"theme-light"};const n=function(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const l=e?o.light:o.dark,r=e?o.dark:o.light;t&&(t.classList.remove(l),t.classList.remove(r),t.classList.add(r)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(l)).forEach((e=>{e.classList.add(".".concat(r)),e.classList.remove(".".concat(l))})),n&&(document.querySelectorAll(".shadow-div").forEach((e=>{var t,o;null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(l)))||void 0===t||t.classList.add(r),null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(l)))||void 0===o||o.classList.remove(l)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var t,o,n;null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(l)))||void 0===t||t.classList.add(r),null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(l)))||void 0===o||o.classList.remove(l);const s=null===(n=e.shadowRoot)||void 0===n?void 0:n.childNodes[0];s&&(s.classList.add(r),s.classList.remove(l))}))))},l="change";exports.anchorClick=t,exports.classNames=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return t.filter((e=>"string"==typeof e&&null!=e)).filter(Boolean).join(" ")},exports.generateId=e,exports.getBaseThemes=()=>o,exports.mapSerReplacer=(e,t)=>t instanceof Map?{dataType:"Map",value:Array.from(t.entries())}:t,exports.noop=e=>{var t,o,n;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),null==e||null===(o=e.stopPropagation)||void 0===o||o.call(e),null==e||null===(n=e.stopImmediatePropagation)||void 0===n||n.call(e)},exports.observeThemePreference=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const o=o=>{const l=e();null==n||n(o,l),null==t||t(o)},r=e=>{o(e.matches)},s=e=>{o(!e.matches)},a=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(l,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(l,s)}catch(e){}return o(null==a?void 0:a.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(l,r),window.matchMedia("(prefers-color-scheme: light)").addEventListener(l,s),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(l,r),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(l,s)}},exports.parseProps=e=>{const t={},o={};return Object.entries(e).forEach((e=>{let[n,l]=e;"data-"===n.substr(0,5)||"data"===n.substr(0,4)?t[n]=l:o[n]=l})),{dataProps:t,restProps:o}},exports.setThemeClassNames=e=>{o=e},exports.switchColorTheme=n,exports.updateColorTheme=(e,t)=>{let l=e||!1;"undefined"!=typeof document&&void 0===e&&(l=document.body.classList.contains(o.dark)),n(l,t||document.body)};
2
2
  //# sourceMappingURL=ui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sources":["../../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n"],"names":["generateId","token","_generateId$tokens3","increment","arguments","length","undefined","forcedValue","_generateId$tokens","tokens","concat","noValue","_generateId$tokens2","anchorClick","href","target","remove","aElement","document","createElement","setAttribute","dataset","date","Date","now","click","_len","classes","Array","_key","filter","className","Boolean","join","mapSerReplacer","key","value","Map","dataType","from","entries","event","_event$preventDefault","_event$stopPropagatio","_event$stopImmediateP","preventDefault","call","stopPropagation","stopImmediatePropagation","props","dataProps","restProps","Object","forEach","_ref","substr"],"mappings":"uGAyCaA,EAAyB,SACpCC,GAGG,IAAAC,EAAA,IAFHC,IAASC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACTG,EAA+BH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,QAAG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AA,OAA2BF,EAC7DG,QAAQC,GAAgD,iBAAdA,GAAP,MAAiCA,IACpED,OAAOE,SAASC,KAAK,IAAI,8CAb1BC,CAACC,EAAaC,IACVA,aAAiBC,IACZ,CACLC,SAAU,MACVF,MAAOR,MAAMW,KAAKH,EAAMI,YAGrBJ,eA6FYK,IAA4B,IAAAC,EAAAC,EAAAC,EAC/CH,SAAqBC,QAAhBA,EAALD,EAAOI,0BAAcH,GAArBA,EAAAI,KAAAL,GACAA,SAAsBE,QAAjBA,EAALF,EAAOM,2BAAeJ,GAAtBA,EAAAG,KAAAL,GACAA,SAA+BG,QAA1BA,EAALH,EAAOO,oCAAwBJ,GAA/BA,EAAAE,KAAAL,EAAmC,qBAlFVQ,IACzB,MAAMC,EAAqC,CAAE,EACvCC,EAAqC,CAAE,EAS7C,OAPAC,OAAOZ,QAAQS,GAAOI,SAAQC,IAAkB,IAAhBnB,EAAKC,GAAMkB,EAChB,UAArBnB,EAAIoB,OAAO,EAAG,IAAuC,SAArBpB,EAAIoB,OAAO,EAAG,GAChDL,EAAUf,GAAOC,EAEjBe,EAAUhB,GAAOC,CACnB,IAEK,CAAEc,YAAWC,YAAW"}
1
+ {"version":3,"file":"ui.js","sources":["../../../../../../../src/core/utils/helpers/ui.ts"],"sourcesContent":["export const mapSerReplacer\n= (key: string, value: unknown): unknown | { dataType: string; value: Array<unknown>} => {\n if (value instanceof Map) {\n return {\n dataType: 'Map',\n value: Array.from(value.entries()), // or with spread: value: [...value]\n }\n }\n return value\n}\n\nexport type TClassName = string | boolean | null | undefined\nexport const classNames = (...classes: TClassName[]): string => classes\n .filter((className: TClassName) => (typeof className === 'string' && className !== undefined && className !== null))\n .filter(Boolean).join(' ')\n\n\nexport type PropsCategoriesType = {\n dataProps: Record<string, unknown>\n restProps: Record<string, unknown>\n};\n\nexport const parseProps = (props: Record<string, unknown>):PropsCategoriesType => {\n const dataProps: Record<string, unknown> = {}\n const restProps: Record<string, unknown> = {}\n\n Object.entries(props).forEach(([key, value]) => {\n if (key.substr(0, 5) === 'data-' || key.substr(0, 4) === 'data') {\n dataProps[key] = value\n } else {\n restProps[key] = value\n }\n })\n return { dataProps, restProps }\n}\n\n\n\ntype GeneratorIdCallable = (token: string, increment?: boolean, forcedValue?: number | undefined) => string\ntype GenerateId = { tokens?: Record<string, number | null | undefined> } & GeneratorIdCallable\n\nexport const generateId: GenerateId = (\n token: string,\n increment = true,\n forcedValue: number | undefined = undefined,\n) => {\n generateId.tokens = generateId.tokens || {}\n\n if (forcedValue !== undefined && forcedValue !== null) {\n generateId.tokens[token] = forcedValue\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n const noValue = generateId?.tokens[token] === undefined || generateId?.tokens[token] === null\n\n generateId.tokens[token] = generateId.tokens[token] || 0\n\n if (noValue) {\n return `${token}${0}`\n }\n\n if (increment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n generateId.tokens[token] += 1\n\n return `${token}${generateId?.tokens?.[token] as number}`\n }\n\n return `${token}${generateId?.tokens?.[token] as number}`\n}\n\ntype FAnchorClick = { aElement?: HTMLAnchorElement | null }\n & ((href: string, target?: string, remove?: boolean) => void)\n\nexport const anchorClick: FAnchorClick = (href: string, target = '_top', remove = false): HTMLAnchorElement | null => {\n anchorClick.aElement = anchorClick.aElement || document.createElement('a')\n\n const { aElement } = anchorClick\n\n aElement.setAttribute('href', href)\n aElement.setAttribute('target', target)\n\n aElement.dataset.date = `${Date.now()}`\n aElement.click()\n if (remove) {\n aElement.remove()\n anchorClick.aElement = null\n }\n\n return aElement\n}\n\n\n\nexport type NoopEvent = {\n preventDefault?: () => void\n stopPropagation?: () => void\n stopImmediatePropagation?: () => void\n} | Event\n\nexport const noop = (event?: NoopEvent): void => {\n event?.preventDefault?.()\n event?.stopPropagation?.()\n event?.stopImmediatePropagation?.()\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\nexport type ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n"],"names":["generateId","token","_generateId$tokens3","increment","arguments","length","undefined","forcedValue","_generateId$tokens","tokens","concat","noValue","_generateId$tokens2","anchorClick","href","target","remove","aElement","document","createElement","setAttribute","dataset","date","Date","now","click","baseThemes","dark","light","getBaseThemes","switchColorTheme","isDark","htmlElement","findShadows","oldClass","newClass","classList","add","querySelectorAll","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","windowMatchMediaChangeEventType","_len","classes","Array","_key","filter","className","Boolean","join","mapSerReplacer","key","value","Map","dataType","from","entries","event","_event$preventDefault","_event$stopPropagatio","_event$stopImmediateP","preventDefault","call","stopPropagation","stopImmediatePropagation","getHtmlElement","body","switchCallback","switchColorThemeHandler","changeDarkColorThemeHandler","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","props","dataProps","restProps","Object","_ref","substr","themes","updateColorTheme","resolvedIsDark","contains"],"mappings":"uGAyCaA,EAAyB,SACpCC,GAGG,IAAAC,EAAA,IAFHC,IAASC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,KAAAA,UAAA,GACTG,EAA+BH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,QAAGE,EAIqB,IAAAE,EAAvD,GAFAR,EAAWS,OAAST,EAAWS,QAAU,CAAE,EAEvCF,QAEF,OADAP,EAAWS,OAAOR,GAASM,EAC3BG,GAAAA,OAAUT,GAAKS,OAAGV,SAAkB,QAARQ,EAAVR,EAAYS,cAAZD,IAAkBA,OAAlBA,EAAAA,EAAqBP,IAGzC,MAAMU,OAAwCL,KAA9BN,aAAAA,EAAAA,EAAYS,OAAOR,KAAsD,QAA9BD,aAAA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OxB,QAAQqB,GAAO/C,SAAQmD,IAAkB,IAAhB9B,EAAKC,GAAM6B,EAChB,UAArB9B,EAAI+B,OAAO,EAAG,IAAuC,SAArB/B,EAAI+B,OAAO,EAAG,GAChDJ,EAAU3B,GAAOC,EAEjB2B,EAAU5B,GAAOC,CACnB,IAEK,CAAE0B,YAAWC,YAAW,6BAoGEI,IACjClE,EAAakE,CAAM,sDAmDWC,CAAC9D,EAAkBC,KACjD,IAAI8D,EAA0B/D,IAAU,EAEhB,oBAAbb,eAAuCZ,IAAXyB,IACrC+D,EAAiB5E,SAASyD,KAAKvC,UAAU2D,SAASrE,EAAWC,OAE/DG,EAAiBgE,EAAgB9D,GAAed,SAASyD,KAAK"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./core/hooks/useApi.js"),r=require("./core/hooks/useToggle.js"),t=require("./core/hooks/useToggle2.js"),o=require("./core/hooks/useOutsideClick.js"),s=require("./core/hooks/useResize.js"),a=require("./core/hooks/useClassNames.js"),i=require("./core/hooks/useParseProps.js"),n=require("./core/hooks/useThemePreference.js"),p=require("./core/hooks/useAnimation.js"),u=require("./core/hooks/useIntersectionObserver.js"),l=require("./core/hooks/useSetTimeout.js"),c=require("./core/utils/helpers/birthnumber.validator.js"),x=require("./core/utils/helpers/birthnumberCZSKvalidator.js"),m=require("./core/utils/helpers/fileValidator.js"),d=require("./core/utils/helpers/date.js"),T=require("./core/utils/helpers/deviceInfo.js"),g=require("./core/utils/helpers/emailMatcher.js"),h=require("./core/utils/helpers/file.js"),S=require("./core/utils/helpers/objectOperations.js"),y=require("./core/utils/helpers/other.js"),j=require("./core/utils/helpers/textValueOperations.js"),C=require("./core/utils/helpers/valueOperations.js"),q=require("./core/utils/helpers/cancelableDelayedFunction.js"),v=require("./core/utils/helpers/ui.js"),P=require("./core/utils/helpers/text.js"),I=require("./core/utils/keyExtractor.js"),b=require("./core/utils/date.js"),A=require("./core/utils/webComponents/webComponent.utils.js"),M=require("./core/utils/appState/store/store.vanillajs.js"),f=require("./core/utils/appState/store/store.vanillajs.templates.js"),F=require("./core/utils/appState/store/useStore.react.js"),L=require("./core/utils/appState/peregrineMQ/peregrineMQ.js"),E=require("./core/utils/appState/peregrineMQ/peregrineMQ.types.js"),D=require("./core/utils/appState/peregrineMQ/usePeregrineMQ.react.js"),z=require("./core/utils/appState/peregrineMQ/index.js"),B=require("./core/utils/appState/stateMachine/tiny-state-machine.base.js"),k=require("./core/utils/array.js"),N=require("./core/constants/ui.constants.js"),O=require("./core/ui/utils/style.js"),V=require("./core/ui/components/container/layoutBox/LayoutBox.js"),R=require("./core/ui/components/container/layoutBox/layoutBox.types.js"),H=require("./core/ui/components/container/lazyComponent/LazyComponent.js"),w=require("./core/ui/components/container/CollapsibleContainer.js"),Q=require("./core/ui/components/container/ResizableContainer.js"),_=require("./core/ui/components/error/ErrorBoundary.js"),W=require("./core/ui/components/field/Field.js"),J=require("./core/ui/components/dividers/DividerLine.js"),K=require("./core/ui/components/icon/IconBase.js"),G=require("./core/ui/components/icon/Icon.js"),U=require("./core/ui/components/icon/IconWC.js"),X=require("./core/ui/components/atoms/button/Button.js"),Z=require("./core/ui/components/atoms/text/Text.js"),Y=require("./core/ui/components/atoms/text/Headline.js"),$=require("./core/ui/components/atoms/text/Paragraph.js"),ee=require("./core/ui/components/atoms/text/Link.js"),re=require("./core/ui/components/atoms/text/anchor-link/AnchorLink.js"),te=require("./core/ui/components/atoms/textAndContent/TextAndContent.js"),oe=require("./core/ui/components/atoms/tag/Tag.js"),se=require("./core/ui/components/atoms/tag/tag.types.js"),ae=require("./core/ui/components/atoms/toggle/Toggle.js"),ie=require("./core/ui/components/molecules/layouts/FlowLayout.js"),ne=require("./core/ui/components/molecules/popover/PopoverLite.js"),pe=require("./core/ui/components/molecules/popover/Tooltip.js"),ue=require("./core/ui/components/molecules/popover/popover.types.js"),le=require("./core/ui/components/molecules/popup/Popup.js"),ce=require("./core/ui/components/molecules/popup/popup.types.js");exports.useApi=e.useApi,exports.useToggle=r.useToggle,exports.useToggle2=t.useToggle2,exports.outsideClickHandler=o.outsideClickHandler,exports.useOutsideClick=o.useOutsideClick,exports.useResize=s.useResize,exports.useClassNames=a.useClassNames,exports.useParseProps=i.useParseProps,exports.getBaseThemes=n.getBaseThemes,exports.observeThemePreference=n.observeThemePreference,exports.setThemeClassNames=n.setThemeClassNames,exports.switchColorTheme=n.switchColorTheme,exports.updateColorTheme=n.updateColorTheme,exports.useThemePreference=n.useThemePreference,exports.useAnimation=p.useAnimation,exports.useIntersectionObserver=u.useIntersectionObserver,exports.useTimeoutFn=l.useTimeoutFn,exports.isBirthNumberValid=c.isBirthNumberValid,exports.getMatch=x.getMatch,exports.isValidFormat=x.isValidFormat,exports.isValidModulo11=x.isValidModulo11,exports.parse=x.parse,exports.regex=x.regex,exports.parseCSVdata=m.parseCSVdata,exports.validateCSVFile=m.validateCSVFile,exports.validateCSVlines=m.validateCSVlines,exports.validateJSONFile=m.validateJSONFile,exports.validateLineCellTrimmed=m.validateLineCellTrimmed,exports.validateLineNumColumns=m.validateLineNumColumns,exports.validateSDFFile=m.validateSDFFile,exports.DATE_FORMAT=d.DATE_FORMAT,exports.DATE_TIME_FORMAT=d.DATE_TIME_FORMAT,exports.formatDate=d.formatDate,exports.formatDateTime=d.formatDateTime,exports.formatDateToTimestamp=d.formatDateToTimestamp,exports.getDate=d.getDate,exports.getDeviceId=T.getDeviceId,exports.emailMatch=g.emailMatch,exports.emailMatcher=g.emailMatcher,exports.regexBuilder=g.regexBuilder,exports.cleanCsvLines=h.cleanCsvLines,exports.formatFilePath=h.formatFilePath,exports.arrayToObjectTree=S.arrayToObjectTree,exports.chunkArray=S.chunkArray,exports.duplicatesInArray=S.duplicatesInArray,exports.formatJsonString=S.formatJsonString,exports.formatObj=S.formatObj,exports.formatObj2=S.formatObj2,exports.AsyncFunctionTemplate=y.AsyncFunctionTemplate,exports.debounce=y.debounce,exports.delay=y.delay,exports.isFunctionAsync=y.isFunctionAsync,exports.memoize=y.memoize,exports.memoizeComplex=y.memoizeComplex,exports.memoizer=y.memoizer,exports.nestedTernary=y.nestedTernary,exports.escapeRegExp=j.escapeRegExp,exports.fileNameExt=j.fileNameExt,exports.findStringInText=j.findStringInText,exports.normalizeString=j.normalizeString,exports.removeWhitespaces=j.removeWhitespaces,exports.sanitizeId=j.sanitizeId,exports.sanitizePathId=j.sanitizePathId,exports.toLowerCase=j.toLowerCase,exports.toUpperCase=j.toUpperCase,exports.truncateText=j.truncateText,exports.Operation=C.Operation,exports.decrementValue=C.decrementValue,exports.incerementValue=C.incerementValue,exports.numberDefined=C.numberDefined,exports.numberOperation=C.numberOperation,exports.restrictNumberInLimits=C.restrictNumberInLimits,exports.setValue=C.setValue,exports.cancelableSetInterval=q.cancelableSetInterval,exports.cancelableSetTimeout=q.cancelableSetTimeout,exports.anchorClick=v.anchorClick,exports.classNames=v.classNames,exports.generateId=v.generateId,exports.mapSerReplacer=v.mapSerReplacer,exports.noop=v.noop,exports.parseProps=v.parseProps,exports.composeId=P.composeId,exports.defaultSanitizeConfig=P.defaultSanitizeConfig,exports.sanitizeHtml=P.sanitizeHtml,exports.keyExtractor=I.keyExtractor,exports.keyExtractorFunction=I.keyExtractorFunction,exports.dateRangeFormat=b.dateRangeFormat,exports.getDateTime=b.getDateTime,exports.getTimeFromNow=b.getTimeFromNow,exports.getTimeFromNowOriginal=b.getTimeFromNowOriginal,exports.getTimeTo=b.getTimeTo,exports.ced=A.ced,exports.createResolveAttribute=A.createResolveAttribute,exports.customElementDefine=A.customElementDefine,exports.resolveAttributes=A.resolveAttributes,exports.canSetStateMerge=M.canSetStateMerge,exports.createStore=M.createStore,exports.getSetStateMerge=M.getSetStateMerge,exports.createDataStore=f.createDataStore,exports.useStore=F.useStore,exports.useStoreApi=F.useStoreApi,exports.PeregrineMQ=L.PeregrineMQ,exports.PeregrineMQClearError=L.PeregrineMQClearError,exports.NON_EXISTENT_CHANNEL=E.NON_EXISTENT_CHANNEL,exports.usePeregrineMQ=D.usePeregrineMQ,exports.peregrineMQInstance=z.peregrineMQInstance,exports.TinyStateMachine=B.TinyStateMachine,exports.TinyStateMachineEvent=B.TinyStateMachineEvent,exports.TinyStateMachineEventType=B.TinyStateMachineEventType,exports.TinyStateMachineState=B.TinyStateMachineState,exports.createStates=B.createStates,exports.stateIterator=B.stateIterator,exports.ArrayFirst=k.ArrayFirst,exports.ArrayLast=k.ArrayLast,exports.Alerts=N.Alerts,exports.EventName=N.EventName,exports.KeyCode=N.KeyCode,exports.calculateColors=O.calculateColors,exports.calculatePercColor=O.calculatePercColor,exports.convertHex=O.convertHex,exports.convertRGB=O.convertRGB,Object.defineProperty(exports,"defaultFontSize",{enumerable:!0,get:function(){return O.defaultFontSize}}),exports.pxToRem=O.pxToRem,exports.resolveStyleValue=O.resolveStyleValue,exports.setDefaultFontSize=O.setDefaultFontSize,exports.toHex=O.toHex,exports.BoxLayout=V.BoxLayout,exports.LayoutBox=V.LayoutBox,exports.LayoutDirection=R.LayoutDirection,exports.LazyComponent=H.LazyComponent,exports.PendingBoundary=H.PendingBoundary,exports.createLazyModule=H.createLazyModule,exports.createLazyModuleWithStore=H.createLazyModuleWithStore,exports.wrapPromise=H.wrapPromise,exports.CollapsibleContainer=w.CollapsibleContainer,exports.ResizableContainer=Q.ResizableContainer,exports.DefaultErrorComponent=_.DefaultErrorComponent,exports.ErrorBoundary=_.ErrorBoundary,exports.Field=W.Field,exports.Select=W.Select,exports.setIconColor=W.setIconColor,exports.setIconComponent=W.setIconComponent,exports.DividerHorizontal=J.DividerHorizontal,exports.DividerLine=J.DividerLine,exports.DividerVertical=J.DividerVertical,exports.IconBase=K.IconBase,exports.Icon=G.Icon,exports.ESIcon=U.ESIcon,exports.ESIconBase=U.ESIconBase,exports.Button=X.Button,exports.IconButton=X.IconButton,exports.keys=X.keys,exports.Text=Z.Text,exports.Headline=Y.Headline,exports.HeadlineSecondary=Y.HeadlineSecondary,exports.HeadlineTertiary=Y.HeadlineTertiary,exports.Paragraph=$.Paragraph,exports.ParagraphBold=$.ParagraphBold,exports.ParagraphBoldSmall=$.ParagraphBoldSmall,exports.ParagraphSmall=$.ParagraphSmall,exports.Link=ee.Link,exports.AnchorLink=re.AnchorLink,exports.TextAndContent=te.TextAndContent,exports.TextAndIcons=te.TextAndIcons,exports.Tag=oe.Tag,exports.TagVariant=se.TagVariant,exports.Toggle=ae.Toggle,exports.FlowLayout=ie.FlowLayout,exports.Popover=ne.Popover,exports.Tooltip=pe.Tooltip,exports.PopoverPlacement=ue.PopoverPlacement,exports.Popup=le.Popup,exports.PopupAnimateVariant=ce.PopupAnimateVariant;
1
+ "use strict";var e=require("./core/hooks/useApi.js"),r=require("./core/hooks/useToggle.js"),t=require("./core/hooks/useToggle2.js"),o=require("./core/hooks/useOutsideClick.js"),s=require("./core/hooks/useResize.js"),a=require("./core/hooks/useClassNames.js"),i=require("./core/hooks/useParseProps.js"),n=require("./core/hooks/useThemePreference.js"),p=require("./core/hooks/useAnimation.js"),u=require("./core/hooks/useIntersectionObserver.js"),l=require("./core/hooks/useSetTimeout.js"),c=require("./core/utils/helpers/birthnumber.validator.js"),x=require("./core/utils/helpers/birthnumberCZSKvalidator.js"),m=require("./core/utils/helpers/fileValidator.js"),d=require("./core/utils/helpers/date.js"),T=require("./core/utils/helpers/deviceInfo.js"),g=require("./core/utils/helpers/emailMatcher.js"),h=require("./core/utils/helpers/file.js"),S=require("./core/utils/helpers/objectOperations.js"),y=require("./core/utils/helpers/other.js"),j=require("./core/utils/helpers/textValueOperations.js"),C=require("./core/utils/helpers/valueOperations.js"),q=require("./core/utils/helpers/cancelableDelayedFunction.js"),v=require("./core/utils/helpers/ui.js"),P=require("./core/utils/helpers/text.js"),I=require("./core/utils/keyExtractor.js"),b=require("./core/utils/date.js"),A=require("./core/utils/webComponents/webComponent.utils.js"),M=require("./core/utils/appState/store/store.vanillajs.js"),f=require("./core/utils/appState/store/store.vanillajs.templates.js"),F=require("./core/utils/appState/store/useStore.react.js"),L=require("./core/utils/appState/peregrineMQ/peregrineMQ.js"),E=require("./core/utils/appState/peregrineMQ/peregrineMQ.types.js"),D=require("./core/utils/appState/peregrineMQ/usePeregrineMQ.react.js"),z=require("./core/utils/appState/peregrineMQ/index.js"),B=require("./core/utils/appState/stateMachine/tiny-state-machine.base.js"),k=require("./core/utils/array.js"),N=require("./core/constants/ui.constants.js"),O=require("./core/ui/utils/style.js"),V=require("./core/ui/components/container/layoutBox/LayoutBox.js"),R=require("./core/ui/components/container/layoutBox/layoutBox.types.js"),H=require("./core/ui/components/container/lazyComponent/LazyComponent.js"),w=require("./core/ui/components/container/CollapsibleContainer.js"),Q=require("./core/ui/components/container/ResizableContainer.js"),_=require("./core/ui/components/error/ErrorBoundary.js"),W=require("./core/ui/components/field/Field.js"),J=require("./core/ui/components/dividers/DividerLine.js"),K=require("./core/ui/components/icon/IconBase.js"),G=require("./core/ui/components/icon/Icon.js"),U=require("./core/ui/components/icon/IconWC.js"),X=require("./core/ui/components/atoms/button/Button.js"),Z=require("./core/ui/components/atoms/text/Text.js"),Y=require("./core/ui/components/atoms/text/Headline.js"),$=require("./core/ui/components/atoms/text/Paragraph.js"),ee=require("./core/ui/components/atoms/text/Link.js"),re=require("./core/ui/components/atoms/text/anchor-link/AnchorLink.js"),te=require("./core/ui/components/atoms/textAndContent/TextAndContent.js"),oe=require("./core/ui/components/atoms/tag/Tag.js"),se=require("./core/ui/components/atoms/tag/tag.types.js"),ae=require("./core/ui/components/atoms/toggle/Toggle.js"),ie=require("./core/ui/components/molecules/layouts/FlowLayout.js"),ne=require("./core/ui/components/molecules/popover/PopoverLite.js"),pe=require("./core/ui/components/molecules/popover/Tooltip.js"),ue=require("./core/ui/components/molecules/popover/popover.types.js"),le=require("./core/ui/components/molecules/popup/Popup.js"),ce=require("./core/ui/components/molecules/popup/popup.types.js");exports.useApi=e.useApi,exports.useToggle=r.useToggle,exports.useToggle2=t.useToggle2,exports.outsideClickHandler=o.outsideClickHandler,exports.useOutsideClick=o.useOutsideClick,exports.useResize=s.useResize,exports.useClassNames=a.useClassNames,exports.useParseProps=i.useParseProps,exports.useThemePreference=n.useThemePreference,exports.useAnimation=p.useAnimation,exports.useIntersectionObserver=u.useIntersectionObserver,exports.useTimeoutFn=l.useTimeoutFn,exports.isBirthNumberValid=c.isBirthNumberValid,exports.getMatch=x.getMatch,exports.isValidFormat=x.isValidFormat,exports.isValidModulo11=x.isValidModulo11,exports.parse=x.parse,exports.regex=x.regex,exports.parseCSVdata=m.parseCSVdata,exports.validateCSVFile=m.validateCSVFile,exports.validateCSVlines=m.validateCSVlines,exports.validateJSONFile=m.validateJSONFile,exports.validateLineCellTrimmed=m.validateLineCellTrimmed,exports.validateLineNumColumns=m.validateLineNumColumns,exports.validateSDFFile=m.validateSDFFile,exports.DATE_FORMAT=d.DATE_FORMAT,exports.DATE_TIME_FORMAT=d.DATE_TIME_FORMAT,exports.formatDate=d.formatDate,exports.formatDateTime=d.formatDateTime,exports.formatDateToTimestamp=d.formatDateToTimestamp,exports.getDate=d.getDate,exports.getDeviceId=T.getDeviceId,exports.emailMatch=g.emailMatch,exports.emailMatcher=g.emailMatcher,exports.regexBuilder=g.regexBuilder,exports.cleanCsvLines=h.cleanCsvLines,exports.formatFilePath=h.formatFilePath,exports.arrayToObjectTree=S.arrayToObjectTree,exports.chunkArray=S.chunkArray,exports.duplicatesInArray=S.duplicatesInArray,exports.formatJsonString=S.formatJsonString,exports.formatObj=S.formatObj,exports.formatObj2=S.formatObj2,exports.AsyncFunctionTemplate=y.AsyncFunctionTemplate,exports.debounce=y.debounce,exports.delay=y.delay,exports.isFunctionAsync=y.isFunctionAsync,exports.memoize=y.memoize,exports.memoizeComplex=y.memoizeComplex,exports.memoizer=y.memoizer,exports.nestedTernary=y.nestedTernary,exports.escapeRegExp=j.escapeRegExp,exports.fileNameExt=j.fileNameExt,exports.findStringInText=j.findStringInText,exports.normalizeString=j.normalizeString,exports.removeWhitespaces=j.removeWhitespaces,exports.sanitizeId=j.sanitizeId,exports.sanitizePathId=j.sanitizePathId,exports.toLowerCase=j.toLowerCase,exports.toUpperCase=j.toUpperCase,exports.truncateText=j.truncateText,exports.Operation=C.Operation,exports.decrementValue=C.decrementValue,exports.incerementValue=C.incerementValue,exports.numberDefined=C.numberDefined,exports.numberOperation=C.numberOperation,exports.restrictNumberInLimits=C.restrictNumberInLimits,exports.setValue=C.setValue,exports.cancelableSetInterval=q.cancelableSetInterval,exports.cancelableSetTimeout=q.cancelableSetTimeout,exports.anchorClick=v.anchorClick,exports.classNames=v.classNames,exports.generateId=v.generateId,exports.getBaseThemes=v.getBaseThemes,exports.mapSerReplacer=v.mapSerReplacer,exports.noop=v.noop,exports.observeThemePreference=v.observeThemePreference,exports.parseProps=v.parseProps,exports.setThemeClassNames=v.setThemeClassNames,exports.switchColorTheme=v.switchColorTheme,exports.updateColorTheme=v.updateColorTheme,exports.composeId=P.composeId,exports.defaultSanitizeConfig=P.defaultSanitizeConfig,exports.sanitizeHtml=P.sanitizeHtml,exports.keyExtractor=I.keyExtractor,exports.keyExtractorFunction=I.keyExtractorFunction,exports.dateRangeFormat=b.dateRangeFormat,exports.getDateTime=b.getDateTime,exports.getTimeFromNow=b.getTimeFromNow,exports.getTimeFromNowOriginal=b.getTimeFromNowOriginal,exports.getTimeTo=b.getTimeTo,exports.ced=A.ced,exports.createResolveAttribute=A.createResolveAttribute,exports.customElementDefine=A.customElementDefine,exports.resolveAttributes=A.resolveAttributes,exports.canSetStateMerge=M.canSetStateMerge,exports.createStore=M.createStore,exports.getSetStateMerge=M.getSetStateMerge,exports.createDataStore=f.createDataStore,exports.useStore=F.useStore,exports.useStoreApi=F.useStoreApi,exports.PeregrineMQ=L.PeregrineMQ,exports.PeregrineMQClearError=L.PeregrineMQClearError,exports.NON_EXISTENT_CHANNEL=E.NON_EXISTENT_CHANNEL,exports.usePeregrineMQ=D.usePeregrineMQ,exports.peregrineMQInstance=z.peregrineMQInstance,exports.TinyStateMachine=B.TinyStateMachine,exports.TinyStateMachineEvent=B.TinyStateMachineEvent,exports.TinyStateMachineEventType=B.TinyStateMachineEventType,exports.TinyStateMachineState=B.TinyStateMachineState,exports.createStates=B.createStates,exports.stateIterator=B.stateIterator,exports.ArrayFirst=k.ArrayFirst,exports.ArrayLast=k.ArrayLast,exports.Alerts=N.Alerts,exports.EventName=N.EventName,exports.KeyCode=N.KeyCode,exports.calculateColors=O.calculateColors,exports.calculatePercColor=O.calculatePercColor,exports.convertHex=O.convertHex,exports.convertRGB=O.convertRGB,Object.defineProperty(exports,"defaultFontSize",{enumerable:!0,get:function(){return O.defaultFontSize}}),exports.pxToRem=O.pxToRem,exports.resolveStyleValue=O.resolveStyleValue,exports.setDefaultFontSize=O.setDefaultFontSize,exports.toHex=O.toHex,exports.BoxLayout=V.BoxLayout,exports.LayoutBox=V.LayoutBox,exports.LayoutDirection=R.LayoutDirection,exports.LazyComponent=H.LazyComponent,exports.PendingBoundary=H.PendingBoundary,exports.createLazyModule=H.createLazyModule,exports.createLazyModuleWithStore=H.createLazyModuleWithStore,exports.wrapPromise=H.wrapPromise,exports.CollapsibleContainer=w.CollapsibleContainer,exports.ResizableContainer=Q.ResizableContainer,exports.DefaultErrorComponent=_.DefaultErrorComponent,exports.ErrorBoundary=_.ErrorBoundary,exports.Field=W.Field,exports.Select=W.Select,exports.setIconColor=W.setIconColor,exports.setIconComponent=W.setIconComponent,exports.DividerHorizontal=J.DividerHorizontal,exports.DividerLine=J.DividerLine,exports.DividerVertical=J.DividerVertical,exports.IconBase=K.IconBase,exports.Icon=G.Icon,exports.ESIcon=U.ESIcon,exports.ESIconBase=U.ESIconBase,exports.Button=X.Button,exports.IconButton=X.IconButton,exports.keys=X.keys,exports.Text=Z.Text,exports.Headline=Y.Headline,exports.HeadlineSecondary=Y.HeadlineSecondary,exports.HeadlineTertiary=Y.HeadlineTertiary,exports.Paragraph=$.Paragraph,exports.ParagraphBold=$.ParagraphBold,exports.ParagraphBoldSmall=$.ParagraphBoldSmall,exports.ParagraphSmall=$.ParagraphSmall,exports.Link=ee.Link,exports.AnchorLink=re.AnchorLink,exports.TextAndContent=te.TextAndContent,exports.TextAndIcons=te.TextAndIcons,exports.Tag=oe.Tag,exports.TagVariant=se.TagVariant,exports.Toggle=ae.Toggle,exports.FlowLayout=ie.FlowLayout,exports.Popover=ne.Popover,exports.Tooltip=pe.Tooltip,exports.PopoverPlacement=ue.PopoverPlacement,exports.Popup=le.Popup,exports.PopupAnimateVariant=ce.PopupAnimateVariant;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{useEffect as e}from"react";const o="change",t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const c=o=>{const c=e();null==s||s(o,c),null==t||t(o)},d=e=>{c(e.matches)},l=e=>{c(!e.matches)},r=window.matchMedia("(prefers-color-scheme: dark)");try{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,d),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,l)}catch(e){}return c(null==r?void 0:r.matches),window.matchMedia("(prefers-color-scheme: dark)").addEventListener(o,d),window.matchMedia("(prefers-color-scheme: light)").addEventListener(o,l),()=>{window.matchMedia("(prefers-color-scheme: dark)").removeEventListener(o,d),window.matchMedia("(prefers-color-scheme: light)").removeEventListener(o,l)}},c=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;e((()=>t(o,c)),[o,c])};let d={dark:"theme-dark",light:"theme-light"};const l=()=>d,r=e=>{d=e},s=function(e,o){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const c=e?d.light:d.dark,l=e?d.dark:d.light;o&&(o.classList.remove(c),o.classList.remove(l),o.classList.add(l)),"undefined"!=typeof document&&(document.querySelectorAll(".".concat(c)).forEach((e=>{e.classList.add(".".concat(l)),e.classList.remove(".".concat(c))})),t&&(document.querySelectorAll(".shadow-div").forEach((e=>{var o,t;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c)})),document.querySelectorAll("esmf-wrapper").forEach((e=>{var o,t,d;null===(o=e.shadowRoot)||void 0===o||null===(o=o.querySelector(".".concat(c)))||void 0===o||o.classList.add(l),null===(t=e.shadowRoot)||void 0===t||null===(t=t.querySelector(".".concat(c)))||void 0===t||t.classList.remove(c);const r=null===(d=e.shadowRoot)||void 0===d?void 0:d.childNodes[0];r&&(r.classList.add(l),r.classList.remove(c))}))))},n=(e,o)=>{let t=e||!1;"undefined"!=typeof document&&void 0===e&&(t=document.body.classList.contains(d.dark)),s(t,o||document.body)};export{l as getBaseThemes,t as observeThemePreference,r as setThemeClassNames,s as switchColorTheme,n as updateColorTheme,c as useThemePreference};
1
+ import{useEffect as o}from"react";import{observeThemePreference as t}from"../utils/helpers/ui.js";const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>document.body,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o=>o;o((()=>t(e,i)),[e,i])};export{e as useThemePreference};
2
2
  //# sourceMappingURL=useThemePreference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\n\nconst windowMatchMediaChangeEventType = 'change'\n\n/**\n * Observes the user's theme preference and applies the appropriate theme.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n * @returns {() => void} Function to stop observing the theme preference.\n */\nexport const observeThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): () => void => {\n const switchColorThemeHandler = (isDark: boolean): void => {\n const htmlElement = getHtmlElement()\n\n switchColorTheme?.(isDark, htmlElement)\n switchCallback?.(isDark)\n }\n\n const changeDarkColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(event.matches)\n }\n\n const changeLightColorThemeHandler = (event: MediaQueryListEvent): void => {\n switchColorThemeHandler(!event.matches)\n }\n\n const isDark = window.matchMedia('(prefers-color-scheme: dark)')\n\n try {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n } catch (error) {\n console.error(`Error::observeThemePreference::removeEventListener: ${error}`)\n }\n\n switchColorThemeHandler(isDark?.matches)\n window.matchMedia('(prefers-color-scheme: dark)').addEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').addEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n\n return () => {\n window.matchMedia('(prefers-color-scheme: dark)').removeEventListener(\n windowMatchMediaChangeEventType, changeDarkColorThemeHandler,\n )\n window.matchMedia('(prefers-color-scheme: light)').removeEventListener(\n windowMatchMediaChangeEventType, changeLightColorThemeHandler,\n )\n }\n}\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n\n/**\n * Type definition for theme map.\n * @typedef {Object} ThemeMap\n * @property {string} dark - CSS class for the dark theme.\n * @property {string} light - CSS class for the light theme.\n */\ntype ThemeMap = {\n dark: string\n light: string\n}\n\nlet baseThemes: ThemeMap = {\n dark: 'theme-dark',\n light: 'theme-light',\n}\n\n/**\n * Gets the base themes.\n * @returns {ThemeMap} The current base themes.\n */\nexport const getBaseThemes = (): ThemeMap => baseThemes\n\n/**\n * Sets the base theme class names.\n * @param {ThemeMap} themes - Object containing the CSS classes for dark and light themes.\n */\nexport const setThemeClassNames = (themes: ThemeMap): void => {\n baseThemes = themes\n}\n\n/**\n * Switches the color theme of the document.\n * @param {boolean} isDark - Flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n * @param {boolean} [findShadows=true] - Flag to determine if shadow DOM elements should also be themed.\n */\nexport const switchColorTheme = (isDark: boolean, htmlElement?: HTMLElement, findShadows = true): void => {\n const oldClass = isDark ? baseThemes.light : baseThemes.dark\n const newClass = isDark ? baseThemes.dark : baseThemes.light\n\n if (htmlElement) {\n htmlElement.classList.remove(oldClass)\n htmlElement.classList.remove(newClass)\n htmlElement.classList.add(newClass)\n }\n\n if (typeof document !== 'undefined') {\n document.querySelectorAll(`.${oldClass}`).forEach((element) => {\n element.classList.add(`.${newClass}`)\n element.classList.remove(`.${oldClass}`)\n })\n\n if (findShadows) {\n document.querySelectorAll('.shadow-div').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n })\n\n document.querySelectorAll('esmf-wrapper').forEach((element) => {\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.add(newClass)\n element.shadowRoot?.querySelector(`.${oldClass}`)?.classList.remove(oldClass)\n\n const firstChild: HTMLElement = element.shadowRoot?.childNodes[0] as HTMLElement\n\n if (firstChild) {\n firstChild.classList.add(newClass)\n firstChild.classList.remove(oldClass)\n }\n })\n }\n }\n}\n\n/**\n * Updates the color theme of the document.\n * @param {boolean} [isDark] - Optional flag to determine if the dark theme should be applied.\n * @param {HTMLElement} [htmlElement] - The HTML element to which the theme will be applied.\n */\nexport const updateColorTheme = (isDark?: boolean, htmlElement?: HTMLElement): void => {\n let resolvedIsDark: boolean = isDark || false\n\n if (typeof document !== 'undefined' && isDark === undefined) {\n resolvedIsDark = document.body.classList.contains(baseThemes.dark)\n }\n switchColorTheme(resolvedIsDark, htmlElement || document.body)\n}\n"],"names":["windowMatchMediaChangeEventType","observeThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","switchColorThemeHandler","htmlElement","switchColorTheme","changeDarkColorThemeHandler","event","matches","changeLightColorThemeHandler","window","matchMedia","removeEventListener","error","addEventListener","useThemePreference","useEffect","baseThemes","dark","light","getBaseThemes","setThemeClassNames","themes","findShadows","oldClass","newClass","classList","remove","add","querySelectorAll","concat","forEach","element","_element$shadowRoot","_element$shadowRoot2","shadowRoot","querySelector","_element$shadowRoot3","_element$shadowRoot4","_element$shadowRoot5","firstChild","childNodes","updateColorTheme","resolvedIsDark","contains"],"mappings":"kCAGA,MAAMA,EAAkC,SAQ3BC,EAAyB,WAGrB,IAFfC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1E,MAAMC,EAA2BD,IAC/B,MAAME,EAAcT,IAEpBU,SAAAA,EAAmBH,EAAQE,GAC3BH,SAAAA,EAAiBC,EAAO,EAGpBI,EAA+BC,IACnCJ,EAAwBI,EAAMC,QAAQ,EAGlCC,EAAgCF,IACpCJ,GAAyBI,EAAMC,QAAQ,EAGnCN,EAASQ,OAAOC,WAAW,gCAEjC,IACED,OAAOC,WAAW,gCAAgCC,oBAChDnB,EAAiCa,GAEnCI,OAAOC,WAAW,iCAAiCC,oBACjDnB,EAAiCgB,EAEpC,CAAC,MAAOI,GAAO,CAYhB,OARAV,EAAwBD,eAAAA,EAAQM,SAChCE,OAAOC,WAAW,gCAAgCG,iBAChDrB,EAAiCa,GAE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AAD,GAA+B,QAA/BA,EAAlBA,EAAoBE,cAAa,IAAAN,OAAKN,WAAW,IAAAU,GAAjDA,EAAmDR,UAAUC,OAAOH,EAAS,IAG/EzB,SAAS8B,iBAAiB,gBAAgBE,SAASC,IAAY,IAAAK,EAAAC,EAAAC,EAC3C,QAAlBF,EAAAL,EAAQG,kBAAU,IAAAE,GAA+B,QAA/BA,EAAlBA,EAAoBD,cAAa,IAAAN,OAAKN,WAAW,IAAAa,GAAjDA,EAAmDX,UAAUE,IAAIH,GAC/C,QAAlBa,EAAAN,EAAQG,kBAAU,IAAAG,GAA+B,QAA/BA,EAAlBA,EAAoBF,cAAa,IAAAN,OAAKN,WAAW,IAAAc,GAAjDA,EAAmDZ,UAAUC,OAAOH,GAEpE,MAAMgB,EAA4CD,QAArBA,EAAGP,EAAQG,sBAAUI,SAAlBA,EAAoBE,WAAW,GAE3DD,IACFA,EAAWd,UAAUE,IAAIH,GACzBe,EAAWd,UAAUC,OAAOH,GAC9B,KAIR,EAOakB,EAAmBA,CAACxC,EAAkBE,KACjD,IAAIuC,EAA0BzC,IAAU,EAEhB,oBAAbH,eAAuCD,IAAXI,IACrCyC,EAAiB5C,SAASC,KAAK0B,UAAUkB,SAAS3B,EAAWC,OAE/Db,EAAiBsC,EAAgBvC,GAAeL,SAASC,KAAK"}
1
+ {"version":3,"file":"useThemePreference.js","sources":["../../../../../../src/core/hooks/useThemePreference.ts"],"sourcesContent":["import { useEffect } from 'react'\n\nimport { observeThemePreference } from '../utils/helpers/ui'\n\n/**\n * Custom hook to use theme preference in a React component.\n * @param {() => HTMLElement} [getHtmlElement] - Function to get the HTML element to which the theme will be applied.\n * @param {(isDark: boolean) => void} [switchCallback] - Callback function to execute when the theme changes.\n */\nexport const useThemePreference = (\n getHtmlElement: () => HTMLElement = (): HTMLElement => document.body,\n switchCallback: (isDark: boolean) => void = (isDark: boolean): boolean => isDark,\n): void => {\n useEffect(() => observeThemePreference(getHtmlElement, switchCallback), [getHtmlElement, switchCallback])\n}\n"],"names":["useThemePreference","getHtmlElement","arguments","length","undefined","document","body","switchCallback","isDark","useEffect","observeThemePreference"],"mappings":"kGASaA,MAAAA,EAAqB,WAGvB,IAFTC,EAAiCC,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAA,GAAG,IAAmBG,SAASC,KAChEC,EAAyCL,UAAAC,OAAAD,QAAAE,IAAAF,UAAAE,GAAAF,UAAIM,GAAAA,GAA6BA,EAE1EC,GAAU,IAAMC,EAAuBT,EAAgBM,IAAiB,CAACN,EAAgBM,GAC3F"}