intergalactic 15.127.0-prerelease.2 → 15.128.0-prerelease.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 (113) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/accordion/package.json +1 -1
  3. package/add-filter/package.json +1 -1
  4. package/bulk-textarea/BulkTextarea.d.ts +1 -1
  5. package/bulk-textarea/BulkTextarea.types.d.ts +23 -21
  6. package/bulk-textarea/components/InputField/InputField.d.ts +4 -4
  7. package/bulk-textarea/components/InputField/InputField.types.d.ts +4 -4
  8. package/bulk-textarea/lib/cjs/BulkTextarea.js +10 -8
  9. package/bulk-textarea/lib/cjs/BulkTextarea.js.map +1 -1
  10. package/bulk-textarea/lib/cjs/BulkTextarea.types.js.map +1 -1
  11. package/bulk-textarea/lib/cjs/components/InputField/InputField.js +39 -26
  12. package/bulk-textarea/lib/cjs/components/InputField/InputField.js.map +1 -1
  13. package/bulk-textarea/lib/cjs/components/InputField/InputField.types.js.map +1 -1
  14. package/bulk-textarea/lib/cjs/components/InputField/inputField.shadow.css +17 -7
  15. package/bulk-textarea/lib/es6/BulkTextarea.js +10 -8
  16. package/bulk-textarea/lib/es6/BulkTextarea.js.map +1 -1
  17. package/bulk-textarea/lib/es6/BulkTextarea.types.js.map +1 -1
  18. package/bulk-textarea/lib/es6/components/InputField/InputField.js +39 -26
  19. package/bulk-textarea/lib/es6/components/InputField/InputField.js.map +1 -1
  20. package/bulk-textarea/lib/es6/components/InputField/InputField.types.js.map +1 -1
  21. package/bulk-textarea/lib/es6/components/InputField/inputField.shadow.css +17 -7
  22. package/bulk-textarea/lib/esm/BulkTextarea.mjs +53 -50
  23. package/bulk-textarea/lib/esm/components/InputField/InputField.mjs +273 -259
  24. package/bulk-textarea/lib/types/BulkTextarea.d.ts +1 -1
  25. package/bulk-textarea/lib/types/BulkTextarea.types.d.ts +23 -21
  26. package/bulk-textarea/lib/types/components/InputField/InputField.d.ts +4 -4
  27. package/bulk-textarea/lib/types/components/InputField/InputField.types.d.ts +4 -4
  28. package/bulk-textarea/package.json +1 -1
  29. package/button/package.json +1 -1
  30. package/card/package.json +1 -1
  31. package/carousel/package.json +1 -1
  32. package/color-picker/package.json +1 -1
  33. package/components.json +14 -14
  34. package/date-picker/package.json +1 -1
  35. package/drag-and-drop/package.json +1 -1
  36. package/dropdown-menu/package.json +1 -1
  37. package/errors/lib/cjs/Error.js +9 -9
  38. package/errors/lib/es6/Error.js +9 -9
  39. package/errors/lib/esm/Error.mjs +40 -40
  40. package/errors/package.json +1 -1
  41. package/feature-popover/package.json +1 -1
  42. package/feedback-form/lib/cjs/FeedbackForm.js +7 -7
  43. package/feedback-form/lib/cjs/component/checkbox-button/CheckboxButton.js +3 -3
  44. package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js +10 -4
  45. package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
  46. package/feedback-form/lib/cjs/component/slider-rating/SliderRating.js +18 -14
  47. package/feedback-form/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
  48. package/feedback-form/lib/cjs/style/slider-rating.shadow.css +1 -3
  49. package/feedback-form/lib/es6/FeedbackForm.js +7 -7
  50. package/feedback-form/lib/es6/component/checkbox-button/CheckboxButton.js +3 -3
  51. package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js +10 -4
  52. package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
  53. package/feedback-form/lib/es6/component/slider-rating/SliderRating.js +18 -14
  54. package/feedback-form/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
  55. package/feedback-form/lib/es6/style/slider-rating.shadow.css +1 -3
  56. package/feedback-form/lib/esm/FeedbackForm.mjs +39 -39
  57. package/feedback-form/lib/esm/component/checkbox-button/CheckboxButton.mjs +13 -13
  58. package/feedback-form/lib/esm/component/feedback-rating/FeedbackRating.mjs +85 -81
  59. package/feedback-form/lib/esm/component/slider-rating/SliderRating.mjs +83 -79
  60. package/feedback-form/package.json +1 -1
  61. package/fullscreen-modal/package.json +1 -1
  62. package/illustration/lib/cjs/index.js +1 -1
  63. package/illustration/lib/es6/index.js +1 -1
  64. package/illustration/package.json +1 -1
  65. package/inline-input/package.json +1 -1
  66. package/modal/lib/cjs/Modal.js +8 -8
  67. package/modal/lib/es6/Modal.js +8 -8
  68. package/modal/lib/esm/Modal.mjs +73 -73
  69. package/modal/package.json +1 -1
  70. package/notice/package.json +1 -1
  71. package/notice-bubble/package.json +1 -1
  72. package/notice-global/package.json +1 -1
  73. package/outside-click/lib/cjs/OutsideClick.js +14 -7
  74. package/outside-click/lib/cjs/OutsideClick.js.map +1 -1
  75. package/outside-click/lib/es6/OutsideClick.js +14 -7
  76. package/outside-click/lib/es6/OutsideClick.js.map +1 -1
  77. package/outside-click/lib/esm/OutsideClick.mjs +39 -35
  78. package/outside-click/package.json +1 -1
  79. package/package.json +1 -1
  80. package/pagination/package.json +1 -1
  81. package/popper/lib/cjs/Popper.js +6 -6
  82. package/popper/lib/es6/Popper.js +6 -6
  83. package/popper/lib/esm/Popper.mjs +25 -25
  84. package/popper/package.json +1 -1
  85. package/select/lib/cjs/InputSearch.js +15 -19
  86. package/select/lib/cjs/InputSearch.js.map +1 -1
  87. package/select/lib/cjs/Select.js +8 -8
  88. package/select/lib/es6/InputSearch.js +15 -19
  89. package/select/lib/es6/InputSearch.js.map +1 -1
  90. package/select/lib/es6/Select.js +8 -8
  91. package/select/lib/esm/InputSearch.mjs +63 -65
  92. package/select/lib/esm/Select.mjs +122 -122
  93. package/select/package.json +1 -1
  94. package/side-panel/lib/cjs/SidePanel.js +16 -16
  95. package/side-panel/lib/es6/SidePanel.js +16 -16
  96. package/side-panel/lib/esm/SidePanel.mjs +77 -77
  97. package/side-panel/package.json +1 -1
  98. package/time-picker/lib/cjs/TimePicker.js +12 -12
  99. package/time-picker/lib/es6/TimePicker.js +12 -12
  100. package/time-picker/lib/esm/TimePicker.mjs +38 -38
  101. package/time-picker/package.json +1 -1
  102. package/tooltip/lib/cjs/Tooltip.js +9 -9
  103. package/tooltip/lib/es6/Tooltip.js +9 -9
  104. package/tooltip/lib/esm/Tooltip.mjs +103 -103
  105. package/tooltip/package.json +1 -1
  106. package/widget-empty/lib/cjs/WidgetEmpty.js +5 -5
  107. package/widget-empty/lib/es6/WidgetEmpty.js +5 -5
  108. package/widget-empty/lib/esm/WidgetEmpty.mjs +32 -32
  109. package/widget-empty/package.json +1 -1
  110. package/wizard/lib/cjs/Wizard.js +12 -12
  111. package/wizard/lib/es6/Wizard.js +12 -12
  112. package/wizard/lib/esm/Wizard.mjs +103 -103
  113. package/wizard/package.json +1 -1
@@ -1 +1 @@
1
- {"name":"intergalactic/illustration","description":"Semrush Illustration Component","version":"2.43.1","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm clear && pnpm semcore-builder --source=js && pnpm run transform","transform":"tsm --require=../../.ci/tsm-filter-warnings.js transform.ts","clear":"tsm --require=../../.ci/tsm-filter-warnings.js clear.ts","upload-static":"gcs-upload svg/*.svg"},"dependencies":{"@babel/runtime":"^7.17.9","@semcore/flex-box":"5.41.1","colorjs.io":"0.4.3"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/illustration"},"devDependencies":{"esbuild":"0.14.29","happy-dom":"9.20.3","svg-to-jsx":"^1.0.4","@semcore/testing-utils":"1.0.0","@types/react":"18.0.21"}}
1
+ {"name":"intergalactic/illustration","description":"Semrush Illustration Component","version":"2.44.0-prerelease.0","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm clear && pnpm semcore-builder --source=js && pnpm run transform","transform":"tsm --require=../../.ci/tsm-filter-warnings.js transform.ts","clear":"tsm --require=../../.ci/tsm-filter-warnings.js clear.ts","upload-static":"gcs-upload svg/*.svg"},"dependencies":{"@babel/runtime":"^7.17.9","@semcore/flex-box":"5.41.1","colorjs.io":"0.4.3"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/illustration"},"devDependencies":{"esbuild":"0.14.29","happy-dom":"9.20.3","fs-extra":"8.1.0","svg-to-jsx":"^1.0.4","@semcore/testing-utils":"1.0.0","@types/react":"18.0.21","@types/fs-extra":"8.1.0"},"exports":{".":{"require":"./lib/cjs/index.js","import":"./lib/es6/index.js","types":"./lib/types/index.d.ts"},"./AccessDenied":{"require":"./AccessDenied/index.js","import":"./AccessDenied/index.mjs","types":"./AccessDenied/index.d.ts"},"./AccessLogIn":{"require":"./AccessLogIn/index.js","import":"./AccessLogIn/index.mjs","types":"./AccessLogIn/index.d.ts"},"./AreaChart":{"require":"./AreaChart/index.js","import":"./AreaChart/index.mjs","types":"./AreaChart/index.d.ts"},"./Blocked":{"require":"./Blocked/index.js","import":"./Blocked/index.mjs","types":"./Blocked/index.d.ts"},"./ChoroplethMapChart":{"require":"./ChoroplethMapChart/index.js","import":"./ChoroplethMapChart/index.mjs","types":"./ChoroplethMapChart/index.d.ts"},"./Coffee":{"require":"./Coffee/index.js","import":"./Coffee/index.mjs","types":"./Coffee/index.d.ts"},"./Collection":{"require":"./Collection/index.js","import":"./Collection/index.mjs","types":"./Collection/index.d.ts"},"./CombinedChart":{"require":"./CombinedChart/index.js","import":"./CombinedChart/index.mjs","types":"./CombinedChart/index.d.ts"},"./Configuration":{"require":"./Configuration/index.js","import":"./Configuration/index.mjs","types":"./Configuration/index.d.ts"},"./Confirmation":{"require":"./Confirmation/index.js","import":"./Confirmation/index.mjs","types":"./Confirmation/index.d.ts"},"./Congrats":{"require":"./Congrats/index.js","import":"./Congrats/index.mjs","types":"./Congrats/index.d.ts"},"./ConnectionLost":{"require":"./ConnectionLost/index.js","import":"./ConnectionLost/index.mjs","types":"./ConnectionLost/index.d.ts"},"./DeletedAccount":{"require":"./DeletedAccount/index.js","import":"./DeletedAccount/index.mjs","types":"./DeletedAccount/index.d.ts"},"./DeletedPage":{"require":"./DeletedPage/index.js","import":"./DeletedPage/index.mjs","types":"./DeletedPage/index.d.ts"},"./Dns":{"require":"./Dns/index.js","import":"./Dns/index.mjs","types":"./Dns/index.d.ts"},"./DonutChart":{"require":"./DonutChart/index.js","import":"./DonutChart/index.mjs","types":"./DonutChart/index.d.ts"},"./Duplicates":{"require":"./Duplicates/index.js","import":"./Duplicates/index.mjs","types":"./Duplicates/index.d.ts"},"./Feedback":{"require":"./Feedback/index.js","import":"./Feedback/index.mjs","types":"./Feedback/index.d.ts"},"./FunnelChart":{"require":"./FunnelChart/index.js","import":"./FunnelChart/index.mjs","types":"./FunnelChart/index.d.ts"},"./Good":{"require":"./Good/index.js","import":"./Good/index.mjs","types":"./Good/index.d.ts"},"./HeatMapChart":{"require":"./HeatMapChart/index.js","import":"./HeatMapChart/index.mjs","types":"./HeatMapChart/index.d.ts"},"./HorizontalBarChart":{"require":"./HorizontalBarChart/index.js","import":"./HorizontalBarChart/index.mjs","types":"./HorizontalBarChart/index.d.ts"},"./KagiChart":{"require":"./KagiChart/index.js","import":"./KagiChart/index.mjs","types":"./KagiChart/index.d.ts"},"./LineChart":{"require":"./LineChart/index.js","import":"./LineChart/index.mjs","types":"./LineChart/index.d.ts"},"./LollipopChart":{"require":"./LollipopChart/index.js","import":"./LollipopChart/index.mjs","types":"./LollipopChart/index.d.ts"},"./MailSent":{"require":"./MailSent/index.js","import":"./MailSent/index.mjs","types":"./MailSent/index.d.ts"},"./Maintenance":{"require":"./Maintenance/index.js","import":"./Maintenance/index.mjs","types":"./Maintenance/index.d.ts"},"./Nexttime":{"require":"./Nexttime/index.js","import":"./Nexttime/index.mjs","types":"./Nexttime/index.d.ts"},"./NoPayment":{"require":"./NoPayment/index.js","import":"./NoPayment/index.mjs","types":"./NoPayment/index.d.ts"},"./NothingFound":{"require":"./NothingFound/index.js","import":"./NothingFound/index.mjs","types":"./NothingFound/index.d.ts"},"./OtherData":{"require":"./OtherData/index.js","import":"./OtherData/index.mjs","types":"./OtherData/index.d.ts"},"./PageError":{"require":"./PageError/index.js","import":"./PageError/index.mjs","types":"./PageError/index.d.ts"},"./PageNotFound":{"require":"./PageNotFound/index.js","import":"./PageNotFound/index.mjs","types":"./PageNotFound/index.d.ts"},"./PieChart":{"require":"./PieChart/index.js","import":"./PieChart/index.mjs","types":"./PieChart/index.d.ts"},"./Processing":{"require":"./Processing/index.js","import":"./Processing/index.mjs","types":"./Processing/index.d.ts"},"./ProjectNotFound":{"require":"./ProjectNotFound/index.js","import":"./ProjectNotFound/index.mjs","types":"./ProjectNotFound/index.d.ts"},"./RadarChart":{"require":"./RadarChart/index.js","import":"./RadarChart/index.mjs","types":"./RadarChart/index.d.ts"},"./RadialTreeChart":{"require":"./RadialTreeChart/index.js","import":"./RadialTreeChart/index.mjs","types":"./RadialTreeChart/index.d.ts"},"./SankeyChart":{"require":"./SankeyChart/index.js","import":"./SankeyChart/index.mjs","types":"./SankeyChart/index.d.ts"},"./ScatterPlotChart":{"require":"./ScatterPlotChart/index.js","import":"./ScatterPlotChart/index.mjs","types":"./ScatterPlotChart/index.d.ts"},"./StackedAreaChart":{"require":"./StackedAreaChart/index.js","import":"./StackedAreaChart/index.mjs","types":"./StackedAreaChart/index.d.ts"},"./Suggestion":{"require":"./Suggestion/index.js","import":"./Suggestion/index.mjs","types":"./Suggestion/index.d.ts"},"./Suggestions":{"require":"./Suggestions/index.js","import":"./Suggestions/index.mjs","types":"./Suggestions/index.d.ts"},"./Table":{"require":"./Table/index.js","import":"./Table/index.mjs","types":"./Table/index.d.ts"},"./TagCloud":{"require":"./TagCloud/index.js","import":"./TagCloud/index.mjs","types":"./TagCloud/index.d.ts"},"./TextLinksEtc":{"require":"./TextLinksEtc/index.js","import":"./TextLinksEtc/index.mjs","types":"./TextLinksEtc/index.d.ts"},"./Timeout":{"require":"./Timeout/index.js","import":"./Timeout/index.mjs","types":"./Timeout/index.d.ts"},"./UnderConstruction":{"require":"./UnderConstruction/index.js","import":"./UnderConstruction/index.mjs","types":"./UnderConstruction/index.d.ts"},"./VennChart":{"require":"./VennChart/index.js","import":"./VennChart/index.mjs","types":"./VennChart/index.d.ts"},"./VerticalBarChart":{"require":"./VerticalBarChart/index.js","import":"./VerticalBarChart/index.mjs","types":"./VerticalBarChart/index.d.ts"},"./Waiting":{"require":"./Waiting/index.js","import":"./Waiting/index.mjs","types":"./Waiting/index.d.ts"},"./Warning":{"require":"./Warning/index.js","import":"./Warning/index.mjs","types":"./Warning/index.d.ts"}}}
@@ -1 +1 @@
1
- {"name":"intergalactic/inline-input","description":"Semrush Input Component","version":"4.47.0-prerelease.2","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/flex-box":"5.41.1","@semcore/icon":"4.60.1","@semcore/spin":"5.41.1","@semcore/tooltip":"6.49.1","@semcore/utils":"4.48.1","@semcore/input-number":"5.41.1","@semcore/input":"4.42.1","@semcore/core":"2.39.1","@semcore/button":"5.43.0-prerelease.2"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0","@semcore/spin":"*","@semcore/tooltip":"*"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/inline-input"}}
1
+ {"name":"intergalactic/inline-input","description":"Semrush Input Component","version":"4.47.0","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/flex-box":"5.41.1","@semcore/icon":"4.60.1","@semcore/spin":"5.41.1","@semcore/tooltip":"6.49.1","@semcore/utils":"4.48.1","@semcore/input-number":"5.41.1","@semcore/input":"4.42.1","@semcore/core":"2.39.1","@semcore/button":"5.43.0"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0","@semcore/spin":"*","@semcore/tooltip":"*"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/inline-input"}}
@@ -35,14 +35,14 @@ var _ThemeProvider = require("intergalactic/utils/lib/ThemeProvider");
35
35
  var _useColorResolver = require("intergalactic/utils/lib/use/useColorResolver");
36
36
  var _zIndexStacking = require("intergalactic/utils/lib/zIndexStacking");
37
37
  /*__reshadow-styles__:"./style/modal.shadow.css"*/
38
- var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SWindow_1vjjl_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, 12px);background:var(--intergalactic-bg-primary-neutral, #ffffff);box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 3px 8px 0px rgba(25, 27, 35, 0.2));color:var(--intergalactic-text-primary, #191b23)}.___SWindow_1vjjl_gg_:focus{outline:0}.___SWindow_1vjjl_gg_ .___STitle_1vjjl_gg_{color:var(--intergalactic-text-primary, #191b23);font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_1vjjl_gg_ .___STitle_1vjjl_gg_.__color_1vjjl_gg_{color:var(--color_1vjjl)}.___SWindow_1vjjl_gg_ .___SClose_1vjjl_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_1vjjl_gg_ .___SClose_1vjjl_gg_.__ghost_1vjjl_gg_{right:0;top:0}.___SWindow_1vjjl_gg_.__ghost_1vjjl_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlay_1vjjl_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:var(--intergalactic-spacing-10x, 40px);background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));overflow:auto;-webkit-overflow-scrolling:touch}.___SOverlay_1vjjl_gg_ .___SOverlay_1vjjl_gg_{background:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}@media (max-width:767px){.___SWindow_1vjjl_gg_{min-width:60%}.___SOverlay_1vjjl_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}" /*__inner_css_end__*/, "1vjjl_gg_") /*__reshadow_css_end__*/, {
39
- "__SWindow": "___SWindow_1vjjl_gg_",
40
- "_ghost": "__ghost_1vjjl_gg_",
41
- "__SOverlay": "___SOverlay_1vjjl_gg_",
42
- "__STitle": "___STitle_1vjjl_gg_",
43
- "_color": "__color_1vjjl_gg_",
44
- "--color": "--color_1vjjl",
45
- "__SClose": "___SClose_1vjjl_gg_"
38
+ var style = ( /*__reshadow_css_start__*/_index.sstyled.insert( /*__inner_css_start__*/".___SWindow_wwtaj_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, 12px);background:var(--intergalactic-bg-primary-neutral, #ffffff);box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 3px 8px 0px rgba(25, 27, 35, 0.2));color:var(--intergalactic-text-primary, #191b23)}.___SWindow_wwtaj_gg_:focus{outline:0}.___SWindow_wwtaj_gg_ .___STitle_wwtaj_gg_{color:var(--intergalactic-text-primary, #191b23);font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_wwtaj_gg_ .___STitle_wwtaj_gg_.__color_wwtaj_gg_{color:var(--color_wwtaj)}.___SWindow_wwtaj_gg_ .___SClose_wwtaj_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_wwtaj_gg_ .___SClose_wwtaj_gg_.__ghost_wwtaj_gg_{right:0;top:0}.___SWindow_wwtaj_gg_.__ghost_wwtaj_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlay_wwtaj_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:var(--intergalactic-spacing-10x, 40px);background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));overflow:auto;-webkit-overflow-scrolling:touch}.___SOverlay_wwtaj_gg_ .___SOverlay_wwtaj_gg_{background:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}@media (max-width:767px){.___SWindow_wwtaj_gg_{min-width:60%}.___SOverlay_wwtaj_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}" /*__inner_css_end__*/, "wwtaj_gg_") /*__reshadow_css_end__*/, {
39
+ "__SWindow": "___SWindow_wwtaj_gg_",
40
+ "_ghost": "__ghost_wwtaj_gg_",
41
+ "__SOverlay": "___SOverlay_wwtaj_gg_",
42
+ "__STitle": "___STitle_wwtaj_gg_",
43
+ "_color": "__color_wwtaj_gg_",
44
+ "--color": "--color_wwtaj",
45
+ "__SClose": "___SClose_wwtaj_gg_"
46
46
  });
47
47
  var ModalRoot = /*#__PURE__*/function (_Component) {
48
48
  (0, _inherits2["default"])(ModalRoot, _Component);
@@ -23,14 +23,14 @@ import usePreventScroll from 'intergalactic/utils/lib/use/usePreventScroll';
23
23
  import { isAdvanceMode } from 'intergalactic/utils/lib/findComponent';
24
24
  import keyboardFocusEnhance from 'intergalactic/utils/lib/enhances/keyboardFocusEnhance';
25
25
  /*__reshadow-styles__:"./style/modal.shadow.css"*/
26
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SWindow_1vjjl_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, 12px);background:var(--intergalactic-bg-primary-neutral, #ffffff);box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 3px 8px 0px rgba(25, 27, 35, 0.2));color:var(--intergalactic-text-primary, #191b23)}.___SWindow_1vjjl_gg_:focus{outline:0}.___SWindow_1vjjl_gg_ .___STitle_1vjjl_gg_{color:var(--intergalactic-text-primary, #191b23);font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_1vjjl_gg_ .___STitle_1vjjl_gg_.__color_1vjjl_gg_{color:var(--color_1vjjl)}.___SWindow_1vjjl_gg_ .___SClose_1vjjl_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_1vjjl_gg_ .___SClose_1vjjl_gg_.__ghost_1vjjl_gg_{right:0;top:0}.___SWindow_1vjjl_gg_.__ghost_1vjjl_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlay_1vjjl_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:var(--intergalactic-spacing-10x, 40px);background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));overflow:auto;-webkit-overflow-scrolling:touch}.___SOverlay_1vjjl_gg_ .___SOverlay_1vjjl_gg_{background:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}@media (max-width:767px){.___SWindow_1vjjl_gg_{min-width:60%}.___SOverlay_1vjjl_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}" /*__inner_css_end__*/, "1vjjl_gg_") /*__reshadow_css_end__*/, {
27
- "__SWindow": "___SWindow_1vjjl_gg_",
28
- "_ghost": "__ghost_1vjjl_gg_",
29
- "__SOverlay": "___SOverlay_1vjjl_gg_",
30
- "__STitle": "___STitle_1vjjl_gg_",
31
- "_color": "__color_1vjjl_gg_",
32
- "--color": "--color_1vjjl",
33
- "__SClose": "___SClose_1vjjl_gg_"
26
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SWindow_wwtaj_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, 12px);background:var(--intergalactic-bg-primary-neutral, #ffffff);box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 3px 8px 0px rgba(25, 27, 35, 0.2));color:var(--intergalactic-text-primary, #191b23)}.___SWindow_wwtaj_gg_:focus{outline:0}.___SWindow_wwtaj_gg_ .___STitle_wwtaj_gg_{color:var(--intergalactic-text-primary, #191b23);font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_wwtaj_gg_ .___STitle_wwtaj_gg_.__color_wwtaj_gg_{color:var(--color_wwtaj)}.___SWindow_wwtaj_gg_ .___SClose_wwtaj_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_wwtaj_gg_ .___SClose_wwtaj_gg_.__ghost_wwtaj_gg_{right:0;top:0}.___SWindow_wwtaj_gg_.__ghost_wwtaj_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlay_wwtaj_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:var(--intergalactic-spacing-10x, 40px);background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));overflow:auto;-webkit-overflow-scrolling:touch}.___SOverlay_wwtaj_gg_ .___SOverlay_wwtaj_gg_{background:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}@media (max-width:767px){.___SWindow_wwtaj_gg_{min-width:60%}.___SOverlay_wwtaj_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}" /*__inner_css_end__*/, "wwtaj_gg_") /*__reshadow_css_end__*/, {
27
+ "__SWindow": "___SWindow_wwtaj_gg_",
28
+ "_ghost": "__ghost_wwtaj_gg_",
29
+ "__SOverlay": "___SOverlay_wwtaj_gg_",
30
+ "__STitle": "___STitle_wwtaj_gg_",
31
+ "_color": "__color_wwtaj_gg_",
32
+ "--color": "--color_wwtaj",
33
+ "__SClose": "___SClose_wwtaj_gg_"
34
34
  });
35
35
  import { localizedMessages } from './translations/__intergalactic-dynamic-locales';
36
36
  import i18nEnhance from 'intergalactic/utils/lib/enhances/i18nEnhance';
@@ -2,18 +2,18 @@ import f from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import S from "@babel/runtime/helpers/esm/classCallCheck";
3
3
  import P from "@babel/runtime/helpers/esm/createClass";
4
4
  import g from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import w from "@babel/runtime/helpers/esm/inherits";
6
- import k from "@babel/runtime/helpers/esm/createSuper";
5
+ import k from "@babel/runtime/helpers/esm/inherits";
6
+ import j from "@babel/runtime/helpers/esm/createSuper";
7
7
  import d from "@babel/runtime/helpers/esm/defineProperty";
8
8
  import { sstyled as T } from 'intergalactic/utils/lib/core/index';
9
- import E, { assignProps as m, Component as O, sstyled as p } from 'intergalactic/core';
10
- import n from "react";
9
+ import E, { assignProps as u, Component as O, sstyled as w } from 'intergalactic/core';
10
+ import l from "react";
11
11
  import { Slide as I, FadeInOut as W } from 'intergalactic/animation';
12
12
  import z, { PortalProvider as M } from 'intergalactic/portal';
13
13
  import C from 'intergalactic/button';
14
14
  import D from 'intergalactic/outside-click';
15
15
  import R from 'intergalactic/icon/Close/l';
16
- import j from 'intergalactic/utils/lib/fire';
16
+ import h from 'intergalactic/utils/lib/fire';
17
17
  import A from 'intergalactic/utils/lib/use/usePreventScroll';
18
18
  import { isAdvanceMode as $ } from 'intergalactic/utils/lib/findComponent';
19
19
  import H from 'intergalactic/utils/lib/enhances/keyboardFocusEnhance';
@@ -30,41 +30,41 @@ var J = (
30
30
  /*__reshadow_css_start__*/
31
31
  (T.insert(
32
32
  /*__inner_css_start__*/
33
- ".___SWindow_1vjjl_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, 12px);background:var(--intergalactic-bg-primary-neutral, #ffffff);box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 3px 8px 0px rgba(25, 27, 35, 0.2));color:var(--intergalactic-text-primary, #191b23)}.___SWindow_1vjjl_gg_:focus{outline:0}.___SWindow_1vjjl_gg_ .___STitle_1vjjl_gg_{color:var(--intergalactic-text-primary, #191b23);font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_1vjjl_gg_ .___STitle_1vjjl_gg_.__color_1vjjl_gg_{color:var(--color_1vjjl)}.___SWindow_1vjjl_gg_ .___SClose_1vjjl_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_1vjjl_gg_ .___SClose_1vjjl_gg_.__ghost_1vjjl_gg_{right:0;top:0}.___SWindow_1vjjl_gg_.__ghost_1vjjl_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlay_1vjjl_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:var(--intergalactic-spacing-10x, 40px);background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));overflow:auto;-webkit-overflow-scrolling:touch}.___SOverlay_1vjjl_gg_ .___SOverlay_1vjjl_gg_{background:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}@media (max-width:767px){.___SWindow_1vjjl_gg_{min-width:60%}.___SOverlay_1vjjl_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}",
34
- "1vjjl_gg_"
33
+ ".___SWindow_wwtaj_gg_{position:relative;border-radius:var(--intergalactic-modal-rounded, 12px);background:var(--intergalactic-bg-primary-neutral, #ffffff);box-sizing:border-box;margin:auto;padding:var(--intergalactic-spacing-10x, 40px);box-shadow:var(--intergalactic-box-shadow-modal, 0px 3px 8px 0px rgba(25, 27, 35, 0.2));color:var(--intergalactic-text-primary, #191b23)}.___SWindow_wwtaj_gg_:focus{outline:0}.___SWindow_wwtaj_gg_ .___STitle_wwtaj_gg_{color:var(--intergalactic-text-primary, #191b23);font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%);font-weight:var(--intergalactic-semi-bold, 600);margin-bottom:var(--intergalactic-spacing-2x, 8px);margin-right:var(--intergalactic-spacing-4x, 16px)}.___SWindow_wwtaj_gg_ .___STitle_wwtaj_gg_.__color_wwtaj_gg_{color:var(--color_wwtaj)}.___SWindow_wwtaj_gg_ .___SClose_wwtaj_gg_{display:inline-flex;position:absolute;right:var(--intergalactic-spacing-2x, 8px);top:var(--intergalactic-spacing-2x, 8px)}.___SWindow_wwtaj_gg_ .___SClose_wwtaj_gg_.__ghost_wwtaj_gg_{right:0;top:0}.___SWindow_wwtaj_gg_.__ghost_wwtaj_gg_{background:0 0;padding:0;box-shadow:none}.___SOverlay_wwtaj_gg_{position:fixed;top:0;bottom:0;left:0;right:0;margin:0;display:flex;justify-content:center;align-items:center;padding:var(--intergalactic-spacing-10x, 40px);background:var(--intergalactic-overlay-primary, rgba(25, 27, 35, 0.7));overflow:auto;-webkit-overflow-scrolling:touch}.___SOverlay_wwtaj_gg_ .___SOverlay_wwtaj_gg_{background:var(--intergalactic-overlay-secondary, rgba(25, 27, 35, 0.4))}@media (max-width:767px){.___SWindow_wwtaj_gg_{min-width:60%}.___SOverlay_wwtaj_gg_{padding:var(--intergalactic-spacing-3x, 12px)}}",
34
+ "wwtaj_gg_"
35
35
  ), {
36
- __SWindow: "___SWindow_1vjjl_gg_",
37
- _ghost: "__ghost_1vjjl_gg_",
38
- __SOverlay: "___SOverlay_1vjjl_gg_",
39
- __STitle: "___STitle_1vjjl_gg_",
40
- _color: "__color_1vjjl_gg_",
41
- "--color": "--color_1vjjl",
42
- __SClose: "___SClose_1vjjl_gg_"
36
+ __SWindow: "___SWindow_wwtaj_gg_",
37
+ _ghost: "__ghost_wwtaj_gg_",
38
+ __SOverlay: "___SOverlay_wwtaj_gg_",
39
+ __STitle: "___STitle_wwtaj_gg_",
40
+ _color: "__color_wwtaj_gg_",
41
+ "--color": "--color_wwtaj",
42
+ __SClose: "___SClose_wwtaj_gg_"
43
43
  })
44
- ), u = /* @__PURE__ */ function(i) {
45
- w(r, i);
46
- var c = k(r);
47
- function r() {
48
- var l;
49
- S(this, r);
50
- for (var e = arguments.length, a = new Array(e), t = 0; t < e; t++)
51
- a[t] = arguments[t];
52
- return l = c.call.apply(c, [this].concat(a)), d(g(l), "state", {
44
+ ), v = /* @__PURE__ */ function(r) {
45
+ k(a, r);
46
+ var c = j(a);
47
+ function a() {
48
+ var n;
49
+ S(this, a);
50
+ for (var e = arguments.length, i = new Array(e), t = 0; t < e; t++)
51
+ i[t] = arguments[t];
52
+ return n = c.call.apply(c, [this].concat(i)), d(g(n), "state", {
53
53
  hasTitle: !1
54
- }), d(g(l), "handleKeyDown", function(o) {
55
- o.key === "Escape" && (o.stopPropagation(), j(g(l), "onClose", "onEscape", o));
56
- }), d(g(l), "handleIconCloseClick", function(o) {
57
- j(g(l), "onClose", "onCloseClick", o);
58
- }), d(g(l), "handleOutsideClick", function(o) {
59
- j(g(l), "onClose", "onOutsideClick", o);
60
- }), l;
54
+ }), d(g(n), "handleKeyDown", function(o) {
55
+ o.key === "Escape" && (o.stopPropagation(), h(g(n), "onClose", "onEscape", o));
56
+ }), d(g(n), "handleIconCloseClick", function(o) {
57
+ h(g(n), "onClose", "onCloseClick", o);
58
+ }), d(g(n), "handleOutsideClick", function(o) {
59
+ h(g(n), "onClose", "onOutsideClick", o);
60
+ }), n;
61
61
  }
62
- return P(r, [{
62
+ return P(a, [{
63
63
  key: "getOverlayProps",
64
64
  value: function() {
65
- var e = this.asProps, a = e.duration, t = e.visible, o = e.animationsDisabled, s = e.disablePreventScroll;
65
+ var e = this.asProps, i = e.duration, t = e.visible, o = e.animationsDisabled, s = e.disablePreventScroll;
66
66
  return {
67
- duration: a,
67
+ duration: i,
68
68
  visible: t,
69
69
  onOutsideClick: this.handleOutsideClick,
70
70
  animationsDisabled: o,
@@ -74,68 +74,68 @@ var J = (
74
74
  }, {
75
75
  key: "getWindowProps",
76
76
  value: function() {
77
- var e = this.asProps, a = e.visible, t = e.closable, o = e.getI18nText, s = e.uid, _ = e.duration, h = e.animationsDisabled, b = this.state.hasTitle;
77
+ var e = this.asProps, i = e.visible, t = e.closable, o = e.getI18nText, s = e.uid, _ = e.duration, p = e.animationsDisabled, b = this.state.hasTitle;
78
78
  return {
79
- visible: a,
79
+ visible: i,
80
80
  closable: t,
81
81
  onKeyDown: this.handleKeyDown,
82
82
  "aria-label": b ? void 0 : o("title"),
83
83
  "aria-labelledby": b ? "igc-".concat(s, "-title") : void 0,
84
84
  duration: _,
85
- animationsDisabled: h
85
+ animationsDisabled: p
86
86
  };
87
87
  }
88
88
  }, {
89
89
  key: "getCloseProps",
90
90
  value: function() {
91
- var e = this.asProps, a = e.getI18nText, t = e.ghost;
91
+ var e = this.asProps, i = e.getI18nText, t = e.ghost;
92
92
  return {
93
93
  onClick: this.handleIconCloseClick,
94
- getI18nText: a,
94
+ getI18nText: i,
95
95
  ghost: t
96
96
  };
97
97
  }
98
98
  }, {
99
99
  key: "getTitleProps",
100
100
  value: function() {
101
- var e = this, a = this.asProps.uid, t = function() {
101
+ var e = this, i = this.asProps.uid, t = function() {
102
102
  return e.setState({
103
103
  hasTitle: !0
104
104
  });
105
105
  };
106
106
  return {
107
- id: "igc-".concat(a, "-title"),
107
+ id: "igc-".concat(i, "-title"),
108
108
  setHasTitle: t
109
109
  };
110
110
  }
111
111
  }, {
112
112
  key: "render",
113
113
  value: function() {
114
- var e = this.asProps, a = this.asProps, t = a.Children, o = a.disablePortal, s = a.forcedAdvancedMode, _ = a.ignorePortalsStacking, h = s || $(t, [v.Overlay.displayName, v.Window.displayName]);
115
- return /* @__PURE__ */ n.createElement(z, {
114
+ var e = this.asProps, i = this.asProps, t = i.Children, o = i.disablePortal, s = i.forcedAdvancedMode, _ = i.ignorePortalsStacking, p = s || $(t, [m.Overlay.displayName, m.Window.displayName]);
115
+ return /* @__PURE__ */ l.createElement(z, {
116
116
  disablePortal: o,
117
117
  ignorePortalsStacking: _
118
- }, h ? /* @__PURE__ */ n.createElement(t, null) : /* @__PURE__ */ n.createElement(v.Overlay, null, /* @__PURE__ */ n.createElement(v.Window, m({}, e))));
118
+ }, p ? /* @__PURE__ */ l.createElement(t, null) : /* @__PURE__ */ l.createElement(m.Overlay, null, /* @__PURE__ */ l.createElement(m.Window, u({}, e))));
119
119
  }
120
- }]), r;
120
+ }]), a;
121
121
  }(O);
122
- d(u, "displayName", "Modal");
123
- d(u, "style", J);
124
- d(u, "enhance", [N(x), K(), Z({
122
+ d(v, "displayName", "Modal");
123
+ d(v, "style", J);
124
+ d(v, "enhance", [N(x), K(), Z({
125
125
  variable: "--intergalactic-duration-modal",
126
126
  fallback: "200",
127
127
  map: Number.parseInt,
128
128
  prop: "duration"
129
129
  })]);
130
- d(u, "defaultProps", {
130
+ d(v, "defaultProps", {
131
131
  closable: !0,
132
132
  i18n: x,
133
133
  locale: "en",
134
134
  disablePreventScroll: !1
135
135
  });
136
- function Q(i) {
137
- var c = arguments[0], r, l = I, e = i.Children, a = i.styles, t = i.visible, o = i.closable, s = i.duration, _ = n.useRef(null);
138
- return q(_, !0, "auto", !t, !0), r = p(a), /* @__PURE__ */ n.createElement(l, r.cn("SWindow", f({}, m({
136
+ function Q(r) {
137
+ var c = arguments[0], a, n = I, e = r.Children, i = r.styles, t = r.visible, o = r.closable, s = r.duration, _ = l.useRef(null);
138
+ return q(_, !0, "auto", !t, !0), a = w(i), /* @__PURE__ */ l.createElement(n, a.cn("SWindow", f({}, u({
139
139
  initialAnimation: !0,
140
140
  slideOrigin: "top",
141
141
  visible: t,
@@ -143,54 +143,54 @@ function Q(i) {
143
143
  "aria-modal": !0,
144
144
  duration: s,
145
145
  ref: _
146
- }, c))), /* @__PURE__ */ n.createElement(V, r.cn("ZIndexStackingContextProvider", {
146
+ }, c))), /* @__PURE__ */ l.createElement(V, a.cn("ZIndexStackingContextProvider", {
147
147
  designToken: "z-index-modal"
148
- }), /* @__PURE__ */ n.createElement(M, r.cn("PortalProvider", {
148
+ }), /* @__PURE__ */ l.createElement(M, a.cn("PortalProvider", {
149
149
  value: _
150
- }), o && /* @__PURE__ */ n.createElement(v.Close, null), /* @__PURE__ */ n.createElement(e, r.cn("Children", {})))));
150
+ }), o && /* @__PURE__ */ l.createElement(m.Close, null), /* @__PURE__ */ l.createElement(e, a.cn("Children", {})))));
151
151
  }
152
- function U(i) {
153
- var c = arguments[0], r, l = W, e = i.Children, a = i.styles, t = i.onOutsideClick, o = i.visible, s = n.useRef(null);
154
- A(o, i.disablePreventScroll), B(s, o);
152
+ function U(r) {
153
+ var c = arguments[0], a, n = W, e = r.Children, i = r.styles, t = r.onOutsideClick, o = r.visible, s = l.useRef(null);
154
+ A(o, r.disablePreventScroll), B(s, o);
155
155
  var _ = G("z-index-modal");
156
- return r = p(a), /* @__PURE__ */ n.createElement(l, r.cn("SOverlay", f({}, m({
156
+ return a = w(i), /* @__PURE__ */ l.createElement(n, a.cn("SOverlay", f({}, u({
157
157
  ref: s,
158
158
  zIndex: _
159
- }, c))), /* @__PURE__ */ n.createElement(D, r.cn("OutsideClick", {
159
+ }, c))), /* @__PURE__ */ l.createElement(D, a.cn("OutsideClick", {
160
160
  root: s,
161
161
  onOutsideClick: t
162
- }), /* @__PURE__ */ n.createElement(e, r.cn("Children", {}))));
162
+ }), /* @__PURE__ */ l.createElement(e, a.cn("Children", {}))));
163
163
  }
164
- function y(i) {
165
- var c = arguments[0], r, l = C, e = i.Children, a = i.children, t = i.getI18nText, o = i.ghost;
166
- return r = p(i.styles), /* @__PURE__ */ n.createElement(l, r.cn("SClose", f({}, m({
164
+ function y(r) {
165
+ var c = arguments[0], a, n = C, e = r.Children, i = r.children, t = r.getI18nText, o = r.ghost;
166
+ return a = w(r.styles), /* @__PURE__ */ l.createElement(n, a.cn("SClose", f({}, u({
167
167
  use: "tertiary",
168
168
  size: "l",
169
169
  theme: o ? "invert" : "muted",
170
170
  "aria-label": t("close")
171
- }, c))), a ? /* @__PURE__ */ n.createElement(e, r.cn("Children", {})) : /* @__PURE__ */ n.createElement(C.Addon, {
171
+ }, c))), i ? /* @__PURE__ */ l.createElement(e, a.cn("Children", {})) : /* @__PURE__ */ l.createElement(C.Addon, {
172
172
  ml: "7px",
173
173
  mr: "7px"
174
- }, /* @__PURE__ */ n.createElement(R, r.cn("CloseIcon", {
174
+ }, /* @__PURE__ */ l.createElement(R, a.cn("CloseIcon", {
175
175
  title: t("close")
176
176
  }))));
177
177
  }
178
178
  y.enhance = [H()];
179
- function X(i) {
180
- var c = arguments[0], r, l = i.setHasTitle, e = i.styles, a = i.color, t = F, o = L();
181
- return n.useEffect(function() {
182
- return l();
183
- }), r = p(e), /* @__PURE__ */ n.createElement(t, r.cn("STitle", f({}, m({
179
+ function X(r) {
180
+ var c = arguments[0], a, n = r.setHasTitle, e = r.styles, i = r.color, t = F, o = L();
181
+ return l.useEffect(function() {
182
+ return n();
183
+ }), a = w(e), /* @__PURE__ */ l.createElement(t, a.cn("STitle", f({}, u({
184
184
  tag: "h2",
185
- "use:color": o(a)
185
+ "use:color": o(i)
186
186
  }, c))));
187
187
  }
188
- var v = E(u, {
188
+ var m = E(v, {
189
189
  Window: Q,
190
190
  Overlay: U,
191
191
  Close: y,
192
192
  Title: X
193
193
  });
194
194
  export {
195
- v as default
195
+ m as default
196
196
  };
@@ -1 +1 @@
1
- {"name":"intergalactic/modal","description":"Semrush Modal Component","version":"4.55.0-prerelease.2","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/button":"5.43.0-prerelease.2","@semcore/animation":"2.41.1","@semcore/flex-box":"5.41.1","@semcore/icon":"4.60.1","@semcore/outside-click":"3.39.1","@semcore/portal":"3.41.1","@semcore/typography":"5.52.1","@semcore/utils":"4.48.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/modal"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
1
+ {"name":"intergalactic/modal","description":"Semrush Modal Component","version":"4.56.0-prerelease.0","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/button":"5.43.0","@semcore/animation":"2.41.1","@semcore/flex-box":"5.41.1","@semcore/icon":"4.60.1","@semcore/outside-click":"3.40.0-prerelease.0","@semcore/portal":"3.41.1","@semcore/typography":"5.52.1","@semcore/utils":"4.48.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/modal"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
@@ -1 +1 @@
1
- {"name":"intergalactic/notice","description":"Semrush Notice Component","version":"5.46.0-prerelease.2","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/animation":"2.41.1","@semcore/utils":"4.48.1","@semcore/button":"5.43.0-prerelease.2","@semcore/flex-box":"5.41.1","@semcore/icon":"4.60.1","@semcore/notice-global":"2.61.0-prerelease.2","@semcore/typography":"5.52.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/notice"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
1
+ {"name":"intergalactic/notice","description":"Semrush Notice Component","version":"5.46.0","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","sideEffects":false,"author":"UI-kit team <ui-kit-team@semrush.com>","license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/animation":"2.41.1","@semcore/utils":"4.48.1","@semcore/button":"5.43.0","@semcore/flex-box":"5.41.1","@semcore/icon":"4.60.1","@semcore/notice-global":"2.61.0","@semcore/typography":"5.52.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/notice"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
@@ -1 +1 @@
1
- {"name":"intergalactic/notice-bubble","description":"Semrush NoticeBubble Component","version":"5.53.0-prerelease.2","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","author":"UI-kit team <ui-kit-team@semrush.com>","sideEffects":false,"license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/button":"5.43.0-prerelease.2","@semcore/utils":"4.48.1","@semcore/icon":"4.60.1","@semcore/portal":"3.41.1","@semcore/flex-box":"5.41.1","@semcore/animation":"2.41.1","@semcore/tooltip":"6.49.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/notice-bubble"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
1
+ {"name":"intergalactic/notice-bubble","description":"Semrush NoticeBubble Component","version":"5.53.0","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","author":"UI-kit team <ui-kit-team@semrush.com>","sideEffects":false,"license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/button":"5.43.0","@semcore/utils":"4.48.1","@semcore/icon":"4.60.1","@semcore/portal":"3.41.1","@semcore/flex-box":"5.41.1","@semcore/animation":"2.41.1","@semcore/tooltip":"6.49.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/notice-bubble"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
@@ -1 +1 @@
1
- {"name":"intergalactic/notice-global","description":"Semrush NoticeGlobal Component","version":"2.61.0-prerelease.2","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","author":"UI-kit team <ui-kit-team@semrush.com>","sideEffects":false,"license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/button":"5.43.0-prerelease.2","@semcore/utils":"4.48.1","@semcore/icon":"4.60.1","@semcore/flex-box":"5.41.1","@semcore/animation":"2.41.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/notice-global"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
1
+ {"name":"intergalactic/notice-global","description":"Semrush NoticeGlobal Component","version":"2.61.0","main":"lib/cjs/index.js","module":"lib/es6/index.js","typings":"lib/types/index.d.ts","author":"UI-kit team <ui-kit-team@semrush.com>","sideEffects":false,"license":"MIT","scripts":{"build":"pnpm semcore-builder --source=js && pnpm vite build"},"exports":{"require":"./lib/cjs/index.js","import":"./lib/esm/index.mjs","types":"./lib/types/index.d.ts"},"dependencies":{"@semcore/button":"5.43.0","@semcore/utils":"4.48.1","@semcore/icon":"4.60.1","@semcore/flex-box":"5.41.1","@semcore/animation":"2.41.1"},"peerDependencies":{"@semcore/core":"^2.17.5","react":"16.8 - 18","react-dom":"16.8 - 18"},"repository":{"type":"git","url":"https://github.com/semrush/intergalactic.git","directory":"semcore/notice-global"},"devDependencies":{"@types/react":"18.0.21","@semcore/testing-utils":"1.0.0"}}
@@ -26,21 +26,28 @@ function OutsideClick(props) {
26
26
  onOutsideClick = _props$onOutsideClick === void 0 ? noop : _props$onOutsideClick;
27
27
  var children = (0, _getOriginChildren["default"])(Children);
28
28
  var nodeRef = _react["default"].useRef(null);
29
- var targetRef = _react["default"].useRef(null);
29
+ var mouseDownInside = _react["default"].useRef(false);
30
30
  var handleRef = (0, _ref5.useForkRef)(children ? children.ref : null, nodeRef, forwardRef);
31
31
  var handleOutsideClick = (0, _useEventCallback["default"])(function (event) {
32
- var isTargetEvent = [].concat((0, _toConsumableArray2["default"])(excludeRefs), [nodeRef]).filter(function (node) {
33
- return (0, _ref5.getNodeByRef)(node);
34
- }).some(function (node) {
35
- var _getNodeByRef;
36
- return (_getNodeByRef = (0, _ref5.getNodeByRef)(node)) === null || _getNodeByRef === void 0 ? void 0 : _getNodeByRef.contains(targetRef.current || (0, _getEventTarget.getEventTarget)(event));
32
+ var nodesToCheck = [].concat((0, _toConsumableArray2["default"])(excludeRefs), [nodeRef]).map(function (ref) {
33
+ return (0, _ref5.getNodeByRef)(ref);
34
+ });
35
+ var eventTarget = (0, _getEventTarget.getEventTarget)(event);
36
+ var isTargetEvent = nodesToCheck.some(function (node) {
37
+ return mouseDownInside.current || (node === null || node === void 0 ? void 0 : node.contains(eventTarget));
37
38
  });
38
39
  if (!isTargetEvent) {
39
40
  onOutsideClick === null || onOutsideClick === void 0 ? void 0 : onOutsideClick(event);
40
41
  }
41
42
  });
42
43
  var handleMouseDown = (0, _useEventCallback["default"])(function (event) {
43
- targetRef.current = (0, _getEventTarget.getEventTarget)(event);
44
+ var nodesToCheck = [].concat((0, _toConsumableArray2["default"])(excludeRefs), [nodeRef]).map(function (ref) {
45
+ return (0, _ref5.getNodeByRef)(ref);
46
+ });
47
+ var eventTarget = (0, _getEventTarget.getEventTarget)(event);
48
+ mouseDownInside.current = nodesToCheck.some(function (node) {
49
+ return node === null || node === void 0 ? void 0 : node.contains(eventTarget);
50
+ });
44
51
  });
45
52
  var toggleEvents = function toggleEvents(status, outsideRoot) {
46
53
  var isModalRoot = outsideRoot instanceof HTMLElement && outsideRoot.dataset.uiName === 'Modal.Overlay';
@@ -1 +1 @@
1
- {"version":3,"file":"OutsideClick.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","_ref5","_ownerDocument","_useEventCallback","_getOriginChildren","_getEventTarget","noop","OutsideClick","props","Children","forwardRef","root","_props$excludeRefs","excludeRefs","_props$onOutsideClick","onOutsideClick","children","getOriginChildren","nodeRef","React","useRef","targetRef","handleRef","useForkRef","ref","handleOutsideClick","useEventCallback","event","isTargetEvent","concat","_toConsumableArray2","filter","node","getNodeByRef","some","_getNodeByRef","contains","current","getEventTarget","handleMouseDown","toggleEvents","status","outsideRoot","isModalRoot","HTMLElement","dataset","uiName","eventsMap","forEach","_ref","_ref2","_slicedToArray2","rootElement","events","Object","entries","_ref3","_ref4","eventName","handler","method","useEffect","ownerDocument","addEventListener","push","mouseup","mousedown","pop","removeEventListener","cloneElement","displayName","_default","createComponent","exports"],"sources":["../../src/OutsideClick.tsx"],"sourcesContent":["import React, { cloneElement, useEffect } from 'react';\nimport createComponent, { IFunctionProps, Intergalactic, UnknownProperties } from '@semcore/core';\nimport { getNodeByRef, NodeByRef, useForkRef } from '@semcore/utils/lib/ref';\nimport ownerDocument from '@semcore/utils/lib/ownerDocument';\nimport useEventCallback from '@semcore/utils/lib/use/useEventCallback';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport { getEventTarget } from '@semcore/utils/lib/getEventTarget';\n\n/** @deprecated */\nexport interface IOutsideClickProps extends OutsideClickProps, UnknownProperties {}\nexport type OutsideClickProps = {\n /**\n * Function called on click outside the component from excludeRefs\n * @default () => {}\n */\n onOutsideClick?: (e?: React.SyntheticEvent) => void;\n\n /**\n * List of refs that will not trigger `onOutsideClick` when clicked\n * @default []\n */\n excludeRefs?: Array<NodeByRef>;\n\n /** Root element\n * @default document\n * */\n root?: NodeByRef;\n};\n\ntype OutsideClickEvents = { [key in 'mouseup' | 'mousedown']: EventListenerOrEventListenerObject };\ntype RootEventsPair = [Element | Document, OutsideClickEvents];\n\nconst noop = () => {};\nfunction OutsideClick(props: IFunctionProps<IOutsideClickProps>) {\n const { Children, forwardRef, root, excludeRefs = [], onOutsideClick = noop } = props;\n const children = getOriginChildren(Children);\n const nodeRef = React.useRef<Node | null>(null);\n const targetRef = React.useRef<Node | null>(null);\n\n const handleRef = useForkRef(children ? children.ref : null, nodeRef, forwardRef!);\n\n const handleOutsideClick = useEventCallback((event: any) => {\n const isTargetEvent = [...(excludeRefs as any), nodeRef]\n .filter((node) => getNodeByRef(node))\n .some((node) =>\n getNodeByRef(node)?.contains(targetRef.current || (getEventTarget(event) as Node | null)),\n );\n\n if (!isTargetEvent) {\n onOutsideClick?.(event);\n }\n });\n\n const handleMouseDown = useEventCallback((event: any) => {\n targetRef.current = getEventTarget(event) as Node | null;\n });\n\n const toggleEvents = (status: boolean, outsideRoot: Element | Document | null) => {\n const isModalRoot =\n outsideRoot instanceof HTMLElement && outsideRoot.dataset.uiName === 'Modal.Overlay';\n if (!isModalRoot) {\n return;\n }\n\n OutsideClick.eventsMap.forEach(([rootElement, events]) => {\n Object.entries(events).forEach(([eventName, handler]) => {\n const method = status ? 'addEventListener' : 'removeEventListener';\n rootElement[method](eventName, handler, true);\n });\n });\n };\n\n React.useEffect(() => {\n const outsideRoot = root ? getNodeByRef(root) : ownerDocument(nodeRef.current as any);\n\n // disable previous events\n toggleEvents(false, outsideRoot);\n\n // Using capture to handle event faster than OutsideClick handler\n outsideRoot?.addEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.addEventListener('mousedown', handleMouseDown, true);\n\n if (outsideRoot) {\n OutsideClick.eventsMap.push([\n outsideRoot,\n {\n mouseup: handleOutsideClick,\n mousedown: handleMouseDown,\n },\n ]);\n }\n\n return () => {\n if (outsideRoot) {\n OutsideClick.eventsMap.pop();\n }\n\n outsideRoot?.removeEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.removeEventListener('mousedown', handleMouseDown, true);\n\n // enabled previous events\n toggleEvents(true, outsideRoot);\n };\n }, [root]);\n\n return children ? cloneElement(children, { ref: handleRef }) : null;\n}\n\nOutsideClick.displayName = 'OutsideClick';\nOutsideClick.eventsMap = [] as RootEventsPair[];\n\nexport default createComponent(OutsideClick) as Intergalactic.Component<\n Intergalactic.Tag,\n OutsideClickProps\n>;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AA0BA,IAAMQ,IAAI,GAAG,SAAPA,IAAIA,CAAA,EAAS,CAAC,CAAC;AACrB,SAASC,YAAYA,CAACC,KAAyC,EAAE;EAC/D,IAAQC,QAAQ,GAAgED,KAAK,CAA7EC,QAAQ;IAAEC,UAAU,GAAoDF,KAAK,CAAnEE,UAAU;IAAEC,IAAI,GAA8CH,KAAK,CAAvDG,IAAI;IAAAC,kBAAA,GAA8CJ,KAAK,CAAjDK,WAAW;IAAXA,WAAW,GAAAD,kBAAA,cAAG,EAAE,GAAAA,kBAAA;IAAAE,qBAAA,GAA4BN,KAAK,CAA/BO,cAAc;IAAdA,cAAc,GAAAD,qBAAA,cAAGR,IAAI,GAAAQ,qBAAA;EAC3E,IAAME,QAAQ,GAAG,IAAAC,6BAAiB,EAACR,QAAQ,CAAC;EAC5C,IAAMS,OAAO,GAAGC,iBAAK,CAACC,MAAM,CAAc,IAAI,CAAC;EAC/C,IAAMC,SAAS,GAAGF,iBAAK,CAACC,MAAM,CAAc,IAAI,CAAC;EAE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mBAAmB,CAAC,WAAW,EAAE7B,eAAe,EAAE,IAAI,CAAC;;MAEpE;MACAC,YAAY,CAAC,IAAI,EAAEE,WAAW,CAAC;IACjC,CAAC;EACH,CAAC,EAAE,CAAC/B,IAAI,CAAC,CAAC;EAEV,OAAOK,QAAQ,gBAAG,IAAAqD,mBAAY,EAACrD,QAAQ,EAAE;IAAEQ,GAAG,EAAEF;EAAU,CAAC,CAAC,GAAG,IAAI;AACrE;AAEAf,YAAY,CAAC+D,WAAW,GAAG,cAAc;AACzC/D,YAAY,CAACwC,SAAS,GAAG,EAAsB;AAAC,IAAAwB,QAAA,GAEjC,IAAAC,gBAAe,EAACjE,YAAY,CAAC;AAAAkE,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"OutsideClick.js","names":["_react","_interopRequireWildcard","require","_core","_interopRequireDefault","_ref5","_ownerDocument","_useEventCallback","_getOriginChildren","_getEventTarget","noop","OutsideClick","props","Children","forwardRef","root","_props$excludeRefs","excludeRefs","_props$onOutsideClick","onOutsideClick","children","getOriginChildren","nodeRef","React","useRef","mouseDownInside","handleRef","useForkRef","ref","handleOutsideClick","useEventCallback","event","nodesToCheck","concat","_toConsumableArray2","map","getNodeByRef","eventTarget","getEventTarget","isTargetEvent","some","node","current","contains","handleMouseDown","toggleEvents","status","outsideRoot","isModalRoot","HTMLElement","dataset","uiName","eventsMap","forEach","_ref","_ref2","_slicedToArray2","rootElement","events","Object","entries","_ref3","_ref4","eventName","handler","method","useEffect","ownerDocument","addEventListener","push","mouseup","mousedown","pop","removeEventListener","cloneElement","displayName","_default","createComponent","exports"],"sources":["../../src/OutsideClick.tsx"],"sourcesContent":["import React, { cloneElement, useEffect } from 'react';\nimport createComponent, { IFunctionProps, Intergalactic, UnknownProperties } from '@semcore/core';\nimport { getNodeByRef, NodeByRef, useForkRef } from '@semcore/utils/lib/ref';\nimport ownerDocument from '@semcore/utils/lib/ownerDocument';\nimport useEventCallback from '@semcore/utils/lib/use/useEventCallback';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport { getEventTarget } from '@semcore/utils/lib/getEventTarget';\n\n/** @deprecated */\nexport interface IOutsideClickProps extends OutsideClickProps, UnknownProperties {}\nexport type OutsideClickProps = {\n /**\n * Function called on click outside the component from excludeRefs\n * @default () => {}\n */\n onOutsideClick?: (e?: React.SyntheticEvent) => void;\n\n /**\n * List of refs that will not trigger `onOutsideClick` when clicked\n * @default []\n */\n excludeRefs?: Array<NodeByRef>;\n\n /** Root element\n * @default document\n * */\n root?: NodeByRef;\n};\n\ntype OutsideClickEvents = { [key in 'mouseup' | 'mousedown']: EventListenerOrEventListenerObject };\ntype RootEventsPair = [Element | Document, OutsideClickEvents];\n\nconst noop = () => {};\nfunction OutsideClick(props: IFunctionProps<IOutsideClickProps>) {\n const { Children, forwardRef, root, excludeRefs = [], onOutsideClick = noop } = props;\n const children = getOriginChildren(Children);\n const nodeRef = React.useRef<Node | null>(null);\n const mouseDownInside = React.useRef<boolean>(false);\n\n const handleRef = useForkRef(children ? children.ref : null, nodeRef, forwardRef!);\n\n const handleOutsideClick = useEventCallback((event: any) => {\n const nodesToCheck = [...(excludeRefs as any), nodeRef].map((ref) => getNodeByRef(ref));\n const eventTarget = getEventTarget(event) as Node | null;\n\n const isTargetEvent = nodesToCheck.some(\n (node) => mouseDownInside.current || node?.contains(eventTarget),\n );\n\n if (!isTargetEvent) {\n onOutsideClick?.(event);\n }\n });\n\n const handleMouseDown = useEventCallback((event: any) => {\n const nodesToCheck = [...(excludeRefs as any), nodeRef].map((ref) => getNodeByRef(ref));\n const eventTarget = getEventTarget(event) as Node | null;\n\n mouseDownInside.current = nodesToCheck.some((node) => node?.contains(eventTarget));\n });\n\n const toggleEvents = (status: boolean, outsideRoot: Element | Document | null) => {\n const isModalRoot =\n outsideRoot instanceof HTMLElement && outsideRoot.dataset.uiName === 'Modal.Overlay';\n if (!isModalRoot) {\n return;\n }\n\n OutsideClick.eventsMap.forEach(([rootElement, events]) => {\n Object.entries(events).forEach(([eventName, handler]) => {\n const method = status ? 'addEventListener' : 'removeEventListener';\n rootElement[method](eventName, handler, true);\n });\n });\n };\n\n React.useEffect(() => {\n const outsideRoot = root ? getNodeByRef(root) : ownerDocument(nodeRef.current as any);\n\n // disable previous events\n toggleEvents(false, outsideRoot);\n\n // Using capture to handle event faster than OutsideClick handler\n outsideRoot?.addEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.addEventListener('mousedown', handleMouseDown, true);\n\n if (outsideRoot) {\n OutsideClick.eventsMap.push([\n outsideRoot,\n {\n mouseup: handleOutsideClick,\n mousedown: handleMouseDown,\n },\n ]);\n }\n\n return () => {\n if (outsideRoot) {\n OutsideClick.eventsMap.pop();\n }\n\n outsideRoot?.removeEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.removeEventListener('mousedown', handleMouseDown, true);\n\n // enabled previous events\n toggleEvents(true, outsideRoot);\n };\n }, [root]);\n\n return children ? cloneElement(children, { ref: handleRef }) : null;\n}\n\nOutsideClick.displayName = 'OutsideClick';\nOutsideClick.eventsMap = [] as RootEventsPair[];\n\nexport default createComponent(OutsideClick) as Intergalactic.Component<\n Intergalactic.Tag,\n OutsideClickProps\n>;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,kBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AA0BA,IAAMQ,IAAI,GAAG,SAAPA,IAAIA,CAAA,EAAS,CAAC,CAAC;AACrB,SAASC,YAAYA,CAACC,KAAyC,EAAE;EAC/D,IAAQC,QAAQ,GAAgED,KAAK,CAA7EC,QAAQ;IAAEC,UAAU,GAAoDF,KA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A"}
@@ -21,21 +21,28 @@ function OutsideClick(props) {
21
21
  onOutsideClick = _props$onOutsideClick === void 0 ? noop : _props$onOutsideClick;
22
22
  var children = getOriginChildren(Children);
23
23
  var nodeRef = React.useRef(null);
24
- var targetRef = React.useRef(null);
24
+ var mouseDownInside = React.useRef(false);
25
25
  var handleRef = useForkRef(children ? children.ref : null, nodeRef, forwardRef);
26
26
  var handleOutsideClick = useEventCallback(function (event) {
27
- var isTargetEvent = [].concat(_toConsumableArray(excludeRefs), [nodeRef]).filter(function (node) {
28
- return getNodeByRef(node);
29
- }).some(function (node) {
30
- var _getNodeByRef;
31
- return (_getNodeByRef = getNodeByRef(node)) === null || _getNodeByRef === void 0 ? void 0 : _getNodeByRef.contains(targetRef.current || getEventTarget(event));
27
+ var nodesToCheck = [].concat(_toConsumableArray(excludeRefs), [nodeRef]).map(function (ref) {
28
+ return getNodeByRef(ref);
29
+ });
30
+ var eventTarget = getEventTarget(event);
31
+ var isTargetEvent = nodesToCheck.some(function (node) {
32
+ return mouseDownInside.current || (node === null || node === void 0 ? void 0 : node.contains(eventTarget));
32
33
  });
33
34
  if (!isTargetEvent) {
34
35
  onOutsideClick === null || onOutsideClick === void 0 ? void 0 : onOutsideClick(event);
35
36
  }
36
37
  });
37
38
  var handleMouseDown = useEventCallback(function (event) {
38
- targetRef.current = getEventTarget(event);
39
+ var nodesToCheck = [].concat(_toConsumableArray(excludeRefs), [nodeRef]).map(function (ref) {
40
+ return getNodeByRef(ref);
41
+ });
42
+ var eventTarget = getEventTarget(event);
43
+ mouseDownInside.current = nodesToCheck.some(function (node) {
44
+ return node === null || node === void 0 ? void 0 : node.contains(eventTarget);
45
+ });
39
46
  });
40
47
  var toggleEvents = function toggleEvents(status, outsideRoot) {
41
48
  var isModalRoot = outsideRoot instanceof HTMLElement && outsideRoot.dataset.uiName === 'Modal.Overlay';
@@ -1 +1 @@
1
- {"version":3,"file":"OutsideClick.js","names":["React","cloneElement","createComponent","getNodeByRef","useForkRef","ownerDocument","useEventCallback","getOriginChildren","getEventTarget","noop","OutsideClick","props","Children","forwardRef","root","_props$excludeRefs","excludeRefs","_props$onOutsideClick","onOutsideClick","children","nodeRef","useRef","targetRef","handleRef","ref","handleOutsideClick","event","isTargetEvent","concat","_toConsumableArray","filter","node","some","_getNodeByRef","contains","current","handleMouseDown","toggleEvents","status","outsideRoot","isModalRoot","HTMLElement","dataset","uiName","eventsMap","forEach","_ref","_ref2","_slicedToArray","rootElement","events","Object","entries","_ref3","_ref4","eventName","handler","method","useEffect","addEventListener","push","mouseup","mousedown","pop","removeEventListener","displayName"],"sources":["../../src/OutsideClick.tsx"],"sourcesContent":["import React, { cloneElement, useEffect } from 'react';\nimport createComponent, { IFunctionProps, Intergalactic, UnknownProperties } from '@semcore/core';\nimport { getNodeByRef, NodeByRef, useForkRef } from '@semcore/utils/lib/ref';\nimport ownerDocument from '@semcore/utils/lib/ownerDocument';\nimport useEventCallback from '@semcore/utils/lib/use/useEventCallback';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport { getEventTarget } from '@semcore/utils/lib/getEventTarget';\n\n/** @deprecated */\nexport interface IOutsideClickProps extends OutsideClickProps, UnknownProperties {}\nexport type OutsideClickProps = {\n /**\n * Function called on click outside the component from excludeRefs\n * @default () => {}\n */\n onOutsideClick?: (e?: React.SyntheticEvent) => void;\n\n /**\n * List of refs that will not trigger `onOutsideClick` when clicked\n * @default []\n */\n excludeRefs?: Array<NodeByRef>;\n\n /** Root element\n * @default document\n * */\n root?: NodeByRef;\n};\n\ntype OutsideClickEvents = { [key in 'mouseup' | 'mousedown']: EventListenerOrEventListenerObject };\ntype RootEventsPair = [Element | Document, OutsideClickEvents];\n\nconst noop = () => {};\nfunction OutsideClick(props: IFunctionProps<IOutsideClickProps>) {\n const { Children, forwardRef, root, excludeRefs = [], onOutsideClick = noop } = props;\n const children = getOriginChildren(Children);\n const nodeRef = React.useRef<Node | null>(null);\n const targetRef = React.useRef<Node | null>(null);\n\n const handleRef = useForkRef(children ? children.ref : null, nodeRef, forwardRef!);\n\n const handleOutsideClick = useEventCallback((event: any) => {\n const isTargetEvent = [...(excludeRefs as any), nodeRef]\n .filter((node) => getNodeByRef(node))\n .some((node) =>\n getNodeByRef(node)?.contains(targetRef.current || (getEventTarget(event) as Node | null)),\n );\n\n if (!isTargetEvent) {\n onOutsideClick?.(event);\n }\n });\n\n const handleMouseDown = useEventCallback((event: any) => {\n targetRef.current = getEventTarget(event) as Node | null;\n });\n\n const toggleEvents = (status: boolean, outsideRoot: Element | Document | null) => {\n const isModalRoot =\n outsideRoot instanceof HTMLElement && outsideRoot.dataset.uiName === 'Modal.Overlay';\n if (!isModalRoot) {\n return;\n }\n\n OutsideClick.eventsMap.forEach(([rootElement, events]) => {\n Object.entries(events).forEach(([eventName, handler]) => {\n const method = status ? 'addEventListener' : 'removeEventListener';\n rootElement[method](eventName, handler, true);\n });\n });\n };\n\n React.useEffect(() => {\n const outsideRoot = root ? getNodeByRef(root) : ownerDocument(nodeRef.current as any);\n\n // disable previous events\n toggleEvents(false, outsideRoot);\n\n // Using capture to handle event faster than OutsideClick handler\n outsideRoot?.addEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.addEventListener('mousedown', handleMouseDown, true);\n\n if (outsideRoot) {\n OutsideClick.eventsMap.push([\n outsideRoot,\n {\n mouseup: handleOutsideClick,\n mousedown: handleMouseDown,\n },\n ]);\n }\n\n return () => {\n if (outsideRoot) {\n OutsideClick.eventsMap.pop();\n }\n\n outsideRoot?.removeEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.removeEventListener('mousedown', handleMouseDown, true);\n\n // enabled previous events\n toggleEvents(true, outsideRoot);\n };\n }, [root]);\n\n return children ? cloneElement(children, { ref: handleRef }) : null;\n}\n\nOutsideClick.displayName = 'OutsideClick';\nOutsideClick.eventsMap = [] as RootEventsPair[];\n\nexport default createComponent(OutsideClick) as Intergalactic.Component<\n Intergalactic.Tag,\n OutsideClickProps\n>;\n"],"mappings":";;AAAA,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,CAAC"}
1
+ {"version":3,"file":"OutsideClick.js","names":["React","cloneElement","createComponent","getNodeByRef","useForkRef","ownerDocument","useEventCallback","getOriginChildren","getEventTarget","noop","OutsideClick","props","Children","forwardRef","root","_props$excludeRefs","excludeRefs","_props$onOutsideClick","onOutsideClick","children","nodeRef","useRef","mouseDownInside","handleRef","ref","handleOutsideClick","event","nodesToCheck","concat","_toConsumableArray","map","eventTarget","isTargetEvent","some","node","current","contains","handleMouseDown","toggleEvents","status","outsideRoot","isModalRoot","HTMLElement","dataset","uiName","eventsMap","forEach","_ref","_ref2","_slicedToArray","rootElement","events","Object","entries","_ref3","_ref4","eventName","handler","method","useEffect","addEventListener","push","mouseup","mousedown","pop","removeEventListener","displayName"],"sources":["../../src/OutsideClick.tsx"],"sourcesContent":["import React, { cloneElement, useEffect } from 'react';\nimport createComponent, { IFunctionProps, Intergalactic, UnknownProperties } from '@semcore/core';\nimport { getNodeByRef, NodeByRef, useForkRef } from '@semcore/utils/lib/ref';\nimport ownerDocument from '@semcore/utils/lib/ownerDocument';\nimport useEventCallback from '@semcore/utils/lib/use/useEventCallback';\nimport getOriginChildren from '@semcore/utils/lib/getOriginChildren';\nimport { getEventTarget } from '@semcore/utils/lib/getEventTarget';\n\n/** @deprecated */\nexport interface IOutsideClickProps extends OutsideClickProps, UnknownProperties {}\nexport type OutsideClickProps = {\n /**\n * Function called on click outside the component from excludeRefs\n * @default () => {}\n */\n onOutsideClick?: (e?: React.SyntheticEvent) => void;\n\n /**\n * List of refs that will not trigger `onOutsideClick` when clicked\n * @default []\n */\n excludeRefs?: Array<NodeByRef>;\n\n /** Root element\n * @default document\n * */\n root?: NodeByRef;\n};\n\ntype OutsideClickEvents = { [key in 'mouseup' | 'mousedown']: EventListenerOrEventListenerObject };\ntype RootEventsPair = [Element | Document, OutsideClickEvents];\n\nconst noop = () => {};\nfunction OutsideClick(props: IFunctionProps<IOutsideClickProps>) {\n const { Children, forwardRef, root, excludeRefs = [], onOutsideClick = noop } = props;\n const children = getOriginChildren(Children);\n const nodeRef = React.useRef<Node | null>(null);\n const mouseDownInside = React.useRef<boolean>(false);\n\n const handleRef = useForkRef(children ? children.ref : null, nodeRef, forwardRef!);\n\n const handleOutsideClick = useEventCallback((event: any) => {\n const nodesToCheck = [...(excludeRefs as any), nodeRef].map((ref) => getNodeByRef(ref));\n const eventTarget = getEventTarget(event) as Node | null;\n\n const isTargetEvent = nodesToCheck.some(\n (node) => mouseDownInside.current || node?.contains(eventTarget),\n );\n\n if (!isTargetEvent) {\n onOutsideClick?.(event);\n }\n });\n\n const handleMouseDown = useEventCallback((event: any) => {\n const nodesToCheck = [...(excludeRefs as any), nodeRef].map((ref) => getNodeByRef(ref));\n const eventTarget = getEventTarget(event) as Node | null;\n\n mouseDownInside.current = nodesToCheck.some((node) => node?.contains(eventTarget));\n });\n\n const toggleEvents = (status: boolean, outsideRoot: Element | Document | null) => {\n const isModalRoot =\n outsideRoot instanceof HTMLElement && outsideRoot.dataset.uiName === 'Modal.Overlay';\n if (!isModalRoot) {\n return;\n }\n\n OutsideClick.eventsMap.forEach(([rootElement, events]) => {\n Object.entries(events).forEach(([eventName, handler]) => {\n const method = status ? 'addEventListener' : 'removeEventListener';\n rootElement[method](eventName, handler, true);\n });\n });\n };\n\n React.useEffect(() => {\n const outsideRoot = root ? getNodeByRef(root) : ownerDocument(nodeRef.current as any);\n\n // disable previous events\n toggleEvents(false, outsideRoot);\n\n // Using capture to handle event faster than OutsideClick handler\n outsideRoot?.addEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.addEventListener('mousedown', handleMouseDown, true);\n\n if (outsideRoot) {\n OutsideClick.eventsMap.push([\n outsideRoot,\n {\n mouseup: handleOutsideClick,\n mousedown: handleMouseDown,\n },\n ]);\n }\n\n return () => {\n if (outsideRoot) {\n OutsideClick.eventsMap.pop();\n }\n\n outsideRoot?.removeEventListener('mouseup', handleOutsideClick, true);\n outsideRoot?.removeEventListener('mousedown', handleMouseDown, true);\n\n // enabled previous events\n toggleEvents(true, outsideRoot);\n };\n }, [root]);\n\n return children ? cloneElement(children, { ref: handleRef }) : null;\n}\n\nOutsideClick.displayName = 'OutsideClick';\nOutsideClick.eventsMap = [] as RootEventsPair[];\n\nexport default createComponent(OutsideClick) as Intergalactic.Component<\n Intergalactic.Tag,\n OutsideClickProps\n>;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,YAAY,QAAmB,OAAO;AACtD,OAAOC,eAAe,MAA4D,eAAe;AACjG,SAASC,YAAY,EAAaC,UAAU,QAAQ,wBAAwB;AAC5E,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,gBAAgB,MAAM,yCAAyC;AACtE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,SAASC,cAAc,QAAQ,mCAAmC;;AAElE;;AAwBA,IAAMC,IAAI,GAAG,SAAPA,IAAIA,CAAA,EAAS,CAAC,CAAC;AACrB,SAASC,YAAYA,CAACC,KAAyC,EAAE;EAC/D,IAAQC,QAAQ,GAAgED,KAAK,CAA7EC,QAAQ;IAAEC,UAAU,GAAoDF,KAAK,CAAnEE,UAAU;IAAEC,IAAI,GAA8CH,KAAK,CAAvDG,IAAI;IAAAC,kBAAA,GAA8CJ,KAAK,CAAjDK,WAAW;IAAXA,WAAW,GAAAD,kBAAA,cAAG,EAAE,GAAAA,kBAAA;IAAAE,qBAAA,GAA4BN,KAAK,CAA/BO,cAAc;IAAdA,cAAc,GAAAD,qBAAA,cAAGR,IAAI,GAAAQ,qBAAA;EAC3E,IAAME,QAAQ,GAAGZ,iBAAiB,CAACK,QAAQ,CAAC;EAC5C,IAAMQ,OAAO,GAAGpB,KAAK,CAACqB,MAAM,CAAc,IAAI,CAAC;EAC/C,IAAMC,eAAe,GAAGtB,KAAK,CAACqB,MAAM,CAAU,KAAK,CAAC;EAEpD,IAAME,SAAS,GAAGnB,UAAU,CAACe,QAAQ,GAAGA,QAAQ,CAACK,GAAG,GAAG,IAAI,EAAEJ,OAAO,EAAEP,UAAU,CAA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